CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
CTPPSProtonReconstructionPlotter Class Reference
Inheritance diagram for CTPPSProtonReconstructionPlotter:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Classes

struct  ArmCorrelationPlots
 
struct  AssociationCuts
 
struct  MultiRPPlots
 
struct  SingleMultiCorrelationPlots
 
struct  SingleRPPlots
 

Public Member Functions

 CTPPSProtonReconstructionPlotter (const edm::ParameterSet &)
 
 ~CTPPSProtonReconstructionPlotter () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void CalculateTimingTrackingDistance (const reco::ForwardProton &proton, const CTPPSLocalTrackLite &tr, const CTPPSGeometry &geometry, double &x_tr, double &x_ti, double &de_x, double &de_x_unc)
 
void endJob () override
 

Static Private Member Functions

static void profileToRMSGraph (TProfile *p, TGraphErrors *g)
 

Private Attributes

std::map< unsigned int, ArmCorrelationPlotsarmCorrelationPlots_
 
std::map< unsigned int, AssociationCutsassociation_cuts_
 
edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecordgeometryESToken_
 
signed int maxNonEmptyEvents_
 
std::map< unsigned int, MultiRPPlotsmultiRPPlots_
 
signed int n_non_empty_events_
 
std::string outputFile_
 
std::unique_ptr< TProfile > p_x_L_diffNF_vs_x_L_N_
 
std::unique_ptr< TProfile > p_x_R_diffNF_vs_x_R_N_
 
std::unique_ptr< TProfile > p_y_L_diffNF_vs_y_L_N_
 
std::unique_ptr< TProfile > p_y_R_diffNF_vs_y_R_N_
 
unsigned int rpId_45_F_
 
unsigned int rpId_45_N_
 
unsigned int rpId_56_F_
 
unsigned int rpId_56_N_
 
std::map< unsigned int, SingleMultiCorrelationPlotssingleMultiCorrelationPlots_
 
std::map< unsigned int, SingleRPPlotssingleRPPlots_
 
edm::EDGetTokenT< reco::ForwardProtonCollectiontokenRecoProtonsMultiRP_
 
edm::EDGetTokenT< reco::ForwardProtonCollectiontokenRecoProtonsSingleRP_
 
edm::EDGetTokenT< CTPPSLocalTrackLiteCollectiontokenTracks_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 33 of file CTPPSProtonReconstructionPlotter.cc.

Constructor & Destructor Documentation

◆ CTPPSProtonReconstructionPlotter()

CTPPSProtonReconstructionPlotter::CTPPSProtonReconstructionPlotter ( const edm::ParameterSet ps)
explicit

Definition at line 483 of file CTPPSProtonReconstructionPlotter.cc.

485  : tokenTracks_(consumes<CTPPSLocalTrackLiteCollection>(ps.getParameter<edm::InputTag>("tagTracks"))),
487  consumes<reco::ForwardProtonCollection>(ps.getParameter<InputTag>("tagRecoProtonsSingleRP"))),
489  consumes<reco::ForwardProtonCollection>(ps.getParameter<InputTag>("tagRecoProtonsMultiRP"))),
491 
492  rpId_45_N_(ps.getParameter<unsigned int>("rpId_45_N")),
493  rpId_45_F_(ps.getParameter<unsigned int>("rpId_45_F")),
494  rpId_56_N_(ps.getParameter<unsigned int>("rpId_56_N")),
495  rpId_56_F_(ps.getParameter<unsigned int>("rpId_56_F")),
496 
497  outputFile_(ps.getParameter<string>("outputFile")),
498  maxNonEmptyEvents_(ps.getUntrackedParameter<signed int>("maxNonEmptyEvents", -1)),
499 
500  p_x_L_diffNF_vs_x_L_N_(new TProfile("p_x_L_diffNF_vs_x_L_N", ";x_{LN};x_{LF} - x_{LN}", 100, 0., +20.)),
501  p_x_R_diffNF_vs_x_R_N_(new TProfile("p_x_R_diffNF_vs_x_R_N", ";x_{RN};x_{RF} - x_{RN}", 100, 0., +20.)),
502 
503  p_y_L_diffNF_vs_y_L_N_(new TProfile("p_y_L_diffNF_vs_y_L_N", ";y_{LN};y_{LF} - y_{LN}", 100, -20., +20.)),
504  p_y_R_diffNF_vs_y_R_N_(new TProfile("p_y_R_diffNF_vs_y_R_N", ";y_{RN};y_{RF} - y_{RN}", 100, -20., +20.)),
505 
507  for (const std::string &sector : {"45", "56"}) {
508  const unsigned int arm = (sector == "45") ? 0 : 1;
509  association_cuts_[arm].load(ps.getParameterSet("association_cuts_" + sector));
510  }

References protons_cff::arm, association_cuts_, edm::ParameterSet::getParameterSet(), and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~CTPPSProtonReconstructionPlotter()

CTPPSProtonReconstructionPlotter::~CTPPSProtonReconstructionPlotter ( )
inlineoverride

Definition at line 38 of file CTPPSProtonReconstructionPlotter.cc.

39 :
40  void analyze(const edm::Event &, const edm::EventSetup &) override;

Member Function Documentation

◆ analyze()

void CTPPSProtonReconstructionPlotter::analyze ( const edm::Event event,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 544 of file CTPPSProtonReconstructionPlotter.cc.

545  {
546  // get input
548  event.getByToken(tokenTracks_, hTracks);
549 
550  Handle<reco::ForwardProtonCollection> hRecoProtonsSingleRP;
551  event.getByToken(tokenRecoProtonsSingleRP_, hRecoProtonsSingleRP);
552 
553  Handle<reco::ForwardProtonCollection> hRecoProtonsMultiRP;
554  event.getByToken(tokenRecoProtonsMultiRP_, hRecoProtonsMultiRP);
555 
556  if (!hRecoProtonsSingleRP->empty())
558 
560  throw cms::Exception("CTPPSProtonReconstructionPlotter") << "Number of non empty events reached maximum.";
561 
562  // get conditions
563  const auto &geometry = iSetup.getData(geometryESToken_);
564 
565  // track plots
566  const CTPPSLocalTrackLite *tr_L_N = nullptr;
567  const CTPPSLocalTrackLite *tr_L_F = nullptr;
568  const CTPPSLocalTrackLite *tr_R_N = nullptr;
569  const CTPPSLocalTrackLite *tr_R_F = nullptr;
570  std::map<unsigned int, unsigned int> armTrackCounter, armTimingTrackCounter;
571  std::map<unsigned int, unsigned int> armTrackCounter_N, armTrackCounter_F;
572 
573  for (const auto &tr : *hTracks) {
574  CTPPSDetId rpId(tr.rpId());
575  unsigned int decRPId = rpId.arm() * 100 + rpId.station() * 10 + rpId.rp();
576 
577  if (decRPId == rpId_45_N_) {
578  tr_L_N = &tr;
579  armTrackCounter_N[0]++;
580  }
581  if (decRPId == rpId_45_F_) {
582  tr_L_F = &tr;
583  armTrackCounter_F[0]++;
584  }
585  if (decRPId == rpId_56_N_) {
586  tr_R_N = &tr;
587  armTrackCounter_N[1]++;
588  }
589  if (decRPId == rpId_56_F_) {
590  tr_R_F = &tr;
591  armTrackCounter_F[1]++;
592  }
593 
594  armTrackCounter[rpId.arm()]++;
595 
596  const bool trackerRP =
597  (rpId.subdetId() == CTPPSDetId::sdTrackingStrip || rpId.subdetId() == CTPPSDetId::sdTrackingPixel);
598  if (!trackerRP)
599  armTimingTrackCounter[rpId.arm()]++;
600  }
601 
602  if (tr_L_N && tr_L_F) {
603  p_x_L_diffNF_vs_x_L_N_->Fill(tr_L_N->x(), tr_L_F->x() - tr_L_N->x());
604  p_y_L_diffNF_vs_y_L_N_->Fill(tr_L_N->y(), tr_L_F->y() - tr_L_N->y());
605  }
606 
607  if (tr_R_N && tr_R_F) {
608  p_x_R_diffNF_vs_x_R_N_->Fill(tr_R_N->x(), tr_R_F->x() - tr_R_N->x());
609  p_y_R_diffNF_vs_y_R_N_->Fill(tr_R_N->y(), tr_R_F->y() - tr_R_N->y());
610  }
611 
612  // initialise multiplicity counters
613  std::map<unsigned int, unsigned int> singleRPMultiplicity, multiRPMultiplicity;
614  singleRPMultiplicity[rpId_45_N_] = singleRPMultiplicity[rpId_45_F_] = singleRPMultiplicity[rpId_56_N_] =
615  singleRPMultiplicity[rpId_56_F_] = 0;
616  multiRPMultiplicity[0] = multiRPMultiplicity[1] = 0;
617 
618  // make single-RP-reco plots
619  for (const auto &proton : *hRecoProtonsSingleRP) {
620  CTPPSDetId rpId((*proton.contributingLocalTracks().begin())->rpId());
621  unsigned int decRPId = rpId.arm() * 100 + rpId.station() * 10 + rpId.rp();
622 
623  const bool n1f1 = (armTrackCounter_N[rpId.arm()] == 1 && armTrackCounter_F[rpId.arm()] == 1);
624 
625  singleRPPlots_[decRPId].fill(proton, armTrackCounter[rpId.arm()], n1f1);
626 
627  if (proton.validFit())
628  singleRPMultiplicity[decRPId]++;
629  }
630 
631  for (const auto it : singleRPMultiplicity)
632  singleRPPlots_[it.first].h_multiplicity->Fill(it.second);
633 
634  // make multi-RP-reco plots
635  for (const auto &proton : *hRecoProtonsMultiRP) {
636  CTPPSDetId rpId((*proton.contributingLocalTracks().begin())->rpId());
637  unsigned int armId = rpId.arm();
638 
639  const bool n1f1 = (armTrackCounter_N[armId] == 1 && armTrackCounter_F[armId] == 1);
640 
641  multiRPPlots_[armId].fill(proton, armTrackCounter[armId], n1f1);
642 
643  if (proton.validFit())
644  multiRPMultiplicity[armId]++;
645  }
646 
647  for (const auto it : multiRPMultiplicity) {
648  const auto &pl = multiRPPlots_[it.first];
649  pl.h_multiplicity->Fill(it.second);
650  pl.h2_timing_tracks_vs_prot_mult->Fill(it.second, armTimingTrackCounter[it.first]);
651  }
652 
653  // define "clean condition" for each arm
654  map<unsigned int, bool> clCo;
655  clCo[0] = (singleRPMultiplicity[rpId_45_N_] && singleRPMultiplicity[rpId_45_F_] && multiRPMultiplicity[0] == 1);
656  clCo[1] = (singleRPMultiplicity[rpId_56_N_] && singleRPMultiplicity[rpId_56_F_] && multiRPMultiplicity[1] == 1);
657 
658  // plot distances between multi-RP protons and timing tracks in the same arm
659  for (const auto &proton : *hRecoProtonsMultiRP) {
660  if (!proton.validFit())
661  continue;
662 
663  CTPPSDetId rpId_proton((*proton.contributingLocalTracks().begin())->rpId());
664  unsigned int armId = rpId_proton.arm();
665  const auto &pl = multiRPPlots_[armId];
666 
667  for (const auto &tr : *hTracks) {
668  CTPPSDetId rpId_tr(tr.rpId());
669  if (rpId_tr.arm() != armId)
670  continue;
671 
672  const bool trackerRP =
673  (rpId_tr.subdetId() == CTPPSDetId::sdTrackingStrip || rpId_tr.subdetId() == CTPPSDetId::sdTrackingPixel);
674  if (trackerRP)
675  continue;
676 
677  double x_tr = -1., x_ti = -1.;
678  double de_x = 0., de_x_unc = 0.;
679  CalculateTimingTrackingDistance(proton, tr, geometry, x_tr, x_ti, de_x, de_x_unc);
680 
681  const double rd = (de_x_unc > 0.) ? de_x / de_x_unc : -1E10;
682  const auto &ac = association_cuts_[armId];
683  const bool match = (ac.ti_tr_min <= fabs(rd) && fabs(rd) <= ac.ti_tr_max);
684 
685  pl.h_de_x_timing_vs_tracking->Fill(de_x);
686  pl.h_de_x_rel_timing_vs_tracking->Fill(rd);
687  pl.h_de_x_match_timing_vs_tracking->Fill(match ? 1. : 0.);
688 
689  if (clCo[armId] && armTimingTrackCounter[armId] == 1) {
690  pl.h2_x_timing_vs_x_tracking_ClCo->Fill(x_tr, x_ti);
691 
692  pl.h_de_x_timing_vs_tracking_ClCo->Fill(de_x);
693  pl.h_de_x_rel_timing_vs_tracking_ClCo->Fill(rd);
694  pl.h_de_x_match_timing_vs_tracking_ClCo->Fill(match ? 1. : 0.);
695 
696  pl.p_time_unc_vs_x_ClCo->Fill(x_tr, proton.timeError());
697  }
698  }
699  }
700 
701  // plot xy maps
702  for (const auto &proton : *hRecoProtonsMultiRP) {
703  if (!proton.validFit())
704  continue;
705 
706  CTPPSDetId rpId((*proton.contributingLocalTracks().begin())->rpId());
707  unsigned int armId = rpId.arm();
708  const auto &pl = multiRPPlots_[armId];
709  const auto &nTimingTracks = armTimingTrackCounter[armId];
710 
711  if (!clCo[armId])
712  continue;
713 
714  double x_ref = 0., y_ref = 0.;
715  if (armId == 0) {
716  x_ref = tr_L_N->x();
717  y_ref = tr_L_N->y();
718  }
719  if (armId == 1) {
720  x_ref = tr_R_N->x();
721  y_ref = tr_R_N->y();
722  }
723 
724  if (nTimingTracks == 0)
725  pl.h2_y_vs_x_tt0_ClCo->Fill(x_ref, y_ref);
726  if (nTimingTracks == 1)
727  pl.h2_y_vs_x_tt1_ClCo->Fill(x_ref, y_ref);
728  if (nTimingTracks > 1)
729  pl.h2_y_vs_x_ttm_ClCo->Fill(x_ref, y_ref);
730  }
731 
732  // make correlation plots
733  for (const auto &proton_m : *hRecoProtonsMultiRP) {
734  CTPPSDetId rpId_m((*proton_m.contributingLocalTracks().begin())->rpId());
735  unsigned int arm = rpId_m.arm();
736 
737  const reco::ForwardProton *p_s_N = nullptr, *p_s_F = nullptr;
738 
739  for (const auto &proton_s : *hRecoProtonsSingleRP) {
740  // skip if source of single-RP reco not included in multi-RP reco
741  const auto key_s = proton_s.contributingLocalTracks()[0].key();
742  bool compatible = false;
743  for (const auto &tr_m : proton_m.contributingLocalTracks()) {
744  if (tr_m.key() == key_s) {
745  compatible = true;
746  break;
747  }
748  }
749 
750  if (!compatible)
751  continue;
752 
753  // fill single-multi plots
754  CTPPSDetId rpId_s((*proton_s.contributingLocalTracks().begin())->rpId());
755  const unsigned int idx = rpId_s.arm() * 1000 + rpId_s.station() * 100 + rpId_s.rp() * 10 + rpId_s.arm();
756  singleMultiCorrelationPlots_[idx].fill(proton_s, proton_m);
757 
758  // select protons for arm-correlation plots
759  const unsigned int rpDecId_s = rpId_s.arm() * 100 + rpId_s.station() * 10 + rpId_s.rp();
760  if (rpDecId_s == rpId_45_N_ || rpDecId_s == rpId_56_N_)
761  p_s_N = &proton_s;
762  if (rpDecId_s == rpId_45_F_ || rpDecId_s == rpId_56_F_)
763  p_s_F = &proton_s;
764  }
765 
766  // fill arm-correlation plots
767  if (p_s_N && p_s_F)
768  armCorrelationPlots_[arm].fill(*p_s_N, *p_s_F, proton_m);
769  }

References protons_cff::arm, CTPPSDetId::arm(), armCorrelationPlots_, association_cuts_, CalculateTimingTrackingDistance(), reco::ForwardProton::contributingLocalTracks(), alignCSCRings::de_x, protons_cff::decRPId, Exception, geometryESToken_, edm::EventSetup::getData(), heavyIonCSV_trainingSettings::idx, match(), maxNonEmptyEvents_, multiRPPlots_, n_non_empty_events_, p_x_L_diffNF_vs_x_L_N_, p_x_R_diffNF_vs_x_R_N_, p_y_L_diffNF_vs_y_L_N_, p_y_R_diffNF_vs_y_R_N_, profile_2016_postTS2_cff::rpId, rpId_45_F_, rpId_45_N_, rpId_56_F_, rpId_56_N_, CTPPSDetId::sdTrackingPixel, CTPPSDetId::sdTrackingStrip, singleMultiCorrelationPlots_, singleRPPlots_, tokenRecoProtonsMultiRP_, tokenRecoProtonsSingleRP_, tokenTracks_, CTPPSLocalTrackLite::x(), and CTPPSLocalTrackLite::y().

◆ CalculateTimingTrackingDistance()

void CTPPSProtonReconstructionPlotter::CalculateTimingTrackingDistance ( const reco::ForwardProton proton,
const CTPPSLocalTrackLite tr,
const CTPPSGeometry geometry,
double &  x_tr,
double &  x_ti,
double &  de_x,
double &  de_x_unc 
)
private

Definition at line 514 of file CTPPSProtonReconstructionPlotter.cc.

521  {
522  // identify tracking-RP tracks
523  const auto &tr_i = *proton.contributingLocalTracks().at(0);
524  const auto &tr_j = *proton.contributingLocalTracks().at(1);
525 
526  const double z_i = geometry.rpTranslation(tr_i.rpId()).z();
527  const double z_j = geometry.rpTranslation(tr_j.rpId()).z();
528 
529  // interpolation from tracking RPs
530  const double z_ti = -geometry.rpTranslation(tr_ti.rpId()).z(); // the minus sign fixes a bug in the diamond geometry
531  const double f_i = (z_ti - z_j) / (z_i - z_j), f_j = (z_i - z_ti) / (z_i - z_j);
532  const double x_inter = f_i * tr_i.x() + f_j * tr_j.x();
533  const double x_inter_unc_sq = f_i * f_i * tr_i.xUnc() * tr_i.xUnc() + f_j * f_j * tr_j.xUnc() * tr_j.xUnc();
534 
535  // save distance
536  x_tr = x_inter;
537  x_ti = tr_ti.x();
538 
539  de_x = tr_ti.x() - x_inter;
540  de_x_unc = sqrt(tr_ti.xUnc() * tr_ti.xUnc() + x_inter_unc_sq);

References edm::RefVector< C, T, F >::at(), reco::ForwardProton::contributingLocalTracks(), alignCSCRings::de_x, CTPPSLocalTrackLite::rpId(), mathSSE::sqrt(), CTPPSLocalTrackLite::x(), CTPPSLocalTrackLite::xUnc(), and z.

Referenced by analyze().

◆ endJob()

void CTPPSProtonReconstructionPlotter::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 773 of file CTPPSProtonReconstructionPlotter.cc.

774  {
775  LogInfo("CTPPSProtonReconstructionPlotter") << "n_non_empty_events = " << n_non_empty_events_;
776 
777  auto f_out = std::make_unique<TFile>(outputFile_.c_str(), "recreate");
778 
779  p_x_L_diffNF_vs_x_L_N_->Write();
780  p_x_R_diffNF_vs_x_R_N_->Write();
781 
782  p_y_L_diffNF_vs_y_L_N_->Write();
783  p_y_R_diffNF_vs_y_R_N_->Write();
784 
785  TDirectory *d_singleRPPlots = f_out->mkdir("singleRPPlots");
786  for (const auto &it : singleRPPlots_) {
787  gDirectory = d_singleRPPlots->mkdir(Form("rp%u", it.first));
788  it.second.write();
789  }
790 
791  TDirectory *d_multiRPPlots = f_out->mkdir("multiRPPlots");
792  for (const auto &it : multiRPPlots_) {
793  gDirectory = d_multiRPPlots->mkdir(Form("arm%u", it.first));
794  it.second.write();
795  }
796 
797  TDirectory *d_singleMultiCorrelationPlots = f_out->mkdir("singleMultiCorrelationPlots");
798  for (const auto &it : singleMultiCorrelationPlots_) {
799  unsigned int si_rp = it.first / 10;
800  unsigned int mu_arm = it.first % 10;
801 
802  gDirectory = d_singleMultiCorrelationPlots->mkdir(Form("si_rp%u_mu_arm%u", si_rp, mu_arm));
803  it.second.write();
804  }
805 
806  TDirectory *d_armCorrelationPlots = f_out->mkdir("armCorrelationPlots");
807  for (const auto &it : armCorrelationPlots_) {
808  gDirectory = d_armCorrelationPlots->mkdir(Form("arm%u", it.first));
809  it.second.write();
810  }

References armCorrelationPlots_, multiRPPlots_, n_non_empty_events_, outputFile_, p_x_L_diffNF_vs_x_L_N_, p_x_R_diffNF_vs_x_R_N_, p_y_L_diffNF_vs_y_L_N_, p_y_R_diffNF_vs_y_R_N_, singleMultiCorrelationPlots_, and singleRPPlots_.

◆ profileToRMSGraph()

static void CTPPSProtonReconstructionPlotter::profileToRMSGraph ( TProfile *  p,
TGraphErrors *  g 
)
inlinestaticprivate

Definition at line 69 of file CTPPSProtonReconstructionPlotter.cc.

69  {
70  double c = p->GetBinCenter(bi);
71 
72  double N = p->GetBinEntries(bi);
73  double Sy = p->GetBinContent(bi) * N;
74  double Syy = p->GetSumw2()->At(bi);
75 
76  double si_sq = Syy / N - Sy * Sy / N / N;
77  double si = (si_sq >= 0.) ? sqrt(si_sq) : 0.;
78  double si_unc_sq = si_sq / 2. / N; // Gaussian approximation
79  double si_unc = (si_unc_sq >= 0.) ? sqrt(si_unc_sq) : 0.;
80 
81  int idx = g->GetN();
82  g->SetPoint(idx, c, si);
83  g->SetPointError(idx, 0., si_unc);
84  }
85  }
86 

References c, g, heavyIonCSV_trainingSettings::idx, N, AlCaHLTBitMon_ParallelJobs::p, and mathSSE::sqrt().

Member Data Documentation

◆ armCorrelationPlots_

std::map<unsigned int, ArmCorrelationPlots> CTPPSProtonReconstructionPlotter::armCorrelationPlots_
private

Definition at line 470 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze(), and endJob().

◆ association_cuts_

std::map<unsigned int, AssociationCuts> CTPPSProtonReconstructionPlotter::association_cuts_
private

◆ geometryESToken_

edm::ESGetToken<CTPPSGeometry, VeryForwardRealGeometryRecord> CTPPSProtonReconstructionPlotter::geometryESToken_
private

Definition at line 48 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze().

◆ maxNonEmptyEvents_

signed int CTPPSProtonReconstructionPlotter::maxNonEmptyEvents_
private

Definition at line 67 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze().

◆ multiRPPlots_

std::map<unsigned int, MultiRPPlots> CTPPSProtonReconstructionPlotter::multiRPPlots_
private

Definition at line 379 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze(), and endJob().

◆ n_non_empty_events_

signed int CTPPSProtonReconstructionPlotter::n_non_empty_events_
private

Definition at line 475 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze(), and endJob().

◆ outputFile_

std::string CTPPSProtonReconstructionPlotter::outputFile_
private

Definition at line 65 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by endJob().

◆ p_x_L_diffNF_vs_x_L_N_

std::unique_ptr<TProfile> CTPPSProtonReconstructionPlotter::p_x_L_diffNF_vs_x_L_N_
private

Definition at line 472 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze(), and endJob().

◆ p_x_R_diffNF_vs_x_R_N_

std::unique_ptr<TProfile> CTPPSProtonReconstructionPlotter::p_x_R_diffNF_vs_x_R_N_
private

Definition at line 472 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze(), and endJob().

◆ p_y_L_diffNF_vs_y_L_N_

std::unique_ptr<TProfile> CTPPSProtonReconstructionPlotter::p_y_L_diffNF_vs_y_L_N_
private

Definition at line 473 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze(), and endJob().

◆ p_y_R_diffNF_vs_y_R_N_

std::unique_ptr<TProfile> CTPPSProtonReconstructionPlotter::p_y_R_diffNF_vs_y_R_N_
private

Definition at line 473 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze(), and endJob().

◆ rpId_45_F_

unsigned int CTPPSProtonReconstructionPlotter::rpId_45_F_
private

Definition at line 50 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze().

◆ rpId_45_N_

unsigned int CTPPSProtonReconstructionPlotter::rpId_45_N_
private

Definition at line 50 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze().

◆ rpId_56_F_

unsigned int CTPPSProtonReconstructionPlotter::rpId_56_F_
private

Definition at line 51 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze().

◆ rpId_56_N_

unsigned int CTPPSProtonReconstructionPlotter::rpId_56_N_
private

Definition at line 51 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze().

◆ singleMultiCorrelationPlots_

std::map<unsigned int, SingleMultiCorrelationPlots> CTPPSProtonReconstructionPlotter::singleMultiCorrelationPlots_
private

Definition at line 428 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze(), and endJob().

◆ singleRPPlots_

std::map<unsigned int, SingleRPPlots> CTPPSProtonReconstructionPlotter::singleRPPlots_
private

Definition at line 154 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze(), and endJob().

◆ tokenRecoProtonsMultiRP_

edm::EDGetTokenT<reco::ForwardProtonCollection> CTPPSProtonReconstructionPlotter::tokenRecoProtonsMultiRP_
private

Definition at line 47 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze().

◆ tokenRecoProtonsSingleRP_

edm::EDGetTokenT<reco::ForwardProtonCollection> CTPPSProtonReconstructionPlotter::tokenRecoProtonsSingleRP_
private

Definition at line 46 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze().

◆ tokenTracks_

edm::EDGetTokenT<CTPPSLocalTrackLiteCollection> CTPPSProtonReconstructionPlotter::tokenTracks_
private

Definition at line 45 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze().

CTPPSLocalTrackLite
Local (=single RP) track with essential information only.
Definition: CTPPSLocalTrackLite.h:18
CTPPSProtonReconstructionPlotter::armCorrelationPlots_
std::map< unsigned int, ArmCorrelationPlots > armCorrelationPlots_
Definition: CTPPSProtonReconstructionPlotter.cc:470
geometry
Definition: geometry.py:1
CTPPSProtonReconstructionPlotter::outputFile_
std::string outputFile_
Definition: CTPPSProtonReconstructionPlotter.cc:65
reco::ForwardProton
Definition: ForwardProton.h:21
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::Handle
Definition: AssociativeIterator.h:50
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
CTPPSProtonReconstructionPlotter::p_x_L_diffNF_vs_x_L_N_
std::unique_ptr< TProfile > p_x_L_diffNF_vs_x_L_N_
Definition: CTPPSProtonReconstructionPlotter.cc:472
CTPPSProtonReconstructionPlotter::singleMultiCorrelationPlots_
std::map< unsigned int, SingleMultiCorrelationPlots > singleMultiCorrelationPlots_
Definition: CTPPSProtonReconstructionPlotter.cc:428
CTPPSProtonReconstructionPlotter::tokenRecoProtonsMultiRP_
edm::EDGetTokenT< reco::ForwardProtonCollection > tokenRecoProtonsMultiRP_
Definition: CTPPSProtonReconstructionPlotter.cc:47
CTPPSProtonReconstructionPlotter::CalculateTimingTrackingDistance
void CalculateTimingTrackingDistance(const reco::ForwardProton &proton, const CTPPSLocalTrackLite &tr, const CTPPSGeometry &geometry, double &x_tr, double &x_ti, double &de_x, double &de_x_unc)
Definition: CTPPSProtonReconstructionPlotter.cc:514
CTPPSProtonReconstructionPlotter::association_cuts_
std::map< unsigned int, AssociationCuts > association_cuts_
Definition: CTPPSProtonReconstructionPlotter.cc:63
CTPPSDetId::sdTrackingStrip
Definition: CTPPSDetId.h:44
CTPPSLocalTrackLite::x
float x() const
returns the horizontal track position
Definition: CTPPSLocalTrackLite.h:74
CTPPSProtonReconstructionPlotter::tokenTracks_
edm::EDGetTokenT< CTPPSLocalTrackLiteCollection > tokenTracks_
Definition: CTPPSProtonReconstructionPlotter.cc:45
CTPPSProtonReconstructionPlotter::rpId_56_N_
unsigned int rpId_56_N_
Definition: CTPPSProtonReconstructionPlotter.cc:51
CTPPSProtonReconstructionPlotter::maxNonEmptyEvents_
signed int maxNonEmptyEvents_
Definition: CTPPSProtonReconstructionPlotter.cc:67
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
CTPPSProtonReconstructionPlotter::singleRPPlots_
std::map< unsigned int, SingleRPPlots > singleRPPlots_
Definition: CTPPSProtonReconstructionPlotter.cc:154
DDAxes::z
N
#define N
Definition: blowfish.cc:9
CTPPSProtonReconstructionPlotter::multiRPPlots_
std::map< unsigned int, MultiRPPlots > multiRPPlots_
Definition: CTPPSProtonReconstructionPlotter.cc:379
CTPPSDetId::sdTrackingPixel
Definition: CTPPSDetId.h:44
reco::ForwardProton::contributingLocalTracks
const CTPPSLocalTrackLiteRefVector & contributingLocalTracks() const
list of RP tracks that contributed to this global track
Definition: ForwardProton.h:136
CTPPSDetId::arm
uint32_t arm() const
Definition: CTPPSDetId.h:55
CTPPSProtonReconstructionPlotter::rpId_45_F_
unsigned int rpId_45_F_
Definition: CTPPSProtonReconstructionPlotter.cc:50
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
match
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
CTPPSProtonReconstructionPlotter::tokenRecoProtonsSingleRP_
edm::EDGetTokenT< reco::ForwardProtonCollection > tokenRecoProtonsSingleRP_
Definition: CTPPSProtonReconstructionPlotter.cc:46
CTPPSDetId
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:31
edm::EventSetup
Definition: EventSetup.h:58
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
CTPPSProtonReconstructionPlotter::rpId_56_F_
unsigned int rpId_56_F_
Definition: CTPPSProtonReconstructionPlotter.cc:51
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
CTPPSProtonReconstructionPlotter::geometryESToken_
edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecord > geometryESToken_
Definition: CTPPSProtonReconstructionPlotter.cc:48
protons_cff.arm
arm
Definition: protons_cff.py:39
profile_2016_postTS2_cff.rpId
rpId
Definition: profile_2016_postTS2_cff.py:21
CTPPSProtonReconstructionPlotter::p_y_R_diffNF_vs_y_R_N_
std::unique_ptr< TProfile > p_y_R_diffNF_vs_y_R_N_
Definition: CTPPSProtonReconstructionPlotter.cc:473
CTPPSProtonReconstructionPlotter::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: CTPPSProtonReconstructionPlotter.cc:544
CTPPSLocalTrackLite::y
float y() const
returns the vertical track position
Definition: CTPPSLocalTrackLite.h:80
Exception
Definition: hltDiff.cc:245
alignCSCRings.de_x
de_x
Definition: alignCSCRings.py:85
protons_cff.decRPId
decRPId
Definition: protons_cff.py:56
CTPPSProtonReconstructionPlotter::n_non_empty_events_
signed int n_non_empty_events_
Definition: CTPPSProtonReconstructionPlotter.cc:475
CTPPSProtonReconstructionPlotter::p_y_L_diffNF_vs_y_L_N_
std::unique_ptr< TProfile > p_y_L_diffNF_vs_y_L_N_
Definition: CTPPSProtonReconstructionPlotter.cc:473
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDConsumerBase::esConsumes
auto esConsumes()
Definition: EDConsumerBase.h:206
edm::RefVector::at
const value_type at(size_type idx) const
Retrieve an element of the RefVector.
Definition: RefVector.h:83
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
edm::ParameterSet::getParameterSet
ParameterSet const & getParameterSet(std::string const &) const
Definition: ParameterSet.cc:2128
CTPPSProtonReconstructionPlotter::p_x_R_diffNF_vs_x_R_N_
std::unique_ptr< TProfile > p_x_R_diffNF_vs_x_R_N_
Definition: CTPPSProtonReconstructionPlotter.cc:472
g
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
CTPPSProtonReconstructionPlotter::rpId_45_N_
unsigned int rpId_45_N_
Definition: CTPPSProtonReconstructionPlotter.cc:50