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.23 by kiesel, Wed Apr 24 14:16:05 2013 UTC vs.
Revision 1.29 by kiesel, Mon Apr 29 13:50:54 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 291 | Line 298 | void TreeWriter::Loop() {
298  
299                  for(std::vector<susy::Photon>::iterator it = photonVector.begin();
300                                  it != photonVector.end(); ++it ) {
301 <                        if( !(it->isEE() || it->isEB()) && it->isEBEtaGap() && it->isEBPhiGap() && it->isEERingGap() && it->isEEDeeGap() && it->isEBEEGap() && skim )
301 >                        if( !(it->isEE() || it->isEB()) && it->momentum.Pt()<20 && it->isEBEtaGap() && it->isEBPhiGap() && it->isEERingGap() && it->isEEDeeGap() && it->isEBEEGap() && skim )
302                                  continue;
303                          tree::Photon thisphoton;
297                        thisphoton.pt = getPtFromMatchedJet( *it, jetVector, loggingVerbosity );
304  
305                          thisphoton.chargedIso = chargedHadronIso_corrected(*it, event->rho25);
306                          thisphoton.neutralIso = neutralHadronIso_corrected(*it, event->rho25);
307                          thisphoton.photonIso = photonIso_corrected(*it, event->rho25);
308  
309 <                        bool loose_photon_barrel = thisphoton.pt>20
304 <                                && it->isEB()
305 <                                && it->passelectronveto
309 >                        bool loose_photon_barrel = it->isEB()
310                                  && it->hadTowOverEm<0.05
311                                  && it->sigmaIetaIeta<0.012
312                                  && thisphoton.chargedIso<2.6
313                                  && thisphoton.neutralIso<3.5+0.04*thisphoton.pt
314                                  && thisphoton.photonIso<1.3+0.005*thisphoton.pt;
315 <                        bool loose_photon_endcap = thisphoton.pt > 20
316 <                                && it->isEE()
313 <                                && it->passelectronveto
315 >
316 >                        bool loose_photon_endcap = it->isEE()
317                                  && it->hadTowOverEm<0.05
318                                  && it->sigmaIetaIeta<0.034
319                                  && thisphoton.chargedIso<2.3
320                                  && thisphoton.neutralIso<2.9+0.04*thisphoton.pt;
321  
322 <                        if(!(loose_photon_endcap || loose_photon_barrel || thisphoton.pt > 75 ) && skim )
322 >                        thisphoton.ptJet = getPtFromMatchedJet( *it, jetVector, loggingVerbosity );
323 >                        if(!(loose_photon_endcap || loose_photon_barrel || thisphoton.ptJet > 75 ) && skim )
324                                  continue;
325 +                        thisphoton.pt = it->momentum.Pt();
326                          thisphoton.eta = it->momentum.Eta();
327                          thisphoton.phi = it->momentum.Phi();
328                          thisphoton.r9 = it->r9;
# Line 471 | Line 476 | void TreeWriter::Loop() {
476                  nVertex = event->vertices.size();
477  
478                  tree::Particle thisGenParticle;
474                cout << "   new event " << endl;
479                  for( std::vector<susy::Particle>::iterator it = event->genParticles.begin(); it != event->genParticles.end(); ++it ) {
480 <                        if( it->status == 3 ) { // hard interaction
481 <                                cout << "hard interaction mit status " << it->pdgId << endl;
482 <                                switch( std::abs(it->pdgId) ) {
483 <                                        thisGenParticle.pt = it->momentum.Pt();
484 <                                        thisGenParticle.eta = it->momentum.Eta();
485 <                                        thisGenParticle.phi = it->momentum.Phi();
486 <                                        case 22: // photon
487 <                                                cout << "found photon with pt " << thisGenParticle.pt << endl;
488 <                                                if( thisGenParticle.pt > 75 )
489 <                                                        genPhoton.push_back( thisGenParticle );
490 <                                        case 11: // electron
491 <                                                cout << "found electron with pt " << thisGenParticle.pt << endl;
492 <                                                if( thisGenParticle.pt > 20 ) // pt cut is lower to estimate fake rate in all pt bins
489 <                                                        genElectron.push_back( thisGenParticle );
490 <                                }
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                          }
492                        else if (it->status == 2)
493                                cout <<"zwischending mit status " << it->pdgId << endl;
494                        else if (it->status == 1)
495                                cout <<"endzustand mit status " << it->pdgId << endl;
496
494                  }
495  
496                  tree->Fill();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines