CMS 3D CMS Logo

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

Classes

struct  RPPlots
 

Public Member Functions

 CTPPSProtonReconstructionValidator (const edm::ParameterSet &)
 
- 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 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 endJob () override
 

Private Attributes

double chiSqCut_
 
edm::ESGetToken< LHCInterpolatedOpticalFunctionsSetCollection, CTPPSInterpolatedOpticsRcdopticsESToken_
 
std::string outputFile_
 
std::map< unsigned int, RPPlotsrp_plots_
 
edm::EDGetTokenT< reco::ForwardProtonCollectiontokenRecoProtons_
 

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 32 of file CTPPSProtonReconstructionValidator.cc.

Constructor & Destructor Documentation

◆ CTPPSProtonReconstructionValidator()

CTPPSProtonReconstructionValidator::CTPPSProtonReconstructionValidator ( const edm::ParameterSet iConfig)
explicit

Definition at line 72 of file CTPPSProtonReconstructionValidator.cc.

73  : tokenRecoProtons_(consumes<reco::ForwardProtonCollection>(iConfig.getParameter<edm::InputTag>("tagRecoProtons"))),
75  chiSqCut_(iConfig.getParameter<double>("chiSqCut")),
76  outputFile_(iConfig.getParameter<string>("outputFile")) {}
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< reco::ForwardProtonCollection > tokenRecoProtons_
edm::ESGetToken< LHCInterpolatedOpticalFunctionsSetCollection, CTPPSInterpolatedOpticsRcd > opticsESToken_

Member Function Documentation

◆ analyze()

void CTPPSProtonReconstructionValidator::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 80 of file CTPPSProtonReconstructionValidator.cc.

References CTPPSDetId::arm(), chiSqCut_, alignCSCRings::de_x, alignCSCRings::de_y, EcalMonitorTask_cff::func, edm::EventSetup::getData(), iEvent, profile_base_cff::opticalFunctions, opticsESToken_, rp_plots_, CTPPSDetId::sdTrackingPixel, CTPPSDetId::sdTrackingStrip, tokenRecoProtons_, LHCInterpolatedOpticalFunctionsSet::Kinematics::x, and LHCInterpolatedOpticalFunctionsSet::Kinematics::y.

80  {
81  // get conditions
82  const auto& opticalFunctions = iSetup.getData(opticsESToken_);
83 
84  // stop if conditions invalid
85  if (opticalFunctions.empty())
86  return;
87 
88  // get input
90  iEvent.getByToken(tokenRecoProtons_, hRecoProtons);
91 
92  // process tracks
93  for (const auto& pr : *hRecoProtons) {
94  if (!pr.validFit())
95  continue;
96 
97  if (pr.chi2() > chiSqCut_)
98  continue;
99 
100  for (const auto& tr : pr.contributingLocalTracks()) {
101  CTPPSDetId rpId(tr->rpId());
102  unsigned int rpDecId = rpId.arm() * 100 + rpId.station() * 10 + rpId.rp();
103 
104  // skip other than tracking RPs
105  if (rpId.subdetId() != CTPPSDetId::sdTrackingStrip && rpId.subdetId() != CTPPSDetId::sdTrackingPixel)
106  continue;
107 
108  // try to get optics for the RP
109  if (opticalFunctions.count(rpId) == 0)
110  continue;
111  const auto& func = opticalFunctions.at(rpId);
112 
113  // do propagation
114  LHCInterpolatedOpticalFunctionsSet::Kinematics k_in_beam = {0., 0., 0., 0., 0.};
116  func.transport(k_in_beam, k_out_beam);
117 
119  -pr.vx(), -pr.thetaX(), pr.vy(), pr.thetaY(), pr.xi()}; // conversions: CMS --> LHC convention
121  func.transport(k_in, k_out);
122 
123  // fill plots
124  const double de_x = (k_out.x - k_out_beam.x) * 10. - tr->x(); // conversions: cm --> mm
125  const double de_y = (k_out.y - k_out_beam.y) * 10. - tr->y(); // conversions: cm --> mm
126 
127  rp_plots_[rpDecId].fill(de_x, de_y);
128  }
129  }
130 }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
uint32_t arm() const
Definition: CTPPSDetId.h:57
edm::EDGetTokenT< reco::ForwardProtonCollection > tokenRecoProtons_
int iEvent
Definition: GenABIO.cc:224
edm::ESGetToken< LHCInterpolatedOpticalFunctionsSetCollection, CTPPSInterpolatedOpticsRcd > opticsESToken_
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32

◆ endJob()

void CTPPSProtonReconstructionValidator::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 134 of file CTPPSProtonReconstructionValidator.cc.

References outputFile_, AlCaHLTBitMon_ParallelJobs::p, and rp_plots_.

134  {
135  auto f_out = std::make_unique<TFile>(outputFile_.c_str(), "recreate");
136 
137  for (const auto& p : rp_plots_) {
138  gDirectory = f_out->mkdir(Form("%u", p.first));
139  p.second.write();
140  }
141 }

Member Data Documentation

◆ chiSqCut_

double CTPPSProtonReconstructionValidator::chiSqCut_
private

Definition at line 42 of file CTPPSProtonReconstructionValidator.cc.

Referenced by analyze().

◆ opticsESToken_

edm::ESGetToken<LHCInterpolatedOpticalFunctionsSetCollection, CTPPSInterpolatedOpticsRcd> CTPPSProtonReconstructionValidator::opticsESToken_
private

Definition at line 41 of file CTPPSProtonReconstructionValidator.cc.

Referenced by analyze().

◆ outputFile_

std::string CTPPSProtonReconstructionValidator::outputFile_
private

Definition at line 43 of file CTPPSProtonReconstructionValidator.cc.

Referenced by endJob().

◆ rp_plots_

std::map<unsigned int, RPPlots> CTPPSProtonReconstructionValidator::rp_plots_
private

Definition at line 62 of file CTPPSProtonReconstructionValidator.cc.

Referenced by analyze(), and endJob().

◆ tokenRecoProtons_

edm::EDGetTokenT<reco::ForwardProtonCollection> CTPPSProtonReconstructionValidator::tokenRecoProtons_
private

Definition at line 40 of file CTPPSProtonReconstructionValidator.cc.

Referenced by analyze().