CMS 3D CMS Logo

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

Public Types

typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 
- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void endJob () override
 
 PFTester (const edm::ParameterSet &)
 
 ~PFTester () 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 Attributes

DQMStoredbe_
 
edm::EDGetTokenT< reco::PFCandidateCollectioninputPFlowLabel_tok_
 
std::map< std::string, MonitorElement * > me
 
std::string outputFile_
 

Additional Inherited Members

- 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 34 of file PFTester.cc.

Member Typedef Documentation

◆ DQMStore

Definition at line 36 of file PFTester.cc.

◆ MonitorElement

Definition at line 37 of file PFTester.cc.

Constructor & Destructor Documentation

◆ PFTester()

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

Definition at line 63 of file PFTester.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

63  {
64  inputPFlowLabel_tok_ = consumes<reco::PFCandidateCollection>(iConfig.getParameter<std::string>("InputPFlowLabel"));
65  outputFile_ = iConfig.getUntrackedParameter<std::string>("OutputFile");
66 
67  if (!outputFile_.empty())
68  edm::LogInfo("OutputInfo") << " ParticleFLow Task histograms will be saved to '" << outputFile_.c_str() << "'";
69  else
70  edm::LogInfo("OutputInfo") << " ParticleFlow Task histograms will NOT be saved";
71 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
T getUntrackedParameter(std::string const &, T const &) const
Log< level::Info, false > LogInfo
edm::EDGetTokenT< reco::PFCandidateCollection > inputPFlowLabel_tok_
Definition: PFTester.cc:53
std::string outputFile_
Definition: PFTester.cc:52

◆ ~PFTester()

PFTester::~PFTester ( )
override

Definition at line 73 of file PFTester.cc.

73 {}

Member Function Documentation

◆ analyze()

void PFTester::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 109 of file PFTester.cc.

References reco::LeafCandidate::charge(), reco::LeafCandidate::et(), reco::LeafCandidate::eta(), iEvent, hlt_dqm_clientPB-live_cfg::me, reco::PFCandidate::particleId(), reco::LeafCandidate::pdgId(), packedPFCandidateRefMixer_cfi::pf, reco::LeafCandidate::phi(), and edm::Handle< T >::product().

109  {
110  // Data to Retrieve from the Event
111  const PFCandidateCollection *pflow_candidates;
112 
113  // ==========================================================
114  // Retrieve!
115  // ==========================================================
116 
117  {
118  // Get Particle Flow Candidates
120  iEvent.getByToken(inputPFlowLabel_tok_, pflow_hnd);
121  pflow_candidates = pflow_hnd.product();
122  }
123 
124  if (!pflow_candidates) {
125  edm::LogInfo("OutputInfo") << " failed to retrieve data required by ParticleFlow Task";
126  edm::LogInfo("OutputInfo") << " ParticleFlow Task cannot continue...!";
127  return;
128  }
129 
130  // ==========================================================
131  // Analyze!
132  // ==========================================================
133 
134  // Loop Over Particle Flow Candidates
135  PFCandidateCollection::const_iterator pf;
136  for (pf = pflow_candidates->begin(); pf != pflow_candidates->end(); pf++) {
137  const PFCandidate *particle = &(*pf);
138 
139  // Fill Histograms for Candidate Methods
140  me["CandidateEt"]->Fill(particle->et());
141  me["CandidateEta"]->Fill(particle->eta());
142  me["CandidatePhi"]->Fill(particle->phi());
143  me["CandidateCharge"]->Fill(particle->charge());
144  me["CandidatePdgId"]->Fill(particle->pdgId());
145 
146  // Fill Histograms for PFCandidate Specific Methods
147  me["PFCandidateType"]->Fill(particle->particleId());
148  // particle->elementsInBlocks();
149 
150  // Get the PFBlock and Elements
151  // JW: Returns vector of blocks now ,TO BE FIXED ----
152  /*PFBlock block = *(particle->block());
153  OwnVector<PFBlockElement> elements = block.elements();
154  int numElements = elements.size();
155  int numTrackElements = 0;
156  int numPS1Elements = 0;
157  int numPS2Elements = 0;
158  int numECALElements = 0;
159  int numHCALElements = 0;
160  int numMuonElements = 0;
161 
162  // Loop over Elements in Block
163  OwnVector<PFBlockElement>::const_iterator element;
164  for (element = elements.begin(); element != elements.end(); element++) {
165 
166  int element_type = element->type();
167  // Element is a Tracker Track
168  if (element_type == PFBlockElement::TRACK) {
169 
170  // Get General Information about the Track
171  PFRecTrack track = *(element->trackRefPF());
172  me["TrackCharge"]->Fill(track.charge());
173  me["TrackNumPoints"]->Fill(track.nTrajectoryPoints());
174  me["TrackNumMeasurements"]->Fill(track.nTrajectoryMeasurements());
175 
176  // Loop Over Points in the Track
177  vector<PFTrajectoryPoint> points = track.trajectoryPoints();
178  vector<PFTrajectoryPoint>::iterator point;
179  for (point = points.begin(); point != points.end(); point++) {
180  int point_layer = point->layer();
181  double x = point->positionXYZ().x();
182  double y = point->positionXYZ().y();
183  double z = point->positionXYZ().z();
184  //switch (point_layer) {
185  //case PFTrajectoryPoint::ClosestApproach:
186  // Fill the Track's D0
187  if (point_layer == PFTrajectoryPoint::ClosestApproach) {
188  me["TrackImpactParameter"]->Fill(sqrt(x*x + y*y + z*z));
189  }
190  }
191  numTrackElements++;
192  }
193 
194  // Element is an ECAL Cluster
195  else if (element_type == PFBlockElement::ECAL) {
196  numECALElements++;
197  }
198  // Element is a HCAL Cluster
199  else if (element_type == PFBlockElement::HCAL) {
200  numHCALElements++;
201  }
202  // Element is a Muon Track
203  else if (element_type == PFBlockElement::MUON) {
204  numMuonElements++;
205  }
206  // Fill the Respective Elements Sizes
207  me["NumElements"]->Fill(numElements);
208  me["NumTrackElements"]->Fill(numTrackElements);
209  me["NumPS1Elements"]->Fill(numPS1Elements);
210  me["NumPS2Elements"]->Fill(numPS2Elements);
211  me["NumECALElements"]->Fill(numECALElements);
212  me["NumHCALElements"]->Fill(numHCALElements);
213  me["NumMuonElements"]->Fill(numMuonElements);
214  } ---------------------------------------------- */
215  }
216 }
T const * product() const
Definition: Handle.h:70
std::map< std::string, MonitorElement * > me
Definition: PFTester.cc:49
int pdgId() const final
PDG identifier.
int iEvent
Definition: GenABIO.cc:224
Log< level::Info, false > LogInfo
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
edm::EDGetTokenT< reco::PFCandidateCollection > inputPFlowLabel_tok_
Definition: PFTester.cc:53
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:41
double et() const final
transverse energy
double phi() const final
momentum azimuthal angle
int charge() const final
electric charge
virtual ParticleType particleId() const
Definition: PFCandidate.h:392
double eta() const final
momentum pseudorapidity

◆ beginJob()

void PFTester::beginJob ( void  )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 75 of file PFTester.cc.

References M_PI, hlt_dqm_clientPB-live_cfg::me, and Utilities::operator.

75  {
76  // get ahold of back-end interface
78 
79  if (dbe_) {
80  dbe_->setCurrentFolder("PFTask/PFCandidates");
81 
82  me["CandidateEt"] = dbe_->book1D("CandidateEt", "CandidateEt", 1000, 0, 1000);
83  me["CandidateEta"] = dbe_->book1D("CandidateEta", "CandidateEta", 200, -5, 5);
84  me["CandidatePhi"] = dbe_->book1D("CandidatePhi", "CandidatePhi", 200, -M_PI, M_PI);
85  me["CandidateCharge"] = dbe_->book1D("CandidateCharge", "CandidateCharge", 5, -2, 2);
86  me["PFCandidateType"] = dbe_->book1D("PFCandidateType", "PFCandidateType", 10, 0, 10);
87 
88  dbe_->setCurrentFolder("PFTask/PFBlocks");
89 
90  me["NumElements"] = dbe_->book1D("NumElements", "NumElements", 25, 0, 25);
91  me["NumTrackElements"] = dbe_->book1D("NumTrackElements", "NumTrackElements", 5, 0, 5);
92  me["NumPS1Elements"] = dbe_->book1D("NumPS1Elements", "NumPS1Elements", 5, 0, 5);
93  me["NumPS2Elements"] = dbe_->book1D("NumPS2Elements", "NumPS2Elements", 5, 0, 5);
94  me["NumECALElements"] = dbe_->book1D("NumECALElements", "NumECALElements", 5, 0, 5);
95  me["NumHCALElements"] = dbe_->book1D("NumHCALElements", "NumHCALElements", 5, 0, 5);
96  me["NumMuonElements"] = dbe_->book1D("NumMuonElements", "NumMuonElements", 5, 0, 5);
97 
98  dbe_->setCurrentFolder("PFTask/PFTracks");
99 
100  me["TrackCharge"] = dbe_->book1D("TrackCharge", "TrackCharge", 5, -2, 2);
101  me["TrackNumPoints"] = dbe_->book1D("TrackNumPoints", "TrackNumPoints", 100, 0, 100);
102  me["TrackNumMeasurements"] = dbe_->book1D("TrackNumMeasurements", "TrackNumMeasurements", 100, 0, 100);
103  me["TrackImpactParameter"] = dbe_->book1D("TrackImpactParameter", "TrackImpactParameter", 1000, 0, 1);
104 
105  dbe_->setCurrentFolder("PFTask/PFClusters");
106  }
107 }
void setCurrentFolder(std::string const &fullpath) override
Definition: DQMStore.h:646
std::map< std::string, MonitorElement * > me
Definition: PFTester.cc:49
#define M_PI
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
DQMStore * dbe_
Definition: PFTester.cc:48

◆ endJob()

void PFTester::endJob ( void  )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 218 of file PFTester.cc.

218  {
219  // Store the DAQ Histograms
220  if (!outputFile_.empty() && dbe_)
222 }
std::string outputFile_
Definition: PFTester.cc:52
DQM_DEPRECATED void save(std::string const &filename, std::string const &path="")
Definition: DQMStore.cc:808
DQMStore * dbe_
Definition: PFTester.cc:48

Member Data Documentation

◆ dbe_

DQMStore* PFTester::dbe_
private

Definition at line 48 of file PFTester.cc.

◆ inputPFlowLabel_tok_

edm::EDGetTokenT<reco::PFCandidateCollection> PFTester::inputPFlowLabel_tok_
private

Definition at line 53 of file PFTester.cc.

◆ me

std::map<std::string, MonitorElement *> PFTester::me
private

Definition at line 49 of file PFTester.cc.

◆ outputFile_

std::string PFTester::outputFile_
private

Definition at line 52 of file PFTester.cc.