CMS 3D CMS Logo

BtlRecHitsValidation.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Validation/MtdValidation
4 // Class: BtlRecHitsValidation
5 //
14 #include <string>
15 
20 
23 
27 
32 
35 
37 public:
38  explicit BtlRecHitsValidation(const edm::ParameterSet&);
39  ~BtlRecHitsValidation() override;
40 
41  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
42 
43 private:
44  void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
45 
46  void analyze(const edm::Event&, const edm::EventSetup&) override;
47 
48  // ------------ member data ------------
49 
51 
53 
54  // --- histograms declaration
55 
57 
60 
62 
68 
76 };
77 
78 // ------------ constructor and destructor --------------
80  : folder_(iConfig.getParameter<std::string>("folder")) {
81  btlRecHitsToken_ = consumes<FTLRecHitCollection>(iConfig.getParameter<edm::InputTag>("inputTag"));
82 }
83 
85 
86 // ------------ method called for each event ------------
88  using namespace edm;
89 
90  edm::ESHandle<MTDGeometry> geometryHandle;
91  iSetup.get<MTDDigiGeometryRecord>().get(geometryHandle);
92  const MTDGeometry* geom = geometryHandle.product();
93 
94  edm::ESHandle<MTDTopology> topologyHandle;
95  iSetup.get<MTDTopologyRcd>().get(topologyHandle);
96  const MTDTopology* topology = topologyHandle.product();
97 
98  auto btlRecHitsHandle = makeValid(iEvent.getHandle(btlRecHitsToken_));
99 
100  // --- Loop over the BLT RECO hits
101 
102  unsigned int n_reco_btl = 0;
103 
104  for (const auto& recHit : *btlRecHitsHandle) {
105  BTLDetId detId = recHit.id();
106  DetId geoId = detId.geographicalId(static_cast<BTLDetId::CrysLayout>(topology->getMTDTopologyMode()));
107  const MTDGeomDet* thedet = geom->idToDet(geoId);
108  if (thedet == nullptr)
109  throw cms::Exception("BtlRecHitsValidation") << "GeographicalID: " << std::hex << geoId.rawId() << " ("
110  << detId.rawId() << ") is invalid!" << std::dec << std::endl;
111  const ProxyMTDTopology& topoproxy = static_cast<const ProxyMTDTopology&>(thedet->topology());
112  const RectangularMTDTopology& topo = static_cast<const RectangularMTDTopology&>(topoproxy.specificTopology());
113 
114  Local3DPoint local_point(0., 0., 0.);
115  local_point = topo.pixelToModuleLocalPoint(local_point, detId.row(topo.nrows()), detId.column(topo.nrows()));
116  const auto& global_point = thedet->toGlobal(local_point);
117 
118  meHitEnergy_->Fill(recHit.energy());
119  meHitTime_->Fill(recHit.time());
120 
121  meOccupancy_->Fill(global_point.z(), global_point.phi());
122 
123  meHitX_->Fill(global_point.x());
124  meHitY_->Fill(global_point.y());
125  meHitZ_->Fill(global_point.z());
126  meHitPhi_->Fill(global_point.phi());
127  meHitEta_->Fill(global_point.eta());
128 
129  meHitTvsE_->Fill(recHit.energy(), recHit.time());
130  meHitEvsPhi_->Fill(global_point.phi(), recHit.energy());
131  meHitEvsEta_->Fill(global_point.eta(), recHit.energy());
132  meHitEvsZ_->Fill(global_point.z(), recHit.energy());
133  meHitTvsPhi_->Fill(global_point.phi(), recHit.time());
134  meHitTvsEta_->Fill(global_point.eta(), recHit.time());
135  meHitTvsZ_->Fill(global_point.z(), recHit.time());
136 
137  n_reco_btl++;
138 
139  } // recHit loop
140 
141  meNhits_->Fill(n_reco_btl);
142 }
143 
144 // ------------ method for histogram booking ------------
146  edm::Run const& run,
147  edm::EventSetup const& iSetup) {
148  ibook.setCurrentFolder(folder_);
149 
150  // --- histograms booking
151 
152  meNhits_ = ibook.book1D("BtlNhits", "Number of BTL RECO hits;N_{RECO}", 100, 0., 5000.);
153 
154  meHitEnergy_ = ibook.book1D("BtlHitEnergy", "BTL RECO hits energy;E_{RECO} [MeV]", 100, 0., 20.);
155  meHitTime_ = ibook.book1D("BtlHitTime", "BTL RECO hits ToA;ToA_{RECO} [ns]", 100, 0., 25.);
156 
157  meOccupancy_ = ibook.book2D(
158  "BtlOccupancy", "BTL RECO hits occupancy;Z_{RECO} [cm]; #phi_{RECO} [rad]", 65, -260., 260., 126, -3.15, 3.15);
159 
160  meHitX_ = ibook.book1D("BtlHitX", "BTL RECO hits X;X_{RECO} [cm]", 60, -120., 120.);
161  meHitY_ = ibook.book1D("BtlHitY", "BTL RECO hits Y;Y_{RECO} [cm]", 60, -120., 120.);
162  meHitZ_ = ibook.book1D("BtlHitZ", "BTL RECO hits Z;Z_{RECO} [cm]", 100, -260., 260.);
163  meHitPhi_ = ibook.book1D("BtlHitPhi", "BTL RECO hits #phi;#phi_{RECO} [rad]", 126, -3.15, 3.15);
164  meHitEta_ = ibook.book1D("BtlHitEta", "BTL RECO hits #eta;#eta_{RECO}", 100, -1.55, 1.55);
165 
166  meHitTvsE_ =
167  ibook.bookProfile("BtlHitTvsE", "BTL RECO ToA vs energy;E_{RECO} [MeV];ToA_{RECO} [ns]", 50, 0., 20., 0., 100.);
168  meHitEvsPhi_ = ibook.bookProfile(
169  "BtlHitEvsPhi", "BTL RECO energy vs #phi;#phi_{RECO} [rad];E_{RECO} [MeV]", 50, -3.15, 3.15, 0., 100.);
170  meHitEvsEta_ = ibook.bookProfile(
171  "BtlHitEvsEta", "BTL RECO energy vs #eta;#eta_{RECO};E_{RECO} [MeV]", 50, -1.55, 1.55, 0., 100.);
172  meHitEvsZ_ =
173  ibook.bookProfile("BtlHitEvsZ", "BTL RECO energy vs Z;Z_{RECO} [cm];E_{RECO} [MeV]", 50, -260., 260., 0., 100.);
174  meHitTvsPhi_ = ibook.bookProfile(
175  "BtlHitTvsPhi", "BTL RECO ToA vs #phi;#phi_{RECO} [rad];ToA_{RECO} [ns]", 50, -3.15, 3.15, 0., 100.);
176  meHitTvsEta_ =
177  ibook.bookProfile("BtlHitTvsEta", "BTL RECO ToA vs #eta;#eta_{RECO};ToA_{RECO} [ns]", 50, -1.6, 1.6, 0., 100.);
178  meHitTvsZ_ =
179  ibook.bookProfile("BtlHitTvsZ", "BTL RECO ToA vs Z;Z_{RECO} [cm];ToA_{RECO} [ns]", 50, -260., 260., 0., 100.);
180 }
181 
182 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
185 
186  desc.add<std::string>("folder", "MTD/BTL/RecHits");
187  desc.add<edm::InputTag>("inputTag", edm::InputTag("mtdRecHits", "FTLBarrel"));
188 
189  descriptions.add("btlRecHits", desc);
190 }
191 
T getParameter(std::string const &) const
MonitorElement * meHitEnergy_
const std::string folder_
CaloTopology const * topology(0)
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:113
MonitorElement * meHitEvsZ_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
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
MonitorElement * meHitPhi_
int getMTDTopologyMode() const
Definition: MTDTopology.h:74
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
BtlRecHitsValidation(const edm::ParameterSet &)
void analyze(const edm::Event &, const edm::EventSetup &) override
MonitorElement * meHitTime_
int nrows() const override
void Fill(long long x)
MonitorElement * meOccupancy_
MonitorElement * meHitEta_
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
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
BTLDetId geographicalId(CrysLayout lay) const
Definition: BTLDetId.cc:162
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
MonitorElement * meHitTvsPhi_
MonitorElement * meHitEvsPhi_
virtual const PixelTopology & specificTopology() const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
ParameterDescriptionBase * add(U const &iLabel, T const &value)
LocalPoint pixelToModuleLocalPoint(const LocalPoint &plp, int row, int col) const
Definition: DetId.h:18
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:109
edm::EDGetTokenT< FTLRecHitCollection > btlRecHitsToken_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
HLT enums.
T get() const
Definition: EventSetup.h:71
Detector identifier class for the Barrel Timing Layer. The crystal count must start from 0...
Definition: BTLDetId.h:18
int column(unsigned nrows=16) const
Definition: BTLDetId.h:110
MonitorElement * meHitTvsE_
auto makeValid(const U &iOtherHandleType) noexcept(false)
Definition: ValidHandle.h:59
MonitorElement * meHitEvsEta_
T const * product() const
Definition: ESHandle.h:86
MonitorElement * meHitTvsEta_
MonitorElement * meHitTvsZ_
Definition: Run.h:45
int row(unsigned nrows=16) const
Definition: BTLDetId.h:105