Fork me on GitHub

Changeset fe0273c in git


Ignore:
Timestamp:
Jun 26, 2015, 12:08:48 PM (9 years ago)
Author:
Pavel Demin <pavel.demin@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
28027d5
Parents:
d38348d
Message:

merge BTagging and BTaggingCMS

Files:
2 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • Makefile

    rd38348d rfe0273c  
    322322        modules/UniqueObjectFinder.h \
    323323        modules/TrackCountingBTagging.h \
    324         modules/BTaggingCMS.h \
    325324        modules/BTagging.h \
    326325        modules/TauTagging.h \
     
    546545        external/ExRootAnalysis/ExRootFilter.h \
    547546        external/ExRootAnalysis/ExRootClassifier.h
    548 tmp/modules/BTaggingCMS.$(ObjSuf): \
    549         modules/BTaggingCMS.$(SrcSuf) \
    550         modules/BTaggingCMS.h \
    551         classes/DelphesClasses.h \
    552         classes/DelphesFactory.h \
    553         classes/DelphesFormula.h \
    554         external/ExRootAnalysis/ExRootResult.h \
    555         external/ExRootAnalysis/ExRootFilter.h \
    556         external/ExRootAnalysis/ExRootClassifier.h
    557547tmp/modules/Calorimeter.$(ObjSuf): \
    558548        modules/Calorimeter.$(SrcSuf) \
     
    907897        tmp/modules/AngularSmearing.$(ObjSuf) \
    908898        tmp/modules/BTagging.$(ObjSuf) \
    909         tmp/modules/BTaggingCMS.$(ObjSuf) \
    910899        tmp/modules/Calorimeter.$(ObjSuf) \
    911900        tmp/modules/Cloner.$(ObjSuf) \
     
    13961385        display/Delphes3DGeometry.$(SrcSuf) \
    13971386        display/Delphes3DGeometry.h \
    1398         external/ExRootAnalysis/ExRootConfReader.h \
    1399         classes/DelphesClasses.h
     1387        classes/DelphesClasses.h \
     1388        external/ExRootAnalysis/ExRootConfReader.h
    14001389tmp/display/DelphesBranchElement.$(ObjSuf): \
    14011390        display/DelphesBranchElement.$(SrcSuf) \
     
    14101399tmp/display/DelphesEventDisplay.$(ObjSuf): \
    14111400        display/DelphesEventDisplay.$(SrcSuf) \
    1412         external/ExRootAnalysis/ExRootConfReader.h \
    1413         external/ExRootAnalysis/ExRootTreeReader.h \
    14141401        display/DelphesCaloData.h \
    14151402        display/DelphesBranchElement.h \
    14161403        display/Delphes3DGeometry.h \
    14171404        display/DelphesEventDisplay.h \
    1418         classes/DelphesClasses.h
     1405        display/DelphesDisplay.h \
     1406        display/Delphes3DGeometry.h \
     1407        display/DelphesHtmlSummary.h \
     1408        display/DelphesPlotSummary.h \
     1409        classes/DelphesClasses.h \
     1410        external/ExRootAnalysis/ExRootConfReader.h \
     1411        external/ExRootAnalysis/ExRootTreeReader.h
    14191412tmp/display/DelphesHtmlSummary.$(ObjSuf): \
    14201413        display/DelphesHtmlSummary.$(SrcSuf) \
     
    17371730        @touch $@
    17381731
    1739 display/DelphesEventDisplay.h: \
    1740         external/ExRootAnalysis/ExRootTreeReader.h \
    1741         display/DelphesDisplay.h \
    1742         display/Delphes3DGeometry.h \
    1743         display/DelphesHtmlSummary.h \
    1744         display/DelphesPlotSummary.h
    1745         @touch $@
    1746 
    17471732modules/TauTagging.h: \
    17481733        classes/DelphesModule.h \
     
    17711756modules/UniqueObjectFinder.h: \
    17721757        classes/DelphesModule.h
    1773         @touch $@
    1774 
    1775 modules/BTaggingCMS.h: \
    1776         classes/DelphesModule.h \
    1777         classes/DelphesClasses.h
    17781758        @touch $@
    17791759
  • classes/DelphesClasses.cc

    rd38348d rfe0273c  
    121121  Charge(0), Mass(0.0),
    122122  IsPU(0), IsRecoPU(0), IsConstituent(0),
    123   BTag(0), BTagAlgo(0), BTagDefault(0), BTagPhysics(0), BTagNearest2(0), BTagNearest3(0), BTagHeaviest(0), BTagHighestPt(0),
    124   FlavorAlgo(0), FlavorDefault(0), FlavorPhysics(0), FlavorNearest2(0), FlavorNearest3(0), FlavorHeaviest(0), FlavorHighestPt(0),
     123  Flavor(0), FlavorAlgo(0), FlavorPhys(0),
     124  BTag(0), BTagAlgo(0), BTagPhys(0),
    125125  TauTag(0), Eem(0.0), Ehad(0.0),
    126126  DeltaEta(0.0), DeltaPhi(0.0),
     
    243243  object.IsPU = IsPU;
    244244  object.IsConstituent = IsConstituent;
     245  object.Flavor = Flavor;
     246  object.FlavorAlgo = FlavorAlgo;
     247  object.FlavorPhys = FlavorPhys;
    245248  object.BTag = BTag;
    246249  object.BTagAlgo = BTagAlgo;
    247   object.BTagDefault = BTagDefault;
    248   object.BTagPhysics = BTagPhysics;
    249   object.BTagNearest2 = BTagNearest2;
    250   object.BTagNearest3 = BTagNearest3;
    251   object.BTagHeaviest = BTagHeaviest;
    252   object.BTagHighestPt = BTagHighestPt;
    253   object.FlavorAlgo = FlavorAlgo;
    254   object.FlavorDefault = FlavorDefault;
    255   object.FlavorPhysics = FlavorPhysics;
    256   object.FlavorNearest2 = FlavorNearest2;
    257   object.FlavorNearest3 = FlavorNearest3;
    258   object.FlavorHeaviest = FlavorHeaviest;
    259   object.FlavorHighestPt = FlavorHighestPt;
     250  object.BTagPhys = BTagPhys;
    260251  object.TauTag = TauTag;
    261252  object.Eem = Eem;
     
    352343  IsPU = 0;
    353344  IsConstituent = 0;
     345  Flavor = 0;
     346  FlavorAlgo = 0;
     347  FlavorPhys = 0;
    354348  BTag = 0;
    355349  BTagAlgo = 0;
    356   BTagDefault = 0;
    357   BTagPhysics = 0;
    358   BTagNearest2 = 0;
    359   BTagNearest3 = 0;
    360   BTagHeaviest = 0;
    361   BTagHighestPt = 0;
    362   FlavorAlgo = 0;
    363   FlavorDefault = 0;
    364   FlavorPhysics = 0;
    365   FlavorNearest2 = 0;
    366   FlavorNearest3 = 0;
    367   FlavorHeaviest = 0;
    368   FlavorHighestPt = 0;
     350  BTagPhys = 0;
    369351  TauTag = 0;
    370352  Eem = 0.0;
  • classes/DelphesClasses.h

    rd38348d rfe0273c  
    344344  Float_t DeltaPhi;  // jet radius in azimuthal angle
    345345
     346  UInt_t Flavor;
     347  UInt_t FlavorAlgo;
     348  UInt_t FlavorPhys;
     349
    346350  UInt_t BTag; // 0 or 1 for a jet that has been tagged as containing a heavy quark
    347 
    348351  UInt_t BTagAlgo;
    349   UInt_t BTagDefault;
    350   UInt_t BTagPhysics;
    351   UInt_t BTagNearest2;
    352   UInt_t BTagNearest3;
    353   UInt_t BTagHeaviest;
    354   UInt_t BTagHighestPt;
    355 
    356   UInt_t FlavorAlgo;
    357   UInt_t FlavorDefault;
    358   UInt_t FlavorPhysics;
    359   UInt_t FlavorNearest2;
    360   UInt_t FlavorNearest3;
    361   UInt_t FlavorHeaviest;
    362   UInt_t FlavorHighestPt;
     352  UInt_t BTagPhys;
    363353
    364354  UInt_t TauTag; // 0 or 1 for a jet that has been tagged as a tau
     
    517507  Int_t IsConstituent;
    518508
     509  UInt_t Flavor;
     510  UInt_t FlavorAlgo;
     511  UInt_t FlavorPhys;
     512
    519513  UInt_t BTag;
    520 
    521514  UInt_t BTagAlgo;
    522   UInt_t BTagDefault;
    523   UInt_t BTagPhysics;
    524   UInt_t BTagNearest2;
    525   UInt_t BTagNearest3;
    526   UInt_t BTagHeaviest;
    527   UInt_t BTagHighestPt;
    528 
    529   UInt_t FlavorAlgo;
    530   UInt_t FlavorDefault;
    531   UInt_t FlavorPhysics;
    532   UInt_t FlavorNearest2;
    533   UInt_t FlavorNearest3;
    534   UInt_t FlavorHeaviest;
    535   UInt_t FlavorHighestPt;
     515  UInt_t BTagPhys;
    536516
    537517  UInt_t TauTag;
  • modules/BTagging.cc

    rd38348d rfe0273c  
    2222 *  Determines origin of jet,
    2323 *  applies b-tagging efficiency (miss identification rate) formulas
    24  *  and sets b-tagging flags 
     24 *  and sets b-tagging flags
    2525 *
    2626 *  \author P. Demin - UCL, Louvain-la-Neuve
     
    4646#include "TLorentzVector.h"
    4747
    48 #include <algorithm> 
     48#include <algorithm>
    4949#include <stdexcept>
    5050#include <iostream>
     
    6262
    6363  Int_t GetCategory(TObject *object);
    64  
     64
    6565  Double_t fEtaMax, fPTMin;
    6666};
     
    7575
    7676  if(momentum.Pt() <= fPTMin || TMath::Abs(momentum.Eta()) > fEtaMax) return -1;
    77  
     77
    7878  pdgCode = TMath::Abs(parton->PID);
    7979  if(pdgCode != 21 && pdgCode > 5) return -1;
     
    117117  param = GetParam("EfficiencyFormula");
    118118  size = param.GetSize();
    119  
     119
    120120  fEfficiencyMap.clear();
    121121  for(i = 0; i < size/2; ++i)
     
    143143
    144144  fFilter = new ExRootFilter(fPartonInputArray);
    145  
     145
    146146  fJetInputArray = ImportArray(GetString("JetInputArray", "FastJetFinder/jets"));
    147147  fItJetInputArray = fJetInputArray->MakeIterator();
     
    170170void BTagging::Process()
    171171{
    172   Candidate *jet, *parton;
     172  Candidate *jet;
    173173  Double_t pt, eta, phi, e;
    174174  TObjArray *partonArray;
    175175  map< Int_t, DelphesFormula * >::iterator itEfficiencyMap;
    176176  DelphesFormula *formula;
    177   Int_t pdgCode, pdgCodeMax;
    178177
    179178  // select quark and gluons
    180179  fFilter->Reset();
    181180  partonArray = fFilter->GetSubArray(fClassifier, 0);
    182  
     181
    183182  if(partonArray == 0) return;
    184183
    185184  TIter itPartonArray(partonArray);
    186  
     185
    187186  // loop over all input jets
    188187  fItJetInputArray->Reset();
     
    190189  {
    191190    const TLorentzVector &jetMomentum = jet->Momentum;
    192     pdgCodeMax = -1;
    193191    eta = jetMomentum.Eta();
    194192    phi = jetMomentum.Phi();
    195193    pt = jetMomentum.Pt();
    196194    e = jetMomentum.E();
    197    
    198     // loop over all input partons
    199     itPartonArray.Reset();
    200     while((parton = static_cast<Candidate*>(itPartonArray.Next())))
    201     {
    202       pdgCode = TMath::Abs(parton->PID);
    203       if(pdgCode == 21) pdgCode = 0;
    204       if(jetMomentum.DeltaR(parton->Momentum) <= fDeltaR)
    205       {
    206         if(pdgCodeMax < pdgCode) pdgCodeMax = pdgCode;
    207       }
    208     }
    209     if(pdgCodeMax == 0) pdgCodeMax = 21;
    210     if(pdgCodeMax == -1) pdgCodeMax = 0;
    211195
    212196    // find an efficency formula
    213     itEfficiencyMap = fEfficiencyMap.find(pdgCodeMax);
     197    itEfficiencyMap = fEfficiencyMap.find(jet->Flavor);
    214198    if(itEfficiencyMap == fEfficiencyMap.end())
    215199    {
     
    220204    // apply an efficency formula
    221205    jet->BTag |= (gRandom->Uniform() <= formula->Eval(pt, eta, phi, e)) << fBitNumber;
    222   }
    223 }
    224 
    225 //------------------------------------------------------------------------------
     206
     207    // find an efficency formula for algo flavor definition
     208    itEfficiencyMap = fEfficiencyMap.find(jet->FlavorAlgo);
     209    if(itEfficiencyMap == fEfficiencyMap.end())
     210    {
     211      itEfficiencyMap = fEfficiencyMap.find(0);
     212    }
     213    formula = itEfficiencyMap->second;
     214
     215    // apply an efficency formula
     216    jet->BTagAlgo |= (gRandom->Uniform() <= formula->Eval(pt, eta, phi, e)) << fBitNumber;
     217
     218    // find an efficency formula for phys flavor definition
     219    itEfficiencyMap = fEfficiencyMap.find(jet->FlavorPhys);
     220    if(itEfficiencyMap == fEfficiencyMap.end())
     221    {
     222      itEfficiencyMap = fEfficiencyMap.find(0);
     223    }
     224    formula = itEfficiencyMap->second;
     225
     226    // apply an efficency formula
     227    jet->BTagPhys |= (gRandom->Uniform() <= formula->Eval(pt, eta, phi, e)) << fBitNumber;
     228  }
     229}
     230
     231//------------------------------------------------------------------------------
  • modules/JetFlavorAssociation.cc

    rd38348d rfe0273c  
    216216{
    217217  float maxPt = 0;
    218   float minDr = 1000;
    219218  bool isGoodParton = true;
    220219  int daughterCounter = 0;
    221220  Candidate *parton, *partonLHEF;
    222   Candidate *tempParton = 0, *tempPartonNearest = 0, *tempPartonHighestPt = 0;
     221  Candidate *tempParton = 0, *tempPartonHighestPt = 0;
    223222  int pdgCode, pdgCodeMax = -1;
    224223
     
    263262      if(jet->Momentum.DeltaR(parton->Momentum) <= fDeltaR)
    264263      {
    265         if(jet->Momentum.DeltaR(parton->Momentum) < minDr)
    266         {
    267           minDr = jet->Momentum.DeltaR(parton->Momentum);
    268           tempPartonNearest = parton;
    269         }
    270 
    271264        // if not yet found && pdgId is a c, take as c
    272265        if(TMath::Abs(parton->PID) == 4) tempParton = parton;
     
    281274  }
    282275
    283   jet->FlavorHeaviest = tempParton ? TMath::Abs(tempParton->PID) : 0;
    284   jet->FlavorHighestPt = tempPartonHighestPt ? TMath::Abs(tempPartonHighestPt->PID) : 0;
    285   jet->FlavorNearest2 = tempPartonNearest ? TMath::Abs(tempPartonNearest->PID) : 0;
    286276  if(!tempParton) tempParton = tempPartonHighestPt;
    287277  jet->FlavorAlgo = tempParton ? TMath::Abs(tempParton->PID) : 0;
     
    290280  if(pdgCodeMax == -1) pdgCodeMax = 0;
    291281
    292   jet->FlavorDefault = pdgCodeMax;
     282  jet->Flavor = pdgCodeMax;
    293283}
    294284
     
    297287void JetFlavorAssociation::GetPhysicsFlavor(Candidate *jet, TIter &itPartonArray, TIter &itPartonLHEFArray)
    298288{
    299   float minDr = 1000;
    300289  int partonCounter = 0;
    301290  float biggerConeSize = 0.7;
     
    305294  int motherCounter = 0;
    306295  Candidate *parton, *partonLHEF, *mother1, *mother2;
    307   Candidate *tempParton = 0, *tempPartonNearest = 0;
     296  Candidate *tempParton = 0;
    308297  vector<Candidate *> contaminations;
    309298  vector<Candidate *>::iterator itContaminations;
     
    315304  {
    316305    dist = jet->Momentum.DeltaR(partonLHEF->Momentum); // take the DR
    317     if(partonLHEF->Status == 1 && dist < minDr)
    318     {
    319       tempPartonNearest = partonLHEF;
    320       minDr = dist;
    321     }
    322306
    323307    if(partonLHEF->Status == 1 && dist <= fDeltaR)
     
    354338  }
    355339
    356   jet->FlavorNearest3 = tempPartonNearest ? TMath::Abs(tempPartonNearest->PID) : 0;
    357 
    358340  if(partonCounter != 1)
    359341  {
    360     jet->FlavorPhysics = 0;
     342    jet->FlavorPhys = 0;
    361343  }
    362344  else if(contaminations.size() == 0)
    363345  {
    364     jet->FlavorPhysics = TMath::Abs(tempParton->PID);
     346    jet->FlavorPhys = TMath::Abs(tempParton->PID);
    365347  }
    366348  else if(contaminations.size() > 0)
    367349  {
    368     jet->FlavorPhysics = TMath::Abs(tempParton->PID);
     350    jet->FlavorPhys = TMath::Abs(tempParton->PID);
    369351
    370352    for(itContaminations = contaminations.begin(); itContaminations != contaminations.end(); ++itContaminations)
     
    391373        // keep association --> the initialParton is a c --> the contaminated parton is a c
    392374        if(contaminatingFlavor == 4) continue;
    393         jet->FlavorPhysics = 0; // all the other cases reject!
     375        jet->FlavorPhys = 0; // all the other cases reject!
    394376        break;
    395377      }
  • modules/ModulesLinkDef.h

    rd38348d rfe0273c  
    4242#include "modules/UniqueObjectFinder.h"
    4343#include "modules/TrackCountingBTagging.h"
    44 #include "modules/BTaggingCMS.h"
    4544#include "modules/BTagging.h"
    4645#include "modules/TauTagging.h"
     
    8584#pragma link C++ class UniqueObjectFinder+;
    8685#pragma link C++ class TrackCountingBTagging+;
    87 #pragma link C++ class BTaggingCMS+;
    8886#pragma link C++ class BTagging+;
    8987#pragma link C++ class TauTagging+;
  • modules/TreeWriter.cc

    rd38348d rfe0273c  
    490490    const TLorentzVector &position = candidate->Position;
    491491
    492 
    493492    pt = momentum.Pt();
    494493    cosTheta = TMath::Abs(momentum.CosTheta());
     
    567566    entry->DeltaPhi = candidate->DeltaPhi;
    568567
     568    entry->Flavor = candidate->Flavor;
     569    entry->FlavorAlgo = candidate->FlavorAlgo;
     570    entry->FlavorPhys = candidate->FlavorPhys;
     571
    569572    entry->BTag = candidate->BTag;
    570573
    571574    entry->BTagAlgo = candidate->BTagAlgo;
    572     entry->BTagDefault = candidate->BTagDefault;
    573     entry->BTagPhysics = candidate->BTagPhysics;
    574     entry->BTagNearest2 = candidate->BTagNearest2;
    575     entry->BTagNearest3 = candidate->BTagNearest3;
    576     entry->BTagHeaviest = candidate->BTagHeaviest;
    577     entry->BTagHighestPt = candidate->BTagHighestPt;
    578 
    579     entry->FlavorAlgo = candidate->FlavorAlgo;
    580     entry->FlavorDefault = candidate->FlavorDefault;
    581     entry->FlavorPhysics = candidate->FlavorPhysics;
    582     entry->FlavorNearest2 = candidate->FlavorNearest2;
    583     entry->FlavorNearest3 = candidate->FlavorNearest3;
    584     entry->FlavorHeaviest = candidate->FlavorHeaviest;
    585     entry->FlavorHighestPt = candidate->FlavorHighestPt;
     575    entry->BTagPhys = candidate->BTagPhys;
    586576
    587577    entry->TauTag = candidate->TauTag;
Note: See TracChangeset for help on using the changeset viewer.