Fork me on GitHub

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/PhotonID.cc

    r341014c r4fd4f01  
    1717 */
    1818
     19
    1920/** \class PhotonID
    2021 *
     
    3334#include "classes/DelphesFormula.h"
    3435
     36#include "ExRootAnalysis/ExRootResult.h"
     37#include "ExRootAnalysis/ExRootFilter.h"
    3538#include "ExRootAnalysis/ExRootClassifier.h"
    36 #include "ExRootAnalysis/ExRootFilter.h"
    37 #include "ExRootAnalysis/ExRootResult.h"
    38 
     39
     40#include "TMath.h"
     41#include "TString.h"
     42#include "TFormula.h"
     43#include "TRandom3.h"
     44#include "TObjArray.h"
    3945#include "TDatabasePDG.h"
    40 #include "TFormula.h"
    4146#include "TLorentzVector.h"
    42 #include "TMath.h"
    43 #include "TObjArray.h"
    44 #include "TRandom3.h"
    45 #include "TString.h"
    46 
    47 #include <algorithm>
     47
     48#include <algorithm>
     49#include <stdexcept>
    4850#include <iostream>
    4951#include <sstream>
    50 #include <stdexcept>
    5152
    5253using namespace std;
     
    5556
    5657PhotonID::PhotonID() :
    57   fPromptFormula(0), fNonPromptFormula(0), fFakeFormula(0), fItInputPhotonArray(0), fItInputGenArray(0)
    58 {
    59   fPromptFormula = new DelphesFormula;
    60   fNonPromptFormula = new DelphesFormula;
    61   fFakeFormula = new DelphesFormula;
     58  fPromptFormula(0), fNonPromptFormula(0), fFakeFormula(0), fItInputPhotonArray(0),  fItInputGenArray(0)
     59{
     60 fPromptFormula = new DelphesFormula;
     61 fNonPromptFormula = new DelphesFormula;
     62 fFakeFormula = new DelphesFormula;
    6263}
    6364
     
    8081  fNonPromptFormula->Compile(GetString("NonPromptFormula", "1.0"));
    8182  fFakeFormula->Compile(GetString("FakeFormula", "1.0"));
    82 
     83 
    8384  // import input arrays
    8485  fInputPhotonArray = ImportArray(GetString("InputPhotonArray", "PhotonIsolation/photons"));
     
    110111
    111112void PhotonID::Process()
    112 {
     113{ 
    113114  Candidate *candidate, *mother;
    114115  Double_t pt, eta, phi, e;
    115116  Double_t relIso;
    116117  Bool_t isolated;
    117 
     118 
    118119  //cout<< "----  new event ---------"<<endl;
    119120
    120121  fItInputPhotonArray->Reset();
    121   while((candidate = static_cast<Candidate *>(fItInputPhotonArray->Next())))
     122  while((candidate = static_cast<Candidate*>(fItInputPhotonArray->Next())))
    122123  {
    123124
    124125    mother = candidate;
    125     candidate = static_cast<Candidate *>(candidate->Clone());
     126    candidate = static_cast<Candidate*>(candidate->Clone());
    126127    candidate->AddCandidate(mother);
    127128
     
    133134    e = candidateMomentum.E();
    134135
    135     if(pt < fPTMin) continue;
     136    if (pt < fPTMin) continue;
    136137
    137138    //cout<< "              ---- photon -----: "<<pt<<","<<eta<<","<<phi<<endl;
    138 
     139   
    139140    // find out if photon matches does not match photon in gen collection and apply fae efficiency
    140     if(isFake(candidate))
     141    if (isFake(candidate) )
    141142    {
    142143      //cout<<"                    Fake!"<<endl;
     
    156157
    157158      // if isolated apply prompt formula
    158       if(isolated)
     159      if (isolated)
    159160      {
    160161        //cout<<"                       isolated!:   "<<relIso<<endl;
     
    163164        candidate->Status = 1;
    164165        fOutputArray->Add(candidate);
     166       
    165167      }
    166 
     168     
    167169      // if non-isolated apply non-prompt formula
    168170      else
     
    180182//------------------------------------------------------------------------------
    181183
    182 Bool_t PhotonID::isFake(const Candidate *obj)
    183 {
     184Bool_t PhotonID::isFake(const Candidate *obj){
    184185
    185186  const TLorentzVector &mom_rec = obj->Momentum;
    186 
     187 
    187188  Bool_t matches = false;
    188189  fItInputGenArray->Reset();
    189190  Candidate *gen;
    190 
    191   while((gen = static_cast<Candidate *>(fItInputGenArray->Next())))
     191 
     192  while((gen = static_cast<Candidate*>(fItInputGenArray->Next())))
    192193  {
    193194    const TLorentzVector &mom_gen = gen->Momentum;
    194195    Int_t status = gen->Status;
    195196    Int_t pdgCode = TMath::Abs(gen->PID);
    196     Float_t dPtOverPt = TMath::Abs((mom_gen.Pt() - mom_rec.Pt()) / mom_rec.Pt());
     197    Float_t dPtOverPt = TMath::Abs((mom_gen.Pt() - mom_rec.Pt())/mom_rec.Pt());
    197198    Float_t deltaR = mom_gen.DeltaR(mom_rec);
    198199
    199     if(status != 1) continue;
    200     if(pdgCode != 22) continue;
    201     if(dPtOverPt > 0.5) continue;
    202     if(deltaR > 0.1) continue;
     200    if (status != 1) continue;
     201    if (pdgCode != 22) continue;
     202    if (dPtOverPt > 0.5) continue;
     203    if (deltaR > 0.1) continue;
    203204
    204205    matches = true;
    205206    break;
     207
    206208  }
    207209
Note: See TracChangeset for help on using the changeset viewer.