ATLAS Offline Software
BB4LPowhegLesHouchesFileReader.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // myLesHouchesReader.h is - (c) Silvia Ferrario Ravasio and Tomas Jezo
4 // inspired by LesHouchesFileReader.h which is a part of ThePEG
5 //
6 #ifndef THEPEG_BB4LPowhegLesHouchesFileReader_H
7 #define THEPEG_BB4LPowhegLesHouchesFileReader_H
8 // This is the declaration of the BB4LPowhegLesHouchesFileReader class.
9 
10 #include "ThePEG/LesHouches/LesHouchesReader.h"
11 #include "ThePEG/PDT/Decayer.h"
12 #include "ThePEG/Utilities/CFileLineReader.h"
13 
14 #include "herwig7_interface.h"
16 #include <string>
17 #include <map>
18 #include <vector>
19 
21 
22 namespace ThePEG {
23 
24 
41 class ATLAS_NOT_THREAD_SAFE BB4LPowhegLesHouchesFileReader: public LesHouchesReader {
42 
43 public:
44 
50  BB4LPowhegLesHouchesFileReader() : m_neve(0), m_ieve(0), m_theQNumbers(false),
51  m_theIncludeFxFxTags(false),
52  m_theIncludeCentral(true) {}
53 
59 
65 
66 public:
67 
74  virtual void initialize(LesHouchesEventHandler & eh);
75 
81  virtual void open ();
82 
86  virtual void close();
87 
88 
94  virtual bool doReadEvent ();
96 
100  const std::string & filename() const { return m_theFileName; }
101 
106  virtual std::vector<std::string> optWeightsNamesFunc();
107 
108  double eventWeight() {return powheg_weight;}
109 
110 public:
111 
118  void persistentOutput(PersistentOStream & os) const;
119 
125  void persistentInput(PersistentIStream & is, int version);
127 
131  static void Init ();
132 
133 
138  void erase_substr(std::string& subject, const std::string& search);
139 
140 
141 protected:
142 
149  virtual IBPtr clone() const;
150 
155  virtual IBPtr fullclone() const;
157 
165  virtual void doinit ();
166 
171  virtual bool preInitialize() const;
172  //@
173 
174 protected:
175 
179  CFileLineReader m_cfile;
180 
181 protected:
182 
186  long m_neve;
187 
191  long m_ieve;
192 
198  std::string m_LHFVersion;
199 
204  std::string m_outsideBlock;
205 
209  std::string m_headerBlock;
210 
214  std::string m_initComments;
215 
220  std::map<std::string,std::string> m_initAttributes;
221 
225  std::string m_eventComments;
226 
231  std::map<std::string,std::string> m_eventAttributes;
232 
233 private:
234 
238  std::string m_theFileName;
239 
244 
249 
254 
258  DecayerPtr m_theDecayer;
259 
263  std::map<std::string,std::string> m_scalemap;
264 
269  std::map<std::string,double> m_optionalWeightsTemp;
270  std::map<std::string,std::string> m_optionalWeightsLabel;
271 
272 
273 private:
274 
278  static ClassDescription<BB4LPowhegLesHouchesFileReader> m_initBB4LPowhegLesHouchesFileReader;
279 
284 
285 public:
286 
290  class powhegLesHouchesFileError: public Exception {};
293 };
294 
295 }
296 
297 
298 #include "ThePEG/Utilities/ClassTraits.h"
299 
300 namespace ThePEG {
301 
308 template <>
309 struct BaseClassTrait<BB4LPowhegLesHouchesFileReader,1>: public ClassTraitsType {
311  typedef LesHouchesReader NthBase;
312 };
313 
319 template <>
320 struct ClassTraits<BB4LPowhegLesHouchesFileReader>
321  : public ClassTraitsBase<BB4LPowhegLesHouchesFileReader> {
325  static std::string className() { return "ThePEG::BB4LPowhegLesHouchesFileReader"; }
331  static std::string library() { return "libpowhegHerwigBB4L.so"; }
332 
333 };
334 
337 }
338 
339 #endif /* THEPEG_BB4LPowhegLesHouchesFileReader_H */
ThePEG::BB4LPowhegLesHouchesFileReader::clone
virtual IBPtr clone() const
Make a simple clone of this object.
ThePEG::BB4LPowhegLesHouchesFileReader::m_cfile
CFileLineReader m_cfile
The wrapper around the C FILE stream from which to read.
Definition: BB4LPowhegLesHouchesFileReader.h:179
ThePEG::BB4LPowhegLesHouchesFileReader::doReadEvent
virtual bool doReadEvent()
Read the next event from the file or stream into the corresponding protected variables.
ThePEG::BB4LPowhegLesHouchesFileReader::m_headerBlock
std::string m_headerBlock
If LHF.
Definition: BB4LPowhegLesHouchesFileReader.h:209
ATLAS_NOT_THREAD_SAFE
#define ATLAS_NOT_THREAD_SAFE
getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats
Definition: checker_macros.h:212
ThePEG::BB4LPowhegLesHouchesFileReader::m_theIncludeFxFxTags
bool m_theIncludeFxFxTags
Include/Read FxFx tags.
Definition: BB4LPowhegLesHouchesFileReader.h:248
ThePEG::BB4LPowhegLesHouchesFileReader::m_eventComments
std::string m_eventComments
If LHF.
Definition: BB4LPowhegLesHouchesFileReader.h:225
ThePEG::BB4LPowhegLesHouchesFileReader::BB4LPowhegLesHouchesFileReader
BB4LPowhegLesHouchesFileReader(const BB4LPowhegLesHouchesFileReader &)
Copy-constructor.
ThePEG::BB4LPowhegLesHouchesFileReader::erase_substr
void erase_substr(std::string &subject, const std::string &search)
Erases all occurences of a substring from a string.
ThePEG::BB4LPowhegLesHouchesFileReader::operator=
BB4LPowhegLesHouchesFileReader & operator=(const BB4LPowhegLesHouchesFileReader &)=delete
Private and non-existent assignment operator.
search
void search(TDirectory *td, const std::string &s, std::string cwd, node *n)
recursive directory search for TH1 and TH2 and TProfiles
Definition: hcg.cxx:738
ThePEG::BB4LPowhegLesHouchesFileReader::m_optionalWeightsTemp
std::map< std::string, double > m_optionalWeightsTemp
Temporary holder for optional weights.
Definition: BB4LPowhegLesHouchesFileReader.h:269
ThePEG::BB4LPowhegLesHouchesFileReader::m_eventAttributes
std::map< std::string, std::string > m_eventAttributes
If LHF.
Definition: BB4LPowhegLesHouchesFileReader.h:231
ThePEG::BB4LPowhegLesHouchesFileReader::m_initAttributes
std::map< std::string, std::string > m_initAttributes
If LHF.
Definition: BB4LPowhegLesHouchesFileReader.h:220
ThePEG::BB4LPowhegLesHouchesFileReader::m_LHFVersion
std::string m_LHFVersion
If the file is a standard Les Houches formatted file (LHF) this is its version number.
Definition: BB4LPowhegLesHouchesFileReader.h:198
ThePEG::BB4LPowhegLesHouchesFileReader::filename
const std::string & filename() const
Return the name of the file from where to read events.
Definition: BB4LPowhegLesHouchesFileReader.h:100
ThePEG::BB4LPowhegLesHouchesFileReader::m_initBB4LPowhegLesHouchesFileReader
static ClassDescription< BB4LPowhegLesHouchesFileReader > m_initBB4LPowhegLesHouchesFileReader
Describe an abstract base class with persistent data.
Definition: BB4LPowhegLesHouchesFileReader.h:278
ThePEG::BB4LPowhegLesHouchesFileReader::open
virtual void open()
Open a file with events.
ThePEG::BB4LPowhegLesHouchesFileReader::persistentOutput
void persistentOutput(PersistentOStream &os) const
Function used to write out object persistently.
ThePEG
Definition: BB4LPowhegLesHouchesFileReader.h:22
ThePEG::BB4LPowhegLesHouchesFileReader::m_ieve
long m_ieve
The current event number.
Definition: BB4LPowhegLesHouchesFileReader.h:191
ThePEG::BB4LPowhegLesHouchesFileReader::Init
static void Init()
Standard Init function used to initialize the interfaces.
ThePEG::BB4LPowhegLesHouchesFileReader::~BB4LPowhegLesHouchesFileReader
virtual ~BB4LPowhegLesHouchesFileReader()
Destructor.
ThePEG::BB4LPowhegLesHouchesFileReader::persistentInput
void persistentInput(PersistentIStream &is, int version)
Function used to read in object persistently.
ThePEG::BB4LPowhegLesHouchesFileReader::m_theFileName
std::string m_theFileName
The name of the file from where to read events.
Definition: BB4LPowhegLesHouchesFileReader.h:238
ThePEG::BB4LPowhegLesHouchesFileReader::eventWeight
double eventWeight()
Definition: BB4LPowhegLesHouchesFileReader.h:108
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
ThePEG::BB4LPowhegLesHouchesFileReader
BB4LPowhegLesHouchesFileReader is an base class to be used for objects which reads event files from m...
Definition: BB4LPowhegLesHouchesFileReader.h:41
ThePEG::BB4LPowhegLesHouchesFileReader::m_optionalWeightsLabel
std::map< std::string, std::string > m_optionalWeightsLabel
Definition: BB4LPowhegLesHouchesFileReader.h:270
ThePEG::BB4LPowhegLesHouchesFileReader::fullclone
virtual IBPtr fullclone() const
Make a clone of this object, possibly modifying the cloned object to make it sane.
ThePEG::BB4LPowhegLesHouchesFileReader::BB4LPowhegLesHouchesFileReader
BB4LPowhegLesHouchesFileReader()
Default constructor.
Definition: BB4LPowhegLesHouchesFileReader.h:50
ThePEG::BB4LPowhegLesHouchesFileReader::m_neve
long m_neve
The number of events in this file.
Definition: BB4LPowhegLesHouchesFileReader.h:186
ThePEG::BB4LPowhegLesHouchesFileReader::close
virtual void close()
Close the file from which events have been read.
get_generator_info.version
version
Definition: get_generator_info.py:33
ThePEG::BB4LPowhegLesHouchesFileReader::preInitialize
virtual bool preInitialize() const
Return true if this object needs to be initialized before all other objects because it needs to extra...
ThePEG::BB4LPowhegLesHouchesFileReader::m_theIncludeCentral
bool m_theIncludeCentral
Include central weight (for backup use)
Definition: BB4LPowhegLesHouchesFileReader.h:253
ThePEG::BB4LPowhegLesHouchesFileReader::initialize
virtual void initialize(LesHouchesEventHandler &eh)
Initialize.
ThePEG::BB4LPowhegLesHouchesFileReader::optWeightsNamesFunc
virtual std::vector< std::string > optWeightsNamesFunc()
Return the optional weights information string ("Names")
ThePEG::BB4LPowhegLesHouchesFileReader::m_initComments
std::string m_initComments
If LHF.
Definition: BB4LPowhegLesHouchesFileReader.h:214
ThePEG::BB4LPowhegLesHouchesFileReader::doinit
virtual void doinit()
Initialize this object after the setup phase before saving an EventGenerator to disk.
ThePEG::BB4LPowhegLesHouchesFileReader::m_theDecayer
DecayerPtr m_theDecayer
Decayer for any decay modes read from the file.
Definition: BB4LPowhegLesHouchesFileReader.h:258
powheg_weight
double powheg_weight
Definition: BB4LPowhegLesHouchesFileReader.h:20
ThePEG::BB4LPowhegLesHouchesFileReader::m_outsideBlock
std::string m_outsideBlock
If LHF.
Definition: BB4LPowhegLesHouchesFileReader.h:204
ThePEG::BB4LPowhegLesHouchesFileReader::m_theQNumbers
bool m_theQNumbers
Whether or not to search for QNUMBERS stuff.
Definition: BB4LPowhegLesHouchesFileReader.h:243
checker_macros.h
Define macros for attributes used to control the static checker.
LArL1Calo_ComputeHVCorr.className
className
Definition: LArL1Calo_ComputeHVCorr.py:135
herwig7_interface.h
ThePEG::BB4LPowhegLesHouchesFileReader::m_scalemap
std::map< std::string, std::string > m_scalemap
Further information on the weights.
Definition: BB4LPowhegLesHouchesFileReader.h:263