163 h_trackCorr_hor = ibooker.
book2D(
"track correlation RP-210-hor",
"rp, 210, hor", 4, -0.5, 3.5, 4, -0.5, 3.5);
165 TAxis *xa = hist->GetXaxis(), *ya = hist->GetYaxis();
166 xa->SetBinLabel(1,
"45, 210, near"); ya->SetBinLabel(1,
"45, 210, near");
167 xa->SetBinLabel(2,
"45, 210, far"); ya->SetBinLabel(2,
"45, 210, far");
168 xa->SetBinLabel(3,
"56, 210, near"); ya->SetBinLabel(3,
"56, 210, near");
169 xa->SetBinLabel(4,
"56, 210, far"); ya->SetBinLabel(4,
"56, 210, far");
178 bool diag = (top45 != top56);
181 sprintf(name,
"%s 45%s - 56%s",
182 (diag) ?
"diagonal" :
"antidiagonal",
183 (top45) ?
"top" :
"bot",
184 (top56) ?
"top" :
"bot" 190 h_lrc_x_d = ibooker.
book2D(
"dx left vs right",
string(name) +
" : dx left vs. right, histogram;#Delta x_{45};#Delta x_{56}", 50, 0., 0., 50, 0., 0.);
191 h_lrc_x_n = ibooker.
book2D(
"xn left vs right",
string(name) +
" : xn left vs. right, histogram;x^{N}_{45};x^{N}_{56}", 50, 0., 0., 50, 0., 0.);
192 h_lrc_x_f = ibooker.
book2D(
"xf left vs right",
string(name) +
" : xf left vs. right, histogram;x^{F}_{45};x^{F}_{56}", 50, 0., 0., 50, 0., 0.);
194 h_lrc_y_d = ibooker.
book2D(
"dy left vs right",
string(name) +
" : dy left vs. right, histogram;#Delta y_{45};#Delta y_{56}", 50, 0., 0., 50, 0., 0.);
195 h_lrc_y_n = ibooker.
book2D(
"yn left vs right",
string(name) +
" : yn left vs. right, histogram;y^{N}_{45};y^{N}_{56}", 50, 0., 0., 50, 0., 0.);
196 h_lrc_y_f = ibooker.
book2D(
"yf left vs right",
string(name) +
" : yf left vs. right, histogram;y^{F}_{45};y^{F}_{56}", 50, 0., 0., 50, 0., 0.);
214 h_trackCorr = ibooker.
book2D(
"track RP correlation", title, 13, -0.5, 12.5, 13, -0.5, 12.5);
216 TAxis *xa = h_trackCorr_h->GetXaxis(), *ya = h_trackCorr_h->GetYaxis();
217 xa->SetBinLabel(1,
"210, near, top"); ya->SetBinLabel(1,
"210, near, top");
218 xa->SetBinLabel(2,
"bot"); ya->SetBinLabel(2,
"bot");
219 xa->SetBinLabel(3,
"hor"); ya->SetBinLabel(3,
"hor");
220 xa->SetBinLabel(4,
"far, hor"); ya->SetBinLabel(4,
"far, hor");
221 xa->SetBinLabel(5,
"top"); ya->SetBinLabel(5,
"top");
222 xa->SetBinLabel(6,
"bot"); ya->SetBinLabel(6,
"bot");
223 xa->SetBinLabel(8,
"220, near, top"); ya->SetBinLabel(8,
"220, near, top");
224 xa->SetBinLabel(9,
"bot"); ya->SetBinLabel(9,
"bot");
225 xa->SetBinLabel(10,
"hor"); ya->SetBinLabel(10,
"hor");
226 xa->SetBinLabel(11,
"far, hor"); ya->SetBinLabel(11,
"far, hor");
227 xa->SetBinLabel(12,
"top"); ya->SetBinLabel(12,
"top");
228 xa->SetBinLabel(13,
"bot"); ya->SetBinLabel(13,
"bot");
232 xa = h_trackCorr_h->GetXaxis(); ya = h_trackCorr_h->GetYaxis();
233 xa->SetBinLabel(1,
"210, near, top"); ya->SetBinLabel(1,
"210, near, top");
234 xa->SetBinLabel(2,
"bot"); ya->SetBinLabel(2,
"bot");
235 xa->SetBinLabel(3,
"hor"); ya->SetBinLabel(3,
"hor");
236 xa->SetBinLabel(4,
"far, hor"); ya->SetBinLabel(4,
"far, hor");
237 xa->SetBinLabel(5,
"top"); ya->SetBinLabel(5,
"top");
238 xa->SetBinLabel(6,
"bot"); ya->SetBinLabel(6,
"bot");
239 xa->SetBinLabel(8,
"220, near, top"); ya->SetBinLabel(8,
"220, near, top");
240 xa->SetBinLabel(9,
"bot"); ya->SetBinLabel(9,
"bot");
241 xa->SetBinLabel(10,
"hor"); ya->SetBinLabel(10,
"hor");
242 xa->SetBinLabel(11,
"far, hor"); ya->SetBinLabel(11,
"far, hor");
243 xa->SetBinLabel(12,
"top"); ya->SetBinLabel(12,
"top");
244 xa->SetBinLabel(13,
"bot"); ya->SetBinLabel(13,
"bot");
268 vfat_problem = ibooker.
book2D(
"vfats with any problem", title+
";plane;vfat index", 10, -0.5, 9.5, 4, -0.5, 3.5);
269 vfat_missing = ibooker.
book2D(
"vfats missing", title+
";plane;vfat index", 10, -0.5, 9.5, 4, -0.5, 3.5);
270 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);
271 vfat_corruption = ibooker.
book2D(
"vfats with data corruption", title+
";plane;vfat index", 10, -0.5, 9.5, 4, -0.5, 3.5);
273 activity = ibooker.
book1D(
"active planes", title+
";number of active planes", 11, -0.5, 10.5);
274 activity_u = ibooker.
book1D(
"active planes U", title+
";number of active U planes", 11, -0.5, 10.5);
275 activity_v = ibooker.
book1D(
"active planes V", title+
";number of active V planes", 11, -0.5, 10.5);
277 activity_per_bx = ibooker.
book1D(
"activity per BX", title+
";Event.BX", 4002, -1.5, 4000. + 0.5);
278 activity_per_bx_short = ibooker.
book1D(
"activity per BX (short)", title+
";Event.BX", 102, -1.5, 100. + 0.5);
280 hit_plane_hist = ibooker.
book2D(
"activity in planes (2D)", title+
";plane number;strip number", 10, -0.5, 9.5, 32, -0.5, 511.5);
282 patterns_u = ibooker.
book1D(
"recognized patterns U", title+
";number of recognized U patterns", 11, -0.5, 10.5);
283 patterns_v = ibooker.
book1D(
"recognized patterns V", title+
";number of recognized V patterns", 11, -0.5, 10.5);
285 h_planes_fit_u = ibooker.
book1D(
"planes contributing to fit U", title+
";number of planes contributing to U fit", 6, -0.5, 5.5);
286 h_planes_fit_v = ibooker.
book1D(
"planes contributing to fit V", title+
";number of planes contributing to V fit", 6, -0.5, 5.5);
288 event_category = ibooker.
book1D(
"event category", title+
";event category", 5, -0.5, 4.5);
289 TH1F *event_category_h = event_category->
getTH1F();
290 event_category_h->GetXaxis()->SetBinLabel(1,
"empty");
291 event_category_h->GetXaxis()->SetBinLabel(2,
"insufficient");
292 event_category_h->GetXaxis()->SetBinLabel(3,
"single-track");
293 event_category_h->GetXaxis()->SetBinLabel(4,
"multi-track");
294 event_category_h->GetXaxis()->SetBinLabel(5,
"shower");
296 trackHitsCumulativeHist = ibooker.
book2D(
"track XY profile", title+
";x (mm);y (mm)", 100, -18., +18., 100, -18., +18.);
298 track_u_profile = ibooker.
book1D(
"track profile U", title+
"; U (mm)", 512, -256*66E-3, +256*66E-3);
299 track_v_profile = ibooker.
book1D(
"track profile V", title+
"; V (mm)", 512, -256*66E-3, +256*66E-3);
314 digi_profile_cumulative = ibooker.
book1D(
"digi profile", title+
";strip number", 512, -0.5, 511.5);
315 cluster_profile_cumulative = ibooker.
book1D(
"cluster profile", title+
";cluster center", 1024, -0.25, 511.75);
316 hit_multiplicity = ibooker.
book1D(
"hit multiplicity", title+
";hits/detector/event", 6, -0.5, 5.5);
317 cluster_size = ibooker.
book1D(
"cluster size", title+
";hits per cluster", 5, 0.5, 5.5);
319 efficiency_num = ibooker.
book1D(
"efficiency num", title+
";track position (mm)", 30, -15., 0.);
320 efficiency_den = ibooker.
book1D(
"efficiency den", title+
";track position (mm)", 30, -15., 0.);
327 verbosity(ps.getUntrackedParameter<unsigned
int>(
"verbosity", 0))
373 for (
unsigned int arm = 0; arm < 2; arm++)
379 for (
unsigned int st = 0; st < 3; st += 2)
385 for (
unsigned int rp = 0; rp < 6; ++rp)
391 for (
unsigned int pl = 0; pl < 10; ++pl)
453 "ERROR in TotemDQMModuleRP::analyze > some of the required inputs are not valid. Skipping this event.\n" 454 <<
" status.isValid = " << status.
isValid() <<
"\n" 455 <<
" digi.isValid = " << digi.
isValid() <<
"\n" 456 <<
" digCluster.isValid = " << digCluster.
isValid() <<
"\n" 457 <<
" hits.isValid = " << hits.
isValid() <<
"\n" 458 <<
" patterns.isValid = " << patterns.
isValid() <<
"\n" 459 <<
" tracks.isValid = " << tracks.
isValid();
472 for (
auto &ds1 : *tracks)
474 for (
auto &tr1 : ds1)
479 unsigned int rpId1 = ds1.detId();
480 unsigned int arm1 = rpId1 / 100;
481 unsigned int stNum1 = (rpId1 / 10) % 10;
482 unsigned int rpNum1 = rpId1 % 10;
483 if (stNum1 != 0 || (rpNum1 != 2 && rpNum1 != 3))
485 unsigned int idx1 = arm1*2 + rpNum1-2;
487 for (
auto &ds2 : *tracks)
489 for (
auto &tr2 : ds2)
494 unsigned int rpId2 = ds2.detId();
495 unsigned int arm2 = rpId2 / 100;
496 unsigned int stNum2 = (rpId2 / 10) % 10;
497 unsigned int rpNum2 = rpId2 % 10;
498 if (stNum2 != 0 || (rpNum2 != 2 && rpNum2 != 3))
500 unsigned int idx2 = arm2*2 + rpNum2-2;
511 for (
auto &ds : *status)
514 unsigned int plNum = detId.
plane();
523 plots.vfat_problem->Fill(plNum,
s.getChipPosition());
524 plots.vfat_missing->Fill(plNum,
s.getChipPosition());
527 if (
s.isECProgressError() ||
s.isBCProgressError())
529 plots.vfat_problem->Fill(plNum,
s.getChipPosition());
530 plots.vfat_ec_bc_error->Fill(plNum,
s.getChipPosition());
533 if (
s.isIDMismatch() ||
s.isFootprintError() ||
s.isCRCError())
535 plots.vfat_problem->Fill(plNum,
s.getChipPosition());
536 plots.vfat_corruption->Fill(plNum,
s.getChipPosition());
549 planePlots[detId].digi_profile_cumulative->Fill(dit->getStripNumber());
557 planePlots[detId].cluster_profile_cumulative->Fill(dit->getCenterStripPosition());
564 planePlots[detId].hit_multiplicity->Fill(it->size());
572 planePlots[detId].cluster_size->Fill(dit->getNumberOfStrips());
576 for (
auto &ds : *tracks)
578 unsigned int rpDecId = ds.detId();
579 unsigned int armIdx = rpDecId / 100;
580 unsigned int stIdx = (rpDecId / 10) % 10;
581 unsigned int rpIdx = rpDecId % 10;
591 for (
unsigned int plNum = 0; plNum < 10; ++plNum)
595 double ft_z = ft.getZ0();
596 double ft_x = ft.getX0() + ft.getTx() * (ft_z - rp_z);
597 double ft_y = ft.getY0() + ft.getTy() * (ft_z - rp_z);
599 double ft_v = geometry->
GlobalToLocal(plId, CLHEP::Hep3Vector(ft_x, ft_y, ft_z)).y();
601 bool hasMatchingHit =
false;
602 const auto &hit_ds_it = hits->find(plId);
603 if (hit_ds_it != hits->end())
605 for (
const auto &
h : *hit_ds_it)
607 bool match = (fabs(ft_v -
h.getPosition()) < 2.*0.066);
610 hasMatchingHit =
true;
618 pp.efficiency_den->Fill(ft_v);
620 pp.efficiency_num->Fill(ft_v);
630 map<unsigned int, set<unsigned int> > planes;
631 map<unsigned int, set<unsigned int> > planes_u;
632 map<unsigned int, set<unsigned int> > planes_v;
633 for (
const auto &ds : *hits)
639 unsigned int planeNum = detId.
plane();
642 planes[rpId].insert(planeNum);
643 if (detId.isStripsCoordinateUDirection())
644 planes_u[rpId].
insert(planeNum);
646 planes_v[rpId].insert(planeNum);
649 for (
const auto &ds : *status)
651 bool activity =
false;
652 for (
const auto &
s : ds)
654 if (
s.isNumberOfClustersSpecified() &&
s.getNumberOfClusters() > 0)
665 unsigned int planeNum = detId.
plane();
668 planes[rpId].insert(planeNum);
669 if (detId.isStripsCoordinateUDirection())
670 planes_u[rpId].
insert(planeNum);
672 planes_v[rpId].insert(planeNum);
676 for (std::map<unsigned int, PotPlots>::iterator it =
potPlots.begin(); it !=
potPlots.end(); it++)
678 it->second.activity->Fill(planes[it->first].size());
679 it->second.activity_u->Fill(planes_u[it->first].size());
680 it->second.activity_v->Fill(planes_v[it->first].size());
682 if (planes[it->first].size() >= 6)
685 it->second.activity_per_bx_short->Fill(event.
bunchCrossing());
692 unsigned int planeNum = detId.
plane();
701 for (
auto &ds : *patterns)
703 unsigned int rpDecId = ds.detId();
704 unsigned int armIdx = rpDecId / 100;
705 unsigned int stIdx = (rpDecId / 10) % 10;
706 unsigned int rpIdx = rpDecId % 10;
712 unsigned int u = 0,
v = 0;
715 if (!
p.getFittable())
733 auto &
pp = it.second;
736 unsigned int pl_u = planes_u[rpId].size();
737 unsigned int pl_v = planes_v[rpId].size();
741 const auto &rp_pat_it = patterns->find(rpDecId);
743 unsigned int pat_u = 0, pat_v = 0;
744 if (rp_pat_it != patterns->end())
746 for (
auto &
p : *rp_pat_it)
748 if (!
p.getFittable())
762 if (pl_u == 0 && pl_v == 0) category = 0;
764 if (category == -1 && pat_u + pat_v <= 1)
772 if (pat_u == 1 && pat_v == 1) category = 2;
774 if (category == -1) category = 3;
776 pp.event_category->Fill(category);
780 for (
auto &ds : *tracks)
782 unsigned int rpDecId = ds.detId();
783 unsigned int armIdx = rpDecId / 100;
784 unsigned int stIdx = (rpDecId / 10) % 10;
785 unsigned int rpIdx = rpDecId % 10;
796 unsigned int n_pl_in_fit_u = 0, n_pl_in_fit_v = 0;
797 for (
auto &hds : ft.getHits())
828 double x = ft.getX0() - rp_x;
829 double y = ft.getY0() - rp_y;
833 double U = x * rod_U.x() + y * rod_U.y();
834 double V = x * rod_V.x() + y * rod_V.y();
848 map<unsigned int, unsigned int>
mTop, mHor, mBot;
857 for (
auto &ds : *tracks)
859 unsigned int rpDecId = ds.detId();
860 unsigned int armIdx = rpDecId / 100;
861 unsigned int stIdx = (rpDecId / 10) % 10;
862 unsigned int rpIdx = rpDecId % 10;
865 unsigned int rpNum = rpId.
rp();
874 if (rpNum == 0 || rpNum == 4)
876 if (rpNum == 2 || rpNum == 3)
878 if (rpNum == 1 || rpNum == 5)
883 for (
auto &
p : armPlots)
885 p.second.h_numRPWithTrack_top->Fill(mTop[
p.first]);
886 p.second.h_numRPWithTrack_hor->Fill(mHor[
p.first]);
887 p.second.h_numRPWithTrack_bot->Fill(mBot[
p.first]);
891 for (
auto &ds1 : *tracks)
893 for (
auto &tr1 : ds1)
898 unsigned int rpDecId1 = ds1.detId();
899 unsigned int arm1 = rpDecId1 / 100;
900 unsigned int stNum1 = (rpDecId1 / 10) % 10;
901 unsigned int rpNum1 = rpDecId1 % 10;
902 unsigned int idx1 = stNum1/2 * 7 + rpNum1;
903 bool hor1 = (rpNum1 == 2 || rpNum1 == 3);
908 for (
auto &ds2 : *tracks)
910 for (
auto &tr2 : ds2)
915 unsigned int rpDecId2 = ds2.detId();
916 unsigned int arm2 = rpDecId2 / 100;
917 unsigned int stNum2 = (rpDecId2 / 10) % 10;
918 unsigned int rpNum2 = rpDecId2 % 10;
919 unsigned int idx2 = stNum2/2 * 7 + rpNum2;
920 bool hor2 = (rpNum2 == 2 || rpNum2 == 3);
Detector ID class for TOTEM Si strip detectors.
T getParameter(std::string const &) const
MonitorElement * h_lrc_x_n
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
void Init(DQMStore::IBooker &ibooker)
MonitorElement * h_trackCorr_overlap
CLHEP::Hep3Vector GetRPGlobalTranslation(int copy_no) const
position of a RP package (translation z corresponds to the first plane - TODO check it) ...
MonitorElement * h_planes_fit_u
#define DEFINE_FWK_MODULE(type)
std::map< unsigned int, ArmPlots > armPlots
int bunchCrossing() const
uint32_t getRPDecimalId() const
DetGeomDesc * GetDetector(unsigned int) const
returns geometry of a detector performs necessary checks, returns NULL if fails input is raw ID ...
MonitorElement * events_per_bx
MonitorElement * h_lrc_x_f
MonitorElement * track_u_profile
void endRun(edm::Run const &run, edm::EventSetup const &eSetup) override
bool isStripsCoordinateUDirection() const
MonitorElement * h_trackCorr
edm::EDGetTokenT< edm::DetSetVector< TotemRPDigi > > tokenDigi
MonitorElement * h_lrc_y_d
Event setup record containing the real (actual) geometry information.
MonitorElement * h_numRPWithTrack_top
const PhiMemoryImage patterns[9]
plots related to one RP plane
std::map< unsigned int, PlanePlots > planePlots
MonitorElement * h_numRPWithTrack_hor
edm::EDGetTokenT< edm::DetSetVector< TotemRPRecHit > > tokenRecHit
MonitorElement * h_lrc_y_f
MonitorElement * patterns_v
plots related to one (anti)diagonal
void beginLuminosityBlock(edm::LuminosityBlock const &lumi, edm::EventSetup const &eSetup) override
virtual ~TotemRPDQMSource()
edm::EDGetTokenT< edm::DetSetVector< TotemRPUVPattern > > tokenUVPattern
MonitorElement * h_numRPWithTrack_bot
MonitorElement * book1D(Args &&...args)
MonitorElement * h_trackCorr_hor
DDTranslation translation() const
void rpName(std::string &name, NameFlag flag=nFull) const
CTPPSDetId getRPId() const
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
CLHEP::Hep3Vector GlobalToLocal(DetGeomDesc *gd, const CLHEP::Hep3Vector r) const
MonitorElement * events_per_bx_short
void armName(std::string &name, NameFlag flag=nFull) const
CLHEP::Hep3Vector LocalToGlobalDirection(unsigned int id, const CLHEP::Hep3Vector dir) const
MonitorElement * track_v_profile
plots related to one station
edm::EDGetTokenT< edm::DetSetVector< TotemRPCluster > > tokenCluster
MonitorElement * hit_plane_hist
std::map< unsigned int, StationPlots > stationPlots
void setCurrentFolder(const std::string &fullpath)
CTPPSDetId getArmId() const
MonitorElement * book2D(Args &&...args)
void setPlane(uint32_t det)
void endLuminosityBlock(edm::LuminosityBlock const &lumi, edm::EventSetup const &eSetup) override
TH1F * getTH1F(void) const
MonitorElement * patterns_u
MonitorElement * h_lrc_x_d
Base class for CTPPS detector IDs.
TotemRPDQMSource(const edm::ParameterSet &ps)
ESHandle< TrackerGeometry > geometry
void stationName(std::string &name, NameFlag flag=nFull) const
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.
plots related to the whole system
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
std::map< unsigned int, DiagonalPlots > diagonalPlots
TH2F * getTH2F(void) const
MonitorElement * h_planes_fit_v
MonitorElement * h_lrc_y_n
edm::EDGetTokenT< edm::DetSetVector< TotemRPLocalTrack > > tokenLocalTrack
edm::EDGetTokenT< edm::DetSetVector< TotemVFATStatus > > tokenStatus
MonitorElement * trackHitsCumulativeHist