ATLAS Offline Software
Loading...
Searching...
No Matches
Rivet_i Class Reference

Interface to the Rivet analysis package. More...

#include <Rivet_i.h>

Inheritance diagram for Rivet_i:
Collaboration diagram for Rivet_i:

Public Member Functions

 Rivet_i (const std::string &name, ISvcLocator *pSvcLocator)
 Standard algorithm constructor.
virtual StatusCode initialize ATLAS_NOT_THREAD_SAFE () override
 Initialise the Rivet interface and Athena services.
virtual StatusCode execute () override
 Run the Rivet analyses on one event, which is retrieved from StoreGate.
virtual StatusCode finalize () override
 Finalise each analysis and commit the plots to an AIDA tree and the THistSvc ROOT tree.
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
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 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

Protected Member Functions

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

std::unique_ptr< HepMC::GenEvent > checkEvent (const HepMC::GenEvent &event, const EventContext &ctx)
 Book an AIDA::IDataPointSet into the THistSvc as a TH1D at path.
void MeV2GeV (HepMC::GenEvent &event)
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

std::string m_stream
 A pointer to the THistSvc.
std::string m_file
 The base file name to write results to.
std::string m_preload
std::string m_anapath
 The analysis plugin search path.
bool m_ignorebeams
 Whether to avoid the beam consistency checks.
bool m_needsConversion
 Do we need to convert xAOD::Truth back to HepMC::GenEvemt?
bool m_patchBeams
 Flag to insert beam protons when they are unavailable in the event.
ToolHandle< IxAODtoHepMCToolm_xAODtoHepMCTool {this, "HepMCTool", "xAODtoHepMCTool"}
 A tool to convert xAOD::Truth to HepMC::GenEvent.
bool m_doRootHistos
 Will we convert Rivet's internal histo format into a ROOT histo for streaming with THistSvc?
std::string m_runname
 The name of the run (prepended to plot paths).
std::string m_genEventKey
 The GenEvent StoreGate key (default "GEN_EVENT")
Rivet::AnalysisHandler * m_analysisHandler
 A Rivet analysis handler.
std::vector< std::string > m_analysisNames
 A list of names of the analyses to run (set from the job properties)
double m_crossSection
 The cross section for this run of events, set from the job properties.
double m_crossSection_uncert
 The uncertainity of the cross section for this run of events, set from the job properties.
bool m_init
 Flag to determine whether Rivet init has already happened (in execute())
bool m_skipweights
 Skip variation weights and only run nominal.
std::string m_matchWeights
 String of weight names (or regex) to select multiweights.
std::string m_unmatchWeights
 String of weight names (or regex) to veto multiweights.
std::string m_nominalWeightName
 String to specify non-standard nominal weight.
double m_weightcap
 Weight cap to set allowed maximum for weights.
SG::ReadHandleKey< xAOD::EventInfom_evtInfoKey
DataObjIDColl m_extendedExtraObjects
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

Interface to the Rivet analysis package.

Author
James Monk jmonk.nosp@m.@cer.nosp@m.n.ch
Andy Buckley andy..nosp@m.buck.nosp@m.ley@c.nosp@m.ern..nosp@m.ch
Christian Gutschow chris.nosp@m..g@c.nosp@m.ern.c.nosp@m.h

Definition at line 31 of file Rivet_i.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ Rivet_i()

Rivet_i::Rivet_i ( const std::string & name,
ISvcLocator * pSvcLocator )

Standard algorithm constructor.

Convert to inherit from GenBase, now we're developing Rivet 2 interfacing for R19+ only.

Definition at line 35 of file Rivet_i.cxx.

35 :
36 AthAlgorithm(name, pSvcLocator),
37 m_needsConversion(false),
39 m_init(false)
40{
41 // Options
42 declareProperty("McEventKey", m_genEventKey="GEN_EVENT");
44 declareProperty("CrossSection", m_crossSection=0.0);
45 declareProperty("CrossSectionUncertainty", m_crossSection_uncert=0.0);
46 declareProperty("Stream", m_stream="/Rivet");
47 declareProperty("RunName", m_runname="");
48 declareProperty("HistoFile", m_file="Rivet.yoda.gz");
49 declareProperty("HistoPreload", m_preload="");
50 declareProperty("AnalysisPath", m_anapath="");
51 declareProperty("IgnoreBeamCheck", m_ignorebeams=false);
52 declareProperty("DoRootHistos", m_doRootHistos=false);
53 declareProperty("SkipWeights", m_skipweights=false);
54 declareProperty("MatchWeights", m_matchWeights="");
55 declareProperty("UnmatchWeights", m_unmatchWeights="");
56 declareProperty("NominalWeightName", m_nominalWeightName="");
57 declareProperty("WeightCap", m_weightcap=-1.0);
58 declareProperty("AddMissingBeamParticles",m_patchBeams=false);
59}
AthAlgorithm()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
bool m_skipweights
Skip variation weights and only run nominal.
Definition Rivet_i.h:128
double m_weightcap
Weight cap to set allowed maximum for weights.
Definition Rivet_i.h:140
std::vector< std::string > m_analysisNames
A list of names of the analyses to run (set from the job properties)
Definition Rivet_i.h:116
bool m_ignorebeams
Whether to avoid the beam consistency checks.
Definition Rivet_i.h:86
double m_crossSection
The cross section for this run of events, set from the job properties.
Definition Rivet_i.h:119
bool m_patchBeams
Flag to insert beam protons when they are unavailable in the event.
Definition Rivet_i.h:94
std::string m_anapath
The analysis plugin search path.
Definition Rivet_i.h:80
bool m_init
Flag to determine whether Rivet init has already happened (in execute())
Definition Rivet_i.h:125
std::string m_file
The base file name to write results to.
Definition Rivet_i.h:72
std::string m_unmatchWeights
String of weight names (or regex) to veto multiweights.
Definition Rivet_i.h:134
std::string m_matchWeights
String of weight names (or regex) to select multiweights.
Definition Rivet_i.h:131
double m_crossSection_uncert
The uncertainity of the cross section for this run of events, set from the job properties.
Definition Rivet_i.h:122
bool m_needsConversion
Do we need to convert xAOD::Truth back to HepMC::GenEvemt?
Definition Rivet_i.h:91
Rivet::AnalysisHandler * m_analysisHandler
A Rivet analysis handler.
Definition Rivet_i.h:113
bool m_doRootHistos
Will we convert Rivet's internal histo format into a ROOT histo for streaming with THistSvc?
Definition Rivet_i.h:104
std::string m_stream
A pointer to the THistSvc.
Definition Rivet_i.h:69
std::string m_preload
Definition Rivet_i.h:75
std::string m_genEventKey
The GenEvent StoreGate key (default "GEN_EVENT")
Definition Rivet_i.h:110
std::string m_nominalWeightName
String to specify non-standard nominal weight.
Definition Rivet_i.h:137
std::string m_runname
The name of the run (prepended to plot paths).
Definition Rivet_i.h:107

Member Function Documentation

◆ ATLAS_NOT_THREAD_SAFE()

virtual StatusCode initialize Rivet_i::ATLAS_NOT_THREAD_SAFE ( )
overridevirtual

Initialise the Rivet interface and Athena services.

Pass a list of analyses to the Rivet AnalysisHandler, which dynamically loads the necessary libraries (including user-written analyses).

◆ checkEvent()

std::unique_ptr< HepMC::GenEvent > Rivet_i::checkEvent ( const HepMC::GenEvent & event,
const EventContext & ctx )
private

Book an AIDA::IDataPointSet into the THistSvc as a TH1D at path.

Parameters
pathBook an AIDA::IDataPointSet into the THistSvc as a TGraph at path
path

Definition at line 262 of file Rivet_i.cxx.

262 {
263 auto modEvent = std::make_unique<HepMC::GenEvent>(event);
264
265 if (!m_needsConversion) {
266 // overwrite the HEPMC dummy event number with the proper ATLAS event number
267 SG::ReadHandle<xAOD::EventInfo> evtInfo(m_evtInfoKey, ctx);
268 modEvent->set_event_number(static_cast<int>(evtInfo->eventNumber()));
269 }
270
271 // weight-name cleaning
272#ifdef HEPMC3
273 std::shared_ptr<HepMC3::GenRunInfo> modRunInfo;
274 if (event.run_info()) {
275 modRunInfo = std::make_shared<HepMC3::GenRunInfo>(*(event.run_info().get()));
276 if (event.run_info()->weight_names().empty() && event.weights().size() == 1) {
277 modRunInfo->set_weight_names({"Default"});
278 }
279 }
280 else {
281 ATH_MSG_DEBUG("No run info, event weights size is " << event.weights().size() );
282 modRunInfo = std::make_shared<HepMC3::GenRunInfo>();
283 std::vector<std::string> w_names;
284 for (size_t i = 0; i < event.weights().size(); i++) { w_names.push_back(std::string("badweight") + std::to_string(i)); }
285 modRunInfo->set_weight_names(w_names);
286 }
287 modEvent->set_run_info(std::move(modRunInfo));
288 std::vector<std::string> w_names = modEvent->weight_names();
289 if (w_names.size()) {
290 std::vector<std::pair<std::string,std::string> > w_subs = {
291 {" nominal ",""},
292 {" set = ","_"},
293 {" = ","_"},
294 {"=",""},
295 {",",""},
296 {".",""},
297 {":",""},
298 {" ","_"},
299 {"#","num"},
300 {"\n","_"},
301 {"/","over"}
302 };
303 for (std::string& wname : w_names) {
304 for (const auto& sub : w_subs) {
305 size_t start_pos = wname.find(sub.first);
306 while (start_pos != std::string::npos) {
307 wname.replace(start_pos, sub.first.length(), sub.second);
308 start_pos = wname.find(sub.first);
309 }
310 }
311 }
312 modEvent->run_info()->set_weight_names(w_names);
313 }
314#else
315 const HepMC::WeightContainer& old_wc = event.weights();
316 std::vector<std::string> old_wnames = old_wc.weight_names();
317 if (old_wnames.size()) {
318 HepMC::WeightContainer& new_wc = modEvent->weights();
319 new_wc.clear();
320 std::vector<std::pair<std::string,std::string> > w_subs = {
321 {" nominal ",""},
322 {" set = ","_"},
323 {" = ","_"},
324 {"=",""},
325 {",",""},
326 {".",""},
327 {":",""},
328 {" ","_"},
329 {"#","num"},
330 {"\n","_"},
331 {"/","over"}
332 };
333 std::map<std::string, double> new_name_to_value;
334 std::map<std::string, std::string> old_name_to_new_name;
335 for (const std::string& old_name : old_wnames) {
336 std::string wname = std::string(old_name);
337 double value = old_wc[old_name];
338 for (const auto& sub : w_subs) {
339 size_t start_pos = wname.find(sub.first);
340 while (start_pos != std::string::npos) {
341 wname.replace(start_pos, sub.first.length(), sub.second);
342 start_pos = wname.find(sub.first);
343 }
344 }
345 new_name_to_value[wname] = value;
346 old_name_to_new_name[old_name] = wname;
347 }
348 auto itEnd = old_name_to_new_name.end();
349 for (const std::string& old_name : old_wnames) {
350 if (old_name_to_new_name.find(old_name) == itEnd) continue;
351 const std::string& new_name = old_name_to_new_name[old_name];
352 new_wc[ new_name ] = new_name_to_value[new_name];
353 }
354 // end of weight-name cleaning
355 }
356#endif
357
358#ifdef HEPMC3
359 modEvent->set_units(HepMC3::Units::GEV, HepMC3::Units::MM);
360 if (modEvent->particles().size() == 1) modEvent->set_beam_particles(modEvent->particles().front(), modEvent->particles().front());
361 if (m_patchBeams) {
362 // workaround in case beam particles were missing in xAOD::Truth
363 // first work out centre-of-mass energy
364 double etotal = 0;
365 for (const auto& p : modEvent->particles()) {
366 if (!MC::isStable(p)) continue;
367 etotal += p->momentum().e();
368 }
369 const double ebeam = 0.5*etotal;
370 // create dummy beam particles
371 HepMC::GenParticlePtr b1 = std::make_shared<HepMC::GenParticle>(HepMC::FourVector(0,0,ebeam,ebeam),2212,4);
372 HepMC::GenParticlePtr b2 = std::make_shared<HepMC::GenParticle>(HepMC::FourVector(0,0,-1*ebeam,ebeam),2212,4);
373 // remove particles incorrectly labelled as beam particles
374 std::vector<HepMC::GenParticlePtr> notBeams;
375 for (const HepMC::GenParticlePtr& p : modEvent->beams()) {
376 if (!MC::isBeam(p)) notBeams.push_back(p);
377 }
378 //AV: the loop is over shared pointers! Should be const auto&
379 for (const auto& bp : notBeams) bp->production_vertex()->remove_particle_out(bp);
380 // add dummy beam particles
381 modEvent->set_beam_particles(std::move(b1), std::move(b2));
382 }
383 if (modEvent->beams().front()->momentum().e() > 50000.0) {
384 MeV2GeV(*modEvent);
385 }
386#else
387 modEvent->use_units(HepMC::Units::GEV, HepMC::Units::MM);
388 if (modEvent->particles_size() == 1) modEvent->set_beam_particles(*modEvent->particles_begin(), *modEvent->particles_begin());
389 if (modEvent->beam_particles().first->momentum().e() > 50000.0) {
390 MeV2GeV(*modEvent);
391 }
392#endif
393
394 return modEvent;
395}
#define ATH_MSG_DEBUG(x)
SG::ReadHandleKey< xAOD::EventInfo > m_evtInfoKey
Definition Rivet_i.h:142
void MeV2GeV(HepMC::GenEvent &event)
Definition Rivet_i.cxx:397
GenParticle * GenParticlePtr
Definition GenParticle.h:37
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
bool isBeam(const T &p)
Identify if the particle is beam particle.

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::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< Algorithm > >::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< Algorithm > >::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< Algorithm > >::evtStore ( )
inlineinherited

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

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode Rivet_i::execute ( )
overridevirtual

Run the Rivet analyses on one event, which is retrieved from StoreGate.

Todo
Replace with new GenBase functionality
Todo
Actually use back(), for the most recent event, or throw an exception if more than one event found?
Todo
Todo
Replace with new GenBase const_event() functionality

Definition at line 141 of file Rivet_i.cxx.

141 {
142 ATH_MSG_DEBUG("Rivet_i execute");
143
144 const EventContext& ctx = getContext();
145
147 ATH_MSG_DEBUG("Rivet_i needs xAOD::Truth to HepMC::GenEvent conversion? " << m_needsConversion);
148
149 std::unique_ptr<HepMC::GenEvent> checkedEvent;
150 if (m_needsConversion) {
151 const xAOD::TruthEventContainer* truthCollection = nullptr;
152 if (evtStore()->retrieve(truthCollection, "TruthEvents").isFailure()) {
153 ATH_MSG_ERROR("Could not retrieve TruthEvents collection, aborting.");
154 return StatusCode::FAILURE;
155 }
156
157 SG::ReadHandle<xAOD::EventInfo> eventInfo(m_evtInfoKey, ctx);
158 ATH_MSG_DEBUG("Attempt xAOD::Truth to HepMC::GenEvent conversion.");
159 std::vector<HepMC::GenEvent>&& hepmc_evts = m_xAODtoHepMCTool->getHepMCEvents(truthCollection, eventInfo.cptr());
160
161 if (hepmc_evts.empty()) {
162 ATH_MSG_ERROR("Conversion didn't yield HepMC::GenEvent, aborting.");
163 return StatusCode::FAILURE;
164 }
165 checkedEvent = checkEvent(std::move(hepmc_evts[0]), ctx);
166 }
167 else {
168 // Get the event collection
170 const McEventCollection* eventCollection = nullptr;
171 StatusCode sc = evtStore()->retrieve(eventCollection, m_genEventKey);
172 if (sc.isFailure() || eventCollection == 0) {
173 ATH_MSG_ERROR("Unable to retrieve event collection from StoreGate with key " << m_genEventKey);
174 return StatusCode::FAILURE;
175 } else {
176 ATH_MSG_DEBUG("Retrieved event collection from StoreGate with key " << m_genEventKey);
177 }
178
179 // Get the first event in the event collection
182 const HepMC::GenEvent* event = eventCollection->front();
183 if (event == nullptr) {
184 ATH_MSG_ERROR("Rivet_i received a null HepMC event");
185 return StatusCode::FAILURE;
186 }
187
188 // Modify the event units etc. if necessary
189 checkedEvent = checkEvent(*event, ctx);
190 }
191
192 if(!checkedEvent) {
193 ATH_MSG_ERROR("Check on HepMC event failed!");
194 return StatusCode::FAILURE;
195 }
196
197 // Initialize Rivet (on the first event only)
198 if (!m_init) {
199 m_analysisHandler->init(*checkedEvent);
200 m_init = true;
201 }
202
203 // Analyse the event
204 m_analysisHandler->analyze(*checkedEvent);
205
206 return StatusCode::SUCCESS;
207}
#define ATH_MSG_ERROR(x)
static Double_t sc
const T * front() const
Access the first element in the collection as an rvalue.
ToolHandle< IxAODtoHepMCTool > m_xAODtoHepMCTool
A tool to convert xAOD::Truth to HepMC::GenEvent.
Definition Rivet_i.h:97
std::unique_ptr< HepMC::GenEvent > checkEvent(const HepMC::GenEvent &event, const EventContext &ctx)
Book an AIDA::IDataPointSet into the THistSvc as a TH1D at path.
Definition Rivet_i.cxx:262
::StatusCode StatusCode
StatusCode definition for legacy code.
retrieve(aClass, aKey=None)
Definition PyKernel.py:110
TruthEventContainer_v1 TruthEventContainer
Declare the latest version of the truth event container.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::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

◆ extraOutputDeps()

const DataObjIDColl & AthAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 50 of file AthAlgorithm.cxx.

51{
52 // If we didn't find any symlinks to add, just return the collection
53 // from the base class. Otherwise, return the extended collection.
54 if (!m_extendedExtraObjects.empty()) {
56 }
57 return Algorithm::extraOutputDeps();
58}
DataObjIDColl m_extendedExtraObjects

◆ finalize()

StatusCode Rivet_i::finalize ( )
overridevirtual

Finalise each analysis and commit the plots to an AIDA tree and the THistSvc ROOT tree.

Definition at line 210 of file Rivet_i.cxx.

210 {
211 ATH_MSG_INFO("Rivet_i finalizing");
212
213 // Setting cross-section in Rivet
214 // If no user-specified cross-section available,
215 // take whatever is in the GenEvent
217
218 // Call Rivet finalize
219 m_analysisHandler->finalize();
220
221
222
223 // Write out YODA file (add .yoda suffix if missing)
224 if (m_file.find(".yoda") == std::string::npos) m_file += ".yoda.gz";
225 auto pos = m_file.find(".gz.");
226 if (pos == std::string::npos) {
227 m_analysisHandler->writeData(m_file);
228 }
229 else {//filename is e.g. something.yoda.gz.1
230 //write to output file name without the ".1"
231 m_analysisHandler->writeData(m_file.substr(0, pos)+".gz");
232 // then rename it as the requested output filename
233 if (std::rename((m_file.substr(0, pos)+".gz").c_str(), m_file.c_str()) !=0) {
234 std::string error_msg = "Impossible to rename ";
235 error_msg += m_file.substr(0, pos)+".gz";
236 error_msg += " as ";
237 error_msg += m_file;
238 ATH_MSG_ERROR(error_msg.c_str());
239 return StatusCode::FAILURE;
240 }
241 }
242
243 return StatusCode::SUCCESS;
244}
#define ATH_MSG_INFO(x)

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::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.

◆ MeV2GeV()

void Rivet_i::MeV2GeV ( HepMC::GenEvent & event)
private

Definition at line 397 of file Rivet_i.cxx.

397 {
398#ifdef HEPMC3
399 for (auto& p: evt.particles()) {
400 p->set_momentum(p->momentum()*0.001);
401#else
402 for (HepMC::GenParticlePtr p: evt) {
403 const HepMC::FourVector& mom = p->momentum();
404 p->set_momentum(HepMC::FourVector (mom.px()*0.001,
405 mom.py()*0.001,
406 mom.pz()*0.001,
407 mom.e()*0.001));
408#endif
409 p->set_generated_mass(p->generated_mass()*0.001);
410 }
411}

◆ msg()

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msgLvl()

bool AthCommonMsg< Algorithm >::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< Algorithm > >::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.

◆ 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< Algorithm > >::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< Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

StatusCode AthAlgorithm::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, AthHistogramAlgorithm, and PyAthena::Alg.

Definition at line 66 of file AthAlgorithm.cxx.

66 {
68
69 if (sc.isFailure()) {
70 return sc;
71 }
72 ServiceHandle<ICondSvc> cs("CondSvc",name());
73 for (auto h : outputHandles()) {
74 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
75 // do this inside the loop so we don't create the CondSvc until needed
76 if ( cs.retrieve().isFailure() ) {
77 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
78 return StatusCode::SUCCESS;
79 }
80 if (cs->regHandle(this,*h).isFailure()) {
81 sc = StatusCode::FAILURE;
82 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
83 << " with CondSvc");
84 }
85 }
86 }
87 return sc;
88}
#define ATH_MSG_WARNING(x)
virtual StatusCode sysInitialize() override
Override sysInitialize.
AthCommonDataStore(const std::string &name, T... args)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Algorithm > >::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< Algorithm > >::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_analysisHandler

Rivet::AnalysisHandler* Rivet_i::m_analysisHandler
private

A Rivet analysis handler.

Definition at line 113 of file Rivet_i.h.

◆ m_analysisNames

std::vector<std::string> Rivet_i::m_analysisNames
private

A list of names of the analyses to run (set from the job properties)

Definition at line 116 of file Rivet_i.h.

◆ m_anapath

std::string Rivet_i::m_anapath
private

The analysis plugin search path.

This will be used to internally set RIVET_ANALYSIS_PATH, if not already set in the environment.

Definition at line 80 of file Rivet_i.h.

◆ m_crossSection

double Rivet_i::m_crossSection
private

The cross section for this run of events, set from the job properties.

Definition at line 119 of file Rivet_i.h.

◆ m_crossSection_uncert

double Rivet_i::m_crossSection_uncert
private

The uncertainity of the cross section for this run of events, set from the job properties.

Definition at line 122 of file Rivet_i.h.

◆ m_detStore

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

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_doRootHistos

bool Rivet_i::m_doRootHistos
private

Will we convert Rivet's internal histo format into a ROOT histo for streaming with THistSvc?

The default is yes Currently (03.01.12) there is no conversion for 2D distributions, in which case you want to set this to False

Definition at line 104 of file Rivet_i.h.

◆ m_evtInfoKey

SG::ReadHandleKey<xAOD::EventInfo> Rivet_i::m_evtInfoKey
private
Initial value:
{this
, "EventInfo"
, "EventInfo"
, "ReadHandleKey for xAOD::EventInfo" }

Definition at line 142 of file Rivet_i.h.

142 {this
143 , "EventInfo"
144 , "EventInfo"
145 , "ReadHandleKey for xAOD::EventInfo" };

◆ m_evtStore

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

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthAlgorithm::m_extendedExtraObjects
privateinherited

Definition at line 79 of file AthAlgorithm.h.

◆ m_file

std::string Rivet_i::m_file
private

The base file name to write results to.

Definition at line 72 of file Rivet_i.h.

◆ m_genEventKey

std::string Rivet_i::m_genEventKey
private

The GenEvent StoreGate key (default "GEN_EVENT")

Definition at line 110 of file Rivet_i.h.

◆ m_ignorebeams

bool Rivet_i::m_ignorebeams
private

Whether to avoid the beam consistency checks.

Default is false: checks will be made to ensure that the supplied events have beams of the sort that the analysis was written to expect.

Definition at line 86 of file Rivet_i.h.

◆ m_init

bool Rivet_i::m_init
private

Flag to determine whether Rivet init has already happened (in execute())

Definition at line 125 of file Rivet_i.h.

◆ m_matchWeights

std::string Rivet_i::m_matchWeights
private

String of weight names (or regex) to select multiweights.

Definition at line 131 of file Rivet_i.h.

◆ m_needsConversion

bool Rivet_i::m_needsConversion
private

Do we need to convert xAOD::Truth back to HepMC::GenEvemt?

Default is false: assume user runs on EVNT files

Definition at line 91 of file Rivet_i.h.

◆ m_nominalWeightName

std::string Rivet_i::m_nominalWeightName
private

String to specify non-standard nominal weight.

Definition at line 137 of file Rivet_i.h.

◆ m_patchBeams

bool Rivet_i::m_patchBeams
private

Flag to insert beam protons when they are unavailable in the event.

Definition at line 94 of file Rivet_i.h.

◆ m_preload

std::string Rivet_i::m_preload
private

Definition at line 75 of file Rivet_i.h.

◆ m_runname

std::string Rivet_i::m_runname
private

The name of the run (prepended to plot paths).

Definition at line 107 of file Rivet_i.h.

◆ m_skipweights

bool Rivet_i::m_skipweights
private

Skip variation weights and only run nominal.

Definition at line 128 of file Rivet_i.h.

◆ m_stream

std::string Rivet_i::m_stream
private

A pointer to the THistSvc.

The stream name for storing the output plots under (default "/Rivet")

Definition at line 69 of file Rivet_i.h.

◆ m_unmatchWeights

std::string Rivet_i::m_unmatchWeights
private

String of weight names (or regex) to veto multiweights.

Definition at line 134 of file Rivet_i.h.

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.

◆ m_weightcap

double Rivet_i::m_weightcap
private

Weight cap to set allowed maximum for weights.

Definition at line 140 of file Rivet_i.h.

◆ m_xAODtoHepMCTool

ToolHandle<IxAODtoHepMCTool> Rivet_i::m_xAODtoHepMCTool {this, "HepMCTool", "xAODtoHepMCTool"}
private

A tool to convert xAOD::Truth to HepMC::GenEvent.

Definition at line 97 of file Rivet_i.h.

97{this, "HepMCTool", "xAODtoHepMCTool"};

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