CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CalibratableTest.h
Go to the documentation of this file.
1 #ifndef CALIBRATABLETEST_H_
2 #define CALIBRATABLETEST_H_
3 
4 // system include files
5 #include <memory>
6 #include <vector>
7 // user include files
15 
17 
23 
24 #include <TTree.h>
25 
26 
58 public:
59  explicit CalibratableTest(const edm::ParameterSet&);
61 
62  /*
63  * Returns the collection in the event matching the Handle.
64  */
65  template<class T> void getCollection(edm::Handle<T>& c,
66  const edm::InputTag& tag, const edm::Event& event) const;
67 
68 private:
69  /*
70  * The usual EDAnalyzer methods
71  */
72  virtual void beginJob();
73  virtual void analyze(const edm::Event&, const edm::EventSetup&);
74  virtual void endJob();
75 
76  /*
77  * Called for each particle in the event to fill the tree and
78  * reset calib_.
79  */
80  virtual void fillTreeAndReset();
81 
82  /*
83  * Finds the main pions generated by FastSim
84  */
85  std::vector<unsigned> findPrimarySimParticles(
86  const std::vector<reco::PFSimParticle>& sims);
87 
88  /*
89  * Finds PFCandidates within some deltaR of the supplied sim particle.
90  */
91  std::vector<unsigned> findCandidatesInDeltaR(const reco::PFSimParticle& pft,
92  const std::vector<reco::PFCandidate>& cands, const double& deltaR);
93 
94  /*
95  * Fills calib_ with PFCandidate information.
96  */
97  void extractCandidate(const reco::PFCandidate& cand);
98 
99  /*
100  * Computes delta R between two objects.
101  */
102  double deltaR(const double& eta1, const double& eta2, const double& phi1,
103  const double& phi2);
104 
105  //Calibratable tree
106  TTree* tree_;
107 
108  //This analyzer produces a file with a tree so we need,
110 
111  //Debug?
112  int debug_;
113 
114  //True if this event was generally successful:
115  //if no sim particles are found, this will be false
117  //True if this particle should be written to the tree
118  //If no PFCandidates are found within a delta R cone of the sim particle,
119  //this will be false.
121 
122  //The Calibratable object
124 
125  //Increment nWrites_ for every record written to the tree
126  //Incremement nFails_ for every event/particle not written to the tree (thisEventPasses_ == false)
129 
130  //Size of cone around sim particle to look for PFCandidates
132 
133  //Collection input tags
138 
139  //collections
144 
145 };
146 
148  const edm::InputTag& tag, const edm::Event& event) const {
149 
150  try {
151  event.getByLabel(tag, c);
152  if(!c.isValid()) {
153  std::cout << "Warning! Collection for label " << tag << " is not valid!" << std::endl;
154  }
155  }
156  catch (cms::Exception& err) {
157  std::cout << "Couldn't get collection\n";
158  //std::ostringstream s;
159  //LogError("Error getting collection!") << s;
160  }
161 }
162 
163 #endif /*CALIBRATABLETEST_H_*/
edm::InputTag inputTagClustersHcal_
edm::Service< TFileService > fileservice_
Wraps essential single particle calibration data ready for export to a Root file. ...
Definition: Calibratable.h:122
virtual void endJob()
std::vector< unsigned > findPrimarySimParticles(const std::vector< reco::PFSimParticle > &sims)
virtual void fillTreeAndReset()
CalibratableTest(const edm::ParameterSet &)
edm::Handle< reco::PFCandidateCollection > * pfCandidates_
double deltaR(const double &eta1, const double &eta2, const double &phi1, const double &phi2)
void extractCandidate(const reco::PFCandidate &cand)
pftools::Calibratable * calib_
edm::Handle< reco::PFSimParticleCollection > * simParticles_
edm::Handle< reco::PFClusterCollection > * clustersEcal_
EDAnalyzer to exercise and demonstrate usage of Calibratable tree.
void getCollection(edm::Handle< T > &c, const edm::InputTag &tag, const edm::Event &event) const
edm::InputTag inputTagCandidates_
std::vector< unsigned > findCandidatesInDeltaR(const reco::PFSimParticle &pft, const std::vector< reco::PFCandidate > &cands, const double &deltaR)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
bool isValid() const
Definition: HandleBase.h:76
true particle for particle flow
Definition: PFSimParticle.h:19
edm::InputTag inputTagSimParticles_
edm::Handle< reco::PFClusterCollection > * clustersHcal_
virtual void beginJob()
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:35
virtual void analyze(const edm::Event &, const edm::EventSetup &)
tuple cout
Definition: gather_cfg.py:121
edm::InputTag inputTagClustersEcal_