ATLAS Offline Software
Rivet_i.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // Implementation file for Athena-Rivet interface
6 
7 #include "Rivet_i.h"
8 #include "LogLevels.h"
9 
10 #include "AtlasHepMC/GenEvent.h"
12 
16 
17 #include "GaudiKernel/IAppMgrUI.h"
18 #include "GaudiKernel/Bootstrap.h"
19 #include "GaudiKernel/ITHistSvc.h"
20 
21 #include "Rivet/Rivet.hh"
22 #include "Rivet/Analysis.hh"
23 #include "Rivet/Config/RivetConfig.hh"
24 #include "Rivet/Tools/RivetYODA.hh"
25 
26 
27 #include <cstdlib>
28 #include <cstdio>
29 #include <memory>
30 #include <regex>
31 
32 
34 
35 Rivet_i::Rivet_i(const std::string& name, ISvcLocator* pSvcLocator) :
36  AthAlgorithm(name, pSvcLocator),
37  m_analysisHandler(0),
38  m_init(false)
39 {
40  // Options
41  declareProperty("McEventKey", m_genEventKey="GEN_EVENT");
42  declareProperty("Analyses", m_analysisNames);
43  declareProperty("CrossSection", m_crossSection=0.0);
44  declareProperty("CrossSectionUncertainty", m_crossSection_uncert=0.0);
45  declareProperty("Stream", m_stream="/Rivet");
46  declareProperty("RunName", m_runname="");
47  declareProperty("HistoFile", m_file="Rivet.yoda.gz");
48  declareProperty("HistoPreload", m_preload="");
49  declareProperty("AnalysisPath", m_anapath="");
50  declareProperty("IgnoreBeamCheck", m_ignorebeams=false);
51  declareProperty("DoRootHistos", m_doRootHistos=false);
52  declareProperty("SkipWeights", m_skipweights=false);
53  declareProperty("MatchWeights", m_matchWeights="");
54  declareProperty("UnmatchWeights", m_unmatchWeights="");
55  declareProperty("NominalWeightName", m_nominalWeightName="");
56  declareProperty("WeightCap", m_weightcap=-1.0);
57  declareProperty("AddMissingBeamParticles",m_patchBeams=false);
58 }
59 
60 std::string getenv_str(const std::string& key) {
61  char const* val = getenv(key.c_str());
62  return val == NULL ? std::string() : std::string(val);
63 }
64 
65 
67  // ^ use of setenv
68  ATH_MSG_INFO("Using Rivet version " << Rivet::version());
69 
70  ATH_CHECK(m_evtInfoKey.initialize());
71 
72  // Get tool for xAOD::Truth to HepMC::GenEvent conversion
73  ATH_CHECK(m_xAODtoHepMCTool.retrieve());
74 
75 
76  // Set RIVET_ANALYSIS_PATH based on alg setup
77 
78  // First set (overwrite, if necessary) the RIVET_ANALYSIS_PATH variable
79  std::string env_rap(getenv_str("RIVET_ANALYSIS_PATH"));
80  if (m_anapath.size() > 0) {
81  ATH_MSG_INFO("Setting Rivet plugin analyses loader env path: " << m_anapath);
82  if (!env_rap.empty()) ATH_MSG_INFO("Overwriting environment's RIVET_ANALYSIS_PATH = " << env_rap << "!");
83  setenv("RIVET_ANALYSIS_PATH", m_anapath.c_str(), 1);
84  }
85 
86  // Now horrid runtime ATLAS env variable and CMT path mangling to work out the std analysis plugin search paths
87  std::vector<std::string> anapaths;
88  const std::string cmtpath = getenv_str("CMTPATH");
89  if (cmtpath.empty()) {
90  ATH_MSG_WARNING("$CMTPATH variable not set: finding the main analysis plugin directory will be difficult...");
91  } else {
92  std::vector<std::string> cmtpaths;
93  std::stringstream ss(cmtpath);
94  std::string item;
95  while (std::getline(ss, item, ':')) {
96  cmtpaths.push_back(std::move(item));
97  }
98  const std::string cmtconfig = getenv_str("CMTCONFIG");
99  if (cmtconfig.empty()) {
100  ATH_MSG_WARNING("$CMTCONFIG variable not set: finding the main analysis plugin directory will be difficult...");
101  }
102  else {
103  const std::string libpath = "/InstallArea/" + cmtconfig + "/lib";
104  for (const std::string& p : cmtpaths) {
105  const std::string cmtlibpath = p + libpath;
106  if (PathResolver::find_file_from_list("RivetMCAnalyses.so", cmtlibpath).empty()) continue;
107  ATH_MSG_INFO("Appending " + cmtlibpath + " to default Rivet analysis search path");
108  anapaths.push_back(cmtlibpath);
109  break;
110  }
111  }
112  }
113 
114  // Then re-grab RIVET_ANALYSIS_PATH and append all the discovered std plugin paths to it
115  std::string anapathstr = getenv_str("RIVET_ANALYSIS_PATH");
116  for (const std::string& ap : anapaths) {
117  if (anapathstr.size() > 0) anapathstr += ":";
118  anapathstr += ap;
119  }
120  setenv("RIVET_ANALYSIS_PATH", anapathstr.c_str(), 1);
121 
122  // Get the final form of RIVET_ANALYSIS_PATH and talk about it. Phew.
123  env_rap = getenv_str("RIVET_ANALYSIS_PATH");
124  if (!env_rap.empty()) ATH_MSG_DEBUG("Loading Rivet plugin analyses from env path: " << env_rap);
125 
126  // Set up analysis handler
127  m_analysisHandler = new Rivet::AnalysisHandler(m_runname);
128  assert(m_analysisHandler);
129 
130  #if RIVET_VERSION_CODE >= 40000
131  m_analysisHandler->setCheckBeams(!m_ignorebeams); //< Whether to do beam ID/energy consistency checks
132  m_analysisHandler->matchWeightNames(m_matchWeights); //< Only run on a subset of the multi-weights
133  m_analysisHandler->unmatchWeightNames(m_unmatchWeights); //< Veto a subset of the multi-weights
134  #else
135  m_analysisHandler->setIgnoreBeams(m_ignorebeams); //< Whether to do beam ID/energy consistency checks
136  m_analysisHandler->selectMultiWeights(m_matchWeights); //< Only run on a subset of the multi-weights
137  m_analysisHandler->deselectMultiWeights(m_unmatchWeights); //< Veto a subset of the multi-weights
138  #endif
139  m_analysisHandler->skipMultiWeights(m_skipweights); //< Only run on the nominal weight
140  m_analysisHandler->setNominalWeightName(m_nominalWeightName);
141  if (m_weightcap>0) m_analysisHandler->setWeightCap(m_weightcap);
142 
143  // Set Rivet native log level to match Athena
144  Rivet::Log::setLevel("Rivet", rivetLevel(msg().level()));
145 
146  // Get all available analysis names
147  if (msgLvl(MSG::VERBOSE)) {
148  std::vector<std::string> analysisNames = Rivet::AnalysisLoader::analysisNames();
149  ATH_MSG_VERBOSE("List of available Rivet analyses:");
150  for (const std::string& a : analysisNames) ATH_MSG_VERBOSE(" " + a);
151  }
152 
153  // Add analyses
154  for (const std::string& a : m_analysisNames) {
155  ATH_MSG_INFO("Loading Rivet analysis " << a);
156  m_analysisHandler->addAnalysis(a);
157  Rivet::Log::setLevel("Rivet.Analysis."+a, rivetLevel(msg().level()));
158  }
159 
160  // Initialise Rivet
161  // m_analysisHandler->init();
162 
163  //load a pre-existing yoda file to initialize histograms
164  if (m_preload!= "") {
165  m_analysisHandler->readData(m_preload);
166  }
167 
168  return StatusCode::SUCCESS;
169 }
170 
171 
173  ATH_MSG_DEBUG("Rivet_i execute");
174 
175  const EventContext& ctx = getContext();
176 
178  ATH_MSG_DEBUG("Rivet_i needs xAOD::Truth to HepMC::GenEvent conversion? " << m_needsConversion);
179 
180  std::unique_ptr<HepMC::GenEvent> checkedEvent;
181  if (m_needsConversion) {
182  const xAOD::TruthEventContainer* truthCollection = nullptr;
183  if (evtStore()->retrieve(truthCollection, "TruthEvents").isFailure()) {
184  ATH_MSG_ERROR("Could not retrieve TruthEvents collection, aborting.");
185  return StatusCode::FAILURE;
186  }
187 
189  ATH_MSG_DEBUG("Attempt xAOD::Truth to HepMC::GenEvent conversion.");
190  std::vector<HepMC::GenEvent>&& hepmc_evts = m_xAODtoHepMCTool->getHepMCEvents(truthCollection, eventInfo.cptr());
191 
192  if (hepmc_evts.empty()) {
193  ATH_MSG_ERROR("Conversion didn't yield HepMC::GenEvent, aborting.");
194  return StatusCode::FAILURE;
195  }
196  checkedEvent = checkEvent(std::move(hepmc_evts[0]), ctx);
197  }
198  else {
199  // Get the event collection
201  const McEventCollection* eventCollection = nullptr;
202  StatusCode sc = evtStore()->retrieve(eventCollection, m_genEventKey);
203  if (sc.isFailure() || eventCollection == 0) {
204  ATH_MSG_ERROR("Unable to retrieve event collection from StoreGate with key " << m_genEventKey);
205  return StatusCode::FAILURE;
206  } else {
207  ATH_MSG_DEBUG("Retrieved event collection from StoreGate with key " << m_genEventKey);
208  }
209 
210  // Get the first event in the event collection
213  const HepMC::GenEvent* event = eventCollection->front();
214  if (event == nullptr) {
215  ATH_MSG_ERROR("Rivet_i received a null HepMC event");
216  return StatusCode::FAILURE;
217  }
218 
219  // Modify the event units etc. if necessary
220  checkedEvent = checkEvent(*event, ctx);
221  }
222 
223  if(!checkedEvent) {
224  ATH_MSG_ERROR("Check on HepMC event failed!");
225  return StatusCode::FAILURE;
226  }
227 
228  // Initialize Rivet (on the first event only)
229  if (!m_init) {
230  m_analysisHandler->init(*checkedEvent);
231  m_init = true;
232  }
233 
234  // Analyse the event
235  m_analysisHandler->analyze(*checkedEvent);
236 
237  return StatusCode::SUCCESS;
238 }
239 
240 
242  ATH_MSG_INFO("Rivet_i finalizing");
243 
244  // Setting cross-section in Rivet
245  // If no user-specified cross-section available,
246  // take whatever is in the GenEvent
248 
249  // Call Rivet finalize
250  m_analysisHandler->finalize();
251 
252 
253 
254  // Write out YODA file (add .yoda suffix if missing)
255  if (m_file.find(".yoda") == std::string::npos) m_file += ".yoda.gz";
256  auto pos = m_file.find(".gz.");
257  if (pos == std::string::npos) {
258  m_analysisHandler->writeData(m_file);
259  }
260  else {//filename is e.g. something.yoda.gz.1
261  //write to output file name without the ".1"
262  m_analysisHandler->writeData(m_file.substr(0, pos)+".gz");
263  // then rename it as the requested output filename
264  if (std::rename((m_file.substr(0, pos)+".gz").c_str(), m_file.c_str()) !=0) {
265  std::string error_msg = "Impossible to rename ";
266  error_msg += m_file.substr(0, pos)+".gz";
267  error_msg += " as ";
268  error_msg += m_file;
269  ATH_MSG_ERROR(error_msg.c_str());
270  return StatusCode::FAILURE;
271  }
272  }
273 
274  return StatusCode::SUCCESS;
275 }
276 
277 
281  return a->momentum().e() > b->momentum().e();
282 }
283 
284 inline std::vector<std::string> split(const std::string& input, const std::string& regex) {
285  // passing -1 as the submatch index parameter performs splitting
287  std::sregex_token_iterator
288  first{input.begin(), input.end(), re, -1},
289  last;
290  return {first, last};
291 }
292 
293 std::unique_ptr<HepMC::GenEvent> Rivet_i::checkEvent(const HepMC::GenEvent& event, const EventContext& ctx) {
294  auto modEvent = std::make_unique<HepMC::GenEvent>(event);
295 
296  if (!m_needsConversion) {
297  // overwrite the HEPMC dummy event number with the proper ATLAS event number
299  modEvent->set_event_number(static_cast<int>(evtInfo->eventNumber()));
300  }
301 
302  // weight-name cleaning
303 #ifdef HEPMC3
304  std::shared_ptr<HepMC3::GenRunInfo> modRunInfo;
305  if (event.run_info()) {
306  modRunInfo = std::make_shared<HepMC3::GenRunInfo>(*(event.run_info().get()));
307  if (event.run_info()->weight_names().empty() && event.weights().size() == 1) {
308  modRunInfo->set_weight_names({"Default"});
309  }
310  }
311  else {
312  ATH_MSG_DEBUG("No run info, event weights size is " << event.weights().size() );
313  modRunInfo = std::make_shared<HepMC3::GenRunInfo>();
314  std::vector<std::string> w_names;
315  for (size_t i = 0; i < event.weights().size(); i++) { w_names.push_back(std::string("badweight") + std::to_string(i)); }
316  modRunInfo->set_weight_names(w_names);
317  }
318  modEvent->set_run_info(modRunInfo);
319  std::vector<std::string> w_names = modEvent->weight_names();
320  if (w_names.size()) {
321  std::vector<std::pair<std::string,std::string> > w_subs = {
322  {" nominal ",""},
323  {" set = ","_"},
324  {" = ","_"},
325  {"=",""},
326  {",",""},
327  {".",""},
328  {":",""},
329  {" ","_"},
330  {"#","num"},
331  {"\n","_"},
332  {"/","over"}
333  };
334  for (std::string& wname : w_names) {
335  for (const auto& sub : w_subs) {
336  size_t start_pos = wname.find(sub.first);
337  while (start_pos != std::string::npos) {
338  wname.replace(start_pos, sub.first.length(), sub.second);
339  start_pos = wname.find(sub.first);
340  }
341  }
342  }
343  modEvent->run_info()->set_weight_names(w_names);
344  }
345 #else
346  const HepMC::WeightContainer& old_wc = event.weights();
347  std::vector<std::string> old_wnames = old_wc.weight_names();
348  if (old_wnames.size()) {
349  HepMC::WeightContainer& new_wc = modEvent->weights();
350  new_wc.clear();
351  std::vector<std::pair<std::string,std::string> > w_subs = {
352  {" nominal ",""},
353  {" set = ","_"},
354  {" = ","_"},
355  {"=",""},
356  {",",""},
357  {".",""},
358  {":",""},
359  {" ","_"},
360  {"#","num"},
361  {"\n","_"},
362  {"/","over"}
363  };
364  std::map<std::string, double> new_name_to_value;
365  std::map<std::string, std::string> old_name_to_new_name;
366  for (const std::string& old_name : old_wnames) {
367  std::string wname = std::string(old_name);
368  double value = old_wc[old_name];
369  for (const auto& sub : w_subs) {
370  size_t start_pos = wname.find(sub.first);
371  while (start_pos != std::string::npos) {
372  wname.replace(start_pos, sub.first.length(), sub.second);
373  start_pos = wname.find(sub.first);
374  }
375  }
376  new_name_to_value[wname] = value;
377  old_name_to_new_name[old_name] = wname;
378  }
379  auto itEnd = old_name_to_new_name.end();
380  for (const std::string& old_name : old_wnames) {
381  if (old_name_to_new_name.find(old_name) == itEnd) continue;
382  const std::string& new_name = old_name_to_new_name[old_name];
383  new_wc[ new_name ] = new_name_to_value[new_name];
384  }
385  // end of weight-name cleaning
386  }
387 #endif
388 
389 #ifdef HEPMC3
390  modEvent->set_units(HepMC3::Units::GEV, HepMC3::Units::MM);
391  if (modEvent->particles().size() == 1) modEvent->set_beam_particles(modEvent->particles().front(), modEvent->particles().front());
392  if (m_patchBeams) {
393  // workaround in case beam particles were missing in xAOD::Truth
394  // first work out centre-of-mass energy
395  double etotal = 0;
396  for (const auto& p : modEvent->particles()) {
397  if (!MC::isStable(p)) continue;
398  etotal += p->momentum().e();
399  }
400  const double ebeam = 0.5*etotal;
401  // create dummy beam particles
402  HepMC::GenParticlePtr b1 = std::make_shared<HepMC::GenParticle>(HepMC::FourVector(0,0,ebeam,ebeam),2212,4);
403  HepMC::GenParticlePtr b2 = std::make_shared<HepMC::GenParticle>(HepMC::FourVector(0,0,-1*ebeam,ebeam),2212,4);
404  // remove particles incorrectly labelled as beam particles
405  std::vector<HepMC::GenParticlePtr> notBeams;
406  for (const HepMC::GenParticlePtr& p : modEvent->beams()) {
407  if (!MC::isBeam(p)) notBeams.push_back(p);
408  }
409  //AV: the loop is over shared pointers! Should be const auto&
410  for (const auto& bp : notBeams) bp->production_vertex()->remove_particle_out(bp);
411  // add dummy beam particles
412  modEvent->set_beam_particles(b1, b2);
413  }
414  if (modEvent->beams().front()->momentum().e() > 50000.0) {
415  MeV2GeV(*modEvent);
416  }
417 #else
418  modEvent->use_units(HepMC::Units::GEV, HepMC::Units::MM);
419  if (modEvent->particles_size() == 1) modEvent->set_beam_particles(*modEvent->particles_begin(), *modEvent->particles_begin());
420  if (modEvent->beam_particles().first->momentum().e() > 50000.0) {
421  MeV2GeV(*modEvent);
422  }
423 #endif
424 
425  return modEvent;
426 }
427 
428 void Rivet_i::MeV2GeV(HepMC::GenEvent& evt) {
429 #ifdef HEPMC3
430  for (auto& p: evt.particles()) {
431  p->set_momentum(p->momentum()*0.001);
432 #else
433  for (HepMC::GenParticlePtr p: evt) {
434  const HepMC::FourVector& mom = p->momentum();
435  p->set_momentum(HepMC::FourVector (mom.px()*0.001,
436  mom.py()*0.001,
437  mom.pz()*0.001,
438  mom.e()*0.001));
439 #endif
440  p->set_generated_mass(p->generated_mass()*0.001);
441  }
442 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
GenEvent.h
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
Rivet_i::m_init
bool m_init
Flag to determine whether Rivet init has already happened (in execute())
Definition: Rivet_i.h:125
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
xAOD::EventInfo_v1::eventNumber
uint64_t eventNumber() const
The current event's event number.
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
Rivet_i::m_anapath
std::string m_anapath
The analysis plugin search path.
Definition: Rivet_i.h:80
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
LogLevels.h
Rivet_i::m_patchBeams
bool m_patchBeams
Flag to insert beam protons when they are unavailable in the event.
Definition: Rivet_i.h:94
initialize
void initialize()
Definition: run_EoverP.cxx:894
Rivet_i::execute
virtual StatusCode execute() override
Run the Rivet analyses on one event, which is retrieved from StoreGate.
Definition: Rivet_i.cxx:172
HepMC::GenParticlePtr
GenParticle * GenParticlePtr
Definition: GenParticle.h:37
Rivet_i::finalize
virtual StatusCode finalize() override
Finalise each analysis and commit the plots to an AIDA tree and the THistSvc ROOT tree.
Definition: Rivet_i.cxx:241
Rivet_i::m_xAODtoHepMCTool
ToolHandle< IxAODtoHepMCTool > m_xAODtoHepMCTool
A tool to convert xAOD::Truth to HepMC::GenEvent.
Definition: Rivet_i.h:97
Rivet_i::m_genEventKey
std::string m_genEventKey
The GenEvent StoreGate key (default "GEN_EVENT")
Definition: Rivet_i.h:110
MM
@ MM
Definition: RegSelEnums.h:38
athena.value
value
Definition: athena.py:124
LArG4FSStartPointFilter.evt
evt
Definition: LArG4FSStartPointFilter.py:42
Rivet_i::m_stream
std::string m_stream
A pointer to the THistSvc.
Definition: Rivet_i.h:69
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
ATLAS_NOT_THREAD_SAFE
StatusCode Rivet_i::initialize ATLAS_NOT_THREAD_SAFE()
Install fatal handler with default options.
Definition: Rivet_i.cxx:66
empty
bool empty(TH1 *h)
Definition: computils.cxx:294
python.AtlRunQueryParser.ap
ap
Definition: AtlRunQueryParser.py:826
Rivet_i.h
rivetLevel
Rivet::Log::Level rivetLevel(MSG::Level gaudiLevel)
Definition: LogLevels.h:21
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
pool::DbPrintLvl::setLevel
void setLevel(MsgLevel l)
Definition: DbPrint.h:32
PrepareReferenceFile.regex
regex
Definition: PrepareReferenceFile.py:43
Rivet_i::m_doRootHistos
bool m_doRootHistos
Will we convert Rivet's internal histo format into a ROOT histo for streaming with THistSvc?
Definition: Rivet_i.h:104
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
PyPoolBrowser.item
item
Definition: PyPoolBrowser.py:129
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
ParticleGun_EoverP_Config.mom
mom
Definition: ParticleGun_EoverP_Config.py:63
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
Rivet_i::m_needsConversion
bool m_needsConversion
Do we need to convert xAOD::Truth back to HepMC::GenEvemt?
Definition: Rivet_i.h:91
Rivet_i::m_nominalWeightName
std::string m_nominalWeightName
String to specify non-standard nominal weight.
Definition: Rivet_i.h:137
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
McEventCollection.h
lumiFormat.i
int i
Definition: lumiFormat.py:85
Rivet_i::m_unmatchWeights
std::string m_unmatchWeights
String of weight names (or regex) to veto multiweights.
Definition: Rivet_i.h:134
Rivet_i::MeV2GeV
void MeV2GeV(HepMC::GenEvent &event)
Definition: Rivet_i.cxx:428
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
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
Rivet_i::m_crossSection_uncert
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
DataVector::front
const T * front() const
Access the first element in the collection as an rvalue.
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
GEV
#define GEV
Definition: PrintPhotonSF.cxx:24
Rivet_i::m_analysisNames
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
getCastorRun.setenv
def setenv()
Definition: getCastorRun.py:9
Rivet_i::m_crossSection
double m_crossSection
The cross section for this run of events, set from the job properties.
Definition: Rivet_i.h:119
McEventCollection
This defines the McEventCollection, which is really just an ObjectVector of McEvent objects.
Definition: McEventCollection.h:33
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
AthAlgorithm
Definition: AthAlgorithm.h:47
PathResolver::find_file_from_list
static std::string find_file_from_list(const std::string &logical_file_name, const std::string &search_list, SearchType search_type=LocalSearch)
Definition: PathResolver.cxx:281
HepMC::ConstGenParticlePtr
const GenParticle * ConstGenParticlePtr
Definition: GenParticle.h:38
PathResolver.h
Rivet_i::m_file
std::string m_file
The base file name to write results to.
Definition: Rivet_i.h:72
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
errorcheck.h
Helpers for checking error return status codes and reporting errors.
Rivet_i::m_ignorebeams
bool m_ignorebeams
Whether to avoid the beam consistency checks.
Definition: Rivet_i.h:86
item
Definition: ItemListSvc.h:43
cmpGenParticleByEDesc
bool cmpGenParticleByEDesc(HepMC::ConstGenParticlePtr a, HepMC::ConstGenParticlePtr b)
Helper function to sort GenParticles by descending energy.
Definition: Rivet_i.cxx:280
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
Rivet_i::m_skipweights
bool m_skipweights
Skip variation weights and only run nominal.
Definition: Rivet_i.h:128
get_generator_info.version
version
Definition: get_generator_info.py:33
MC::isStable
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
Definition: HepMCHelpers.h:45
Rivet_i::m_matchWeights
std::string m_matchWeights
String of weight names (or regex) to select multiweights.
Definition: Rivet_i.h:131
a
TList * a
Definition: liststreamerinfos.cxx:10
SCT_ConditionsAlgorithms::CoveritySafe::getenv
std::string getenv(const std::string &variableName)
get an environment variable
Definition: SCT_ConditionsUtilities.cxx:17
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
Rivet_i::checkEvent
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:293
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
getenv_str
std::string getenv_str(const std::string &key)
Definition: Rivet_i.cxx:60
MC::isBeam
bool isBeam(const T &p)
Identify if the particle is beam particle.
Definition: HepMCHelpers.h:39
DeMoScan.first
bool first
Definition: DeMoScan.py:536
re
const boost::regex re(r_e)
Rivet_i::m_preload
std::string m_preload
Definition: Rivet_i.h:75
split
std::vector< std::string > split(const std::string &input, const std::string &regex)
Definition: Rivet_i.cxx:284
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14
Rivet_i::Rivet_i
Rivet_i(const std::string &name, ISvcLocator *pSvcLocator)
Standard algorithm constructor.
Definition: Rivet_i.cxx:35
Rivet_i::m_weightcap
double m_weightcap
Weight cap to set allowed maximum for weights.
Definition: Rivet_i.h:140
Rivet_i::m_analysisHandler
Rivet::AnalysisHandler * m_analysisHandler
A Rivet analysis handler.
Definition: Rivet_i.h:113
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
Rivet_i::m_evtInfoKey
SG::ReadHandleKey< xAOD::EventInfo > m_evtInfoKey
Definition: Rivet_i.h:142
HepMCHelpers.h
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
Rivet_i::m_runname
std::string m_runname
The name of the run (prepended to plot paths).
Definition: Rivet_i.h:107