ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/PhotonTreeWriter.cc
(Generate patch)

Comparing UserCode/MitPhysics/Mods/src/PhotonTreeWriter.cc (file contents):
Revision 1.12 by paus, Thu Mar 29 23:41:56 2012 UTC vs.
Revision 1.13 by fabstoec, Tue Apr 24 11:45:53 2012 UTC

# Line 38 | Line 38 | PhotonTreeWriter::PhotonTreeWriter(const
38    fSuperClusterName       ("PFSuperClusters"),
39    fPFMetName              ("PFMet"),
40    fPFJetName              (Names::gkPFJetBrn),
41 +
42 +  fLeptonTagElectronsName ("HggLeptonTagElectrons"),
43 +  fLeptonTagMuonsName     ("HggLeptonTagMuons"),
44 +
45    fIsData                 (false),
46    fPhotonsFromBranch      (kTRUE),  
47    fPVFromBranch           (kTRUE),
# Line 57 | Line 61 | PhotonTreeWriter::PhotonTreeWriter(const
61    fPileUp                 (0),
62    fSuperClusters          (0),
63    fPFJets                 (0),
64 +
65 +  fLeptonTagElectrons     (0),
66 +  fLeptonTagMuons         (0),
67 +
68    fLoopOnGoodElectrons    (kFALSE),
69    fApplyElectronVeto      (kTRUE),  
70    fWriteDiphotonTree      (kTRUE),
# Line 64 | Line 72 | PhotonTreeWriter::PhotonTreeWriter(const
72    fExcludeSinglePrompt    (kFALSE),
73    fExcludeDoublePrompt    (kFALSE),
74    fEnableJets             (kFALSE),
75 +  fApplyLeptonTag         (kFALSE),
76    fPhFixDataFile          (gSystem->Getenv("CMSSW_BASE") +
77                             TString("/src/MitPhysics/data/PhotonFixSTART42V13.dat")),
78    fTupleName              ("hPhotonTree")
# Line 83 | Line 92 | void PhotonTreeWriter::Process()
92    // Process entries of the tree.
93    LoadEventObject(fPhotonBranchName,   fPhotons);
94    LoadEventObject(fGoodElectronName,   fGoodElectrons);
95 +
96 +  // lepton tag collections
97 +  if( fApplyLeptonTag ) {
98 +    LoadEventObject(fLeptonTagElectronsName, fLeptonTagElectrons);
99 +    LoadEventObject(fLeptonTagMuonsName,     fLeptonTagMuons);
100 +  }
101 +
102    const BaseCollection *egcol = 0;
103    if (fLoopOnGoodElectrons)
104      egcol = fGoodElectrons;
# Line 135 | Line 151 | void PhotonTreeWriter::Process()
151    if (!fIsData)
152      FindHiggsPtAndZ(_pth, _decayZ, _genmass);
153  
154 +  fDiphotonEvent->leptonTag = -1; // disabled
155 +
156    fDiphotonEvent->rho = rho;
157    fDiphotonEvent->genHiggspt = _pth;
158    fDiphotonEvent->genHiggsZ = _decayZ;
# Line 412 | Line 430 | void PhotonTreeWriter::Process()
430      
431      //printf("r9 = %5f, photon sigieie = %5f, seed sigieie = %5f\n",phHard->R9(),
432      //       phHard->CoviEtaiEta(),sqrt(phHard->SCluster()->Seed()->CoviEtaiEta()));
433 <    
433 >
434 >    if( fApplyLeptonTag ) {
435 >      // perform lepton tagging
436 >      // the diphoton event record will have one more entry; i.e. leptonTag
437 >      // leptonTag = -1   -> lepton-taggng was swicthed off
438 >      //           =  0   -> event tagged as 'non-lepton-event'
439 >      //           = +1   -> event tagged as muon-event
440 >      //           = +2   -> event tagged as electron-event
441 >      fDiphotonEvent->leptonTag = 0;
442 >
443 >      if ( fLeptonTagMuons->GetEntries() > 0 ) {
444 >        // need to have dR > 1 for with respect to both photons
445 >        for(UInt_t iMuon = 0; iMuon <fLeptonTagMuons->GetEntries(); ++iMuon) {
446 >          if(MathUtils::DeltaR(fLeptonTagMuons->At(iMuon),phHard) < 1.) continue;
447 >          if(MathUtils::DeltaR(fLeptonTagMuons->At(iMuon),phSoft) < 1.) continue;
448 >
449 >          fDiphotonEvent->leptonTag = 1;
450 >          break;
451 >        }
452 >      }
453 >      if ( fDiphotonEvent->leptonTag < 1 && fLeptonTagElectrons->GetEntries() > 0 ) {
454 >        for(UInt_t iEle = 0; iEle < fLeptonTagElectrons->GetEntries(); ++iEle) {
455 >          if(MathUtils::DeltaR(fLeptonTagElectrons->At(iEle),phHard) < 1.) continue;
456 >          if(MathUtils::DeltaR(fLeptonTagElectrons->At(iEle),phSoft) < 1.) continue;
457 >
458 >          // here we also check the mass ....
459 >          if ( TMath::Abs( (phHard->Mom()+fLeptonTagElectrons->At(iEle)->Mom()).M()-91.19 ) < 5. ) continue;
460 >          if ( TMath::Abs( (phSoft->Mom()+fLeptonTagElectrons->At(iEle)->Mom()).M()-91.19 ) < 5. ) continue;
461 >          
462 >          fDiphotonEvent->leptonTag = 2;
463 >          break;
464 >        }
465 >      }
466 >    }
467 >
468      if (fWriteDiphotonTree)
469        hCiCTuple->Fill();  
470    }
# Line 484 | Line 536 | void PhotonTreeWriter::SlaveBegin()
536    // Run startup code on the computer (slave) doing the actual analysis. Here,
537    // we just request the photon collection branch.
538  
539 +  if( fApplyLeptonTag ) {
540 +    ReqEventObject(fLeptonTagElectronsName,    fLeptonTagElectrons,    false);  
541 +    ReqEventObject(fLeptonTagMuonsName,        fLeptonTagMuons,        false);  
542 +  }
543 +
544    ReqEventObject(fPhotonBranchName,fPhotons,      fPhotonsFromBranch);
545    ReqEventObject(fTrackBranchName, fTracks,       true);
546    ReqEventObject(fElectronName,    fElectrons,    true);  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines