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,
93  const edm::EventSetup& eventSetup,
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
PixelTemplateSmearerBase::theEdgePixelResolutionFileName
std::string theEdgePixelResolutionFileName
Definition: PixelTemplateSmearerBase.h:66
PixelTemplateSmearerBase::theMergedPixelResolutionYFileName
std::string theMergedPixelResolutionYFileName
Definition: PixelTemplateSmearerBase.h:82
PixelTemplateSmearerBase::pixelTemplateDBObject_
const SiPixelTemplateDBObject * pixelTemplateDBObject_
Definition: PixelTemplateSmearerBase.h:52
PixelTemplateSmearerBase::theMergingProbabilityFile
std::unique_ptr< TFile > theMergingProbabilityFile
Definition: PixelTemplateSmearerBase.h:75
PixelTemplateSmearerBase::theMergedPixelResolutionXFile
std::unique_ptr< TFile > theMergedPixelResolutionXFile
Definition: PixelTemplateSmearerBase.h:78
edm::Run
Definition: Run.h:45
PixelTemplateSmearerBase::MergeGroup::group
std::vector< TrackingRecHitProduct::SimHitIdPair > group
Definition: PixelTemplateSmearerBase.h:44
PixelTemplateSmearerBase::hitsMerge
bool hitsMerge(const PSimHit &simHit1, const PSimHit &simHit2) const
Definition: PixelTemplateSmearerBase.cc:929
GeomDetType.h
PixelTemplateSmearerBase::theBigPixelResolutions
std::shared_ptr< PixelResolutionHistograms > theBigPixelResolutions
Definition: PixelTemplateSmearerBase.h:68
PixelTemplateSmearerBase::MergeGroup
Definition: PixelTemplateSmearerBase.h:43
Point3DBase.h
PixelTemplateSmearerBase::theMergingProbabilityFileName
std::string theMergingProbabilityFileName
Definition: PixelTemplateSmearerBase.h:76
config
Definition: config.py:1
PixelTemplateSmearerBase::processUnmergedHits
TrackingRecHitProductPtr processUnmergedHits(std::vector< TrackingRecHitProduct::SimHitIdPair > &unmergedHits, TrackingRecHitProductPtr product, const PixelGeomDetUnit *detUnit, const double boundX, const double boundY, RandomEngineAndDistribution const *random) const
Definition: PixelTemplateSmearerBase.cc:667
PixelTemplateSmearerBase::theRegularPixelResolutionFileName
std::string theRegularPixelResolutionFileName
Definition: PixelTemplateSmearerBase.h:72
PixelTemplateSmearerBase::smearMergeGroup
FastSingleTrackerRecHit smearMergeGroup(MergeGroup *mg, const PixelGeomDetUnit *detUnit, const double boundX, const double boundY, const RandomEngineAndDistribution *random) const
Definition: PixelTemplateSmearerBase.cc:702
SiPixelTemplate.h
PSimHit.h
PixelTemplateSmearerBase::~PixelTemplateSmearerBase
~PixelTemplateSmearerBase() override
Definition: PixelTemplateSmearerBase.cc:128
TrackingRecHitProductPtr
std::shared_ptr< TrackingRecHitProduct > TrackingRecHitProductPtr
Definition: TrackingRecHitProduct.h:47
LocalError.h
rpcPointValidation_cfi.simHit
simHit
Definition: rpcPointValidation_cfi.py:24
PixelGeomDetUnit
Definition: PixelGeomDetUnit.h:15
PixelTemplateSmearerBase::thePixelTemp_
std::vector< SiPixelTemplateStore > thePixelTemp_
Definition: PixelTemplateSmearerBase.h:53
PixelTemplateSmearerBase::theEdgePixelResolutions
std::shared_ptr< PixelResolutionHistograms > theEdgePixelResolutions
Definition: PixelTemplateSmearerBase.h:65
PixelTemplateSmearerBase::theBigPixelResolutionFileName
std::string theBigPixelResolutionFileName
Definition: PixelTemplateSmearerBase.h:69
PixelTemplateSmearerBase::MergeGroup::smearIt
bool smearIt
Definition: PixelTemplateSmearerBase.h:45
PixelTemplateSmearerBase::PixelTemplateSmearerBase
PixelTemplateSmearerBase(const std::string &name, const edm::ParameterSet &config, edm::ConsumesCollector &consumesCollector)
Definition: PixelTemplateSmearerBase.cc:46
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
FastSingleTrackerRecHit
Definition: FastSingleTrackerRecHit.h:7
SiPixelTemplateDBObject
Definition: SiPixelTemplateDBObject.h:16
SimpleHistogramGenerator
Definition: SimpleHistogramGenerator.h:21
PixelTemplateSmearerBase::smearHit
FastSingleTrackerRecHit smearHit(const PSimHit &simHit, const PixelGeomDetUnit *detUnit, const double boundX, const double boundY, RandomEngineAndDistribution const *) const
Definition: PixelTemplateSmearerBase.cc:318
edm::EventSetup
Definition: EventSetup.h:57
PixelTemplateSmearerBase::beginRun
void beginRun(edm::Run const &run, const edm::EventSetup &eventSetup, const SiPixelTemplateDBObject *pixelTemplateDBObjectPtr, std::vector< SiPixelTemplateStore > &tempStoreRef) override
Definition: PixelTemplateSmearerBase.cc:140
PixelResolutionHistograms
Definition: PixelResolutionHistograms.h:22
PixelTemplateSmearerBase::theRegularPixelResolutions
std::shared_ptr< PixelResolutionHistograms > theRegularPixelResolutions
Definition: PixelTemplateSmearerBase.h:71
PixelTemplateSmearerBase::templateId
int templateId
Definition: PixelTemplateSmearerBase.h:55
writedatasetfile.run
run
Definition: writedatasetfile.py:27
PixelTemplateSmearerBase::theMergedPixelResolutionXFileName
std::string theMergedPixelResolutionXFileName
Definition: PixelTemplateSmearerBase.h:79
PixelTemplateSmearerBase::processMergeGroups
TrackingRecHitProductPtr processMergeGroups(std::vector< MergeGroup * > &mergeGroups, TrackingRecHitProductPtr product, const PixelGeomDetUnit *detUnit, const double boundX, const double boundY, RandomEngineAndDistribution const *random) const
Definition: PixelTemplateSmearerBase.cc:684
TrackingRecHitAlgorithm.h
PixelTemplateSmearerBase::thePixelTempRef
std::vector< SiPixelTemplateStore > & thePixelTempRef
Definition: PixelTemplateSmearerBase.h:54
PixelTemplateSmearerBase::process
TrackingRecHitProductPtr process(TrackingRecHitProductPtr product) const override
Definition: PixelTemplateSmearerBase.cc:175
PixelGeomDetUnit.h
TrackingRecHitAlgorithm
Definition: TrackingRecHitAlgorithm.h:26
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
ParameterSet.h
PixelTemplateSmearerBase::isBarrel
bool isBarrel
Definition: PixelTemplateSmearerBase.h:62
PSimHit
Definition: PSimHit.h:15
PixelTemplateSmearerBase
Definition: PixelTemplateSmearerBase.h:40
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
PixelTemplateSmearerBase::mergeHitsOn
bool mergeHitsOn
Definition: PixelTemplateSmearerBase.h:49
PixelTemplateSmearerBase::theMergedPixelResolutionYFile
std::unique_ptr< TFile > theMergedPixelResolutionYFile
Definition: PixelTemplateSmearerBase.h:81
RandomEngineAndDistribution
Definition: RandomEngineAndDistribution.h:18