All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
IsolatedLeptonFinderProcessor.h
Go to the documentation of this file.
1 /**
2  * @brief Marlin processor for finding isolated leptons.
3  * @author Ryo Yonamine <yonamine@post.kek.jp>
4  * @author Tomohiko Tanabe <tomohiko@icepp.s.u-tokyo.ac.jp>
5  * @version $Id:$
6  *
7  * Given a list of ReconstructedParticle, identify isolated leptons
8  * based on the track cone energy, lepton identification,
9  * and the track impact parameters (optional).
10  */
11 #ifndef IsolatedLeptonFinderProcessor_h
12 #define IsolatedLeptonFinderProcessor_h 1
13 
14 #include <algorithm>
15 #include <string>
16 #include <map>
17 
18 #include <marlin/Processor.h>
19 #include <lcio.h>
20 
21 #include <EVENT/ReconstructedParticle.h>
22 #include <EVENT/MCParticle.h>
23 #include "IMPL/ReconstructedParticleImpl.h"
24 #include <UTIL/LCRelationNavigator.h>
25 
26 
27 class IsolatedLeptonFinderProcessor : public marlin::Processor {
28 
29  public:
30 
32 
34 
37 
38  virtual void init() ;
39  virtual void processEvent( LCEvent * evt ) ;
40  virtual void end() ;
41 
42  protected:
43 
44  /** Returns true if pfo is a lepton */
45  bool IsGoodLepton( ReconstructedParticle* pfo ) ;
46 
47  /** Returns true if pfo is an isolated lepton */
48  bool IsIsolatedLepton( ReconstructedParticle* pfo) ;
49 
50  /** Returns true if isolated, as defined by the cone energy */
51  bool IsIsolatedRectangular( ReconstructedParticle* pfo) ;
52  bool IsIsolatedPolynomial( ReconstructedParticle* pfo) ;
53  bool IsIsolatedJet( ReconstructedParticle* pfo ) ;
54 
55  /** Returns true if charged */
56  bool IsCharged( ReconstructedParticle* pfo ) ;
57 
58  /** Returns true if it passes muon or electron ID cuts */
59  bool IsLepton( ReconstructedParticle* pfo ) ;
60 
61  /** Returns true if it passes electron ID cuts */
62  bool IsElectron( ReconstructedParticle* pfo ) ;
63 
64  /** Returns true if it passes muon ID cuts */
65  bool IsMuon( ReconstructedParticle* pfo ) ;
66 
67  /** Returns true if it passes photon ID cuts */
68  bool IsPhoton( ReconstructedParticle* pfo ) ;
69 
70  /** Returns true if it passes impact parameter cuts */
71  bool PassesImpactParameterCuts( ReconstructedParticle* pfo ) ;
72 
73  /** Returns true if it passes impact parameter significance cuts */
74  bool PassesImpactParameterSignificanceCuts( ReconstructedParticle* pfo ) ;
75 
76  /** Helper function to order PFOS by energy */
77  bool isMoreEnergetic (int i, int j) {
78  ReconstructedParticle* pfo_i = static_cast<ReconstructedParticle*>( _pfoCol->getElementAt(i) );
79  ReconstructedParticle* pfo_j = static_cast<ReconstructedParticle*>( _pfoCol->getElementAt(j) );
80  return (pfo_i->getEnergy()>pfo_j->getEnergy());
81  }
82 
83  /** Adds photons around lepton to four vector */
84  void dressLepton( ReconstructedParticleImpl* pfo, int PFO_idx ) ;
85 
86  /** Calculates the cone energy */
87  float getConeEnergy( ReconstructedParticle* pfo) ;
88 
89  /** [0]:Ecal energy, [1]:Hcal energy */
90  void getCalEnergy( ReconstructedParticle* pfo , float* cale) ;
91 
92  /** Replace missing copy constructor by hand */
93  ReconstructedParticleImpl* CopyReconstructedParticle ( ReconstructedParticle* pfo ) ;
94 
95  /** Input collection */
96  std::string _inputPFOsCollection{};
97 
98  /** Output collection (all input with isolated leptons removed) */
100 
101  /** Output collection of isolated leptons */
102  std::string _outputIsoLepCollection{};
103 
104  /** Output collection (all input with dressed isolated leptons removed) */
106 
107  /** Output collection of dressed isolated leptons */
109 
110  LCCollection* _pfoCol=nullptr;
111  float _cosConeAngle = 0;
112  std::vector<ReconstructedParticle*> _workingList = {};
113 
114  /** If set to true, uses PID cuts */
115  bool _usePID = false;
124 
125  /** If set to true, uses impact parameter cuts */
126  bool _useImpactParameter = false;
127  float _minD0 = 0;
128  float _maxD0 = 0;
129  float _minZ0 = 0;
130  float _maxZ0 = 0;
131  float _minR0 = 0;
132  float _maxR0 = 0;
133 
134  /** If set to true, uses impact parameter significance cuts */
136  float _minD0Sig = 0;
137  float _maxD0Sig = 0;
138  float _minZ0Sig = 0;
139  float _maxZ0Sig = 0;
140  float _minR0Sig = 0;
141  float _maxR0Sig = 0;
142 
143  /** If set to true, uses rectangular cuts for isolation */
147  float _isoMinConeEnergy = 0;
148  float _isoMaxConeEnergy = 0;
149 
150  /** If set to true, uses polynomial cuts for isolation */
152  float _isoPolynomialA = 0;
153  float _isoPolynomialB = 0;
154  float _isoPolynomialC = 0;
155 
156  /** If set to true, uses jet-based isolation (LAL algorithm) */
157  bool _useJetIsolation = false;
158  std::string _jetCollectionName {};
159  std::map<ReconstructedParticle*,ReconstructedParticle*> _rpJetMap {};
160  float _jetIsoVetoMinXt = 0;
161  float _jetIsoVetoMaxXt = 0;
162  float _jetIsoVetoMinZ = 0;
163  float _jetIsoVetoMaxZ = 0;
164 
165 
166  /** If set to true, uses lepton dressing */
167  bool _useDressedLeptons = false;
168  bool _mergeCloseElectrons = false;
171 
172  /** If set to true, uses Pandora particle IDs */
173  bool _usePandoraIDs = false;
174 } ;
175 
176 #endif
177 
std::string _outputIsoLepCollection
Output collection of isolated leptons.
bool _useImpactParameterSignificance
If set to true, uses impact parameter significance cuts.
bool IsIsolatedRectangular(ReconstructedParticle *pfo)
Returns true if isolated, as defined by the cone energy.
std::string _outputDressedIsoLepCollection
Output collection of dressed isolated leptons.
bool _usePandoraIDs
If set to true, uses Pandora particle IDs.
void dressLepton(ReconstructedParticleImpl *pfo, int PFO_idx)
Adds photons around lepton to four vector.
void getCalEnergy(ReconstructedParticle *pfo, float *cale)
[0]:Ecal energy, [1]:Hcal energy
std::vector< ReconstructedParticle * > _workingList
bool IsLepton(ReconstructedParticle *pfo)
Returns true if it passes muon or electron ID cuts.
bool PassesImpactParameterCuts(ReconstructedParticle *pfo)
Returns true if it passes impact parameter cuts.
bool IsGoodLepton(ReconstructedParticle *pfo)
Returns true if pfo is a lepton.
std::string _outputPFOsRemovedDressedIsoLepCollection
Output collection (all input with dressed isolated leptons removed)
ReconstructedParticleImpl * CopyReconstructedParticle(ReconstructedParticle *pfo)
Replace missing copy constructor by hand.
bool PassesImpactParameterSignificanceCuts(ReconstructedParticle *pfo)
Returns true if it passes impact parameter significance cuts.
IsolatedLeptonFinderProcessor & operator=(const IsolatedLeptonFinderProcessor &)=delete
bool IsIsolatedPolynomial(ReconstructedParticle *pfo)
bool IsIsolatedLepton(ReconstructedParticle *pfo)
Returns true if pfo is an isolated lepton.
std::map< ReconstructedParticle *, ReconstructedParticle * > _rpJetMap
bool _usePolynomialIsolation
If set to true, uses polynomial cuts for isolation.
bool _usePID
If set to true, uses PID cuts.
bool IsCharged(ReconstructedParticle *pfo)
Returns true if charged.
bool _useImpactParameter
If set to true, uses impact parameter cuts.
bool IsPhoton(ReconstructedParticle *pfo)
Returns true if it passes photon ID cuts.
float getConeEnergy(ReconstructedParticle *pfo)
Calculates the cone energy.
bool IsElectron(ReconstructedParticle *pfo)
Returns true if it passes electron ID cuts.
bool _useJetIsolation
If set to true, uses jet-based isolation (LAL algorithm)
bool IsMuon(ReconstructedParticle *pfo)
Returns true if it passes muon ID cuts.
std::string _outputPFOsRemovedIsoLepCollection
Output collection (all input with isolated leptons removed)
bool _useRectangularIsolation
If set to true, uses rectangular cuts for isolation.
bool _useDressedLeptons
If set to true, uses lepton dressing.
Marlin processor for finding isolated leptons.
bool isMoreEnergetic(int i, int j)
Helper function to order PFOS by energy.
std::string _inputPFOsCollection
Input collection.
bool IsIsolatedJet(ReconstructedParticle *pfo)