Fork me on GitHub

source: git/modules/ConstituentFilter.cc@ 1150871

ImprovedOutputFile Timing dual_readout llp
Last change on this file since 1150871 was 498cda4, checked in by pavel <pavel@…>, 11 years ago

replace ;; with ;

  • Property mode set to 100644
File size: 3.7 KB
Line 
1
2/** \class ConstituentFilter
3 *
4 * Drops all input objects that are not constituents of any jet.
5 *
6 * $Date$
7 * $Revision$
8 *
9 *
10 * \author P. Demin - UCL, Louvain-la-Neuve
11 *
12 */
13
14#include "modules/ConstituentFilter.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
41ConstituentFilter::ConstituentFilter()
42{
43}
44
45//------------------------------------------------------------------------------
46
47ConstituentFilter::~ConstituentFilter()
48{
49}
50
51//------------------------------------------------------------------------------
52
53void ConstituentFilter::Init()
54{
55 ExRootConfParam param;
56 Long_t i, size;
57 const TObjArray *array;
58 TIterator *iterator;
59
60 fJetPTMin = GetDouble("JetPTMin", 0.0);
61
62 // import input array(s)
63
64 param = GetParam("JetInputArray");
65 size = param.GetSize();
66 for(i = 0; i < size; ++i)
67 {
68 array = ImportArray(param[i].GetString());
69 iterator = array->MakeIterator();
70
71 fInputList.push_back(iterator);
72 }
73
74 param = GetParam("ConstituentInputArray");
75 size = param.GetSize();
76 for(i = 0; i < size/2; ++i)
77 {
78 array = ImportArray(param[i*2].GetString());
79 iterator = array->MakeIterator();
80
81 fInputMap[iterator] = ExportArray(param[i*2 + 1].GetString());
82 }
83}
84
85//------------------------------------------------------------------------------
86
87void ConstituentFilter::Finish()
88{
89 map< TIterator *, TObjArray * >::iterator itInputMap;
90 vector< TIterator * >::iterator itInputList;
91 TIterator *iterator;
92
93 for(itInputList = fInputList.begin(); itInputList != fInputList.end(); ++itInputList)
94 {
95 iterator = *itInputList;
96 if(iterator) delete iterator;
97 }
98
99 for(itInputMap = fInputMap.begin(); itInputMap != fInputMap.end(); ++itInputMap)
100 {
101 iterator = itInputMap->first;
102 if(iterator) delete iterator;
103 }
104}
105
106//------------------------------------------------------------------------------
107
108void ConstituentFilter::Process()
109{
110 Candidate *jet, *constituent;
111 map< TIterator *, TObjArray * >::iterator itInputMap;
112 vector< TIterator * >::iterator itInputList;
113 TIterator *iterator;
114 TObjArray *array;
115
116 // loop over all jet input arrays
117 for(itInputList = fInputList.begin(); itInputList != fInputList.end(); ++itInputList)
118 {
119 iterator = *itInputList;
120
121 // loop over all jets
122 iterator->Reset();
123 while((jet = static_cast<Candidate*>(iterator->Next())))
124 {
125 TIter itConstituents(jet->GetCandidates());
126
127 if(jet->Momentum.Pt() <= fJetPTMin) continue;
128
129 // loop over all constituents
130 while((constituent = static_cast<Candidate*>(itConstituents.Next())))
131 {
132 // set the IsConstituent flag
133 constituent->IsConstituent = 1;
134 }
135 }
136 }
137
138 // loop over all constituent input arrays
139 for(itInputMap = fInputMap.begin(); itInputMap != fInputMap.end(); ++itInputMap)
140 {
141 iterator = itInputMap->first;
142 array = itInputMap->second;
143
144 // loop over all constituents
145 iterator->Reset();
146 while((constituent = static_cast<Candidate*>(iterator->Next())))
147 {
148 // check the IsConstituent flag
149 if(constituent->IsConstituent)
150 {
151 array->Add(constituent);
152 }
153 }
154 }
155}
156
157//------------------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.