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.8 by bendavid, Tue Feb 17 15:09:45 2009 UTC vs.
Revision 1.24 by bendavid, Sun Oct 9 23:28:47 2011 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines