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  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 noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept 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 noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, 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::ESRecordsToProductResolverIndices 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_
 
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_
 
edm::ESGetToken< PPSAssociationCuts, PPSAssociationCutsRcdppsAssociationCutsToken_
 
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
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 36 of file CTPPSProtonReconstructionPlotter.cc.

Constructor & Destructor Documentation

◆ CTPPSProtonReconstructionPlotter()

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

Definition at line 475 of file CTPPSProtonReconstructionPlotter.cc.

476  : tokenTracks_(consumes<CTPPSLocalTrackLiteCollection>(ps.getParameter<edm::InputTag>("tagTracks"))),
478  consumes<reco::ForwardProtonCollection>(ps.getParameter<InputTag>("tagRecoProtonsSingleRP"))),
480  consumes<reco::ForwardProtonCollection>(ps.getParameter<InputTag>("tagRecoProtonsMultiRP"))),
482  ppsAssociationCutsToken_(esConsumes<PPSAssociationCuts, PPSAssociationCutsRcd>()),
483 
484  rpId_45_N_(ps.getParameter<unsigned int>("rpId_45_N")),
485  rpId_45_F_(ps.getParameter<unsigned int>("rpId_45_F")),
486  rpId_56_N_(ps.getParameter<unsigned int>("rpId_56_N")),
487  rpId_56_F_(ps.getParameter<unsigned int>("rpId_56_F")),
488 
489  outputFile_(ps.getParameter<string>("outputFile")),
490  maxNonEmptyEvents_(ps.getUntrackedParameter<signed int>("maxNonEmptyEvents", -1)),
491 
492  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.)),
493  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.)),
494 
495  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.)),
496  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.)),
497 
498  n_non_empty_events_(0) {}
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetTokenT< reco::ForwardProtonCollection > tokenRecoProtonsSingleRP_
edm::ESGetToken< PPSAssociationCuts, PPSAssociationCutsRcd > ppsAssociationCutsToken_
edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecord > geometryESToken_
edm::EDGetTokenT< CTPPSLocalTrackLiteCollection > tokenTracks_
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< reco::ForwardProtonCollection > tokenRecoProtonsMultiRP_

◆ ~CTPPSProtonReconstructionPlotter()

CTPPSProtonReconstructionPlotter::~CTPPSProtonReconstructionPlotter ( )
inlineoverride

Definition at line 39 of file CTPPSProtonReconstructionPlotter.cc.

39 {}

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 532 of file CTPPSProtonReconstructionPlotter.cc.

References protons_cff::arm, CTPPSDetId::arm(), armCorrelationPlots_, cms::cuda::assert(), CalculateTimingTrackingDistance(), reco::ForwardProton::contributingLocalTracks(), alignCSCRings::de_x, protons_cff::decRPId, Exception, geometryESToken_, PPSAssociationCuts::getAssociationCuts(), edm::EventSetup::getData(), edm::EventSetup::getHandle(), heavyIonCSV_trainingSettings::idx, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, 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_, ppsAssociationCutsToken_, 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().

532  {
533  // get input
535  event.getByToken(tokenTracks_, hTracks);
536 
537  Handle<reco::ForwardProtonCollection> hRecoProtonsSingleRP;
538  event.getByToken(tokenRecoProtonsSingleRP_, hRecoProtonsSingleRP);
539 
540  Handle<reco::ForwardProtonCollection> hRecoProtonsMultiRP;
541  event.getByToken(tokenRecoProtonsMultiRP_, hRecoProtonsMultiRP);
542 
543  if (!hRecoProtonsSingleRP->empty())
545 
547  throw cms::Exception("CTPPSProtonReconstructionPlotter") << "Number of non empty events reached maximum.";
548 
549  // get conditions
550  const auto &geometry = iSetup.getData(geometryESToken_);
552 
553  // track plots
554  const CTPPSLocalTrackLite *tr_L_N = nullptr;
555  const CTPPSLocalTrackLite *tr_L_F = nullptr;
556  const CTPPSLocalTrackLite *tr_R_N = nullptr;
557  const CTPPSLocalTrackLite *tr_R_F = nullptr;
558  std::map<unsigned int, unsigned int> armTrackCounter, armTimingTrackCounter;
559  std::map<unsigned int, unsigned int> armTrackCounter_N, armTrackCounter_F;
560 
561  for (const auto &tr : *hTracks) {
562  CTPPSDetId rpId(tr.rpId());
563  unsigned int decRPId = rpId.arm() * 100 + rpId.station() * 10 + rpId.rp();
564 
565  if (decRPId == rpId_45_N_) {
566  tr_L_N = &tr;
567  armTrackCounter_N[0]++;
568  }
569  if (decRPId == rpId_45_F_) {
570  tr_L_F = &tr;
571  armTrackCounter_F[0]++;
572  }
573  if (decRPId == rpId_56_N_) {
574  tr_R_N = &tr;
575  armTrackCounter_N[1]++;
576  }
577  if (decRPId == rpId_56_F_) {
578  tr_R_F = &tr;
579  armTrackCounter_F[1]++;
580  }
581 
582  armTrackCounter[rpId.arm()]++;
583 
584  const bool trackerRP =
585  (rpId.subdetId() == CTPPSDetId::sdTrackingStrip || rpId.subdetId() == CTPPSDetId::sdTrackingPixel);
586  if (!trackerRP)
587  armTimingTrackCounter[rpId.arm()]++;
588  }
589 
590  if (tr_L_N && tr_L_F) {
591  p_x_L_diffNF_vs_x_L_N_->Fill(tr_L_N->x(), tr_L_F->x() - tr_L_N->x());
592  p_y_L_diffNF_vs_y_L_N_->Fill(tr_L_N->y(), tr_L_F->y() - tr_L_N->y());
593  }
594 
595  if (tr_R_N && tr_R_F) {
596  p_x_R_diffNF_vs_x_R_N_->Fill(tr_R_N->x(), tr_R_F->x() - tr_R_N->x());
597  p_y_R_diffNF_vs_y_R_N_->Fill(tr_R_N->y(), tr_R_F->y() - tr_R_N->y());
598  }
599 
600  // initialise multiplicity counters
601  std::map<unsigned int, unsigned int> singleRPMultiplicity, multiRPMultiplicity;
602  singleRPMultiplicity[rpId_45_N_] = singleRPMultiplicity[rpId_45_F_] = singleRPMultiplicity[rpId_56_N_] =
603  singleRPMultiplicity[rpId_56_F_] = 0;
604  multiRPMultiplicity[0] = multiRPMultiplicity[1] = 0;
605 
606  // make single-RP-reco plots
607  for (const auto &proton : *hRecoProtonsSingleRP) {
608  // workaround for https://github.com/cms-sw/cmssw/issues/44931#issuecomment-2142898754
609  const auto &pcLTiter = *proton.contributingLocalTracks().begin();
610  assert(pcLTiter.isNonnull());
611  CTPPSDetId rpId(pcLTiter->rpId());
612  unsigned int decRPId = rpId.arm() * 100 + rpId.station() * 10 + rpId.rp();
613 
614  const bool n1f1 = (armTrackCounter_N[rpId.arm()] == 1 && armTrackCounter_F[rpId.arm()] == 1);
615 
616  singleRPPlots_[decRPId].fill(proton, armTrackCounter[rpId.arm()], n1f1);
617 
618  if (proton.validFit())
619  singleRPMultiplicity[decRPId]++;
620  }
621 
622  for (const auto it : singleRPMultiplicity)
623  singleRPPlots_[it.first].h_multiplicity->Fill(it.second);
624 
625  // make multi-RP-reco plots
626  for (const auto &proton : *hRecoProtonsMultiRP) {
627  CTPPSDetId rpId((*proton.contributingLocalTracks().begin())->rpId());
628  unsigned int armId = rpId.arm();
629 
630  const bool n1f1 = (armTrackCounter_N[armId] == 1 && armTrackCounter_F[armId] == 1);
631 
632  multiRPPlots_[armId].fill(proton, armTrackCounter[armId], n1f1);
633 
634  if (proton.validFit())
635  multiRPMultiplicity[armId]++;
636  }
637 
638  for (const auto it : multiRPMultiplicity) {
639  const auto &pl = multiRPPlots_[it.first];
640  pl.h_multiplicity->Fill(it.second);
641  pl.h2_timing_tracks_vs_prot_mult->Fill(it.second, armTimingTrackCounter[it.first]);
642  }
643 
644  // define "clean condition" for each arm
645  map<unsigned int, bool> clCo;
646  clCo[0] = (singleRPMultiplicity[rpId_45_N_] && singleRPMultiplicity[rpId_45_F_] && multiRPMultiplicity[0] == 1);
647  clCo[1] = (singleRPMultiplicity[rpId_56_N_] && singleRPMultiplicity[rpId_56_F_] && multiRPMultiplicity[1] == 1);
648 
649  // plot distances between multi-RP protons and timing tracks in the same arm
650  for (const auto &proton : *hRecoProtonsMultiRP) {
651  if (!proton.validFit())
652  continue;
653 
654  CTPPSDetId rpId_proton((*proton.contributingLocalTracks().begin())->rpId());
655  unsigned int armId = rpId_proton.arm();
656  const auto &pl = multiRPPlots_[armId];
657 
658  for (const auto &tr : *hTracks) {
659  CTPPSDetId rpId_tr(tr.rpId());
660  if (rpId_tr.arm() != armId)
661  continue;
662 
663  const bool trackerRP =
664  (rpId_tr.subdetId() == CTPPSDetId::sdTrackingStrip || rpId_tr.subdetId() == CTPPSDetId::sdTrackingPixel);
665  if (trackerRP)
666  continue;
667 
668  double x_tr = -1., x_ti = -1.;
669  double de_x = 0., de_x_unc = 0.;
670  CalculateTimingTrackingDistance(proton, tr, geometry, x_tr, x_ti, de_x, de_x_unc);
671 
672  const double rd = (de_x_unc > 0.) ? de_x / de_x_unc : -1E10;
673  const auto &ac = ppsAssociationCuts->getAssociationCuts(armId);
674  const bool match = (ac.getTiTrMin() <= fabs(rd) && fabs(rd) <= ac.getTiTrMax());
675 
676  pl.h_de_x_timing_vs_tracking->Fill(de_x);
677  pl.h_de_x_rel_timing_vs_tracking->Fill(rd);
678  pl.h_de_x_match_timing_vs_tracking->Fill(match ? 1. : 0.);
679 
680  if (clCo[armId] && armTimingTrackCounter[armId] == 1) {
681  pl.h2_x_timing_vs_x_tracking_ClCo->Fill(x_tr, x_ti);
682 
683  pl.h_de_x_timing_vs_tracking_ClCo->Fill(de_x);
684  pl.h_de_x_rel_timing_vs_tracking_ClCo->Fill(rd);
685  pl.h_de_x_match_timing_vs_tracking_ClCo->Fill(match ? 1. : 0.);
686 
687  pl.p_time_unc_vs_x_ClCo->Fill(x_tr, proton.timeError());
688  }
689  }
690  }
691 
692  // plot xy maps
693  for (const auto &proton : *hRecoProtonsMultiRP) {
694  if (!proton.validFit())
695  continue;
696 
697  CTPPSDetId rpId((*proton.contributingLocalTracks().begin())->rpId());
698  unsigned int armId = rpId.arm();
699  const auto &pl = multiRPPlots_[armId];
700  const auto &nTimingTracks = armTimingTrackCounter[armId];
701 
702  if (!clCo[armId])
703  continue;
704 
705  double x_ref = 0., y_ref = 0.;
706  if (armId == 0) {
707  x_ref = tr_L_N->x();
708  y_ref = tr_L_N->y();
709  }
710  if (armId == 1) {
711  x_ref = tr_R_N->x();
712  y_ref = tr_R_N->y();
713  }
714 
715  if (nTimingTracks == 0)
716  pl.h2_y_vs_x_tt0_ClCo->Fill(x_ref, y_ref);
717  if (nTimingTracks == 1)
718  pl.h2_y_vs_x_tt1_ClCo->Fill(x_ref, y_ref);
719  if (nTimingTracks > 1)
720  pl.h2_y_vs_x_ttm_ClCo->Fill(x_ref, y_ref);
721  }
722 
723  // make correlation plots
724  for (const auto &proton_m : *hRecoProtonsMultiRP) {
725  CTPPSDetId rpId_m((*proton_m.contributingLocalTracks().begin())->rpId());
726  unsigned int arm = rpId_m.arm();
727 
728  const reco::ForwardProton *p_s_N = nullptr, *p_s_F = nullptr;
729 
730  for (const auto &proton_s : *hRecoProtonsSingleRP) {
731  // skip if source of single-RP reco not included in multi-RP reco
732  const auto key_s = proton_s.contributingLocalTracks()[0].key();
733  bool compatible = false;
734  for (const auto &tr_m : proton_m.contributingLocalTracks()) {
735  if (tr_m.key() == key_s) {
736  compatible = true;
737  break;
738  }
739  }
740 
741  if (!compatible)
742  continue;
743 
744  // fill single-multi plots
745  CTPPSDetId rpId_s((*proton_s.contributingLocalTracks().begin())->rpId());
746  const unsigned int idx = rpId_s.arm() * 1000 + rpId_s.station() * 100 + rpId_s.rp() * 10 + rpId_s.arm();
747  singleMultiCorrelationPlots_[idx].fill(proton_s, proton_m);
748 
749  // select protons for arm-correlation plots
750  const unsigned int rpDecId_s = rpId_s.arm() * 100 + rpId_s.station() * 10 + rpId_s.rp();
751  if (rpDecId_s == rpId_45_N_ || rpDecId_s == rpId_56_N_)
752  p_s_N = &proton_s;
753  if (rpDecId_s == rpId_45_F_ || rpDecId_s == rpId_56_F_)
754  p_s_F = &proton_s;
755  }
756 
757  // fill arm-correlation plots
758  if (p_s_N && p_s_F)
759  armCorrelationPlots_[arm].fill(*p_s_N, *p_s_F, proton_m);
760  }
761 }
std::map< unsigned int, MultiRPPlots > multiRPPlots_
edm::EDGetTokenT< reco::ForwardProtonCollection > tokenRecoProtonsSingleRP_
const CTPPSLocalTrackLiteRefVector & contributingLocalTracks() const
list of RP tracks that contributed to this global track
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
std::map< unsigned int, SingleRPPlots > singleRPPlots_
Local (=single RP) track with essential information only.
uint32_t arm() const
Definition: CTPPSDetId.h:57
edm::ESGetToken< PPSAssociationCuts, PPSAssociationCutsRcd > ppsAssociationCutsToken_
edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecord > geometryESToken_
edm::EDGetTokenT< CTPPSLocalTrackLiteCollection > tokenTracks_
float y() const
returns the vertical track position
assert(be >=bs)
const CutsPerArm & getAssociationCuts(const int sector) const
float x() const
returns the horizontal track position
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
std::map< unsigned int, ArmCorrelationPlots > armCorrelationPlots_
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32
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)
std::map< unsigned int, SingleMultiCorrelationPlots > singleMultiCorrelationPlots_
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
edm::EDGetTokenT< reco::ForwardProtonCollection > tokenRecoProtonsMultiRP_

◆ 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 502 of file CTPPSProtonReconstructionPlotter.cc.

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().

508  {
509  // identify tracking-RP tracks
510  const auto &tr_i = *proton.contributingLocalTracks().at(0);
511  const auto &tr_j = *proton.contributingLocalTracks().at(1);
512 
513  const double z_i = geometry.rpTranslation(tr_i.rpId()).z();
514  const double z_j = geometry.rpTranslation(tr_j.rpId()).z();
515 
516  // interpolation from tracking RPs
517  const double z_ti = -geometry.rpTranslation(tr_ti.rpId()).z(); // the minus sign fixes a bug in the diamond geometry
518  const double f_i = (z_ti - z_j) / (z_i - z_j), f_j = (z_i - z_ti) / (z_i - z_j);
519  const double x_inter = f_i * tr_i.x() + f_j * tr_j.x();
520  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();
521 
522  // save distance
523  x_tr = x_inter;
524  x_ti = tr_ti.x();
525 
526  de_x = tr_ti.x() - x_inter;
527  de_x_unc = sqrt(tr_ti.xUnc() * tr_ti.xUnc() + x_inter_unc_sq);
528 }
const CTPPSLocalTrackLiteRefVector & contributingLocalTracks() const
list of RP tracks that contributed to this global track
value_type const at(size_type idx) const
Retrieve an element of the RefVector.
Definition: RefVector.h:83
T sqrt(T t)
Definition: SSEVec.h:23

◆ endJob()

void CTPPSProtonReconstructionPlotter::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 765 of file CTPPSProtonReconstructionPlotter.cc.

References armCorrelationPlots_, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, 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_.

765  {
766  LogInfo("CTPPSProtonReconstructionPlotter") << "n_non_empty_events = " << n_non_empty_events_;
767 
768  auto f_out = std::make_unique<TFile>(outputFile_.c_str(), "recreate");
769 
770  p_x_L_diffNF_vs_x_L_N_->Write();
771  p_x_R_diffNF_vs_x_R_N_->Write();
772 
773  p_y_L_diffNF_vs_y_L_N_->Write();
774  p_y_R_diffNF_vs_y_R_N_->Write();
775 
776  TDirectory *d_singleRPPlots = f_out->mkdir("singleRPPlots");
777  for (const auto &it : singleRPPlots_) {
778  gDirectory = d_singleRPPlots->mkdir(Form("rp%u", it.first));
779  it.second.write();
780  }
781 
782  TDirectory *d_multiRPPlots = f_out->mkdir("multiRPPlots");
783  for (const auto &it : multiRPPlots_) {
784  gDirectory = d_multiRPPlots->mkdir(Form("arm%u", it.first));
785  it.second.write();
786  }
787 
788  TDirectory *d_singleMultiCorrelationPlots = f_out->mkdir("singleMultiCorrelationPlots");
789  for (const auto &it : singleMultiCorrelationPlots_) {
790  unsigned int si_rp = it.first / 10;
791  unsigned int mu_arm = it.first % 10;
792 
793  gDirectory = d_singleMultiCorrelationPlots->mkdir(Form("si_rp%u_mu_arm%u", si_rp, mu_arm));
794  it.second.write();
795  }
796 
797  TDirectory *d_armCorrelationPlots = f_out->mkdir("armCorrelationPlots");
798  for (const auto &it : armCorrelationPlots_) {
799  gDirectory = d_armCorrelationPlots->mkdir(Form("arm%u", it.first));
800  it.second.write();
801  }
802 }
std::map< unsigned int, MultiRPPlots > multiRPPlots_
std::map< unsigned int, SingleRPPlots > singleRPPlots_
std::map< unsigned int, ArmCorrelationPlots > armCorrelationPlots_
Log< level::Info, false > LogInfo
std::map< unsigned int, SingleMultiCorrelationPlots > singleMultiCorrelationPlots_

◆ profileToRMSGraph()

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

Definition at line 59 of file CTPPSProtonReconstructionPlotter.cc.

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

Referenced by CTPPSProtonReconstructionPlotter::MultiRPPlots::write().

59  {
60  for (int bi = 1; bi <= p->GetNbinsX(); ++bi) {
61  double c = p->GetBinCenter(bi);
62 
63  double N = p->GetBinEntries(bi);
64  double Sy = p->GetBinContent(bi) * N;
65  double Syy = p->GetSumw2()->At(bi);
66 
67  double si_sq = Syy / N - Sy * Sy / N / N;
68  double si = (si_sq >= 0.) ? sqrt(si_sq) : 0.;
69  double si_unc_sq = si_sq / 2. / N; // Gaussian approximation
70  double si_unc = (si_unc_sq >= 0.) ? sqrt(si_unc_sq) : 0.;
71 
72  int idx = g->GetN();
73  g->SetPoint(idx, c, si);
74  g->SetPointError(idx, 0., si_unc);
75  }
76  }
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
T sqrt(T t)
Definition: SSEVec.h:23
#define N
Definition: blowfish.cc:9

Member Data Documentation

◆ armCorrelationPlots_

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

Definition at line 460 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze(), and endJob().

◆ geometryESToken_

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

Definition at line 49 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze().

◆ maxNonEmptyEvents_

signed int CTPPSProtonReconstructionPlotter::maxNonEmptyEvents_
private

Definition at line 57 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze().

◆ multiRPPlots_

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

Definition at line 369 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze(), and endJob().

◆ n_non_empty_events_

signed int CTPPSProtonReconstructionPlotter::n_non_empty_events_
private

Definition at line 465 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze(), and endJob().

◆ outputFile_

std::string CTPPSProtonReconstructionPlotter::outputFile_
private

Definition at line 55 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 462 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 462 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 463 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 463 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze(), and endJob().

◆ ppsAssociationCutsToken_

edm::ESGetToken<PPSAssociationCuts, PPSAssociationCutsRcd> CTPPSProtonReconstructionPlotter::ppsAssociationCutsToken_
private

Definition at line 50 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze().

◆ rpId_45_F_

unsigned int CTPPSProtonReconstructionPlotter::rpId_45_F_
private

Definition at line 52 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze().

◆ rpId_45_N_

unsigned int CTPPSProtonReconstructionPlotter::rpId_45_N_
private

Definition at line 52 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze().

◆ rpId_56_F_

unsigned int CTPPSProtonReconstructionPlotter::rpId_56_F_
private

Definition at line 53 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze().

◆ rpId_56_N_

unsigned int CTPPSProtonReconstructionPlotter::rpId_56_N_
private

Definition at line 53 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze().

◆ singleMultiCorrelationPlots_

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

Definition at line 418 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze(), and endJob().

◆ singleRPPlots_

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

Definition at line 144 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze(), and endJob().

◆ tokenRecoProtonsMultiRP_

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

Definition at line 48 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze().

◆ tokenRecoProtonsSingleRP_

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

Definition at line 47 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze().

◆ tokenTracks_

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

Definition at line 46 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze().