ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/UHHAnalysis/SFrameTools/src/Utils.cxx
(Generate patch)

Comparing UserCode/UHHAnalysis/SFrameTools/src/Utils.cxx (file contents):
Revision 1.1 by peiffer, Fri May 25 09:31:04 2012 UTC vs.
Revision 1.2 by peiffer, Thu May 31 08:56:47 2012 UTC

# Line 46 | Line 46 | bool TopTag(TopJet topjet,  double &mjet
46    
47    return true;
48   }
49 +
50 + double HTlep(const BaseCycleContainer *bcc){
51 +
52 +  double htlep=0;
53 +
54 +  if(bcc->electrons){
55 +    for(unsigned int i=0; i<bcc->electrons->size(); ++i){
56 +      htlep += bcc->electrons->at(i).pt();
57 +    }
58 +  }
59 +  if(bcc->muons){
60 +    for(unsigned int i=0; i<bcc->muons->size(); ++i){
61 +      htlep += bcc->muons->at(i).pt();
62 +    }
63 +  }
64 +  if(bcc->met) htlep += bcc->met->pt();
65 +
66 +  return htlep;
67 +
68 + }
69 +
70 + Jet* nextJet(const Particle *p, std::vector<Jet> *jets){
71 +
72 +  double deltarmin = double_infinity();
73 +  Jet* nextjet=0;
74 +  for(unsigned int i=0; i<jets->size();++i){
75 +    if(jets->at(i).deltaR(*p) < deltarmin){
76 +      deltarmin = jets->at(i).deltaR(*p);
77 +      nextjet = &jets->at(i);
78 +    }
79 +  }
80 +
81 +  return nextjet;
82 + }
83 +
84 + double pTrel(const Particle *p, std::vector<Jet> *jets){
85 +
86 +  double ptrel=0;
87 +
88 +  Jet* nextjet =  nextJet(p,jets);
89 +
90 +  TVector3 p3(p->v4().Px(),p->v4().Py(),p->v4().Pz());
91 +  TVector3 jet3(nextjet->v4().Px(),nextjet->v4().Py(),nextjet->v4().Pz());
92 +
93 +  if(p3.Mag()!=0 && jet3.Mag()!=0){
94 +    double sin_alpha = (p3.Cross(jet3)).Mag()/p3.Mag()/jet3.Mag();
95 +    ptrel = p3.Mag()*sin_alpha;
96 +  }
97 +  else{
98 +    std::cout << "something strange happend in the ptrel calculation: either lepton or jet momentum is 0" <<std::endl;
99 +  }
100 +
101 +  return ptrel;
102 + }
103 +
104 + double deltaRmin(const Particle *p, std::vector<Jet> *jets){
105 +  return nextJet(p,jets)->deltaR(*p);
106 + }
107 +
108 +
109 + double double_infinity(){
110 +  return std::numeric_limits<double>::infinity() ;
111 + }
112 +
113 + int int_infinity(){
114 +  return std::numeric_limits<int>::max() ;
115 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines