Fork me on GitHub

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/TrackCountingTauTagging.cc

    r45e58be r341014c  
    2020#include "classes/DelphesFormula.h"
    2121
     22#include "ExRootAnalysis/ExRootClassifier.h"
     23#include "ExRootAnalysis/ExRootFilter.h"
    2224#include "ExRootAnalysis/ExRootResult.h"
    23 #include "ExRootAnalysis/ExRootFilter.h"
    24 #include "ExRootAnalysis/ExRootClassifier.h"
    25 
     25
     26#include "TDatabasePDG.h"
     27#include "TFormula.h"
     28#include "TLorentzVector.h"
    2629#include "TMath.h"
     30#include "TObjArray.h"
     31#include "TRandom3.h"
    2732#include "TString.h"
    28 #include "TFormula.h"
    29 #include "TRandom3.h"
    30 #include "TObjArray.h"
    31 #include "TDatabasePDG.h"
    32 #include "TLorentzVector.h"
    3333
    3434#include <algorithm>
    35 #include <stdexcept>
    3635#include <iostream>
    3736#include <sstream>
     37#include <stdexcept>
    3838
    3939using namespace std;
     
    4444{
    4545public:
    46 
    4746  TrackCountingTauTaggingPartonClassifier(const TObjArray *array);
    4847
     
    6766  Candidate *daughter1 = 0;
    6867  Candidate *daughter2 = 0;
    69  
     68
    7069  const TLorentzVector &momentum = tau->Momentum;
    7170  Int_t pdgCode, i, j;
     
    8079  if(tau->D2 < tau->D1) return -1;
    8180
    82   if(tau->D1 >= fParticleInputArray->GetEntriesFast() ||
    83      tau->D2 >= fParticleInputArray->GetEntriesFast())
     81  if(tau->D1 >= fParticleInputArray->GetEntriesFast() || tau->D2 >= fParticleInputArray->GetEntriesFast())
    8482  {
    8583    throw runtime_error("tau's daughter index is greater than the ParticleInputArray size");
     
    9088    daughter1 = static_cast<Candidate *>(fParticleInputArray->At(i));
    9189    pdgCode = TMath::Abs(daughter1->PID);
    92     if(pdgCode == 11 || pdgCode == 13 || pdgCode == 15) return -1;
     90    if(pdgCode == 11 || pdgCode == 13 || pdgCode == 15)
     91      return -1;
    9392    else if(pdgCode == 24)
    9493    {
    95      if(daughter1->D1 < 0) return -1;
    96      for(j = daughter1->D1; j <= daughter1->D2; ++j)
    97      {
    98        daughter2 = static_cast<Candidate*>(fParticleInputArray->At(j));
    99        pdgCode = TMath::Abs(daughter2->PID);
    100        if(pdgCode == 11 || pdgCode == 13) return -1;
    101      }
    102        
     94      if(daughter1->D1 < 0) return -1;
     95      for(j = daughter1->D1; j <= daughter1->D2; ++j)
     96      {
     97        daughter2 = static_cast<Candidate *>(fParticleInputArray->At(j));
     98        pdgCode = TMath::Abs(daughter2->PID);
     99        if(pdgCode == 11 || pdgCode == 13) return -1;
     100      }
    103101    }
    104102  }
     
    125123void TrackCountingTauTagging::Init()
    126124{
    127   map< Int_t, DelphesFormula * >::iterator itEfficiencyMap;
     125  map<Int_t, DelphesFormula *>::iterator itEfficiencyMap;
    128126  ExRootConfParam param;
    129127  DelphesFormula *formula;
     
    135133  fDeltaRTrack = GetDouble("DeltaRTrack", 0.2);
    136134  fTrackPTMin = GetDouble("TrackPTMin", 1.0);
    137  
     135
    138136  // read efficiency formulas
    139137  param = GetParam("EfficiencyFormula");
     
    141139
    142140  fEfficiencyMap.clear();
    143   for(i = 0; i < size/2; ++i)
     141  for(i = 0; i < size / 2; ++i)
    144142  {
    145143    formula = new DelphesFormula;
    146     formula->Compile(param[i*2 + 1].GetString());
    147 
    148     fEfficiencyMap[param[i*2].GetInt()] = formula;
     144    formula->Compile(param[i * 2 + 1].GetString());
     145
     146    fEfficiencyMap[param[i * 2].GetInt()] = formula;
    149147  }
    150148
     
    172170  fTrackInputArray = ImportArray(GetString("TrackInputArray", "TrackMerger/tracks"));
    173171  fItTrackInputArray = fTrackInputArray->MakeIterator();
    174  
     172
    175173  fFilter = new ExRootFilter(fPartonInputArray);
    176174
     
    183181void TrackCountingTauTagging::Finish()
    184182{
    185   map< Int_t, DelphesFormula * >::iterator itEfficiencyMap;
     183  map<Int_t, DelphesFormula *>::iterator itEfficiencyMap;
    186184  DelphesFormula *formula;
    187185
     
    207205  Double_t pt, eta, phi, e;
    208206  TObjArray *tauArray;
    209   map< Int_t, DelphesFormula * >::iterator itEfficiencyMap;
     207  map<Int_t, DelphesFormula *>::iterator itEfficiencyMap;
    210208  DelphesFormula *formula;
    211209  Int_t pdgCode, charge, i, identifier;
     
    232230    e = jetMomentum.E();
    233231
    234 
    235 // loop over all input tracks
     232    // loop over all input tracks
    236233    fItTrackInputArray->Reset();
    237234    while((track = static_cast<Candidate *>(fItTrackInputArray->Next())))
    238235    {
    239         if((track->Momentum).Pt() < fTrackPTMin) continue;
    240         if(jetMomentum.DeltaR(track->Momentum) <= fDeltaRTrack) {
    241             identifier -= 1;
    242             charge += track->Charge;
    243         }
    244     }
    245    
     236      if((track->Momentum).Pt() < fTrackPTMin) continue;
     237      if(jetMomentum.DeltaR(track->Momentum) <= fDeltaRTrack)
     238      {
     239        identifier -= 1;
     240        charge += track->Charge;
     241      }
     242    }
     243
    246244    // loop over all input taus
    247245    itTauArray.Reset();
     
    251249      if(tau->D1 < 0) continue;
    252250
    253       if(tau->D1 >= fParticleInputArray->GetEntriesFast() ||
    254          tau->D2 >= fParticleInputArray->GetEntriesFast())
     251      if(tau->D1 >= fParticleInputArray->GetEntriesFast() || tau->D2 >= fParticleInputArray->GetEntriesFast())
    255252      {
    256253        throw runtime_error("tau's daughter index is greater than the ParticleInputArray size");
     
    263260        daughter = static_cast<Candidate *>(fParticleInputArray->At(i));
    264261        if(TMath::Abs(daughter->PID) == 16) continue;
    265         tauMomentum += daughter->Momentum; 
     262        tauMomentum += daughter->Momentum;
    266263      }
    267264
    268265      if(jetMomentum.DeltaR(tauMomentum) <= fDeltaR)
    269       {       
     266      {
    270267        matchedTau = true;
    271268        pdgCode = 15;
     
    273270    }
    274271    if(matchedTau)
    275         identifier *= -1;
     272      identifier *= -1;
    276273    // find an efficency formula
    277274    // If the identifier is larger than 2, set it to 2 (multiprong requires at least 2 tracks)
    278     if (identifier > 2)
    279         identifier = 2;
    280     else if (identifier < -2)
    281         identifier = -2;
    282 
    283    
     275    if(identifier > 2)
     276      identifier = 2;
     277    else if(identifier < -2)
     278      identifier = -2;
     279
    284280    itEfficiencyMap = fEfficiencyMap.find(identifier);
    285281    if(itEfficiencyMap == fEfficiencyMap.end())
     
    293289    // apply an efficency formula
    294290    jet->TauTag |= (gRandom->Uniform() <= formula->Eval(pt, eta, phi, e)) << fBitNumber;
    295    
    296    
     291
    297292    // set tau charge
    298293    jet->Charge = charge;
Note: See TracChangeset for help on using the changeset viewer.