CMS 3D CMS Logo

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

Public Member Functions

 CTPPSProtonReconstructionDiffPlotter (const edm::ParameterSet &)
 
 ~CTPPSProtonReconstructionDiffPlotter () 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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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 endJob () override
 

Private Attributes

std::unique_ptr< TH1D > h_de_th_x
 
std::unique_ptr< TH1D > h_de_th_y
 
std::unique_ptr< TH1D > h_de_vtx_y
 
std::unique_ptr< TH1D > h_de_xi
 
std::string outputFile_
 
edm::EDGetTokenT< reco::ForwardProtonCollectiontokenRecoProtonsRef_
 
edm::EDGetTokenT< reco::ForwardProtonCollectiontokenRecoProtonsTest_
 

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 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<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 33 of file CTPPSProtonReconstructionDiffPlotter.cc.

Constructor & Destructor Documentation

◆ CTPPSProtonReconstructionDiffPlotter()

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

Definition at line 58 of file CTPPSProtonReconstructionDiffPlotter.cc.

59  : tokenRecoProtonsRef_(consumes<reco::ForwardProtonCollection>(ps.getParameter<InputTag>("tagRecoProtonsRef"))),
60  tokenRecoProtonsTest_(consumes<reco::ForwardProtonCollection>(ps.getParameter<InputTag>("tagRecoProtonsTest"))),
61 
62  outputFile_(ps.getParameter<string>("outputFile")),
63 
64  h_de_xi(new TH1D("", ";#Delta#xi", 200, -0.01, +0.01)),
65  h_de_th_x(new TH1D("", ";#Delta#theta_{x}", 200, -100E-6, +100E-6)),
66  h_de_th_y(new TH1D("", ";#Delta#theta_{y}", 200, -100E-6, +100E-6)),
67  h_de_vtx_y(new TH1D("", ";#Deltay^{*} (cm)", 200, -0.01, +0.01)) {}
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< reco::ForwardProtonCollection > tokenRecoProtonsTest_
edm::EDGetTokenT< reco::ForwardProtonCollection > tokenRecoProtonsRef_

◆ ~CTPPSProtonReconstructionDiffPlotter()

CTPPSProtonReconstructionDiffPlotter::~CTPPSProtonReconstructionDiffPlotter ( )
inlineoverride

Definition at line 36 of file CTPPSProtonReconstructionDiffPlotter.cc.

36 {}

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 71 of file CTPPSProtonReconstructionDiffPlotter.cc.

References h_de_th_x, h_de_th_y, h_de_vtx_y, h_de_xi, mps_fire::i, tokenRecoProtonsRef_, and tokenRecoProtonsTest_.

71  {
72  // get input
74  event.getByToken(tokenRecoProtonsRef_, hRecoProtonsRef);
75 
77  event.getByToken(tokenRecoProtonsTest_, hRecoProtonsTest);
78 
79  if (hRecoProtonsRef->size() != hRecoProtonsTest->size()) {
80  edm::LogWarning("CTPPSProtonReconstructionDiffPlotter::analyze")
81  << "Different number of Ref and Test protons. Skipping event.";
82  return;
83  }
84 
85  for (unsigned int i = 0; i < hRecoProtonsRef->size(); ++i) {
86  const auto &pr_ref = hRecoProtonsRef->at(i);
87  const auto &pr_test = hRecoProtonsTest->at(i);
88 
89  if (!pr_ref.validFit() || !pr_test.validFit())
90  continue;
91 
92  h_de_xi->Fill(pr_test.xi() - pr_ref.xi());
93  h_de_th_x->Fill(pr_test.thetaX() - pr_ref.thetaX());
94  h_de_th_y->Fill(pr_test.thetaY() - pr_ref.thetaY());
95  h_de_vtx_y->Fill(pr_test.vy() - pr_ref.vy());
96  }
97 }
edm::EDGetTokenT< reco::ForwardProtonCollection > tokenRecoProtonsTest_
edm::EDGetTokenT< reco::ForwardProtonCollection > tokenRecoProtonsRef_
Log< level::Warning, false > LogWarning

◆ endJob()

void CTPPSProtonReconstructionDiffPlotter::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 101 of file CTPPSProtonReconstructionDiffPlotter.cc.

References h_de_th_x, h_de_th_y, h_de_vtx_y, h_de_xi, and outputFile_.

101  {
102  auto f_out = std::make_unique<TFile>(outputFile_.c_str(), "recreate");
103 
104  h_de_xi->Write("h_de_xi");
105  h_de_th_x->Write("h_de_th_x");
106  h_de_th_y->Write("h_de_th_y");
107  h_de_vtx_y->Write("h_de_vtx_y");
108 }

Member Data Documentation

◆ h_de_th_x

std::unique_ptr<TH1D> CTPPSProtonReconstructionDiffPlotter::h_de_th_x
private

Definition at line 48 of file CTPPSProtonReconstructionDiffPlotter.cc.

Referenced by analyze(), and endJob().

◆ h_de_th_y

std::unique_ptr<TH1D> CTPPSProtonReconstructionDiffPlotter::h_de_th_y
private

Definition at line 48 of file CTPPSProtonReconstructionDiffPlotter.cc.

Referenced by analyze(), and endJob().

◆ h_de_vtx_y

std::unique_ptr<TH1D> CTPPSProtonReconstructionDiffPlotter::h_de_vtx_y
private

Definition at line 48 of file CTPPSProtonReconstructionDiffPlotter.cc.

Referenced by analyze(), and endJob().

◆ h_de_xi

std::unique_ptr<TH1D> CTPPSProtonReconstructionDiffPlotter::h_de_xi
private

Definition at line 48 of file CTPPSProtonReconstructionDiffPlotter.cc.

Referenced by analyze(), and endJob().

◆ outputFile_

std::string CTPPSProtonReconstructionDiffPlotter::outputFile_
private

Definition at line 46 of file CTPPSProtonReconstructionDiffPlotter.cc.

Referenced by endJob().

◆ tokenRecoProtonsRef_

edm::EDGetTokenT<reco::ForwardProtonCollection> CTPPSProtonReconstructionDiffPlotter::tokenRecoProtonsRef_
private

Definition at line 43 of file CTPPSProtonReconstructionDiffPlotter.cc.

Referenced by analyze().

◆ tokenRecoProtonsTest_

edm::EDGetTokenT<reco::ForwardProtonCollection> CTPPSProtonReconstructionDiffPlotter::tokenRecoProtonsTest_
private

Definition at line 44 of file CTPPSProtonReconstructionDiffPlotter.cc.

Referenced by analyze().