125 hitMinEnergy_(iConfig.getParameter<double>(
"hitMinimumEnergy")) {
127 mtdgeoToken_ = esConsumes<MTDGeometry, MTDDigiGeometryRecord>();
147 std::unordered_map<uint32_t, std::unordered_map<uint64_t, MTDHit> > m_btlHitsPerCell;
150 for (
auto const&
simHit : btlSimHits) {
165 if (m_btlHitsPerCell[
id.
rawId()][globalTrkID].time == 0. ||
166 simHit.tof() < m_btlHitsPerCell[
id.rawId()][globalTrkID].time) {
167 m_btlHitsPerCell[
id.rawId()][globalTrkID].time =
simHit.tof();
169 auto hit_pos =
simHit.localPosition();
170 m_btlHitsPerCell[
id.rawId()][globalTrkID].x = hit_pos.x();
171 m_btlHitsPerCell[
id.rawId()][globalTrkID].y = hit_pos.y();
172 m_btlHitsPerCell[
id.rawId()][globalTrkID].z = hit_pos.z();
181 if (!m_btlHitsPerCell.empty()) {
186 for (
auto const& cell : m_btlHitsPerCell) {
188 const auto& m_hits = cell.second;
191 if (m_hits.empty()) {
196 std::vector<uint64_t> v_hitID;
197 float ene_tot_cell = 0.;
199 for (
auto const&
hit : m_hits) {
200 ene_tot_cell +=
hit.second.energy;
201 v_hitID.push_back(
hit.first);
213 for (
unsigned int ihit = 0; ihit < v_hitID.size() - 1; ++ihit) {
215 for (
unsigned int jhit = 0; jhit < v_hitID.size() - ihit - 1; ++jhit) {
216 if (m_hits.at(v_hitID[jhit]).time > m_hits.at(v_hitID[jhit + 1]).time) {
217 std::swap(v_hitID[jhit], v_hitID[jhit + 1]);
221 if (swapped ==
false) {
227 float deltaT_max = 0.;
228 for (
unsigned int ihit = 0; ihit < v_hitID.size() - 1; ++ihit) {
229 float deltaT = m_hits.at(v_hitID[ihit + 1]).time - m_hits.at(v_hitID[ihit]).time;
231 if (deltaT > deltaT_max) {
240 if (thedet ==
nullptr) {
241 throw cms::Exception(
"BtlSimHitsValidation") <<
"GeographicalID: " << std::hex << geoId.
rawId() <<
" (" 242 <<
detId.rawId() <<
") is invalid!" <<
std::dec << std::endl;
252 const auto& global_point = thedet->
toGlobal(local_point);
282 int trackID = (
int)(v_hitID[0] & 0xFFFFFFFF) / 100000000;
295 if (v_hitID.size() == 2) {
296 trackID = (
int)(v_hitID[1] & 0xFFFFFFFF) / 100000000;
311 m_hits.at(v_hitID[0]).energy - m_hits.at(v_hitID[1]).energy);
315 else if (v_hitID.size() == 3) {
316 trackID = (
int)(v_hitID[2] & 0xFFFFFFFF) / 100000000;
332 else if (v_hitID.size() >= 4) {
333 for (
unsigned int ihit = 3; ihit < v_hitID.size(); ++ihit) {
334 trackID = (
int)(v_hitID[ihit] & 0xFFFFFFFF) / 100000000;
366 meNhits_ = ibook.
book1D(
"BtlNhits",
"Number of BTL cells with SIM hits;log_{10}(N_{BTL cells})", 100, 0., 5.25);
367 meNtrkPerCell_ = ibook.
book1D(
"BtlNtrkPerCell",
"Number of tracks per BTL cell;N_{trk}", 10, 0., 10.);
369 meHitEnergy_ = ibook.
book1D(
"BtlHitEnergy",
"BTL SIM hits energy;E_{SIM} [MeV]", 100, 0., 20.);
370 meHitLogEnergy_ = ibook.
book1D(
"BtlHitLogEnergy",
"BTL SIM hits energy;log_{10}(E_{SIM} [MeV])", 200, -6., 3.);
371 meHitTime_ = ibook.
book1D(
"BtlHitTime",
"BTL SIM hits ToA;ToA_{SIM} [ns]", 100, 0., 25.);
373 meHitXlocal_ = ibook.
book1D(
"BtlHitXlocal",
"BTL SIM local X;X_{SIM}^{LOC} [mm]", 100, -30., 30.);
374 meHitYlocal_ = ibook.
book1D(
"BtlHitYlocal",
"BTL SIM local Y;Y_{SIM}^{LOC} [mm]", 100, -1.65, 1.65);
375 meHitZlocal_ = ibook.
book1D(
"BtlHitZlocal",
"BTL SIM local Z;Z_{SIM}^{LOC} [mm]", 100, -2., 2.);
378 "BtlOccupancy",
"BTL SIM hits occupancy;z_{SIM} [cm];#phi_{SIM} [rad]", 130, -260., 260., 200, -3.15, 3.15);
380 meHitX_ = ibook.
book1D(
"BtlHitX",
"BTL SIM hits X;X_{SIM} [cm]", 100, -120., 120.);
381 meHitY_ = ibook.
book1D(
"BtlHitY",
"BTL SIM hits Y;Y_{SIM} [cm]", 100, -120., 120.);
382 meHitZ_ = ibook.
book1D(
"BtlHitZ",
"BTL SIM hits Z;Z_{SIM} [cm]", 100, -260., 260.);
383 meHitPhi_ = ibook.
book1D(
"BtlHitPhi",
"BTL SIM hits #phi;#phi_{SIM} [rad]", 200, -3.15, 3.15);
384 meHitEta_ = ibook.
book1D(
"BtlHitEta",
"BTL SIM hits #eta;#eta_{SIM}", 100, -1.55, 1.55);
387 ibook.
bookProfile(
"BtlHitTvsE",
"BTL SIM time vs energy;E_{SIM} [MeV];T_{SIM} [ns]", 50, 0., 20., 0., 100.);
389 "BtlHitEvsPhi",
"BTL SIM energy vs #phi;#phi_{SIM} [rad];E_{SIM} [MeV]", 50, -3.15, 3.15, 0., 100.);
391 ibook.
bookProfile(
"BtlHitEvsEta",
"BTL SIM energy vs #eta;#eta_{SIM};E_{SIM} [MeV]", 50, -1.55, 1.55, 0., 100.);
393 ibook.
bookProfile(
"BtlHitEvsZ",
"BTL SIM energy vs Z;Z_{SIM} [cm];E_{SIM} [MeV]", 50, -260., 260., 0., 100.);
395 "BtlHitTvsPhi",
"BTL SIM time vs #phi;#phi_{SIM} [rad];T_{SIM} [ns]", 50, -3.15, 3.15, 0., 100.);
397 ibook.
bookProfile(
"BtlHitTvsEta",
"BTL SIM time vs #eta;#eta_{SIM};T_{SIM} [ns]", 50, -1.55, 1.55, 0., 100.);
399 ibook.
bookProfile(
"BtlHitTvsZ",
"BTL SIM time vs Z;Z_{SIM} [cm];T_{SIM} [ns]", 50, -260., 260., 0., 100.);
401 meHitTrkID1_ = ibook.
book1I(
"BtlHitTrkID1",
"Category of the 1^{st} hit in time;Hit category", 8, 0, 8);
402 meHitTrkID2_ = ibook.
book1I(
"BtlHitTrkID2",
"Category of the 2^{nd} hit in time;Hit category", 8, 0, 8);
403 meHitTrkID3_ = ibook.
book1I(
"BtlHitTrkID3",
"Category of the 3^{rd} hit in time;Hit category", 8, 0, 8);
404 meHitTrkID4_ = ibook.
book1I(
"BtlHitTrkID4",
"Category of the #geq4^{th} hit in time;Hit category", 8, 0, 8);
407 "BtlHitDeltaT2",
"Time interval between hits in the same cell (2 hits);#DeltaT_{2} [ns]", 100., 0., 25.);
409 "BtlHitDeltaT3",
"Max time interval between hits in the same cell (3 hits);#DeltaT_{3} [ns]", 100., 0., 25.);
411 "Max time interval between hits in the same cell (#geq4 hits);#DeltaT_{#geq4} [ns]",
417 "BtlHitDeltaE12vsE",
"E_{1}-E_{2} vs E_{1};E_{1} [MeV];E_{1}-E_{2} [MeV]", 100, 0., 100., 0., 100.);
420 "Energy fraction of the 1^{st} hit in time (E_{cell}<10 MeV);E_{1} / E_{cell}",
425 "Energy fraction of the 2^{nd} hit in time (E_{cell}<10 MeV);E_{2} / E_{cell}",
430 "Energy fraction of the 3^{rd} hit in time (E_{cell}<10 MeV);E_{3} / E_{cell}",
435 ibook.
book1D(
"BtlHitE1overEtotBulk4",
436 "Energy fraction of the #geq4^{th} hit in time (E_{cell}<10 MeV);E_{#geq4} / E_{cell}",
441 "Energy fraction of the 1^{st} hit in time (E_{cell}>10 MeV);E_{1} / E_{cell}",
446 "Energy fraction of the 2^{nd} hit in time (E_{cell}>10 MeV);E_{2} / E_{cell}",
451 "Energy fraction of the 3^{rd} hit in time (E_{cell}>10 MeV);E_{3} / E_{cell}",
456 ibook.
book1D(
"BtlHitE1overEtotTail4",
457 "Energy fraction of the #geq4^{th} hit in time (E_{cell}>10 MeV);E_{#geq4} / E_{cell}",
469 desc.add<
double>(
"hitMinimumEnergy", 1.);
471 descriptions.
add(
"btlSimHitsValid",
desc);
MonitorElement * meHitEta_
MonitorElement * meHitZlocal_
T getParameter(std::string const &) const
MonitorElement * meHitPhi_
MonitorElement * meHitE1overEcellBulk4_
void analyze(const edm::Event &, const edm::EventSetup &) override
MonitorElement * book1I(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
MonitorElement * meHitXlocal_
MonitorElement * meNtrkPerCell_
virtual void setCurrentFolder(std::string const &fullpath)
MonitorElement * meHitE1overEcellBulk1_
virtual const Topology & topology() const
const float hitMinEnergy_
virtual const PixelTopology & specificTopology() const
MonitorElement * meHitDeltaT2_
LocalPoint pixelToModuleLocalPoint(const LocalPoint &plp, int row, int col) const
void swap(Association< C > &lhs, Association< C > &rhs)
MonitorElement * meNhits_
MonitorElement * meHitE1overEcellTail4_
MonitorElement * meHitEvsPhi_
MonitorElement * meHitE1overEcellTail1_
MonitorElement * meHitTrkID3_
const std::string folder_
MonitorElement * meHitDeltaE12vsE1_
MonitorElement * meHitEnergy_
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())
constexpr NumType convertGeVToMeV(NumType gev)
MonitorElement * meOccupancy_
MonitorElement * meHitTrkID2_
MonitorElement * meHitE1overEcellTail3_
MonitorElement * meHitE1overEcellBulk3_
MonitorElement * meHitEvsEta_
MonitorElement * meHitDeltaT3_
#define DEFINE_FWK_MODULE(type)
int nrows() const override
edm::ESGetToken< MTDGeometry, MTDDigiGeometryRecord > mtdgeoToken_
MonitorElement * meHitEvsZ_
MonitorElement * meHitYlocal_
MonitorElement * meHitTvsPhi_
MonitorElement * meNevents_
MonitorElement * meHitE1overEcellTail2_
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
MonitorElement * meHitTvsE_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
static constexpr float cellEneCut_
MonitorElement * meHitE1overEcellBulk2_
~BtlSimHitsValidation() override
constexpr NumType convertMmToCm(NumType millimeters)
unsigned long long uint64_t
edm::ESGetToken< MTDTopology, MTDTopologyRcd > mtdtopoToken_
constexpr uint32_t rawId() const
get the raw id
MonitorElement * meHitLogEnergy_
BtlSimHitsValidation(const edm::ParameterSet &)
MonitorElement * meHitTrkID1_
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
void add(std::string const &label, ParameterSetDescription const &psetDescription)
MonitorElement * meHitTvsZ_
MonitorElement * meHitTime_
edm::EDGetTokenT< CrossingFrame< PSimHit > > btlSimHitsToken_
Detector identifier class for the Barrel Timing Layer. The crystal count must start from 0...
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
static constexpr float BXTime_
ESTransientHandle< T > getTransientHandle(const ESGetToken< T, R > &iToken) const
BTLDetId::CrysLayout crysLayoutFromTopoMode(const int &topoMode)
MonitorElement * meHitTvsEta_
auto makeValid(const U &iOtherHandleType) noexcept(false)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
MonitorElement * meHitTrkID4_
MonitorElement * meHitDeltaT4_