CMS 3D CMS Logo

PixelTemplateSmearerBase.h
Go to the documentation of this file.
1 #ifndef FastSimulation_TrackingRecHitProducer_PixelTemplateSmearerBase_h
2 #define FastSimulation_TrackingRecHitProducer_PixelTemplateSmearerBase_h
3 
4 //---------------------------------------------------------------------------
9 //---------------------------------------------------------------------------
10 
11 // FastSim stuff
13 
14 //Framework
16 
17 // PSimHit
19 
20 // Geometry
23 // template object
25 
26 // Vectors
29 
30 // STL. <memory> needed for uniq_ptr<>
31 #include <vector>
32 #include <string>
33 #include <memory>
34 
35 class TFile;
39 
41 public:
42  //--- Use this type to keep track of groups of hits that need to be merged:
43  struct MergeGroup {
44  std::vector<TrackingRecHitProduct::SimHitIdPair> group;
45  bool smearIt;
46  };
47 
48 protected:
49  bool mergeHitsOn = false; // if true then see if neighboring hits might merge
50 
51  //--- Template DB Object(s)
52  const SiPixelTemplateDBObject* pixelTemplateDBObject_ = nullptr; // needed for template<-->DetId map.
53  std::vector<SiPixelTemplateStore> thePixelTemp_; // our own template storage
54  std::vector<SiPixelTemplateStore>& thePixelTempRef = thePixelTemp_; // points to the one we will use.
55  int templateId = -1;
56 
57  //--- Flag to tell us whether we are in barrel or in forward.
58  // This is needed since the parameterization is slightly
59  // different for forward, since all forward detectors cover
60  // a smaller range of local incidence angles and thus
61  // the clusters are shorter and have less charge.
62  bool isBarrel;
63 
64  //--- The histogram storage containers.
65  std::shared_ptr<PixelResolutionHistograms> theEdgePixelResolutions;
67 
68  std::shared_ptr<PixelResolutionHistograms> theBigPixelResolutions;
70 
71  std::shared_ptr<PixelResolutionHistograms> theRegularPixelResolutions;
73 
74  //--- Files with hit merging information:
75  std::unique_ptr<TFile> theMergingProbabilityFile;
77 
78  std::unique_ptr<TFile> theMergedPixelResolutionXFile;
80 
81  std::unique_ptr<TFile> theMergedPixelResolutionYFile;
83 
84 public:
87  edm::ConsumesCollector& consumesCollector);
88 
89  ~PixelTemplateSmearerBase() override;
91  // void beginEvent(edm::Event& event, const edm::EventSetup& eventSetup) override;
92  void beginRun(edm::Run const& run,
94  const SiPixelTemplateDBObject* pixelTemplateDBObjectPtr,
95  std::vector<SiPixelTemplateStore>& tempStoreRef) override;
96  // void endEvent(edm::Event& event, const edm::EventSetup& eventSetup) override;
97 
98  //--- Process all unmerged hits. Calls smearHit() for each.
99  TrackingRecHitProductPtr processUnmergedHits(std::vector<TrackingRecHitProduct::SimHitIdPair>& unmergedHits,
100  TrackingRecHitProductPtr product,
101  const PixelGeomDetUnit* detUnit,
102  const double boundX,
103  const double boundY,
104  RandomEngineAndDistribution const* random) const;
105  //--- Process all groups of merged hits.
106  TrackingRecHitProductPtr processMergeGroups(std::vector<MergeGroup*>& mergeGroups,
107  TrackingRecHitProductPtr product,
108  const PixelGeomDetUnit* detUnit,
109  const double boundX,
110  const double boundY,
111  RandomEngineAndDistribution const* random) const;
112 
113  //--- Process one umerged hit.
115  const PixelGeomDetUnit* detUnit,
116  const double boundX,
117  const double boundY,
118  RandomEngineAndDistribution const*) const;
119 
120  //--- Process one merge group.
122  const PixelGeomDetUnit* detUnit,
123  const double boundX,
124  const double boundY,
125  const RandomEngineAndDistribution* random) const;
126 
127  //--- Method to decide if the two hits on the same DetUnit are merged, or not.
128  bool hitsMerge(const PSimHit& simHit1, const PSimHit& simHit2) const;
129 };
130 #endif
void beginRun(edm::Run const &run, const edm::EventSetup &eventSetup, const SiPixelTemplateDBObject *pixelTemplateDBObjectPtr, std::vector< SiPixelTemplateStore > &tempStoreRef) override
TrackingRecHitProductPtr processMergeGroups(std::vector< MergeGroup *> &mergeGroups, TrackingRecHitProductPtr product, const PixelGeomDetUnit *detUnit, const double boundX, const double boundY, RandomEngineAndDistribution const *random) const
TrackingRecHitProductPtr processUnmergedHits(std::vector< TrackingRecHitProduct::SimHitIdPair > &unmergedHits, TrackingRecHitProductPtr product, const PixelGeomDetUnit *detUnit, const double boundX, const double boundY, RandomEngineAndDistribution const *random) const
const SiPixelTemplateDBObject * pixelTemplateDBObject_
std::vector< SiPixelTemplateStore > thePixelTemp_
Definition: config.py:1
std::unique_ptr< TFile > theMergingProbabilityFile
std::shared_ptr< TrackingRecHitProduct > TrackingRecHitProductPtr
std::vector< SiPixelTemplateStore > & thePixelTempRef
std::unique_ptr< TFile > theMergedPixelResolutionXFile
bool hitsMerge(const PSimHit &simHit1, const PSimHit &simHit2) const
std::shared_ptr< PixelResolutionHistograms > theBigPixelResolutions
FastSingleTrackerRecHit smearHit(const PSimHit &simHit, const PixelGeomDetUnit *detUnit, const double boundX, const double boundY, RandomEngineAndDistribution const *) const
std::unique_ptr< TFile > theMergedPixelResolutionYFile
std::shared_ptr< PixelResolutionHistograms > theEdgePixelResolutions
FastSingleTrackerRecHit smearMergeGroup(MergeGroup *mg, const PixelGeomDetUnit *detUnit, const double boundX, const double boundY, const RandomEngineAndDistribution *random) const
std::shared_ptr< PixelResolutionHistograms > theRegularPixelResolutions
std::vector< TrackingRecHitProduct::SimHitIdPair > group
PixelTemplateSmearerBase(const std::string &name, const edm::ParameterSet &config, edm::ConsumesCollector &consumesCollector)
Definition: Run.h:45
TrackingRecHitProductPtr process(TrackingRecHitProductPtr product) const override