Fork me on GitHub

Changeset 341014c in git for modules/PhotonID.cc


Ignore:
Timestamp:
Feb 12, 2019, 9:29:17 PM (6 years ago)
Author:
Pavel Demin <pavel-demin@…>
Branches:
ImprovedOutputFile, Timing, llp, master
Children:
6455202
Parents:
45e58be
Message:

apply .clang-format to all .h, .cc and .cpp files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/PhotonID.cc

    r45e58be r341014c  
    1717 */
    1818
    19 
    2019/** \class PhotonID
    2120 *
     
    3433#include "classes/DelphesFormula.h"
    3534
     35#include "ExRootAnalysis/ExRootClassifier.h"
     36#include "ExRootAnalysis/ExRootFilter.h"
    3637#include "ExRootAnalysis/ExRootResult.h"
    37 #include "ExRootAnalysis/ExRootFilter.h"
    38 #include "ExRootAnalysis/ExRootClassifier.h"
    39 
     38
     39#include "TDatabasePDG.h"
     40#include "TFormula.h"
     41#include "TLorentzVector.h"
    4042#include "TMath.h"
     43#include "TObjArray.h"
     44#include "TRandom3.h"
    4145#include "TString.h"
    42 #include "TFormula.h"
    43 #include "TRandom3.h"
    44 #include "TObjArray.h"
    45 #include "TDatabasePDG.h"
    46 #include "TLorentzVector.h"
    47 
    48 #include <algorithm>
    49 #include <stdexcept>
     46
     47#include <algorithm>
    5048#include <iostream>
    5149#include <sstream>
     50#include <stdexcept>
    5251
    5352using namespace std;
     
    5655
    5756PhotonID::PhotonID() :
    58   fPromptFormula(0), fNonPromptFormula(0), fFakeFormula(0), fItInputPhotonArray(0),  fItInputGenArray(0)
    59 {
    60  fPromptFormula = new DelphesFormula;
    61  fNonPromptFormula = new DelphesFormula;
    62  fFakeFormula = new DelphesFormula;
     57  fPromptFormula(0), fNonPromptFormula(0), fFakeFormula(0), fItInputPhotonArray(0), fItInputGenArray(0)
     58{
     59  fPromptFormula = new DelphesFormula;
     60  fNonPromptFormula = new DelphesFormula;
     61  fFakeFormula = new DelphesFormula;
    6362}
    6463
     
    8180  fNonPromptFormula->Compile(GetString("NonPromptFormula", "1.0"));
    8281  fFakeFormula->Compile(GetString("FakeFormula", "1.0"));
    83  
     82
    8483  // import input arrays
    8584  fInputPhotonArray = ImportArray(GetString("InputPhotonArray", "PhotonIsolation/photons"));
     
    111110
    112111void PhotonID::Process()
    113 { 
     112{
    114113  Candidate *candidate, *mother;
    115114  Double_t pt, eta, phi, e;
    116115  Double_t relIso;
    117116  Bool_t isolated;
    118  
     117
    119118  //cout<< "----  new event ---------"<<endl;
    120119
    121120  fItInputPhotonArray->Reset();
    122   while((candidate = static_cast<Candidate*>(fItInputPhotonArray->Next())))
     121  while((candidate = static_cast<Candidate *>(fItInputPhotonArray->Next())))
    123122  {
    124123
    125124    mother = candidate;
    126     candidate = static_cast<Candidate*>(candidate->Clone());
     125    candidate = static_cast<Candidate *>(candidate->Clone());
    127126    candidate->AddCandidate(mother);
    128127
     
    134133    e = candidateMomentum.E();
    135134
    136     if (pt < fPTMin) continue;
     135    if(pt < fPTMin) continue;
    137136
    138137    //cout<< "              ---- photon -----: "<<pt<<","<<eta<<","<<phi<<endl;
    139    
     138
    140139    // find out if photon matches does not match photon in gen collection and apply fae efficiency
    141     if (isFake(candidate) )
     140    if(isFake(candidate))
    142141    {
    143142      //cout<<"                    Fake!"<<endl;
     
    157156
    158157      // if isolated apply prompt formula
    159       if (isolated)
     158      if(isolated)
    160159      {
    161160        //cout<<"                       isolated!:   "<<relIso<<endl;
     
    164163        candidate->Status = 1;
    165164        fOutputArray->Add(candidate);
    166        
    167165      }
    168      
     166
    169167      // if non-isolated apply non-prompt formula
    170168      else
     
    182180//------------------------------------------------------------------------------
    183181
    184 Bool_t PhotonID::isFake(const Candidate *obj){
     182Bool_t PhotonID::isFake(const Candidate *obj)
     183{
    185184
    186185  const TLorentzVector &mom_rec = obj->Momentum;
    187  
     186
    188187  Bool_t matches = false;
    189188  fItInputGenArray->Reset();
    190189  Candidate *gen;
    191  
    192   while((gen = static_cast<Candidate*>(fItInputGenArray->Next())))
     190
     191  while((gen = static_cast<Candidate *>(fItInputGenArray->Next())))
    193192  {
    194193    const TLorentzVector &mom_gen = gen->Momentum;
    195194    Int_t status = gen->Status;
    196195    Int_t pdgCode = TMath::Abs(gen->PID);
    197     Float_t dPtOverPt = TMath::Abs((mom_gen.Pt() - mom_rec.Pt())/mom_rec.Pt());
     196    Float_t dPtOverPt = TMath::Abs((mom_gen.Pt() - mom_rec.Pt()) / mom_rec.Pt());
    198197    Float_t deltaR = mom_gen.DeltaR(mom_rec);
    199198
    200     if (status != 1) continue;
    201     if (pdgCode != 22) continue;
    202     if (dPtOverPt > 0.5) continue;
    203     if (deltaR > 0.1) continue;
     199    if(status != 1) continue;
     200    if(pdgCode != 22) continue;
     201    if(dPtOverPt > 0.5) continue;
     202    if(deltaR > 0.1) continue;
    204203
    205204    matches = true;
    206205    break;
    207 
    208206  }
    209207
Note: See TracChangeset for help on using the changeset viewer.