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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines