ATLAS Offline Software
Loading...
Searching...
No Matches
PMGTools::PMGSherpaVjetsSysTool Class Reference

#include <PMGSherpaVjetsSysTool.h>

Inheritance diagram for PMGTools::PMGSherpaVjetsSysTool:
Collaboration diagram for PMGTools::PMGSherpaVjetsSysTool:

Public Member Functions

 PMGSherpaVjetsSysTool (const std::string &name)
 Standard tool constructor, with name.
StatusCode initialize () override
 Initialize is required by AsgTool base class.
double getWeight (const std::string &sysVariation="nom") override
 Return weight for a given systematic variation.
virtual void print () const
 Print the state of the tool.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const
Additional helper functions, not directly mimicking Athena
template<class T>
const T * getProperty (const std::string &name) const
 Get one of the tool's properties.
const std::string & msg_level_name () const __attribute__((deprecated))
 A deprecated function for getting the message level's name.
const std::string & getName (const void *ptr) const
 Get the name of an object that is / should be in the event store.
SG::sgkey_t getKey (const void *ptr) const
 Get the (hashed) key of an object that is in the event store.

Protected Member Functions

void setNjets (int njets) override
 Some setters to speed up the calculation for multiple variations/events.
void cacheDSID (bool do_it=true) override
std::vector< std::string > getSupportedVariations (SysParType ptype) override
 Helpers to get the list of supported variations for Z/W+jets and gamma+jets.
unsigned int getNtruthJets () override
 get number of truth jets as defined in the parametrization analysis
void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

int getPtMapping (SysParType &pType)
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

int m_current_njets
 Current settings.
bool m_use_cache
 Cache MC DSID (to avoid checking it everytime)
SysParType m_cache_ptype
unsigned int m_cache_ptidx
std::unique_ptr< TFile > m_file
 Parametrization files.
std::map< std::string, TH2F * > m_map_w
 Parametrization maps.
std::map< std::string, TH2F * > m_map_zll
std::map< std::string, TH2F * > m_map_znunu
std::map< std::string, TH2F * > m_map_gamma
std::vector< std::string > m_supported_w
std::vector< std::string > m_supported_zll
std::vector< std::string > m_supported_znunu
std::vector< std::string > m_supported_gamma
std::string m_weightsFile
 Tool properties.
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.
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 39 of file PMGSherpaVjetsSysTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ PMGSherpaVjetsSysTool()

PMGTools::PMGSherpaVjetsSysTool::PMGSherpaVjetsSysTool ( const std::string & name)

Standard tool constructor, with name.

Definition at line 29 of file PMGSherpaVjetsSysTool.cxx.

30 : asg::AsgTool( name ),
32 m_use_cache(false),
33 m_cache_ptype(SysParType::None),
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 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
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::string m_weightsFile
Tool properties.
bool m_use_cache
Cache MC DSID (to avoid checking it everytime)

Member Function Documentation

◆ cacheDSID()

void PMGTools::PMGSherpaVjetsSysTool::cacheDSID ( bool do_it = true)
overrideprotectedvirtual

Implements PMGTools::IPMGSherpaVjetsSysTool.

Definition at line 125 of file PMGSherpaVjetsSysTool.cxx.

125 {
126
127 m_use_cache = do_it;
128 if(do_it){
129 m_cache_ptype = SysParType::None;
131 }
132 }

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ getKey()

SG::sgkey_t asg::AsgTool::getKey ( const void * ptr) const
inherited

Get the (hashed) key of an object that is in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the SG::sgkey_t key for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getName
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The hashed key of the object in the store. If not found, an invalid (zero) key.

Definition at line 119 of file AsgTool.cxx.

119 {
120
121#ifdef XAOD_STANDALONE
122 // In case we use @c xAOD::TEvent, we have a direct function call
123 // for this.
124 return evtStore()->event()->getKey( ptr );
125#else
126 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
127 return ( proxy == nullptr ? 0 : proxy->sgkey() );
128#endif // XAOD_STANDALONE
129 }
ServiceHandle< StoreGateSvc > & evtStore()

◆ getName()

const std::string & asg::AsgTool::getName ( const void * ptr) const
inherited

Get the name of an object that is / should be in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the std::string name for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getKey
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The string name of the object in the store. If not found, an empty string.

Definition at line 106 of file AsgTool.cxx.

106 {
107
108#ifdef XAOD_STANDALONE
109 // In case we use @c xAOD::TEvent, we have a direct function call
110 // for this.
111 return evtStore()->event()->getName( ptr );
112#else
113 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
114 static const std::string dummy = "";
115 return ( proxy == nullptr ? dummy : proxy->name() );
116#endif // XAOD_STANDALONE
117 }

◆ getNtruthJets()

unsigned int PMGTools::PMGSherpaVjetsSysTool::getNtruthJets ( )
overrideprotectedvirtual

get number of truth jets as defined in the parametrization analysis

Implements PMGTools::IPMGSherpaVjetsSysTool.

Definition at line 393 of file PMGSherpaVjetsSysTool.cxx.

393 {
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
430 static const SG::AuxElement::ConstAccessor< int >
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 }
#define ATH_MSG_ERROR(x)
bool vetoJet(const xAOD::jFexSRJetRoI *j)
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)
retrieve(aClass, aKey=None)
Definition PyKernel.py:110
double deltaR2(double rapidity1, double phi1, double rapidity2, double phi2)
from bare rapidity,phi
Jet_v1 Jet
Definition of the current "jet 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.

◆ getProperty()

template<class T>
const T * asg::AsgTool::getProperty ( const std::string & name) const
inherited

Get one of the tool's properties.

◆ getPtMapping()

int PMGTools::PMGSherpaVjetsSysTool::getPtMapping ( SysParType & pType)
private

Definition at line 171 of file PMGSherpaVjetsSysTool.cxx.

171 {
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 }
uint32_t mcChannelNumber() const
The MC generator's channel number.
EventInfo_v1 EventInfo
Definition of the latest event info version.

◆ getSupportedVariations()

std::vector< std::string > PMGTools::PMGSherpaVjetsSysTool::getSupportedVariations ( SysParType ptype)
overrideprotectedvirtual

Helpers to get the list of supported variations for Z/W+jets and gamma+jets.

Implements PMGTools::IPMGSherpaVjetsSysTool.

Definition at line 484 of file PMGSherpaVjetsSysTool.cxx.

484 {
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 }
std::vector< std::string > m_supported_gamma
std::vector< std::string > m_supported_zll
std::vector< std::string > m_supported_w
std::vector< std::string > m_supported_znunu

◆ getWeight()

double PMGTools::PMGSherpaVjetsSysTool::getWeight ( const std::string & sysVariation = "nom")
overridevirtual

Return weight for a given systematic variation.

Implements PMGTools::IPMGSherpaVjetsSysTool.

Definition at line 135 of file PMGSherpaVjetsSysTool.cxx.

135 {
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 }
std::map< std::string, TH2F * > m_map_zll
unsigned int getNtruthJets() override
get number of truth jets as defined in the parametrization analysis
std::map< std::string, TH2F * > m_map_gamma
std::map< std::string, TH2F * > m_map_w
Parametrization maps.
std::map< std::string, TH2F * > m_map_znunu

◆ initialize()

StatusCode PMGTools::PMGSherpaVjetsSysTool::initialize ( void )
overridevirtual

Initialize is required by AsgTool base class.

Reimplemented from asg::AsgTool.

Definition at line 51 of file PMGSherpaVjetsSysTool.cxx.

51 {
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
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 }
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
std::unique_ptr< TFile > m_file
Parametrization files.
TH2F(name, title, nxbins, bins_par2, bins_par3, bins_par4, bins_par5=None, bins_par6=None, path='', **kwargs)

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msg_level_name()

const std::string & asg::AsgTool::msg_level_name ( ) const
inherited

A deprecated function for getting the message level's name.

Instead of using this, weirdly named function, user code should get the string name of the current minimum message level (in case they really need it...), with:

MSG::name( msg().level() )

This function's name doesn't follow the ATLAS coding rules, and as such will be removed in the not too distant future.

Returns
The string name of the current minimum message level that's printed

Definition at line 101 of file AsgTool.cxx.

101 {
102
103 return MSG::name( msg().level() );
104 }
MsgStream & msg() const
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
Definition MsgLevel.cxx:19

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ print()

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ setNjets()

void PMGTools::PMGSherpaVjetsSysTool::setNjets ( int njets)
overrideprotectedvirtual

Some setters to speed up the calculation for multiple variations/events.

Implements PMGTools::IPMGSherpaVjetsSysTool.

Definition at line 479 of file PMGSherpaVjetsSysTool.cxx.

479 {
480 m_current_njets = njets;
481 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_cache_ptidx

unsigned int PMGTools::PMGSherpaVjetsSysTool::m_cache_ptidx
private

Definition at line 75 of file PMGSherpaVjetsSysTool.h.

◆ m_cache_ptype

SysParType PMGTools::PMGSherpaVjetsSysTool::m_cache_ptype
private

Definition at line 74 of file PMGSherpaVjetsSysTool.h.

◆ m_current_njets

int PMGTools::PMGSherpaVjetsSysTool::m_current_njets
private

Current settings.

Definition at line 70 of file PMGSherpaVjetsSysTool.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_file

std::unique_ptr< TFile > PMGTools::PMGSherpaVjetsSysTool::m_file
private

Parametrization files.

Definition at line 78 of file PMGSherpaVjetsSysTool.h.

◆ m_map_gamma

std::map<std::string, TH2F*> PMGTools::PMGSherpaVjetsSysTool::m_map_gamma
private

Definition at line 84 of file PMGSherpaVjetsSysTool.h.

◆ m_map_w

std::map<std::string, TH2F*> PMGTools::PMGSherpaVjetsSysTool::m_map_w
private

Parametrization maps.

Definition at line 81 of file PMGSherpaVjetsSysTool.h.

◆ m_map_zll

std::map<std::string, TH2F*> PMGTools::PMGSherpaVjetsSysTool::m_map_zll
private

Definition at line 82 of file PMGSherpaVjetsSysTool.h.

◆ m_map_znunu

std::map<std::string, TH2F*> PMGTools::PMGSherpaVjetsSysTool::m_map_znunu
private

Definition at line 83 of file PMGSherpaVjetsSysTool.h.

◆ m_supported_gamma

std::vector<std::string> PMGTools::PMGSherpaVjetsSysTool::m_supported_gamma
private

Definition at line 89 of file PMGSherpaVjetsSysTool.h.

◆ m_supported_w

std::vector<std::string> PMGTools::PMGSherpaVjetsSysTool::m_supported_w
private

Definition at line 86 of file PMGSherpaVjetsSysTool.h.

◆ m_supported_zll

std::vector<std::string> PMGTools::PMGSherpaVjetsSysTool::m_supported_zll
private

Definition at line 87 of file PMGSherpaVjetsSysTool.h.

◆ m_supported_znunu

std::vector<std::string> PMGTools::PMGSherpaVjetsSysTool::m_supported_znunu
private

Definition at line 88 of file PMGSherpaVjetsSysTool.h.

◆ m_truthJetContainer

std::string PMGTools::PMGSherpaVjetsSysTool::m_truthJetContainer
private

The truth jet container to use for the calculation.

Definition at line 97 of file PMGSherpaVjetsSysTool.h.

◆ m_truthParticleContainer

std::string PMGTools::PMGSherpaVjetsSysTool::m_truthParticleContainer
private

The truth particle container to use for the calculation.

Definition at line 99 of file PMGSherpaVjetsSysTool.h.

◆ m_use_cache

bool PMGTools::PMGSherpaVjetsSysTool::m_use_cache
private

Cache MC DSID (to avoid checking it everytime)

Definition at line 73 of file PMGSherpaVjetsSysTool.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.

◆ m_weightsFile

std::string PMGTools::PMGSherpaVjetsSysTool::m_weightsFile
private

Tool properties.

Parametrizations input file

Definition at line 94 of file PMGSherpaVjetsSysTool.h.


The documentation for this class was generated from the following files: