CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () 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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (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::vector< ModuleDescription const * > &modules, 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
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
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 &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_
 
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
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 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<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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)
 

Detailed Description

Definition at line 32 of file CTPPSProtonReconstructionPlotter.cc.

Constructor & Destructor Documentation

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

Definition at line 426 of file CTPPSProtonReconstructionPlotter.cc.

427  : tokenTracks_(consumes<CTPPSLocalTrackLiteCollection>(ps.getParameter<edm::InputTag>("tagTracks"))),
429  consumes<reco::ForwardProtonCollection>(ps.getParameter<InputTag>("tagRecoProtonsSingleRP"))),
431  consumes<reco::ForwardProtonCollection>(ps.getParameter<InputTag>("tagRecoProtonsMultiRP"))),
432 
433  rpId_45_N_(ps.getParameter<unsigned int>("rpId_45_N")),
434  rpId_45_F_(ps.getParameter<unsigned int>("rpId_45_F")),
435  rpId_56_N_(ps.getParameter<unsigned int>("rpId_56_N")),
436  rpId_56_F_(ps.getParameter<unsigned int>("rpId_56_F")),
437 
438  outputFile_(ps.getParameter<string>("outputFile")),
439  maxNonEmptyEvents_(ps.getUntrackedParameter<signed int>("maxNonEmptyEvents", -1)),
440 
441  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.)),
442  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.)),
443 
444  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.)),
445  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.)),
446 
447  n_non_empty_events_(0) {}
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< reco::ForwardProtonCollection > tokenRecoProtonsSingleRP_
edm::EDGetTokenT< CTPPSLocalTrackLiteCollection > tokenTracks_
edm::EDGetTokenT< reco::ForwardProtonCollection > tokenRecoProtonsMultiRP_
CTPPSProtonReconstructionPlotter::~CTPPSProtonReconstructionPlotter ( )
inlineoverride

Definition at line 35 of file CTPPSProtonReconstructionPlotter.cc.

References analyze(), and endJob().

35 {}

Member Function Documentation

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

Definition at line 476 of file CTPPSProtonReconstructionPlotter.cc.

References CTPPSDetId::arm(), armCorrelationPlots_, CalculateTimingTrackingDistance(), reco::ForwardProton::contributingLocalTracks(), alignCSCRings::de_x, Exception, edm::EventSetup::get(), CTPPSLocalTrackLite::getX(), CTPPSLocalTrackLite::getY(), training_settings::idx, 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_, year_2016_postTS2_cff::rpId, rpId_45_F_, rpId_45_N_, rpId_56_F_, rpId_56_N_, CTPPSDetId::sdTrackingPixel, CTPPSDetId::sdTrackingStrip, singleMultiCorrelationPlots_, singleRPPlots_, tokenRecoProtonsMultiRP_, tokenRecoProtonsSingleRP_, and tokenTracks_.

Referenced by ~CTPPSProtonReconstructionPlotter().

476  {
477  // get input
479  event.getByToken(tokenTracks_, hTracks);
480 
481  Handle<reco::ForwardProtonCollection> hRecoProtonsSingleRP;
482  event.getByToken(tokenRecoProtonsSingleRP_, hRecoProtonsSingleRP);
483 
484  Handle<reco::ForwardProtonCollection> hRecoProtonsMultiRP;
485  event.getByToken(tokenRecoProtonsMultiRP_, hRecoProtonsMultiRP);
486 
487  if (!hRecoProtonsSingleRP->empty())
489 
491  throw cms::Exception("CTPPSProtonReconstructionPlotter") << "Number of non empty events reached maximum.";
492 
493  // get conditions
495  iSetup.get<VeryForwardRealGeometryRecord>().get(hGeometry);
496 
497  // track plots
498  const CTPPSLocalTrackLite *tr_L_N = nullptr;
499  const CTPPSLocalTrackLite *tr_L_F = nullptr;
500  const CTPPSLocalTrackLite *tr_R_N = nullptr;
501  const CTPPSLocalTrackLite *tr_R_F = nullptr;
502  std::map<unsigned int, unsigned int> armTrackCounter, armTimingTrackCounter;
503 
504  for (const auto &tr : *hTracks) {
505  CTPPSDetId rpId(tr.getRPId());
506  unsigned int decRPId = rpId.arm() * 100 + rpId.station() * 10 + rpId.rp();
507 
508  if (decRPId == rpId_45_N_)
509  tr_L_N = &tr;
510  if (decRPId == rpId_45_F_)
511  tr_L_F = &tr;
512  if (decRPId == rpId_56_N_)
513  tr_R_N = &tr;
514  if (decRPId == rpId_56_F_)
515  tr_R_F = &tr;
516 
517  armTrackCounter[rpId.arm()]++;
518 
519  const bool trackerRP =
520  (rpId.subdetId() == CTPPSDetId::sdTrackingStrip || rpId.subdetId() == CTPPSDetId::sdTrackingPixel);
521  if (!trackerRP)
522  armTimingTrackCounter[rpId.arm()]++;
523  }
524 
525  if (tr_L_N && tr_L_F) {
526  p_x_L_diffNF_vs_x_L_N_->Fill(tr_L_N->getX(), tr_L_F->getX() - tr_L_N->getX());
527  p_y_L_diffNF_vs_y_L_N_->Fill(tr_L_N->getY(), tr_L_F->getY() - tr_L_N->getY());
528  }
529 
530  if (tr_R_N && tr_R_F) {
531  p_x_R_diffNF_vs_x_R_N_->Fill(tr_R_N->getX(), tr_R_F->getX() - tr_R_N->getX());
532  p_y_R_diffNF_vs_y_R_N_->Fill(tr_R_N->getY(), tr_R_F->getY() - tr_R_N->getY());
533  }
534 
535  // initialise multiplicity counters
536  std::map<unsigned int, unsigned int> singleRPMultiplicity, multiRPMultiplicity;
537  singleRPMultiplicity[rpId_45_N_] = singleRPMultiplicity[rpId_45_F_] = singleRPMultiplicity[rpId_56_N_] =
538  singleRPMultiplicity[rpId_56_F_] = 0;
539  multiRPMultiplicity[0] = multiRPMultiplicity[1] = 0;
540 
541  // make single-RP-reco plots
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();
545  singleRPPlots_[decRPId].fill(proton, armTrackCounter[rpId.arm()]);
546 
547  if (proton.validFit())
548  singleRPMultiplicity[decRPId]++;
549  }
550 
551  for (const auto it : singleRPMultiplicity)
552  singleRPPlots_[it.first].h_multiplicity->Fill(it.second);
553 
554  // make multi-RP-reco plots
555  for (const auto &proton : *hRecoProtonsMultiRP) {
556  CTPPSDetId rpId((*proton.contributingLocalTracks().begin())->getRPId());
557  unsigned int armId = rpId.arm();
558  multiRPPlots_[armId].fill(proton, armTrackCounter[armId]);
559 
560  if (proton.validFit())
561  multiRPMultiplicity[armId]++;
562  }
563 
564  for (const auto it : multiRPMultiplicity) {
565  const auto &pl = multiRPPlots_[it.first];
566  pl.h_multiplicity->Fill(it.second);
567  pl.h2_timing_tracks_vs_prot_mult->Fill(it.second, armTimingTrackCounter[it.first]);
568  }
569 
570  // define "clean condition" for each arm
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);
574 
575  // plot distances between multi-RP protons and timing tracks in the same arm
576  for (const auto &proton : *hRecoProtonsMultiRP) {
577  if (!proton.validFit())
578  continue;
579 
580  CTPPSDetId rpId_proton((*proton.contributingLocalTracks().begin())->getRPId());
581  unsigned int armId = rpId_proton.arm();
582  const auto &pl = multiRPPlots_[armId];
583 
584  for (const auto &tr : *hTracks) {
585  CTPPSDetId rpId_tr(tr.getRPId());
586  if (rpId_tr.arm() != armId)
587  continue;
588 
589  const bool trackerRP =
590  (rpId_tr.subdetId() == CTPPSDetId::sdTrackingStrip || rpId_tr.subdetId() == CTPPSDetId::sdTrackingPixel);
591  if (trackerRP)
592  continue;
593 
594  double de_x = 0., de_x_unc = 0.;
595  CalculateTimingTrackingDistance(proton, tr, *hGeometry, de_x, de_x_unc);
596 
597  double rd = (de_x_unc > 0.) ? de_x / de_x_unc : -1E10;
598 
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.);
602 
603  if (clCo[armId]) {
604  if (armTimingTrackCounter[armId] == 1)
605  pl.h_de_x_rel_timing_vs_tracking_ClCo->Fill(rd);
606  }
607  }
608  }
609 
610  // plot xy maps
611  for (const auto &proton : *hRecoProtonsMultiRP) {
612  if (!proton.validFit())
613  continue;
614 
615  CTPPSDetId rpId((*proton.contributingLocalTracks().begin())->getRPId());
616  unsigned int armId = rpId.arm();
617  const auto &pl = multiRPPlots_[armId];
618  const auto &nTimingTracks = armTimingTrackCounter[armId];
619 
620  if (!clCo[armId])
621  continue;
622 
623  double x_ref = 0., y_ref = 0.;
624  if (armId == 0) {
625  x_ref = tr_L_N->getX();
626  y_ref = tr_L_N->getY();
627  }
628  if (armId == 1) {
629  x_ref = tr_R_N->getX();
630  y_ref = tr_R_N->getY();
631  }
632 
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);
639  }
640 
641  // make correlation plots
642  for (const auto &proton_m : *hRecoProtonsMultiRP) {
643  CTPPSDetId rpId_m((*proton_m.contributingLocalTracks().begin())->getRPId());
644  unsigned int arm = rpId_m.arm();
645 
646  const reco::ForwardProton *p_s_N = nullptr, *p_s_F = nullptr;
647 
648  /*
649  printf("multi-RP candidate: ");
650  for (const auto &tr_m : proton_m.contributingLocalTracks())
651  printf("%u, ", tr_m.key());
652  printf("\n");
653  */
654 
655  for (const auto &proton_s : *hRecoProtonsSingleRP) {
656  // skip if source of single-RP reco not included in multi-RP reco
657  const auto key_s = proton_s.contributingLocalTracks()[0].key();
658  bool compatible = false;
659  for (const auto &tr_m : proton_m.contributingLocalTracks()) {
660  if (tr_m.key() == key_s) {
661  compatible = true;
662  break;
663  }
664  }
665 
666  //printf(" key_s = %u --> compatible = %u\n", key_s, compatible);
667 
668  if (!compatible)
669  continue;
670 
671  // fill single-multi plots
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();
674  singleMultiCorrelationPlots_[idx].fill(proton_s, proton_m);
675 
676  //printf(" arm_s = %u, arm_m = %u\n", rpId_s.arm(), arm);
677 
678  // select protons for arm-correlation plots
679  const unsigned int rpDecId_s = rpId_s.arm() * 100 + rpId_s.station() * 10 + rpId_s.rp();
680  if (rpDecId_s == rpId_45_N_ || rpDecId_s == rpId_56_N_)
681  p_s_N = &proton_s;
682  if (rpDecId_s == rpId_45_F_ || rpDecId_s == rpId_56_F_)
683  p_s_F = &proton_s;
684  }
685 
686  // fill arm-correlation plots
687  if (p_s_N && p_s_F)
688  armCorrelationPlots_[arm].fill(*p_s_N, *p_s_F, proton_m);
689  }
690 }
std::map< unsigned int, MultiRPPlots > multiRPPlots_
edm::EDGetTokenT< reco::ForwardProtonCollection > tokenRecoProtonsSingleRP_
std::map< unsigned int, SingleRPPlots > singleRPPlots_
Local (=single RP) track with essential information only.
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
uint32_t arm() const
Definition: CTPPSDetId.h:51
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.
Definition: CTPPSDetId.h:32
std::map< unsigned int, SingleMultiCorrelationPlots > singleMultiCorrelationPlots_
T get() const
Definition: EventSetup.h:71
edm::EDGetTokenT< reco::ForwardProtonCollection > tokenRecoProtonsMultiRP_
void CTPPSProtonReconstructionPlotter::CalculateTimingTrackingDistance ( const reco::ForwardProton proton,
const CTPPSLocalTrackLite tr,
const CTPPSGeometry geometry,
double &  de_x,
double &  de_x_unc 
)
private

Definition at line 451 of file CTPPSProtonReconstructionPlotter.cc.

References edm::RefVector< C, T, F >::at(), reco::ForwardProton::contributingLocalTracks(), CTPPSLocalTrackLite::getRPId(), CTPPSGeometry::getRPTranslation(), CTPPSLocalTrackLite::getX(), CTPPSLocalTrackLite::getXUnc(), mathSSE::sqrt(), and z.

Referenced by analyze(), and profileToRMSGraph().

455  {
456  // identify tracking-RP tracks
457  const auto &tr_i = *proton.contributingLocalTracks().at(0);
458  const auto &tr_j = *proton.contributingLocalTracks().at(1);
459 
460  const double z_i = geometry.getRPTranslation(tr_i.getRPId()).z();
461  const double z_j = geometry.getRPTranslation(tr_j.getRPId()).z();
462 
463  // interpolation from tracking RPs
464  const double z_ti = -geometry.getRPTranslation(tr_ti.getRPId()).z(); // the minus sign fixes a bug in the diamond geometry
465  const double f_i = (z_ti - z_j) / (z_i - z_j), f_j = (z_i - z_ti) / (z_i - z_j);
466  const double x_inter = f_i * tr_i.getX() + f_j * tr_j.getX();
467  const double x_inter_unc_sq = f_i * f_i * tr_i.getXUnc() * tr_i.getXUnc() + f_j * f_j * tr_j.getXUnc() * tr_j.getXUnc();
468 
469  // save distance
470  de_x = tr_ti.getX() - x_inter;
471  de_x_unc = sqrt(tr_ti.getXUnc() * tr_ti.getXUnc() + x_inter_unc_sq);
472 }
T sqrt(T t)
Definition: SSEVec.h:18
const CTPPSLocalTrackLiteRefVector & contributingLocalTracks() const
list of RP tracks that contributed to this global track
CLHEP::Hep3Vector getRPTranslation(unsigned int id) const
value_type const at(size_type idx) const
Retrieve an element of the RefVector.
Definition: RefVector.h:88
void CTPPSProtonReconstructionPlotter::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 694 of file CTPPSProtonReconstructionPlotter.cc.

References armCorrelationPlots_, DEFINE_FWK_MODULE, 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_.

Referenced by ~CTPPSProtonReconstructionPlotter().

694  {
695  LogInfo("CTPPSProtonReconstructionPlotter") << "n_non_empty_events = " << n_non_empty_events_;
696 
697  auto f_out = std::make_unique<TFile>(outputFile_.c_str(), "recreate");
698 
699  p_x_L_diffNF_vs_x_L_N_->Write();
700  p_x_R_diffNF_vs_x_R_N_->Write();
701 
702  p_y_L_diffNF_vs_y_L_N_->Write();
703  p_y_R_diffNF_vs_y_R_N_->Write();
704 
705  TDirectory *d_singleRPPlots = f_out->mkdir("singleRPPlots");
706  for (const auto &it : singleRPPlots_) {
707  gDirectory = d_singleRPPlots->mkdir(Form("rp%u", it.first));
708  it.second.write();
709  }
710 
711  TDirectory *d_multiRPPlots = f_out->mkdir("multiRPPlots");
712  for (const auto &it : multiRPPlots_) {
713  gDirectory = d_multiRPPlots->mkdir(Form("arm%u", it.first));
714  it.second.write();
715  }
716 
717  TDirectory *d_singleMultiCorrelationPlots = f_out->mkdir("singleMultiCorrelationPlots");
718  for (const auto &it : singleMultiCorrelationPlots_) {
719  unsigned int si_rp = it.first / 10;
720  unsigned int mu_arm = it.first % 10;
721 
722  gDirectory = d_singleMultiCorrelationPlots->mkdir(Form("si_rp%u_mu_arm%u", si_rp, mu_arm));
723  it.second.write();
724  }
725 
726  TDirectory *d_armCorrelationPlots = f_out->mkdir("armCorrelationPlots");
727  for (const auto &it : armCorrelationPlots_) {
728  gDirectory = d_armCorrelationPlots->mkdir(Form("arm%u", it.first));
729  it.second.write();
730  }
731 }
std::map< unsigned int, MultiRPPlots > multiRPPlots_
std::map< unsigned int, SingleRPPlots > singleRPPlots_
std::map< unsigned int, ArmCorrelationPlots > armCorrelationPlots_
std::map< unsigned int, SingleMultiCorrelationPlots > singleMultiCorrelationPlots_
static void CTPPSProtonReconstructionPlotter::profileToRMSGraph ( TProfile *  p,
TGraphErrors *  g 
)
inlinestaticprivate

Definition at line 53 of file CTPPSProtonReconstructionPlotter.cc.

References EnergyCorrector::c, CalculateTimingTrackingDistance(), alignCSCRings::de_x, training_settings::idx, N, and mathSSE::sqrt().

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

53  {
54  for (int bi = 1; bi <= p->GetNbinsX(); ++bi) {
55  double c = p->GetBinCenter(bi);
56 
57  double N = p->GetBinEntries(bi);
58  double Sy = p->GetBinContent(bi) * N;
59  double Syy = p->GetSumw2()->At(bi);
60 
61  double si_sq = Syy / N - Sy * Sy / N / N;
62  double si = (si_sq >= 0.) ? sqrt(si_sq) : 0.;
63  double si_unc_sq = si_sq / 2. / N; // Gaussian approximation
64  double si_unc = (si_unc_sq >= 0.) ? sqrt(si_unc_sq) : 0.;
65 
66  int idx = g->GetN();
67  g->SetPoint(idx, c, si);
68  g->SetPointError(idx, 0., si_unc);
69  }
70  }
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:18
#define N
Definition: blowfish.cc:9

Member Data Documentation

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

Definition at line 411 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze(), and endJob().

signed int CTPPSProtonReconstructionPlotter::maxNonEmptyEvents_
private

Definition at line 51 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze().

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

Definition at line 320 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze(), and endJob().

signed int CTPPSProtonReconstructionPlotter::n_non_empty_events_
private

Definition at line 416 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze(), and endJob().

std::string CTPPSProtonReconstructionPlotter::outputFile_
private

Definition at line 49 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by endJob().

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

Definition at line 413 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze(), and endJob().

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

Definition at line 413 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze(), and endJob().

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

Definition at line 414 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze(), and endJob().

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

Definition at line 414 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze(), and endJob().

unsigned int CTPPSProtonReconstructionPlotter::rpId_45_F_
private

Definition at line 46 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze().

unsigned int CTPPSProtonReconstructionPlotter::rpId_45_N_
private

Definition at line 46 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze().

unsigned int CTPPSProtonReconstructionPlotter::rpId_56_F_
private

Definition at line 47 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze().

unsigned int CTPPSProtonReconstructionPlotter::rpId_56_N_
private

Definition at line 47 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze().

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

Definition at line 369 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze(), and endJob().

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

Definition at line 129 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze(), and endJob().

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

Definition at line 44 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze().

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

Definition at line 43 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze().

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

Definition at line 42 of file CTPPSProtonReconstructionPlotter.cc.

Referenced by analyze().