18 #include "Utilities/AssociationUtil.h" 30 #include <TDatabasePDG.h> 32 #include <TStopwatch.h> 85 , fG4AlgPSet(pset.
get<
fhicl::ParameterSet >(
"G4AlgPSet") )
100 produces< std::vector<sim::G4Status> >();
101 produces< std::vector<sim::FLSHitList > >();
102 produces< std::vector<sim::Particle> >();
103 produces< art::Assns<sim::Particle, simb::MCTruth> >();
104 produces< std::vector<sim::TrueEnergy> >();
105 produces< art::Assns<sim::TrueEnergy, sim::Particle> >();
158 std::unique_ptr<std::vector<sim::G4Status> > g4status(
new std::vector<sim::G4Status>(1) );
159 std::unique_ptr<std::vector<sim::FLSHitList> > flshlcol(
new std::vector<sim::FLSHitList> );
160 std::unique_ptr<std::vector<sim::Particle> > pcol (
new std::vector<sim::Particle> );
163 std::unique_ptr<std::vector<sim::TrueEnergy> > trueens (
new std::vector<sim::TrueEnergy>);
173 std::vector< art::Ptr< simb::MCTruth > > mctp;
174 std::vector< const simb::MCTruth* > mct;
176 for(
size_t i = 0;
i < mclist->size(); ++
i){
179 mct .push_back(ptr.
get());
183 std::map<int, size_t> trackIDToMCTruthIndex;
188 if (g4status->at(0).IsAborted()) {
189 std::cout <<
"Geant4 aborted during processing. Flagged in G4Status data product." <<
std::endl;
194 std::map< int, std::vector<float> >::iterator TrueMapIt;
198 for (
unsigned int pp=0; pp<pcol->size(); ++pp) {
200 if ( (*pcol)[pp].TrackId() != TrueMapIt->first )
continue;
204 if (part.
TrackId() != TrueMapIt->first) {
209 sim::TrueEnergy ThisEn(TrueMapIt->first, TrueMapIt->second[0], TrueMapIt->second[1], TrueMapIt->second[2], TrueMapIt->second[3]);
210 (*trueens).push_back( ThisEn );
212 util::CreateAssn( *
this, evt, *treassn, *trueens, *pcol, pp, (trueens->size()-1) );
223 for(
size_t p = 0;
p < pcol->size(); ++
p){
228 if( trackIDToMCTruthIndex.count(trackID) > 0){
229 mctidx = trackIDToMCTruthIndex.find(trackID)->second;
233 throw cet::exception(
"G4Gen") <<
"Cannot find MCTruth for Track Id: " 235 <<
" to create association between Particle and MCTruth";
240 evt.
put(std::move(g4status));
241 evt.
put(std::move(flshlcol));
242 evt.
put(std::move(pcol));
243 evt.
put(std::move(tpassn));
245 evt.
put(std::move(trueens));
246 evt.
put(std::move(treassn));
TruthSlim – remove generated objects that don't contribute.
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
void RunGeant(std::vector< art::Handle< std::vector< simb::MCTruth > > > &mclists, std::vector< sim::FLSHitList > &flshitlist, std::vector< sim::Particle > &particlelist, std::vector< std::vector< std::pair< size_t, size_t > > > &pListLimits)
static bool CreateAssn(art::EDProducer const &prod, art::Event &evt, std::vector< T > &a, art::Ptr< U > b, art::Assns< T, U > &assn, size_t indx=UINT_MAX, std::string const &instance=std::string())
Create a 1 to 1 association between a new product and one already in the event.
bool fPrintTables
Print the dE/dx tables and other info for debugging etc.?
base_engine_t & createEngine(seed_t seed)
::xsd::cxx::tree::exception< char > exception
DEFINE_ART_MODULE(TestTMapFile)
static std::map< int, std::vector< float > > fTrueDepMap
ProductID put(std::unique_ptr< PROD > &&product)
g4n::G4Alg * fG4Alg
G4Helper object.
void produce(art::Event &evt)
T get(std::string const &key) const
unsigned int GetRandomNumberSeed()
void beginRun(art::Run &run)
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
An algorithm to pass interaction information to Geant4 and create hits and particle lists...
TStopwatch fStopwatch
keep track of how long it takes to run the job
Service to store calibration data products (CDP) in the SQLite3 metadatabase of a file...
std::string fGeneratorLabel
fhicl::ParameterSet fG4AlgPSet
parameter set to configure the G4Alg object