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.20 by kiesel, Wed Apr 24 07:16:49 2013 UTC vs.
Revision 1.25 by kiesel, Wed Apr 24 15:25:35 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() && 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 305 | Line 308 | void TreeWriter::Loop() {
308                                  && thisphoton.chargedIso<2.6
309                                  && thisphoton.neutralIso<3.5+0.04*thisphoton.pt
310                                  && thisphoton.photonIso<1.3+0.005*thisphoton.pt;
311 <                        /*bool loose_photon_endcap = thisphoton.pt > 20
311 >                        bool loose_photon_endcap = thisphoton.pt > 20
312                                  && it->isEE()
313                                  && it->passelectronveto
314                                  && it->hadTowOverEm<0.05
315                                  && it->sigmaIetaIeta<0.034
316                                  && thisphoton.chargedIso<2.3
317                                  && thisphoton.neutralIso<2.9+0.04*thisphoton.pt;
318 <                        */
319 <                        if(!(loose_photon_barrel || thisphoton.pt > 75 ) && skim )
318 >
319 >                        if(!(loose_photon_endcap || loose_photon_barrel || thisphoton.pt > 75 ) && skim )
320                                  continue;
321                          thisphoton.eta = it->momentum.Eta();
322                          thisphoton.phi = it->momentum.Phi();
# 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->momentum.Pt() < 20 ) continue;
476 >                        thisGenParticle.pt = it->momentum.Pt();
477 >                        thisGenParticle.eta = it->momentum.Eta();
478 >                        thisGenParticle.phi = it->momentum.Phi();
479 >                        switch( std::abs(it->pdgId) ) {
480 >                                case 22: // photon
481 >                                        genPhoton.push_back( thisGenParticle );
482 >                                        break;
483 >                                case 11: // electron
484 >                                        // Demand a W boson as mother particle of electron
485 >                                        if( abs(event->genParticles[it->motherIndex].pdgId) == 24 )
486 >                                                genElectron.push_back( thisGenParticle );
487 >                                        break;
488 >                        }
489 >                }
490  
491                  tree->Fill();
492          } // for jentry

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines