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.18 by bendavid, Fri Jun 25 15:12:58 2010 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  
22   namespace mithep
23   {
# Line 23 | Line 26 | namespace mithep
26      public:
27        SuperCluster() : fEnergy(0), fEtaWidth(0), fPreshowerEnergy(0),
28                         fPhiWidth(0), fRawEnergy(0) {}    
26      ~SuperCluster() {}
29  
30 <      const BasicCluster  *Cluster(UInt_t i)       const { return fClusters.At(i); }
31 <      UInt_t               ClusterSize()           const { return fClusters.GetEntries(); }
32 <      Double_t             Energy()                const { return fEnergy; }      
33 <      Double_t             Eta()                   const { return fPoint.Eta(); }
34 <      Double_t             EtaWidth()              const { return fEtaWidth; }
35 <      EObjType             ObjType()               const { return kSuperCluster; }      
36 <      Double_t             Phi()                   const { return fPoint.Phi(); }
37 <      Double_t             PhiWidth()              const { return fPhiWidth; }
38 <      void                 Print(Option_t *opt="") const;
39 <      Double_t             PreshowerEnergy()       const { return fPreshowerEnergy; }
40 <      Double_t             RawEnergy()             const { return fRawEnergy; }      
41 <      const BasicCluster  *Seed()                  const;      
42 <      Double_t             X()                     const { return fPoint.X(); }
43 <      Double_t             Y()                     const { return fPoint.Y(); }
44 <      Double_t             Z()                     const { return fPoint.Z(); }
45 <      void                 AddCluster(const BasicCluster *c)            { fClusters.Add(c);       }
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)              
52 <                             { fSeedRef = const_cast<BasicCluster*>(s); }
53 <      void                 SetXYZ(Double_t x, Double_t y, Double_t z)   { fPoint.SetXYZ(x,y,z);   }
30 >      void                   AddCluster(const BasicCluster *c)          { fClusters.Add(c);        }
31 >      void                   AddTower(const CaloTower *t)               { fCaloTowers.Add(t);      }
32 >      const BasicCluster    *Cluster(UInt_t i)       const { return fClusters.At(i);               }
33 >      UInt_t                 ClusterSize()           const { return fClusters.Entries();           }
34 >      Int_t                  Compare(const TObject *o) const;  
35 >      Double_t               Energy()                const { return fEnergy;                       }
36 >      Double_t               Et()                    const;
37 >      Double_t               Eta()                   const { return fPoint.Eta();                  }
38 >      Double_t               EtaWidth()              const { return fEtaWidth;                     }
39 >      Double_t               HcalDepth1Energy()      const { return fHcalDepth1Energy;             }
40 >      Double_t               HcalDepth2Energy()      const { return fHcalDepth2Energy;             }
41 >      Double_t               HadDepth1OverEm()       const { return fHcalDepth1Energy/fEnergy;     }
42 >      Double_t               HadDepth2OverEm()       const { return fHcalDepth2Energy/fEnergy;     }
43 >      Double_t               HadOverEm()             const { return (fHcalDepth1Energy+
44 >                                                                     fHcalDepth2Energy)/fEnergy;   }
45 >      Bool_t                 IsSortable()            const { return kTRUE;                         }
46 >      EObjType               ObjType()               const { return kSuperCluster;                 }
47 >      UInt_t                 NTowers()               const { return fCaloTowers.Entries();         }
48 >      Double_t               Phi()                   const { return fPoint.Phi();                  }
49 >      Double_t               PhiWidth()              const { return fPhiWidth;                     }
50 >      ThreeVectorC           Point()                 const { return fPoint.V();                    }
51 >      void                   Print(Option_t *opt="") const;
52 >      Double_t               PreshowerEnergy()       const { return fPreshowerEnergy;              }
53 >      Double_t               RawEnergy()             const { return fRawEnergy;                    }
54 >      Double_t               Rho()                   const { return fPoint.Rho();                  }
55 >      const BasicCluster    *Seed()                  const { return fSeedRef.Obj();                }
56 >      const CaloTower       *Tower(UInt_t i)         const { return fCaloTowers.At(i);             }
57 >      void                   SetEnergy(Double_t energy)                 { fEnergy = energy;        }
58 >      void                   SetEtaWidth(Double_t etaWidth)             { fEtaWidth = etaWidth;    }
59 >      void                   SetPhiWidth(Double_t phiWidth)             { fPhiWidth = phiWidth;    }
60 >      void                   SetPreshowerEnergy(Double_t e)             { fPreshowerEnergy = e;    }
61 >      void                   SetRawEnergy(Double_t rawEnergy)           { fRawEnergy = rawEnergy;  }
62 >      void                   SetHcalDepth1Energy(Double_t x)            { fHcalDepth1Energy = x;   }
63 >      void                   SetHcalDepth2Energy(Double_t x)            { fHcalDepth2Energy = x;   }
64 >      void                   SetSeed(const BasicCluster *s)             { fSeedRef = s;            }
65 >      void                   SetXYZ(Double_t x, Double_t y, Double_t z) { fPoint.SetXYZ(x,y,z);    }
66        
67      protected:
68 <      Double32_t                  fEnergy;          //super cluster energy    
69 <      Double32_t                  fEtaWidth;        //width in Phi
70 <      ThreeVector32               fPoint;           //centroid Position
71 <      Double32_t                  fPreshowerEnergy; //energy in the preshower
72 <      Double32_t                  fPhiWidth;        //width in Phi
73 <      Double32_t                  fRawEnergy;       //super cluster raw energy
74 <      RefArray<BasicCluster,1024> fClusters;        //assigned basic clusters
75 <      TRef                        fSeedRef;         //seed cluster
68 >      Vect3C                  fPoint;               //centroid Position
69 >      Double32_t              fEnergy;              //[0,0,14]super cluster energy    
70 >      Double32_t              fEtaWidth;            //[0,0,14]width in Phi
71 >      Double32_t              fPreshowerEnergy;     //[0,0,14]energy in the preshower
72 >      Double32_t              fPhiWidth;            //[0,0,14]width in Phi
73 >      Double32_t              fRawEnergy;           //[0,0,14]super cluster raw energy
74 >      Double32_t              fHcalDepth1Energy;    //[0,0,14] hcal depth1 over ECAL energy
75 >      Double32_t              fHcalDepth2Energy;    //[0,0,14] hcal depth2 over ECAL energy
76 >      RefArray<BasicCluster>  fClusters;            //assigned basic clusters
77 >      Ref<BasicCluster>       fSeedRef;             //seed cluster
78 >      RefArray<CaloTower>     fCaloTowers;          //calo towers (matched by detid)
79  
80 <    ClassDef(SuperCluster, 1) // Super cluster class
80 >    ClassDef(SuperCluster, 3) // Super cluster class
81    };
82   }
83  
84   //--------------------------------------------------------------------------------------------------
85 < inline const mithep::BasicCluster *mithep::SuperCluster::Seed() const
86 < {
87 <  // Return basic cluster seed.
85 > inline Double_t mithep::SuperCluster::Et() const
86 > {
87 >  // Return transverse energy.
88 >
89 >  return fEnergy*fPoint.Rho()/fPoint.V().R();
90 > }
91 >
92 > //--------------------------------------------------------------------------------------------------
93 > inline Int_t mithep::SuperCluster::Compare(const TObject *o) const
94 > {
95 >  // Default compare function for sorting according to transverse momentum.
96 >  // Returns -1 if this object is smaller than given object, 0 if objects are
97 >  // equal and 1 if this is larger than given object.
98 >
99 >  const mithep::SuperCluster *s = dynamic_cast<const mithep::SuperCluster *>(o);
100 >  if (!s)
101 >    return 1;
102  
103 <  return static_cast<const BasicCluster*>(fSeedRef.GetObject());
103 >  Double_t mye = Energy();
104 >  Double_t e   = s->Energy();
105 >  if (mye>e)
106 >    return -1;
107 >  else if (e>mye)
108 >    return +1;
109 >  return 0;
110   }
111   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines