ATLAS Offline Software
Loading...
Searching...
No Matches
PMGSherpaVjetsSysTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5// $Id: PMGSherpaVjetsSysTool.cxx.cxx 2016-07-12 tripiana $
6
7// ROOT include(s):
8#include "TKey.h"
9#include "TIterator.h"
10#include "TH2F.h"
11
12// EDM include(s):
17
18// Tool include(s):
20
21// Local include(s):
24
25namespace PMGTools {
26
27 using namespace std;
28
30 : asg::AsgTool( name ),
32 m_use_cache(false),
34 m_cache_ptidx(-1),
35 m_weightsFile(""),
38 {
39
40 // Declare the properties of the tool:
41 declareProperty( "WeightsFile",
43 "dev/SUSYTools/Vjets_SysParameterization/AllVariationWeights.root" );
44
45 declareProperty( "TruthJetContainer",
46 m_truthJetContainer = "AntiKt4TruthWZJets" );
47 declareProperty( "TruthParticleContainer",
48 m_truthParticleContainer = "TruthParticles" );
49 }
50
52
53 // Tell the user what's happening:
54 ATH_MSG_INFO( "Initializing " << name() << "..." );
55 ATH_MSG_DEBUG( "Will be using:" );
56 ATH_MSG_DEBUG( " WeightsFile = " << m_weightsFile );
57 ATH_MSG_DEBUG( " TruthJetContainer = " << m_truthJetContainer );
58 ATH_MSG_DEBUG( " TruthParticleContainer = " << m_truthParticleContainer );
59
60 //load parametrization maps
61 m_map_w = {};
62 m_map_zll = {};
63 m_map_znunu = {};
64 m_map_gamma = {};
65
66 //open the rootfiles
67 const std::string fileName = PathResolverFindCalibFile( m_weightsFile );
68 m_file.reset( TFile::Open( fileName.c_str(), "READ" ) );
69 if( ( ! m_file ) || m_file->IsZombie() ) {
70 ATH_MSG_ERROR( "Couldn't open file: " << m_weightsFile );
71 return StatusCode::FAILURE;
72 }
73
74 TKey *key;
75 std::string hname="";
76 std::string keyname="";
77 TIter next( m_file->GetListOfKeys());
78 while ((key = (TKey *) next())) {
79
80 keyname = std::string(key->GetName());
81
82 //load Zee histograms
83 if( keyname.find("Zee_") != std::string::npos ){
84 keyname.erase(0,4);
85 hname = "PMGSherpaVjetsSysTool::ZllJets_"+keyname;
86
87 m_map_zll[keyname] = (TH2F*)m_file->Get(key->GetName())->Clone(hname.c_str());
88 m_supported_zll.push_back(key->GetName());
89 }
90
91 //load Znunu histograms
92 if( keyname.find("Znunu_") != std::string::npos ){
93 keyname.erase(0,6);
94 hname = "PMGSherpaVjetsSysTool::ZnunuJets_"+keyname;
95
96 m_map_znunu[keyname] = (TH2F*)m_file->Get(key->GetName())->Clone(hname.c_str());
97 m_supported_znunu.push_back(keyname);
98 }
99
100 //load Wlnu histograms
101 if( keyname.find("Wenu_") != std::string::npos ){
102 keyname.erase(0,5);
103 hname = "PMGSherpaVjetsSysTool::WlnuJets_"+keyname;
104
105 m_map_w[keyname] = (TH2F*)m_file->Get(key->GetName())->Clone(hname.c_str());
106 m_supported_w.push_back(keyname);
107 }
108
109 //load gammaJets histograms
110 if( keyname.find("Gamma_") != std::string::npos ){
111 keyname.erase(0,6);
112 hname = "PMGSherpaVjetsSysTool::GammaJets_"+keyname;
113
114 m_map_gamma[keyname] = (TH2F*)m_file->Get(key->GetName())->Clone(hname.c_str());
115 m_supported_gamma.push_back(keyname);
116 }
117
118 }
119
120 // Return gracefully:
121 return StatusCode::SUCCESS;
122 }
123
124
126
127 m_use_cache = do_it;
128 if(do_it){
129 m_cache_ptype = SysParType::None;
131 }
132 }
133
134
135 double PMGSherpaVjetsSysTool::getWeight( const std::string& sysVariation ) {
136
137 SysParType pType(SysParType::None);
138 int ptIdx(0);
139
140 //look for DSID type and pt-bin unless previously fixed by user
141 if(!m_use_cache){
142 ptIdx = getPtMapping(pType);
143 }
144 else{
145 pType = m_cache_ptype;
146 ptIdx = m_cache_ptidx;
147 }
148
149 //if not found in mapped samples, then return 1.
150 if(pType == SysParType::None) return 1.;
151
152 // get number of truth jets
153 unsigned int njets = (m_current_njets >=0 ? m_current_njets : this->getNtruthJets());
154
155 // re-define last bin for n_jets >= 11
156 if(njets>11)
157 njets = 11;
158
159
160 // retrieve weight
161 if(pType == SysParType::Zll) return m_map_zll[sysVariation]->GetBinContent(ptIdx, njets+1);
162 if(pType == SysParType::Znunu) return m_map_znunu[sysVariation]->GetBinContent(ptIdx, njets+1);
163 if(pType == SysParType::Wlnu) return m_map_w[sysVariation]->GetBinContent(ptIdx, njets+1);
164 if(pType == SysParType::GammaJets) return m_map_gamma[sysVariation]->GetBinContent(ptIdx, njets+1);
165 //...
166
167 return 1.;
168 }
169
170
172 //get MCID --> PT-BIN mapping
173
174 const xAOD::EventInfo* ei = 0;
175 if(! evtStore()->retrieve( ei, "EventInfo").isSuccess() ){
176 ATH_MSG_ERROR("No EventInfo found in TStore(). Not able to get the sample ID. Dummy null weight retrieved.");
177 return 0;
178 }
179
180 unsigned int MCID = ei->mcChannelNumber();
181
182 //Check Znunu 2.1 samples
183 if( MCID>=361444 && MCID<361447 ){ pType=SysParType::Znunu; return 1; }
184 if( MCID>=361447 && MCID<361450 ){ pType=SysParType::Znunu; return 2; }
185 if( MCID>=361450 && MCID<361453 ){ pType=SysParType::Znunu; return 3; }
186 if( MCID>=361453 && MCID<361456 ){ pType=SysParType::Znunu; return 4; }
187 if( MCID>=361456 && MCID<361459 ){ pType=SysParType::Znunu; return 5; }
188 if( MCID>=361459 && MCID<361462 ){ pType=SysParType::Znunu; return 6; }
189 if( MCID>=361462 && MCID<361465 ){ pType=SysParType::Znunu; return 7; }
190 if( MCID>=361465 && MCID<361468 ){ pType=SysParType::Znunu; return 8; }
191
192 //Check Zee 2.1 samples
193 if( MCID>=361372 && MCID<361375 ){ pType=SysParType::Zll; return 1; }
194 if( MCID>=361375 && MCID<361378 ){ pType=SysParType::Zll; return 2; }
195 if( MCID>=361378 && MCID<361381 ){ pType=SysParType::Zll; return 3; }
196 if( MCID>=361381 && MCID<361384 ){ pType=SysParType::Zll; return 4; }
197 if( MCID>=361384 && MCID<361387 ){ pType=SysParType::Zll; return 5; }
198 if( MCID>=361387 && MCID<361390 ){ pType=SysParType::Zll; return 6; }
199 if( MCID>=361390 && MCID<361393 ){ pType=SysParType::Zll; return 7; }
200 if( MCID>=361393 && MCID<361396 ){ pType=SysParType::Zll; return 8; }
201
202 //Check Zmumu 2.1 samples
203 if( MCID>=361396 && MCID<361399 ){ pType=SysParType::Zll; return 1; }
204 if( MCID>=361399 && MCID<361402 ){ pType=SysParType::Zll; return 2; }
205 if( MCID>=361402 && MCID<361405 ){ pType=SysParType::Zll; return 3; }
206 if( MCID>=361405 && MCID<361408 ){ pType=SysParType::Zll; return 4; }
207 if( MCID>=361408 && MCID<361411 ){ pType=SysParType::Zll; return 5; }
208 if( MCID>=361411 && MCID<361414 ){ pType=SysParType::Zll; return 6; }
209 if( MCID>=361414 && MCID<361417 ){ pType=SysParType::Zll; return 7; }
210 if( MCID>=361417 && MCID<361420 ){ pType=SysParType::Zll; return 8; }
211
212 //Check Ztautau 2.1 samples
213 if( MCID>=361420 && MCID<361423 ){ pType=SysParType::Zll; return 1; }
214 if( MCID>=361423 && MCID<361426 ){ pType=SysParType::Zll; return 2; }
215 if( MCID>=361426 && MCID<361429 ){ pType=SysParType::Zll; return 3; }
216 if( MCID>=361429 && MCID<361432 ){ pType=SysParType::Zll; return 4; }
217 if( MCID>=361432 && MCID<361435 ){ pType=SysParType::Zll; return 5; }
218 if( MCID>=361435 && MCID<361438 ){ pType=SysParType::Zll; return 6; }
219 if( MCID>=361438 && MCID<361441 ){ pType=SysParType::Zll; return 7; }
220 if( MCID>=361441 && MCID<361444 ){ pType=SysParType::Zll; return 8; }
221
222 //Check Wenu 2.1 samples
223 if( MCID>=361300 && MCID<361303 ){ pType=SysParType::Wlnu; return 1; }
224 if( MCID>=361303 && MCID<361306 ){ pType=SysParType::Wlnu; return 2; }
225 if( MCID>=361306 && MCID<361309 ){ pType=SysParType::Wlnu; return 3; }
226 if( MCID>=361309 && MCID<361312 ){ pType=SysParType::Wlnu; return 4; }
227 if( MCID>=361312 && MCID<361315 ){ pType=SysParType::Wlnu; return 5; }
228 if( MCID>=361315 && MCID<361318 ){ pType=SysParType::Wlnu; return 6; }
229 if( MCID>=361318 && MCID<361321 ){ pType=SysParType::Wlnu; return 7; }
230 if( MCID>=361321 && MCID<361324 ){ pType=SysParType::Wlnu; return 8; }
231
232 //Check Wmunu 2.1 samples
233 if( MCID>=361324 && MCID<361327 ){ pType=SysParType::Wlnu; return 1; }
234 if( MCID>=361327 && MCID<361330 ){ pType=SysParType::Wlnu; return 2; }
235 if( MCID>=361330 && MCID<361333 ){ pType=SysParType::Wlnu; return 3; }
236 if( MCID>=361333 && MCID<361336 ){ pType=SysParType::Wlnu; return 4; }
237 if( MCID>=361336 && MCID<361339 ){ pType=SysParType::Wlnu; return 5; }
238 if( MCID>=361339 && MCID<361342 ){ pType=SysParType::Wlnu; return 6; }
239 if( MCID>=361342 && MCID<361345 ){ pType=SysParType::Wlnu; return 7; }
240 if( MCID>=361345 && MCID<361348 ){ pType=SysParType::Wlnu; return 8; }
241
242 //Check Wtaunu 2.1 samples
243 if( MCID>=361348 && MCID<361351 ){ pType=SysParType::Wlnu; return 1; }
244 if( MCID>=361351 && MCID<361354 ){ pType=SysParType::Wlnu; return 2; }
245 if( MCID>=361354 && MCID<361357 ){ pType=SysParType::Wlnu; return 3; }
246 if( MCID>=361357 && MCID<361360 ){ pType=SysParType::Wlnu; return 4; }
247 if( MCID>=361360 && MCID<361363 ){ pType=SysParType::Wlnu; return 5; }
248 if( MCID>=361363 && MCID<361366 ){ pType=SysParType::Wlnu; return 6; }
249 if( MCID>=361366 && MCID<361369 ){ pType=SysParType::Wlnu; return 7; }
250 if( MCID>=361369 && MCID<361372 ){ pType=SysParType::Wlnu; return 8; }
251
252 //Check Znunu 2.2 samples
253 if( MCID>=363412 && MCID<363415 ){ pType=SysParType::Znunu; return 1; }
254 if( MCID>=363415 && MCID<363418 ){ pType=SysParType::Znunu; return 2; }
255 if( MCID>=363418 && MCID<363421 ){ pType=SysParType::Znunu; return 3; }
256 if( MCID>=363421 && MCID<363424 ){ pType=SysParType::Znunu; return 4; }
257 if( MCID>=363424 && MCID<363427 ){ pType=SysParType::Znunu; return 5; }
258 if( MCID>=363427 && MCID<363430 ){ pType=SysParType::Znunu; return 6; }
259 if( MCID>=363430 && MCID<363433 ){ pType=SysParType::Znunu; return 7; }
260 if( MCID>=363433 && MCID<363436 ){ pType=SysParType::Znunu; return 8; }
261
262 //Check Zee 2.2 samples
263 if( MCID>=363388 && MCID<363391 ){ pType=SysParType::Zll; return 1; }
264 if( MCID>=363391 && MCID<363394 ){ pType=SysParType::Zll; return 2; }
265 if( MCID>=363394 && MCID<363397 ){ pType=SysParType::Zll; return 3; }
266 if( MCID>=363397 && MCID<363400 ){ pType=SysParType::Zll; return 4; }
267 if( MCID>=363400 && MCID<363403 ){ pType=SysParType::Zll; return 5; }
268 if( MCID>=363403 && MCID<363406 ){ pType=SysParType::Zll; return 6; }
269 if( MCID>=363406 && MCID<363409 ){ pType=SysParType::Zll; return 7; }
270 if( MCID>=363409 && MCID<363412 ){ pType=SysParType::Zll; return 8; }
271
272 //Check Zmumu 2.2 samples
273 if( MCID>=363364 && MCID<363367 ){ pType=SysParType::Zll; return 1; }
274 if( MCID>=363367 && MCID<363370 ){ pType=SysParType::Zll; return 2; }
275 if( MCID>=363370 && MCID<363373 ){ pType=SysParType::Zll; return 3; }
276 if( MCID>=363373 && MCID<363376 ){ pType=SysParType::Zll; return 4; }
277 if( MCID>=363376 && MCID<363379 ){ pType=SysParType::Zll; return 5; }
278 if( MCID>=363379 && MCID<363382 ){ pType=SysParType::Zll; return 6; }
279 if( MCID>=363382 && MCID<363385 ){ pType=SysParType::Zll; return 7; }
280 if( MCID>=363385 && MCID<363388 ){ pType=SysParType::Zll; return 8; }
281
282 //Check Ztautau 2.2 samples
283 if( MCID>=363099 && MCID<363102 ){ pType=SysParType::Zll; return 1; }
284 if( MCID>=363102 && MCID<363105 ){ pType=SysParType::Zll; return 2; }
285 if( MCID>=363105 && MCID<363108 ){ pType=SysParType::Zll; return 3; }
286 if( MCID>=363108 && MCID<363111 ){ pType=SysParType::Zll; return 4; }
287 if( MCID>=363111 && MCID<363114 ){ pType=SysParType::Zll; return 5; }
288 if( MCID>=363114 && MCID<363117 ){ pType=SysParType::Zll; return 6; }
289 if( MCID>=363117 && MCID<363120 ){ pType=SysParType::Zll; return 7; }
290 if( MCID>=363120 && MCID<363123 ){ pType=SysParType::Zll; return 8; }
291
292 //Check Wenu 2.2 samples
293 if( MCID>=363460 && MCID<363463 ){ pType=SysParType::Wlnu; return 1; }
294 if( MCID>=363463 && MCID<363466 ){ pType=SysParType::Wlnu; return 2; }
295 if( MCID>=363466 && MCID<363469 ){ pType=SysParType::Wlnu; return 3; }
296 if( MCID>=363469 && MCID<363472 ){ pType=SysParType::Wlnu; return 4; }
297 if( MCID>=363472 && MCID<363475 ){ pType=SysParType::Wlnu; return 5; }
298 if( MCID>=363475 && MCID<363478 ){ pType=SysParType::Wlnu; return 6; }
299 if( MCID>=363478 && MCID<363481 ){ pType=SysParType::Wlnu; return 7; }
300 if( MCID>=363481 && MCID<363484 ){ pType=SysParType::Wlnu; return 8; }
301
302 //Check Wmunu 2.2 samples
303 if( MCID>=363436 && MCID<363439 ){ pType=SysParType::Wlnu; return 1; }
304 if( MCID>=363439 && MCID<363442 ){ pType=SysParType::Wlnu; return 2; }
305 if( MCID>=363442 && MCID<363445 ){ pType=SysParType::Wlnu; return 3; }
306 if( MCID>=363445 && MCID<363448 ){ pType=SysParType::Wlnu; return 4; }
307 if( MCID>=363448 && MCID<363451 ){ pType=SysParType::Wlnu; return 5; }
308 if( MCID>=363451 && MCID<363454 ){ pType=SysParType::Wlnu; return 6; }
309 if( MCID>=363454 && MCID<363457 ){ pType=SysParType::Wlnu; return 7; }
310 if( MCID>=363457 && MCID<363460 ){ pType=SysParType::Wlnu; return 8; }
311
312 //Check Wtaunu 2.2 samples
313 if( MCID>=363331 && MCID<363334 ){ pType=SysParType::Wlnu; return 1; }
314 if( MCID>=363334 && MCID<363337 ){ pType=SysParType::Wlnu; return 2; }
315 if( MCID>=363337 && MCID<363340 ){ pType=SysParType::Wlnu; return 3; }
316 if( MCID>=363340 && MCID<363343 ){ pType=SysParType::Wlnu; return 4; }
317 if( MCID>=363343 && MCID<363346 ){ pType=SysParType::Wlnu; return 5; }
318 if( MCID>=363346 && MCID<363349 ){ pType=SysParType::Wlnu; return 6; }
319 if( MCID>=363349 && MCID<363352 ){ pType=SysParType::Wlnu; return 7; }
320 if( MCID>=363352 && MCID<363355 ){ pType=SysParType::Wlnu; return 8; }
321
322 //Check gamma+Jets samples
323 if( MCID>=361039 && MCID<361042 ){ pType=SysParType::GammaJets; return 1; }
324 if( MCID>=361042 && MCID<361045 ){ pType=SysParType::GammaJets; return 2; }
325 if( MCID>=361045 && MCID<361048 ){ pType=SysParType::GammaJets; return 3; }
326 if( MCID>=361048 && MCID<361051 ){ pType=SysParType::GammaJets; return 4; }
327 if( MCID>=361051 && MCID<361054 ){ pType=SysParType::GammaJets; return 5; }
328 if( MCID>=361054 && MCID<361057 ){ pType=SysParType::GammaJets; return 6; }
329 if( MCID>=361057 && MCID<361061 ){ pType=SysParType::GammaJets; return 7; }
330
331
332 //Check Znunu 2.2.1 samples
333 if( MCID>=364142 && MCID<364145 ){ pType=SysParType::Znunu; return 1; }
334 if( MCID>=364145 && MCID<364148 ){ pType=SysParType::Znunu; return 2; }
335 if( MCID>=364148 && MCID<364151 ){ pType=SysParType::Znunu; return 3; }
336 if( MCID>=364151 && MCID<364154 ){ pType=SysParType::Znunu; return 4; }
337 if( MCID==364154 ){ pType=SysParType::Znunu; return 5; }
338 if( MCID==364155 ){ pType=SysParType::Znunu; return 7; }
339
340 //Check Zee 2.2.1 samples
341 if( MCID>=364114 && MCID<364117 ){ pType=SysParType::Zll; return 1; }
342 if( MCID>=364117 && MCID<364120 ){ pType=SysParType::Zll; return 2; }
343 if( MCID>=364120 && MCID<364123 ){ pType=SysParType::Zll; return 3; }
344 if( MCID>=364123 && MCID<364126 ){ pType=SysParType::Zll; return 4; }
345 if( MCID==364126 ){ pType=SysParType::Zll; return 5; }
346 if( MCID==364127 ){ pType=SysParType::Zll; return 7; }
347
348 //Check Zmumu 2.2.1 samples
349 if( MCID>=364100 && MCID<364103 ){ pType=SysParType::Zll; return 1; }
350 if( MCID>=364103 && MCID<364106 ){ pType=SysParType::Zll; return 2; }
351 if( MCID>=364106 && MCID<364109 ){ pType=SysParType::Zll; return 3; }
352 if( MCID>=364109 && MCID<364112 ){ pType=SysParType::Zll; return 4; }
353 if( MCID==364112 ){ pType=SysParType::Zll; return 5; }
354 if( MCID==364113 ){ pType=SysParType::Zll; return 7; }
355
356 //Check Ztautau 2.2.1 samples
357 if( MCID>=364128 && MCID<364131 ){ pType=SysParType::Zll; return 1; }
358 if( MCID>=364131 && MCID<364134 ){ pType=SysParType::Zll; return 2; }
359 if( MCID>=364134 && MCID<364137 ){ pType=SysParType::Zll; return 3; }
360 if( MCID>=364137 && MCID<364140 ){ pType=SysParType::Zll; return 4; }
361 if( MCID==364140 ){ pType=SysParType::Zll; return 5; }
362 if( MCID==364141 ){ pType=SysParType::Zll; return 7; }
363
364 //Check Wenu 2.2.1 samples
365 if( MCID>=364170 && MCID<364173 ){ pType=SysParType::Wlnu; return 1; }
366 if( MCID>=364173 && MCID<364176 ){ pType=SysParType::Wlnu; return 2; }
367 if( MCID>=364176 && MCID<364179 ){ pType=SysParType::Wlnu; return 3; }
368 if( MCID>=364179 && MCID<364182 ){ pType=SysParType::Wlnu; return 4; }
369 if( MCID==364182 ){ pType=SysParType::Wlnu; return 5; }
370 if( MCID==364183 ){ pType=SysParType::Wlnu; return 7; }
371
372 //Check Wmunu 2.2.1 samples
373 if( MCID>=364156 && MCID<364159 ){ pType=SysParType::Wlnu; return 1; }
374 if( MCID>=364159 && MCID<364162 ){ pType=SysParType::Wlnu; return 2; }
375 if( MCID>=364162 && MCID<364165 ){ pType=SysParType::Wlnu; return 3; }
376 if( MCID>=364165 && MCID<364168 ){ pType=SysParType::Wlnu; return 4; }
377 if( MCID==364168 ){ pType=SysParType::Wlnu; return 5; }
378 if( MCID==364169 ){ pType=SysParType::Wlnu; return 7; }
379
380 //Check Wtaunu 2.2.1 samples
381 if( MCID>=364184 && MCID<364187 ){ pType=SysParType::Wlnu; return 1; }
382 if( MCID>=364187 && MCID<364190 ){ pType=SysParType::Wlnu; return 2; }
383 if( MCID>=364190 && MCID<364193 ){ pType=SysParType::Wlnu; return 3; }
384 if( MCID>=364193 && MCID<364196 ){ pType=SysParType::Wlnu; return 4; }
385 if( MCID==364196 ){ pType=SysParType::Wlnu; return 5; }
386 if( MCID==364197 ){ pType=SysParType::Wlnu; return 7; }
387
388
389 return -1;
390 }
391
392
394 //
395 // Count number of truthjets compatible with evaluation of correction
396 //
397 // MT : ~same to what's done in PMGSherpa22VJetsWeightTool already. Might want to inherit/merge/move to PMGUtils-like common code?
398
399 // Check whether to do overlap removal with truth leptons:
400 const bool doRemoval = ( m_truthJetContainer == "AntiKt4TruthJets" );
401
402 // Retrieve the truth jets
403 const xAOD::JetContainer* truthJets( 0 );
404 if( evtStore()->retrieve( truthJets, m_truthJetContainer ).isFailure() ) {
405 ATH_MSG_ERROR( "No TruthJetContainer (\"" << m_truthJetContainer << "\") found! Dummy null weight retrieved." );
406 return 0;
407 }
408
409 size_t nTruthJets = 0;
410
411 // Retrieve the truth particles to get the leptons
412 const xAOD::TruthParticleContainer* truthParticles( 0 );
413 if( doRemoval ) {
414 if( evtStore()->retrieve( truthParticles,
415 m_truthParticleContainer ).isFailure() ) {
416 ATH_MSG_ERROR( "Couldn't retrieve truth particle container: " << m_truthParticleContainer );
417 return 0;
418 }
419 }
420
421 // Loop over all truth jets passing basic cuts:
422 for( const xAOD::Jet* truthJet : *truthJets ) {
423
424 // Start with a simple kinematic cut:
425 if( truthJet->pt() <= 20000. || std::abs( truthJet->eta() ) >= 2.8 ) { //MT : until John updates the parametrization with a 4.5 upper cut...
426 continue;
427 }
428
429 // Remove hadronic taus e.g. from Ztautau, Wtaunu decays
431 acc( "HadronConeExclTruthLabelID" );
432 if( acc.isAvailable( *truthJet ) && ( acc( *truthJet ) == 15 ) ) {
433 continue;
434 }
435
436 // If no overlap removal is to be made, we're done already:
437 if( ! doRemoval ) {
438 ++nTruthJets;
439 continue;
440 }
441
442 // Loop over the truth particles, to veto some jets:
443 bool vetoJet = false;
444 for( const xAOD::TruthParticle* truthParticle : *truthParticles ) {
445
446 // Only select final state electrons and muons:
447 if( !MC::isStable(truthParticle) ||
448 ( !MC::isElectron(truthParticle) &&
449 !MC::isMuon(truthParticle) ) ) {
450 continue;
451 }
452 // ...which also pass some basic kinematic cuts:
453 if( ( truthParticle->pt() <= 20000.0 ) ||
454 ( std::abs( truthParticle->eta() ) >= 2.8 ) ) { //MT : until John updates the parametrization with a 4.5 upper cut...
455 continue;
456 }
457
458 // Veto the jet if it's close to this lepton:
459 static const double MIN_DISTANCE = 0.2 * 0.2;
460 const double dR2 =
461 xAOD::P4Helpers::deltaR2( truthJet, truthParticle, true );
462 if( dR2 < MIN_DISTANCE ) {
463 vetoJet = true;
464 break;
465 }
466 }
467
468 // If the jet was not vetoed:
469 if( ! vetoJet ) {
470 ++nTruthJets;
471 }
472 }
473
474 // Return the calculated value:
475 return nTruthJets;
476 }
477
478
480 m_current_njets = njets;
481 }
482
483
485
486 if(ptype == SysParType::Zll) return m_supported_zll;
487 if(ptype == SysParType::Znunu) return m_supported_znunu;
488 if(ptype == SysParType::Wlnu) return m_supported_w;
489 if(ptype == SysParType::GammaJets) return m_supported_gamma;
490
491 std::vector<std::string> vdummy={};
492 return vdummy;
493 }
494
495}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
ATLAS-specific HepMC functions.
bool vetoJet(const xAOD::jFexSRJetRoI *j)
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ServiceHandle< StoreGateSvc > & evtStore()
std::string m_truthJetContainer
The truth jet container to use for the calculation.
std::string m_truthParticleContainer
The truth particle container to use for the calculation.
std::map< std::string, TH2F * > m_map_zll
unsigned int getNtruthJets() override
get number of truth jets as defined in the parametrization analysis
PMGSherpaVjetsSysTool(const std::string &name)
Standard tool constructor, with name.
std::vector< std::string > m_supported_gamma
std::vector< std::string > getSupportedVariations(SysParType ptype) override
Helpers to get the list of supported variations for Z/W+jets and gamma+jets.
std::vector< std::string > m_supported_zll
StatusCode initialize() override
Initialize is required by AsgTool base class.
std::string m_weightsFile
Tool properties.
std::vector< std::string > m_supported_w
std::map< std::string, TH2F * > m_map_gamma
std::map< std::string, TH2F * > m_map_w
Parametrization maps.
void cacheDSID(bool do_it=true) override
double getWeight(const std::string &sysVariation="nom") override
Return weight for a given systematic variation.
std::map< std::string, TH2F * > m_map_znunu
void setNjets(int njets) override
Some setters to speed up the calculation for multiple variations/events.
bool m_use_cache
Cache MC DSID (to avoid checking it everytime)
std::vector< std::string > m_supported_znunu
std::unique_ptr< TFile > m_file
Parametrization files.
SG::ConstAccessor< T, ALLOC > ConstAccessor
Definition AuxElement.h:569
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition AsgTool.cxx:58
uint32_t mcChannelNumber() const
The MC generator's channel number.
bool isElectron(const T &p)
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
bool isMuon(const T &p)
Tool providing sample cross-sections and k-factors etc.
double deltaR2(double rapidity1, double phi1, double rapidity2, double phi2)
from bare rapidity,phi
Jet_v1 Jet
Definition of the current "jet version".
EventInfo_v1 EventInfo
Definition of the latest event info version.
TruthParticle_v1 TruthParticle
Typedef to implementation.
JetContainer_v1 JetContainer
Definition of the current "jet container version".
TruthParticleContainer_v1 TruthParticleContainer
Declare the latest version of the truth particle container.