CMS 3D CMS Logo

EtlRecHitsValidation.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Validation/MtdValidation
4 // Class: EtlRecHitsValidation
5 //
14 #include <string>
15 
20 
23 
27 
31 
33 public:
34  explicit EtlRecHitsValidation(const edm::ParameterSet&);
35  ~EtlRecHitsValidation() override;
36 
37  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
38 
39 private:
40  void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
41 
42  void analyze(const edm::Event&, const edm::EventSetup&) override;
43 
44  // ------------ member data ------------
45 
47 
49 
50  // --- histograms declaration
51 
53 
56 
58 
64 
70 };
71 
72 // ------------ constructor and destructor --------------
74  : folder_(iConfig.getParameter<std::string>("folder")) {
75  etlRecHitsToken_ = consumes<FTLRecHitCollection>(iConfig.getParameter<edm::InputTag>("inputTag"));
76 }
77 
79 
80 // ------------ method called for each event ------------
82  using namespace edm;
83 
84  edm::ESHandle<MTDGeometry> geometryHandle;
85  iSetup.get<MTDDigiGeometryRecord>().get(geometryHandle);
86  const MTDGeometry* geom = geometryHandle.product();
87 
88  auto etlRecHitsHandle = makeValid(iEvent.getHandle(etlRecHitsToken_));
89 
90  // --- Loop over the ELT RECO hits
91 
92  unsigned int n_reco_etl[2] = {0, 0};
93 
94  for (const auto& recHit : *etlRecHitsHandle) {
95  ETLDetId detId = recHit.id();
96 
97  DetId geoId = detId.geographicalId();
98  const MTDGeomDet* thedet = geom->idToDet(geoId);
99  if (thedet == nullptr)
100  throw cms::Exception("EtlRecHitsValidation") << "GeographicalID: " << std::hex << geoId.rawId() << " ("
101  << detId.rawId() << ") is invalid!" << std::dec << std::endl;
102  const PixelTopology& topo = static_cast<const PixelTopology&>(thedet->topology());
103 
104  Local3DPoint local_point(topo.localX(recHit.row()), topo.localY(recHit.column()), 0.);
105  const auto& global_point = thedet->toGlobal(local_point);
106 
107  // --- Fill the histograms
108 
109  int idet = (detId.zside() + 1) / 2;
110 
111  meHitEnergy_[idet]->Fill(recHit.energy());
112  meHitTime_[idet]->Fill(recHit.time());
113 
114  meOccupancy_[idet]->Fill(global_point.x(), global_point.y());
115 
116  meHitX_[idet]->Fill(global_point.x());
117  meHitY_[idet]->Fill(global_point.y());
118  meHitZ_[idet]->Fill(global_point.z());
119  meHitPhi_[idet]->Fill(global_point.phi());
120  meHitEta_[idet]->Fill(global_point.eta());
121 
122  meHitTvsE_[idet]->Fill(recHit.energy(), recHit.time());
123  meHitEvsPhi_[idet]->Fill(global_point.phi(), recHit.energy());
124  meHitEvsEta_[idet]->Fill(global_point.eta(), recHit.energy());
125  meHitTvsPhi_[idet]->Fill(global_point.phi(), recHit.time());
126  meHitTvsEta_[idet]->Fill(global_point.eta(), recHit.time());
127 
128  n_reco_etl[idet]++;
129 
130  } // recHit loop
131 
132  meNhits_[0]->Fill(n_reco_etl[0]);
133  meNhits_[1]->Fill(n_reco_etl[1]);
134 }
135 
136 // ------------ method for histogram booking ------------
138  edm::Run const& run,
139  edm::EventSetup const& iSetup) {
140  ibook.setCurrentFolder(folder_);
141 
142  // --- histograms booking
143 
144  meNhits_[0] = ibook.book1D("EtlNhitsZneg", "Number of ETL RECO hits (-Z);N_{RECO}", 100, 0., 5000.);
145  meNhits_[1] = ibook.book1D("EtlNhitsZpos", "Number of ETL RECO hits (+Z);N_{RECO}", 100, 0., 5000.);
146 
147  meHitEnergy_[0] = ibook.book1D("EtlHitEnergyZneg", "ETL RECO hits energy (-Z);E_{RECO} [MeV]", 100, 0., 3.);
148  meHitEnergy_[1] = ibook.book1D("EtlHitEnergyZpos", "ETL RECO hits energy (+Z);E_{RECO} [MeV]", 100, 0., 3.);
149 
150  meHitTime_[0] = ibook.book1D("EtlHitTimeZneg", "ETL RECO hits ToA (-Z);ToA_{RECO} [ns]", 100, 0., 25.);
151  meHitTime_[1] = ibook.book1D("EtlHitTimeZpos", "ETL RECO hits ToA (+Z);ToA_{RECO} [ns]", 100, 0., 25.);
152 
153  meOccupancy_[0] = ibook.book2D("EtlOccupancyZneg",
154  "ETL RECO hits occupancy (-Z);X_{RECO} [cm];Y_{RECO} [cm]",
155  135,
156  -135.,
157  135.,
158  135,
159  -135.,
160  135.);
161  meOccupancy_[1] = ibook.book2D("EtlOccupancyZpos",
162  "ETL DIGI hits occupancy (+Z);X_{RECO} [cm];Y_{RECO} [cm]",
163  135,
164  -135.,
165  135.,
166  135,
167  -135.,
168  135.);
169 
170  meHitX_[1] = ibook.book1D("EtlHitXZpos", "ETL RECO hits X (+Z);X_{RECO} [cm]", 100, -130., 130.);
171  meHitX_[0] = ibook.book1D("EtlHitXZneg", "ETL RECO hits X (-Z);X_{RECO} [cm]", 100, -130., 130.);
172  meHitY_[1] = ibook.book1D("EtlHitYZpos", "ETL RECO hits Y (+Z);Y_{RECO} [cm]", 100, -130., 130.);
173  meHitY_[0] = ibook.book1D("EtlHitYZneg", "ETL RECO hits Y (-Z);Y_{RECO} [cm]", 100, -130., 130.);
174  meHitZ_[1] = ibook.book1D("EtlHitZZpos", "ETL RECO hits Z (+Z);Z_{RECO} [cm]", 100, 303.4, 304.2);
175  meHitZ_[0] = ibook.book1D("EtlHitZZneg", "ETL RECO hits Z (-Z);Z_{RECO} [cm]", 100, -304.2, -303.4);
176 
177  meHitPhi_[1] = ibook.book1D("EtlHitPhiZpos", "ETL RECO hits #phi (+Z);#phi_{RECO} [rad]", 100, -3.15, 3.15);
178  meHitPhi_[0] = ibook.book1D("EtlHitPhiZneg", "ETL RECO hits #phi (-Z);#phi_{RECO} [rad]", 100, -3.15, 3.15);
179  meHitEta_[1] = ibook.book1D("EtlHitEtaZpos", "ETL RECO hits #eta (+Z);#eta_{RECO}", 100, 1.56, 3.2);
180  meHitEta_[0] = ibook.book1D("EtlHitEtaZneg", "ETL RECO hits #eta (-Z);#eta_{RECO}", 100, -3.2, -1.56);
181 
182  meHitTvsE_[1] = ibook.bookProfile(
183  "EtlHitTvsEZpos", "ETL RECO time vs energy (+Z);E_{RECO} [MeV];ToA_{RECO} [ns]", 50, 0., 2., 0., 100.);
184  meHitTvsE_[0] = ibook.bookProfile(
185  "EtlHitTvsEZneg", "ETL RECO time vs energy (-Z);E_{RECO} [MeV];ToA_{RECO} [ns]", 50, 0., 2., 0., 100.);
186  meHitEvsPhi_[1] = ibook.bookProfile(
187  "EtlHitEvsPhiZpos", "ETL RECO energy vs #phi (+Z);#phi_{RECO} [rad];E_{RECO} [MeV]", 50, -3.15, 3.15, 0., 100.);
188  meHitEvsPhi_[0] = ibook.bookProfile(
189  "EtlHitEvsPhiZneg", "ETL RECO energy vs #phi (-Z);#phi_{RECO} [rad];E_{RECO} [MeV]", 50, -3.15, 3.15, 0., 100.);
190  meHitEvsEta_[1] = ibook.bookProfile(
191  "EtlHitEvsEtaZpos", "ETL RECO energy vs #eta (+Z);#eta_{RECO};E_{RECO} [MeV]", 50, 1.56, 3.2, 0., 100.);
192  meHitEvsEta_[0] = ibook.bookProfile(
193  "EtlHitEvsEtaZneg", "ETL RECO energy vs #eta (-Z);#eta_{RECO};E_{RECO} [MeV]", 50, -3.2, -1.56, 0., 100.);
194  meHitTvsPhi_[1] = ibook.bookProfile(
195  "EtlHitTvsPhiZpos", "ETL RECO time vs #phi (+Z);#phi_{RECO} [rad];ToA_{RECO} [ns]", 50, -3.15, 3.15, 0., 100.);
196  meHitTvsPhi_[0] = ibook.bookProfile(
197  "EtlHitTvsPhiZneg", "ETL RECO time vs #phi (-Z);#phi_{RECO} [rad];ToA_{RECO} [ns]", 50, -3.15, 3.15, 0., 100.);
198  meHitTvsEta_[1] = ibook.bookProfile(
199  "EtlHitTvsEtaZpos", "ETL RECO time vs #eta (+Z);#eta_{RECO};ToA_{RECO} [ns]", 50, 1.56, 3.2, 0., 100.);
200  meHitTvsEta_[0] = ibook.bookProfile(
201  "EtlHitTvsEtaZneg", "ETL RECO time vs #eta (-Z);#eta_{RECO};ToA_{RECO} [ns]", 50, -3.2, -1.56, 0., 100.);
202 }
203 
204 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
207 
208  desc.add<std::string>("folder", "MTD/ETL/RecHits");
209  desc.add<edm::InputTag>("inputTag", edm::InputTag("mtdRecHits", "FTLEndcap"));
210 
211  descriptions.add("etlRecHits", desc);
212 }
213 
MonitorElement * meHitPhi_[2]
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
T getParameter(std::string const &) const
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:113
MonitorElement * meHitEvsEta_[2]
virtual const Topology & topology() const
Definition: GeomDet.cc:81
EtlRecHitsValidation(const edm::ParameterSet &)
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:54
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
MonitorElement * meHitEnergy_[2]
MonitorElement * meHitTime_[2]
MonitorElement * meHitZ_[2]
MonitorElement * meNhits_[2]
void analyze(const edm::Event &, const edm::EventSetup &) override
MonitorElement * meHitEvsPhi_[2]
const std::string folder_
void Fill(long long x)
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
Definition: Event.h:539
const MTDGeomDet * idToDet(DetId) const override
Definition: MTDGeometry.cc:184
int iEvent
Definition: GenABIO.cc:224
MonitorElement * meHitEta_[2]
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
ETLDetId geographicalId() const
Definition: ETLDetId.cc:4
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
virtual float localX(float mpX) const =0
MonitorElement * meHitX_[2]
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
MonitorElement * meHitY_[2]
MonitorElement * meHitTvsPhi_[2]
Definition: DetId.h:18
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:109
void add(std::string const &label, ParameterSetDescription const &psetDescription)
MonitorElement * meHitTvsEta_[2]
MonitorElement * meHitTvsE_[2]
Detector identifier class for the Endcap Timing Layer.
Definition: ETLDetId.h:15
HLT enums.
T get() const
Definition: EventSetup.h:71
int zside() const
Definition: MTDDetId.h:63
virtual float localY(float mpY) const =0
MonitorElement * meOccupancy_[2]
auto makeValid(const U &iOtherHandleType) noexcept(false)
Definition: ValidHandle.h:59
edm::EDGetTokenT< FTLRecHitCollection > etlRecHitsToken_
T const * product() const
Definition: ESHandle.h:86
Definition: Run.h:45