112 vfat_problem = ibooker.
book2D(
"vfats with any problem", title+
";plane;vfat index", 10, -0.5, 9.5, 4, -0.5, 3.5);
113 vfat_missing = ibooker.
book2D(
"vfats missing", title+
";plane;vfat index", 10, -0.5, 9.5, 4, -0.5, 3.5);
114 vfat_ec_bc_error = ibooker.
book2D(
"vfats with EC or BC error", title+
";plane;vfat index", 10, -0.5, 9.5, 4, -0.5, 3.5);
115 vfat_corruption = ibooker.
book2D(
"vfats with data corruption", title+
";plane;vfat index", 10, -0.5, 9.5, 4, -0.5, 3.5);
117 activity = ibooker.
book1D(
"active planes", title+
";number of active planes", 11, -0.5, 10.5);
118 activity_u = ibooker.
book1D(
"active planes U", title+
";number of active U planes", 11, -0.5, 10.5);
119 activity_v = ibooker.
book1D(
"active planes V", title+
";number of active V planes", 11, -0.5, 10.5);
124 hit_plane_hist = ibooker.
book2D(
"activity in planes (2D)", title+
";plane number;strip number", 10, -0.5, 9.5, 32, -0.5, 511.5);
126 patterns_u = ibooker.
book1D(
"recognized patterns U", title+
";number of recognized U patterns", 11, -0.5, 10.5);
127 patterns_v = ibooker.
book1D(
"recognized patterns V", title+
";number of recognized V patterns", 11, -0.5, 10.5);
129 h_planes_fit_u = ibooker.
book1D(
"planes contributing to fit U", title+
";number of planes contributing to U fit", 6, -0.5, 5.5);
130 h_planes_fit_v = ibooker.
book1D(
"planes contributing to fit V", title+
";number of planes contributing to V fit", 6, -0.5, 5.5);
134 event_category_h->GetXaxis()->SetBinLabel(1,
"empty");
135 event_category_h->GetXaxis()->SetBinLabel(2,
"insufficient");
136 event_category_h->GetXaxis()->SetBinLabel(3,
"single-track");
137 event_category_h->GetXaxis()->SetBinLabel(4,
"multi-track");
138 event_category_h->GetXaxis()->SetBinLabel(5,
"shower");
161 digi_profile_cumulative = ibooker.
book1D(
"digi profile", title+
";strip number", 512, -0.5, 511.5);
162 cluster_profile_cumulative = ibooker.
book1D(
"cluster profile", title+
";cluster center", 1024, -0.25, 511.75);
163 hit_multiplicity = ibooker.
book1D(
"hit multiplicity", title+
";hits/detector/event", 6, -0.5, 5.5);
164 cluster_size = ibooker.
book1D(
"cluster size", title+
";hits per cluster", 5, 0.5, 5.5);
166 efficiency_num = ibooker.
book1D(
"efficiency num", title+
";track position (mm)", 30, -15., 0.);
167 efficiency_den = ibooker.
book1D(
"efficiency den", title+
";track position (mm)", 30, -15., 0.);
174 verbosity(ps.getUntrackedParameter<unsigned
int>(
"verbosity", 0))
199 for (
unsigned int arm : {0, 1})
202 for (
unsigned int st_rp : {2, 3, 4, 5, 24, 25})
204 const unsigned int st = st_rp / 10;
205 const unsigned int rp = st_rp % 10;
211 for (
unsigned int pl = 0; pl < 10; ++pl)
261 "ERROR in TotemDQMModuleRP::analyze > some of the required inputs are not valid. Skipping this event.\n" 262 <<
" status.isValid = " << status.
isValid() <<
"\n" 263 <<
" digi.isValid = " << digi.
isValid() <<
"\n" 264 <<
" digCluster.isValid = " << digCluster.
isValid() <<
"\n" 265 <<
" hits.isValid = " << hits.
isValid() <<
"\n" 266 <<
" patterns.isValid = " << patterns.
isValid() <<
"\n" 267 <<
" tracks.isValid = " << tracks.
isValid();
276 for (
auto &ds : *status)
279 unsigned int plNum = detId.
plane();
285 auto &
plots = it->second;
291 plots.vfat_problem->Fill(plNum,
s.getChipPosition());
292 plots.vfat_missing->Fill(plNum,
s.getChipPosition());
295 if (
s.isECProgressError() ||
s.isBCProgressError())
297 plots.vfat_problem->Fill(plNum,
s.getChipPosition());
298 plots.vfat_ec_bc_error->Fill(plNum,
s.getChipPosition());
301 if (
s.isIDMismatch() ||
s.isFootprintError() ||
s.isCRCError())
303 plots.vfat_problem->Fill(plNum,
s.getChipPosition());
304 plots.vfat_corruption->Fill(plNum,
s.getChipPosition());
320 auto &
plots = plIt->second;
323 plots.digi_profile_cumulative->Fill(dit->getStripNumber());
334 auto &
plots = plIt->second;
337 plots.hit_multiplicity->Fill(it->size());
342 plots.cluster_profile_cumulative->Fill(dit->getCenterStripPosition());
345 plots.cluster_size->Fill(dit->getNumberOfStrips());
350 for (
auto &ds : *tracks)
361 for (
unsigned int plNum = 0; plNum < 10; ++plNum)
369 auto &
plots = plIt->second;
371 double ft_z = ft.getZ0();
372 double ft_x = ft.getX0() + ft.getTx() * (ft_z - rp_z);
373 double ft_y = ft.getY0() + ft.getTy() * (ft_z - rp_z);
375 double ft_v = geometry->
globalToLocal(plId, CLHEP::Hep3Vector(ft_x, ft_y, ft_z)).y();
377 bool hasMatchingHit =
false;
378 const auto &hit_ds_it = hits->find(plId);
379 if (hit_ds_it != hits->end())
381 for (
const auto &
h : *hit_ds_it)
383 bool match = (fabs(ft_v -
h.getPosition()) < 2.*0.066);
386 hasMatchingHit =
true;
392 plots.efficiency_den->Fill(ft_v);
394 plots.efficiency_num->Fill(ft_v);
404 map<unsigned int, set<unsigned int> > planes;
405 map<unsigned int, set<unsigned int> > planes_u;
406 map<unsigned int, set<unsigned int> > planes_v;
407 for (
const auto &ds : *hits)
413 unsigned int planeNum = detId.
plane();
416 planes[
rpId].insert(planeNum);
417 if (detId.isStripsCoordinateUDirection())
418 planes_u[rpId].
insert(planeNum);
420 planes_v[
rpId].insert(planeNum);
423 for (
const auto &ds : *status)
425 bool activity =
false;
426 for (
const auto &
s : ds)
428 if (
s.isNumberOfClustersSpecified() &&
s.getNumberOfClusters() > 0)
439 unsigned int planeNum = detId.
plane();
442 planes[
rpId].insert(planeNum);
443 if (detId.isStripsCoordinateUDirection())
444 planes_u[rpId].
insert(planeNum);
446 planes_v[
rpId].insert(planeNum);
450 for (std::map<unsigned int, PotPlots>::iterator it =
potPlots.begin(); it !=
potPlots.end(); it++)
452 it->second.activity->Fill(planes[it->first].size());
453 it->second.activity_u->Fill(planes_u[it->first].size());
454 it->second.activity_v->Fill(planes_v[it->first].size());
456 if (planes[it->first].size() >= 6)
459 it->second.activity_per_bx_short->Fill(event.
bunchCrossing());
466 unsigned int planeNum = detId.
plane();
472 auto &
plots = plIt->second;
475 plots.hit_plane_hist->Fill(planeNum, dit->getCenterStripPosition());
479 for (
auto &ds : *patterns)
486 auto &
plots = plIt->second;
489 unsigned int u = 0,
v = 0;
492 if (!
p.getFittable())
502 plots.patterns_u->Fill(u);
503 plots.patterns_v->Fill(
v);
510 auto &
pp = it.second;
513 unsigned int pl_u = planes_u[
rpId].size();
514 unsigned int pl_v = planes_v[
rpId].size();
517 const auto &rp_pat_it = patterns->find(rpId);
519 unsigned int pat_u = 0, pat_v = 0;
520 if (rp_pat_it != patterns->end())
522 for (
auto &
p : *rp_pat_it)
524 if (!
p.getFittable())
538 if (pl_u == 0 && pl_v == 0) category = 0;
540 if (category == -1 && pat_u + pat_v <= 1)
548 if (pat_u == 1 && pat_v == 1) category = 2;
550 if (category == -1) category = 3;
552 pp.event_category->Fill(category);
556 set<unsigned int> rps_with_tracks;
558 for (
auto &ds : *tracks)
562 rps_with_tracks.insert(
rpId);
564 auto plIt = potPlots.find(
rpId);
565 if (plIt == potPlots.end())
567 auto &
plots = plIt->second;
575 unsigned int n_pl_in_fit_u = 0, n_pl_in_fit_v = 0;
576 for (
auto &hds : ft.getHits())
591 plots.h_planes_fit_u->Fill(n_pl_in_fit_u);
592 plots.h_planes_fit_v->Fill(n_pl_in_fit_v);
607 double x = ft.getX0() - rp_x;
608 double y = ft.getY0() - rp_y;
610 plots.trackHitsCumulativeHist->Fill(x, y);
612 double U = x * rod_U.x() + y * rod_U.y();
613 double V = x * rod_V.x() + y * rod_V.y();
615 plots.track_u_profile->Fill(U);
616 plots.track_v_profile->Fill(V);
621 map<unsigned int, map<unsigned int, map<unsigned int, unsigned int>>> triggerSectorMap;
622 for (
const auto &dp : *digi)
626 unsigned int uvFlag = (plId.isStripsCoordinateUDirection()) ? 0 : 1;
628 set<unsigned int> sectors;
629 for (
const auto &
d : dp)
631 unsigned int sector =
d.getStripNumber() / 32;
632 sectors.insert(sector);
635 for (
const auto §or : sectors)
636 triggerSectorMap[
rpId][uvFlag][sector]++;
639 for (
auto &rpp : triggerSectorMap)
641 const unsigned int rpId = rpp.first;
645 set<unsigned int> triggerSectorsU;
646 for (
const auto sp : rpp.second[0])
649 triggerSectorsU.insert(sp.first);
652 set<unsigned int> triggerSectorsV;
653 for (
const auto sp : rpp.second[1])
656 triggerSectorsV.insert(sp.first);
659 auto plIt = potPlots.find(rpId);
660 if (plIt == potPlots.end())
662 auto &
plots = plIt->second;
664 const bool high_mult = (triggerSectorsU.size() > 2 && triggerSectorsV.size() > 2);
666 const bool has_track = (rps_with_tracks.find(rpId) != rps_with_tracks.end());
668 for (
const auto &secU : triggerSectorsU)
670 for (
const auto &secV : triggerSectorsV)
672 plots.triggerSectorUVCorrelation_all->Fill(secV, secU);
675 plots.triggerSectorUVCorrelation_mult2->Fill(secV, secU);
678 plots.triggerSectorUVCorrelation_track->Fill(secV, secU);
Detector ID class for TOTEM Si strip detectors.
MonitorElement * event_category
T getParameter(std::string const &) const
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * triggerSectorUVCorrelation_all
Translation translation() const
MonitorElement * activity
MonitorElement * vfat_corruption
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
MonitorElement * h_planes_fit_u
MonitorElement * activity_per_bx
MonitorElement * triggerSectorUVCorrelation_track
int bunchCrossing() const
MonitorElement * track_u_profile
bool isStripsCoordinateUDirection() const
edm::EDGetTokenT< edm::DetSetVector< TotemRPDigi > > tokenDigi
Event setup record containing the real (actual) geometry information.
plots related to one RP plane
std::map< unsigned int, PlanePlots > planePlots
edm::EDGetTokenT< edm::DetSetVector< TotemRPRecHit > > tokenRecHit
MonitorElement * activity_v
const DetGeomDesc * getSensor(unsigned int id) const
returns geometry of a detector performs necessary checks, returns NULL if fails
MonitorElement * patterns_v
#define DEFINE_FWK_MODULE(type)
void setCurrentFolder(std::string const &fullpath)
~TotemRPDQMSource() override
edm::EDGetTokenT< edm::DetSetVector< TotemRPUVPattern > > tokenUVPattern
MonitorElement * book1D(Args &&...args)
void rpName(std::string &name, NameFlag flag=nFull) const
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
MonitorElement * vfat_missing
MonitorElement * track_v_profile
CLHEP::Hep3Vector getRPTranslation(unsigned int id) const
edm::EDGetTokenT< edm::DetSetVector< TotemRPCluster > > tokenCluster
MonitorElement * hit_plane_hist
MonitorElement * book2D(Args &&...args)
CLHEP::Hep3Vector localToGlobalDirection(unsigned int id, const CLHEP::Hep3Vector &) const
void setPlane(uint32_t det)
MonitorElement * patterns_u
MonitorElement * activity_u
Base class for CTPPS detector IDs.
TotemRPDQMSource(const edm::ParameterSet &ps)
MonitorElement * vfat_ec_bc_error
ESHandle< TrackerGeometry > geometry
MonitorElement * triggerSectorUVCorrelation_mult2
MonitorElement * vfat_problem
std::map< unsigned int, PotPlots > potPlots
void planeName(std::string &name, NameFlag flag=nFull) const
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
collection_type::const_iterator const_iterator
collection_type::const_iterator const_iterator
MonitorElement * h_planes_fit_v
CLHEP::Hep3Vector globalToLocal(const DetGeomDesc *, const CLHEP::Hep3Vector &) const
edm::EDGetTokenT< edm::DetSetVector< TotemRPLocalTrack > > tokenLocalTrack
MonitorElement * activity_per_bx_short
edm::EDGetTokenT< edm::DetSetVector< TotemVFATStatus > > tokenStatus
MonitorElement * trackHitsCumulativeHist