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 : {0, 2})
205 for (
unsigned int rp : {4, 5})
211 for (
unsigned int pl = 0; pl < 10; ++pl)
262 "ERROR in TotemDQMModuleRP::analyze > some of the required inputs are not valid. Skipping this event.\n" 263 <<
" status.isValid = " << status.
isValid() <<
"\n" 264 <<
" digi.isValid = " << digi.
isValid() <<
"\n" 265 <<
" digCluster.isValid = " << digCluster.
isValid() <<
"\n" 266 <<
" hits.isValid = " << hits.
isValid() <<
"\n" 267 <<
" patterns.isValid = " << patterns.
isValid() <<
"\n" 268 <<
" tracks.isValid = " << tracks.
isValid();
277 for (
auto &ds : *status)
280 unsigned int plNum = detId.
plane();
286 auto &
plots = it->second;
292 plots.vfat_problem->Fill(plNum,
s.getChipPosition());
293 plots.vfat_missing->Fill(plNum,
s.getChipPosition());
296 if (
s.isECProgressError() ||
s.isBCProgressError())
298 plots.vfat_problem->Fill(plNum,
s.getChipPosition());
299 plots.vfat_ec_bc_error->Fill(plNum,
s.getChipPosition());
302 if (
s.isIDMismatch() ||
s.isFootprintError() ||
s.isCRCError())
304 plots.vfat_problem->Fill(plNum,
s.getChipPosition());
305 plots.vfat_corruption->Fill(plNum,
s.getChipPosition());
321 auto &
plots = plIt->second;
324 plots.digi_profile_cumulative->Fill(dit->getStripNumber());
335 auto &
plots = plIt->second;
338 plots.hit_multiplicity->Fill(it->size());
343 plots.cluster_profile_cumulative->Fill(dit->getCenterStripPosition());
346 plots.cluster_size->Fill(dit->getNumberOfStrips());
351 for (
auto &ds : *tracks)
362 for (
unsigned int plNum = 0; plNum < 10; ++plNum)
370 auto &
plots = plIt->second;
372 double ft_z = ft.getZ0();
373 double ft_x = ft.getX0() + ft.getTx() * (ft_z - rp_z);
374 double ft_y = ft.getY0() + ft.getTy() * (ft_z - rp_z);
376 double ft_v = geometry->
globalToLocal(plId, CLHEP::Hep3Vector(ft_x, ft_y, ft_z)).y();
378 bool hasMatchingHit =
false;
379 const auto &hit_ds_it = hits->find(plId);
380 if (hit_ds_it != hits->end())
382 for (
const auto &
h : *hit_ds_it)
384 bool match = (fabs(ft_v -
h.getPosition()) < 2.*0.066);
387 hasMatchingHit =
true;
393 plots.efficiency_den->Fill(ft_v);
395 plots.efficiency_num->Fill(ft_v);
405 map<unsigned int, set<unsigned int> > planes;
406 map<unsigned int, set<unsigned int> > planes_u;
407 map<unsigned int, set<unsigned int> > planes_v;
408 for (
const auto &ds : *hits)
414 unsigned int planeNum = detId.
plane();
417 planes[rpId].insert(planeNum);
418 if (detId.isStripsCoordinateUDirection())
419 planes_u[rpId].
insert(planeNum);
421 planes_v[rpId].insert(planeNum);
424 for (
const auto &ds : *status)
426 bool activity =
false;
427 for (
const auto &
s : ds)
429 if (
s.isNumberOfClustersSpecified() &&
s.getNumberOfClusters() > 0)
440 unsigned int planeNum = detId.
plane();
443 planes[rpId].insert(planeNum);
444 if (detId.isStripsCoordinateUDirection())
445 planes_u[rpId].
insert(planeNum);
447 planes_v[rpId].insert(planeNum);
451 for (std::map<unsigned int, PotPlots>::iterator it =
potPlots.begin(); it !=
potPlots.end(); it++)
453 it->second.activity->Fill(planes[it->first].size());
454 it->second.activity_u->Fill(planes_u[it->first].size());
455 it->second.activity_v->Fill(planes_v[it->first].size());
457 if (planes[it->first].size() >= 6)
460 it->second.activity_per_bx_short->Fill(event.
bunchCrossing());
467 unsigned int planeNum = detId.
plane();
473 auto &
plots = plIt->second;
476 plots.hit_plane_hist->Fill(planeNum, dit->getCenterStripPosition());
480 for (
auto &ds : *patterns)
487 auto &
plots = plIt->second;
490 unsigned int u = 0,
v = 0;
493 if (!
p.getFittable())
503 plots.patterns_u->Fill(u);
504 plots.patterns_v->Fill(
v);
511 auto &
pp = it.second;
514 unsigned int pl_u = planes_u[rpId].size();
515 unsigned int pl_v = planes_v[rpId].size();
518 const auto &rp_pat_it = patterns->find(rpId);
520 unsigned int pat_u = 0, pat_v = 0;
521 if (rp_pat_it != patterns->end())
523 for (
auto &
p : *rp_pat_it)
525 if (!
p.getFittable())
539 if (pl_u == 0 && pl_v == 0) category = 0;
541 if (category == -1 && pat_u + pat_v <= 1)
549 if (pat_u == 1 && pat_v == 1) category = 2;
551 if (category == -1) category = 3;
553 pp.event_category->Fill(category);
557 set<unsigned int> rps_with_tracks;
559 for (
auto &ds : *tracks)
563 rps_with_tracks.insert(rpId);
565 auto plIt = potPlots.find(rpId);
566 if (plIt == potPlots.end())
568 auto &
plots = plIt->second;
576 unsigned int n_pl_in_fit_u = 0, n_pl_in_fit_v = 0;
577 for (
auto &hds : ft.getHits())
592 plots.h_planes_fit_u->Fill(n_pl_in_fit_u);
593 plots.h_planes_fit_v->Fill(n_pl_in_fit_v);
608 double x = ft.getX0() - rp_x;
609 double y = ft.getY0() - rp_y;
611 plots.trackHitsCumulativeHist->Fill(x, y);
613 double U = x * rod_U.x() + y * rod_U.y();
614 double V = x * rod_V.x() + y * rod_V.y();
616 plots.track_u_profile->Fill(U);
617 plots.track_v_profile->Fill(V);
622 map<unsigned int, map<unsigned int, map<unsigned int, unsigned int>>> triggerSectorMap;
623 for (
const auto &dp : *digi)
627 unsigned int uvFlag = (plId.isStripsCoordinateUDirection()) ? 0 : 1;
629 set<unsigned int> sectors;
630 for (
const auto &
d : dp)
632 unsigned int sector =
d.getStripNumber() / 32;
633 sectors.insert(sector);
636 for (
const auto §or : sectors)
637 triggerSectorMap[rpId][uvFlag][sector]++;
640 for (
auto &rpp : triggerSectorMap)
642 const unsigned int rpId = rpp.first;
646 set<unsigned int> triggerSectorsU;
647 for (
const auto sp : rpp.second[0])
650 triggerSectorsU.insert(sp.first);
653 set<unsigned int> triggerSectorsV;
654 for (
const auto sp : rpp.second[1])
657 triggerSectorsV.insert(sp.first);
660 auto plIt = potPlots.find(rpId);
661 if (plIt == potPlots.end())
663 auto &
plots = plIt->second;
665 const bool high_mult = (triggerSectorsU.size() > 2 && triggerSectorsV.size() > 2);
667 const bool has_track = (rps_with_tracks.find(rpId) != rps_with_tracks.end());
669 for (
const auto &secU : triggerSectorsU)
671 for (
const auto &secV : triggerSectorsV)
673 plots.triggerSectorUVCorrelation_all->Fill(secV, secU);
676 plots.triggerSectorUVCorrelation_mult2->Fill(secV, secU);
679 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
MonitorElement * activity
MonitorElement * vfat_corruption
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
MonitorElement * h_planes_fit_u
#define DEFINE_FWK_MODULE(type)
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
~TotemRPDQMSource() override
edm::EDGetTokenT< edm::DetSetVector< TotemRPUVPattern > > tokenUVPattern
MonitorElement * book1D(Args &&...args)
DDTranslation translation() const
void rpName(std::string &name, NameFlag flag=nFull) const
CTPPSDetId getRPId() 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
void setCurrentFolder(const std::string &fullpath)
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
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