17 #include "TStopwatch.h" 18 #include "TGeoManager.h" 44 #include "dk2nu/tree/dk2nu.h" 45 #include "dk2nu/tree/NuChoice.h" 46 #include "dk2nu/genie/GDk2NuFlux.h" 51 #include "GENIE/EVGCore/EventRecord.h" 53 #include "GENIE/Framework/EventGen/EventRecord.h" 57 #define PUT_DK2NU_ASSN 1 97 ,
fDebugFlags (pset.get<
unsigned int >(
"DebugFlags", 0))
101 produces< std::vector<simb::MCTruth> >();
102 produces< std::vector<simb::MCFlux> >();
103 produces< std::vector<simb::GTruth> >();
108 produces< art::Assns<simb::MCTruth, simb::MCFlux> >();
109 produces< art::Assns<simb::MCTruth, simb::GTruth> >();
113 produces< std::vector<bsim::Dk2Nu> >();
114 produces< std::vector<bsim::NuChoice> >();
115 #ifdef PUT_DK2NU_ASSN 116 produces< art::Assns<simb::MCTruth, bsim::Dk2Nu> >();
117 produces< art::Assns<simb::MCTruth, bsim::NuChoice> >();
122 std::string geomFileName =
123 pset.get<std::string>(
"GeomFileName");
124 mf::LogInfo(
"TestGENIEHelper") <<
"using GeomFileName '" 125 << geomFileName <<
"'";
126 TGeoManager::Import(geomFileName.c_str());
127 double detectorMass = 1;
144 mf::LogInfo(
"TestGENIEHelper") <<
"real time to produce file: " 169 std::cerr <<
" *** TestGENIEHelper::beginRun() begin " 170 << std::endl << std::flush;
180 std::cerr <<
" *** TestGENIEHelper::beginRun() done " 181 << std::endl << std::flush;
203 mf::LogInfo(
"TestGENIEHelper") <<
"Total Exposure was " 216 std::unique_ptr< std::vector<simb::MCTruth> > truthcol(
new std::vector<simb::MCTruth>);
217 std::unique_ptr< std::vector<simb::MCFlux> > fluxcol (
new std::vector<simb::MCFlux >);
218 std::unique_ptr< std::vector<simb::GTruth> > gtruthcol (
new std::vector<simb::GTruth >);
222 std::cerr <<
" ******************************* TestGENIEHelper::produce() " << std::endl << std::flush;
223 std::cout <<
" stopwatch at produce() ";
225 std::cout << std::flush;
229 std::unique_ptr< std::vector<bsim::Dk2Nu> >
230 dk2nucol(
new std::vector<bsim::Dk2Nu>);
231 std::unique_ptr< std::vector<bsim::NuChoice> >
232 nuchoicecol(
new std::vector<bsim::NuChoice>);
234 std::unique_ptr< art::Assns<simb::MCTruth, bsim::Dk2Nu> >
236 std::unique_ptr< art::Assns<simb::MCTruth, bsim::NuChoice> >
246 std::cerr <<
" *** TestGENIEHelper::produce() about to sample " 248 << std::endl << std::flush;
249 std::cout <<
" stopwatch before Sample() ";
251 std::cout << std::flush;
260 std::cout <<
" stopwatch after Sample() ";
262 std::cout << std::flush;
264 truthcol ->push_back(truth);
265 gtruthcol->push_back(gTruth);
266 fluxcol ->push_back(flux);
269 fluxcol->size()-1, fluxcol->size());
272 gtruthcol->size()-1, gtruthcol->size());
277 genie::flux::GDk2NuFlux* dk2nuDriver =
278 dynamic_cast<genie::flux::GDk2NuFlux*
>(fdriver);
280 const bsim::Dk2Nu& dk2nuObj = dk2nuDriver->GetDk2Nu();
281 dk2nucol ->push_back(dk2nuObj);
282 const bsim::NuChoice& nuchoiceObj = dk2nuDriver->GetNuChoice();
283 nuchoicecol->push_back(nuchoiceObj);
286 std::cout <<
"---------==== creation dump" << std::endl;
288 if ( gevtrec ) std::cout << *gevtrec << std::endl;
289 std::cout << dk2nuObj << std::endl;
290 const bsim::Decay& decay = dk2nuObj.decay;
291 std::cout <<
" necm " << decay.necm
292 <<
" muparp4 " << decay.muparpx <<
" " 293 << decay.muparpy <<
" " << decay.muparpz <<
" " 294 << decay.mupare << std::endl;
295 std::cout << nuchoiceObj << std::endl;
298 #ifdef PUT_DK2NU_ASSN 300 dk2nucol->size()-1, dk2nucol->size());
302 nuchoicecol->size()-1, nuchoicecol->size());
307 std::cerr <<
" *** TestGENIEHelper::produce() sample success size " 309 << std::endl << std::flush;
311 std::cout <<
" stopwatch after push_back + CreateAssn ";
313 std::cout << std::flush;
321 evt.
put(std::move(truthcol));
322 evt.
put(std::move(fluxcol));
323 evt.
put(std::move(gtruthcol));
324 evt.
put(std::move(assns));
325 evt.
put(std::move(tgtassn));
327 std::cerr <<
" *** TestGENIEHelper::produce() done " 328 <<
" event " << evt.
event()
329 << std::endl << std::flush;
335 evt.
put(std::move(dk2nucol));
336 evt.
put(std::move(nuchoicecol));
338 #ifdef PUT_DK2NU_ASSN 339 std::cerr <<
" *** TestGENIEHelper::produce()" 340 <<
" put dk2nuAssn + nuchoiceAssn ** " 341 <<
" event " << evt.
event()
342 << std::endl << std::flush;
344 evt.
put(std::move(dk2nuassn));
345 evt.
put(std::move(nuchoiceassn));
347 std::cerr <<
" *** TestGENIEHelper::produce() finished put " 348 <<
" event " << evt.
event()
349 << std::endl << std::flush;
genie::GFluxI * GetFluxDriver(bool base=true)
void produce(art::Event &evt)
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
genie::EventRecord * GetGenieEventRecord()
bool Sample(simb::MCTruth &truth, simb::MCFlux &flux, simb::GTruth >ruth)
EDProducer(fhicl::ParameterSet const &pset)
object containing MC flux information
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
void beginRun(art::Run &run)
A module to check the results from the Monte Carlo generator.
#define DEFINE_ART_MODULE(klass)
bool CreateAssn(PRODUCER const &prod, art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t indx=UINT_MAX)
Creates a single one-to-one association.
int fEventsPerSpill
negative for Poisson()
EventNumber_t event() const
Wrapper for generating neutrino interactions with GENIE.
void endSubRun(art::SubRun &sr)
TestGENIEHelper(fhicl::ParameterSet const &pset)
double TotalExposure() const
virtual ~TestGENIEHelper()
evgb::GENIEHelper * fGENIEHelp
GENIEHelper object.
Event generator information.
Event Generation using GENIE, cosmics or single particles.