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.12 by loizides, Wed Apr 8 10:24:33 2009 UTC vs.
Revision 1.27 by paus, Sat May 5 16:49:10 2012 UTC

# Line 5 | Line 5
5   //
6   // This class holds the super cluster information.
7   //
8 < // Authors: S.Xie
8 > // Authors: C.Paus, J.Bendavid, S.Xie
9   //--------------------------------------------------------------------------------------------------
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/PsCluster.h"
19 + #include "MitAna/DataTree/interface/CaloTower.h"
20   #include "MitAna/DataCont/interface/RefArray.h"
21   #include "MitAna/DataCont/interface/Ref.h"
22  
23 < namespace mithep
23 > namespace mithep
24   {
25    class SuperCluster : public DataObject
26    {
27 <    public:
28 <      SuperCluster() : fEnergy(0), fEtaWidth(0), fPreshowerEnergy(0),
29 <                       fPhiWidth(0), fRawEnergy(0) {}    
30 <
31 <      void                    AddCluster(const BasicCluster *c)      { fClusters.Add(c);           }
32 <      const BasicCluster     *Cluster(UInt_t i)       const { return fClusters.At(i);              }
33 <      UInt_t                  ClusterSize()           const { return fClusters.Entries();          }
34 <      Double_t                Energy()                const { return fEnergy;                      }
35 <      Double_t                Eta()                   const { return fPoint.Eta();                 }
36 <      Double_t                EtaWidth()              const { return fEtaWidth;                    }
37 <      EObjType                ObjType()               const { return kSuperCluster;                }
38 <      Double_t                Phi()                   const { return fPoint.Phi();                 }
39 <      Double_t                PhiWidth()              const { return fPhiWidth;                    }
40 <      ThreeVectorC            Point()                 const { return fPoint.V();                   }
41 <      void                    Print(Option_t *opt="") const;
42 <      Double_t                PreshowerEnergy()       const { return fPreshowerEnergy;             }
43 <      Double_t                RawEnergy()             const { return fRawEnergy;                   }
44 <      Double_t                Rho()                   const { return fPoint.Rho();                 }
45 <      const BasicCluster     *Seed()                  const { return fSeedRef.Obj();               }
46 <      void                    SetEnergy(Double_t energy)                 { fEnergy = energy;       }
47 <      void                    SetEtaWidth(Double_t etaWidth)             { fEtaWidth = etaWidth;   }
48 <      void                    SetPhiWidth(Double_t phiWidth)             { fPhiWidth = phiWidth;   }
49 <      void                    SetPreshowerEnergy(Double_t e)             { fPreshowerEnergy = e;   }
50 <      void                    SetRawEnergy(Double_t rawEnergy)           { fRawEnergy = rawEnergy; }
51 <      void                    SetSeed(const BasicCluster *s)             { fSeedRef = s;           }
52 <      void                    SetXYZ(Double_t x, Double_t y, Double_t z) { fPoint.SetXYZ(x,y,z);   }
53 <      
54 <    protected:
55 <      Vect3C                  fPoint;           //centroid Position
56 <      Double32_t              fEnergy;          //[0,0,14]super cluster energy    
57 <      Double32_t              fEtaWidth;        //[0,0,14]width in Phi
58 <      Double32_t              fPreshowerEnergy; //[0,0,14]energy in the preshower
59 <      Double32_t              fPhiWidth;        //[0,0,14]width in Phi
60 <      Double32_t              fRawEnergy;       //[0,0,14]super cluster raw energy
61 <      RefArray<BasicCluster>  fClusters;        //assigned basic clusters
62 <      Ref<BasicCluster>       fSeedRef;         //seed cluster
27 >  public:
28 >    SuperCluster() : fEnergy(0), fEtaWidth(0), fPreshowerEnergy(0),
29 >                     fPhiWidth(0), fRawEnergy(0),
30 >                     fEtaC(-99.), fEtaS(-99.), fEtaM(-99.),
31 >                     fPhiC(-99.), fPhiS(-99.), fPhiM(-99.),
32 >                     fXC(-99.), fXS(-99.), fXM(-99.), fXZ(-99.),
33 >                     fYC(-99.), fYS(-99.), fYM(-99.), fYZ(-99.),
34 >                     fPreshowerEnergyPlane1(0.), fPreshowerEnergyPlane2(0.),
35 >                     fPsEffWidthSigmaXX(-99.), fPsEffWidthSigmaYY(-99.) {}
36 >
37 >    void                   AddCluster(const BasicCluster *c)          { fClusters.Add(c);        }
38 >    void                   AddPsClust(const PsCluster *c)             { fPsClusts.Add(c);        }
39 >    void                   AddTower(const CaloTower *t)               { fCaloTowers.Add(t);      }
40 >    const BasicCluster    *Cluster(UInt_t i)       const { return fClusters.At(i);               }
41 >    UInt_t                 ClusterSize()           const { return fClusters.Entries();           }
42 >    UInt_t                 NClusters()             const { return fClusters.Entries();           }
43 >    UInt_t                 NHits()                 const;
44 >    const PsCluster       *PsClust(UInt_t i)       const { return fPsClusts.At(i);               }    
45 >    UInt_t                 NPsClusts()             const { return fPsClusts.Entries();           }    
46 >    Int_t                  Compare(const TObject *o) const;
47 >    Double_t               Energy()                const { return fEnergy;                       }
48 >    Double_t               Et()                    const;
49 >    Double_t               Eta()                   const { return fPoint.Eta();                  }
50 >    Double_t               AbsEta()                const { return TMath::Abs(Eta());             }
51 >    Double_t               EtaWidth()              const { return fEtaWidth;                     }
52 >    Bool_t                 HasSeed()               const { return fSeedRef.IsValid();            }
53 >    Bool_t                 HasTower(const CaloTower *t) const { return fCaloTowers.HasObject(t); }
54 >    Double_t               HcalDepth1Energy()      const { return fHcalDepth1Energy;             }
55 >    Double_t               HcalDepth2Energy()      const { return fHcalDepth2Energy;             }
56 >    Double_t               HadDepth1OverEm()       const { return fHcalDepth1Energy/fEnergy;     }
57 >    Double_t               HadDepth2OverEm()       const { return fHcalDepth2Energy/fEnergy;     }
58 >    Double_t               HadOverEm()             const { return (fHcalDepth1Energy+
59 >                                                                   fHcalDepth2Energy)/fEnergy;   }
60 >    Bool_t                 IsSortable()            const { return kTRUE;                         }
61 >    EObjType               ObjType()               const { return kSuperCluster;                 }
62 >    UInt_t                 NTowers()               const { return fCaloTowers.Entries();         }
63 >    Double_t               Phi()                   const { return fPoint.Phi();                  }
64 >    Double_t               PhiWidth()              const { return fPhiWidth;                     }
65 >    ThreeVectorC           Point()                 const { return fPoint.V();                    }
66 >    void                   Print(Option_t *opt="") const;
67 >    Double_t               PreshowerEnergy()       const { return fPreshowerEnergy;              }
68 >    Double_t               PreshowerEnergyPlane1() const { return fPreshowerEnergyPlane1;        }
69 >    Double_t               PreshowerEnergyPlane2() const { return fPreshowerEnergyPlane2;        }
70 >    Double_t               RawEnergy()             const { return fRawEnergy;                    }
71 >    Double_t               Rho()                   const { return fPoint.Rho();                  }
72 >    Double_t               R9()                    const { return fSeedRef.Obj()->E3x3()/fRawEnergy; }
73 >    const BasicCluster    *Seed()                  const { return fSeedRef.Obj();                }
74 >    const CaloTower       *Tower(UInt_t i)         const { return fCaloTowers.At(i);             }
75 >    Double_t               EtaC()                  const { return fEtaC;                         }
76 >    Double_t               EtaS()                  const { return fEtaS;                         }
77 >    Double_t               EtaM()                  const { return fEtaM;                         }
78 >    Double_t               PhiC()                  const { return fPhiC;                         }
79 >    Double_t               PhiS()                  const { return fPhiS;                         }
80 >    Double_t               PhiM()                  const { return fPhiM;                         }
81 >    Double_t               XC()                    const { return fXC;                           }
82 >    Double_t               XS()                    const { return fXS;                           }
83 >    Double_t               XM()                    const { return fXM;                           }
84 >    Double_t               XZ()                    const { return fXZ;                           }
85 >    Double_t               YC()                    const { return fYC;                           }
86 >    Double_t               YS()                    const { return fYS;                           }
87 >    Double_t               YM()                    const { return fYM;                           }
88 >    Double_t               YZ()                    const { return fYZ;                           }
89 >    Double_t               Time()                  const { return fTime;                         }
90 >    Double_t               SeedTime()              const { return fSeedTime;                     }
91 >    Double_t               PsEffWidthSigmaXX()     const { return fPsEffWidthSigmaXX;            }
92 >    Double_t               PsEffWidthSigmaYY()     const { return fPsEffWidthSigmaYY;            }
93 >
94 >    void                   SetEnergy(Double_t energy)                 { fEnergy = energy;        }
95 >    void                   SetEtaWidth(Double_t etaWidth)             { fEtaWidth = etaWidth;    }
96 >    void                   SetPhiWidth(Double_t phiWidth)             { fPhiWidth = phiWidth;    }
97 >    void                   SetPreshowerEnergy(Double_t e)             { fPreshowerEnergy = e;    }
98 >    void                   SetPreshowerEnergyPlane1(Double_t e)       { fPreshowerEnergyPlane1 = e; }
99 >    void                   SetPreshowerEnergyPlane2(Double_t e)       { fPreshowerEnergyPlane2 = e; }
100 >    void                   SetRawEnergy(Double_t rawEnergy)           { fRawEnergy = rawEnergy;  }
101 >    void                   SetHcalDepth1Energy(Double_t x)            { fHcalDepth1Energy = x;   }
102 >    void                   SetHcalDepth2Energy(Double_t x)            { fHcalDepth2Energy = x;   }
103 >    void                   SetSeed(const BasicCluster *s)             { fSeedRef = s;            }
104 >    void                   SetXYZ(Double_t x, Double_t y, Double_t z) { fPoint.SetXYZ(x,y,z);    }
105 >    void                   SetEtaC(Double_t x)                        { fEtaC = x;               }
106 >    void                   SetEtaS(Double_t x)                        { fEtaS = x;               }
107 >    void                   SetEtaM(Double_t x)                        { fEtaM = x;               }
108 >    void                   SetPhiC(Double_t x)                        { fPhiC = x;               }
109 >    void                   SetPhiS(Double_t x)                        { fPhiS = x;               }
110 >    void                   SetPhiM(Double_t x)                        { fPhiM = x;               }
111 >    void                   SetXC(Double_t x)                          { fXC = x;                 }
112 >    void                   SetXS(Double_t x)                          { fXS = x;                 }
113 >    void                   SetXM(Double_t x)                          { fXM = x;                 }
114 >    void                   SetXZ(Double_t x)                          { fXZ = x;                 }
115 >    void                   SetYC(Double_t x)                          { fYC = x;                 }
116 >    void                   SetYS(Double_t x)                          { fYS = x;                 }
117 >    void                   SetYM(Double_t x)                          { fYM = x;                 }
118 >    void                   SetYZ(Double_t x)                          { fYZ = x;                 }
119 >    void                   SetTime(Double_t x)                        { fTime = x;               }
120 >    void                   SetSeedTime(Double_t x)                    { fSeedTime = x;           }
121 >    void                   SetPsEffWidthSigmaXX(Double_t x)           { fPsEffWidthSigmaXX = x;  }
122 >    void                   SetPsEffWidthSigmaYY(Double_t x)           { fPsEffWidthSigmaYY = x;  }
123 >
124 >    // Some structural tools
125 >    void                   Mark(UInt_t i=1)  const;
126  
127 <    ClassDef(SuperCluster, 1) // Super cluster class
127 >  protected:
128 >    Vect3C                  fPoint;               //centroid Position
129 >    Double32_t              fEnergy;              //[0,0,14]super cluster energy
130 >    Double32_t              fEtaWidth;            //[0,0,14]width in Phi
131 >    Double32_t              fPreshowerEnergy;     //[0,0,14]energy in the preshower
132 >    Double32_t              fPhiWidth;            //[0,0,14]width in Phi
133 >    Double32_t              fRawEnergy;           //[0,0,14]super cluster raw energy
134 >    Double32_t              fHcalDepth1Energy;    //[0,0,14] hcal depth1 over ECAL energy
135 >    Double32_t              fHcalDepth2Energy;    //[0,0,14] hcal depth2 over ECAL energy
136 >    RefArray<BasicCluster>  fClusters;            //assigned basic clusters
137 >    Ref<BasicCluster>       fSeedRef;             //seed cluster
138 >    RefArray<CaloTower>     fCaloTowers;          //calo towers (matched by detid)
139 >    Double32_t              fEtaC;                //local coordinates
140 >    Double32_t              fEtaS;                //local coordinates
141 >    Double32_t              fEtaM;                //local coordinates
142 >    Double32_t              fPhiC;                //local coordinates
143 >    Double32_t              fPhiS;                //local coordinates
144 >    Double32_t              fPhiM;                //local coordinates
145 >    Double32_t              fXC;                  //local coordinates
146 >    Double32_t              fXS;                  //local coordinates
147 >    Double32_t              fXM;                  //local coordinates
148 >    Double32_t              fXZ;                  //local coordinates
149 >    Double32_t              fYC;                  //local coordinates
150 >    Double32_t              fYS;                  //local coordinates
151 >    Double32_t              fYM;                  //local coordinates
152 >    Double32_t              fYZ;                  //local coordinates
153 >    Double32_t              fTime;                //ecal timing (weighted average)
154 >    Double32_t              fSeedTime;            //ecal timing (seed crystal)
155 >
156 >    Double32_t              fPreshowerEnergyPlane1; //local coordinates
157 >    Double32_t              fPreshowerEnergyPlane2; //local coordinates
158 >    Double32_t              fPsEffWidthSigmaXX;       //preshower cluster width in x plane
159 >    Double32_t              fPsEffWidthSigmaYY;       //preshower cluster width in y plane
160 >    RefArray<PsCluster>     fPsClusts;              //assigned preshower clusters
161 >
162 >    ClassDef(SuperCluster, 5) // Super cluster class
163    };
164   }
165 +
166 + //--------------------------------------------------------------------------------------------------
167 + inline void mithep::SuperCluster::Mark(UInt_t ib) const
168 + {
169 +  // mark myself
170 +  mithep::DataObject::Mark(ib);
171 +  // mark my dependencies if they are there
172 +  if (fSeedRef.IsValid())
173 +    fSeedRef.Obj()->Mark(ib);
174 +  fClusters  .Mark(ib);
175 +  fPsClusts  .Mark(ib);
176 +  fCaloTowers.Mark(ib);
177 + }
178 +
179 +
180 + //--------------------------------------------------------------------------------------------------
181 + inline UInt_t mithep::SuperCluster::NHits() const
182 + {
183 +  // Return transverse energy.
184 +
185 +  UInt_t nhits = 0;
186 +  for (UInt_t i=0; i<fClusters.GetEntries(); ++i) {
187 +    nhits += fClusters.At(i)->NHits();
188 +  }
189 +  return nhits;
190 + }
191 +
192 +
193 + //--------------------------------------------------------------------------------------------------
194 + inline Double_t mithep::SuperCluster::Et() const
195 + {
196 +  // Return transverse energy.
197 +
198 +  return fEnergy*fPoint.Rho()/fPoint.V().R();
199 + }
200 +
201 + //--------------------------------------------------------------------------------------------------
202 + inline Int_t mithep::SuperCluster::Compare(const TObject *o) const
203 + {
204 +  // Default compare function for sorting according to transverse momentum.
205 +  // Returns -1 if this object is smaller than given object, 0 if objects are
206 +  // equal and 1 if this is larger than given object.
207 +
208 +  const mithep::SuperCluster *s = dynamic_cast<const mithep::SuperCluster *>(o);
209 +  if (!s)
210 +    return 1;
211 +
212 +  Double_t mye = Energy();
213 +  Double_t e   = s->Energy();
214 +  if (mye>e)
215 +    return -1;
216 +  else if (e>mye)
217 +    return +1;
218 +  return 0;
219 + }
220   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines