[694] | 1 |
|
---|
[814] | 2 | /** \class Isolation
|
---|
| 3 | *
|
---|
| 4 | * Sums transverse momenta of isolation objects (tracks, calorimeter towers, etc)
|
---|
| 5 | * within a DeltaR cone around a candidate and calculates fraction of this sum
|
---|
| 6 | * to the candidate's transverse momentum. outputs candidates that have
|
---|
[1028] | 7 | * the transverse momenta fraction within (PTRatioMin, PTRatioMax].
|
---|
[814] | 8 | *
|
---|
| 9 | * $Date: 2013-08-19 13:40:54 +0000 (Mon, 19 Aug 2013) $
|
---|
| 10 | * $Revision: 1267 $
|
---|
| 11 | *
|
---|
| 12 | *
|
---|
| 13 | * \author P. Demin - UCL, Louvain-la-Neuve
|
---|
| 14 | *
|
---|
| 15 | */
|
---|
| 16 |
|
---|
[694] | 17 | #include "modules/Isolation.h"
|
---|
| 18 |
|
---|
| 19 | #include "classes/DelphesClasses.h"
|
---|
[703] | 20 | #include "classes/DelphesFactory.h"
|
---|
[766] | 21 | #include "classes/DelphesFormula.h"
|
---|
[694] | 22 |
|
---|
[703] | 23 | #include "ExRootAnalysis/ExRootResult.h"
|
---|
[694] | 24 | #include "ExRootAnalysis/ExRootFilter.h"
|
---|
| 25 | #include "ExRootAnalysis/ExRootClassifier.h"
|
---|
| 26 |
|
---|
| 27 | #include "TMath.h"
|
---|
| 28 | #include "TString.h"
|
---|
| 29 | #include "TFormula.h"
|
---|
[703] | 30 | #include "TRandom3.h"
|
---|
| 31 | #include "TObjArray.h"
|
---|
| 32 | #include "TDatabasePDG.h"
|
---|
[694] | 33 | #include "TLorentzVector.h"
|
---|
| 34 |
|
---|
[1028] | 35 | #include <algorithm>
|
---|
[703] | 36 | #include <stdexcept>
|
---|
[694] | 37 | #include <iostream>
|
---|
| 38 | #include <sstream>
|
---|
| 39 |
|
---|
| 40 | using namespace std;
|
---|
| 41 |
|
---|
| 42 | //------------------------------------------------------------------------------
|
---|
| 43 |
|
---|
| 44 | class IsolationClassifier : public ExRootClassifier
|
---|
| 45 | {
|
---|
| 46 | public:
|
---|
| 47 |
|
---|
| 48 | IsolationClassifier() {}
|
---|
| 49 |
|
---|
| 50 | Int_t GetCategory(TObject *object);
|
---|
[1028] | 51 |
|
---|
[694] | 52 | Double_t fPTMin;
|
---|
| 53 | };
|
---|
| 54 |
|
---|
| 55 | //------------------------------------------------------------------------------
|
---|
| 56 |
|
---|
| 57 | Int_t IsolationClassifier::GetCategory(TObject *object)
|
---|
| 58 | {
|
---|
| 59 | Candidate *track = static_cast<Candidate*>(object);
|
---|
| 60 | const TLorentzVector &momentum = track->Momentum;
|
---|
| 61 |
|
---|
| 62 | if(momentum.Pt() < fPTMin) return -1;
|
---|
| 63 |
|
---|
| 64 | return 0;
|
---|
| 65 | }
|
---|
| 66 |
|
---|
| 67 | //------------------------------------------------------------------------------
|
---|
| 68 |
|
---|
| 69 | Isolation::Isolation() :
|
---|
| 70 | fClassifier(0), fFilter(0),
|
---|
[1023] | 71 | fItIsolationInputArray(0), fItCandidateInputArray(0)
|
---|
[694] | 72 | {
|
---|
| 73 | fClassifier = new IsolationClassifier;
|
---|
| 74 | }
|
---|
| 75 |
|
---|
| 76 | //------------------------------------------------------------------------------
|
---|
| 77 |
|
---|
| 78 | Isolation::~Isolation()
|
---|
| 79 | {
|
---|
| 80 | }
|
---|
| 81 |
|
---|
| 82 | //------------------------------------------------------------------------------
|
---|
| 83 |
|
---|
| 84 | void Isolation::Init()
|
---|
| 85 | {
|
---|
[1023] | 86 | const char *rhoInputArrayName;
|
---|
| 87 |
|
---|
[878] | 88 | fDeltaRMax = GetDouble("DeltaRMax", 0.5);
|
---|
[694] | 89 |
|
---|
[878] | 90 | fPTRatioMax = GetDouble("PTRatioMax", 0.1);
|
---|
[696] | 91 |
|
---|
[1267] | 92 | fPTSumMax = GetDouble("PTSumMax", 5.0);
|
---|
| 93 |
|
---|
| 94 | fUsePTSum = GetBool("UsePTSum", false);
|
---|
| 95 |
|
---|
[694] | 96 | fClassifier->fPTMin = GetDouble("PTMin", 0.5);
|
---|
[1028] | 97 |
|
---|
[694] | 98 | // import input array(s)
|
---|
| 99 |
|
---|
| 100 | fIsolationInputArray = ImportArray(GetString("IsolationInputArray", "Delphes/partons"));
|
---|
| 101 | fItIsolationInputArray = fIsolationInputArray->MakeIterator();
|
---|
| 102 |
|
---|
| 103 | fFilter = new ExRootFilter(fIsolationInputArray);
|
---|
[1028] | 104 |
|
---|
[694] | 105 | fCandidateInputArray = ImportArray(GetString("CandidateInputArray", "Calorimeter/electrons"));
|
---|
| 106 | fItCandidateInputArray = fCandidateInputArray->MakeIterator();
|
---|
[1028] | 107 |
|
---|
[1023] | 108 | rhoInputArrayName = GetString("RhoInputArray", "");
|
---|
| 109 | if(rhoInputArrayName[0] != '\0')
|
---|
| 110 | {
|
---|
[1033] | 111 | fRhoInputArray = ImportArray(rhoInputArrayName);
|
---|
[1023] | 112 | }
|
---|
| 113 | else
|
---|
| 114 | {
|
---|
| 115 | fRhoInputArray = 0;
|
---|
| 116 | }
|
---|
[1008] | 117 |
|
---|
[694] | 118 | // create output array
|
---|
| 119 |
|
---|
| 120 | fOutputArray = ExportArray(GetString("OutputArray", "electrons"));
|
---|
| 121 | }
|
---|
| 122 |
|
---|
| 123 | //------------------------------------------------------------------------------
|
---|
| 124 |
|
---|
| 125 | void Isolation::Finish()
|
---|
| 126 | {
|
---|
| 127 | if(fFilter) delete fFilter;
|
---|
| 128 | if(fItCandidateInputArray) delete fItCandidateInputArray;
|
---|
| 129 | if(fItIsolationInputArray) delete fItIsolationInputArray;
|
---|
| 130 | }
|
---|
| 131 |
|
---|
| 132 | //------------------------------------------------------------------------------
|
---|
| 133 |
|
---|
| 134 | void Isolation::Process()
|
---|
| 135 | {
|
---|
| 136 | Candidate *candidate, *isolation;
|
---|
| 137 | TObjArray *isolationArray;
|
---|
[1267] | 138 | Double_t sum, ratio;
|
---|
[894] | 139 | Int_t counter;
|
---|
[1028] | 140 | Double_t rho = 0.0;
|
---|
| 141 |
|
---|
| 142 | if(fRhoInputArray && fRhoInputArray->GetEntriesFast() > 0)
|
---|
[1023] | 143 | {
|
---|
| 144 | candidate = static_cast<Candidate*>(fRhoInputArray->At(0));
|
---|
[1008] | 145 | rho = candidate->Momentum.Pt();
|
---|
| 146 | }
|
---|
[1028] | 147 |
|
---|
[694] | 148 | // select isolation objects
|
---|
| 149 | fFilter->Reset();
|
---|
| 150 | isolationArray = fFilter->GetSubArray(fClassifier, 0);
|
---|
[1028] | 151 |
|
---|
[694] | 152 | if(isolationArray == 0) return;
|
---|
| 153 |
|
---|
| 154 | TIter itIsolationArray(isolationArray);
|
---|
[1028] | 155 |
|
---|
[694] | 156 | // loop over all input jets
|
---|
| 157 | fItCandidateInputArray->Reset();
|
---|
| 158 | while((candidate = static_cast<Candidate*>(fItCandidateInputArray->Next())))
|
---|
| 159 | {
|
---|
[753] | 160 | const TLorentzVector &candidateMomentum = candidate->Momentum;
|
---|
[694] | 161 |
|
---|
| 162 | // loop over all input tracks
|
---|
[1267] | 163 | sum = 0.0;
|
---|
[894] | 164 | counter = 0;
|
---|
[694] | 165 | itIsolationArray.Reset();
|
---|
| 166 | while((isolation = static_cast<Candidate*>(itIsolationArray.Next())))
|
---|
| 167 | {
|
---|
| 168 | const TLorentzVector &isolationMomentum = isolation->Momentum;
|
---|
[894] | 169 |
|
---|
| 170 | if(candidateMomentum.DeltaR(isolationMomentum) <= fDeltaRMax &&
|
---|
| 171 | !candidate->Overlaps(isolation))
|
---|
[694] | 172 | {
|
---|
[1267] | 173 | sum += isolationMomentum.Pt();
|
---|
[894] | 174 | ++counter;
|
---|
[694] | 175 | }
|
---|
| 176 | }
|
---|
[878] | 177 |
|
---|
[1267] | 178 | // correct sum for pile-up contamination
|
---|
| 179 | sum = sum - rho*fDeltaRMax*fDeltaRMax*TMath::Pi();
|
---|
[1028] | 180 |
|
---|
[1267] | 181 | ratio = sum/candidateMomentum.Pt();
|
---|
| 182 | if((fUsePTSum && sum > fPTSumMax) || ratio > fPTRatioMax) continue;
|
---|
[753] | 183 |
|
---|
| 184 | fOutputArray->Add(candidate);
|
---|
[694] | 185 | }
|
---|
| 186 | }
|
---|
| 187 |
|
---|
| 188 | //------------------------------------------------------------------------------
|
---|