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

Comparing UserCode/Morgan/interface/TRootEvent.h (file contents):
Revision 1.9 by lethuill, Mon Jan 12 16:00:37 2009 UTC vs.
Revision 1.11 by lethuill, Wed Jun 10 11:17:05 2009 UTC

# Line 10 | Line 10
10   #include "Rtypes.h"
11   #include "TObject.h"
12   #include "TVector3.h"
13 + #include "TRef.h"
14 +
15 + #include "../interface/TRootVertex.h"
16  
17   using namespace std;
18  
19   class TRootEvent : public TObject
20   {
18        
19 public:
20        
21        TRootEvent() :
22                nb_(0)
23                ,eventId_(-1)
24                ,runId_(-1)
25                ,passGlobalL1_(false)
26                ,passGlobalHLT_(false)
27                ,trigHLT_(0)
28                ,csa07id_(-1)
29                ,csa07weight_(-1.)
30                ,csa07process_()
31                ,nBasicClusters_()
32                ,nSuperClusters_()
33                ,primaryVertex_(0)
34                ,idParton1_(-1)
35                ,xParton1_(-1.)
36                ,idParton2_(-1)
37                ,xParton2_(-1.)
38                ,factorizationScale_(-1.)
39                {;}
40
41        ~TRootEvent() {;}
42
43        // Event number
44        Int_t nb() const { return nb_; }
45        Int_t eventId() const { return eventId_; }
46        Int_t runId() const { return runId_; }
47
48        // Trigger decision
49        Int_t passGlobalL1() const { return passGlobalL1_; }
50        Bool_t passGlobalHLT() const { return passGlobalHLT_; }
51        unsigned int nHLTPaths() const { return trigHLT_.size(); }
52        std::vector<Bool_t> trigHLT() const { return trigHLT_; }
53        Bool_t trigHLT(unsigned int i) const
54        {
55                 if (trigHLT_.size()>i)
56                 {
57                        return trigHLT_.at(i);
58                 }
59                 else
60                 {
61                         cout << "HLT path " << i << " not found" << endl;
62                         return false;
63                 }
64        }
65
66        // CSA07 Process Id and Event Weight
67        Int_t csa07id() const { return csa07id_; }
68        Float_t csa07weight() const { return csa07weight_; }
69        TString csa07process() const { return csa07process_; }
70        
71        // Nb of primary vertices
72        unsigned nPrimaryVertices() const { return primaryVertex_.size(); }
73        
74        // Nb of BasicClusters of a given type
75        Int_t nBasicClusters(Int_t type)
76        {
77                map<Int_t,Int_t>::iterator it=nBasicClusters_.find(type);
78                return ( it ==nBasicClusters_.end() ? 0 : (*it).second );
79        }
80        
81        // Nb of SuperClusters of a given type
82        Int_t nSuperClusters(Int_t type)
83        {
84                map<Int_t,Int_t>::iterator it=nSuperClusters_.find(type);
85                return ( it ==nSuperClusters_.end() ? 0 : (*it).second );
86        }
87        
88        
89        // Primary Vertex as 3-vector
90        TVector3 primaryVertex() const { return (primaryVertex_.size()>0 ?  primaryVertex_.at(0) : TVector3(0.,0.,0.) ); }
91        TVector3 primaryVertex(unsigned i) const { return (primaryVertex_.size()>i ?  primaryVertex_.at(i) : TVector3(0.,0.,0.) ); }
92        // x, y, z of Primary Vertex
93        Double_t primaryVertex_x() const { return (primaryVertex_.size()>0 ?  primaryVertex_.at(0).x() : 0. ); }
94        Double_t primaryVertex_y() const { return (primaryVertex_.size()>0 ?  primaryVertex_.at(0).y() : 0. ); }
95        Double_t primaryVertex_z() const { return (primaryVertex_.size()>0 ?  primaryVertex_.at(0).z() : 0. ); }
96        Double_t primaryVertex_x(unsigned i) const { return (primaryVertex_.size()>i ?  primaryVertex_.at(i).x() : 0. ); }
97        Double_t primaryVertex_y(unsigned i) const { return (primaryVertex_.size()>i ?  primaryVertex_.at(i).x() : 0. ); }
98        Double_t primaryVertex_z(unsigned i) const { return (primaryVertex_.size()>i ?  primaryVertex_.at(i).x() : 0. ); }
99        
100        // PDF infos
101        // flavour first incoming parton
102        Int_t idParton1() const { return idParton1_; }
103        // energy fraction carried by first incoming parton
104        Float_t xParton1() const { return xParton1_; }
105        // flavour first incoming parton
106        Int_t idParton2() const { return idParton2_; }
107        // energy fraction carried by first incoming parton
108        Float_t xParton2() const { return xParton2_; }
109        // Factorization Scale Q
110        Float_t factorizationScale() const { return factorizationScale_; }
111
112
113        
114        void setNb(Int_t nb) { nb_ = nb; }
115        void setEventId(Int_t eventId) { eventId_ = eventId; }
116        void setRunId(Int_t runId) { runId_ = runId; }
117        void setGlobalL1(Int_t passGlobalL1) { passGlobalL1_ = passGlobalL1; }
118        void setGlobalHLT(Bool_t passGlobalHLT) { passGlobalHLT_ = passGlobalHLT; }
119        void setTrigHLT(std::vector<Bool_t> trigHLT)
120        {
121                trigHLT_.resize(trigHLT.size());
122                for (unsigned int i=0; i!=trigHLT.size(); ++i) trigHLT_[i]=trigHLT[i];
123        }
124
125        void setCsa07id(Int_t csa07id) { csa07id_=csa07id; }
126        void setCsa07weight(Float_t csa07weight)  { csa07weight_=csa07weight; }
127        void setCsa07process(TString csa07process)  { csa07process_=csa07process; }
128        void setCsa07process(char* csa07process)  { csa07process_=csa07process; }
129        
130        void setNBasicClusters(Int_t type,Int_t nBC) { nBasicClusters_[type]=nBC; }
131        void setNSuperClusters(Int_t type,Int_t nSC) { nSuperClusters_[type]=nSC; }
132                
133        void addPrimaryVertex(TVector3 vertex) {  primaryVertex_.push_back(vertex); }
134        void clearPrimaryVertex(TVector3 vertex) {  primaryVertex_.clear(); }
135
136        void setIdParton1(Int_t idParton1) { idParton1_=idParton1; }
137        void setXParton1(Float_t xParton1) { xParton1_=xParton1; }
138        void setIdParton2(Int_t idParton2) { idParton2_=idParton2; }
139        void setXParton2(Float_t xParton2) { xParton2_=xParton2; }
140        void setFactorizationScale(Float_t factorizationScale) { factorizationScale_=factorizationScale; }
141
142        /*
143        // FIXME
144        friend std::ostream& operator<< (std::ostream& stream, const TRootEvent& event) {
145                stream << "Event #"<< event.nb() <<"  L1="<< event.trigL1() <<"  HLT="<< event.trigHLT()
146                        << "  Primary vertex x=" << event.primaryVertex_x() << "  y=" << event.primaryVertex_y() << "  z=" << event.primaryVertex_z();
147                return stream;
148        };
149        */
150        
151 private:
152        
153        Int_t nb_;
154        Int_t eventId_;
155        Int_t runId_;
156
157        // Trigger Infos
158        Bool_t passGlobalL1_;
159        Bool_t passGlobalHLT_;
160        std::vector<Bool_t> trigHLT_;
161
162        // CSA07 Process ID and Weight
163        Int_t csa07id_;
164        Float_t csa07weight_;
165        TString csa07process_;
166        
167        map<Int_t,Int_t> nBasicClusters_;
168        map<Int_t,Int_t> nSuperClusters_;
169        std::vector<TVector3> primaryVertex_;
170
171        // PDF infos
172        Int_t idParton1_;
173        Float_t xParton1_;
174        Int_t idParton2_;
175        Float_t xParton2_;
176        Float_t factorizationScale_;
21  
22 <        ClassDef (TRootEvent,1);
22 >   public:
23 >
24 >      TRootEvent() :
25 >      nb_(0)
26 >      ,eventId_(-1)
27 >      ,runId_(-1)
28 >      ,passGlobalL1_(false)
29 >      ,passGlobalHLT_(false)
30 >      ,trigHLT_(0)
31 >      ,csa07id_(-1)
32 >      ,csa07weight_(-1.)
33 >      ,csa07process_()
34 >      ,nBasicClusters_()
35 >      ,nSuperClusters_()
36 >      ,primaryVertexIndex_(-1)
37 >      ,primaryVertex_(0)
38 >      ,idParton1_(-1)
39 >      ,xParton1_(-1.)
40 >      ,idParton2_(-1)
41 >      ,xParton2_(-1.)
42 >      ,factorizationScale_(-1.)
43 >      {;}
44 >
45 >      ~TRootEvent() {;}
46 >
47 >      // Event number
48 >      Int_t nb() const { return nb_; }
49 >      Int_t eventId() const { return eventId_; }
50 >      Int_t runId() const { return runId_; }
51 >
52 >      // Trigger decision
53 >      Int_t passGlobalL1() const { return passGlobalL1_; }
54 >      Bool_t passGlobalHLT() const { return passGlobalHLT_; }
55 >      unsigned int nHLTPaths() const { return trigHLT_.size(); }
56 >      std::vector<Bool_t> trigHLT() const { return trigHLT_; }
57 >      Bool_t trigHLT(unsigned int i) const
58 >      {
59 >         if (trigHLT_.size()>i)
60 >         {
61 >            return trigHLT_.at(i);
62 >         }
63 >         else
64 >         {
65 >            cout << "HLT path " << i << " not found" << endl;
66 >            return false;
67 >         }
68 >      }
69 >
70 >      // CSA07 Process Id and Event Weight
71 >      Int_t csa07id() const { return csa07id_; }
72 >      Float_t csa07weight() const { return csa07weight_; }
73 >      TString csa07process() const { return csa07process_; }
74 >
75 >      // Nb of BasicClusters of a given type
76 >      Int_t nBasicClusters(Int_t type)
77 >      {
78 >         map<Int_t,Int_t>::iterator it=nBasicClusters_.find(type);
79 >         return ( it ==nBasicClusters_.end() ? 0 : (*it).second );
80 >      }
81 >
82 >      // Nb of SuperClusters of a given type
83 >      Int_t nSuperClusters(Int_t type)
84 >      {
85 >         map<Int_t,Int_t>::iterator it=nSuperClusters_.find(type);
86 >         return ( it ==nSuperClusters_.end() ? 0 : (*it).second );
87 >      }
88 >
89 >
90 >      // Selected Primary Vertex
91 >      Int_t primaryVertexIndex() const { return primaryVertexIndex_; }
92 >      TRootVertex* primaryVertex() const
93 >      {
94 >         if ( primaryVertex_==0)
95 >         {
96 >            cout << "   ********** Error in TRootEvent::primaryVertex() - No primary vertex selected **********" << endl;
97 >            return 0;
98 >         }
99 >         else
100 >         {
101 >            return (TRootVertex*) primaryVertex_.GetObject();
102 >         }
103 >      }
104 >
105 >
106 >      // PDF infos
107 >      // flavour first incoming parton
108 >      Int_t idParton1() const { return idParton1_; }
109 >      // energy fraction carried by first incoming parton
110 >      Float_t xParton1() const { return xParton1_; }
111 >      // flavour first incoming parton
112 >      Int_t idParton2() const { return idParton2_; }
113 >      // energy fraction carried by first incoming parton
114 >      Float_t xParton2() const { return xParton2_; }
115 >      // Factorization Scale Q
116 >      Float_t factorizationScale() const { return factorizationScale_; }
117 >
118 >
119 >
120 >      void setNb(Int_t nb) { nb_ = nb; }
121 >      void setEventId(Int_t eventId) { eventId_ = eventId; }
122 >      void setRunId(Int_t runId) { runId_ = runId; }
123 >      void setGlobalL1(Int_t passGlobalL1) { passGlobalL1_ = passGlobalL1; }
124 >      void setGlobalHLT(Bool_t passGlobalHLT) { passGlobalHLT_ = passGlobalHLT; }
125 >      void setTrigHLT(std::vector<Bool_t> trigHLT)
126 >      {
127 >         trigHLT_.resize(trigHLT.size());
128 >         for (unsigned int i=0; i!=trigHLT.size(); ++i) trigHLT_[i]=trigHLT[i];
129 >      }
130 >
131 >      void setCsa07id(Int_t csa07id) { csa07id_=csa07id; }
132 >      void setCsa07weight(Float_t csa07weight)  { csa07weight_=csa07weight; }
133 >      void setCsa07process(TString csa07process)  { csa07process_=csa07process; }
134 >      void setCsa07process(char* csa07process)  { csa07process_=csa07process; }
135 >
136 >      void setNBasicClusters(Int_t type,Int_t nBC) { nBasicClusters_[type]=nBC; }
137 >      void setNSuperClusters(Int_t type,Int_t nSC) { nSuperClusters_[type]=nSC; }
138 >
139 >      void setPrimaryVertexIndex(Int_t primaryVertexIndex) { primaryVertexIndex_=primaryVertexIndex; }
140 >      void setPrimaryVertex(TRootVertex* primaryVertex) { primaryVertex_ = primaryVertex; }
141 >
142 >      void setIdParton1(Int_t idParton1) { idParton1_=idParton1; }
143 >      void setXParton1(Float_t xParton1) { xParton1_=xParton1; }
144 >      void setIdParton2(Int_t idParton2) { idParton2_=idParton2; }
145 >      void setXParton2(Float_t xParton2) { xParton2_=xParton2; }
146 >      void setFactorizationScale(Float_t factorizationScale) { factorizationScale_=factorizationScale; }
147 >
148 >      /*
149 >      // FIXME
150 >      friend std::ostream& operator<< (std::ostream& stream, const TRootEvent& event) {
151 >      stream << "Event #"<< event.nb() <<"  L1="<< event.trigL1() <<"  HLT="<< event.trigHLT()
152 >      << "  Primary vertex x=" << event.primaryVertex_x() << "  y=" << event.primaryVertex_y() << "  z=" << event.primaryVertex_z();
153 >      return stream;
154 >      };
155 >      */
156 >
157 >
158 >   private:
159 >
160 >      Int_t nb_;
161 >      Int_t eventId_;
162 >      Int_t runId_;
163 >
164 >      // Trigger Infos
165 >      Bool_t passGlobalL1_;
166 >      Bool_t passGlobalHLT_;
167 >      std::vector<Bool_t> trigHLT_;
168 >
169 >      // CSA07 Process ID and Weight
170 >      Int_t csa07id_;
171 >      Float_t csa07weight_;
172 >      TString csa07process_;
173 >
174 >      map<Int_t,Int_t> nBasicClusters_;
175 >      map<Int_t,Int_t> nSuperClusters_;
176 >
177 >      // Selected Primary vertex (by VertexAnalyzer::SelectPrimary)
178 >      Int_t primaryVertexIndex_; // Index in vertices TClonesArray of the selected primary vertex
179 >      TRef primaryVertex_; // Reference to the TRootVertex of the selected primary vertex
180 >
181 >      // PDF infos
182 >      Int_t idParton1_;
183 >      Float_t xParton1_;
184 >      Int_t idParton2_;
185 >      Float_t xParton2_;
186 >      Float_t factorizationScale_;
187 >
188 >      ClassDef (TRootEvent,2);
189 >
190   };
191  
192   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines