CMS 3D CMS Logo

SiStripLorentzAnglePCLMonitor.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: CalibTracker/SiStripLorentzAnglePCLMonitor
4 // Class: SiStripLorentzAnglePCLMonitor
5 //
13 //
14 // Original Author: musich
15 // Created: Sun, 07 May 2023 16:57:10 GMT
16 //
17 //
18 
19 // system includes
20 #include <string>
21 #include <fmt/format.h>
22 #include <fmt/printf.h>
23 
24 // user include files
51 
52 // ROOT includes
53 #include "TVector3.h"
54 
55 //
56 // class declaration
57 //
58 
60 public:
62  ~SiStripLorentzAnglePCLMonitor() override = default;
63 
64  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
65 
66 private:
67  void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
68  void analyze(const edm::Event&, const edm::EventSetup&) override;
69  void dqmBeginRun(edm::Run const&, edm::EventSetup const&) override;
70 
71  std::string moduleLocationType(const uint32_t& mod, const TrackerTopology* tTopo);
72 
73  // ------------ member data ------------
76 
77  // for magnetic field conversion
78  static constexpr float teslaToInverseGeV_ = 2.99792458e-3f;
79 
83  const bool saveHistosMods_;
87 
93 
94  struct OnTrackCluster {
95  uint32_t det;
97  const Trajectory* traj;
102  const Trajectory* trajectory,
103  const reco::Track* track_,
104  const TrajectoryMeasurement& measurement_)
105  : det{detId}, cluster{stripCluster}, traj{trajectory}, track{track_}, measurement{measurement_} {}
106  };
107 };
108 
110  : m_clusterInfo(consumesCollector()),
111  mismatchedBField_{false},
112  mismatchedLatency_{false},
113  folder_(iConfig.getParameter<std::string>("folder")),
114  saveHistosMods_(iConfig.getParameter<bool>("saveHistoMods")),
115  m_tracks_token(consumes<edm::View<reco::Track>>(iConfig.getParameter<edm::InputTag>("Tracks"))),
116  m_association_token(consumes<TrajTrackAssociationCollection>(iConfig.getParameter<edm::InputTag>("Tracks"))),
117  m_tkGeomToken{esConsumes<>()},
118  m_latencyTokenBR{esConsumes<edm::Transition::BeginRun>()},
119  m_topoEsTokenBR{esConsumes<edm::Transition::BeginRun>()},
120  m_tkGeomTokenBR{esConsumes<edm::Transition::BeginRun>()},
121  m_magFieldTokenBR{esConsumes<edm::Transition::BeginRun>()},
122  m_lorentzAngleTokenBR{esConsumes<edm::Transition::BeginRun>()} {}
123 //
124 // member functions
125 //
126 
128  const auto& tkGeom = iSetup.getData(m_tkGeomTokenBR);
129  const auto& magField = iSetup.getData(m_magFieldTokenBR);
130  const auto& lorentzAngle = iSetup.getData(m_lorentzAngleTokenBR);
131  const TrackerTopology* tTopo = &iSetup.getData(m_topoEsTokenBR);
132 
133  // fast cachecd access
134  const auto& theMagField = 1.f / (magField.inverseBzAtOriginInGeV() * teslaToInverseGeV_);
135 
136  if (iHists_.bfield_.empty()) {
138  } else {
140  mismatchedBField_ = true;
141  }
142  }
143 
144  const SiStripLatency* apvlat = &iSetup.getData(m_latencyTokenBR);
145  if (iHists_.apvmode_.empty()) {
147  } else {
149  mismatchedLatency_ = true;
150  }
151  }
152 
153  std::vector<uint32_t> c_rawid;
154  std::vector<float> c_globalZofunitlocalY, c_localB, c_BdotY, c_driftx, c_drifty, c_driftz, c_lorentzAngle;
155 
156  auto dets = tkGeom.detsTIB();
157  //dets.insert(dets.end(), tkGeom.detsTID().begin(), tkGeom.detsTID().end()); // no LA in endcaps
158  dets.insert(dets.end(), tkGeom.detsTOB().begin(), tkGeom.detsTOB().end());
159  //dets.insert(dets.end(), tkGeom.detsTEC().begin(), tkGeom.detsTEC().end()); // no LA in endcaps
160 
161  for (auto det : dets) {
162  auto detid = det->geographicalId().rawId();
163  const StripGeomDetUnit* stripDet = dynamic_cast<const StripGeomDetUnit*>(tkGeom.idToDet(det->geographicalId()));
164  if (stripDet) {
165  c_rawid.push_back(detid);
166  c_globalZofunitlocalY.push_back(stripDet->toGlobal(LocalVector(0, 1, 0)).z());
167  iHists_.orientation_[detid] = (stripDet->toGlobal(LocalVector(0, 1, 0)).z() < 0 ? -1 : 1);
168  const auto locB = magField.inTesla(stripDet->surface().position());
169  c_localB.push_back(locB.mag());
170  c_BdotY.push_back(stripDet->surface().toLocal(locB).y());
171  const auto drift = shallow::drift(stripDet, magField, lorentzAngle);
172  c_driftx.push_back(drift.x());
173  c_drifty.push_back(drift.y());
174  c_driftz.push_back(drift.z());
175  c_lorentzAngle.push_back(lorentzAngle.getLorentzAngle(detid));
176  iHists_.la_db_[detid] = lorentzAngle.getLorentzAngle(detid);
177  iHists_.moduleLocationType_[detid] = this->moduleLocationType(detid, tTopo);
178  }
179  }
180 
181  // Sorted DetId list gives max performance, anything else is worse
182  std::sort(c_rawid.begin(), c_rawid.end());
183 
184  // initialize the hash map
185  // in case it's not already initialized
186  if (iHists_.hash_.size() == 0) {
187  iHists_.hash_ = SiStripHashedDetId(c_rawid);
188  }
189 
190  //reserve the size of the vector
191  if (saveHistosMods_) {
192  iHists_.h2_ct_w_m_.reserve(c_rawid.size());
193  iHists_.h2_ct_var2_m_.reserve(c_rawid.size());
194  iHists_.h2_ct_var3_m_.reserve(c_rawid.size());
195 
196  iHists_.h2_t_w_m_.reserve(c_rawid.size());
197  iHists_.h2_t_var2_m_.reserve(c_rawid.size());
198  iHists_.h2_t_var3_m_.reserve(c_rawid.size());
199  }
200 }
201 
203  const SiStripDetId detid(mod);
204  std::string subdet = "";
205  unsigned int layer = 0;
206  if (detid.subDetector() == SiStripDetId::TIB) {
207  subdet = "TIB";
208  layer = tTopo->layer(mod);
209  }
210 
211  if (detid.subDetector() == SiStripDetId::TOB) {
212  subdet = "TOB";
213  layer = tTopo->layer(mod);
214  }
215 
216  std::string type = (detid.stereo() ? "s" : "a");
217  std::string d_l_t = Form("%s_L%d%s", subdet.c_str(), layer, type.c_str());
218 
219  if (layer == 0)
220  return subdet;
221  return d_l_t;
222 }
223 
224 // ------------ method called for each event ------------
226  using namespace edm;
227 
228  // return immediately if the field is not consistent!
229  if (mismatchedBField_)
230  return;
231 
232  if (mismatchedLatency_)
233  return;
234 
236  iEvent.getByToken(m_tracks_token, tracks);
237  edm::Handle<TrajTrackAssociationCollection> trajTrackAssociations;
238  iEvent.getByToken(m_association_token, trajTrackAssociations);
239 
240  LogDebug(moduleDescription().moduleName()) << "I AM IN EVENT" << iEvent.id() << std::endl;
241 
242  std::vector<OnTrackCluster> clusters{};
243 
244  // first collect all the clusters
245  for (const auto& assoc : *trajTrackAssociations) {
246  const auto traj = assoc.key.get();
247  const auto track = assoc.val.get();
248 
249  iHists_.h1_["track_pt"]->Fill(track->pt());
250  iHists_.h1_["track_eta"]->Fill(track->eta());
251  iHists_.h1_["track_phi"]->Fill(track->phi());
252  iHists_.h1_["track_validhits"]->Fill(track->numberOfValidHits());
253 
254  const auto normChi2 = track->ndof() > 0 ? track->chi2() / track->ndof() : -1.;
255  iHists_.h1_["track_chi2ndof"]->Fill(normChi2);
256  iHists_.h2_["track_chi2xhits"]->Fill(normChi2, track->numberOfValidHits());
257  iHists_.h2_["track_ptxhits"]->Fill(track->pt(), track->numberOfValidHits());
258  iHists_.h2_["track_etaxhits"]->Fill(track->eta(), track->numberOfValidHits());
259  iHists_.h2_["track_ptxchi2"]->Fill(track->pt(), normChi2);
260  iHists_.h2_["track_ptxeta"]->Fill(track->pt(), track->eta());
261  iHists_.h2_["track_etaxchi2"]->Fill(track->eta(), normChi2);
262 
263  edm::LogInfo("SiStripLorentzAnglePCLMonitor")
264  << " track pT()" << track->pt() << " track eta()" << track->eta() << std::endl;
265 
266  for (const auto& meas : traj->measurements()) {
267  const auto& trajState = meas.updatedState();
268  if (!trajState.isValid())
269  continue;
270 
271  // there can be 2 (stereo module), 1 (no stereo module), or 0 (no strip hit) clusters per measurement
272  const auto trechit = meas.recHit()->hit();
273  const auto simple1d = dynamic_cast<const SiStripRecHit1D*>(trechit);
274  const auto simple = dynamic_cast<const SiStripRecHit2D*>(trechit);
275  const auto matched = dynamic_cast<const SiStripMatchedRecHit2D*>(trechit);
276  if (matched) {
277  clusters.emplace_back(matched->monoId(), &matched->monoCluster(), traj, track, meas);
278  clusters.emplace_back(matched->stereoId(), &matched->stereoCluster(), traj, track, meas);
279  } else if (simple) {
280  clusters.emplace_back(simple->geographicalId().rawId(), simple->cluster().get(), traj, track, meas);
281  } else if (simple1d) {
282  clusters.emplace_back(simple1d->geographicalId().rawId(), simple1d->cluster().get(), traj, track, meas);
283  }
284  }
285  }
286 
287  for (const auto clus : clusters) {
288  uint32_t c_nstrips = clus.cluster->amplitudes().size();
289  m_clusterInfo.setCluster(*clus.cluster, clus.det);
290  float c_variance = m_clusterInfo.variance();
291  const auto& trajState = clus.measurement.updatedState();
292  const auto trackDir = trajState.localDirection();
293  float c_localdirx = trackDir.x();
294  float c_localdiry = trackDir.y();
295  float c_localdirz = trackDir.z();
296  const auto hit = clus.measurement.recHit()->hit();
297 
298  // not yet needed (might be used for Backplane correction later on
299  /*
300  const auto& tkGeom = iSetup.getData(m_tkGeomToken);
301  const auto stripDet = dynamic_cast<const StripGeomDetUnit*>(tkGeom.idToDet(hit->geographicalId()));
302  float c_barycenter = stripDet->specificTopology().localPosition(clus.cluster->barycenter()).x();
303  float c_localx = stripDet->toLocal(trajState.globalPosition()).x();
304  float c_rhlocalx = hit->localPosition().x();
305  float c_rhlocalxerr = hit->localPositionError().xx();
306  */
307 
308  const uint32_t mod = hit->geographicalId().rawId();
309 
310  std::string locationtype = iHists_.moduleLocationType_[mod];
311  if (locationtype.empty())
312  return;
313 
314  // retrive the hashed index
315  const auto& hashedIndex = iHists_.hash_.hashedIndex(mod);
316 
317  if (saveHistosMods_) {
318  LogDebug("SiStripLorentzAnglePCLMonitor") << "module ID: " << mod << " hashedIndex: " << hashedIndex;
319  iHists_.h1_["occupancyPerIndex"]->Fill(hashedIndex);
320  }
321 
322  TVector3 localdir(c_localdirx, c_localdiry, c_localdirz);
323  int sign = iHists_.orientation_[mod];
324  float tantheta = TMath::Tan(localdir.Theta());
325  float cosphi = TMath::Cos(localdir.Phi());
326  float theta = localdir.Theta();
327 
328  iHists_.h1_[Form("%s_nstrips", locationtype.c_str())]->Fill(c_nstrips);
329  iHists_.h1_[Form("%s_tanthetatrk", locationtype.c_str())]->Fill(sign * tantheta);
330  iHists_.h1_[Form("%s_cosphitrk", locationtype.c_str())]->Fill(cosphi);
331 
332  // nstrips
333  iHists_.h2_[Form("%s_tanthcosphtrk_nstrip", locationtype.c_str())]->Fill(sign * cosphi * tantheta, c_nstrips);
334  iHists_.h2_[Form("%s_thetatrk_nstrip", locationtype.c_str())]->Fill(sign * theta * cosphi, c_nstrips);
335 
336  if (saveHistosMods_) {
337  iHists_.h1_[Form("%s_%d_nstrips", locationtype.c_str(), mod)]->Fill(c_nstrips);
338  iHists_.h1_[Form("%s_%d_tanthetatrk", locationtype.c_str(), mod)]->Fill(sign * tantheta);
339  iHists_.h1_[Form("%s_%d_cosphitrk", locationtype.c_str(), mod)]->Fill(cosphi);
340  }
341 
342  // variance for width == 2
343  if (c_nstrips == 2) {
344  iHists_.h1_[Form("%s_variance_w2", locationtype.c_str())]->Fill(c_variance);
345  iHists_.h2_[Form("%s_tanthcosphtrk_var2", locationtype.c_str())]->Fill(sign * cosphi * tantheta, c_variance);
346  iHists_.h2_[Form("%s_thcosphtrk_var2", locationtype.c_str())]->Fill(sign * cosphi * theta, c_variance);
347 
348  // not in PCL
349  if (saveHistosMods_) {
350  LogDebug("SiStripLorentzAnglePCLMonitor") << iHists_.h2_ct_var2_m_[hashedIndex]->getName();
351  iHists_.h1_[Form("%s_%d_variance_w2", locationtype.c_str(), mod)]->Fill(c_variance);
352  iHists_.h2_ct_var2_m_[hashedIndex]->Fill(sign * cosphi * tantheta, c_variance);
353  iHists_.h2_t_var2_m_[hashedIndex]->Fill(sign * cosphi * theta, c_variance);
354  }
355  }
356  // variance for width == 3
357  if (c_nstrips == 3) {
358  iHists_.h1_[Form("%s_variance_w3", locationtype.c_str())]->Fill(c_variance);
359  iHists_.h2_[Form("%s_tanthcosphtrk_var3", locationtype.c_str())]->Fill(sign * cosphi * tantheta, c_variance);
360  iHists_.h2_[Form("%s_thcosphtrk_var3", locationtype.c_str())]->Fill(sign * cosphi * theta, c_variance);
361 
362  // not in PCL
363  if (saveHistosMods_) {
364  iHists_.h1_[Form("%s_%d_variance_w3", locationtype.c_str(), mod)]->Fill(c_variance);
365  iHists_.h2_ct_var3_m_[hashedIndex]->Fill(sign * cosphi * tantheta, c_variance);
366  iHists_.h2_t_var3_m_[hashedIndex]->Fill(sign * cosphi * theta, c_variance);
367  }
368  }
369 
370  // not in PCL
371  if (saveHistosMods_) {
372  iHists_.h2_ct_w_m_[hashedIndex]->Fill(sign * cosphi * tantheta, c_nstrips);
373  iHists_.h2_t_w_m_[hashedIndex]->Fill(sign * cosphi * theta, c_nstrips);
374  }
375  }
376 }
377 
379  edm::Run const& run,
380  edm::EventSetup const& iSetup) {
381  std::string bvalue = (iHists_.bfield_ == "3.8") ? "B-ON" : "B-OFF";
382  std::string folderToBook = fmt::format("{}/{}_{}", folder_, bvalue, iHists_.apvmode_);
383 
384  ibook.setCurrentFolder(folderToBook);
385  edm::LogPrint(moduleDescription().moduleName()) << "booking in " << folderToBook;
386 
387  // prepare track histograms
388  // clang-format off
389  iHists_.h1_["track_pt"] = ibook.book1D("track_pt", "track p_{T};track p_{T} [GeV];n. tracks", 2000, 0, 1000);
390  iHists_.h1_["track_eta"] = ibook.book1D("track_eta", "track #eta;track #eta;n. tracks", 100, -4, 4);
391  iHists_.h1_["track_phi"] = ibook.book1D("track_phi", "track #phi;track #phi;n. tracks", 80, -3.2, 3.2);
392  iHists_.h1_["track_validhits"] =
393  ibook.book1D("track_validhits", "track n. valid hits;track n. valid hits;n. tracks", 50, 0, 50);
394  iHists_.h1_["track_chi2ndof"] =
395  ibook.book1D("track_chi2ndof", "track #chi^{2}/ndf;track #chi^{2}/ndf;n. tracks", 100, 0, 5);
396  iHists_.h2_["track_chi2xhits"] =
397  ibook.book2D("track_chi2xhits_2d",
398  "track track n. hits vs track #chi^{2}/ndf;track #chi^{2};track n. valid hits;tracks",
399  100, 0, 5, 50, 0, 50);
400  iHists_.h2_["track_ptxhits"] = ibook.book2D(
401  "track_ptxhits_2d", "track n. hits vs p_{T};track p_{T} [GeV];track n. valid hits;tracks", 200, 0, 100, 50, 0, 50);
402  iHists_.h2_["track_etaxhits"] = ibook.book2D(
403  "track_etaxhits_2d", "track n. hits vs track #eta;track #eta;track n. valid hits;tracks", 60, -3, 3, 50, 0, 50);
404  iHists_.h2_["track_ptxchi2"] =
405  ibook.book2D("track_ptxchi2_2d",
406  "track #chi^{2}/ndf vs track p_{T};track p_{T} [GeV]; track #chi^{2}/ndf;tracks",
407  200, 0, 100, 100, 0, 5);
408  iHists_.h2_["track_ptxeta"] = ibook.book2D(
409  "track_ptxeta_2d", "track #eta vs track p_{T};track p_{T} [GeV];track #eta;tracks", 200, 0, 100, 60, -3, 3);
410  iHists_.h2_["track_etaxchi2"] = ibook.book2D(
411  "track_etaxchi2_2d", "track #chi^{2}/ndf vs track #eta;track #eta;track #chi^{2};tracks", 60, -3, 3, 100, 0, 5);
412  // clang-format on
413 
414  if (saveHistosMods_) {
415  iHists_.h1_["occupancyPerIndex"] = ibook.book1D("ClusterOccupancyPerHashedIndex",
416  "cluster occupancy;hashed index;# clusters per module",
417  iHists_.hash_.size(),
418  -0.5,
419  iHists_.hash_.size() - 0.5);
420  }
421 
422  // fill in the module types
423  iHists_.nlayers_["TIB"] = 4;
424  iHists_.nlayers_["TOB"] = 6;
425  iHists_.modtypes_.push_back("s");
426  iHists_.modtypes_.push_back("a");
427 
428  // prepare type histograms
429  for (auto& layers : iHists_.nlayers_) {
430  std::string subdet = layers.first;
431  for (int l = 1; l <= layers.second; ++l) {
432  ibook.setCurrentFolder(folderToBook + Form("/%s/L%d", subdet.c_str(), l));
433  for (auto& t : iHists_.modtypes_) {
434  // do not fill stereo where there aren't
435  if (l > 2 && t == "s")
436  continue;
437  std::string locType = Form("%s_L%d%s", subdet.c_str(), l, t.c_str());
438 
439  // clang-format off
440  const char* titles = Form("n.strips in %s;n.strips;n. clusters", locType.c_str());
441  iHists_.h1_[Form("%s_nstrips", locType.c_str())] = ibook.book1D(Form("%s_nstrips", locType.c_str()), titles, 20, 0, 20);
442 
443  titles = Form("tan(#theta_{trk}) in %s;tan(#theta_{trk});n. clusters", locType.c_str());
444  iHists_.h1_[Form("%s_tanthetatrk", locType.c_str())] = ibook.book1D(Form("%s_tanthetatrk", locType.c_str()), titles, 300, -1.5, 1.5);
445 
446  titles = Form("cos(#phi_{trk}) in %s;cos(#phi_{trk});n. clusters", locType.c_str());
447  iHists_.h1_[Form("%s_cosphitrk", locType.c_str())] = ibook.book1D(Form("%s_cosphitrk", locType.c_str()), titles, 40, -1, 1);
448 
449  titles = Form("Cluster variance (w=2) in %s;cluster variance (w=2);n. clusters", locType.c_str());
450  iHists_.h1_[Form("%s_variance_w2", locType.c_str())] = ibook.book1D(Form("%s_variance_w2", locType.c_str()), titles, 100, 0, 1);
451 
452  titles = Form("Cluster variance (w=3) in %s;cluster variance (w=3);n. clusters", locType.c_str());
453  iHists_.h1_[Form("%s_variance_w3", locType.c_str())] = ibook.book1D(Form("%s_variance_w3", locType.c_str()), titles, 100, 0, 1);
454 
455  titles = Form("n. strips in %s vs tan(#theta_{trk})cos(#phi_{trk});tan(#theta_{trk})cos(#phi_{trk});n. strips;n. clusters", locType.c_str());
456  iHists_.h2_[Form("%s_tanthcosphtrk_nstrip", locType.c_str())] = ibook.book2D(Form("%s_tanthcosphtrk_nstrip", locType.c_str()), titles, 360, -0.9, 0.9, 20, 0, 20);
457 
458  titles = Form("n. strips in %s vs #theta_{trk};#theta_{trk} [rad];n. strips;n. clusters", locType.c_str());
459  iHists_.h2_[Form("%s_thetatrk_nstrip", locType.c_str())] = ibook.book2D(Form("%s_thetatrk_nstrip", locType.c_str()), titles, 360, -0.9, 0.9, 20, 0, 20);
460 
461  titles = Form("cluster variance (w=2) in %s vs tan(#theta_{trk})cos(#phi_{trk});tan(#theta_{trk})cos(#phi_{trk});cluster variance (w=2);n. clusters", locType.c_str());
462  iHists_.h2_[Form("%s_tanthcosphtrk_var2", locType.c_str())] = ibook.book2D(Form("%s_tanthcosphtrk_var2", locType.c_str()), titles, 360, -0.9, 0.9, 50, 0, 1);
463 
464  titles = Form("cluster variance (w=3) in %s vs tan(#theta_{trk})cos(#phi_{trk});tan(#theta_{trk})cos(#phi_{trk});cluster variance (w=3);n. clusters", locType.c_str());
465  iHists_.h2_[Form("%s_tanthcosphtrk_var3", locType.c_str())] = ibook.book2D(Form("%s_tanthcosphtrk_var3", locType.c_str()), titles, 360, -0.9, 0.9, 50, 0, 1);
466 
467  titles = Form("cluster variance (w=2) in %s vs #theta_{trk}cos(#phi_{trk});#theta_{trk}cos(#phi_{trk});cluster variance (w=2);n. clusters", locType.c_str());
468  iHists_.h2_[Form("%s_thcosphtrk_var2", locType.c_str())] = ibook.book2D(Form("%s_thcosphtrk_var2", locType.c_str()), titles, 360, -0.9, 0.9, 50, 0, 1);
469 
470  titles = Form("cluster variance (w=3) in %s vs #theta_{trk}cos(#phi_{trk});#theta_{trk}cos(#phi_{trk});cluster variance (w=3);n. clusters", locType.c_str());
471  iHists_.h2_[Form("%s_thcosphtrk_var3", locType.c_str())] = ibook.book2D(Form("%s_thcosphtrk_var3", locType.c_str()), titles, 360, -0.9, 0.9, 50, 0, 1);
472  // clang-format on
473  }
474  }
475  }
476 
477  // prepare module histograms
478  if (saveHistosMods_) {
479  ibook.setCurrentFolder(folderToBook + "/modules");
480  for (const auto& [mod, locationType] : iHists_.moduleLocationType_) {
481  ibook.setCurrentFolder(folderToBook + "/modules" + Form("/%s", locationType.c_str()));
482  // histograms for each module
483  iHists_.h1_[Form("%s_%d_nstrips", locationType.c_str(), mod)] =
484  ibook.book1D(Form("%s_%d_nstrips", locationType.c_str(), mod), "", 10, 0, 10);
485  iHists_.h1_[Form("%s_%d_tanthetatrk", locationType.c_str(), mod)] =
486  ibook.book1D(Form("%s_%d_tanthetatrk", locationType.c_str(), mod), "", 40, -1., 1.);
487  iHists_.h1_[Form("%s_%d_cosphitrk", locationType.c_str(), mod)] =
488  ibook.book1D(Form("%s_%d_cosphitrk", locationType.c_str(), mod), "", 40, -1, 1);
489  iHists_.h1_[Form("%s_%d_variance_w2", locationType.c_str(), mod)] =
490  ibook.book1D(Form("%s_%d_variance_w2", locationType.c_str(), mod), "", 20, 0, 1);
491  iHists_.h1_[Form("%s_%d_variance_w3", locationType.c_str(), mod)] =
492  ibook.book1D(Form("%s_%d_variance_w3", locationType.c_str(), mod), "", 20, 0, 1);
493  }
494 
495  int counter{0};
497  for (; iter != iHists_.hash_.end(); ++iter) {
498  LogDebug("SiStripLorentzAnglePCLMonitor")
499  << "detId: " << (*iter) << " hashed index: " << iHists_.hash_.hashedIndex((*iter));
500  const auto& locationType = iHists_.moduleLocationType_[(*iter)];
501  ibook.setCurrentFolder(folderToBook + "/modules" + Form("/%s", locationType.c_str()));
502  iHists_.h2_ct_w_m_.push_back(
503  ibook.book2D(Form("ct_w_m_%s_%d", locationType.c_str(), *iter), "", 90, -0.9, 0.9, 10, 0, 10));
504  iHists_.h2_t_w_m_.push_back(
505  ibook.book2D(Form("t_w_m_%s_%d", locationType.c_str(), *iter), "", 90, -0.9, 0.9, 10, 0, 10));
506  iHists_.h2_ct_var2_m_.push_back(
507  ibook.book2D(Form("ct_var2_m_%s_%d", locationType.c_str(), *iter), "", 90, -0.9, 0.9, 20, 0, 1));
508  iHists_.h2_ct_var3_m_.push_back(
509  ibook.book2D(Form("ct_var3_m_%s_%d", locationType.c_str(), *iter), "", 90, -0.9, 0.9, 20, 0, 1));
510  iHists_.h2_t_var2_m_.push_back(
511  ibook.book2D(Form("t_var2_m_%s_%d", locationType.c_str(), *iter), "", 90, -0.9, 0.9, 20, 0, 1));
512  iHists_.h2_t_var3_m_.push_back(
513  ibook.book2D(Form("t_var3_m_%s_%d", locationType.c_str(), *iter), "", 90, -0.9, 0.9, 20, 0, 1));
514  counter++;
515  }
516  edm::LogPrint(moduleDescription().moduleName())
517  << __PRETTY_FUNCTION__ << " Booked " << counter << " module level histograms!";
518  } // if saveHistoMods
519 }
520 
521 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
524  desc.add<std::string>("folder", "AlCaReco/SiStripLorentzAngle")->setComment("DQM folder to write into");
525  desc.add<bool>("saveHistoMods", false)->setComment("save module level hisotgrams. Warning! takes a lot of space!");
526  desc.add<edm::InputTag>("Tracks", edm::InputTag("SiStripCalCosmics"))->setComment("input track collection");
527  descriptions.addWithDefaultLabel(desc);
528 }
529 
530 // define this as a plug-in
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
static const std::array< std::string, 5 > titles
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
const edm::ESGetToken< SiStripLorentzAngle, SiStripLorentzAngleDepRcd > m_lorentzAngleTokenBR
Local3DVector LocalVector
Definition: LocalVector.h:12
std::vector< uint32_t >::const_iterator const_iterator
std::string moduleLocationType(const uint32_t &mod, const TrackerTopology *tTopo)
void setCluster(const SiStripCluster &cluster, int detId)
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
std::string folder_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
std::vector< dqm::reco::MonitorElement * > h2_ct_var3_m_
std::vector< dqm::reco::MonitorElement * > h2_t_w_m_
T z() const
Definition: PV3DBase.h:61
std::vector< dqm::reco::MonitorElement * > h2_t_var3_m_
LocalVector drift(const StripGeomDetUnit *, const MagneticField &, const SiStripLorentzAngle &)
Definition: ShallowTools.cc:36
SubDetector subDetector() const
Definition: SiStripDetId.h:105
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > m_tkGeomTokenBR
LocalPoint toLocal(const GlobalPoint &gp) const
uint32_t hashedIndex(uint32_t det_id)
unsigned int layer(const DetId &id) const
Provides dense hash map in place of DetId.
std::vector< dqm::reco::MonitorElement * > h2_ct_w_m_
SiStripLorentzAngleCalibrationHistograms iHists_
int hashedIndex(int ieta, int iphi)
Definition: EcalPyUtils.cc:36
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
int iEvent
Definition: GenABIO.cc:224
const edm::EDGetTokenT< TrajTrackAssociationCollection > m_association_token
const size_t size() const
std::map< std::string, dqm::reco::MonitorElement * > h2_
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > m_tkGeomToken
uint32_t stereo() const
Definition: SiStripDetId.h:168
const std::string fieldAsString(const float &inputField)
std::vector< dqm::reco::MonitorElement * > h2_t_var2_m_
OnTrackCluster(uint32_t detId, const SiStripCluster *stripCluster, const Trajectory *trajectory, const reco::Track *track_, const TrajectoryMeasurement &measurement_)
double f[11][100]
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
SiStripLorentzAnglePCLMonitor(const edm::ParameterSet &)
const std::string apvModeAsString(const SiStripLatency *latency)
const edm::ESGetToken< SiStripLatency, SiStripLatencyRcd > m_latencyTokenBR
static constexpr auto TOB
Definition: SiStripDetId.h:39
Log< level::Warning, true > LogPrint
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
Log< level::Info, false > LogInfo
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:18
std::vector< dqm::reco::MonitorElement * > h2_ct_var2_m_
std::map< std::string, dqm::reco::MonitorElement * > h1_
void analyze(const edm::Event &, const edm::EventSetup &) override
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
const PositionType & position() const
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:221
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
static constexpr auto TIB
Definition: SiStripDetId.h:37
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > m_topoEsTokenBR
const edm::EDGetTokenT< edm::View< reco::Track > > m_tracks_token
HLT enums.
~SiStripLorentzAnglePCLMonitor() override=default
const_iterator end() const
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
Geom::Theta< T > theta() const
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > m_magFieldTokenBR
Definition: Run.h:45
const_iterator begin() const
#define LogDebug(id)