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.21 by kiesel, Wed Apr 24 10:07:51 2013 UTC vs.
Revision 1.22 by kiesel, Wed Apr 24 13:24:30 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->isEE() || it->isEB()) it->isEBEtaGap() && it->isEBPhiGap() && it->isEERingGap() && it->isEEDeeGap() && it->isEBEEGap() && 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 350 | Line 353 | void TreeWriter::Loop() {
353  
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 )
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;
# Line 382 | 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 408 | 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
412 <                                                                                                                - effectiveAreaElectron(it->momentum.Eta())*event->rho25, (float)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 464 | Line 470 | void TreeWriter::Loop() {
470                  // vertices
471                  nVertex = event->vertices.size();
472  
473 <                if( ht < 450 && skim)
474 <                        continue;
475 <
473 >                tree::Particle thisGenParticle;
474 >                for( std::vector<susy::Particle>::iterator it = event->genParticles.begin(); it != event->genParticles.end(); ++it ) {
475 >                        if( it->status == 3 ) { // hard interaction
476 >                                switch( std::abs(it->pdgId) ) {
477 >                                        thisGenParticle.pt = it->momentum.Pt();
478 >                                        thisGenParticle.eta = it->momentum.Eta();
479 >                                        thisGenParticle.phi = it->momentum.Phi();
480 >                                        case 22: // photon
481 >                                                if( thisGenParticle.pt > 75 )
482 >                                                        genPhoton.push_back( thisGenParticle );
483 >                                        case 11: // electron
484 >                                                if( thisGenParticle.pt > 20 ) // pt cut is lower to estimate fake rate in all pt bins
485 >                                                        genElectron.push_back( thisGenParticle );
486 >                                }
487 >                        }
488 >                }
489  
490                  tree->Fill();
491          } // for jentry

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines