CMS 3D CMS Logo

EtlDigiHitsValidation.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Validation/MtdValidation
4 // Class: EtlDigiHitsValidation
5 //
14 #include <string>
15 
20 
23 
27 
31 
33 public:
35  ~EtlDigiHitsValidation() 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  etlDigiHitsToken_ = consumes<ETLDigiCollection>(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 etlDigiHitsHandle = makeValid(iEvent.getHandle(etlDigiHitsToken_));
89 
90  // --- Loop over the ELT DIGI hits
91 
92  unsigned int n_digi_etl[2] = {0, 0};
93 
94  for (const auto& dataFrame : *etlDigiHitsHandle) {
95  // --- Get the on-time sample
96  int isample = 2;
97 
98  const auto& sample = dataFrame.sample(isample);
99 
100  ETLDetId detId = dataFrame.id();
101 
102  DetId geoId = detId.geographicalId();
103 
104  const MTDGeomDet* thedet = geom->idToDet(geoId);
105  if (thedet == nullptr)
106  throw cms::Exception("EtlDigiHitsValidation") << "GeographicalID: " << std::hex << geoId.rawId() << " ("
107  << detId.rawId() << ") is invalid!" << std::dec << std::endl;
108  const PixelTopology& topo = static_cast<const PixelTopology&>(thedet->topology());
109 
110  Local3DPoint local_point(topo.localX(sample.row()), topo.localY(sample.column()), 0.);
111  const auto& global_point = thedet->toGlobal(local_point);
112 
113  // --- Fill the histograms
114 
115  int idet = (detId.zside() + 1) / 2;
116 
117  meHitCharge_[idet]->Fill(sample.data());
118  meHitTime_[idet]->Fill(sample.toa());
119  meOccupancy_[idet]->Fill(global_point.x(), global_point.y());
120 
121  meHitX_[idet]->Fill(global_point.x());
122  meHitY_[idet]->Fill(global_point.y());
123  meHitZ_[idet]->Fill(global_point.z());
124  meHitPhi_[idet]->Fill(global_point.phi());
125  meHitEta_[idet]->Fill(global_point.eta());
126 
127  meHitTvsQ_[idet]->Fill(sample.data(), sample.toa());
128  meHitQvsPhi_[idet]->Fill(global_point.phi(), sample.data());
129  meHitQvsEta_[idet]->Fill(global_point.eta(), sample.data());
130  meHitTvsPhi_[idet]->Fill(global_point.phi(), sample.toa());
131  meHitTvsEta_[idet]->Fill(global_point.eta(), sample.toa());
132 
133  n_digi_etl[idet]++;
134 
135  } // dataFrame loop
136 
137  meNhits_[0]->Fill(n_digi_etl[0]);
138  meNhits_[1]->Fill(n_digi_etl[1]);
139 }
140 
141 // ------------ method for histogram booking ------------
143  edm::Run const& run,
144  edm::EventSetup const& iSetup) {
145  ibook.setCurrentFolder(folder_);
146 
147  // --- histograms booking
148 
149  meNhits_[0] = ibook.book1D("EtlNhitsZneg", "Number of ETL DIGI hits (-Z);N_{DIGI}", 100, 0., 5000.);
150  meNhits_[1] = ibook.book1D("EtlNhitsZpos", "Number of ETL DIGI hits (+Z);N_{DIGI}", 100, 0., 5000.);
151 
152  meHitCharge_[0] = ibook.book1D("EtlHitChargeZneg", "ETL DIGI hits charge (-Z);Q_{DIGI} [ADC counts]", 100, 0., 256.);
153  meHitCharge_[1] = ibook.book1D("EtlHitChargeZpos", "ETL DIGI hits charge (+Z);Q_{DIGI} [ADC counts]", 100, 0., 256.);
154  meHitTime_[0] = ibook.book1D("EtlHitTimeZneg", "ETL DIGI hits ToA (-Z);ToA_{DIGI} [TDC counts]", 100, 0., 2000.);
155  meHitTime_[1] = ibook.book1D("EtlHitTimeZpos", "ETL DIGI hits ToA (+Z);ToA_{DIGI} [TDC counts]", 100, 0., 2000.);
156 
157  meOccupancy_[0] = ibook.book2D("EtlOccupancyZneg",
158  "ETL DIGI hits occupancy (-Z);X_{DIGI} [cm];Y_{DIGI} [cm]",
159  135,
160  -135.,
161  135.,
162  135,
163  -135.,
164  135.);
165  meOccupancy_[1] = ibook.book2D("EtlOccupancyZpos",
166  "ETL DIGI hits occupancy (+Z);X_{DIGI} [cm];Y_{DIGI} [cm]",
167  135,
168  -135.,
169  135.,
170  135,
171  -135.,
172  135.);
173 
174  meHitX_[0] = ibook.book1D("EtlHitXZneg", "ETL DIGI hits X (-Z);X_{DIGI} [cm]", 100, -130., 130.);
175  meHitX_[1] = ibook.book1D("EtlHitXZpos", "ETL DIGI hits X (+Z);X_{DIGI} [cm]", 100, -130., 130.);
176  meHitY_[0] = ibook.book1D("EtlHitYZneg", "ETL DIGI hits Y (-Z);Y_{DIGI} [cm]", 100, -130., 130.);
177  meHitY_[1] = ibook.book1D("EtlHitYZpos", "ETL DIGI hits Y (+Z);Y_{DIGI} [cm]", 100, -130., 130.);
178  meHitZ_[0] = ibook.book1D("EtlHitZZneg", "ETL DIGI hits Z (-Z);Z_{DIGI} [cm]", 100, -304.2, -303.4);
179  meHitZ_[1] = ibook.book1D("EtlHitZZpos", "ETL DIGI hits Z (+Z);Z_{DIGI} [cm]", 100, 303.4, 304.2);
180 
181  meHitPhi_[0] = ibook.book1D("EtlHitPhiZneg", "ETL DIGI hits #phi (-Z);#phi_{DIGI} [rad]", 100, -3.15, 3.15);
182  meHitPhi_[1] = ibook.book1D("EtlHitPhiZpos", "ETL DIGI hits #phi (+Z);#phi_{DIGI} [rad]", 100, -3.15, 3.15);
183  meHitEta_[0] = ibook.book1D("EtlHitEtaZneg", "ETL DIGI hits #eta (-Z);#eta_{DIGI}", 100, -3.2, -1.56);
184  meHitEta_[1] = ibook.book1D("EtlHitEtaZpos", "ETL DIGI hits #eta (+Z);#eta_{DIGI}", 100, 1.56, 3.2);
185 
186  meHitTvsQ_[0] = ibook.bookProfile("EtlHitTvsQZneg",
187  "ETL DIGI ToA vs charge (-Z);Q_{DIGI} [ADC counts];ToA_{DIGI} [TDC counts]",
188  50,
189  0.,
190  256.,
191  0.,
192  1024.);
193  meHitTvsQ_[1] = ibook.bookProfile("EtlHitTvsQZpos",
194  "ETL DIGI ToA vs charge (+Z);Q_{DIGI} [ADC counts];ToA_{DIGI} [TDC counts]",
195  50,
196  0.,
197  256.,
198  0.,
199  1024.);
200  meHitQvsPhi_[0] = ibook.bookProfile("EtlHitQvsPhiZneg",
201  "ETL DIGI charge vs #phi (-Z);#phi_{DIGI} [rad];Q_{DIGI} [ADC counts]",
202  50,
203  -3.15,
204  3.15,
205  0.,
206  1024.);
207  meHitQvsPhi_[1] = ibook.bookProfile("EtlHitQvsPhiZpos",
208  "ETL DIGI charge vs #phi (+Z);#phi_{DIGI} [rad];Q_{DIGI} [ADC counts]",
209  50,
210  -3.15,
211  3.15,
212  0.,
213  1024.);
214  meHitQvsEta_[0] = ibook.bookProfile(
215  "EtlHitQvsEtaZneg", "ETL DIGI charge vs #eta (-Z);#eta_{DIGI};Q_{DIGI} [ADC counts]", 50, -3.2, -1.56, 0., 1024.);
216  meHitQvsEta_[1] = ibook.bookProfile(
217  "EtlHitQvsEtaZpos", "ETL DIGI charge vs #eta (+Z);#eta_{DIGI};Q_{DIGI} [ADC counts]", 50, 1.56, 3.2, 0., 1024.);
218  meHitTvsPhi_[0] = ibook.bookProfile("EtlHitTvsPhiZneg",
219  "ETL DIGI ToA vs #phi (-Z);#phi_{DIGI} [rad];ToA_{DIGI} [TDC counts]",
220  50,
221  -3.15,
222  3.15,
223  0.,
224  1024.);
225  meHitTvsPhi_[1] = ibook.bookProfile("EtlHitTvsPhiZpos",
226  "ETL DIGI ToA vs #phi (+Z);#phi_{DIGI} [rad];ToA_{DIGI} [TDC counts]",
227  50,
228  -3.15,
229  3.15,
230  0.,
231  1024.);
232  meHitTvsEta_[0] = ibook.bookProfile(
233  "EtlHitTvsEtaZneg", "ETL DIGI ToA vs #eta (-Z);#eta_{DIGI};ToA_{DIGI} [TDC counts]", 50, -3.2, -1.56, 0., 1024.);
234  meHitTvsEta_[1] = ibook.bookProfile(
235  "EtlHitTvsEtaZpos", "ETL DIGI ToA vs #eta (+Z);#eta_{DIGI};ToA_{DIGI} [TDC counts]", 50, 1.56, 3.2, 0., 1024.);
236 }
237 
238 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
241 
242  desc.add<std::string>("folder", "MTD/ETL/DigiHits");
243  desc.add<edm::InputTag>("inputTag", edm::InputTag("mix", "FTLEndcap"));
244 
245  descriptions.add("etlDigiHitsDefault", desc);
246 }
247 
T getParameter(std::string const &) const
MonitorElement * meHitTvsPhi_[2]
MonitorElement * meHitEta_[2]
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:113
virtual const Topology & topology() const
Definition: GeomDet.cc:81
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 * meHitTvsQ_[2]
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
edm::EDGetTokenT< ETLDigiCollection > etlDigiHitsToken_
void Fill(long long x)
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
Definition: Event.h:539
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const MTDGeomDet * idToDet(DetId) const override
Definition: MTDGeometry.cc:184
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
void analyze(const edm::Event &, const edm::EventSetup &) override
MonitorElement * meHitTvsEta_[2]
ETLDetId geographicalId() const
Definition: ETLDetId.cc:4
MonitorElement * meNhits_[2]
MonitorElement * meHitCharge_[2]
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
virtual float localX(float mpX) const =0
MonitorElement * meHitX_[2]
ParameterDescriptionBase * add(U const &iLabel, T const &value)
MonitorElement * meHitZ_[2]
Definition: DetId.h:18
MonitorElement * meHitY_[2]
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:109
MonitorElement * meHitQvsEta_[2]
MonitorElement * meHitQvsPhi_[2]
void add(std::string const &label, ParameterSetDescription const &psetDescription)
MonitorElement * meHitPhi_[2]
MonitorElement * meHitTime_[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
EtlDigiHitsValidation(const edm::ParameterSet &)
virtual float localY(float mpY) const =0
auto makeValid(const U &iOtherHandleType) noexcept(false)
Definition: ValidHandle.h:59
T const * product() const
Definition: ESHandle.h:86
Definition: Run.h:45
MonitorElement * meOccupancy_[2]