Fork me on GitHub

source: git/modules/TrackPileUpSubtractor.cc@ 4575766

ImprovedOutputFile Timing dual_readout llp
Last change on this file since 4575766 was d7d2da3, checked in by pavel <pavel@…>, 12 years ago

move branches/ModularDelphes to trunk

  • Property mode set to 100644
File size: 2.9 KB
RevLine 
[d7d2da3]1
2/** \class TrackPileUpSubtractor
3 *
4 * Subtract pile-up contribution from tracks.
5 *
6 * $Date$
7 * $Revision$
8 *
9 *
10 * \author P. Demin - UCL, Louvain-la-Neuve
11 *
12 */
13
14#include "modules/TrackPileUpSubtractor.h"
15
16#include "classes/DelphesClasses.h"
17#include "classes/DelphesFactory.h"
18#include "classes/DelphesFormula.h"
19
20#include "ExRootAnalysis/ExRootResult.h"
21#include "ExRootAnalysis/ExRootFilter.h"
22#include "ExRootAnalysis/ExRootClassifier.h"
23
24#include "TMath.h"
25#include "TString.h"
26#include "TFormula.h"
27#include "TRandom3.h"
28#include "TObjArray.h"
29#include "TDatabasePDG.h"
30#include "TLorentzVector.h"
31
32#include <algorithm>
33#include <stdexcept>
34#include <iostream>
35#include <sstream>
36
37using namespace std;
38
39//------------------------------------------------------------------------------
40
41TrackPileUpSubtractor::TrackPileUpSubtractor()
42{
43}
44
45//------------------------------------------------------------------------------
46
47TrackPileUpSubtractor::~TrackPileUpSubtractor()
48{
49}
50
51//------------------------------------------------------------------------------
52
53void TrackPileUpSubtractor::Init()
54{
55 fZVertexResolution = GetDouble("ZVertexResolution", 0.005)*1.0E3;
56
57 // import arrays with output from other modules
58
59 ExRootConfParam param = GetParam("InputArray");
60 Long_t i, size;
61 const TObjArray *array;
62 TIterator *iterator;
63
64 size = param.GetSize();
65 for(i = 0; i < size/2; ++i)
66 {
67 array = ImportArray(param[i*2].GetString());
68 iterator = array->MakeIterator();
69
70 fInputMap[iterator] = ExportArray(param[i*2 + 1].GetString());;
71 }
72}
73
74//------------------------------------------------------------------------------
75
76void TrackPileUpSubtractor::Finish()
77{
78 map< TIterator *, TObjArray * >::iterator itInputMap;
79 TIterator *iterator;
80
81 for(itInputMap = fInputMap.begin(); itInputMap != fInputMap.end(); ++itInputMap)
82 {
83 iterator = itInputMap->first;
84
85 if(iterator) delete iterator;
86 }
87}
88
89//------------------------------------------------------------------------------
90
91void TrackPileUpSubtractor::Process()
92{
93 Candidate *candidate, *particle;
94 map< TIterator *, TObjArray * >::iterator itInputMap;
95 TIterator *iterator;
96 TObjArray *array;
97 Double_t z;
98
99 // loop over all input arrays
100 for(itInputMap = fInputMap.begin(); itInputMap != fInputMap.end(); ++itInputMap)
101 {
102 iterator = itInputMap->first;
103 array = itInputMap->second;
104
105 // loop over all candidates
106 iterator->Reset();
107 while((candidate = static_cast<Candidate*>(iterator->Next())))
108 {
109 particle = static_cast<Candidate*>(candidate->GetCandidates()->At(0));
110 z = particle->Position.Z();
111
112 // apply pile-up subtraction
113 // assume perfect pile-up subtraction for tracks outside fZVertexResolution
114 if(candidate->IsPU && TMath::Abs(z) > fZVertexResolution) continue;
115
116 array->Add(candidate);
117 }
118 }
119}
120
121//------------------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.