Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-06-04 01:26:22

0001 #ifndef SimTracker_SiPixelDigitizer_SiPixelChargeReweightingAlgorithm_h
0002 #define SimTracker_SiPixelDigitizer_SiPixelChargeReweightingAlgorithm_h
0003 
0004 #include "CondFormats/DataRecord/interface/SiPixel2DTemplateDBObjectRcd.h"
0005 #include "CondFormats/SiPixelObjects/interface/SiPixel2DTemplateDBObject.h"
0006 #include "FWCore/Framework/interface/FrameworkfwdMostUsed.h"
0007 #include "SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizerAlgorithm.h"
0008 
0009 // forward declarations
0010 class DetId;
0011 class GaussianTailNoiseGenerator;
0012 class PixelDigi;
0013 class PixelDigiSimLink;
0014 class PixelGeomDetUnit;
0015 class SiG4UniversalFluctuation;
0016 
0017 class SiPixelChargeReweightingAlgorithm {
0018 public:
0019   SiPixelChargeReweightingAlgorithm(const edm::ParameterSet& conf, edm::ConsumesCollector iC);
0020   ~SiPixelChargeReweightingAlgorithm();
0021 
0022   // initialization that cannot be done in the constructor
0023   void init(const edm::EventSetup& es);
0024 
0025   typedef std::map<int, SiPixelDigitizerAlgorithm::Amplitude, std::less<int> > signal_map_type;  // from Digi.Skel.
0026   typedef signal_map_type::iterator signal_map_iterator;                                         // from Digi.Skel.
0027   typedef signal_map_type::const_iterator signal_map_const_iterator;                             // from Digi.Skel.
0028 
0029   bool hitSignalReweight(const PSimHit& hit,
0030                          std::map<int, float, std::less<int> >& hit_signal,
0031                          const size_t hitIndex,
0032                          const size_t hitIndex4CR,
0033                          const unsigned int tofBin,
0034                          const PixelTopology* topol,
0035                          uint32_t detID,
0036                          signal_map_type& theSignal,
0037                          unsigned short int processType,
0038                          const bool& boolmakeDigiSimLinks);
0039 
0040   bool lateSignalReweight(const PixelGeomDetUnit* pixdet,
0041                           std::vector<PixelDigi>& digis,
0042                           PixelSimHitExtraInfo& loopTempSH,
0043                           signal_map_type& theNewDigiSignal,
0044                           const TrackerTopology* tTopo,
0045                           CLHEP::HepRandomEngine* engine);
0046 
0047 private:
0048   // Internal typedef
0049   typedef std::map<uint32_t, signal_map_type> signalMaps;
0050   typedef GloballyPositioned<double> Frame;
0051   typedef std::vector<edm::ParameterSet> Parameters;
0052   typedef boost::multi_array<float, 2> array_2d;
0053 
0054   // Variables and objects for the charge reweighting using 2D templates
0055   SiPixelTemplate2D templ2D;
0056   std::vector<bool> xdouble;
0057   std::vector<bool> ydouble;
0058   std::vector<float> track;
0059   int IDnum, IDden;
0060 
0061   const bool UseReweighting;
0062   bool applyLateReweighting_;
0063   const bool PrintClusters;
0064   const bool PrintTemplates;
0065 
0066   static constexpr float cmToMicrons = 10000.f;
0067 
0068   std::vector<SiPixelTemplateStore2D> templateStores_;
0069 
0070   edm::ESGetToken<SiPixel2DTemplateDBObject, SiPixel2DTemplateDBObjectRcd> SiPixel2DTemp_den_token_;
0071   edm::ESGetToken<SiPixel2DTemplateDBObject, SiPixel2DTemplateDBObjectRcd> SiPixel2DTemp_num_token_;
0072   const SiPixel2DTemplateDBObject* dbobject_den;
0073   const SiPixel2DTemplateDBObject* dbobject_num;
0074 
0075   // methods for charge reweighting in irradiated sensors
0076   int PixelTempRewgt2D(int id_gen, int id_rewgt, array_2d& cluster);
0077   void printCluster(array_2d& cluster);
0078   void printCluster(float arr[BXM2][BYM2]);
0079   void printCluster(float arr[TXSIZE][TYSIZE]);
0080 };
0081 
0082 #endif