ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/Morgan/interface/TRootEvent.h
Revision: 1.4
Committed: Wed Oct 1 16:05:09 2008 UTC (16 years, 7 months ago) by lethuill
Content type: text/plain
Branch: MAIN
CVS Tags: cmssw_1_6_12
Changes since 1.3: +1 -1 lines
Log Message:
bug in setGlobalHLT

File Contents

# User Rev Content
1 mlethuil 1.1 #ifndef TRootEvent_h
2     #define TRootEvent_h
3    
4     #include <string>
5     #include <iostream>
6    
7     #include "Rtypes.h"
8     #include "TObject.h"
9     #include "TVector3.h"
10    
11     using namespace std;
12    
13     class TRootEvent : public TObject
14     {
15    
16     public:
17 mlethuil 1.2
18     TRootEvent() :
19     nb_(0)
20     ,passGlobalL1_(false)
21     ,passGlobalHLT_(false)
22     ,trigHLT_(0)
23 mlethuil 1.3 ,csa07id_(0)
24     ,csa07weight_(0.)
25     ,csa07process_()
26 mlethuil 1.2 ,nBasicClusters_()
27     ,nSuperClusters_()
28     ,primaryVertex_(0)
29     ,metCalo_()
30     {;}
31 mlethuil 1.3
32 mlethuil 1.1 ~TRootEvent() {;}
33    
34     // Event number
35 mlethuil 1.2 Int_t nb() const { return nb_; }
36 mlethuil 1.1
37     // Trigger decision
38 mlethuil 1.2 Int_t passGlobalL1() const { return passGlobalL1_; }
39     Bool_t passGlobalHLT() const { return passGlobalHLT_; }
40     unsigned int nHLTPaths() const { return trigHLT_.size(); }
41     std::vector<Bool_t> trigHLT() const { return trigHLT_; }
42     Bool_t trigHLT(unsigned int i) const
43     {
44     if (trigHLT_.size()>i)
45     {
46     return trigHLT_.at(i);
47     }
48     else
49     {
50     cout << "HLT path " << i << " not found" << endl;
51     return false;
52     }
53     }
54 mlethuil 1.1
55 mlethuil 1.3 // CSA07 Process Id and Event Weight
56     Int_t csa07id() const { return csa07id_; }
57     Float_t csa07weight() const { return csa07weight_; }
58     TString csa07process() const { return csa07process_; }
59    
60 mlethuil 1.1 // Nb of primary vertices
61 mlethuil 1.2 unsigned nPrimaryVertices() const { return primaryVertex_.size(); }
62 mlethuil 1.1
63     // Nb of BasicClusters of a given type
64     Int_t nBasicClusters(Int_t type)
65     {
66     map<Int_t,Int_t>::iterator it=nBasicClusters_.find(type);
67     return ( it ==nBasicClusters_.end() ? 0 : (*it).second );
68     }
69    
70     // Nb of SuperClusters of a given type
71     Int_t nSuperClusters(Int_t type)
72     {
73     map<Int_t,Int_t>::iterator it=nSuperClusters_.find(type);
74     return ( it ==nSuperClusters_.end() ? 0 : (*it).second );
75     }
76    
77    
78     // Primary Vertex as 3-vector
79 mlethuil 1.2 TVector3 primaryVertex() const { return (primaryVertex_.size()>0 ? primaryVertex_.at(0) : TVector3(0.,0.,0.) ); }
80     TVector3 primaryVertex(unsigned i) const { return (primaryVertex_.size()>i ? primaryVertex_.at(i) : TVector3(0.,0.,0.) ); }
81 mlethuil 1.1 // x, y, z of Primary Vertex
82 mlethuil 1.2 Double_t primaryVertex_x() const { return (primaryVertex_.size()>0 ? primaryVertex_.at(0).x() : 0. ); }
83     Double_t primaryVertex_y() const { return (primaryVertex_.size()>0 ? primaryVertex_.at(0).y() : 0. ); }
84     Double_t primaryVertex_z() const { return (primaryVertex_.size()>0 ? primaryVertex_.at(0).z() : 0. ); }
85     Double_t primaryVertex_x(unsigned i) const { return (primaryVertex_.size()>i ? primaryVertex_.at(i).x() : 0. ); }
86     Double_t primaryVertex_y(unsigned i) const { return (primaryVertex_.size()>i ? primaryVertex_.at(i).x() : 0. ); }
87     Double_t primaryVertex_z(unsigned i) const { return (primaryVertex_.size()>i ? primaryVertex_.at(i).x() : 0. ); }
88 mlethuil 1.1
89     // Missing Et as 3-vector
90 mlethuil 1.2 TVector3 metCaloVect() const { return metCalo_; }
91 mlethuil 1.1 // Missing Et magnitude
92 mlethuil 1.2 Double_t metCalo() const { return sqrt(metCalo_.Perp2()); }
93 mlethuil 1.1
94    
95     void setNb(Int_t nb) { nb_ = nb; }
96 mlethuil 1.2 void setGlobalL1(Int_t passGlobalL1) { passGlobalL1_ = passGlobalL1; }
97 lethuill 1.4 void setGlobalHLT(Bool_t passGlobalHLT) { passGlobalHLT_ = passGlobalHLT; }
98 mlethuil 1.2 void setTrigHLT(std::vector<Bool_t> trigHLT)
99     {
100     trigHLT_.resize(trigHLT.size());
101     for (unsigned int i=0; i!=trigHLT.size(); ++i) trigHLT_[i]=trigHLT[i];
102     }
103    
104 mlethuil 1.3 void setCsa07id(Int_t csa07id) { csa07id_=csa07id; }
105     void setCsa07weight(Float_t csa07weight) { csa07weight_=csa07weight; }
106     void setCsa07process(TString csa07process) { csa07process_=csa07process; }
107     void setCsa07process(char* csa07process) { csa07process_=csa07process; }
108 mlethuil 1.1
109     void setNBasicClusters(Int_t type,Int_t nBC) { nBasicClusters_[type]=nBC; }
110     void setNSuperClusters(Int_t type,Int_t nSC) { nSuperClusters_[type]=nSC; }
111    
112     void addPrimaryVertex(TVector3 vertex) { primaryVertex_.push_back(vertex); }
113     void clearPrimaryVertex(TVector3 vertex) { primaryVertex_.clear(); }
114     void setMetCaloVect(TVector3 metCaloVect) { metCalo_ = metCaloVect; }
115    
116     /*
117     friend std::ostream& operator<< (std::ostream& stream, const TRootEvent& event) {
118     stream << "Event #"<< event.nb() <<" L1="<< event.trigL1() <<" HLT="<< event.trigHLT()
119     << " Primary vertex x=" << event.primaryVertex_x() << " y=" << event.primaryVertex_y() << " z=" << event.primaryVertex_z()
120     << " CaloMET=" << event.metCalo() << endl;
121     return stream;
122     };
123     */
124    
125     private:
126 mlethuil 1.3
127 mlethuil 1.1 Int_t nb_;
128 mlethuil 1.2 Bool_t passGlobalL1_;
129     Bool_t passGlobalHLT_;
130     std::vector<Bool_t> trigHLT_;
131 mlethuil 1.1
132 mlethuil 1.3 Int_t csa07id_;
133     Float_t csa07weight_;
134     TString csa07process_;
135    
136 mlethuil 1.1 map<Int_t,Int_t> nBasicClusters_;
137     map<Int_t,Int_t> nSuperClusters_;
138     std::vector<TVector3> primaryVertex_;
139    
140     TVector3 metCalo_;
141    
142 mlethuil 1.2 ClassDef (TRootEvent,2);
143 mlethuil 1.1 };
144    
145     #endif