ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/HbbAnalysis/interface/GenParticle.hh
Revision: 1.4
Committed: Thu Sep 1 14:07:31 2011 UTC (13 years, 8 months ago) by amagnan
Content type: text/plain
Branch: MAIN
CVS Tags: beforeMETHacks
Changes since 1.3: +13 -0 lines
Log Message:
minor changes related to genParticles and gen info

File Contents

# User Rev Content
1 amagnan 1.1 #ifndef HbbAnalysis_GenParticle_hh
2     #define HbbAnalysis_GenParticle_hh
3    
4     #include <vector>
5     #include <string>
6     #include <iostream>
7    
8     #include "UserCode/HbbAnalysis/interface/Objects.hh"
9    
10     namespace HbbAnalysis {
11    
12     class GenParticle {
13    
14     public:
15    
16    
17     /** Constructors */
18    
19     GenParticle(){
20     Clear();
21     };
22    
23     ~GenParticle(){};
24    
25     GenParticle(const HbbAnalysis::MCVars & aPart){
26     Clear();
27     partVars(aPart);
28     };
29    
30     inline const HbbAnalysis::MCVars & partVars() const {
31     return part_;
32     };
33    
34     inline void partVars(const HbbAnalysis::MCVars & aPart) {
35     part_ = aPart;
36     };
37    
38     inline void setParent(const unsigned int aPar){
39     parentIndex_.push_back(aPar);
40     };
41    
42     inline const std::vector<unsigned int> getParents(){
43     return parentIndex_;
44     };
45    
46     inline void Clear(){
47     part_.index = 0;
48     part_.pT = 0;
49     part_.eta = 0;
50 amagnan 1.2 part_.y = 0;
51 amagnan 1.1 part_.phi = 0;
52     part_.pdgId = 0;
53     part_.status = 0;
54    
55     parentIndex_.clear();
56     };
57    
58     inline void print() const{
59    
60     std::cout << "=======================================================" << std::endl
61     << "================== Print GenParticle ==================" << std::endl
62     << "=======================================================" << std::endl
63     << " ---- index : " << part_.index << std::endl
64     << " ---- pdgId : " << part_.pdgId << std::endl
65     << " ---- status: " << part_.status << std::endl
66     << " ---- pt,eta,phi: " << part_.pT << " " << part_.eta << " " << part_.phi << std::endl
67     << " ---- parents: " ;
68     for (unsigned int i(0); i<parentIndex_.size(); i++){
69     std::cout << parentIndex_.at(i) << " " ;
70     }
71     std::cout << std::endl
72     << "=======================================================" << std::endl;
73    
74     };
75    
76 amagnan 1.4 inline TLorentzVector fourMomentum()
77     {
78     double lpx = part_.pT*cos(part_.phi);
79     double lpy = part_.pT*sin(part_.phi);
80     //double lp = part_.pT/sin(2*atan(exp(-part_.eta)));
81     //double lpz = sqrt(lp*lp - part_.pT*part_.pT);
82     double lpz = part_.pT*sinh(part_.eta);
83     double lE = part_.E;
84    
85     return TLorentzVector(lpx,lpy,lpz,lE);
86    
87     };
88    
89 amagnan 1.1 private:
90    
91     HbbAnalysis::MCVars part_;
92     std::vector<unsigned int> parentIndex_;
93    
94     };
95    
96 amagnan 1.3 inline bool operator < (const GenParticle & one, const GenParticle & two)
97     {
98     return one.partVars().pT > two.partVars().pT;
99     }
100    
101    
102 amagnan 1.1 }//namespace
103     #endif