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
 
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 endJob () override
 

Private Attributes

double chiSqCut_
 
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)
 
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 CTPPSProtonReconstructionValidator.cc.

Constructor & Destructor Documentation

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

Definition at line 74 of file CTPPSProtonReconstructionValidator.cc.

74  :
75  tokenRecoProtons_(consumes<reco::ForwardProtonCollection>(iConfig.getParameter<edm::InputTag>("tagRecoProtons"))),
76  chiSqCut_ (iConfig.getParameter<double>("chiSqCut")),
77  outputFile_(iConfig.getParameter<string>("outputFile"))
78 {}
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::ForwardProtonCollection > tokenRecoProtons_

Member Function Documentation

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

Definition at line 82 of file CTPPSProtonReconstructionValidator.cc.

References chiSqCut_, alignCSCRings::de_x, alignCSCRings::de_y, edm::EventSetup::get(), edm::Event::getByToken(), rp_plots_, year_2016_postTS2_cff::rpId, CTPPSDetId::sdTrackingPixel, CTPPSDetId::sdTrackingStrip, tokenRecoProtons_, LHCInterpolatedOpticalFunctionsSet::Kinematics::x, and LHCInterpolatedOpticalFunctionsSet::Kinematics::y.

83 {
84  // get conditions
86  iSetup.get<CTPPSInterpolatedOpticsRcd>().get(hOpticalFunctions);
87 
88  // stop if conditions invalid
89  if (hOpticalFunctions->empty())
90  return;
91 
92  // get input
94  iEvent.getByToken(tokenRecoProtons_, hRecoProtons);
95 
96  // process tracks
97  for (const auto &pr : *hRecoProtons)
98  {
99  if (! pr.validFit())
100  continue;
101 
102  if (pr.chi2() > chiSqCut_)
103  continue;
104 
105  for (const auto &tr : pr.contributingLocalTracks())
106  {
107  CTPPSDetId rpId(tr->getRPId());
108  unsigned int rpDecId = rpId.arm()*100 + rpId.station()*10 + rpId.rp();
109 
110  // skip other than tracking RPs
111  if (rpId.subdetId() != CTPPSDetId::sdTrackingStrip && rpId.subdetId() != CTPPSDetId::sdTrackingPixel)
112  continue;
113 
114  // try to get optics for the RP
115  auto it = hOpticalFunctions->find(rpId);
116  if (it == hOpticalFunctions->end())
117  continue;
118 
119  // do propagation
120  LHCInterpolatedOpticalFunctionsSet::Kinematics k_in_beam = { 0., 0., 0., 0., 0. };
122  it->second.transport(k_in_beam, k_out_beam);
123 
124  LHCInterpolatedOpticalFunctionsSet::Kinematics k_in = { -pr.vx(), -pr.thetaX(), pr.vy(), pr.thetaY(), pr.xi() }; // conversions: CMS --> LHC convention
126  it->second.transport(k_in, k_out);
127 
128  // fill plots
129  const double de_x = (k_out.x - k_out_beam.x) * 10. - tr->getX(); // conversions: cm --> mm
130  const double de_y = (k_out.y - k_out_beam.y) * 10. - tr->getY(); // conversions: cm --> mm
131 
132  rp_plots_[rpDecId].fill(de_x, de_y);
133  }
134  }
135 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
edm::EDGetTokenT< reco::ForwardProtonCollection > tokenRecoProtons_
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32
T get() const
Definition: EventSetup.h:71
void CTPPSProtonReconstructionValidator::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 139 of file CTPPSProtonReconstructionValidator.cc.

References DEFINE_FWK_MODULE, outputFile_, AlCaHLTBitMon_ParallelJobs::p, and rp_plots_.

140 {
141  auto f_out = std::make_unique<TFile>(outputFile_.c_str(), "recreate");
142 
143  for (const auto& p : rp_plots_) {
144  gDirectory = f_out->mkdir(Form("%u", p.first));
145  p.second.write();
146  }
147 }

Member Data Documentation

double CTPPSProtonReconstructionValidator::chiSqCut_
private

Definition at line 42 of file CTPPSProtonReconstructionValidator.cc.

Referenced by analyze().

std::string CTPPSProtonReconstructionValidator::outputFile_
private

Definition at line 43 of file CTPPSProtonReconstructionValidator.cc.

Referenced by endJob().

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

Definition at line 64 of file CTPPSProtonReconstructionValidator.cc.

Referenced by analyze(), and endJob().

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

Definition at line 41 of file CTPPSProtonReconstructionValidator.cc.

Referenced by analyze().