[a0431dc] | 1 |
|
---|
| 2 | /** \class TrackCountingBTagging
|
---|
| 3 | *
|
---|
| 4 | * btagging algorithm based on counting tracks with large impact parameterDetermines origin of jet,
|
---|
| 5 | *
|
---|
| 6 | * $Date: 2014-03-27 12:39:14 +0200 (Fri, 27 March 2014) $
|
---|
| 7 | * $Revision: 1099 $
|
---|
| 8 | *
|
---|
| 9 | *
|
---|
| 10 | * \author M. Selvaggi - UCL, Louvain-la-Neuve
|
---|
| 11 | *
|
---|
| 12 | */
|
---|
| 13 |
|
---|
| 14 | #include "modules/TrackCountingBTagging.h"
|
---|
| 15 |
|
---|
| 16 | #include "classes/DelphesClasses.h"
|
---|
| 17 | #include "classes/DelphesFactory.h"
|
---|
| 18 | #include "classes/DelphesFormula.h"
|
---|
| 19 |
|
---|
| 20 | #include "TMath.h"
|
---|
| 21 | #include "TString.h"
|
---|
| 22 | #include "TFormula.h"
|
---|
| 23 | #include "TRandom3.h"
|
---|
| 24 | #include "TObjArray.h"
|
---|
| 25 | #include "TLorentzVector.h"
|
---|
| 26 |
|
---|
| 27 | #include <algorithm>
|
---|
| 28 | #include <stdexcept>
|
---|
| 29 | #include <iostream>
|
---|
| 30 | #include <sstream>
|
---|
| 31 |
|
---|
| 32 | using namespace std;
|
---|
| 33 |
|
---|
| 34 |
|
---|
| 35 | //------------------------------------------------------------------------------
|
---|
| 36 |
|
---|
| 37 | TrackCountingBTagging::TrackCountingBTagging() :
|
---|
| 38 | fItTrackInputArray(0), fItJetInputArray(0)
|
---|
| 39 | {
|
---|
| 40 | }
|
---|
| 41 |
|
---|
| 42 | //------------------------------------------------------------------------------
|
---|
| 43 |
|
---|
| 44 | TrackCountingBTagging::~TrackCountingBTagging()
|
---|
| 45 | {
|
---|
| 46 | }
|
---|
| 47 |
|
---|
| 48 | //------------------------------------------------------------------------------
|
---|
| 49 |
|
---|
| 50 | void TrackCountingBTagging::Init()
|
---|
| 51 | {
|
---|
| 52 |
|
---|
| 53 | fBitNumber = GetInt("BitNumber", 0);
|
---|
| 54 |
|
---|
| 55 | fPtMin = GetDouble("TrackPtMin", 1.0);
|
---|
| 56 | fDeltaR = GetDouble("DeltaR", 0.3);
|
---|
| 57 | fIPmax = GetDouble("TrackIPMax", 2.0);
|
---|
| 58 |
|
---|
| 59 | fSigMin = GetDouble("SigMin", 6.5);
|
---|
| 60 | fNtracks = GetInt("Ntracks", 3);
|
---|
| 61 |
|
---|
| 62 | // import input array(s)
|
---|
| 63 |
|
---|
| 64 | fTrackInputArray = ImportArray(GetString("TrackInputArray", "Calorimeter/eflowTracks"));
|
---|
| 65 | fItTrackInputArray = fTrackInputArray->MakeIterator();
|
---|
| 66 |
|
---|
| 67 | fJetInputArray = ImportArray(GetString("JetInputArray", "FastJetFinder/jets"));
|
---|
| 68 | fItJetInputArray = fJetInputArray->MakeIterator();
|
---|
| 69 | }
|
---|
| 70 |
|
---|
| 71 | //------------------------------------------------------------------------------
|
---|
| 72 |
|
---|
| 73 | void TrackCountingBTagging::Finish()
|
---|
| 74 | {
|
---|
| 75 | if(fItTrackInputArray) delete fItTrackInputArray;
|
---|
| 76 | if(fItJetInputArray) delete fItJetInputArray;
|
---|
| 77 | }
|
---|
| 78 |
|
---|
| 79 | //------------------------------------------------------------------------------
|
---|
| 80 |
|
---|
| 81 | void TrackCountingBTagging::Process()
|
---|
| 82 | {
|
---|
| 83 | Candidate *jet, *track;
|
---|
| 84 |
|
---|
| 85 | Double_t jpx, jpy;
|
---|
| 86 | Double_t dr, tpx, tpy, tpt;
|
---|
| 87 | Double_t xd, yd, dxy, ddxy, ip, sip;
|
---|
| 88 |
|
---|
| 89 | Int_t sign;
|
---|
| 90 |
|
---|
| 91 | Int_t count;
|
---|
| 92 |
|
---|
| 93 | // loop over all input jets
|
---|
| 94 | fItJetInputArray->Reset();
|
---|
| 95 | while((jet = static_cast<Candidate*>(fItJetInputArray->Next())))
|
---|
| 96 | {
|
---|
| 97 | const TLorentzVector &jetMomentum = jet->Momentum;
|
---|
| 98 | jpx = jetMomentum.Px();
|
---|
| 99 | jpy = jetMomentum.Py();
|
---|
| 100 |
|
---|
| 101 | // loop over all input tracks
|
---|
| 102 | fItTrackInputArray->Reset();
|
---|
| 103 | count = 0;
|
---|
| 104 | while((track = static_cast<Candidate*>(fItTrackInputArray->Next())))
|
---|
| 105 | {
|
---|
| 106 | const TLorentzVector &trkMomentum = track->Momentum;
|
---|
| 107 |
|
---|
| 108 | dr = jetMomentum.DeltaR(trkMomentum);
|
---|
| 109 |
|
---|
| 110 | tpt = trkMomentum.Pt();
|
---|
| 111 | tpx = trkMomentum.Px();
|
---|
| 112 | tpy = trkMomentum.Py();
|
---|
| 113 |
|
---|
| 114 | xd = track->Xd;
|
---|
| 115 | yd = track->Yd;
|
---|
| 116 | dxy = TMath::Abs(track->Dxy);
|
---|
| 117 | ddxy = track->SDxy;
|
---|
| 118 |
|
---|
| 119 | if( tpt < fPtMin ) continue;
|
---|
| 120 | if( dr > fDeltaR ) continue;
|
---|
| 121 | if( dxy > fIPmax ) continue;
|
---|
| 122 |
|
---|
| 123 | sign = ( jpx*xd + jpy*yd > 0.0 ) ? 1 : -1;
|
---|
| 124 |
|
---|
| 125 | ip = sign*dxy;
|
---|
| 126 | sip = ip / TMath::Abs(ddxy);
|
---|
| 127 |
|
---|
| 128 | if( sip > fSigMin ) count++;
|
---|
| 129 |
|
---|
| 130 | }
|
---|
| 131 |
|
---|
| 132 | // set BTag flag to true if count >= Ntracks
|
---|
| 133 | jet->BTag |= ( count >= fNtracks ) << fBitNumber;
|
---|
| 134 | }
|
---|
| 135 | }
|
---|
| 136 |
|
---|
| 137 | //------------------------------------------------------------------------------
|
---|