73 PotPlots(DQMStore::IBooker &ibooker,
unsigned int id);
87 PlanePlots(DQMStore::IBooker &ibooker,
unsigned int id);
104 ibooker.setCurrentFolder(path);
109 vfat_problem = ibooker.book2D(
"vfats with any problem", title +
";plane;vfat index", 10, -0.5, 9.5, 4, -0.5, 3.5);
110 vfat_missing = ibooker.book2D(
"vfats missing", title +
";plane;vfat index", 10, -0.5, 9.5, 4, -0.5, 3.5);
112 ibooker.book2D(
"vfats with EC or BC error", title +
";plane;vfat index", 10, -0.5, 9.5, 4, -0.5, 3.5);
114 ibooker.book2D(
"vfats with data corruption", title +
";plane;vfat index", 10, -0.5, 9.5, 4, -0.5, 3.5);
116 activity = ibooker.book1D(
"active planes", title +
";number of active planes", 11, -0.5, 10.5);
117 activity_u = ibooker.book1D(
"active planes U", title +
";number of active U planes", 11, -0.5, 10.5);
118 activity_v = ibooker.book1D(
"active planes V", title +
";number of active V planes", 11, -0.5, 10.5);
120 activity_per_bx = ibooker.book1D(
"activity per BX", title +
";Event.BX", 4002, -1.5, 4000. + 0.5);
121 activity_per_bx_short = ibooker.book1D(
"activity per BX (short)", title +
";Event.BX", 102, -1.5, 100. + 0.5);
124 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);
130 ibooker.book1D(
"planes contributing to fit U", title +
";number of planes contributing to U fit", 6, -0.5, 5.5);
132 ibooker.book1D(
"planes contributing to fit V", title +
";number of planes contributing to V fit", 6, -0.5, 5.5);
134 event_category = ibooker.book1D(
"event category", title +
";event category", 5, -0.5, 4.5);
136 event_category_h->GetXaxis()->SetBinLabel(1,
"empty");
137 event_category_h->GetXaxis()->SetBinLabel(2,
"insufficient");
138 event_category_h->GetXaxis()->SetBinLabel(3,
"single-track");
139 event_category_h->GetXaxis()->SetBinLabel(4,
"multi-track");
140 event_category_h->GetXaxis()->SetBinLabel(5,
"shower");
143 ibooker.book2D(
"track XY profile", title +
";x (mm);y (mm)", 100, -18., +18., 100, -18., +18.);
145 track_u_profile = ibooker.book1D(
"track profile U", title +
"; U (mm)", 512, -256 * 66E-3, +256 * 66E-3);
146 track_v_profile = ibooker.book1D(
"track profile V", title +
"; V (mm)", 512, -256 * 66E-3, +256 * 66E-3);
149 "trigger sector UV correlation (no cond)", title +
";V sector;U sector", 16, -0.5, 15.5, 16, -0.5, 15.5);
151 "trigger sector UV correlation (max mult 2)", title +
";V sector;U sector", 16, -0.5, 15.5, 16, -0.5, 15.5);
153 "trigger sector UV correlation (track)", title +
";V sector;U sector", 16, -0.5, 15.5, 16, -0.5, 15.5);
161 ibooker.setCurrentFolder(path);
166 digi_profile_cumulative = ibooker.book1D(
"digi profile", title +
";strip number", 512, -0.5, 511.5);
167 cluster_profile_cumulative = ibooker.book1D(
"cluster profile", title +
";cluster center", 1024, -0.25, 511.75);
168 hit_multiplicity = ibooker.book1D(
"hit multiplicity", title +
";hits/detector/event", 6, -0.5, 5.5);
169 cluster_size = ibooker.book1D(
"cluster size", title +
";hits per cluster", 5, 0.5, 5.5);
171 efficiency_num = ibooker.book1D(
"efficiency num", title +
";track position (mm)", 30, -15., 0.);
172 efficiency_den = ibooker.book1D(
"efficiency den", title +
";track position (mm)", 30, -15., 0.);
179 :
verbosity(ps.getUntrackedParameter<unsigned
int>(
"verbosity", 0)) {
197 ibooker.setCurrentFolder(
"CTPPS");
200 for (
unsigned int arm : {0, 1}) {
202 for (
unsigned int st_rp : {2, 3, 4, 5, 24, 25}) {
203 const unsigned int st = st_rp / 10;
204 const unsigned int rp = st_rp % 10;
210 for (
unsigned int pl = 0; pl < 10; ++pl) {
256 <<
"ERROR in TotemDQMModuleRP::analyze > some of the required inputs are not valid. Skipping this event.\n" 257 <<
" status.isValid = " << status.
isValid() <<
"\n" 258 <<
" digi.isValid = " << digi.
isValid() <<
"\n" 259 <<
" digCluster.isValid = " << digCluster.
isValid() <<
"\n" 260 <<
" hits.isValid = " << hits.
isValid() <<
"\n" 261 <<
" patterns.isValid = " << patterns.
isValid() <<
"\n" 262 <<
" tracks.isValid = " << tracks.
isValid();
271 for (
auto &ds : *status) {
273 unsigned int plNum = detId.
plane();
279 auto &
plots = it->second;
283 plots.vfat_problem->Fill(plNum,
s.chipPosition());
284 plots.vfat_missing->Fill(plNum,
s.chipPosition());
287 if (
s.isECProgressError() ||
s.isBCProgressError()) {
288 plots.vfat_problem->Fill(plNum,
s.chipPosition());
289 plots.vfat_ec_bc_error->Fill(plNum,
s.chipPosition());
292 if (
s.isIDMismatch() ||
s.isFootprintError() ||
s.isCRCError()) {
293 plots.vfat_problem->Fill(plNum,
s.chipPosition());
294 plots.vfat_corruption->Fill(plNum,
s.chipPosition());
309 auto &
plots = plIt->second;
312 plots.digi_profile_cumulative->Fill(dit->stripNumber());
322 auto &
plots = plIt->second;
325 plots.hit_multiplicity->Fill(it->size());
329 plots.cluster_profile_cumulative->Fill(dit->centerStripPosition());
332 plots.cluster_size->Fill(dit->numberOfStrips());
337 for (
auto &ds : *tracks) {
340 for (
auto &ft : ds) {
346 for (
unsigned int plNum = 0; plNum < 10; ++plNum) {
353 auto &
plots = plIt->second;
355 double ft_z = ft.z0();
356 double ft_x = ft.x0() + ft.tx() * (ft_z - rp_z);
357 double ft_y = ft.y0() + ft.ty() * (ft_z - rp_z);
359 double ft_v = geometry->
globalToLocal(plId, CLHEP::Hep3Vector(ft_x, ft_y, ft_z)).y();
361 bool hasMatchingHit =
false;
362 const auto &hit_ds_it = hits->find(plId);
363 if (hit_ds_it != hits->end()) {
364 for (
const auto &
h : *hit_ds_it) {
365 bool match = (fabs(ft_v -
h.position()) < 2. * 0.066);
367 hasMatchingHit =
true;
373 plots.efficiency_den->Fill(ft_v);
375 plots.efficiency_num->Fill(ft_v);
384 map<unsigned int, set<unsigned int>> planes;
385 map<unsigned int, set<unsigned int>> planes_u;
386 map<unsigned int, set<unsigned int>> planes_v;
387 for (
const auto &ds : *hits) {
392 unsigned int planeNum = detId.
plane();
395 planes[rpId].insert(planeNum);
396 if (detId.isStripsCoordinateUDirection())
397 planes_u[rpId].
insert(planeNum);
399 planes_v[rpId].insert(planeNum);
402 for (
const auto &ds : *status) {
403 bool activity =
false;
404 for (
const auto &
s : ds) {
405 if (
s.isNumberOfClustersSpecified() &&
s.numberOfClusters() > 0) {
415 unsigned int planeNum = detId.
plane();
418 planes[rpId].insert(planeNum);
419 if (detId.isStripsCoordinateUDirection())
420 planes_u[rpId].
insert(planeNum);
422 planes_v[rpId].insert(planeNum);
426 for (std::map<unsigned int, PotPlots>::iterator it =
potPlots.begin(); it !=
potPlots.end(); it++) {
427 it->second.activity->Fill(planes[it->first].size());
428 it->second.activity_u->Fill(planes_u[it->first].size());
429 it->second.activity_v->Fill(planes_v[it->first].size());
431 if (planes[it->first].size() >= 6) {
433 it->second.activity_per_bx_short->Fill(event.
bunchCrossing());
439 unsigned int planeNum = detId.
plane();
445 auto &
plots = plIt->second;
448 plots.hit_plane_hist->Fill(planeNum, dit->centerStripPosition());
452 for (
auto &ds : *patterns) {
458 auto &
plots = plIt->second;
461 unsigned int u = 0,
v = 0;
473 plots.patterns_u->Fill(u);
474 plots.patterns_v->Fill(
v);
480 auto &
pp = it.second;
483 unsigned int pl_u = planes_u[rpId].size();
484 unsigned int pl_v = planes_v[rpId].size();
487 const auto &rp_pat_it = patterns->find(rpId);
489 unsigned int pat_u = 0, pat_v = 0;
490 if (rp_pat_it != patterns->end()) {
491 for (
auto &
p : *rp_pat_it) {
506 if (pl_u == 0 && pl_v == 0)
509 if (category == -1 && pat_u + pat_v <= 1) {
516 if (pat_u == 1 && pat_v == 1)
522 pp.event_category->Fill(category);
526 set<unsigned int> rps_with_tracks;
528 for (
auto &ds : *tracks) {
531 rps_with_tracks.insert(rpId);
533 auto plIt = potPlots.find(rpId);
534 if (plIt == potPlots.end())
536 auto &
plots = plIt->second;
538 for (
auto &ft : ds) {
543 unsigned int n_pl_in_fit_u = 0, n_pl_in_fit_v = 0;
544 for (
auto &hds : ft.hits()) {
548 for (
auto &
h : hds) {
557 plots.h_planes_fit_u->Fill(n_pl_in_fit_u);
558 plots.h_planes_fit_v->Fill(n_pl_in_fit_v);
573 double x = ft.x0() - rp_x;
574 double y = ft.y0() - rp_y;
576 plots.trackHitsCumulativeHist->Fill(x, y);
578 double U = x * rod_U.x() + y * rod_U.y();
579 double V = x * rod_V.x() + y * rod_V.y();
581 plots.track_u_profile->Fill(U);
582 plots.track_v_profile->Fill(V);
587 map<unsigned int, map<unsigned int, map<unsigned int, unsigned int>>>
589 for (
const auto &
dp : *digi) {
592 unsigned int uvFlag = (plId.isStripsCoordinateUDirection()) ? 0 : 1;
595 for (
const auto &
d :
dp) {
596 unsigned int sector =
d.stripNumber() / 32;
597 sectors.insert(sector);
600 for (
const auto §or : sectors)
601 triggerSectorMap[rpId][uvFlag][sector]++;
604 for (
auto &rpp : triggerSectorMap) {
605 const unsigned int rpId = rpp.first;
609 set<unsigned int> triggerSectorsU;
610 for (
const auto sp : rpp.second[0]) {
612 triggerSectorsU.insert(sp.first);
615 set<unsigned int> triggerSectorsV;
616 for (
const auto sp : rpp.second[1]) {
618 triggerSectorsV.insert(sp.first);
621 auto plIt = potPlots.find(rpId);
622 if (plIt == potPlots.end())
624 auto &
plots = plIt->second;
626 const bool high_mult = (triggerSectorsU.size() > 2 && triggerSectorsV.size() > 2);
628 const bool has_track = (rps_with_tracks.find(rpId) != rps_with_tracks.end());
630 for (
const auto &secU : triggerSectorsU) {
631 for (
const auto &secV : triggerSectorsV) {
632 plots.triggerSectorUVCorrelation_all->Fill(secV, secU);
635 plots.triggerSectorUVCorrelation_mult2->Fill(secV, secU);
638 plots.triggerSectorUVCorrelation_track->Fill(secV, secU);
Detector ID class for TOTEM Si strip detectors.
MonitorElement * event_category
T getParameter(std::string const &) const
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * triggerSectorUVCorrelation_all
Translation translation() const
MonitorElement * activity
MonitorElement * vfat_corruption
MonitorElement * h_planes_fit_u
virtual TH1F * getTH1F() const
MonitorElement * activity_per_bx
MonitorElement * triggerSectorUVCorrelation_track
int bunchCrossing() const
MonitorElement * track_u_profile
bool isStripsCoordinateUDirection() const
Event setup record containing the real (actual) geometry information.
edm::EDGetTokenT< edm::DetSetVector< TotemVFATStatus > > tokenStatus
plots related to one RP plane
std::map< unsigned int, PlanePlots > planePlots
MonitorElement * activity_v
MonitorElement * patterns_v
#define DEFINE_FWK_MODULE(type)
CLHEP::Hep3Vector rpTranslation(unsigned int id) const
~TotemRPDQMSource() override
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
MonitorElement * hit_plane_hist
const DetGeomDesc * sensor(unsigned int id) const
returns geometry of a detector performs necessary checks, returns NULL if fails
edm::EDGetTokenT< edm::DetSetVector< TotemRPUVPattern > > tokenUVPattern
CLHEP::Hep3Vector localToGlobalDirection(unsigned int id, const CLHEP::Hep3Vector &) const
void setPlane(uint32_t det)
MonitorElement * patterns_u
edm::EDGetTokenT< edm::DetSetVector< TotemRPCluster > > tokenCluster
MonitorElement * activity_u
Base class for CTPPS detector IDs.
TotemRPDQMSource(const edm::ParameterSet &ps)
MonitorElement * vfat_ec_bc_error
edm::EDGetTokenT< edm::DetSetVector< TotemRPRecHit > > tokenRecHit
edm::EDGetTokenT< edm::DetSetVector< TotemRPLocalTrack > > tokenLocalTrack
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
MonitorElement * activity_per_bx_short
edm::EDGetTokenT< edm::DetSetVector< TotemRPDigi > > tokenDigi
MonitorElement * trackHitsCumulativeHist