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 
MTDDigiGeometryRecord
Definition: MTDDigiGeometryRecord.h:15
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
FTLDigiCollections.h
dqm::impl::MonitorElement
Definition: MonitorElement.h:98
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
EtlDigiHitsValidation::meHitTime_
MonitorElement * meHitTime_[2]
Definition: EtlDigiHitsValidation.cc:55
PixelTopology.h
simplePhotonAnalyzer_cfi.sample
sample
Definition: simplePhotonAnalyzer_cfi.py:12
edm::Run
Definition: Run.h:45
edm::EDGetTokenT
Definition: EDGetToken.h:33
EtlDigiHitsValidation::~EtlDigiHitsValidation
~EtlDigiHitsValidation() override
Definition: EtlDigiHitsValidation.cc:78
edm
HLT enums.
Definition: AlignableModifier.h:19
EtlDigiHitsValidation::meNhits_
MonitorElement * meNhits_[2]
Definition: EtlDigiHitsValidation.cc:52
MTDGeometry.h
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
TrackerGeomDet
Definition: TrackerGeomDet.h:6
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
EtlDigiHitsValidation::meHitCharge_
MonitorElement * meHitCharge_[2]
Definition: EtlDigiHitsValidation.cc:54
MTDDigiGeometryRecord.h
DQMStore.h
GeomDet::topology
virtual const Topology & topology() const
Definition: GeomDet.cc:67
ETLDetId
Detector identifier class for the Endcap Timing Layer.
Definition: ETLDetId.h:15
ETLDetId.h
EtlDigiHitsValidation::meOccupancy_
MonitorElement * meOccupancy_[2]
Definition: EtlDigiHitsValidation.cc:57
DetId
Definition: DetId.h:17
MakerMacros.h
EtlDigiHitsValidation::meHitTvsQ_
MonitorElement * meHitTvsQ_[2]
Definition: EtlDigiHitsValidation.cc:65
EtlDigiHitsValidation::meHitY_
MonitorElement * meHitY_[2]
Definition: EtlDigiHitsValidation.cc:60
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
EtlDigiHitsValidation::meHitQvsEta_
MonitorElement * meHitQvsEta_[2]
Definition: EtlDigiHitsValidation.cc:67
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
edm::ESHandle
Definition: DTSurvey.h:22
dqm::implementation::IBooker::bookProfile
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:322
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
EtlDigiHitsValidation::meHitPhi_
MonitorElement * meHitPhi_[2]
Definition: EtlDigiHitsValidation.cc:62
MTDDetId::zside
int zside() const
Definition: MTDDetId.h:61
EtlDigiHitsValidation::meHitZ_
MonitorElement * meHitZ_[2]
Definition: EtlDigiHitsValidation.cc:61
ETLDetId::geographicalId
ETLDetId geographicalId() const
Definition: ETLDetId.h:81
Point3DBase< float, LocalTag >
PixelTopology
Definition: PixelTopology.h:10
DQMEDAnalyzer.h
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
ValidHandle.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
folder_
std::string folder_
Definition: DQMEDAnalyzer.cc:60
DQMEDAnalyzer
Definition: DQMEDAnalyzer.py:1
GeomDet::toGlobal
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
EtlDigiHitsValidation::EtlDigiHitsValidation
EtlDigiHitsValidation(const edm::ParameterSet &)
Definition: EtlDigiHitsValidation.cc:73
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
EtlDigiHitsValidation
Definition: EtlDigiHitsValidation.cc:32
EtlDigiHitsValidation::meHitQvsPhi_
MonitorElement * meHitQvsPhi_[2]
Definition: EtlDigiHitsValidation.cc:66
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:57
EtlDigiHitsValidation::folder_
const std::string folder_
Definition: EtlDigiHitsValidation.cc:46
edm::makeValid
auto makeValid(const U &iOtherHandleType) noexcept(false)
Definition: ValidHandle.h:52
get
#define get
EtlDigiHitsValidation::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: EtlDigiHitsValidation.cc:81
EtlDigiHitsValidation::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: EtlDigiHitsValidation.cc:239
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
MTDGeometry
Definition: MTDGeometry.h:14
std
Definition: JetResolutionObject.h:76
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
writedatasetfile.run
run
Definition: writedatasetfile.py:27
EtlDigiHitsValidation::meHitTvsEta_
MonitorElement * meHitTvsEta_[2]
Definition: EtlDigiHitsValidation.cc:69
Frameworkfwd.h
dqm::implementation::IBooker::book2D
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:177
EtlDigiHitsValidation::meHitTvsPhi_
MonitorElement * meHitTvsPhi_[2]
Definition: EtlDigiHitsValidation.cc:68
Exception
Definition: hltDiff.cc:246
PixelTopology::localY
virtual float localY(float mpY) const =0
EtlDigiHitsValidation::meHitEta_
MonitorElement * meHitEta_[2]
Definition: EtlDigiHitsValidation.cc:63
dqm::implementation::IBooker
Definition: DQMStore.h:43
PixelTopology::localX
virtual float localX(float mpX) const =0
EtlDigiHitsValidation::meHitX_
MonitorElement * meHitX_[2]
Definition: EtlDigiHitsValidation.cc:59
ParameterSet.h
edm::Event
Definition: Event.h:73
EtlDigiHitsValidation::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: EtlDigiHitsValidation.cc:142
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
edm::InputTag
Definition: InputTag.h:15
EtlDigiHitsValidation::etlDigiHitsToken_
edm::EDGetTokenT< ETLDigiCollection > etlDigiHitsToken_
Definition: EtlDigiHitsValidation.cc:48
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98