CMS 3D CMS Logo

Phase2ITValidateRecHitBase.cc
Go to the documentation of this file.
15 
17 
19  : config_(iConfig),
21  topoToken_(esConsumes<TrackerTopology, TrackerTopologyRcd, edm::Transition::BeginRun>()) {
22  edm::LogInfo("Phase2ITValidateRecHitBase") << ">>> Construct Phase2ITValidateRecHitBase ";
23 }
24 
26  tkGeom_ = &iSetup.getData(geomToken_);
27  tTopo_ = &iSetup.getData(topoToken_);
28 }
29 //
30 // -- Book Histograms
31 //
33  edm::Run const& iRun,
34  edm::EventSetup const& iSetup) {
35  std::string top_folder = config_.getParameter<std::string>("TopFolderName");
36  edm::LogInfo("Phase2ITValidateRecHitBase") << " Booking Histograms in : " << top_folder;
37  edm::ESWatcher<TrackerDigiGeometryRecord> theTkDigiGeomWatcher;
38  if (theTkDigiGeomWatcher.check(iSetup)) {
39  for (auto const& det_u : tkGeom_->detUnits()) {
40  //Always check TrackerNumberingBuilder before changing this part
41  if (!(det_u->subDetector() == GeomDetEnumerators::SubDetector::P2PXB ||
42  det_u->subDetector() == GeomDetEnumerators::SubDetector::P2PXEC))
43  continue;
44  unsigned int detId_raw = det_u->geographicalId().rawId();
45  bookLayerHistos(ibooker, detId_raw, top_folder);
46  }
47  }
48 }
49 
50 //
52  ibooker.cd();
54  if (key.empty())
55  return;
56  if (layerMEs_.find(key) == layerMEs_.end()) {
57  ibooker.cd();
58  RecHitME local_histos;
59  ibooker.setCurrentFolder(subdir + "/" + key);
60  edm::LogInfo("Phase2ITValidateRecHit") << " Booking Histograms in : " << (subdir + "/" + key);
61 
62  local_histos.deltaX = phase2tkutil::book1DFromPSet(config_.getParameter<edm::ParameterSet>("DeltaX"), ibooker);
63 
64  local_histos.deltaY = phase2tkutil::book1DFromPSet(config_.getParameter<edm::ParameterSet>("DeltaY"), ibooker);
65 
66  local_histos.pullX = phase2tkutil::book1DFromPSet(config_.getParameter<edm::ParameterSet>("PullX"), ibooker);
67 
68  local_histos.pullY = phase2tkutil::book1DFromPSet(config_.getParameter<edm::ParameterSet>("PullY"), ibooker);
69 
70  local_histos.deltaX_eta =
72 
73  local_histos.deltaX_phi =
75 
76  local_histos.deltaY_eta =
78 
79  local_histos.deltaY_phi =
81 
82  local_histos.deltaX_clsizex =
84 
85  local_histos.deltaX_clsizey =
87 
88  local_histos.deltaY_clsizex =
90 
91  local_histos.deltaY_clsizey =
93 
94  local_histos.deltaYvsdeltaX =
96 
97  local_histos.pullX_eta =
99 
100  local_histos.pullY_eta =
102  ibooker.setCurrentFolder(subdir + "/" + key + "/PrimarySimHits");
103  //all histos for Primary particles
104  local_histos.numberRecHitsprimary =
106 
107  local_histos.deltaX_primary =
109 
110  local_histos.deltaY_primary =
112 
113  local_histos.pullX_primary =
115 
116  local_histos.pullY_primary =
118 
119  layerMEs_.emplace(key, local_histos);
120  }
121 }
122 
124  const SiPixelRecHit* rechit,
125  const std::map<unsigned int, SimTrack>& selectedSimTrackMap,
126  std::map<std::string, unsigned int>& nrechitLayerMap_primary) {
127  auto id = rechit->geographicalId();
129  const GeomDetUnit* geomDetunit(tkGeom_->idToDetUnit(id));
130  if (!geomDetunit)
131  return;
132 
133  LocalPoint lp = rechit->localPosition();
134  auto simTrackIt(selectedSimTrackMap.find(simhitClosest->trackId()));
135  bool isPrimary = false;
136  //check if simhit is primary
137  if (simTrackIt != selectedSimTrackMap.end())
138  isPrimary = phase2tkutil::isPrimary(simTrackIt->second, simhitClosest);
139 
140  Local3DPoint simlp(simhitClosest->localPosition());
141  const LocalError& lperr = rechit->localPositionError();
142  double dx = phase2tkutil::cmtomicron * (lp.x() - simlp.x());
143  double dy = phase2tkutil::cmtomicron * (lp.y() - simlp.y());
144  double pullx = 999.;
145  double pully = 999.;
146  if (lperr.xx())
147  pullx = (lp.x() - simlp.x()) / std::sqrt(lperr.xx());
148  if (lperr.yy())
149  pully = (lp.y() - simlp.y()) / std::sqrt(lperr.yy());
150  float eta = geomDetunit->surface().toGlobal(lp).eta();
151  float phi = geomDetunit->surface().toGlobal(lp).phi();
152  layerMEs_[key].deltaX->Fill(dx);
153  layerMEs_[key].deltaY->Fill(dy);
154  layerMEs_[key].pullX->Fill(pullx);
155  layerMEs_[key].pullY->Fill(pully);
156 
157  layerMEs_[key].deltaX_eta->Fill(std::abs(eta), dx);
158  layerMEs_[key].deltaY_eta->Fill(std::abs(eta), dy);
159  layerMEs_[key].deltaX_phi->Fill(phi, dx);
160  layerMEs_[key].deltaY_phi->Fill(phi, dy);
161 
162  layerMEs_[key].deltaX_clsizex->Fill(rechit->cluster()->sizeX(), dx);
163  layerMEs_[key].deltaX_clsizey->Fill(rechit->cluster()->sizeY(), dx);
164  layerMEs_[key].deltaY_clsizex->Fill(rechit->cluster()->sizeX(), dy);
165  layerMEs_[key].deltaY_clsizey->Fill(rechit->cluster()->sizeY(), dy);
166  layerMEs_[key].deltaYvsdeltaX->Fill(dx, dy);
167  layerMEs_[key].pullX_eta->Fill(eta, pullx);
168  layerMEs_[key].pullY_eta->Fill(eta, pully);
169  if (isPrimary) {
170  layerMEs_[key].deltaX_primary->Fill(dx);
171  layerMEs_[key].deltaY_primary->Fill(dy);
172  layerMEs_[key].pullX_primary->Fill(pullx);
173  layerMEs_[key].pullY_primary->Fill(pully);
174  } else {
175  nrechitLayerMap_primary[key]--;
176  }
177 }
178 
181  psd0.add<std::string>("name", "Delta_X");
182  psd0.add<std::string>("title", "Delta_X;RecHit resolution X coordinate [#mum]");
183  psd0.add<bool>("switch", true);
184  psd0.add<double>("xmin", -100.0);
185  psd0.add<double>("xmax", 100.0);
186  psd0.add<int>("NxBins", 100);
187  desc.add<edm::ParameterSetDescription>("DeltaX", psd0);
188 
190  psd1.add<std::string>("name", "Delta_Y");
191  psd1.add<std::string>("title", "Delta_Y;RecHit resolution Y coordinate [#mum];");
192  psd1.add<bool>("switch", true);
193  psd1.add<double>("xmin", -100.0);
194  psd1.add<double>("xmax", 100.0);
195  psd1.add<int>("NxBins", 100);
196  desc.add<edm::ParameterSetDescription>("DeltaY", psd1);
197 
199  psd2.add<std::string>("name", "Pull_X");
200  psd2.add<std::string>("title", "Pull_X;pull x;");
201  psd2.add<double>("xmin", -4.0);
202  psd2.add<bool>("switch", true);
203  psd2.add<double>("xmax", 4.0);
204  psd2.add<int>("NxBins", 100);
205  desc.add<edm::ParameterSetDescription>("PullX", psd2);
206 
208  psd3.add<std::string>("name", "Pull_Y");
209  psd3.add<std::string>("title", "Pull_Y;pull y;");
210  psd3.add<double>("xmin", -4.0);
211  psd3.add<bool>("switch", true);
212  psd3.add<double>("xmax", 4.0);
213  psd3.add<int>("NxBins", 100);
214  desc.add<edm::ParameterSetDescription>("PullY", psd3);
215 
217  psd4.add<std::string>("name", "Delta_X_vs_Eta");
218  psd4.add<std::string>("title", "Delta_X_vs_Eta;|#eta|;#Delta x [#mum]");
219  psd4.add<int>("NyBins", 100);
220  psd4.add<double>("ymin", -100.0);
221  psd4.add<double>("ymax", 100.0);
222  psd4.add<int>("NxBins", 41);
223  psd4.add<bool>("switch", true);
224  psd4.add<double>("xmax", 4.1);
225  psd4.add<double>("xmin", 0.);
226  desc.add<edm::ParameterSetDescription>("DeltaX_eta", psd4);
227 
229  psd4_y.add<std::string>("name", "Delta_X_vs_Phi");
230  ;
231  psd4_y.add<std::string>("title", "Delta_X_vs_Phi;#phi;#Delta x [#mum]");
232  psd4_y.add<int>("NyBins", 100);
233  psd4_y.add<double>("ymin", -100.0);
234  psd4_y.add<double>("ymax", 100.0);
235  psd4_y.add<int>("NxBins", 36);
236  psd4_y.add<bool>("switch", true);
237  psd4_y.add<double>("xmax", M_PI);
238  psd4_y.add<double>("xmin", -M_PI);
239  desc.add<edm::ParameterSetDescription>("DeltaX_phi", psd4_y);
240 
242  psd5.add<std::string>("name", "Delta_Y_vs_Eta");
243  psd5.add<std::string>("title", "Delta_Y_vs_Eta;|#eta|;#Delta y [#mum]");
244  psd5.add<int>("NyBins", 100);
245  psd5.add<double>("ymin", -100.0);
246  psd5.add<double>("ymax", 100.0);
247  psd5.add<int>("NxBins", 41);
248  psd5.add<bool>("switch", true);
249  psd5.add<double>("xmax", 4.1);
250  psd5.add<double>("xmin", 0.);
251  desc.add<edm::ParameterSetDescription>("DeltaY_eta", psd5);
252 
254  psd5_y.add<std::string>("name", "Delta_Y_vs_Phi");
255  psd5_y.add<std::string>("title", "Delta_Y_vs_Phi;#phi;#Delta y [#mum]");
256  psd5_y.add<int>("NyBins", 100);
257  psd5_y.add<double>("ymin", -100.0);
258  psd5_y.add<double>("ymax", 100.0);
259  psd5_y.add<int>("NxBins", 36);
260  psd5_y.add<bool>("switch", true);
261  psd5_y.add<double>("xmax", M_PI);
262  psd5_y.add<double>("xmin", -M_PI);
263  desc.add<edm::ParameterSetDescription>("DeltaY_phi", psd5_y);
264 
266  psd6.add<std::string>("name", "Delta_X_vs_ClusterSizeX");
267  psd6.add<std::string>("title", ";Cluster size X;#Delta x [#mum]");
268  psd6.add<double>("ymin", -100.0);
269  psd6.add<double>("ymax", 100.0);
270  psd6.add<int>("NxBins", 21);
271  psd6.add<bool>("switch", true);
272  psd6.add<double>("xmax", 20.5);
273  psd6.add<double>("xmin", -0.5);
274  desc.add<edm::ParameterSetDescription>("DeltaX_clsizex", psd6);
275 
277  psd7.add<std::string>("name", "Delta_X_vs_ClusterSizeY");
278  psd7.add<std::string>("title", ";Cluster size Y;#Delta x [#mum]");
279  psd7.add<double>("ymin", -100.0);
280  psd7.add<double>("ymax", 100.0);
281  psd7.add<int>("NxBins", 21);
282  psd7.add<bool>("switch", true);
283  psd7.add<double>("xmax", 20.5);
284  psd7.add<double>("xmin", -0.5);
285  desc.add<edm::ParameterSetDescription>("DeltaX_clsizey", psd7);
286 
288  psd8.add<std::string>("name", "Delta_Y_vs_ClusterSizeX");
289  psd8.add<std::string>("title", ";Cluster size X;#Delta y [#mum]");
290  psd8.add<double>("ymin", -100.0);
291  psd8.add<double>("ymax", 100.0);
292  psd8.add<int>("NxBins", 21);
293  psd8.add<bool>("switch", true);
294  psd8.add<double>("xmax", 20.5);
295  psd8.add<double>("xmin", -0.5);
296  desc.add<edm::ParameterSetDescription>("DeltaY_clsizex", psd8);
297 
299  psd9.add<std::string>("name", "Delta_Y_vs_ClusterSizeY");
300  psd9.add<std::string>("title", ";Cluster size Y;#Delta y [#mum]");
301  psd9.add<double>("ymin", -100.0);
302  psd9.add<double>("ymax", 100.0);
303  psd9.add<int>("NxBins", 21);
304  psd9.add<bool>("switch", true);
305  psd9.add<double>("xmax", 20.5);
306  psd9.add<double>("xmin", -0.5);
307  desc.add<edm::ParameterSetDescription>("DeltaY_clsizey", psd9);
308 
310  psd10.add<std::string>("name", "Delta_Y_vs_DeltaX");
311  psd10.add<std::string>("title", ";#Delta x[#mum];#Delta y[#mum]");
312  psd10.add<bool>("switch", true);
313  psd10.add<double>("ymin", -100.0);
314  psd10.add<double>("ymax", 100.0);
315  psd10.add<int>("NyBins", 100);
316  psd10.add<double>("xmax", 100.);
317  psd10.add<double>("xmin", -100.);
318  psd10.add<int>("NxBins", 100);
319  desc.add<edm::ParameterSetDescription>("DeltaY_vs_DeltaX", psd10);
320 
322  psd11.add<std::string>("name", "Pull_X_vs_Eta");
323  psd11.add<std::string>("title", "Pull_X_vs_Eta;#eta;pull x");
324  psd11.add<double>("ymax", 4.0);
325  psd11.add<int>("NxBins", 82);
326  psd11.add<bool>("switch", true);
327  psd11.add<double>("xmax", 4.1);
328  psd11.add<double>("xmin", -4.1);
329  psd11.add<double>("ymin", -4.0);
330  desc.add<edm::ParameterSetDescription>("PullX_eta", psd11);
331 
333  psd12.add<std::string>("name", "Pull_Y_vs_Eta");
334  psd12.add<std::string>("title", "Pull_Y_vs_Eta;#eta;pull y");
335  psd12.add<double>("ymax", 4.0);
336  psd12.add<int>("NxBins", 82);
337  psd12.add<bool>("switch", true);
338  psd12.add<double>("xmax", 4.1);
339  psd12.add<double>("xmin", -4.1);
340  psd12.add<double>("ymin", -4.0);
341  desc.add<edm::ParameterSetDescription>("PullY_eta", psd12);
342 
343  //simhits primary
344 
346  psd13.add<std::string>("name", "Number_RecHits_matched_PrimarySimTrack");
347  psd13.add<std::string>("title", "Number of RecHits matched to primary SimTrack;;");
348  psd13.add<double>("xmin", 0.0);
349  psd13.add<bool>("switch", true);
350  psd13.add<double>("xmax", 0.0);
351  psd13.add<int>("NxBins", 100);
352  desc.add<edm::ParameterSetDescription>("nRecHits_primary", psd13);
353 
355  psd14.add<std::string>("name", "Delta_X_SimHitPrimary");
356  psd14.add<std::string>("title", "Delta_X_SimHitPrimary;#delta x [#mum];");
357  psd14.add<double>("xmin", -100.0);
358  psd14.add<bool>("switch", true);
359  psd14.add<double>("xmax", 100.0);
360  psd14.add<int>("NxBins", 100);
361  desc.add<edm::ParameterSetDescription>("DeltaX_primary", psd14);
362 
364  psd15.add<std::string>("name", "Delta_Y_SimHitPrimary");
365  psd15.add<std::string>("title", "Delta_Y_SimHitPrimary;#Delta y [#mum];");
366  psd15.add<double>("xmin", -100.0);
367  psd15.add<bool>("switch", true);
368  psd15.add<double>("xmax", 100.0);
369  psd15.add<int>("NxBins", 100);
370  desc.add<edm::ParameterSetDescription>("DeltaY_primary", psd15);
371 
373  psd16.add<std::string>("name", "Pull_X_SimHitPrimary");
374  psd16.add<std::string>("title", "Pull_X_SimHitPrimary;pull x;");
375  psd16.add<double>("ymax", 4.0);
376  psd16.add<int>("NxBins", 82);
377  psd16.add<bool>("switch", true);
378  psd16.add<double>("xmax", 4.1);
379  psd16.add<double>("xmin", -4.1);
380  psd16.add<double>("ymin", -4.0);
381  desc.add<edm::ParameterSetDescription>("PullX_primary", psd16);
382 
384  psd17.add<std::string>("name", "Pull_Y_SimHitPrimary");
385  psd17.add<std::string>("title", "Pull_Y_SimHitPrimary;pull y;");
386  psd17.add<double>("ymax", 4.0);
387  psd17.add<int>("NxBins", 82);
388  psd17.add<bool>("switch", true);
389  psd17.add<double>("xmax", 4.1);
390  psd17.add<double>("xmin", -4.1);
391  psd17.add<double>("ymin", -4.0);
392  desc.add<edm::ParameterSetDescription>("PullY_primary", psd17);
393 }
ClusterRef cluster() const
Definition: SiPixelRecHit.h:47
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
MonitorElement * book2DFromPSet(const edm::ParameterSet &hpars, DQMStore::IBooker &ibooker)
std::map< std::string, RecHitME > layerMEs_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
static constexpr float cmtomicron
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
bool isPrimary(const SimTrack &simTrk, const PSimHit *simHit)
MonitorElement * bookProfile1DFromPSet(const edm::ParameterSet &hpars, DQMStore::IBooker &ibooker)
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
std::string getITHistoId(uint32_t det_id, const TrackerTopology *tTopo)
void bookLayerHistos(DQMStore::IBooker &ibooker, unsigned int det_id, std::string &subdir)
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
T sqrt(T t)
Definition: SSEVec.h:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Transition
Definition: Transition.h:12
~Phase2ITValidateRecHitBase() override
void bookHistograms(DQMStore::IBooker &ibooker, edm::Run const &iRun, edm::EventSetup const &iSetup) override
unsigned int trackId() const
Definition: PSimHit.h:108
ParameterDescriptionBase * add(U const &iLabel, T const &value)
MonitorElement * book1DFromPSet(const edm::ParameterSet &hpars, DQMStore::IBooker &ibooker)
static void fillPSetDescription(edm::ParameterSetDescription &desc)
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
#define M_PI
Log< level::Info, false > LogInfo
LocalError localPositionError() const override
Phase2ITValidateRecHitBase(const edm::ParameterSet &)
DetId geographicalId() const
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_
Local3DPoint localPosition() const
Definition: PSimHit.h:54
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
HLT enums.
LocalPoint localPosition() const override
void fillRechitHistos(const PSimHit *simhitClosest, const SiPixelRecHit *rechit, const std::map< unsigned int, SimTrack > &selectedSimTrackMap, std::map< std::string, unsigned int > &nrechitLayerMap_primary)
Definition: Run.h:45
Our base class.
Definition: SiPixelRecHit.h:23