ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/Morgan/interface/TRootEvent.h
Revision: 1.2
Committed: Thu Jun 19 14:07:31 2008 UTC (16 years, 10 months ago) by mlethuil
Content type: text/plain
Branch: MAIN
Changes since 1.1: +53 -25 lines
Log Message:
Add HLT Info

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     ,nBasicClusters_()
24     ,nSuperClusters_()
25     ,primaryVertex_(0)
26     ,metCalo_()
27     {;}
28    
29 mlethuil 1.1 ~TRootEvent() {;}
30    
31     // Event number
32 mlethuil 1.2 Int_t nb() const { return nb_; }
33 mlethuil 1.1
34     // Trigger decision
35 mlethuil 1.2 Int_t passGlobalL1() const { return passGlobalL1_; }
36     Bool_t passGlobalHLT() const { return passGlobalHLT_; }
37     unsigned int nHLTPaths() const { return trigHLT_.size(); }
38     std::vector<Bool_t> trigHLT() const { return trigHLT_; }
39     Bool_t trigHLT(unsigned int i) const
40     {
41     if (trigHLT_.size()>i)
42     {
43     return trigHLT_.at(i);
44     }
45     else
46     {
47     cout << "HLT path " << i << " not found" << endl;
48     return false;
49     }
50     }
51 mlethuil 1.1
52     // Nb of primary vertices
53 mlethuil 1.2 unsigned nPrimaryVertices() const { return primaryVertex_.size(); }
54 mlethuil 1.1
55     // Nb of BasicClusters of a given type
56     Int_t nBasicClusters(Int_t type)
57     {
58     map<Int_t,Int_t>::iterator it=nBasicClusters_.find(type);
59     return ( it ==nBasicClusters_.end() ? 0 : (*it).second );
60     }
61    
62     // Nb of SuperClusters of a given type
63     Int_t nSuperClusters(Int_t type)
64     {
65     map<Int_t,Int_t>::iterator it=nSuperClusters_.find(type);
66     return ( it ==nSuperClusters_.end() ? 0 : (*it).second );
67     }
68    
69    
70     // Primary Vertex as 3-vector
71 mlethuil 1.2 TVector3 primaryVertex() const { return (primaryVertex_.size()>0 ? primaryVertex_.at(0) : TVector3(0.,0.,0.) ); }
72     TVector3 primaryVertex(unsigned i) const { return (primaryVertex_.size()>i ? primaryVertex_.at(i) : TVector3(0.,0.,0.) ); }
73 mlethuil 1.1 // x, y, z of Primary Vertex
74 mlethuil 1.2 Double_t primaryVertex_x() const { return (primaryVertex_.size()>0 ? primaryVertex_.at(0).x() : 0. ); }
75     Double_t primaryVertex_y() const { return (primaryVertex_.size()>0 ? primaryVertex_.at(0).y() : 0. ); }
76     Double_t primaryVertex_z() const { return (primaryVertex_.size()>0 ? primaryVertex_.at(0).z() : 0. ); }
77     Double_t primaryVertex_x(unsigned i) const { return (primaryVertex_.size()>i ? primaryVertex_.at(i).x() : 0. ); }
78     Double_t primaryVertex_y(unsigned i) const { return (primaryVertex_.size()>i ? primaryVertex_.at(i).x() : 0. ); }
79     Double_t primaryVertex_z(unsigned i) const { return (primaryVertex_.size()>i ? primaryVertex_.at(i).x() : 0. ); }
80 mlethuil 1.1
81     // Missing Et as 3-vector
82 mlethuil 1.2 TVector3 metCaloVect() const { return metCalo_; }
83 mlethuil 1.1 // Missing Et magnitude
84 mlethuil 1.2 Double_t metCalo() const { return sqrt(metCalo_.Perp2()); }
85 mlethuil 1.1
86    
87     void setNb(Int_t nb) { nb_ = nb; }
88 mlethuil 1.2 void setGlobalL1(Int_t passGlobalL1) { passGlobalL1_ = passGlobalL1; }
89     void setGlobalHLT(Bool_t passGlobalHLT) { passGlobalHLT_ = passGlobalHLT_; }
90     void setTrigHLT(std::vector<Bool_t> trigHLT)
91     {
92     trigHLT_.resize(trigHLT.size());
93     for (unsigned int i=0; i!=trigHLT.size(); ++i) trigHLT_[i]=trigHLT[i];
94     }
95    
96    
97 mlethuil 1.1
98     void setNBasicClusters(Int_t type,Int_t nBC) { nBasicClusters_[type]=nBC; }
99     void setNSuperClusters(Int_t type,Int_t nSC) { nSuperClusters_[type]=nSC; }
100    
101     void addPrimaryVertex(TVector3 vertex) { primaryVertex_.push_back(vertex); }
102     void clearPrimaryVertex(TVector3 vertex) { primaryVertex_.clear(); }
103     void setMetCaloVect(TVector3 metCaloVect) { metCalo_ = metCaloVect; }
104    
105     /*
106     friend std::ostream& operator<< (std::ostream& stream, const TRootEvent& event) {
107     stream << "Event #"<< event.nb() <<" L1="<< event.trigL1() <<" HLT="<< event.trigHLT()
108     << " Primary vertex x=" << event.primaryVertex_x() << " y=" << event.primaryVertex_y() << " z=" << event.primaryVertex_z()
109     << " CaloMET=" << event.metCalo() << endl;
110     return stream;
111     };
112     */
113    
114     private:
115    
116     Int_t nb_;
117 mlethuil 1.2 Bool_t passGlobalL1_;
118     Bool_t passGlobalHLT_;
119     std::vector<Bool_t> trigHLT_;
120 mlethuil 1.1
121     map<Int_t,Int_t> nBasicClusters_;
122     map<Int_t,Int_t> nSuperClusters_;
123     std::vector<TVector3> primaryVertex_;
124    
125     TVector3 metCalo_;
126    
127 mlethuil 1.2 ClassDef (TRootEvent,2);
128 mlethuil 1.1 };
129    
130     #endif