47 #include "CLHEP/Random/RandomEngine.h" 91 -> registerAndSeedEngine(
createEngine(0,
"HepJamesRandom",
"ISCalcAlg"),
96 ,
Instances{pset.get<
string>(
"Instances",
"LArG4DetectorServicevolTPCActive")}
99 std::cout <<
"IonAndScint Module Construct" << std::endl;
102 std::cout <<
"Produce SimEnergyDeposit in default volume - LArG4DetectorServicevolTPCActive" 109 while (std::getline(input, temp,
';')) {
113 std::cout <<
"Produce SimEnergyDeposit in volumes: " << std::endl;
115 std::cout <<
" - " << instanceName << std::endl;
119 produces<std::vector<sim::SimEnergyDeposit>>();
120 if (
fSavePriorSCE) produces<std::vector<sim::SimEnergyDeposit>>(
"priorSCE");
126 std::cout <<
"IonAndScint beginJob." << std::endl;
127 std::cout <<
"Using " <<
calcTag.
label() <<
" algorithm to calculate IS." << std::endl;
130 fISAlg = std::make_unique<ISCalcSeparate>();
133 fISAlg = std::make_unique<ISCalcCorrelated>(detProp,
fEngine);
138 mf::LogWarning(
"IonAndScint") <<
"No ISCalculation set, this can't be good.";
144 std::cout <<
"IonAndScint endJob." << std::endl;
152 mf::LogDebug(
"IonAndScint") <<
"Retrieving all products" << std::endl;
156 std::vector<art::Handle<SimEnergyDepositCollection>> result;
160 mf::LogDebug(
"IonAndScint") <<
"Retrieving products with module label " << module
165 if (
empty(handels)) {
167 <<
"IonAndScint module cannot find any SimEnergyDeposits with module label " << module
168 <<
" as requested in InputModuleLabels. \n";
171 result.insert(result.end(), handels.begin(), handels.end());
180 std::cout <<
"IonAndScint Module Producer" << std::endl;
182 std::vector<art::Handle<SimEnergyDepositCollection>> edepHandle =
inputCollections(event);
184 if (
empty(edepHandle)) {
185 std::cout <<
"IonAndScint Module Cannot Retrive SimEnergyDeposit" << std::endl;
189 auto sce = lar::providerFrom<spacecharge::SpaceChargeService>();
193 auto simedep = std::make_unique<std::vector<sim::SimEnergyDeposit>>();
194 auto simedep1 = std::make_unique<std::vector<sim::SimEnergyDeposit>>();
195 for (
auto edeps : edepHandle) {
197 if (!edeps.isValid()) {
198 std::cout <<
"!edeps.isValid()" << std::endl;
202 auto index = std::find(
205 std::cout <<
"Skip SimEnergyDeposit in: " << edeps.provenance()->productInstanceName()
210 std::cout <<
"SimEnergyDeposit input module: " << edeps.provenance()->moduleLabel()
211 <<
", instance name: " << edeps.provenance()->productInstanceName() << std::endl;
214 auto const isCalcData =
fISAlg->CalcIonAndScint(detProp, edepi);
216 int ph_num = round(isCalcData.numPhotons);
217 int ion_num = round(isCalcData.numElectrons);
218 float scintyield = isCalcData.scintillationYieldRatio;
219 float edep_tmp = edepi.Energy();
222 double startTime_tmp = edepi.StartT();
223 double endTime_tmp = edepi.EndT();
224 int trackID_tmp = edepi.TrackID();
225 int pdgCode_tmp = edepi.PdgCode();
226 int origTrackID_tmp = edepi.OrigTrackID();
228 if (
sce->EnableSimSpatialSCE()) {
229 auto posOffsetsStart =
230 sce->GetPosOffsets({edepi.StartX(), edepi.StartY(), edepi.StartZ()});
231 auto posOffsetsEnd =
sce->GetPosOffsets({edepi.EndX(), edepi.EndY(), edepi.EndZ()});
233 geo::Point_t{(float)(edepi.StartX() - posOffsetsStart.X()),
234 (
float)(edepi.StartY() + posOffsetsStart.Y()),
235 (
float)(edepi.StartZ() + posOffsetsStart.Z())};
238 (
float)(edepi.EndY() + posOffsetsEnd.Y()),
239 (
float)(edepi.EndZ() + posOffsetsEnd.Z())};
242 simedep->emplace_back(ph_num,
255 simedep1->emplace_back(ph_num,
265 edepi.OrigTrackID());
269 event.put(std::move(simedep));
270 if (
fSavePriorSCE)
event.put(std::move(simedep1),
"priorSCE");
base_engine_t & createEngine(seed_t seed)
Utilities related to art service access.
IonAndScint(fhicl::ParameterSet const &pset)
CLHEP::HepRandomEngine & fEngine
EDProducer(fhicl::ParameterSet const &pset)
std::vector< std::string > fInputModuleLabels
#define DEFINE_ART_MODULE(klass)
std::vector< string > instanceNames
std::vector< art::Handle< SimEnergyDepositCollection > > inputCollections(art::Event const &) const
An art service to assist in the distribution of guaranteed unique seeds to all engines within an art ...
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
contains information for a single step in the detector simulation
Energy deposition in the active material.
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
std::unique_ptr< ISCalc > fISAlg
void produce(art::Event &event) override
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.
Event finding and building.
std::vector< Handle< PROD > > getMany(SelectorBase const &selector=MatchAllSelector{}) const
std::vector< sim::SimEnergyDeposit > SimEnergyDepositCollection