ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/kiesel/TreeWriter/treeWriter.cc
(Generate patch)

Comparing UserCode/kiesel/TreeWriter/treeWriter.cc (file contents):
Revision 1.22 by kiesel, Wed Apr 24 13:24:30 2013 UTC vs.
Revision 1.27 by kiesel, Thu Apr 25 18:17:04 2013 UTC

# Line 70 | Line 70 | std::vector<Type>* getVectorFromMap( map
70          return vec;
71   }
72  
73 + float deltaPhi( float phi1, float phi2) {
74 +        float result = phi1 - phi2;
75 +        while (result > M_PI) result -= 2*M_PI;
76 +        while (result <= -M_PI) result += 2*M_PI;
77 +        return result;
78 + }
79 +
80   // useful functions
81   float deltaR( const TLorentzVector& v1, const TLorentzVector& v2 ) {
82          // deltaR  = sqrt ( deltaEta^2 + deltaPhi^2 )
83 <        return sqrt(pow(v1.Eta() - v2.Eta(), 2) + pow(v1.Phi() - v2.Phi(), 2) );
83 >        return sqrt(pow(v1.Eta() - v2.Eta(), 2) + pow(deltaPhi(v1.Phi(),v2.Phi()), 2) );
84   }
85  
86   float effectiveAreaElectron( float eta ) {
# Line 302 | Line 309 | void TreeWriter::Loop() {
309  
310                          bool loose_photon_barrel = thisphoton.pt>20
311                                  && it->isEB()
305                                && it->passelectronveto
312                                  && it->hadTowOverEm<0.05
313                                  && it->sigmaIetaIeta<0.012
314                                  && thisphoton.chargedIso<2.6
# Line 310 | Line 316 | void TreeWriter::Loop() {
316                                  && thisphoton.photonIso<1.3+0.005*thisphoton.pt;
317                          bool loose_photon_endcap = thisphoton.pt > 20
318                                  && it->isEE()
313                                && it->passelectronveto
319                                  && it->hadTowOverEm<0.05
320                                  && it->sigmaIetaIeta<0.034
321                                  && thisphoton.chargedIso<2.3
# Line 472 | Line 477 | void TreeWriter::Loop() {
477  
478                  tree::Particle thisGenParticle;
479                  for( std::vector<susy::Particle>::iterator it = event->genParticles.begin(); it != event->genParticles.end(); ++it ) {
480 <                        if( it->status == 3 ) { // hard interaction
481 <                                switch( std::abs(it->pdgId) ) {
482 <                                        thisGenParticle.pt = it->momentum.Pt();
483 <                                        thisGenParticle.eta = it->momentum.Eta();
484 <                                        thisGenParticle.phi = it->momentum.Phi();
485 <                                        case 22: // photon
486 <                                                if( thisGenParticle.pt > 75 )
487 <                                                        genPhoton.push_back( thisGenParticle );
488 <                                        case 11: // electron
489 <                                                if( thisGenParticle.pt > 20 ) // pt cut is lower to estimate fake rate in all pt bins
490 <                                                        genElectron.push_back( thisGenParticle );
491 <                                }
480 >                        if( it->momentum.Pt() < 20 ) continue;
481 >                        thisGenParticle.pt = it->momentum.Pt();
482 >                        thisGenParticle.eta = it->momentum.Eta();
483 >                        thisGenParticle.phi = it->momentum.Phi();
484 >                        switch( std::abs(it->pdgId) ) {
485 >                                case 22: // photon
486 >                                        genPhoton.push_back( thisGenParticle );
487 >                                        break;
488 >                                case 11: // electron
489 >                                        // Demand a W boson as mother particle of electron
490 >                                        if( abs(event->genParticles[it->motherIndex].pdgId) == 24 )
491 >                                                genElectron.push_back( thisGenParticle );
492 >                                        break;
493                          }
494                  }
495  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines