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.72 by veverka, Tue Dec 10 14:02:05 2013 UTC vs.
Revision 1.73 by bendavid, Tue Dec 10 15:31:21 2013 UTC

# Line 2373 | Line 2373 | const Muon* PhotonTreeWriter::GetLeptonT
2373      }
2374      cout << "++ Exiting GetLeptonTagMuon ..." << endl;
2375    }
2376 <  if (fLeptonTagMuons->GetEntries() > 0                       &&
2377 <      fLeptonTagMuons->At(0) != 0                             &&
2378 <      MathUtils::DeltaR(fLeptonTagMuons->At(0), phHard) >= 1.0 &&
2379 <      MathUtils::DeltaR(fLeptonTagMuons->At(0), phSoft) >= 1.0) {
2380 <    return fLeptonTagMuons->At(0);
2381 <  } else {
2382 <    return 0;
2376 >  
2377 >  for (unsigned int imu=0; imu<fLeptonTagMuons->GetEntries(); ++imu) {
2378 >    const Muon *mu = fLeptonTagMuons->At(imu);
2379 >    if (fLeptonTagMuons->GetEntries() > 0                       &&
2380 >        fLeptonTagMuons->At(0) != 0                             &&
2381 >        MathUtils::DeltaR(mu, phHard) >= 1.0 &&
2382 >        MathUtils::DeltaR(mu, phSoft) >= 1.0) {
2383 >      return mu;
2384 >    }
2385    }
2386 +    
2387 +  return 0;
2388 +  
2389   } // const Muon* PhotonTreeWriter::GetLeptonTagMuon(..)
2390    
2391    
# Line 2453 | Line 2458 | const Electron* PhotonTreeWriter::GetLep
2458       cout << "++ Exiting GetLeptonTagElectron ..." << endl;
2459    }
2460    
2461 <  if (fLeptonTagElectrons->GetEntries() > 0                          &&
2462 <      fLeptonTagElectrons->At(0) != 0                                &&
2463 <      PhotonTools::ElectronVetoCiC(phHard, fLeptonTagElectrons) >= 1 &&
2464 <      PhotonTools::ElectronVetoCiC(phSoft, fLeptonTagElectrons) >= 1 &&
2465 <      PhotonTools::ElectronVetoCiC(phHard, fElectrons) >= 1          &&
2466 <      PhotonTools::ElectronVetoCiC(phSoft, fElectrons) >= 1          &&    
2467 <      MathUtils::DeltaR(fLeptonTagElectrons->At(0), phHard) >= 1     &&
2468 <      MathUtils::DeltaR(fLeptonTagElectrons->At(0), phSoft) >= 1){
2469 <    return fLeptonTagElectrons->At(0);
2470 <  } else {
2471 <    return 0;
2461 >  //loop over all electrons
2462 >  for (unsigned int iele=0; iele<fLeptonTagElectrons->GetEntries(); ++iele) {
2463 >    const Electron *ele = fLeptonTagElectrons->At(iele);
2464 >    if (fLeptonTagElectrons->GetEntries() > 0                          &&
2465 >        fLeptonTagElectrons->At(0) != 0                                &&
2466 >        PhotonTools::ElectronVetoCiC(phHard, fLeptonTagElectrons) >= 1 &&
2467 >        PhotonTools::ElectronVetoCiC(phSoft, fLeptonTagElectrons) >= 1 &&
2468 >        PhotonTools::ElectronVetoCiC(phHard, fElectrons) >= 1          &&
2469 >        PhotonTools::ElectronVetoCiC(phSoft, fElectrons) >= 1          &&    
2470 >        MathUtils::DeltaR(ele, phHard) >= 1     &&
2471 >        MathUtils::DeltaR(ele, phSoft) >= 1){
2472 >      return ele;
2473 >    }
2474    }
2475 +    
2476 +  return 0;
2477 +  
2478   } // const Electron* PhotonTreeWriter::GetLeptonTagElectron(..)
2479  
2480    
# Line 2496 | Line 2506 | void PhotonTreeWriter::ApplyVHLepTag(con
2506    // TODO: Set the selected vertex to the lepton vertex if tagged as a
2507    //       VH(lep) event.
2508    
2509 +  //printf("ApplyVHLepTag: electrons = %i, softelectrons = %i, muons = %i, softmuons = %i\n",fLeptonTagElectrons->GetEntries(), fLeptonTagSoftElectrons->GetEntries(), fLeptonTagMuons->GetEntries(), fLeptonTagSoftMuons->GetEntries());
2510 +  
2511    if (fVerbosityLevel > 90) {
2512      cout << "+ Entering ApplyVHLepTag ..." << endl
2513           << "+ fElectrons->GetEntries(): " << fElectrons->GetEntries() << endl
# Line 2505 | Line 2517 | void PhotonTreeWriter::ApplyVHLepTag(con
2517           << fLeptonTagMuons->GetEntries() << endl
2518           << "+ corrpfmet: " << fDiphotonEvent->corrpfmet << endl;
2519    }
2520 +
2521    fDiphotonEvent->VHLepTag = 0; // non-lepton event
2522    bool isVHLepLoose = false;
2523    bool isVHLepTight = false;
# Line 2515 | Line 2528 | void PhotonTreeWriter::ApplyVHLepTag(con
2528    if (fDiphotonEvent->leptonTag < 0) {
2529      ApplyLeptonTag(phHard, phSoft, selvtx);
2530    }
2531 +  
2532 +  //printf("check dilepton, tight = %i\n",int(isVHLepTight));
2533  
2534    const Muon *muon = GetLeptonTagMuon(phHard, phSoft);
2535    if (muon && VHLepNumberOfJets(phHard, phSoft, selvtx, muon) <= 2) {
# Line 2522 | Line 2537 | void PhotonTreeWriter::ApplyVHLepTag(con
2537      else                                 isVHLepLoose = true; // low MET event
2538    } // Found a good VH(lep) tag muon.
2539    
2540 +  //printf("check muon, tight  = %i, loose = %i\n",int(isVHLepTight),int(isVHLepLoose));
2541 +  
2542    const Electron *electron = GetLeptonTagElectron(phHard, phSoft);
2543    if (electron && VHLepNumberOfJets(phHard, phSoft, selvtx, electron) <= 2) {
2544      if (fDiphotonEvent->corrpfmet > 45.) {
# Line 2532 | Line 2549 | void PhotonTreeWriter::ApplyVHLepTag(con
2549      } // Low MET event.
2550    } // Found a good VH(lep) tag electron.
2551  
2552 +  //printf("check electron, tight  = %i, loose = %i\n",int(isVHLepTight),int(isVHLepLoose));
2553 +  
2554    if (isVHLepLoose) fDiphotonEvent->VHLepTag += 1;
2555    if (isVHLepTight) fDiphotonEvent->VHLepTag += 2;
2556  
# Line 2766 | Line 2785 | void PhotonTreeWriter::ApplyTTHTag(const
2785    }
2786    
2787    
2788 +  //printf("ApplyTTHLepTag: electrons = %i, softelectrons = %i, muons = %i, softmuons = %i\n",fLeptonTagElectrons->GetEntries(), fLeptonTagSoftElectrons->GetEntries(), fLeptonTagMuons->GetEntries(), fLeptonTagSoftMuons->GetEntries());
2789 +  
2790 +  
2791    fDiphotonEvent->tthTag = 0;
2792    
2793    // Selection taken from the AN2012_480_V6 of 24 April 2013 further
# Line 2775 | Line 2797 | void PhotonTreeWriter::ApplyTTHTag(const
2797  
2798    const Particle *lepton = TTHSelectLepton(phHard, phSoft, selvtx);
2799  
2800 +  //printf("lepton = %p\n",(void*)lepton);
2801 +  
2802    // Init jet object counters
2803    UInt_t nJets = 0;
2804    UInt_t nBJets = 0;
# Line 3000 | Line 3024 | PhotonTreeWriter::TTHSelectElectron(cons
3024           <<      PhotonTools::ElectronVetoCiC(phSoft, fElectrons) << endl;
3025    }  
3026    
3003  const Electron *selectedElectron = 0;
3027    if (PhotonTools::ElectronVetoCiC(phHard, fLeptonTagElectrons) >= 1 &&
3028        PhotonTools::ElectronVetoCiC(phSoft, fLeptonTagElectrons) >= 1 &&
3029        PhotonTools::ElectronVetoCiC(phHard, fElectrons) >= 1          &&
3030        PhotonTools::ElectronVetoCiC(phSoft, fElectrons) >= 1){
3008    double maxIdMva = -999.;
3031      // Loop over electrons, apply all cuts, find the one wiht hightes ID MVA
3032      for (UInt_t iele=0; iele < fLeptonTagElectrons->GetEntries(); ++iele) {
3033        const Electron *ele = fLeptonTagElectrons->At(iele);
# Line 3022 | Line 3044 | PhotonTreeWriter::TTHSelectElectron(cons
3044               << "+++ MassOfPairIsWithinWindowAroundMZ(ele, phHard, 10): "
3045               <<      MassOfPairIsWithinWindowAroundMZ(ele, phHard, 10) << endl
3046               << "+++ MassOfPairIsWithinWindowAroundMZ(ele, phSoft, 10): "
3047 <             <<      MassOfPairIsWithinWindowAroundMZ(ele, phSoft, 10) << endl
3048 <             << "+++ GetElectronIdMva(ele): " << GetElectronIdMva(ele) << endl;
3047 >             <<      MassOfPairIsWithinWindowAroundMZ(ele, phSoft, 10) << endl;
3048 >             //<< "+++ GetElectronIdMva(ele): " << GetElectronIdMva(ele) << endl;
3049        }  
3050        
3051        // Apply kinematic cuts, see L133 and L134 of the AN
3052 <      if (ele->Pt() < 20. || ele->AbsEta() < 2.5) continue;
3052 >      //(JOSH: In fact these are already applied in the ElectronIDMod as we have configured it)
3053 >      //if (ele->Pt() < 20. || ele->AbsEta() > 2.5) continue;
3054 >      //keep Pt cut here in any case we reorganize logic later
3055 >      if (ele->Pt()<20.) continue;
3056 >      
3057        // Require separation between this electron and both photons,
3058        // see the slide 7, bullet 2
3059        if (MathUtils::DeltaR(ele, phHard) < 0.5) continue;
3060        if (MathUtils::DeltaR(ele, phSoft) < 0.5) continue;
3061        // Require electron-photon mass outside of a 20 GeV window around MZ
3062 <      if (MassOfPairIsWithinWindowAroundMZ(ele, phHard, 10)) continue;
3063 <      if (MassOfPairIsWithinWindowAroundMZ(ele, phSoft, 10)) continue;
3062 >      //JOSH: Shouldn't be applied for ttH category
3063 > //       if (MassOfPairIsWithinWindowAroundMZ(ele, phHard, 10)) continue;
3064 > //       if (MassOfPairIsWithinWindowAroundMZ(ele, phSoft, 10)) continue;
3065        // Electron ID MVA arbitration (private discussion with
3066        // Francesco Micheli on 26 Nov 2013)
3067 <      double idMva = GetElectronIdMva(ele);
3068 <      if (idMva > maxIdMva) {
3069 <        maxIdMva = idMva;
3070 <        selectedElectron = ele;
3071 <      }
3067 > //       double idMva = GetElectronIdMva(ele);
3068 > //       if (idMva > maxIdMva) {
3069 > //         maxIdMva = idMva;
3070 > //         selectedElectron = ele;
3071 > //       }
3072 >      //JOSH: electrons here are already sorted by mva output, so can just take the first one and break
3073 >      //(in fact the call to GetElectronIdMva was segfaulting for a reason which I didn't care to debug)
3074 >      return ele;
3075      } // Loop over electrons
3076    }
3077 <  if (fVerbosityLevel > 90) {
3078 <    cout << "+++ selectedElectron: " << selectedElectron << endl
3079 <         << "+++ Exiting TTHSelectElectron ..." << endl << flush;
3050 <  }  
3051 <  return selectedElectron;
3077 >
3078 >  return 0;
3079 >  
3080   } // TTHSelectElectron
3081  
3082  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines