ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/PFCandidate.h
(Generate patch)

Comparing UserCode/MitAna/DataTree/interface/PFCandidate.h (file contents):
Revision 1.1 by bendavid, Wed Mar 11 18:10:34 2009 UTC vs.
Revision 1.2 by loizides, Wed Mar 18 15:44:32 2009 UTC

# Line 3 | Line 3
3   //
4   // PFCandidate
5   //
6 < // For now mostly mirroring PFCandidate from CMSSW
6 > // Particle-flow candidate class, for now mostly mirroring the PFCandidate from CMSSW.
7   //
8   // Authors: J.Bendavid
9   //--------------------------------------------------------------------------------------------------
# Line 11 | Line 11
11   #ifndef MITANA_DATATREE_PFCandidate_H
12   #define MITANA_DATATREE_PFCandidate_H
13  
14 + #include "MitCommon/DataFormats/interface/Vect3.h"
15 + #include "MitCommon/DataFormats/interface/Vect4M.h"
16   #include "MitAna/DataTree/interface/Types.h"
17   #include "MitAna/DataCont/interface/Ref.h"
18   #include "MitAna/DataTree/interface/CompositeParticle.h"
17 #include "MitCommon/DataFormats/interface/Vect3.h"
18 #include "MitCommon/DataFormats/interface/Vect4M.h"
19   #include "MitAna/DataTree/interface/Track.h"
20   #include "MitAna/DataTree/interface/Muon.h"
21   #include "MitAna/DataTree/interface/Conversion.h"
# Line 26 | Line 26 | namespace mithep
26    {
27      public:
28        enum EPFType {
29 <        eX = 0,    //unidentified
30 <        eHadron,   //charged hadron
31 <        eElectron, //electron
32 <        eMuon,     //muon
33 <        eGamma,    //photon
29 >        eX = 0,          //unidentified
30 >        eHadron,         //charged hadron
31 >        eElectron,       //electron
32 >        eMuon,           //muon
33 >        eGamma,          //photon
34          eNeutralHadron,  //neutral hadron
35 <        eHadronHF,  //hadron in HF
36 <        eEGammaHF   //EM object in HF
35 >        eHadronHF,       //hadron in HF
36 >        eEGammaHF        //EM object in HF
37        };
38  
39        enum EPFFlags {
# Line 56 | Line 56 | namespace mithep
56          eToConversion
57        };
58  
59
59        PFCandidate() : fCharge(0), fEECal(0), fEHCal(0), fEECalRaw(0), fEHCalRaw(0),
60                        fEPS1(0), fEPS2(0), fPError(0),fMvaEPi(0), fMvaEMu(0),
61                        fMvaPiMu(0), fMvaGamma(0), fMvaNeutralH(0), fMvaGammaNeutralH(0),
# Line 68 | Line 67 | namespace mithep
67                        fMvaPiMu(0), fMvaGamma(0), fMvaNeutralH(0), fMvaGammaNeutralH(0),
68                        fEtaECal(0), fPhiECal(0), fPFType(eX) {}
69  
70 <      void                AddDaughter(const PFCandidate *p) { fDaughters.Add(p);                 }
71 <      void                ClearFlag(EPFFlags f)             { fPFFlags.ClearBit(f);              }
72 <      void                ClearFlags()                      { fPFFlags.Clear();                  }
73 <      const Conversion   *Conv()                   const    { return fConversion.Obj();          }
70 >      void                AddDaughter(const PFCandidate *p) { fDaughters.Add(p);                  }
71 >      void                ClearFlag(EPFFlags f)             { fPFFlags.ClearBit(f);               }
72 >      void                ClearFlags()                      { fPFFlags.Clear();                   }
73 >      const Conversion   *Conv()                   const    { return fConversion.Obj();           }
74        const PFCandidate  *Daughter(UInt_t i)       const;
75 <      Double_t            EECal()                  const    { return fEECal;                     }
76 <      Double_t            EHCal()                  const    { return fEHCal;                     }
77 <      Double_t            EECalRaw()               const    { return fEECalRaw;                  }
78 <      Double_t            EHCalRaw()               const    { return fEHCalRaw;                  }
79 <      Double_t            EPS1()                   const    { return fEPS1;                      }
80 <      Double_t            EPS2()                   const    { return fEPS2;                      }
81 <      Double_t            PError()                 const    { return fPError;                    }
82 <      Double_t            MvaEPi()                 const    { return fMvaEPi;                    }
83 <      Double_t            MvaEMu()                 const    { return fMvaEMu;                    }
84 <      Double_t            MvaPiMu()                const    { return fMvaPiMu;                   }
85 <      Double_t            MvaGamma()               const    { return fMvaGamma;                  }
86 <      Double_t            MvaNeutralH()            const    { return fMvaNeutralH;               }
87 <      Double_t            MvaGammaNeutralH()       const    { return fMvaGammaNeutralH;          }
88 <      Double_t            EtaECal()                const    { return fEtaECal;                   }
89 <      Double_t            PhiECal()                const    { return fPhiECal;                   }
90 <      Bool_t              Flag(EPFFlags f)         const    { return fPFFlags.TestBit(f);        }
91 <      Bool_t              HasConversion()          const    { return fConversion.IsValid();      }
92 <      Bool_t              HasMother()              const { return fMother.IsValid();             }
93 <      Bool_t              HasMother(const PFCandidate *m)                   const;
94 <      Bool_t              HasTrackerTrk()          const { return fTrackerTrack.IsValid();       }
95 <      Bool_t              HasGsfTrk()              const { return fGsfTrack.IsValid();           }
96 <      Bool_t              HasTrk()                 const { return (HasTrackerTrk() || HasGsfTrk()); }
97 <      const PFCandidate  *Mother()                 const { return fMother.Obj();                 }
98 <      const Muon         *Mu()                     const { return fMuon.Obj();                   }
99 <      EObjType            ObjType()                const { return kPFCandidate;                  }
100 <      EPFType             PFType()                 const { return fPFType;                       }
101 <      void                SetCharge(Short_t c)           { fCharge = c; ClearCharge();           }
102 <      void                SetEECal(Double_t e)           { fEECal = e;                           }
103 <      void                SetEHCal(Double_t e)           { fEHCal = e;                           }
104 <      void                SetEECalRaw(Double_t e)        { fEECalRaw = e;                        }
105 <      void                SetEHCalRaw(Double_t e)        { fEHCalRaw = e;                        }
106 <      void                SetEPS1(Double_t e)            { fEPS1 = e;                            }
107 <      void                SetEPS2(Double_t e)            { fEPS2 = e;                            }
108 <      void                SetPError(Double_t err)        { fPError = err;                        }
109 <      void                SetMvaEPi(Double_t d)          { fMvaEPi = d;                          }
110 <      void                SetMvaEMu(Double_t d)          { fMvaEMu = d;                          }
111 <      void                SetMvaPiMu(Double_t d)         { fMvaPiMu = d;                         }
112 <      void                SetMvaGamma(Double_t d)        { fMvaGamma = d;                        }
113 <      void                SetMvaNeutralH(Double_t d)     { fMvaNeutralH = d;                     }
114 <      void                SetMvaGammaNeutralH(Double_t d) { fMvaGammaNeutralH = d;               }
115 <      void                SetEtaECal(Double_t eta)       { fEtaECal = eta;                       }
116 <      void                SetPhiECal(Double_t phi)       { fPhiECal = phi;                       }
117 <      void                SetPFType(EPFType t)           { fPFType = t;                          }
118 <      void                SetFlag(EPFFlags f, Bool_t b=1) { fPFFlags.SetBit(f,b);                }
75 >      Double_t            EECal()                  const    { return fEECal;                      }
76 >      Double_t            EHCal()                  const    { return fEHCal;                      }
77 >      Double_t            EECalRaw()               const    { return fEECalRaw;                   }
78 >      Double_t            EHCalRaw()               const    { return fEHCalRaw;                   }
79 >      Double_t            EPS1()                   const    { return fEPS1;                       }
80 >      Double_t            EPS2()                   const    { return fEPS2;                       }
81 >      Double_t            PError()                 const    { return fPError;                     }
82 >      Double_t            MvaEPi()                 const    { return fMvaEPi;                     }
83 >      Double_t            MvaEMu()                 const    { return fMvaEMu;                     }
84 >      Double_t            MvaPiMu()                const    { return fMvaPiMu;                    }
85 >      Double_t            MvaGamma()               const    { return fMvaGamma;                   }
86 >      Double_t            MvaNeutralH()            const    { return fMvaNeutralH;                }
87 >      Double_t            MvaGammaNeutralH()       const    { return fMvaGammaNeutralH;           }
88 >      Double_t            EtaECal()                const    { return fEtaECal;                    }
89 >      Double_t            PhiECal()                const    { return fPhiECal;                    }
90 >      Bool_t              Flag(EPFFlags f)         const    { return fPFFlags.TestBit(f);         }
91 >      Bool_t              HasConversion()          const    { return fConversion.IsValid();       }
92 >      Bool_t              HasMother()              const    { return fMother.IsValid();           }
93 >      Bool_t              HasMother(const PFCandidate *m) const;
94 >      Bool_t              HasTrackerTrk()          const    { return fTrackerTrack.IsValid();     }
95 >      Bool_t              HasGsfTrk()              const    { return fGsfTrack.IsValid();         }
96 >      Bool_t              HasTrk()                 const
97 >                            { return (HasTrackerTrk() || HasGsfTrk()); }
98 >      const PFCandidate  *Mother()                 const    { return fMother.Obj();               }
99 >      const Muon         *Mu()                     const    { return fMuon.Obj();                 }
100 >      EObjType            ObjType()                const    { return kPFCandidate;                }
101 >      EPFType             PFType()                 const    { return fPFType;                     }
102 >      void                SetCharge(Double_t c)             { fCharge = c; ClearCharge();         }
103 >      void                SetEECal(Double_t e)              { fEECal = e;                         }
104 >      void                SetEHCal(Double_t e)              { fEHCal = e;                         }
105 >      void                SetEECalRaw(Double_t e)           { fEECalRaw = e;                      }
106 >      void                SetEHCalRaw(Double_t e)           { fEHCalRaw = e;                      }
107 >      void                SetEPS1(Double_t e)               { fEPS1 = e;                          }
108 >      void                SetEPS2(Double_t e)               { fEPS2 = e;                          }
109 >      void                SetPError(Double_t err)           { fPError = err;                      }
110 >      void                SetMvaEPi(Double_t d)             { fMvaEPi = d;                        }
111 >      void                SetMvaEMu(Double_t d)             { fMvaEMu = d;                        }
112 >      void                SetMvaPiMu(Double_t d)            { fMvaPiMu = d;                       }
113 >      void                SetMvaGamma(Double_t d)           { fMvaGamma = d;                      }
114 >      void                SetMvaNeutralH(Double_t d)        { fMvaNeutralH = d;                   }
115 >      void                SetMvaGammaNeutralH(Double_t d)   { fMvaGammaNeutralH = d;              }
116 >      void                SetEtaECal(Double_t eta)          { fEtaECal = eta;                     }
117 >      void                SetPhiECal(Double_t phi)          { fPhiECal = phi;                     }
118 >      void                SetPFType(EPFType t)              { fPFType = t;                        }
119 >      void                SetFlag(EPFFlags f, Bool_t b=1)   { fPFFlags.SetBit(f,b);               }
120        void                SetMom(Double_t px, Double_t py, Double_t pz, Double_t e);
121 <      void                SetMother(const PFCandidate *p) { fMother = p;    }
122 <      void                SetTrackerTrk(const Track *t)   { fTrackerTrack = t;                   }
123 <      void                SetGsfTrk(const Track *t)       { fGsfTrack = t;                       }
124 <      void                SetMuon(const Muon *m)          { fMuon = m;                           }
125 <      void                SetConversion(const Conversion *c) { fConversion = c;                  }
121 >      void                SetMother(const PFCandidate *p)   { fMother = p;                        }
122 >      void                SetTrackerTrk(const Track *t)     { fTrackerTrack = t;                  }
123 >      void                SetGsfTrk(const Track *t)         { fGsfTrack = t;                      }
124 >      void                SetMuon(const Muon *m)            { fMuon = m;                          }
125 >      void                SetConversion(const Conversion *c)
126 >                            { fConversion = c; }
127        void                SetVertex(Double_t x, Double_t y, Double_t z);
128 <      const ThreeVector   SourceVertex()           const    { return fSourceVertex.V();          }
129 <      const Track        *TrackerTrk()             const    { return fTrackerTrack.Obj();        }
130 <      const Track        *GsfTrk()                 const    { return fGsfTrack.Obj();            }
128 >      const ThreeVector   SourceVertex()           const    { return fSourceVertex.V();           }
129 >      const Track        *TrackerTrk()             const    { return fTrackerTrack.Obj();         }
130 >      const Track        *GsfTrk()                 const    { return fGsfTrack.Obj();             }
131        const Track        *BestTrk()                const;
132 <      const Track        *Trk()                    const    { return BestTrk();                  }
132 >      const Track        *Trk()                    const    { return BestTrk();                   }
133        
134      protected:
135        Double_t            GetCharge()              const;
136        void                GetMom()                 const;
137  
138 <      FourVectorM32       fMom;          //four momentum vector
139 <      Vect3               fSourceVertex; //pflow source vertex
140 <      Short_t             fCharge;       //charge
141 <      Double32_t          fEECal;        //corrected Ecal energy
142 <      Double32_t          fEHCal;        //corrected Hcal energy
143 <      Double32_t          fEECalRaw;     //uncorrected Ecal energy
144 <      Double32_t          fEHCalRaw;     //uncorrected Hcal energy
145 <      Double32_t          fEPS1;         //corrected PS1 energy
146 <      Double32_t          fEPS2;         //corrected PS2 energy
147 <      Double32_t          fPError;       //uncertainty on P (three-mom magnitude)
148 <      Double32_t          fMvaEPi;       //electron-pion discriminant
149 <      Double32_t          fMvaEMu;       //electron-muon discriminant
150 <      Double32_t          fMvaPiMu;      //pion-muon discriminant
151 <      Double32_t          fMvaGamma;     //photon id discriminant
152 <      Double32_t          fMvaNeutralH;  //neutral hadron id discriminant
153 <      Double32_t          fMvaGammaNeutralH; //photon-neutralhadron discriminant
154 <      Double32_t          fEtaECal;      //eta at ecal front face
155 <      Double32_t          fPhiECal;      //phi at ecal front face
156 <
157 <      EPFType             fPFType;       //particle flow type
158 <      BitMask32           fPFFlags;      //various PF flags
159 <      
160 <      Ref<PFCandidate>    fMother;       //reference to mother
161 <      Ref<Track>          fTrackerTrack; //reference to (standard) track
162 <      Ref<Track>          fGsfTrack;     //reference to gsf track (for electrons only)
162 <      Ref<Muon>           fMuon;         //reference to corresponding reco muon
163 <      Ref<Conversion>     fConversion;   //reference to corresponding reco conversion
138 >      Vect4M              fMom;              //four momentum vector
139 >      Vect3               fSourceVertex;     //pflow source vertex
140 >      Double32_t          fCharge;           //[-1,1,2]charge
141 >      Double32_t          fEECal;            //[0,0,14]corrected Ecal energy
142 >      Double32_t          fEHCal;            //[0,0,14]corrected Hcal energy
143 >      Double32_t          fEECalRaw;         //[0,0,14]uncorrected Ecal energy
144 >      Double32_t          fEHCalRaw;         //[0,0,14]uncorrected Hcal energy
145 >      Double32_t          fEPS1;             //[0,0,14]corrected PS1 energy
146 >      Double32_t          fEPS2;             //[0,0,14]corrected PS2 energy
147 >      Double32_t          fPError;           //[0,0,14]uncertainty on P (three-mom magnitude)
148 >      Double32_t          fMvaEPi;           //[0,0,14]electron-pion discriminant
149 >      Double32_t          fMvaEMu;           //[0,0,14]electron-muon discriminant
150 >      Double32_t          fMvaPiMu;          //[0,0,14]pion-muon discriminant
151 >      Double32_t          fMvaGamma;         //[0,0,14]photon id discriminant
152 >      Double32_t          fMvaNeutralH;      //[0,0,14]neutral hadron id discriminant
153 >      Double32_t          fMvaGammaNeutralH; //[0,0,14]photon-neutralhadron discriminant
154 >      Double32_t          fEtaECal;          //[0,0,10]eta at ecal front face
155 >      Double32_t          fPhiECal;          //[0,0,10]phi at ecal front face
156 >      EPFType             fPFType;           //particle flow type
157 >      BitMask32           fPFFlags;          //various PF flags
158 >      Ref<PFCandidate>    fMother;           //reference to mother
159 >      Ref<Track>          fTrackerTrack;     //reference to (standard) track
160 >      Ref<Track>          fGsfTrack;         //reference to gsf track (for electrons only)
161 >      Ref<Muon>           fMuon;             //reference to corresponding reco muon
162 >      Ref<Conversion>     fConversion;       //reference to corresponding reco conversion
163  
164 <    ClassDef(PFCandidate,1) // Generated particle class
164 >    ClassDef(PFCandidate,1) // Particle-flow candidate class
165    };
166   }
167  
# Line 195 | Line 194 | inline Double_t mithep::PFCandidate::Get
194    // Get stored charge
195  
196    return fCharge;
198
197   }
198  
199   //--------------------------------------------------------------------------------------------------
# Line 203 | Line 201 | inline void mithep::PFCandidate::GetMom(
201   {
202    // Get momentum values from stored values.
203  
204 <  fCachedMom = fMom;
204 >  fCachedMom.SetCoordinates(fMom.Pt(),fMom.Eta(),fMom.Phi(),fMom.M());
205   }
206  
207   //--------------------------------------------------------------------------------------------------

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines