CMS 3D CMS Logo

Phase2TrackerDigitizer.h
Go to the documentation of this file.
1 #ifndef __SimTracker_SiPhase2Digitizer_Phase2TrackerDigitizer_h
2 #define __SimTracker_SiPhase2Digitizer_Phase2TrackerDigitizer_h
3 
4 //-------------------------------------------------------------
5 // class Phase2TrackerDigitizer
6 //
7 // Phase2TrackerDigitizer produces digis from SimHits
8 // The real algorithm is in Phase2TrackerDigitizerAlgorithm
9 //
10 // Author: Suchandra Dutta, Suvankar Roy Chowdhury, Subir Sarkar
11 //
12 //--------------------------------------------------------------
13 
14 #include <map>
15 #include <string>
16 #include <vector>
17 
26 
27 #include <unordered_map>
28 
29 // Forward declaration
30 namespace CLHEP {
31  class HepRandomEngine;
32 }
33 
34 namespace edm {
35  class Event;
36  class EventSetup;
37  class ParameterSet;
38  template <typename T>
39  class Handle;
40  class ConsumesCollector;
41 } // namespace edm
42 
43 class MagneticField;
45 class PSimHit;
48 
49 namespace cms {
51  public:
52  typedef std::unordered_map<unsigned, TrackerGeometry::ModuleType> ModuleTypeCache;
53 
54  explicit Phase2TrackerDigitizer(const edm::ParameterSet& iConfig,
57  ~Phase2TrackerDigitizer() override;
58  void initializeEvent(edm::Event const& e, edm::EventSetup const& c) override;
59  void accumulate(edm::Event const& e, edm::EventSetup const& c) override;
60  void accumulate(PileUpEventPrincipal const& e, edm::EventSetup const& c, edm::StreamID const&) override;
61  void finalizeEvent(edm::Event& e, edm::EventSetup const& c) override;
62  virtual void beginJob() {}
63  void beginLuminosityBlock(edm::LuminosityBlock const& lumi, edm::EventSetup const& iSetup) override;
64 
65  template <class T>
66  void accumulate_local(T const& iEvent, edm::EventSetup const& iSetup);
67 
68  // For premixing
69  void loadAccumulator(const std::map<unsigned int, std::map<int, float> >& accumulator);
70 
71  private:
72  using vstring = std::vector<std::string>;
73 
74  // constants of different algorithm types
75  enum class AlgorithmType { InnerPixel, PixelinPS, StripinPS, TwoStrip, Unknown };
76  AlgorithmType getAlgoType(unsigned int idet);
77 
78  void accumulatePixelHits(edm::Handle<std::vector<PSimHit> >, size_t globalSimHitIndex, const unsigned int tofBin);
79  void addPixelCollection(edm::Event& iEvent, const edm::EventSetup& iSetup, const bool ot_analog);
80 
81  // Templated for premixing
82  template <typename DigiType>
83  void addOuterTrackerCollection(edm::Event& iEvent, const edm::EventSetup& iSetup);
84 
85  bool first_;
86 
95  std::map<std::string, size_t> crossingSimHitIndexOffset_;
96  std::map<AlgorithmType, std::unique_ptr<Phase2TrackerDigitizerAlgorithm> > algomap_;
102  std::map<unsigned int, const Phase2TrackerGeomDetUnit*> detectorUnits_;
106  const bool premixStage1_;
107  const bool makeDigiSimLinks_;
108  // cache for detector types
109  ModuleTypeCache moduleTypeCache_;
110  };
111 } // namespace cms
112 #endif
edm::ESWatcher< TrackerDigiGeometryRecord > theTkDigiGeomWatcher
std::unordered_map< unsigned, TrackerGeometry::ModuleType > ModuleTypeCache
std::map< unsigned int, const Phase2TrackerGeomDetUnit * > detectorUnits_
int iEvent
Definition: GenABIO.cc:224
edm::ESHandle< TrackerTopology > tTopoHand
edm::ESHandle< TrackerGeometry > pDD_
Namespace of DDCMS conversion namespace.
edm::ESHandle< MagneticField > pSetup_
std::map< AlgorithmType, std::unique_ptr< Phase2TrackerDigitizerAlgorithm > > algomap_
HLT enums.
long double T
std::vector< std::string > vstring
std::map< std::string, size_t > crossingSimHitIndexOffset_
Offset to add to the index of each sim hit to account for which crossing it&#39;s in. ...