CMS 3D CMS Logo

BtlDigiHitsValidation.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Validation/MtdValidation
4 // Class: BtlDigiHitsValidation
5 //
14 #include <string>
15 
20 
23 
27 
32 
35 
37 
39 public:
41  ~BtlDigiHitsValidation() override;
42 
43  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
44 
45 private:
46  void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
47 
48  void analyze(const edm::Event&, const edm::EventSetup&) override;
49 
50  // ------------ member data ------------
51 
53 
55 
56  // --- histograms declaration
57 
59 
62 
64 
70 
78 };
79 
80 // ------------ constructor and destructor --------------
82  : folder_(iConfig.getParameter<std::string>("folder")) {
83  btlDigiHitsToken_ = consumes<BTLDigiCollection>(iConfig.getParameter<edm::InputTag>("inputTag"));
84 }
85 
87 
88 // ------------ method called for each event ------------
90  using namespace edm;
91 
92  edm::ESHandle<MTDGeometry> geometryHandle;
93  iSetup.get<MTDDigiGeometryRecord>().get(geometryHandle);
94  const MTDGeometry* geom = geometryHandle.product();
95 
96  edm::ESHandle<MTDTopology> topologyHandle;
97  iSetup.get<MTDTopologyRcd>().get(topologyHandle);
98  const MTDTopology* topology = topologyHandle.product();
99 
100  auto btlDigiHitsHandle = makeValid(iEvent.getHandle(btlDigiHitsToken_));
101 
102  // --- Loop over the BLT DIGI hits
103 
104  unsigned int n_digi_btl[2] = {0, 0};
105 
106  for (const auto& dataFrame : *btlDigiHitsHandle) {
107  BTLDetId detId = dataFrame.id();
108  DetId geoId = detId.geographicalId(MTDTopologyMode::crysLayoutFromTopoMode(topology->getMTDTopologyMode()));
109  const MTDGeomDet* thedet = geom->idToDet(geoId);
110  if (thedet == nullptr)
111  throw cms::Exception("BtlDigiHitsValidation") << "GeographicalID: " << std::hex << geoId.rawId() << " ("
112  << detId.rawId() << ") is invalid!" << std::dec << std::endl;
113  const ProxyMTDTopology& topoproxy = static_cast<const ProxyMTDTopology&>(thedet->topology());
114  const RectangularMTDTopology& topo = static_cast<const RectangularMTDTopology&>(topoproxy.specificTopology());
115 
116  Local3DPoint local_point(0., 0., 0.);
117  local_point = topo.pixelToModuleLocalPoint(local_point, detId.row(topo.nrows()), detId.column(topo.nrows()));
118  const auto& global_point = thedet->toGlobal(local_point);
119 
120  const auto& sample_L = dataFrame.sample(0);
121  const auto& sample_R = dataFrame.sample(1);
122 
123  uint32_t adc[2] = {sample_L.data(), sample_R.data()};
124  uint32_t tdc[2] = {sample_L.toa(), sample_R.toa()};
125 
126  for (int iside = 0; iside < 2; ++iside) {
127  if (adc[iside] == 0)
128  continue;
129 
130  meHitCharge_[iside]->Fill(adc[iside]);
131  meHitTime_[iside]->Fill(tdc[iside]);
132 
133  meOccupancy_[iside]->Fill(global_point.z(), global_point.phi());
134 
135  meHitX_[iside]->Fill(global_point.x());
136  meHitY_[iside]->Fill(global_point.y());
137  meHitZ_[iside]->Fill(global_point.z());
138  meHitPhi_[iside]->Fill(global_point.phi());
139  meHitEta_[iside]->Fill(global_point.eta());
140 
141  meHitTvsQ_[iside]->Fill(adc[iside], tdc[iside]);
142  meHitQvsPhi_[iside]->Fill(global_point.phi(), adc[iside]);
143  meHitQvsEta_[iside]->Fill(global_point.eta(), adc[iside]);
144  meHitQvsZ_[iside]->Fill(global_point.z(), adc[iside]);
145  meHitTvsPhi_[iside]->Fill(global_point.phi(), tdc[iside]);
146  meHitTvsEta_[iside]->Fill(global_point.eta(), tdc[iside]);
147  meHitTvsZ_[iside]->Fill(global_point.z(), tdc[iside]);
148 
149  n_digi_btl[iside]++;
150 
151  } // iside loop
152 
153  } // dataFrame loop
154 
155  if (n_digi_btl[0] > 0)
156  meNhits_[0]->Fill(log10(n_digi_btl[0]));
157  if (n_digi_btl[1] > 0)
158  meNhits_[1]->Fill(log10(n_digi_btl[1]));
159 }
160 
161 // ------------ method for histogram booking ------------
163  edm::Run const& run,
164  edm::EventSetup const& iSetup) {
165  ibook.setCurrentFolder(folder_);
166 
167  // --- histograms booking
168 
169  meNhits_[0] = ibook.book1D("BtlNhitsL", "Number of BTL DIGI hits (L);log_{10}(N_{DIGI})", 100, 0., 5.25);
170  meNhits_[1] = ibook.book1D("BtlNhitsR", "Number of BTL DIGI hits (R);log_{10}(N_{DIGI})", 100, 0., 5.25);
171 
172  meHitCharge_[0] = ibook.book1D("BtlHitChargeL", "BTL DIGI hits charge (L);Q_{DIGI} [ADC counts]", 100, 0., 1024.);
173  meHitCharge_[1] = ibook.book1D("BtlHitChargeR", "BTL DIGI hits charge (R);Q_{DIGI} [ADC counts]", 100, 0., 1024.);
174  meHitTime_[0] = ibook.book1D("BtlHitTimeL", "BTL DIGI hits ToA (L);ToA_{DIGI} [TDC counts]", 100, 0., 1024.);
175  meHitTime_[1] = ibook.book1D("BtlHitTimeR", "BTL DIGI hits ToA (R);ToA_{DIGI} [TDC counts]", 100, 0., 1024.);
176 
177  meOccupancy_[0] = ibook.book2D("BtlOccupancyL",
178  "BTL DIGI hits occupancy (L);Z_{DIGI} [cm]; #phi_{DIGI} [rad]",
179  65,
180  -260.,
181  260.,
182  126,
183  -3.15,
184  3.15);
185  meOccupancy_[1] = ibook.book2D("BtlOccupancyR",
186  "BTL DIGI hits occupancy (R);Z_{DIGI} [cm]; #phi_{DIGI} [rad]",
187  65,
188  -260.,
189  260.,
190  126,
191  -3.15,
192  3.15);
193 
194  meHitX_[0] = ibook.book1D("BtlHitXL", "BTL DIGI hits X (L);X_{DIGI} [cm]", 60, -120., 120.);
195  meHitX_[1] = ibook.book1D("BtlHitXR", "BTL DIGI hits X (R);X_{DIGI} [cm]", 60, -120., 120.);
196  meHitY_[0] = ibook.book1D("BtlHitYL", "BTL DIGI hits Y (L);Y_{DIGI} [cm]", 60, -120., 120.);
197  meHitY_[1] = ibook.book1D("BtlHitYR", "BTL DIGI hits Y (R);Y_{DIGI} [cm]", 60, -120., 120.);
198  meHitZ_[0] = ibook.book1D("BtlHitZL", "BTL DIGI hits Z (L);Z_{DIGI} [cm]", 100, -260., 260.);
199  meHitZ_[1] = ibook.book1D("BtlHitZR", "BTL DIGI hits Z (R);Z_{DIGI} [cm]", 100, -260., 260.);
200  meHitPhi_[0] = ibook.book1D("BtlHitPhiL", "BTL DIGI hits #phi (L);#phi_{DIGI} [rad]", 126, -3.15, 3.15);
201  meHitPhi_[1] = ibook.book1D("BtlHitPhiR", "BTL DIGI hits #phi (R);#phi_{DIGI} [rad]", 126, -3.15, 3.15);
202  meHitEta_[0] = ibook.book1D("BtlHitEtaL", "BTL DIGI hits #eta (L);#eta_{DIGI}", 100, -1.55, 1.55);
203  meHitEta_[1] = ibook.book1D("BtlHitEtaR", "BTL DIGI hits #eta (R);#eta_{DIGI}", 100, -1.55, 1.55);
204 
205  meHitTvsQ_[0] = ibook.bookProfile("BtlHitTvsQL",
206  "BTL DIGI ToA vs charge (L);Q_{DIGI} [ADC counts];ToA_{DIGI} [TDC counts]",
207  50,
208  0.,
209  1024.,
210  0.,
211  1024.);
212  meHitTvsQ_[1] = ibook.bookProfile("BtlHitTvsQR",
213  "BTL DIGI ToA vs charge (R);Q_{DIGI} [ADC counts];ToA_{DIGI} [TDC counts]",
214  50,
215  0.,
216  1024.,
217  0.,
218  1024.);
219  meHitQvsPhi_[0] = ibook.bookProfile("BtlHitQvsPhiL",
220  "BTL DIGI charge vs #phi (L);#phi_{DIGI} [rad];Q_{DIGI} [ADC counts]",
221  50,
222  -3.15,
223  3.15,
224  0.,
225  1024.);
226  meHitQvsPhi_[1] = ibook.bookProfile("BtlHitQvsPhiR",
227  "BTL DIGI charge vs #phi (R);#phi_{DIGI} [rad];Q_{DIGI} [ADC counts]",
228  50,
229  -3.15,
230  3.15,
231  0.,
232  1024.);
233  meHitQvsEta_[0] = ibook.bookProfile(
234  "BtlHitQvsEtaL", "BTL DIGI charge vs #eta (L);#eta_{DIGI};Q_{DIGI} [ADC counts]", 50, -1.55, 1.55, 0., 1024.);
235  meHitQvsEta_[1] = ibook.bookProfile(
236  "BtlHitQvsEtaR", "BTL DIGI charge vs #eta (R);#eta_{DIGI};Q_{DIGI} [ADC counts]", 50, -1.55, 1.55, 0., 1024.);
237  meHitQvsZ_[0] = ibook.bookProfile(
238  "BtlHitQvsZL", "BTL DIGI charge vs Z (L);Z_{DIGI} [cm];Q_{DIGI} [ADC counts]", 50, -260., 260., 0., 1024.);
239  meHitQvsZ_[1] = ibook.bookProfile(
240  "BtlHitQvsZR", "BTL DIGI charge vs Z (R);Z_{DIGI} [cm];Q_{DIGI} [ADC counts]", 50, -260., 260., 0., 1024.);
241  meHitTvsPhi_[0] = ibook.bookProfile(
242  "BtlHitTvsPhiL", "BTL DIGI ToA vs #phi (L);#phi_{DIGI} [rad];ToA_{DIGI} [TDC counts]", 50, -3.15, 3.15, 0., 1024.);
243  meHitTvsPhi_[1] = ibook.bookProfile(
244  "BtlHitTvsPhiR", "BTL DIGI ToA vs #phi (R);#phi_{DIGI} [rad];ToA_{DIGI} [TDC counts]", 50, -3.15, 3.15, 0., 1024.);
245  meHitTvsEta_[0] = ibook.bookProfile(
246  "BtlHitTvsEtaL", "BTL DIGI ToA vs #eta (L);#eta_{DIGI};ToA_{DIGI} [TDC counts]", 50, -1.55, 1.55, 0., 1024.);
247  meHitTvsEta_[1] = ibook.bookProfile(
248  "BtlHitTvsEtaR", "BTL DIGI ToA vs #eta (R);#eta_{DIGI};ToA_{DIGI} [TDC counts]", 50, -1.55, 1.55, 0., 1024.);
249  meHitTvsZ_[0] = ibook.bookProfile(
250  "BtlHitTvsZL", "BTL DIGI ToA vs Z (L);Z_{DIGI} [cm];ToA_{DIGI} [TDC counts]", 50, -260., 260., 0., 1024.);
251  meHitTvsZ_[1] = ibook.bookProfile(
252  "BtlHitTvsZR", "BTL DIGI ToA vs Z (R);Z_{DIGI} [cm];ToA_{DIGI} [TDC counts]", 50, -260., 260., 0., 1024.);
253 }
254 
255 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
258 
259  desc.add<std::string>("folder", "MTD/BTL/DigiHits");
260  desc.add<edm::InputTag>("inputTag", edm::InputTag("mix", "FTLBarrel"));
261 
262  descriptions.add("btlDigiHitsDefault", desc);
263 }
264 
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
BtlDigiHitsValidation::meHitTvsPhi_
MonitorElement * meHitTvsPhi_[2]
Definition: BtlDigiHitsValidation.cc:75
BtlDigiHitsValidation::meHitY_
MonitorElement * meHitY_[2]
Definition: BtlDigiHitsValidation.cc:66
BTLDetId.h
BtlDigiHitsValidation::meOccupancy_
MonitorElement * meOccupancy_[2]
Definition: BtlDigiHitsValidation.cc:63
BtlDigiHitsValidation::btlDigiHitsToken_
edm::EDGetTokenT< BTLDigiCollection > btlDigiHitsToken_
Definition: BtlDigiHitsValidation.cc:54
BtlDigiHitsValidation::folder_
const std::string folder_
Definition: BtlDigiHitsValidation.cc:52
edm::Run
Definition: Run.h:45
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm
HLT enums.
Definition: AlignableModifier.h:19
BtlDigiHitsValidation::meHitTvsEta_
MonitorElement * meHitTvsEta_[2]
Definition: BtlDigiHitsValidation.cc:76
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89287
MTDGeometry.h
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
TrackerGeomDet
Definition: TrackerGeomDet.h:6
BtlDigiHitsValidation::meHitEta_
MonitorElement * meHitEta_[2]
Definition: BtlDigiHitsValidation.cc:69
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
MTDDigiGeometryRecord.h
ProxyMTDTopology::specificTopology
virtual const PixelTopology & specificTopology() const
Definition: ProxyMTDTopology.h:89
DQMStore.h
GeomDet::topology
virtual const Topology & topology() const
Definition: GeomDet.cc:67
BtlDigiHitsValidation::meHitTime_
MonitorElement * meHitTime_[2]
Definition: BtlDigiHitsValidation.cc:61
MTDTopologyMode.h
ecalLiteDTU::adc
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
Definition: EcalLiteDTUSample.h:12
DetId
Definition: DetId.h:17
MakerMacros.h
BTLDetId
Detector identifier class for the Barrel Timing Layer. The crystal count must start from 0,...
Definition: BTLDetId.h:18
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
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
ecaldqm::topology
const CaloTopology * topology(nullptr)
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
BTLDetId::row
int row(unsigned nrows=16) const
Definition: BTLDetId.h:105
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
BtlDigiHitsValidation::meNhits_
MonitorElement * meNhits_[2]
Definition: BtlDigiHitsValidation.cc:58
RectangularMTDTopology.h
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
BtlDigiHitsValidation::meHitTvsZ_
MonitorElement * meHitTvsZ_[2]
Definition: BtlDigiHitsValidation.cc:77
Point3DBase< float, LocalTag >
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
MTDTopology
Definition: MTDTopology.h:16
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
edm::ParameterSet
Definition: ParameterSet.h:47
MTDTopologyRcd
Definition: MTDTopologyRcd.h:10
Event.h
MTDTopologyMode::crysLayoutFromTopoMode
BTLDetId::CrysLayout crysLayoutFromTopoMode(const int &topoMode)
Definition: MTDTopologyMode.h:19
BtlDigiHitsValidation
Definition: BtlDigiHitsValidation.cc:38
BtlDigiHitsValidation::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: BtlDigiHitsValidation.cc:256
iEvent
int iEvent
Definition: GenABIO.cc:224
BtlDigiHitsValidation::meHitX_
MonitorElement * meHitX_[2]
Definition: BtlDigiHitsValidation.cc:65
edm::EventSetup
Definition: EventSetup.h:57
BtlDigiHitsValidation::meHitCharge_
MonitorElement * meHitCharge_[2]
Definition: BtlDigiHitsValidation.cc:60
edm::makeValid
auto makeValid(const U &iOtherHandleType) noexcept(false)
Definition: ValidHandle.h:52
get
#define get
BtlDigiHitsValidation::~BtlDigiHitsValidation
~BtlDigiHitsValidation() override
Definition: BtlDigiHitsValidation.cc:86
RectangularMTDTopology
Definition: RectangularMTDTopology.h:39
ProxyMTDTopology
Definition: ProxyMTDTopology.h:28
ProxyMTDTopology.h
MTDGeometry
Definition: MTDGeometry.h:14
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
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
MTDTopologyRcd.h
Frameworkfwd.h
BtlDigiHitsValidation::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: BtlDigiHitsValidation.cc:89
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
Exception
Definition: hltDiff.cc:246
BtlDigiHitsValidation::BtlDigiHitsValidation
BtlDigiHitsValidation(const edm::ParameterSet &)
Definition: BtlDigiHitsValidation.cc:81
BtlDigiHitsValidation::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: BtlDigiHitsValidation.cc:162
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
dqm::implementation::IBooker
Definition: DQMStore.h:43
BtlDigiHitsValidation::meHitQvsPhi_
MonitorElement * meHitQvsPhi_[2]
Definition: BtlDigiHitsValidation.cc:72
BtlDigiHitsValidation::meHitZ_
MonitorElement * meHitZ_[2]
Definition: BtlDigiHitsValidation.cc:67
BtlDigiHitsValidation::meHitQvsEta_
MonitorElement * meHitQvsEta_[2]
Definition: BtlDigiHitsValidation.cc:73
ParameterSet.h
BtlDigiHitsValidation::meHitTvsQ_
MonitorElement * meHitTvsQ_[2]
Definition: BtlDigiHitsValidation.cc:71
BTLDetId::geographicalId
BTLDetId geographicalId(CrysLayout lay) const
Definition: BTLDetId.cc:171
edm::Event
Definition: Event.h:73
BtlDigiHitsValidation::meHitPhi_
MonitorElement * meHitPhi_[2]
Definition: BtlDigiHitsValidation.cc:68
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
edm::InputTag
Definition: InputTag.h:15
MTDTopology.h
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
BtlDigiHitsValidation::meHitQvsZ_
MonitorElement * meHitQvsZ_[2]
Definition: BtlDigiHitsValidation.cc:74
BTLDetId::column
int column(unsigned nrows=16) const
Definition: BTLDetId.h:110