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.17 by kiesel, Fri Apr 19 10:13:02 2013 UTC vs.
Revision 1.23 by kiesel, Wed Apr 24 14:16:05 2013 UTC

# Line 253 | Line 253 | void TreeWriter::Loop() {
253          tree->Branch("ht", &ht, "ht/F");
254          tree->Branch("nVertex", &nVertex, "nVertex/I");
255          tree->Branch("pu_weight", &pu_weight, "pu_weight/F");
256 <
256 >        tree->Branch("genElectron", &genElectron);
257 >        tree->Branch("genPhoton", &genPhoton);
258  
259          for (unsigned long jentry=0; jentry < processNEvents; ++jentry) {
260                  if ( loggingVerbosity>1 || jentry%reportEvery==0 )
# Line 265 | Line 266 | void TreeWriter::Loop() {
266                  jet.clear();
267                  electron.clear();
268                  muon.clear();
269 +                genElectron.clear();
270 +                genPhoton.clear();
271                  ht = 0;
272  
273                  // weights
# Line 288 | Line 291 | void TreeWriter::Loop() {
291  
292                  for(std::vector<susy::Photon>::iterator it = photonVector.begin();
293                                  it != photonVector.end(); ++it ) {
294 <                        if( !(it->isEB() || it->isEE()) && skim )
294 >                        if( !(it->isEE() || it->isEB()) && it->isEBEtaGap() && it->isEBPhiGap() && it->isEERingGap() && it->isEEDeeGap() && it->isEBEEGap() && skim )
295                                  continue;
296                          tree::Photon thisphoton;
297                          thisphoton.pt = getPtFromMatchedJet( *it, jetVector, loggingVerbosity );
# Line 312 | Line 315 | void TreeWriter::Loop() {
315                                  && it->sigmaIetaIeta<0.034
316                                  && thisphoton.chargedIso<2.3
317                                  && thisphoton.neutralIso<2.9+0.04*thisphoton.pt;
318 +
319                          if(!(loose_photon_endcap || loose_photon_barrel || thisphoton.pt > 75 ) && skim )
320                                  continue;
321                          thisphoton.eta = it->momentum.Eta();
# Line 347 | Line 351 | void TreeWriter::Loop() {
351                                  scale = it->jecScaleFactors.find("L2L3")->second;
352                          TLorentzVector corrP4 = scale * it->momentum;
353  
354 <                        if(std::abs(corrP4.Eta()) > 3.0 && skim ) continue;
354 >                        // Calculate HT.
355 >                        // The definiton differs from the saved jet, since trigger is described better
356 >                        if( std::abs( corrP4.Eta() ) < 3 && corrP4.Pt() > 40 )
357 >                                ht += thisjet.pt;
358 >
359 >                        if(std::abs(corrP4.Eta()) > 2.6 && skim ) continue;
360                          if(corrP4.Pt() < 30 && skim ) continue;
361                          thisjet.pt = corrP4.Pt();
362                          thisjet.eta = corrP4.Eta();
# Line 369 | Line 378 | void TreeWriter::Loop() {
378                                  std::cout << " p_T, jet = " << thisjet.pt << std::endl;
379  
380                          jet.push_back( thisjet );
372                        ht += thisjet.pt;
381                  }// for jet
382                  if( jet.size() < 2 && skim )
383                          continue;
# Line 377 | Line 385 | void TreeWriter::Loop() {
385                  if( loggingVerbosity > 1 )
386                          std::cout << "Found " << jet.size() << " jets" << std::endl;
387  
388 +                if( ht < 450 && skim)
389 +                        continue;
390 +
391 +
392  
393                  // met
394                  std::map<TString, susy::MET>::iterator met_it = event->metMap.find("pfMet");
# Line 403 | Line 415 | void TreeWriter::Loop() {
415                          // use veto electrons
416                          if( it->momentum.Pt() < 20  || it->momentum.Pt() > 1e6 )
417                                  continue; // spike rejection
418 <                        float iso = ( it->chargedHadronIso + max(it->neutralHadronIso+it->photonIso
407 <                                                                                                                - effectiveAreaElectron(it->momentum.Eta())*event->rho25, (Float_t)0. )
418 >                        float iso = ( it->chargedHadronIso + max(it->neutralHadronIso+it->photonIso - effectiveAreaElectron(it->momentum.Eta())*event->rho25, (float)0. )
419                                                  ) / it->momentum.Pt();
420                          float d0 = d0correction( *it, *event );
421                          float dZ = std::abs( dZcorrection( *it, *event ) );
# Line 459 | Line 470 | void TreeWriter::Loop() {
470                  // vertices
471                  nVertex = event->vertices.size();
472  
473 <                if( ht < 450 && skim)
474 <                        continue;
473 >                tree::Particle thisGenParticle;
474 >                cout << "   new event " << endl;
475 >                for( std::vector<susy::Particle>::iterator it = event->genParticles.begin(); it != event->genParticles.end(); ++it ) {
476 >                        if( it->status == 3 ) { // hard interaction
477 >                                cout << "hard interaction mit status " << it->pdgId << endl;
478 >                                switch( std::abs(it->pdgId) ) {
479 >                                        thisGenParticle.pt = it->momentum.Pt();
480 >                                        thisGenParticle.eta = it->momentum.Eta();
481 >                                        thisGenParticle.phi = it->momentum.Phi();
482 >                                        case 22: // photon
483 >                                                cout << "found photon with pt " << thisGenParticle.pt << endl;
484 >                                                if( thisGenParticle.pt > 75 )
485 >                                                        genPhoton.push_back( thisGenParticle );
486 >                                        case 11: // electron
487 >                                                cout << "found electron with pt " << thisGenParticle.pt << endl;
488 >                                                if( thisGenParticle.pt > 20 ) // pt cut is lower to estimate fake rate in all pt bins
489 >                                                        genElectron.push_back( thisGenParticle );
490 >                                }
491 >                        }
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  
497 +                }
498  
499                  tree->Fill();
500          } // for jentry

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines