487 if (!hRecoProtonsSingleRP->empty())
491 throw cms::Exception(
"CTPPSProtonReconstructionPlotter") <<
"Number of non empty events reached maximum.";
502 std::map<unsigned int, unsigned int> armTrackCounter, armTimingTrackCounter;
504 for (
const auto &tr : *hTracks) {
506 unsigned int decRPId =
rpId.arm() * 100 +
rpId.station() * 10 +
rpId.rp();
517 armTrackCounter[
rpId.arm()]++;
519 const bool trackerRP =
522 armTimingTrackCounter[
rpId.arm()]++;
525 if (tr_L_N && tr_L_F) {
530 if (tr_R_N && tr_R_F) {
536 std::map<unsigned int, unsigned int> singleRPMultiplicity, multiRPMultiplicity;
539 multiRPMultiplicity[0] = multiRPMultiplicity[1] = 0;
542 for (
const auto &proton : *hRecoProtonsSingleRP) {
543 CTPPSDetId rpId((*proton.contributingLocalTracks().begin())->getRPId());
544 unsigned int decRPId =
rpId.arm() * 100 +
rpId.station() * 10 +
rpId.rp();
547 if (proton.validFit())
548 singleRPMultiplicity[decRPId]++;
551 for (
const auto it : singleRPMultiplicity)
555 for (
const auto &proton : *hRecoProtonsMultiRP) {
556 CTPPSDetId rpId((*proton.contributingLocalTracks().begin())->getRPId());
557 unsigned int armId =
rpId.arm();
560 if (proton.validFit())
561 multiRPMultiplicity[armId]++;
564 for (
const auto it : multiRPMultiplicity) {
566 pl.h_multiplicity->Fill(it.second);
567 pl.h2_timing_tracks_vs_prot_mult->Fill(it.second, armTimingTrackCounter[it.first]);
571 map<unsigned int, bool> clCo;
572 clCo[0] = (singleRPMultiplicity[
rpId_45_N_] && singleRPMultiplicity[
rpId_45_F_] && multiRPMultiplicity[0] == 1);
573 clCo[1] = (singleRPMultiplicity[
rpId_56_N_] && singleRPMultiplicity[
rpId_56_F_] && multiRPMultiplicity[1] == 1);
576 for (
const auto &proton : *hRecoProtonsMultiRP) {
577 if (!proton.validFit())
580 CTPPSDetId rpId_proton((*proton.contributingLocalTracks().begin())->getRPId());
581 unsigned int armId = rpId_proton.
arm();
584 for (
const auto &tr : *hTracks) {
586 if (rpId_tr.arm() != armId)
589 const bool trackerRP =
594 double de_x = 0., de_x_unc = 0.;
597 double rd = (de_x_unc > 0.) ? de_x / de_x_unc : -1E10;
599 pl.h_de_x_timing_vs_tracking->Fill(de_x);
600 pl.h_de_x_rel_timing_vs_tracking->Fill(rd);
601 pl.h_de_x_match_timing_vs_tracking->Fill(fabs(de_x / de_x_unc) <= 1. ? 1. : 0.);
604 if (armTimingTrackCounter[armId] == 1)
605 pl.h_de_x_rel_timing_vs_tracking_ClCo->Fill(rd);
611 for (
const auto &proton : *hRecoProtonsMultiRP) {
612 if (!proton.validFit())
615 CTPPSDetId rpId((*proton.contributingLocalTracks().begin())->getRPId());
616 unsigned int armId =
rpId.arm();
618 const auto &nTimingTracks = armTimingTrackCounter[armId];
623 double x_ref = 0., y_ref = 0.;
625 x_ref = tr_L_N->
getX();
626 y_ref = tr_L_N->
getY();
629 x_ref = tr_R_N->
getX();
630 y_ref = tr_R_N->
getY();
633 if (nTimingTracks == 0)
634 pl.h2_y_vs_x_tt0_ClCo->Fill(x_ref, y_ref);
635 if (nTimingTracks == 1)
636 pl.h2_y_vs_x_tt1_ClCo->Fill(x_ref, y_ref);
637 if (nTimingTracks > 1)
638 pl.h2_y_vs_x_ttm_ClCo->Fill(x_ref, y_ref);
642 for (
const auto &proton_m : *hRecoProtonsMultiRP) {
643 CTPPSDetId rpId_m((*proton_m.contributingLocalTracks().begin())->getRPId());
644 unsigned int arm = rpId_m.
arm();
655 for (
const auto &proton_s : *hRecoProtonsSingleRP) {
658 bool compatible =
false;
659 for (
const auto &tr_m : proton_m.contributingLocalTracks()) {
660 if (tr_m.key() == key_s) {
672 CTPPSDetId rpId_s((*proton_s.contributingLocalTracks().begin())->getRPId());
673 const unsigned int idx = rpId_s.arm() * 1000 + rpId_s.station() * 100 + rpId_s.rp() * 10 + rpId_s.arm();
679 const unsigned int rpDecId_s = rpId_s.arm() * 100 + rpId_s.station() * 10 + rpId_s.rp();
std::map< unsigned int, MultiRPPlots > multiRPPlots_
edm::EDGetTokenT< reco::ForwardProtonCollection > tokenRecoProtonsSingleRP_
std::unique_ptr< TProfile > p_y_R_diffNF_vs_y_R_N_
std::unique_ptr< TProfile > p_x_R_diffNF_vs_x_R_N_
std::map< unsigned int, SingleRPPlots > singleRPPlots_
Local (=single RP) track with essential information only.
signed int n_non_empty_events_
std::unique_ptr< TProfile > p_y_L_diffNF_vs_y_L_N_
edm::EDGetTokenT< CTPPSLocalTrackLiteCollection > tokenTracks_
float getX() const
returns the horizontal track position
Event setup record containing the real (actual) geometry information.
float getY() const
returns the vertical track position
const CTPPSLocalTrackLiteRefVector & contributingLocalTracks() const
list of RP tracks that contributed to this global track
std::map< unsigned int, ArmCorrelationPlots > armCorrelationPlots_
void CalculateTimingTrackingDistance(const reco::ForwardProton &proton, const CTPPSLocalTrackLite &tr, const CTPPSGeometry &geometry, double &de_x, double &de_x_unc)
Base class for CTPPS detector IDs.
signed int maxNonEmptyEvents_
std::map< unsigned int, SingleMultiCorrelationPlots > singleMultiCorrelationPlots_
edm::EDGetTokenT< reco::ForwardProtonCollection > tokenRecoProtonsMultiRP_
std::unique_ptr< TProfile > p_x_L_diffNF_vs_x_L_N_