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

Comparing UserCode/MitAna/DataTree/interface/SuperCluster.h (file contents):
Revision 1.17 by sixie, Fri Mar 26 15:09:11 2010 UTC vs.
Revision 1.26 by paus, Thu Mar 29 23:41:55 2012 UTC

# Line 10 | Line 10
10  
11   #ifndef MITANA_DATATREE_SUPERCLUSTER_H
12   #define MITANA_DATATREE_SUPERCLUSTER_H
13 <
13 >
14   #include <TMath.h>
15   #include "MitCommon/DataFormats/interface/Vect3C.h"
16   #include "MitAna/DataTree/interface/DataObject.h"
17   #include "MitAna/DataTree/interface/BasicCluster.h"
18 + #include "MitAna/DataTree/interface/CaloTower.h"
19   #include "MitAna/DataCont/interface/RefArray.h"
20   #include "MitAna/DataCont/interface/Ref.h"
21  
22 < namespace mithep
22 > namespace mithep
23   {
24    class SuperCluster : public DataObject
25    {
26 <    public:
27 <      SuperCluster() : fEnergy(0), fEtaWidth(0), fPreshowerEnergy(0),
28 <                       fPhiWidth(0), fRawEnergy(0) {}    
29 <
30 <      void                   AddCluster(const BasicCluster *c)          { fClusters.Add(c);        }
31 <      const BasicCluster    *Cluster(UInt_t i)       const { return fClusters.At(i);               }
32 <      UInt_t                 ClusterSize()           const { return fClusters.Entries();           }
33 <      Int_t                  Compare(const TObject *o) const;  
34 <      Double_t               Energy()                const { return fEnergy;                       }
35 <      Double_t               Et()                    const;
36 <      Double_t               Eta()                   const { return fPoint.Eta();                  }
37 <      Double_t               EtaWidth()              const { return fEtaWidth;                     }
38 <      Double_t               HcalDepth1Energy()      const { return fHcalDepth1Energy;             }
39 <      Double_t               HcalDepth2Energy()      const { return fHcalDepth2Energy;             }
40 <      Double_t               HadDepth1OverEm()       const { return fHcalDepth1Energy/fEnergy;     }
41 <      Double_t               HadDepth2OverEm()       const { return fHcalDepth2Energy/fEnergy;     }
42 <      Double_t               HadOverEm()             const { return (fHcalDepth1Energy+
43 <                                                                     fHcalDepth2Energy)/fEnergy;   }
44 <      Bool_t                 IsSortable()            const { return kTRUE;                         }
45 <      EObjType               ObjType()               const { return kSuperCluster;                 }
46 <      Double_t               Phi()                   const { return fPoint.Phi();                  }
47 <      Double_t               PhiWidth()              const { return fPhiWidth;                     }
48 <      ThreeVectorC           Point()                 const { return fPoint.V();                    }
49 <      void                   Print(Option_t *opt="") const;
50 <      Double_t               PreshowerEnergy()       const { return fPreshowerEnergy;              }
51 <      Double_t               RawEnergy()             const { return fRawEnergy;                    }
52 <      Double_t               Rho()                   const { return fPoint.Rho();                  }
53 <      const BasicCluster    *Seed()                  const { return fSeedRef.Obj();                }
54 <      void                   SetEnergy(Double_t energy)                 { fEnergy = energy;        }
55 <      void                   SetEtaWidth(Double_t etaWidth)             { fEtaWidth = etaWidth;    }
56 <      void                   SetPhiWidth(Double_t phiWidth)             { fPhiWidth = phiWidth;    }
57 <      void                   SetPreshowerEnergy(Double_t e)             { fPreshowerEnergy = e;    }
58 <      void                   SetRawEnergy(Double_t rawEnergy)           { fRawEnergy = rawEnergy;  }
59 <      void                   SetHcalDepth1Energy(Double_t x)            { fHcalDepth1Energy = x;   }
60 <      void                   SetHcalDepth2Energy(Double_t x)            { fHcalDepth2Energy = x;   }
61 <      void                   SetSeed(const BasicCluster *s)             { fSeedRef = s;            }
62 <      void                   SetXYZ(Double_t x, Double_t y, Double_t z) { fPoint.SetXYZ(x,y,z);    }
63 <      
64 <    protected:
65 <      Vect3C                  fPoint;               //centroid Position
66 <      Double32_t              fEnergy;              //[0,0,14]super cluster energy    
67 <      Double32_t              fEtaWidth;            //[0,0,14]width in Phi
68 <      Double32_t              fPreshowerEnergy;     //[0,0,14]energy in the preshower
69 <      Double32_t              fPhiWidth;            //[0,0,14]width in Phi
70 <      Double32_t              fRawEnergy;           //[0,0,14]super cluster raw energy
71 <      Double32_t              fHcalDepth1Energy;    //[0,0,14] hcal depth1 over ECAL energy
72 <      Double32_t              fHcalDepth2Energy;    //[0,0,14] hcal depth2 over ECAL energy
73 <      RefArray<BasicCluster>  fClusters;            //assigned basic clusters
74 <      Ref<BasicCluster>       fSeedRef;             //seed cluster
26 >  public:
27 >    SuperCluster() : fEnergy(0), fEtaWidth(0), fPreshowerEnergy(0),
28 >                     fPhiWidth(0), fRawEnergy(0),
29 >                     fEtaC(-99.), fEtaS(-99.), fEtaM(-99.),
30 >                     fPhiC(-99.), fPhiS(-99.), fPhiM(-99.),
31 >                     fXC(-99.), fXS(-99.), fXM(-99.), fXZ(-99.),
32 >                     fYC(-99.), fYS(-99.), fYM(-99.), fYZ(-99.) {}
33 >
34 >    void                   AddCluster(const BasicCluster *c)          { fClusters.Add(c);        }
35 >    void                   AddTower(const CaloTower *t)               { fCaloTowers.Add(t);      }
36 >    const BasicCluster    *Cluster(UInt_t i)       const { return fClusters.At(i);               }
37 >    UInt_t                 ClusterSize()           const { return fClusters.Entries();           }
38 >    UInt_t                 NClusters()             const { return fClusters.Entries();           }
39 >    UInt_t                 NHits()                 const;
40 >    Int_t                  Compare(const TObject *o) const;
41 >    Double_t               Energy()                const { return fEnergy;                       }
42 >    Double_t               Et()                    const;
43 >    Double_t               Eta()                   const { return fPoint.Eta();                  }
44 >    Double_t               AbsEta()                const { return TMath::Abs(Eta());             }
45 >    Double_t               EtaWidth()              const { return fEtaWidth;                     }
46 >    Bool_t                 HasSeed()               const { return fSeedRef.IsValid();            }
47 >    Bool_t                 HasTower(const CaloTower *t) const { return fCaloTowers.HasObject(t); }
48 >    Double_t               HcalDepth1Energy()      const { return fHcalDepth1Energy;             }
49 >    Double_t               HcalDepth2Energy()      const { return fHcalDepth2Energy;             }
50 >    Double_t               HadDepth1OverEm()       const { return fHcalDepth1Energy/fEnergy;     }
51 >    Double_t               HadDepth2OverEm()       const { return fHcalDepth2Energy/fEnergy;     }
52 >    Double_t               HadOverEm()             const { return (fHcalDepth1Energy+
53 >                                                                   fHcalDepth2Energy)/fEnergy;   }
54 >    Bool_t                 IsSortable()            const { return kTRUE;                         }
55 >    EObjType               ObjType()               const { return kSuperCluster;                 }
56 >    UInt_t                 NTowers()               const { return fCaloTowers.Entries();         }
57 >    Double_t               Phi()                   const { return fPoint.Phi();                  }
58 >    Double_t               PhiWidth()              const { return fPhiWidth;                     }
59 >    ThreeVectorC           Point()                 const { return fPoint.V();                    }
60 >    void                   Print(Option_t *opt="") const;
61 >    Double_t               PreshowerEnergy()       const { return fPreshowerEnergy;              }
62 >    Double_t               RawEnergy()             const { return fRawEnergy;                    }
63 >    Double_t               Rho()                   const { return fPoint.Rho();                  }
64 >    Double_t               R9()                    const { return fSeedRef.Obj()->E3x3()/fRawEnergy; }
65 >    const BasicCluster    *Seed()                  const { return fSeedRef.Obj();                }
66 >    const CaloTower       *Tower(UInt_t i)         const { return fCaloTowers.At(i);             }
67 >    Double_t               EtaC()                  const { return fEtaC;                         }
68 >    Double_t               EtaS()                  const { return fEtaS;                         }
69 >    Double_t               EtaM()                  const { return fEtaM;                         }
70 >    Double_t               PhiC()                  const { return fPhiC;                         }
71 >    Double_t               PhiS()                  const { return fPhiS;                         }
72 >    Double_t               PhiM()                  const { return fPhiM;                         }
73 >    Double_t               XC()                    const { return fXC;                           }
74 >    Double_t               XS()                    const { return fXS;                           }
75 >    Double_t               XM()                    const { return fXM;                           }
76 >    Double_t               XZ()                    const { return fXZ;                           }
77 >    Double_t               YC()                    const { return fYC;                           }
78 >    Double_t               YS()                    const { return fYS;                           }
79 >    Double_t               YM()                    const { return fYM;                           }
80 >    Double_t               YZ()                    const { return fYZ;                           }
81 >    void                   SetEnergy(Double_t energy)                 { fEnergy = energy;        }
82 >    void                   SetEtaWidth(Double_t etaWidth)             { fEtaWidth = etaWidth;    }
83 >    void                   SetPhiWidth(Double_t phiWidth)             { fPhiWidth = phiWidth;    }
84 >    void                   SetPreshowerEnergy(Double_t e)             { fPreshowerEnergy = e;    }
85 >    void                   SetRawEnergy(Double_t rawEnergy)           { fRawEnergy = rawEnergy;  }
86 >    void                   SetHcalDepth1Energy(Double_t x)            { fHcalDepth1Energy = x;   }
87 >    void                   SetHcalDepth2Energy(Double_t x)            { fHcalDepth2Energy = x;   }
88 >    void                   SetSeed(const BasicCluster *s)             { fSeedRef = s;            }
89 >    void                   SetXYZ(Double_t x, Double_t y, Double_t z) { fPoint.SetXYZ(x,y,z);    }
90 >    void                   SetEtaC(Double_t x)                        { fEtaC = x;               }
91 >    void                   SetEtaS(Double_t x)                        { fEtaS = x;               }
92 >    void                   SetEtaM(Double_t x)                        { fEtaM = x;               }
93 >    void                   SetPhiC(Double_t x)                        { fPhiC = x;               }
94 >    void                   SetPhiS(Double_t x)                        { fPhiS = x;               }
95 >    void                   SetPhiM(Double_t x)                        { fPhiM = x;               }
96 >    void                   SetXC(Double_t x)                          { fXC = x;                 }
97 >    void                   SetXS(Double_t x)                          { fXS = x;                 }
98 >    void                   SetXM(Double_t x)                          { fXM = x;                 }
99 >    void                   SetXZ(Double_t x)                          { fXZ = x;                 }
100 >    void                   SetYC(Double_t x)                          { fYC = x;                 }
101 >    void                   SetYS(Double_t x)                          { fYS = x;                 }
102 >    void                   SetYM(Double_t x)                          { fYM = x;                 }
103 >    void                   SetYZ(Double_t x)                          { fYZ = x;                 }
104 >
105 >    // Some structural tools
106 >    void                   Mark(UInt_t i=1)  const;
107 >
108 >  protected:
109 >    Vect3C                  fPoint;               //centroid Position
110 >    Double32_t              fEnergy;              //[0,0,14]super cluster energy
111 >    Double32_t              fEtaWidth;            //[0,0,14]width in Phi
112 >    Double32_t              fPreshowerEnergy;     //[0,0,14]energy in the preshower
113 >    Double32_t              fPhiWidth;            //[0,0,14]width in Phi
114 >    Double32_t              fRawEnergy;           //[0,0,14]super cluster raw energy
115 >    Double32_t              fHcalDepth1Energy;    //[0,0,14] hcal depth1 over ECAL energy
116 >    Double32_t              fHcalDepth2Energy;    //[0,0,14] hcal depth2 over ECAL energy
117 >    RefArray<BasicCluster>  fClusters;            //assigned basic clusters
118 >    Ref<BasicCluster>       fSeedRef;             //seed cluster
119 >    RefArray<CaloTower>     fCaloTowers;          //calo towers (matched by detid)
120 >    Double32_t              fEtaC;                //local coordinates
121 >    Double32_t              fEtaS;                //local coordinates
122 >    Double32_t              fEtaM;                //local coordinates
123 >    Double32_t              fPhiC;                //local coordinates
124 >    Double32_t              fPhiS;                //local coordinates
125 >    Double32_t              fPhiM;                //local coordinates
126 >    Double32_t              fXC;                  //local coordinates
127 >    Double32_t              fXS;                  //local coordinates
128 >    Double32_t              fXM;                  //local coordinates
129 >    Double32_t              fXZ;                  //local coordinates
130 >    Double32_t              fYC;                  //local coordinates
131 >    Double32_t              fYS;                  //local coordinates
132 >    Double32_t              fYM;                  //local coordinates
133 >    Double32_t              fYZ;                  //local coordinates
134  
135 <    ClassDef(SuperCluster, 2) // Super cluster class
135 >    ClassDef(SuperCluster, 4) // Super cluster class
136    };
137   }
138  
139   //--------------------------------------------------------------------------------------------------
140 + inline void mithep::SuperCluster::Mark(UInt_t ib) const
141 + {
142 +  // mark myself
143 +  mithep::DataObject::Mark(ib);
144 +  // mark my dependencies if they are there
145 +  if (fSeedRef.IsValid())
146 +    fSeedRef.Obj()->Mark(ib);
147 +  fClusters  .Mark(ib);
148 +  fCaloTowers.Mark(ib);
149 + }
150 +
151 +
152 + //--------------------------------------------------------------------------------------------------
153 + inline UInt_t mithep::SuperCluster::NHits() const
154 + {
155 +  // Return transverse energy.
156 +
157 +  UInt_t nhits = 0;
158 +  for (UInt_t i=0; i<fClusters.GetEntries(); ++i) {
159 +    nhits += fClusters.At(i)->NHits();
160 +  }
161 +  return nhits;
162 + }
163 +
164 +
165 + //--------------------------------------------------------------------------------------------------
166   inline Double_t mithep::SuperCluster::Et() const
167   {
168    // Return transverse energy.
# Line 87 | Line 173 | inline Double_t mithep::SuperCluster::Et
173   //--------------------------------------------------------------------------------------------------
174   inline Int_t mithep::SuperCluster::Compare(const TObject *o) const
175   {
176 <  // Default compare function for sorting according to transverse momentum.
177 <  // Returns -1 if this object is smaller than given object, 0 if objects are
176 >  // Default compare function for sorting according to transverse momentum.
177 >  // Returns -1 if this object is smaller than given object, 0 if objects are
178    // equal and 1 if this is larger than given object.
179  
180    const mithep::SuperCluster *s = dynamic_cast<const mithep::SuperCluster *>(o);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines