ATLAS Offline Software
Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
Sherpa_i Class Reference

#include <Sherpa_i.h>

Inheritance diagram for Sherpa_i:
Collaboration diagram for Sherpa_i:

Public Member Functions

 Sherpa_i (const std::string &name, ISvcLocator *pSvcLocator)
 
StatusCode genInitialize ()
 For initializing the generator, if required. More...
 
StatusCode callGenerator ()
 For calling the generator on each iteration of the event loop. More...
 
StatusCode genFinalize ()
 For finalising the generator, if required. More...
 
StatusCode fillEvt (HepMC::GenEvent *evt)
 For filling the HepMC event object. More...
 
void getParameters (int &argc, char **&argv)
 
void compilePlugin (std::string)
 
virtual StatusCode sysInitialize () override
 Override sysInitialize. More...
 
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies. More...
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
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. More...
 

Protected Attributes

SHERPA::Sherpa * p_sherpa {}
 
std::string m_basefragment
 Sherpa base settings (read from base fragment file) More...
 
StringProperty m_runcard {this, "RunCard", ""}
 FIXME unused? More...
 
StringArrayProperty m_params {this, "Parameters", {} }
 List of additional Sherpa parameters beyond run card snippet (from JO file) More...
 
StringArrayProperty m_openloopslibs {this, "OpenLoopsLibs", {} }
 List of needed OpenLoops process libraries (from JO file) More...
 
StringArrayProperty m_extrafiles {this, "ExtraFiles", {} }
 List of any additional needed files, e.g. custom libraries, PDF sets (from JO file) More...
 
IntegerProperty m_ncores {this, "NCores", 1}
 Number of cores recommended for multi-core integration file. More...
 
DoubleProperty m_memorymb {this, "MemoryMB", 2500.}
 Memory required for integration/evgen. More...
 
StringProperty m_plugincode {this, "PluginCode", ""}
 Optional code for plugin library to compile and load at run time. More...
 
DoubleProperty m_variation_weight_cap {this, "VariationWeightCap", 10.0}
 Variation weight cap factor. More...
 
DoubleProperty m_xsscale {this, "CrossSectionScaleFactor", 1.0}
 
BooleanProperty m_cleanup {this, "CleanupGeneratedFiles", true}
 
IntegerProperty m_dsid {this, "Dsid", 999999, "Dataset ID number"}
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

DataObjIDColl m_extendedExtraObjects
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Utility event-mangling functions

Todo:
Replace with HepMC units when available
ServiceHandle< IPartPropSvc > m_ppSvc {this, "PartPropSvc", "PartPropSvc"}
 Handle on the particle property service. More...
 
SG::ReadHandleKey< McEventCollectionm_mcevents_const { this, "McEventKey", "GEN_EVENT", "StoreGate key of the MC event collection" }
 Const handle to the MC event collection. More...
 
void GeVToMeV (HepMC::GenEvent *evt)
 Scale event energies/momenta by x 1000. More...
 
void MeVToGeV (HepMC::GenEvent *evt)
 Scale event energies/momenta by x 1/1000. More...
 
void cmTomm (HepMC::GenEvent *evt)
 Scale event lengths by x 10. More...
 
void mmTocm (HepMC::GenEvent *evt)
 Scale event lengths by x 1/10. More...
 

Features for derived classes to use internally

IntegerProperty m_randomSeed {this, "RandomSeed", 1234567, "Random seed for the built-in random engine"}
 Seed for random number engine. More...
 
BooleanProperty m_isAfterburner {this, "IsAfterburner", false, "Set true if generator modifies existing events rather than creating new ones"}
 Flag for normal vs. afterburner generators. More...
 
ServiceHandle< IAthRNGSvcm_rndmSvc {this, "RndmSvc", "AthRNGSvc"}
 Data members. More...
 
ServiceHandle< IIncidentSvc > m_incidentSvc {this, "IncidentSvc", "IncidentSvc"}
 Handle on the incident service. More...
 
CLHEP::HepRandomEngine * getRandomEngine (const std::string &streamName, const EventContext &ctx) const
 
CLHEP::HepRandomEngine * getRandomEngine (const std::string &streamName, unsigned long int randomSeedOffset, const EventContext &ctx) const
 
CLHEP::HepRandomEngine * getRandomEngineDuringInitialize (const std::string &streamName, unsigned long int randomSeedOffset, unsigned int conditionsRun=1, unsigned int lbn=1) const
 

Detailed Description

Definition at line 18 of file Sherpa_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

◆ Sherpa_i()

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

Definition at line 38 of file Sherpa_i.cxx.

39  : GenModule(name, pSvcLocator)
40 {
41  #ifdef IS_SHERPA_3
42  declareProperty("BaseFragment", m_inputfiles["Base.yaml"] = "");
43  declareProperty("RunCard", m_inputfiles["Sherpa.yaml"] = "");
44  #endif
45 }

Member Function Documentation

◆ ATLAS_NOT_CONST_THREAD_SAFE() [1/2]

HepMC::GenEvent* event GenBase::ATLAS_NOT_CONST_THREAD_SAFE ( )
inlineinherited

Access the current signal event (first in the McEventCollection)

Note
This function will make a new McEventCollection if there is not already a valid one and MakeMcEvent=True.

Definition at line 76 of file GenBase.h.

76  {
77  if (events()->empty())
78  ATH_MSG_ERROR("McEventCollection is empty during first event access");
79  return *(events()->begin());
80  }

◆ ATLAS_NOT_CONST_THREAD_SAFE() [2/2]

McEventCollection* events GenBase::ATLAS_NOT_CONST_THREAD_SAFE ( )
inherited

Access the current event's McEventCollection.

Note
This function will make a new McEventCollection if there is not already a valid one and MakeMcEvent=True.

◆ callGenerator()

StatusCode Sherpa_i::callGenerator ( )
virtual

For calling the generator on each iteration of the event loop.

Reimplemented from GenModule.

Definition at line 200 of file Sherpa_i.cxx.

200  {
201  ATH_MSG_DEBUG("Sherpa_i in callGenerator()");
202  //Re-seed the random number stream
203  long seeds[7];
204  const EventContext& ctx = Gaudi::Hive::currentContext();
205  ATHRNG::calculateSeedsMC21(seeds, "SHERPA", ctx.eventID().event_number(), m_dsid, m_randomSeed);
206  p_rndEngine->setSeeds(seeds, 0); // NOT THREAD-SAFE
207 
208  do {
209  ATH_MSG_DEBUG("Trying to generate event with Sherpa");
210  } while (p_sherpa->GenerateOneEvent()==false);
211 
212  const size_t genEvents = ATOOLS::rpa->gen.NumberOfGeneratedEvents();
213  if (genEvents%1000==0) {
214  ATH_MSG_INFO("Passed "<<genEvents<<" events.");
215  }
216 
217  return StatusCode::SUCCESS;
218 }

◆ cmTomm()

void GenBase::cmTomm ( HepMC::GenEvent *  evt)
protectedinherited

Scale event lengths by x 10.

Definition at line 81 of file GenBase.cxx.

81  {
82  for (HepMC::GenEvent::vertex_iterator vtx = evt->vertices_begin(); vtx != evt->vertices_end(); ++vtx) {
83  const HepMC::FourVector fv((*vtx)->position().x() * 10,
84  (*vtx)->position().y() * 10,
85  (*vtx)->position().z() * 10,
86  (*vtx)->position().t() * 10);
87  (*vtx)->set_position(fv);
88  }
89 }

◆ compilePlugin()

void Sherpa_i::compilePlugin ( std::string  pluginCode)

Definition at line 353 of file Sherpa_i.cxx.

353  {
354  // TODO: not very pretty, should we eventually do this in Python instead (base fragment)
355  FILE *file = fopen("Sherpa_iPlugin.C","w");
356  fputs(pluginCode.c_str(),file);
357  fclose(file);
358  std::string command;
359  // Python -> C++ string conversion seems to add quote character as first
360  // and last line if the string contains quotes (like always in a plugin)
361  // thus removing them here
362  command += "tail -n +2 Sherpa_iPlugin.C | head -n -1 > Sherpa_iPlugin.C.tmp; mv Sherpa_iPlugin.C.tmp Sherpa_iPlugin.C; ";
363  command += "g++ -shared -std=c++0x -g ";
364  command += "-I`Sherpa-config --incdir` ";
365  command += "`Sherpa-config --ldflags` ";
366  command += "-I$FASTJETPATH/include ";
367  command += "-fPIC -o libSherpa_iPlugin.so Sherpa_iPlugin.C";
368  ATH_MSG_INFO("Now compiling plugin library using: "+command);
369  if (system(command.c_str())!=0) {
370  ATH_MSG_ERROR("Error compiling plugin library.");
371  }
372 }

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyArrayType  
)
inlineprivateinherited

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

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

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

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

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleType  
)
inlineprivateinherited

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

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( Gaudi::Property< T > &  t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

◆ 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.

95 { return m_detStore; }

◆ event_const()

const HepMC::GenEvent* GenBase::event_const ( ) const
inlineinherited

Access the current signal event (const)

Definition at line 83 of file GenBase.h.

83  {
84  if (events_const()->empty())
85  ATH_MSG_ERROR("Const McEventCollection is empty during first event access");
86  return *(events_const()->begin());
87  }

◆ events_const() [1/2]

const McEventCollection* GenBase::events_const ( ) const
inlineinherited

Access the current event's McEventCollection (const)

Definition at line 96 of file GenBase.h.

96  {
97  return events_const( getContext() );
98  }

◆ events_const() [2/2]

const McEventCollection* GenBase::events_const ( const EventContext &  ctx) const
inlineinherited

Definition at line 99 of file GenBase.h.

99  {
101  if (!ret.isValid())
102  ATH_MSG_ERROR("No McEventCollection found in StoreGate with key " << m_mcevents_const.key());
103  return ret.cptr();
104  }

◆ evtStore() [1/2]

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.

85 { return m_evtStore; }

◆ evtStore() [2/2]

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

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

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ execute()

StatusCode GenModule::execute ( )
virtualinherited
Todo:
Remove hard-coded alg name checking (already incomplete)

Reimplemented from GenBase.

Definition at line 70 of file GenModule.cxx.

70  {
71  // Examples of how to retrieve the random number engine for a given
72  // stream.
73  // NB getRandomEngine should only be called once per event for a
74  // given stream, as it causes the stream to be re-seeded each time
75  // it is called.
76 
77  // Example 1 - seeded based on the current event number (+ slot, run, streamName)
78  //const EventContext& ctx = Gaudi::Hive::currentContext();
79  //CLHEP::HepRandomEngine* rndmEngine = this->getRandomEngine("MyStream", ctx);
80 
81  // Example 2 - seeded based on the m_randomSeed property (+ slot, run, streamName)
82  //const EventContext& ctx = Gaudi::Hive::currentContext();
83  //CLHEP::HepRandomEngine* rndmEngine = this->getRandomEngine("MyStream", m_randomSeed.value(), ctx);
84 
85  // Call the code that generates an event
86  CHECK(this->callGenerator());
87 
88  // Create the MC event and send the GeneratorEvent stored in it to fillEvt
89  HepMC::GenEvent* evt = HepMC::newGenEvent(1,1);
90  CHECK(this->fillEvt(evt));
92 
93  // Add the event to the MC event collection
94  if (events()) {
95  // If this is an "afterburner" generator, replace the last event rather than add a new one
97  if (m_isAfterburner.value() || name() == "Tauola" || name() == "Photos") {
98  events()->pop_back();
99  }
100  // Add the event to the end of the collection
101  events()->push_back(evt);
102  ATH_MSG_DEBUG("MC event added to McEventCollection");
103 
104  // remove the empty event in case of ParticleDecayer
105  if (name() == "ParticleDecayer") {
106  events()->pop_back();
107  }
108  }
109 
110  // Call the incident service to notify that an event has been made
111  m_incidentSvc->fireIncident( Incident(name(), "McEventGenerated") );
112  return StatusCode::SUCCESS;
113 }

◆ 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 }

◆ fillEvt()

StatusCode Sherpa_i::fillEvt ( HepMC::GenEvent *  evt)
virtual

For filling the HepMC event object.

Implements GenModule.

Definition at line 220 of file Sherpa_i.cxx.

220  {
221  ATH_MSG_DEBUG( "Sherpa_i Filling event");
222 #ifdef HEPMC3
223  if (!event->run_info()) event->set_run_info(m_runinfo);
224 #endif
225  p_sherpa->FillHepMCEvent(*event);
226 
227 
228 #ifdef HEPMC3
229 //Weight, MEWeight, WeightNormalisation, NTrials
230  if (event->weights().size()>2) {
231  double nominal = event->weight("Weight");
232  for (const auto& name: event->weight_names()) {
233  if (name == "WeightNormalisation") continue;
234  if (name == "NTrials") continue;
235  if (name == "Weight") continue;
236  if (name == "NTrials") continue;
237  if (std::abs(event->weight(name)) > m_variation_weight_cap*std::abs(nominal)) {
238  ATH_MSG_INFO("Capping variation" << name << " = " << event->weight(name)/nominal << "*nominal");
239  event->weight(name) *= m_variation_weight_cap*std::abs(nominal)/std::abs(event->weight(name));
240  }
241  ATH_MSG_DEBUG("Sherpa WEIGHT " << name << " value="<< event->weight(name));
242  }
243  }
244 #else
245  if (event->weights().size()>2) {
246  for (size_t i=0; i<event->weights().size(); ++i) {
247  if (i>3) { // cap variation weights
248  // cap variation weights at m_variation_weight_cap*nominal to avoid spikes from numerical instability
249  if (std::abs(event->weights()[i]) > m_variation_weight_cap*std::abs(event->weights()[0])) {
250  ATH_MSG_INFO("Capping variation" << i << " = " << event->weights()[i]/event->weights()[0] << "*nominal");
251  event->weights()[i] *= m_variation_weight_cap*std::abs(event->weights()[0])/std::abs(event->weights()[i]);
252  }
253  }
254  ATH_MSG_DEBUG("Sherpa WEIGHT " << i << " value="<< event->weights()[i]);
255  }
256  }
257 #endif
258 
259 #ifdef HEPMC3
260  event->set_units(HepMC3::Units::MEV, HepMC3::Units::MM);
261 #else
262  GeVToMeV(event); //unit check
263 #endif
264 
265 
266  return StatusCode::SUCCESS;
267 }

◆ finalize()

StatusCode GenModule::finalize ( )
inlineinherited

Definition at line 55 of file GenModule.h.

55 { return genFinalize(); }

◆ genFinalize()

StatusCode Sherpa_i::genFinalize ( )
virtual

For finalising the generator, if required.

Reimplemented from GenModule.

Definition at line 269 of file Sherpa_i.cxx.

269  {
270 
271  ATH_MSG_INFO("Sherpa_i finalize()");
272 
273  std::cout << "MetaData: generator = Sherpa" << SHERPA_VERSION << "." << SHERPA_SUBVERSION << std::endl;
274  std::cout << "MetaData: cross-section (nb)= " << p_sherpa->TotalXS()/1000.0*m_xsscale << std::endl;
275 
276  std::cout << "MetaData: PDF = " << p_sherpa->PDFInfo() << std::endl;
277 
278  std::cout << "Named variations initialised by Sherpa:" << std::endl;
279  std::cout << *p_sherpa->GetInitHandler()->GetVariations() << std::endl;
280 
281  p_sherpa->SummarizeRun();
282  delete p_sherpa;
283 
284  if (m_cleanup) {
285  ATH_MSG_INFO("Deleting left-over files from working directory.");
286  system("rm -rf Results.db Process MIG_*.db MPI_*.dat libSherpa*.so libProc*.so");
287  }
288 
289  return StatusCode::SUCCESS;
290 }

◆ genInitialize()

StatusCode Sherpa_i::genInitialize ( )
virtual

For initializing the generator, if required.

Reimplemented from GenModule.

Definition at line 49 of file Sherpa_i.cxx.

49  {
50  if (m_plugincode != "") {
52  #ifndef IS_SHERPA_3
53  m_params.value().push_back("SHERPA_LDADD=Sherpa_iPlugin");
54  #endif
55  }
56 
57  ATH_MSG_INFO("Sherpa initialising...");
58 
59  #ifdef IS_SHERPA_3
60  for (auto& inputfile : m_inputfiles) {
61  // remove first line and last character containing '"'
62  // TODO fix Python/C++ string passing, to not contain " in first place
63  inputfile.second.erase(0, inputfile.second.find("\n") + 1);
64  inputfile.second.pop_back();
65  }
66  #endif
67 
68  ATH_MSG_DEBUG("... compiling plugin code");
69  if (m_plugincode != "") {
71  #ifdef IS_SHERPA_3
72  m_inputfiles["Base.yaml"] += "SHERPA_LDADD: Sherpa_iPlugin \n";
73  #else
74  m_params.value().push_back("SHERPA_LDADD=Sherpa_iPlugin");
75  #endif
76  }
77 
78  ATH_MSG_DEBUG("... seeding Athena random number generator");
79  p_rndEngine = getRandomEngineDuringInitialize("SHERPA", m_randomSeed, m_dsid); // NOT THREAD-SAFE
80 
81  #ifdef IS_SHERPA_3
82  ATH_MSG_DEBUG("... adapting output level");
83  if( msg().level()==MSG::FATAL || msg().level()==MSG::ERROR || msg().level()==MSG::WARNING ){
84  m_inputfiles["Base.yaml"] += "\nEVT_OUTPUT: 0 \n";
85  }
86  else if(msg().level()==MSG::INFO){
87  m_inputfiles["Base.yaml"] += "\nEVT_OUTPUT: 2 \n";
88  }
89  else if(msg().level()==MSG::DEBUG){
90  m_inputfiles["Base.yaml"] += "\nEVT_OUTPUT: 15 \n";
91  }
92  else{
93  m_inputfiles["Base.yaml"] += "\nEVT_OUTPUT: 15 \n";
94  }
95 
96  ATH_MSG_DEBUG("... writing input files to directory");
97  for (auto& inputfile : m_inputfiles) {
98  // write input content to file in working directory
99  FILE *file = fopen(inputfile.first.c_str(),"w");
100  fputs(inputfile.second.c_str(),file);
101  fclose(file);
102  ATH_MSG_INFO("Sherpa_i using the following settings in "+inputfile.first);
103  ATH_MSG_INFO("\n"+inputfile.second+"\n");
104  }
105 
106  ATH_MSG_DEBUG("... go Sherpa!");
107  int argc = 2;
108  char** argv = new char*[2];
109  argv[0] = new char[7];
110  argv[1] = new char[34];
111  strcpy(argv[0], "Sherpa");
112  strcpy(argv[1], "RUNDATA: [Base.yaml, Sherpa.yaml]");
113  p_sherpa = new SHERPA::Sherpa(argc, argv);
114  delete [] argv;
115  #else
116  p_sherpa = new SHERPA::Sherpa();
117  #endif
118 
119 
120  /***
121  translate ATOOLS:SignalHandler
122  ***/
123  std::set_terminate(ATOOLS::Terminate);
124  std::set_unexpected(ATOOLS::Terminate);
125  #ifdef IS_SHERPA_3
126  signal(SIGSEGV,ATOOLS::HandleSignal);
127  signal(SIGINT,ATOOLS::HandleSignal);
128  signal(SIGPIPE,ATOOLS::HandleSignal);
129  signal(SIGBUS,ATOOLS::HandleSignal);
130  signal(SIGFPE,ATOOLS::HandleSignal);
131  signal(SIGABRT,ATOOLS::HandleSignal);
132  signal(SIGTERM,ATOOLS::HandleSignal);
133  signal(SIGXCPU,ATOOLS::HandleSignal);
134  signal(SIGUSR1,ATOOLS::HandleSignal);
135 
136  try {
137  p_sherpa->InitializeTheRun();
138  p_sherpa->InitializeTheEventHandler();
139  }
140  catch (const ATOOLS::normal_exit& exception) {
141  ATH_MSG_ERROR("Normal exit caught, this probably means:");
142  ATH_MSG_ERROR("Have to compile Amegic libraries");
143  ATH_MSG_ERROR("You probably want to run ./makelibs");
144  return StatusCode::FAILURE;
145  }
146  catch (const ATOOLS::Exception& exception) {
147  ATH_MSG_ERROR("Unwanted ATOOLS::exception caught.");
149  return StatusCode::FAILURE;
150  }
151  #else
152  signal(SIGSEGV,ATOOLS::SignalHandler);
153  signal(SIGINT,ATOOLS::SignalHandler);
154  signal(SIGBUS,ATOOLS::SignalHandler);
155  signal(SIGFPE,ATOOLS::SignalHandler);
156  signal(SIGABRT,ATOOLS::SignalHandler);
157  signal(SIGTERM,ATOOLS::SignalHandler);
158  signal(SIGXCPU,ATOOLS::SignalHandler);
159 
160  try {
161  int argc;
162  char** argv;
164  p_sherpa->InitializeTheRun(argc,(char **)argv);
165  delete [] argv;
166 
167  p_sherpa->InitializeTheEventHandler();
168  }
169  catch (const ATOOLS::Exception& exception) {
170  if (exception.Class()=="Matrix_Element_Handler" && exception.Type()==ATOOLS::ex::normal_exit) {
171  ATH_MSG_ERROR("Have to compile Amegic libraries");
172  ATH_MSG_ERROR("You probably want to run ./makelibs");
173  }
174  else {
175  ATH_MSG_ERROR("Unwanted ATOOLS::exception caught.");
177  }
178  return StatusCode::FAILURE;
179  }
180  #endif
181  catch (const std::exception& exception) {
182  ATH_MSG_ERROR("std::exception caught.");
183  return StatusCode::FAILURE;
184  }
185 
186  #ifdef HEPMC3
187  m_runinfo = std::make_shared<HepMC3::GenRunInfo>();
189  struct HepMC3::GenRunInfo::ToolInfo generator = {
190  std::string("SHERPA"),
191  std::string(SHERPA_VERSION)+ "." + std::string(SHERPA_SUBVERSION),
192  std::string("Used generator")
193  };
194  m_runinfo->tools().push_back(generator);
195  #endif
196  return StatusCode::SUCCESS;
197 }

◆ genuserInitialize()

virtual StatusCode GenModule::genuserInitialize ( )
inlinevirtualinherited

For initialization of user code, if required. Called after genInitialize.

Reimplemented in Pythia8B_i.

Definition at line 64 of file GenModule.h.

64 { return StatusCode::SUCCESS; }

◆ getParameters()

void Sherpa_i::getParameters ( int &  argc,
char **&  argv 
)

Definition at line 294 of file Sherpa_i.cxx.

294  {
295  std::vector<std::string> params;
296 
297  // set some ATLAS specific default values as a starting point
298  params.push_back("EXTERNAL_RNG=Atlas_RNG");
299 
300  /***
301  Adopt Atlas Debug Level Scheme
302  ***/
303 
304  std::string verbose_arg;
305  MsgStream log(msgSvc(), name());
306  if( log.level()==MSG::FATAL || log.level()==MSG::ERROR || log.level()==MSG::WARNING ){
307  params.push_back("OUTPUT=0");
308  }
309  else if(log.level()==MSG::INFO){
310  params.push_back("OUTPUT=2");
311  }
312  else if(log.level()==MSG::DEBUG){
313  params.push_back("OUTPUT=3");
314  }
315  else{
316  params.push_back("OUTPUT=15");
317  }
318 
319  // disregard manual RUNDATA setting if run card given in JO
320  if (m_runcard != "") m_params.value().push_back("RUNDATA=Run.dat");
321 
322  // allow to overwrite all parameters from JO file
323  params.insert(params.begin()+params.size(), m_params.begin(), m_params.end());
324 
325  // create Run.dat file if runcard explicitely given
326  if (m_runcard != "") {
327  FILE *file = fopen("Run.dat","w");
328  fputs(m_runcard.value().c_str(),file);
329  fclose(file);
330  }
331 
332  /***
333  Convert into Sherpas argc/argv arguments
334  ***/
335  argc = 1+params.size();
336  argv = new char * [ 1+params.size() ];
337  argv[0] = new char[7];
338  strcpy(argv[0], "Sherpa");
339 
340  ATH_MSG_INFO("Sherpa_i using the following Arguments");
342  for(size_t i=0; i<params.size(); i++) {
343  ATH_MSG_INFO(" [ " << params[i] << " ] ");
344  argv[i+1] = new char[params[i].size()+1];
345  strcpy(argv[i+1], params[i].c_str());
346  }
347  ATH_MSG_INFO("End Sherpa_i Argument List");
348  ATH_MSG_INFO("Further Sherpa initialisation output will be redirected to the LOG_FILE specified above.");
349 
350 }

◆ getRandomEngine() [1/2]

CLHEP::HepRandomEngine * GenModule::getRandomEngine ( const std::string &  streamName,
const EventContext &  ctx 
) const
protectedinherited

Definition at line 34 of file GenModule.cxx.

36 {
37  ATHRNG::RNGWrapper* rngWrapper = m_rndmSvc->getEngine(this, streamName);
38  std::string rngName = name()+streamName;
39  rngWrapper->setSeed( rngName, ctx );
40  return rngWrapper->getEngine(ctx);
41 }

◆ getRandomEngine() [2/2]

CLHEP::HepRandomEngine * GenModule::getRandomEngine ( const std::string &  streamName,
unsigned long int  randomSeedOffset,
const EventContext &  ctx 
) const
protectedinherited

Definition at line 44 of file GenModule.cxx.

46 {
47  ATHRNG::RNGWrapper* rngWrapper = m_rndmSvc->getEngine(this, streamName);
48  rngWrapper->setSeed( streamName, ctx.slot(), randomSeedOffset, ctx.eventID().run_number() );
49  return rngWrapper->getEngine(ctx);
50 }

◆ getRandomEngineDuringInitialize()

CLHEP::HepRandomEngine * GenModule::getRandomEngineDuringInitialize ( const std::string &  streamName,
unsigned long int  randomSeedOffset,
unsigned int  conditionsRun = 1,
unsigned int  lbn = 1 
) const
protectedinherited

Definition at line 53 of file GenModule.cxx.

54 {
55  const size_t slot=0;
56  EventContext ctx;
57  ctx.setSlot( slot );
58  ctx.setEventID (EventIDBase (conditionsRun,
59  EventIDBase::UNDEFEVT, // event
60  EventIDBase::UNDEFNUM, // timestamp
61  EventIDBase::UNDEFNUM, // timestamp ns
62  lbn));
64  Atlas::ExtendedEventContext( evtStore()->hiveProxyDict(),
65  conditionsRun) );
66  return getRandomEngine(streamName, randomSeedOffset, ctx);
67 }

◆ GeVToMeV()

void GenBase::GeVToMeV ( HepMC::GenEvent *  evt)
protectedinherited

Scale event energies/momenta by x 1000.

Todo:
Add HepMC units awareness and do it differently when HepMC provides this functionality directly (and reference-based FourVector accessors)

Definition at line 61 of file GenBase.cxx.

61  {
62  for (HepMC::GenEvent::particle_iterator p = evt->particles_begin(); p != evt->particles_end(); ++p) {
63  const HepMC::FourVector fv((*p)->momentum().px() * 1000,
64  (*p)->momentum().py() * 1000,
65  (*p)->momentum().pz() * 1000,
66  (*p)->momentum().e() * 1000);
67  (*p)->set_momentum(fv);
68  (*p)->set_generated_mass(1000 * (*p)->generated_mass());
69  }
70 }

◆ initialize()

StatusCode GenModule::initialize ( )
virtualinherited

Reimplemented from GenBase.

Definition at line 21 of file GenModule.cxx.

21  {
22  // Base class initializations
24  // Get the random number service
25  CHECK(m_rndmSvc.retrieve());
26  // Get the incident service
27  CHECK(m_incidentSvc.retrieve());
30  return StatusCode::SUCCESS;
31 }

◆ 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.

◆ MeVToGeV()

void GenBase::MeVToGeV ( HepMC::GenEvent *  evt)
protectedinherited

Scale event energies/momenta by x 1/1000.

Definition at line 71 of file GenBase.cxx.

71  {
72  for (HepMC::GenEvent::particle_iterator p = evt->particles_begin(); p != evt->particles_end(); ++p) {
73  const HepMC::FourVector fv((*p)->momentum().px() / 1000,
74  (*p)->momentum().py() / 1000,
75  (*p)->momentum().pz() / 1000,
76  (*p)->momentum().e() / 1000);
77  (*p)->set_momentum(fv);
78  (*p)->set_generated_mass((*p)->generated_mass() / 1000);
79  }
80 }

◆ mmTocm()

void GenBase::mmTocm ( HepMC::GenEvent *  evt)
protectedinherited

Scale event lengths by x 1/10.

Definition at line 90 of file GenBase.cxx.

90  {
91  for (HepMC::GenEvent::vertex_iterator vtx = evt->vertices_begin(); vtx != evt->vertices_end(); ++vtx) {
92  const HepMC::FourVector fv((*vtx)->position().x() / 10,
93  (*vtx)->position().y() / 10,
94  (*vtx)->position().z() / 10,
95  (*vtx)->position().t() / 10);
96  (*vtx)->set_position(fv);
97  }
98 }

◆ msg() [1/2]

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msg() [2/2]

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

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ 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.

◆ particleData()

const HepPDT::ParticleData* GenBase::particleData ( int  pid) const
inlineinherited

Access an element in the particle data table.

Definition at line 126 of file GenBase.h.

126  {
127  return pdt().particle(HepPDT::ParticleID(std::abs(pid)));
128  }

◆ particleTable()

const HepPDT::ParticleDataTable& GenBase::particleTable ( ) const
inlineinherited

Get a particle data table.

Definition at line 118 of file GenBase.h.

118  {
119  return *(m_ppSvc->PDT());
120  }

◆ partPropSvc()

const ServiceHandle<IPartPropSvc> GenBase::partPropSvc ( ) const
inlineinherited

Access the particle property service.

Definition at line 113 of file GenBase.h.

113  {
114  return m_ppSvc;
115  }

◆ pdt()

const HepPDT::ParticleDataTable& GenBase::pdt ( ) const
inlineinherited

Shorter alias to get a particle data table.

Definition at line 123 of file GenBase.h.

123 { return particleTable(); }

◆ 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();
383  PBASE::renounce (h);
384  }

◆ 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  {
365  handlesArray.renounce();
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, PyAthena::Alg, and AthHistogramAlgorithm.

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 }

◆ 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) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

◆ m_basefragment

std::string Sherpa_i::m_basefragment
protected

Sherpa base settings (read from base fragment file)

Definition at line 39 of file Sherpa_i.h.

◆ m_cleanup

BooleanProperty Sherpa_i::m_cleanup {this, "CleanupGeneratedFiles", true}
protected

Definition at line 67 of file Sherpa_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_dsid

IntegerProperty Sherpa_i::m_dsid {this, "Dsid", 999999, "Dataset ID number"}
protected

Definition at line 70 of file Sherpa_i.h.

◆ 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_extrafiles

StringArrayProperty Sherpa_i::m_extrafiles {this, "ExtraFiles", {} }
protected

List of any additional needed files, e.g. custom libraries, PDF sets (from JO file)

Definition at line 52 of file Sherpa_i.h.

◆ m_incidentSvc

ServiceHandle<IIncidentSvc> GenModule::m_incidentSvc {this, "IncidentSvc", "IncidentSvc"}
privateinherited

Handle on the incident service.

Definition at line 101 of file GenModule.h.

◆ m_isAfterburner

BooleanProperty GenModule::m_isAfterburner {this, "IsAfterburner", false, "Set true if generator modifies existing events rather than creating new ones"}
protectedinherited

Flag for normal vs. afterburner generators.

Definition at line 87 of file GenModule.h.

◆ m_mcEventKey

std::string GenBase::m_mcEventKey {}
protectedinherited

StoreGate key for the MC event collection (defaults to GEN_EVENT)

Definition at line 137 of file GenBase.h.

◆ m_mcevents_const

SG::ReadHandleKey<McEventCollection> GenBase::m_mcevents_const { this, "McEventKey", "GEN_EVENT", "StoreGate key of the MC event collection" }
privateinherited

Const handle to the MC event collection.

Definition at line 163 of file GenBase.h.

◆ m_memorymb

DoubleProperty Sherpa_i::m_memorymb {this, "MemoryMB", 2500.}
protected

Memory required for integration/evgen.

Definition at line 58 of file Sherpa_i.h.

◆ m_mkMcEvent

BooleanProperty GenBase::m_mkMcEvent {this, "MakeMcEvent", false, "Create a new MC event collection if it doesn't exist"}
protectedinherited

Flag to determine if a new MC event collection should be made if it doesn't exist.

Definition at line 139 of file GenBase.h.

◆ m_ncores

IntegerProperty Sherpa_i::m_ncores {this, "NCores", 1}
protected

Number of cores recommended for multi-core integration file.

Definition at line 55 of file Sherpa_i.h.

◆ m_openloopslibs

StringArrayProperty Sherpa_i::m_openloopslibs {this, "OpenLoopsLibs", {} }
protected

List of needed OpenLoops process libraries (from JO file)

Definition at line 49 of file Sherpa_i.h.

◆ m_params

StringArrayProperty Sherpa_i::m_params {this, "Parameters", {} }
protected

List of additional Sherpa parameters beyond run card snippet (from JO file)

Definition at line 45 of file Sherpa_i.h.

◆ m_plugincode

StringProperty Sherpa_i::m_plugincode {this, "PluginCode", ""}
protected

Optional code for plugin library to compile and load at run time.

Definition at line 61 of file Sherpa_i.h.

◆ m_ppSvc

ServiceHandle<IPartPropSvc> GenBase::m_ppSvc {this, "PartPropSvc", "PartPropSvc"}
privateinherited

Handle on the particle property service.

Definition at line 160 of file GenBase.h.

◆ m_randomSeed

IntegerProperty GenModule::m_randomSeed {this, "RandomSeed", 1234567, "Random seed for the built-in random engine"}
protectedinherited

Seed for random number engine.

Definition at line 84 of file GenModule.h.

◆ m_rndmSvc

ServiceHandle<IAthRNGSvc> GenModule::m_rndmSvc {this, "RndmSvc", "AthRNGSvc"}
privateinherited

Data members.

Definition at line 99 of file GenModule.h.

◆ m_runcard

StringProperty Sherpa_i::m_runcard {this, "RunCard", ""}
protected

FIXME unused?

Sherpa run card snippet (from JO file)

Definition at line 42 of file Sherpa_i.h.

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_variation_weight_cap

DoubleProperty Sherpa_i::m_variation_weight_cap {this, "VariationWeightCap", 10.0}
protected

Variation weight cap factor.

Definition at line 64 of file Sherpa_i.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.

◆ m_xsscale

DoubleProperty Sherpa_i::m_xsscale {this, "CrossSectionScaleFactor", 1.0}
protected

Definition at line 66 of file Sherpa_i.h.

◆ p_sherpa

SHERPA::Sherpa* Sherpa_i::p_sherpa {}
protected

Definition at line 32 of file Sherpa_i.h.


The documentation for this class was generated from the following files:
ATHRNG::RNGWrapper::setSeed
void setSeed(const std::string &algName, const EventContext &ctx)
Set the random seed using a string (e.g.
Definition: RNGWrapper.h:169
Sherpa_i::m_runcard
StringProperty m_runcard
FIXME unused?
Definition: Sherpa_i.h:42
Sherpa_i::getParameters
void getParameters(int &argc, char **&argv)
Definition: Sherpa_i.cxx:294
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
python.Constants.FATAL
int FATAL
Definition: Control/AthenaCommon/python/Constants.py:19
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
GenModule::fillEvt
virtual StatusCode fillEvt(HepMC::GenEvent *evt)=0
For filling the HepMC event object.
GenModule::callGenerator
virtual StatusCode callGenerator()
For calling the generator on each iteration of the event loop.
Definition: GenModule.h:66
GenBase::GeVToMeV
void GeVToMeV(HepMC::GenEvent *evt)
Scale event energies/momenta by x 1000.
Definition: GenBase.cxx:61
GenBase::events_const
const McEventCollection * events_const() const
Access the current event's McEventCollection (const)
Definition: GenBase.h:96
SG::ReadHandle< McEventCollection >
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
GenModule::m_incidentSvc
ServiceHandle< IIncidentSvc > m_incidentSvc
Handle on the incident service.
Definition: GenModule.h:101
AthCommonDataStore< AthCommonMsg< Algorithm > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< Algorithm > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
MM
@ MM
Definition: RegSelEnums.h:38
HepMC::newGenEvent
GenEvent * newGenEvent(const int a, const int b)
Definition: GenEvent.h:502
LArG4FSStartPointFilter.evt
evt
Definition: LArG4FSStartPointFilter.py:42
LArCellConditions.argv
argv
Definition: LArCellConditions.py:112
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
Sherpa_i::p_sherpa
SHERPA::Sherpa * p_sherpa
Definition: Sherpa_i.h:32
Sherpa_i::m_xsscale
DoubleProperty m_xsscale
Definition: Sherpa_i.h:66
HepMC::fillBarcodesAttribute
void fillBarcodesAttribute(GenEvent *)
Definition: GenEvent.h:504
empty
bool empty(TH1 *h)
Definition: computils.cxx:294
Sherpa_i::m_plugincode
StringProperty m_plugincode
Optional code for plugin library to compile and load at run time.
Definition: Sherpa_i.h:61
python.DataFormatRates.events
events
Definition: DataFormatRates.py:105
Sherpa_i::m_variation_weight_cap
DoubleProperty m_variation_weight_cap
Variation weight cap factor.
Definition: Sherpa_i.h:64
GenModule::getRandomEngine
CLHEP::HepRandomEngine * getRandomEngine(const std::string &streamName, const EventContext &ctx) const
Definition: GenModule.cxx:34
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:269
GenModule::genuserInitialize
virtual StatusCode genuserInitialize()
For initialization of user code, if required. Called after genInitialize.
Definition: GenModule.h:64
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
GenModule::m_rndmSvc
ServiceHandle< IAthRNGSvc > m_rndmSvc
Data members.
Definition: GenModule.h:99
GenBase::m_ppSvc
ServiceHandle< IPartPropSvc > m_ppSvc
Handle on the particle property service.
Definition: GenBase.h:160
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
GenModule::genInitialize
virtual StatusCode genInitialize()
For initializing the generator, if required.
Definition: GenModule.h:62
AthCommonDataStore
Definition: AthCommonDataStore.h:52
AthAlgorithm::sysInitialize
virtual StatusCode sysInitialize() override
Override sysInitialize.
Definition: AthAlgorithm.cxx:66
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
AthCommonDataStore< AthCommonMsg< Algorithm > >::outputHandles
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
Return this algorithm's output handles.
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
lumiFormat.i
int i
Definition: lumiFormat.py:92
ret
T ret(T t)
Definition: rootspy.cxx:260
Atlas::ExtendedEventContext
Definition: ExtendedEventContext.h:23
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
GenBase::m_mcevents_const
SG::ReadHandleKey< McEventCollection > m_mcevents_const
Const handle to the MC event collection.
Definition: GenBase.h:163
GenModule::m_isAfterburner
BooleanProperty m_isAfterburner
Flag for normal vs. afterburner generators.
Definition: GenModule.h:87
top::nominal
@ nominal
Definition: ScaleFactorRetriever.h:29
calibdata.exception
exception
Definition: calibdata.py:496
ParticleGun_EoverP_Config.pid
pid
Definition: ParticleGun_EoverP_Config.py:62
file
TFile * file
Definition: tile_monitor.h:29
jobOptions.ParticleID
ParticleID
Definition: jobOptions.decayer.py:85
GenModule::genFinalize
virtual StatusCode genFinalize()
For finalising the generator, if required.
Definition: GenModule.h:70
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
Sherpa_i::m_dsid
IntegerProperty m_dsid
Definition: Sherpa_i.h:70
AthCommonDataStore< AthCommonMsg< Algorithm > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
DQHistogramMergeRegExp.argc
argc
Definition: DQHistogramMergeRegExp.py:20
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
GenBase::particleTable
const HepPDT::ParticleDataTable & particleTable() const
Get a particle data table.
Definition: GenBase.h:118
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
GenModule::GenModule
GenModule(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition: GenModule.cxx:14
Sherpa_i::m_cleanup
BooleanProperty m_cleanup
Definition: Sherpa_i.h:67
Cut::signal
@ signal
Definition: SUSYToolsAlg.cxx:64
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
ATHRNG::RNGWrapper
A wrapper class for event-slot-local random engines.
Definition: RNGWrapper.h:56
ATHRNG::RNGWrapper::getEngine
CLHEP::HepRandomEngine * getEngine(const EventContext &ctx) const
Retrieve the random engine corresponding to the provided EventContext.
Definition: RNGWrapper.h:134
Sherpa_i::compilePlugin
void compilePlugin(std::string)
Definition: Sherpa_i.cxx:353
AthAlgorithm::m_extendedExtraObjects
DataObjIDColl m_extendedExtraObjects
Definition: AthAlgorithm.h:79
AthenaPoolExample_Copy.streamName
string streamName
Definition: AthenaPoolExample_Copy.py:39
mc.generator
generator
Configure Herwig7 These are the commands corresponding to what would go into the regular Herwig infil...
Definition: mc.MGH7_FxFx_H71-DEFAULT_test.py:18
a
TList * a
Definition: liststreamerinfos.cxx:10
h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
GenModule::m_randomSeed
IntegerProperty m_randomSeed
Seed for random number engine.
Definition: GenModule.h:84
FullCPAlgorithmsTest_CA.inputfile
dictionary inputfile
Definition: FullCPAlgorithmsTest_CA.py:59
DEBUG
#define DEBUG
Definition: page_access.h:11
GenBase::pdt
const HepPDT::ParticleDataTable & pdt() const
Shorter alias to get a particle data table.
Definition: GenBase.h:123
AthCommonMsg< Algorithm >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:616
ATHRNG::calculateSeedsMC21
void calculateSeedsMC21(long *seeds, const std::string &algName, uint64_t ev, uint64_t run, uint64_t offset=0)
Set the random seed using a string (e.g.
Definition: RNGWrapper.cxx:37
Sherpa_i::m_params
StringArrayProperty m_params
List of additional Sherpa parameters beyond run card snippet (from JO file)
Definition: Sherpa_i.h:45
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
LHEF::Writer
Pythia8::Writer Writer
Definition: Prophecy4fMerger.cxx:12
PowhegControl_ttFCNC_NLO.params
params
Definition: PowhegControl_ttFCNC_NLO.py:226
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
get_generator_info.command
string command
Definition: get_generator_info.py:38
Atlas::setExtendedEventContext
void setExtendedEventContext(EventContext &ctx, ExtendedEventContext &&ectx)
Move an extended context into a context object.
Definition: ExtendedEventContext.cxx:50
GenBase::initialize
virtual StatusCode initialize() override
Definition: GenBase.cxx:17
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
fitman.k
k
Definition: fitman.py:528
GenModule::getRandomEngineDuringInitialize
CLHEP::HepRandomEngine * getRandomEngineDuringInitialize(const std::string &streamName, unsigned long int randomSeedOffset, unsigned int conditionsRun=1, unsigned int lbn=1) const
Definition: GenModule.cxx:53
LB_AnalMapSplitter.lbn
lbn
Definition: LB_AnalMapSplitter.py:28
ServiceHandle< ICondSvc >
p_rndEngine
CLHEP::HepRandomEngine * p_rndEngine
Definition: Sherpa_i.cxx:36