Fork me on GitHub

source: svn/trunk/modules/TrackPileUpSubtractor.cc@ 1320

Last change on this file since 1320 was 1314, checked in by Pavel Demin, 11 years ago

replace ;; with ;

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision Date
File size: 2.9 KB
RevLine 
[1069]1
2/** \class TrackPileUpSubtractor
3 *
4 * Subtract pile-up contribution from tracks.
5 *
6 * $Date: 2013-11-04 10:21:27 +0000 (Mon, 04 Nov 2013) $
7 * $Revision: 1314 $
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
[1070]32#include <algorithm>
[1069]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
[1314]70 fInputMap[iterator] = ExportArray(param[i*2 + 1].GetString());
[1069]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{
[1073]93 Candidate *candidate, *particle;
[1069]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 {
[1073]109 particle = static_cast<Candidate*>(candidate->GetCandidates()->At(0));
110 z = particle->Position.Z();
[1070]111
[1069]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.