LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
GENIEHelper.h
Go to the documentation of this file.
1 #ifndef EVGB_GENIEHELPER_H
9 #define EVGB_GENIEHELPER_H
10 
11 #include <vector>
12 #include <set>
13 
14 #include "TGeoManager.h"
15 
16 #include "EVGDrivers/GFluxI.h"
17 #include "EVGDrivers/GeomAnalyzerI.h"
18 #include "EVGDrivers/GMCJDriver.h"
19 
20 class TH1D;
21 class TH2D;
22 class TF1;
23 class TRandom3;
24 class TRotation;
25 
27 namespace fhicl {
28  class ParameterSet;
29 }
30 
32 namespace ifdh_ns {
33  class ifdh;
34 }
35 
36 namespace simb {
37  class MCTruth;
38  class MCFlux;
39  class GTruth;
40 }
41 
43 namespace genie { class EventRecord; }
44 
45 namespace evgb {
46 
47  class EvtTimeShiftI; // for shifting time within a spill
48 
49  class GENIEHelper {
50 
51  public:
52 
53  explicit GENIEHelper(fhicl::ParameterSet const& pset,
54  TGeoManager* rootGeom,
55  std::string const& rootFile,
56  double const& detectorMass);
57  ~GENIEHelper();
58 
59  void Initialize();
60  bool Stop();
61  bool Sample(simb::MCTruth &truth,
62  simb::MCFlux &flux,
63  simb::GTruth &gtruth);
64 
65  double TotalHistFlux();
66  double TotalExposure() const { return fTotalExposure; }
67 
68  // Call the following method before calling Stop, otherwise fSpillExposure
69  // will be reset to 0
70  double SpillExposure() const { return fSpillExposure; }
71  std::string FluxType() const { return fFluxType; }
72  std::string DetectorLocation() const { return fDetLocation; }
73 
74  // methods for checking the various algorithms in GENIEHelper - please
75  // do not use these in your code!!!!!
76  std::vector<TH1D*> FluxHistograms() const { return fFluxHistograms; }
77  double TotalMass() const { return fDetectorMass+fSurroundingMass; }
78 
79  genie::EventRecord * GetGenieEventRecord() { return fGenieEventRecord; }
80 
81  // access the random number generator that is supplying additional values for helper
82  TRandom3* GetHelperRandom() { return fHelperRandom; }
83 
84  // direct access to flux driver ... no ownership handover
85  // base is the "real" flux driver, might be wrapped by a flavor mixer
86  genie::GFluxI* GetFluxDriver(bool base = true )
87  { return ( (base) ? fFluxD : fFluxD2GMCJD ); }
88 
89  private:
90 
91  void InitializeGeometry();
92  void InitializeFiducialSelection();
93  void InitializeRockBoxSelection();
94  void InitializeFluxDriver();
95  void ConfigGeomScan();
96  void SetMaxPathOutInfo();
97 
98 
99  void PackNuMIFlux(simb::MCFlux &flux);
100  void PackSimpleFlux(simb::MCFlux &flux);
101  void PackMCTruth(genie::EventRecord *record, simb::MCTruth &truth);
102  void PackGTruth(genie::EventRecord *record, simb::GTruth &truth);
103 
104  void BuildFluxRotation();
105  void ExpandFluxPaths();
106  void ExpandFluxFilePatternsDirect();
107  void ExpandFluxFilePatternsIFDH();
108  bool StringToBool(std::string v);
109 
110  void SetGXMLPATH();
111  void SetGMSGLAYOUT();
112  void StartGENIEMessenger(std::string prodmode);
113  void FindEventGeneratorList();
114  void ReadXSecTable();
115 
116  TGeoManager* fGeoManager;
117  std::string fGeoFile;
118 
119  genie::EventRecord* fGenieEventRecord;
120  genie::GeomAnalyzerI* fGeomD;
121  genie::GFluxI* fFluxD;
122  genie::GFluxI* fFluxD2GMCJD;
123  genie::GMCJDriver* fDriver;
124 
125  // for now leave this here ... but not necessary when using IFDH_service
126  ifdh_ns::ifdh* fIFDH;
127 
128  TRandom3* fHelperRandom;
131 
132  std::string fFluxType;
133 
135  std::string fFluxSearchPaths;
136  std::vector<std::string> fFluxFilePatterns;
137  std::vector<std::string> fSelectedFluxFiles;
140  std::string fFluxCopyMethod;
141  std::string fFluxCleanup;
142  std::string fBeamName;
143  std::string fFluxRotCfg;
144  std::vector<double> fFluxRotValues;
145  TRotation* fFluxRotation;
146 
147  std::string fTopVolume;
148  std::string fWorldVolume;
149  std::string fDetLocation;
150  std::vector<TH1D *> fFluxHistograms;
151 
152  double fFluxUpstreamZ;
154  double fPOTPerSpill;
158  double fSpillExposure;
159  double fTotalExposure;
160  double fMonoEnergy;
161  std::string fFunctionalFlux;
163  double fEmin;
164  double fEmax;
165  double fXSecMassPOT;
166  double fTotalHistFlux;
167  TVector3 fBeamDirection;
168  TVector3 fBeamCenter;
169  double fBeamRadius;
170  double fDetectorMass;
172  double fGlobalTimeOffset;
175  std::string fSpillTimeConfig;
176  std::vector<int> fGenFlavors;
177  double fAtmoEmin;
178  double fAtmoEmax;
179  double fAtmoRl;
180  double fAtmoRt;
181  std::vector<std::string> fEnvironment;
183  std::string fXSecTable;
184  std::string fEventGeneratorList;
185  std::string fGXMLPATH;
186  std::string fGMSGLAYOUT;
187  std::string fGENIEMsgThresholds;
189  std::string fMixerConfig;
190  double fMixerBaseline;
191  std::string fFiducialCut;
192  std::string fGeomScan;
193  std::string fMaxPathOutInfo;
194  unsigned int fDebugFlags;
195  };
196 }
197 #endif //EVGB_GENIEHELPER_H
genie::GFluxI * GetFluxDriver(bool base=true)
Definition: GENIEHelper.h:86
std::vector< std::string > fFluxFilePatterns
wildcard patterns files containing histograms or ntuples, or txt
Definition: GENIEHelper.h:136
std::string FluxType() const
Definition: GENIEHelper.h:71
bool fUseHelperRndGen4GENIE
use fHelperRandom for gRandom during Sample()
Definition: GENIEHelper.h:129
double fEventsPerSpill
Definition: GENIEHelper.h:153
std::string fDetLocation
name of flux window location
Definition: GENIEHelper.h:149
double fAtmoEmax
atmo: Maximum energy of neutrinos in GeV
Definition: GENIEHelper.h:178
int fMaxFluxFileNumber
maximum # of flux files
Definition: GENIEHelper.h:139
double fMixerBaseline
baseline distance if genie flux can&#39;t calculate it
Definition: GENIEHelper.h:190
IFDH interface (data handling) ... if using bare interface.
Definition: GENIEHelper.h:32
GENIE neutrino interaction simulation objects.
Definition: GENIE2ART.h:14
double fTotalHistFlux
total flux of neutrinos from flux histograms for used flavors
Definition: GENIEHelper.h:166
ifdh_ns::ifdh * fIFDH
(optional) flux file handling
Definition: GENIEHelper.h:126
std::string fGXMLPATH
locations for GENIE XML files
Definition: GENIEHelper.h:185
std::string fFiducialCut
configuration for geometry selector
Definition: GENIEHelper.h:191
std::string DetectorLocation() const
Definition: GENIEHelper.h:72
genie::EventRecord * GetGenieEventRecord()
Definition: GENIEHelper.h:79
void Initialize()
Definition: errprop.cc:101
double fRandomTimeOffset
additional random time shift (ns) added to every particle time
Definition: GENIEHelper.h:174
TVector3 fBeamCenter
center of beam for histogram fluxes - must be in meters
Definition: GENIEHelper.h:168
std::string fSpillTimeConfig
alternative to flat spill distribution
Definition: GENIEHelper.h:175
std::string fEventGeneratorList
control over event topologies, was $GEVGL [Default]
Definition: GENIEHelper.h:184
TGeoManager * fGeoManager
pointer to ROOT TGeoManager
Definition: GENIEHelper.h:116
std::string fGENIEMsgThresholds
additional XML file setting Messager level thresholds (":" separated)
Definition: GENIEHelper.h:187
std::vector< int > fGenFlavors
pdg codes for flavors to generate
Definition: GENIEHelper.h:176
evgb::EvtTimeShiftI * fTimeShifter
generator for time offset within a spill
Definition: GENIEHelper.h:130
genie::GMCJDriver * fDriver
Definition: GENIEHelper.h:123
double fXSecMassPOT
product of cross section, mass and POT/spill for histogram fluxes
Definition: GENIEHelper.h:165
std::vector< std::string > fSelectedFluxFiles
flux files selected after wildcard expansion and subset selection
Definition: GENIEHelper.h:137
genie::EventRecord * fGenieEventRecord
last generated event
Definition: GENIEHelper.h:119
double TotalMass() const
Definition: GENIEHelper.h:77
std::string fXSecTable
cross section file (was $GSPLOAD)
Definition: GENIEHelper.h:183
double fFluxUpstreamZ
z where flux starts from (if non-default, simple/ntuple only)
Definition: GENIEHelper.h:152
std::vector< TH1D * > fFluxHistograms
histograms for each nu species
Definition: GENIEHelper.h:150
interface for event time distribution
Definition: EvtTimeShiftI.h:29
double fSurroundingMass
Definition: GENIEHelper.h:171
double SpillExposure() const
Definition: GENIEHelper.h:70
int fGHepPrintLevel
GHepRecord::SetPrintLevel(), -1=no-print.
Definition: GENIEHelper.h:188
std::string fFluxRotCfg
how to interpret fFluxRotValues
Definition: GENIEHelper.h:143
TVector3 fBeamDirection
direction of the beam for histogram fluxes
Definition: GENIEHelper.h:167
std::string fBeamName
name of the beam we are simulating
Definition: GENIEHelper.h:142
std::string fWorldVolume
name of the world volume in the ROOT geometry
Definition: GENIEHelper.h:148
double fTotalExposure
pot used from flux ntuple
Definition: GENIEHelper.h:159
TRandom3 * fHelperRandom
random # generator for GENIEHelper
Definition: GENIEHelper.h:128
parameter set interface
std::string fTopVolume
top volume in the ROOT geometry in which to generate events
Definition: GENIEHelper.h:147
std::vector< TH1D * > FluxHistograms() const
Definition: GENIEHelper.h:76
genie::GeomAnalyzerI * fGeomD
Definition: GENIEHelper.h:120
std::string fFluxSearchPaths
colon separated set of path stems
Definition: GENIEHelper.h:135
std::string fGMSGLAYOUT
format for GENIE log message [BASIC]|SIMPLE (SIMPLE=no timestamps)
Definition: GENIEHelper.h:186
Framework includes.
double fBeamRadius
radius of cylindar for histogram fluxes - must be in meters
Definition: GENIEHelper.h:169
std::string fMixerConfig
configuration string for genie GFlavorMixerI
Definition: GENIEHelper.h:189
genie::GFluxI * fFluxD
real flux driver
Definition: GENIEHelper.h:121
double fMonoEnergy
energy of monoenergetic neutrinos
Definition: GENIEHelper.h:160
double fDetectorMass
mass of the detector in kg
Definition: GENIEHelper.h:170
std::vector< double > fFluxRotValues
parameters for rotation
Definition: GENIEHelper.h:144
TRandom3 * GetHelperRandom()
Definition: GENIEHelper.h:82
double TotalExposure() const
Definition: GENIEHelper.h:66
std::string fMaxPathOutInfo
output info if writing PathLengthList from GeomScan
Definition: GENIEHelper.h:193
double fSpillExposure
total exposure (i.e. pot) for this spill
Definition: GENIEHelper.h:158
double fAtmoEmin
atmo: Minimum energy of neutrinos in GeV
Definition: GENIEHelper.h:177
std::string fGeoFile
name of file containing the Geometry description
Definition: GENIEHelper.h:117
double fAtmoRl
atmo: radius of the sphere on where the neutrinos are generated
Definition: GENIEHelper.h:179
unsigned int fDebugFlags
set bits to enable debug info
Definition: GENIEHelper.h:194
Physics generators for neutrinos, cosmic rays, and others.
Definition: CRYHelper.cxx:33
std::string fFluxCopyMethod
"DIRECT" = old direct access method, otherwise = ifdh approach schema ("" okay)
Definition: GENIEHelper.h:140
std::string fFluxCleanup
"ALWAYS", "/var/tmp", "NEVER"
Definition: GENIEHelper.h:141
Event generator information.
Definition: MCTruth.h:30
double fHistEventsPerSpill
number of events per spill for histogram fluxes - changes each spill
Definition: GENIEHelper.h:156
TRotation * fFluxRotation
rotation for atmos / astro flux coord systems
Definition: GENIEHelper.h:145
std::string fGeomScan
configuration for geometry scan to determine max pathlengths
Definition: GENIEHelper.h:192
int fSpillEvents
total events for this spill
Definition: GENIEHelper.h:157
genie::GFluxI * fFluxD2GMCJD
flux driver passed to genie GMCJDriver, might be GFluxBlender
Definition: GENIEHelper.h:122
std::string fFunctionalFlux
Definition: GENIEHelper.h:161
int fMaxFluxFileMB
maximum size of flux files (MB)
Definition: GENIEHelper.h:138
std::string fFluxType
Definition: GENIEHelper.h:132