CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
BtlSimHitsValidation Class Reference

#include <Validation/MtdValidation/plugins/BtlSimHitsValidation.cc>

Inheritance diagram for BtlSimHitsValidation:
one::DQMEDAnalyzer< T > one::dqmimplementation::DQMBaseClass< T... >

Public Member Functions

 BtlSimHitsValidation (const edm::ParameterSet &)
 
 ~BtlSimHitsValidation () override
 
- Public Member Functions inherited from one::DQMEDAnalyzer< T >
 DQMEDAnalyzer ()=default
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > &&)=delete
 
 ~DQMEDAnalyzer () override=default
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 

Private Attributes

edm::EDGetTokenT< edm::PSimHitContainerbtlSimHitsToken_
 
const std::string folder_
 
const float hitMinEnergy_
 
MonitorElementmeHitEnergy_
 
MonitorElementmeHitEta_
 
MonitorElementmeHitEvsEta_
 
MonitorElementmeHitEvsPhi_
 
MonitorElementmeHitEvsZ_
 
MonitorElementmeHitPhi_
 
MonitorElementmeHitTime_
 
MonitorElementmeHitTvsE_
 
MonitorElementmeHitTvsEta_
 
MonitorElementmeHitTvsPhi_
 
MonitorElementmeHitTvsZ_
 
MonitorElementmeHitX_
 
MonitorElementmeHitXlocal_
 
MonitorElementmeHitY_
 
MonitorElementmeHitYlocal_
 
MonitorElementmeHitZ_
 
MonitorElementmeHitZlocal_
 
MonitorElementmeNhits_
 
MonitorElementmeNtrkPerCell_
 
MonitorElementmeOccupancy_
 

Detailed Description

Description: BTL SIM hits validation

Implementation: [Notes on implementation]

Definition at line 47 of file BtlSimHitsValidation.cc.

Constructor & Destructor Documentation

BtlSimHitsValidation::BtlSimHitsValidation ( const edm::ParameterSet iConfig)
explicit

Definition at line 97 of file BtlSimHitsValidation.cc.

References btlSimHitsToken_, and edm::ParameterSet::getParameter().

98  : folder_(iConfig.getParameter<std::string>("folder")),
99  hitMinEnergy_(iConfig.getParameter<double>("hitMinimumEnergy")) {
100  btlSimHitsToken_ = consumes<edm::PSimHitContainer>(iConfig.getParameter<edm::InputTag>("inputTag"));
101 }
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::PSimHitContainer > btlSimHitsToken_
const std::string folder_
BtlSimHitsValidation::~BtlSimHitsValidation ( )
override

Definition at line 103 of file BtlSimHitsValidation.cc.

103 {}

Member Function Documentation

void BtlSimHitsValidation::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 106 of file BtlSimHitsValidation.cc.

References btlSimHitsToken_, BTLDetId::column(), geant_units::operators::convertMmToCm(), geant_units::operators::convertUnitsTo(), TauDecayModes::dec, randomXiThetaGunProducer_cfi::energy, Exception, MonitorElement::Fill(), BTLDetId::geographicalId(), relativeConstraints::geom, edm::EventSetup::get(), edm::Event::getHandle(), MTDTopology::getMTDTopologyMode(), hitMinEnergy_, MTDGeometry::idToDet(), edm::makeValid(), meHitEnergy_, meHitEta_, meHitEvsEta_, meHitEvsPhi_, meHitEvsZ_, meHitPhi_, meHitTime_, meHitTvsE_, meHitTvsEta_, meHitTvsPhi_, meHitTvsZ_, meHitX_, meHitXlocal_, meHitY_, meHitYlocal_, meHitZ_, meHitZlocal_, meNhits_, meNtrkPerCell_, meOccupancy_, RectangularMTDTopology::nrows(), RectangularMTDTopology::pixelToModuleLocalPoint(), edm::ESHandle< T >::product(), DetId::rawId(), BTLDetId::row(), rpcPointValidation_cfi::simHit, ProxyMTDTopology::specificTopology(), ntuplemaker::time, GeomDet::toGlobal(), GeomDet::topology(), ecaldqm::topology(), x, y, and z.

106  {
107  using namespace edm;
108  using namespace geant_units::operators;
109 
110  edm::ESHandle<MTDGeometry> geometryHandle;
111  iSetup.get<MTDDigiGeometryRecord>().get(geometryHandle);
112  const MTDGeometry* geom = geometryHandle.product();
113 
114  edm::ESHandle<MTDTopology> topologyHandle;
115  iSetup.get<MTDTopologyRcd>().get(topologyHandle);
116  const MTDTopology* topology = topologyHandle.product();
117 
118  auto btlSimHitsHandle = makeValid(iEvent.getHandle(btlSimHitsToken_));
119 
120  std::unordered_map<uint32_t, MTDHit> m_btlHits;
121  std::unordered_map<uint32_t, std::set<int> > m_btlTrkPerCell;
122 
123  // --- Loop over the BLT SIM hits
124  for (auto const& simHit : *btlSimHitsHandle) {
125  // --- Use only hits compatible with the in-time bunch-crossing
126  if (simHit.tof() < 0 || simHit.tof() > 25.)
127  continue;
128 
129  DetId id = simHit.detUnitId();
130 
131  m_btlTrkPerCell[id.rawId()].insert(simHit.trackId());
132 
133  auto simHitIt = m_btlHits.emplace(id.rawId(), MTDHit()).first;
134 
135  // --- Accumulate the energy (in MeV) of SIM hits in the same detector cell
136  (simHitIt->second).energy += convertUnitsTo(0.001_MeV, simHit.energyLoss());
137 
138  // --- Get the time of the first SIM hit in the cell
139  if ((simHitIt->second).time == 0 || simHit.tof() < (simHitIt->second).time) {
140  (simHitIt->second).time = simHit.tof();
141 
142  auto hit_pos = simHit.entryPoint();
143  (simHitIt->second).x = hit_pos.x();
144  (simHitIt->second).y = hit_pos.y();
145  (simHitIt->second).z = hit_pos.z();
146  }
147 
148  } // simHit loop
149 
150  // ==============================================================================
151  // Histogram filling
152  // ==============================================================================
153 
154  meNhits_->Fill(m_btlHits.size());
155 
156  for (auto const& hit : m_btlTrkPerCell)
157  meNtrkPerCell_->Fill((hit.second).size());
158 
159  for (auto const& hit : m_btlHits) {
160  if ((hit.second).energy < hitMinEnergy_)
161  continue;
162 
163  // --- Get the SIM hit global position
164  BTLDetId detId(hit.first);
165  DetId geoId = detId.geographicalId(static_cast<BTLDetId::CrysLayout>(topology->getMTDTopologyMode()));
166  const MTDGeomDet* thedet = geom->idToDet(geoId);
167  if (thedet == nullptr)
168  throw cms::Exception("BtlSimHitsValidation") << "GeographicalID: " << std::hex << geoId.rawId() << " ("
169  << detId.rawId() << ") is invalid!" << std::dec << std::endl;
170  const ProxyMTDTopology& topoproxy = static_cast<const ProxyMTDTopology&>(thedet->topology());
171  const RectangularMTDTopology& topo = static_cast<const RectangularMTDTopology&>(topoproxy.specificTopology());
172 
173  Local3DPoint local_point(
174  convertMmToCm((hit.second).x), convertMmToCm((hit.second).y), convertMmToCm((hit.second).z));
175 
176  local_point = topo.pixelToModuleLocalPoint(local_point, detId.row(topo.nrows()), detId.column(topo.nrows()));
177  const auto& global_point = thedet->toGlobal(local_point);
178 
179  // --- Fill the histograms
180  meHitEnergy_->Fill((hit.second).energy);
181  meHitTime_->Fill((hit.second).time);
182 
183  meHitXlocal_->Fill((hit.second).x);
184  meHitYlocal_->Fill((hit.second).y);
185  meHitZlocal_->Fill((hit.second).z);
186 
187  meOccupancy_->Fill(global_point.z(), global_point.phi());
188 
189  meHitX_->Fill(global_point.x());
190  meHitY_->Fill(global_point.y());
191  meHitZ_->Fill(global_point.z());
192  meHitPhi_->Fill(global_point.phi());
193  meHitEta_->Fill(global_point.eta());
194 
195  meHitTvsE_->Fill((hit.second).energy, (hit.second).time);
196  meHitEvsPhi_->Fill(global_point.phi(), (hit.second).energy);
197  meHitEvsEta_->Fill(global_point.eta(), (hit.second).energy);
198  meHitEvsZ_->Fill(global_point.z(), (hit.second).energy);
199  meHitTvsPhi_->Fill(global_point.phi(), (hit.second).time);
200  meHitTvsEta_->Fill(global_point.eta(), (hit.second).time);
201  meHitTvsZ_->Fill(global_point.z(), (hit.second).time);
202 
203  } // hit loop
204 }
MonitorElement * meHitEta_
MonitorElement * meHitZlocal_
MonitorElement * meHitPhi_
edm::EDGetTokenT< edm::PSimHitContainer > btlSimHitsToken_
constexpr NumType convertUnitsTo(long double desiredUnits, NumType val)
Definition: GeantUnits.h:128
MonitorElement * meHitXlocal_
MonitorElement * meNtrkPerCell_
CaloTopology const * topology(0)
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
int getMTDTopologyMode() const
Definition: MTDTopology.h:74
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
int nrows() const override
void Fill(long long x)
MonitorElement * meHitEvsPhi_
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
Definition: Event.h:539
const MTDGeomDet * idToDet(DetId) const override
Definition: MTDGeometry.cc:184
MonitorElement * meHitEnergy_
MonitorElement * meOccupancy_
virtual const PixelTopology & specificTopology() const
MonitorElement * meHitEvsEta_
LocalPoint pixelToModuleLocalPoint(const LocalPoint &plp, int row, int col) const
MonitorElement * meHitEvsZ_
MonitorElement * meHitYlocal_
MonitorElement * meHitTvsPhi_
MonitorElement * meHitTvsE_
Definition: DetId.h:18
MonitorElement * meHitTvsZ_
MonitorElement * meHitTime_
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
constexpr NumType convertMmToCm(NumType millimeters)
Definition: GeantUnits.h:110
MonitorElement * meHitTvsEta_
auto makeValid(const U &iOtherHandleType) noexcept(false)
Definition: ValidHandle.h:59
T const * product() const
Definition: ESHandle.h:86
void BtlSimHitsValidation::bookHistograms ( DQMStore::IBooker ibook,
edm::Run const &  run,
edm::EventSetup const &  iSetup 
)
overrideprivate

Definition at line 207 of file BtlSimHitsValidation.cc.

References DQMStore::IBooker::book1D(), DQMStore::IBooker::book2D(), DQMStore::IBooker::bookProfile(), folder_, meHitEnergy_, meHitEta_, meHitEvsEta_, meHitEvsPhi_, meHitEvsZ_, meHitPhi_, meHitTime_, meHitTvsE_, meHitTvsEta_, meHitTvsPhi_, meHitTvsZ_, meHitX_, meHitXlocal_, meHitY_, meHitYlocal_, meHitZ_, meHitZlocal_, meNhits_, meNtrkPerCell_, meOccupancy_, and DQMStore::IBooker::setCurrentFolder().

209  {
210  ibook.setCurrentFolder(folder_);
211 
212  // --- histograms booking
213 
214  meNhits_ = ibook.book1D("BtlNhits", "Number of BTL cells with SIM hits;N_{BTL cells}", 100, 0., 5000.);
215  meNtrkPerCell_ = ibook.book1D("BtlNtrkPerCell", "Number of tracks per BTL cell;N_{trk}", 10, 0., 10.);
216 
217  meHitEnergy_ = ibook.book1D("BtlHitEnergy", "BTL SIM hits energy;E_{SIM} [MeV]", 100, 0., 20.);
218  meHitTime_ = ibook.book1D("BtlHitTime", "BTL SIM hits ToA;ToA_{SIM} [ns]", 100, 0., 25.);
219 
220  meHitXlocal_ = ibook.book1D("BtlHitXlocal", "BTL SIM local X;X_{SIM}^{LOC} [mm]", 100, -30., 30.);
221  meHitYlocal_ = ibook.book1D("BtlHitYlocal", "BTL SIM local Y;Y_{SIM}^{LOC} [mm]", 100, -1.65, 1.65);
222  meHitZlocal_ = ibook.book1D("BtlHitZlocal", "BTL SIM local z;z_{SIM}^{LOC} [mm]", 100, -2., 2.);
223 
224  meOccupancy_ = ibook.book2D(
225  "BtlOccupancy", "BTL SIM hits occupancy;z_{SIM} [cm];#phi_{SIM} [rad]", 130, -260., 260., 200, -3.15, 3.15);
226 
227  meHitX_ = ibook.book1D("BtlHitX", "BTL SIM hits X;X_{SIM} [cm]", 100, -120., 120.);
228  meHitY_ = ibook.book1D("BtlHitY", "BTL SIM hits Y;Y_{SIM} [cm]", 100, -120., 120.);
229  meHitZ_ = ibook.book1D("BtlHitZ", "BTL SIM hits Z;Z_{SIM} [cm]", 100, -260., 260.);
230  meHitPhi_ = ibook.book1D("BtlHitPhi", "BTL SIM hits #phi;#phi_{SIM} [rad]", 200, -3.15, 3.15);
231  meHitEta_ = ibook.book1D("BtlHitEta", "BTL SIM hits #eta;#eta_{SIM}", 100, -1.55, 1.55);
232 
233  meHitTvsE_ =
234  ibook.bookProfile("BtlHitTvsE", "BTL SIM time vs energy;E_{SIM} [MeV];T_{SIM} [ns]", 50, 0., 20., 0., 100.);
235  meHitEvsPhi_ = ibook.bookProfile(
236  "BtlHitEvsPhi", "BTL SIM energy vs #phi;#phi_{SIM} [rad];E_{SIM} [MeV]", 50, -3.15, 3.15, 0., 100.);
237  meHitEvsEta_ =
238  ibook.bookProfile("BtlHitEvsEta", "BTL SIM energy vs #eta;#eta_{SIM};E_{SIM} [MeV]", 50, -1.55, 1.55, 0., 100.);
239  meHitEvsZ_ =
240  ibook.bookProfile("BtlHitEvsZ", "BTL SIM energy vs Z;Z_{SIM} [cm];E_{SIM} [MeV]", 50, -260., 260., 0., 100.);
241  meHitTvsPhi_ = ibook.bookProfile(
242  "BtlHitTvsPhi", "BTL SIM time vs #phi;#phi_{SIM} [rad];T_{SIM} [ns]", 50, -3.15, 3.15, 0., 100.);
243  meHitTvsEta_ =
244  ibook.bookProfile("BtlHitTvsEta", "BTL SIM time vs #eta;#eta_{SIM};T_{SIM} [ns]", 50, -1.55, 1.55, 0., 100.);
245  meHitTvsZ_ =
246  ibook.bookProfile("BtlHitTvsZ", "BTL SIM time vs Z;Z_{SIM} [cm];T_{SIM} [ns]", 50, -260., 260., 0., 100.);
247 }
MonitorElement * meHitEta_
MonitorElement * meHitZlocal_
MonitorElement * meHitPhi_
MonitorElement * meHitXlocal_
MonitorElement * meNtrkPerCell_
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:113
MonitorElement * meHitEvsPhi_
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
const std::string folder_
MonitorElement * meHitEnergy_
MonitorElement * meOccupancy_
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
MonitorElement * meHitEvsEta_
MonitorElement * meHitEvsZ_
MonitorElement * meHitYlocal_
MonitorElement * meHitTvsPhi_
MonitorElement * meHitTvsE_
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:109
MonitorElement * meHitTvsZ_
MonitorElement * meHitTime_
MonitorElement * meHitTvsEta_
void BtlSimHitsValidation::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 250 of file BtlSimHitsValidation.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), DEFINE_FWK_MODULE, and AlCaHLTBitMon_QueryRunRegistry::string.

250  {
252 
253  desc.add<std::string>("folder", "MTD/BTL/SimHits");
254  desc.add<edm::InputTag>("inputTag", edm::InputTag("g4SimHits", "FastTimerHitsBarrel"));
255  desc.add<double>("hitMinimumEnergy", 1.); // [MeV]
256 
257  descriptions.add("btlSimHits", desc);
258 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

Member Data Documentation

edm::EDGetTokenT<edm::PSimHitContainer> BtlSimHitsValidation::btlSimHitsToken_
private

Definition at line 65 of file BtlSimHitsValidation.cc.

Referenced by analyze(), and BtlSimHitsValidation().

const std::string BtlSimHitsValidation::folder_
private

Definition at line 61 of file BtlSimHitsValidation.cc.

Referenced by bookHistograms().

const float BtlSimHitsValidation::hitMinEnergy_
private

Definition at line 63 of file BtlSimHitsValidation.cc.

Referenced by analyze().

MonitorElement* BtlSimHitsValidation::meHitEnergy_
private

Definition at line 72 of file BtlSimHitsValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement* BtlSimHitsValidation::meHitEta_
private

Definition at line 85 of file BtlSimHitsValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement* BtlSimHitsValidation::meHitEvsEta_
private

Definition at line 89 of file BtlSimHitsValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement* BtlSimHitsValidation::meHitEvsPhi_
private

Definition at line 88 of file BtlSimHitsValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement* BtlSimHitsValidation::meHitEvsZ_
private

Definition at line 90 of file BtlSimHitsValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement* BtlSimHitsValidation::meHitPhi_
private

Definition at line 84 of file BtlSimHitsValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement* BtlSimHitsValidation::meHitTime_
private

Definition at line 73 of file BtlSimHitsValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement* BtlSimHitsValidation::meHitTvsE_
private

Definition at line 87 of file BtlSimHitsValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement* BtlSimHitsValidation::meHitTvsEta_
private

Definition at line 92 of file BtlSimHitsValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement* BtlSimHitsValidation::meHitTvsPhi_
private

Definition at line 91 of file BtlSimHitsValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement* BtlSimHitsValidation::meHitTvsZ_
private

Definition at line 93 of file BtlSimHitsValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement* BtlSimHitsValidation::meHitX_
private

Definition at line 81 of file BtlSimHitsValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement* BtlSimHitsValidation::meHitXlocal_
private

Definition at line 75 of file BtlSimHitsValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement* BtlSimHitsValidation::meHitY_
private

Definition at line 82 of file BtlSimHitsValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement* BtlSimHitsValidation::meHitYlocal_
private

Definition at line 76 of file BtlSimHitsValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement* BtlSimHitsValidation::meHitZ_
private

Definition at line 83 of file BtlSimHitsValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement* BtlSimHitsValidation::meHitZlocal_
private

Definition at line 77 of file BtlSimHitsValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement* BtlSimHitsValidation::meNhits_
private

Definition at line 69 of file BtlSimHitsValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement* BtlSimHitsValidation::meNtrkPerCell_
private

Definition at line 70 of file BtlSimHitsValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement* BtlSimHitsValidation::meOccupancy_
private

Definition at line 79 of file BtlSimHitsValidation.cc.

Referenced by analyze(), and bookHistograms().