30 #include "nurandom/RandomUtils/NuRandomService.h" 85 ->createEngine(*
this,
"HepJamesRandom",
"NEST", pset,
"SeedNEST"))
87 pset.get<
string>(
"Instances",
"LArG4DetectorServicevolTPCActive"),
91 std::cout <<
"IonAndScint Module Construct" <<
std::endl;
94 std::cout <<
"Produce SimEnergyDeposit in default volume - LArG4DetectorServicevolTPCActive" 101 while (std::getline(input, temp,
';')) {
105 std::cout <<
"Produce SimEnergyDeposit in volumes: " <<
std::endl;
107 std::cout <<
" - " << instanceName <<
std::endl;
111 produces<std::vector<sim::SimEnergyDeposit>>();
112 if (
fSavePriorSCE) produces<std::vector<sim::SimEnergyDeposit>>(
"priorSCE");
119 std::cout <<
"IonAndScint beginJob." <<
std::endl;
123 fISAlg = std::make_unique<ISCalcSeparate>();
126 fISAlg = std::make_unique<ISCalcCorrelated>(detProp);
131 mf::LogWarning(
"IonAndScint") <<
"No ISCalculation set, this can't be good.";
138 std::cout <<
"IonAndScint endJob." <<
std::endl;
142 std::vector<art::Handle<SimEnergyDepositCollection>>
150 std::vector<art::Handle<SimEnergyDepositCollection>>
result;
154 mf::LogDebug(
"IonAndScint") <<
"Retrieving products with module label " 159 if (
empty(handels)) {
161 <<
"IonAndScint module cannot find any SimEnergyDeposits with module label " 162 << module <<
" as requested in InputModuleLabels. \n";
165 result.insert(result.end(), handels.begin(), handels.end());
175 std::cout <<
"IonAndScint Module Producer" <<
std::endl;
177 std::vector<art::Handle<SimEnergyDepositCollection>> edepHandle =
inputCollections(event);
179 if (
empty(edepHandle)) {
180 std::cout <<
"IonAndScint Module Cannot Retrive SimEnergyDeposit" <<
std::endl;
184 auto sce = lar::providerFrom<spacecharge::SpaceChargeService>();
188 auto simedep = std::make_unique<std::vector<sim::SimEnergyDeposit>>();
189 auto simedep1 = std::make_unique<std::vector<sim::SimEnergyDeposit>>();
190 for (
auto edeps : edepHandle) {
192 if (!edeps.isValid()) {
193 std::cout <<
"!edeps.isValid()" <<
std::endl;
197 auto index = std::find(
200 std::cout <<
"Skip SimEnergyDeposit in: " << edeps.provenance()->productInstanceName()
205 std::cout <<
"SimEnergyDeposit input module: " << edeps.provenance()->moduleLabel()
206 <<
", instance name: " << edeps.provenance()->productInstanceName() <<
std::endl;
209 auto const isCalcData =
fISAlg->CalcIonAndScint(detProp, edepi);
211 int ph_num = round(isCalcData.numPhotons);
212 int ion_num = round(isCalcData.numElectrons);
213 float scintyield = isCalcData.scintillationYieldRatio;
214 float edep_tmp = edepi.Energy();
217 double startTime_tmp = edepi.StartT();
218 double endTime_tmp = edepi.EndT();
219 int trackID_tmp = edepi.TrackID();
220 int pdgCode_tmp = edepi.PdgCode();
222 if (
sce->EnableSimSpatialSCE()) {
223 auto posOffsetsStart =
224 sce->GetPosOffsets({edepi.StartX(), edepi.StartY(), edepi.StartZ()});
225 auto posOffsetsEnd =
sce->GetPosOffsets({edepi.EndX(), edepi.EndY(), edepi.EndZ()});
228 (
float)(edepi.StartY() + posOffsetsStart.Y()),
229 (
float)(edepi.StartZ() + posOffsetsStart.Z())};
232 (
float)(edepi.EndY() + posOffsetsEnd.Y()),
233 (
float)(edepi.EndZ() + posOffsetsEnd.Z())};
236 simedep->emplace_back(ph_num,
248 simedep1->emplace_back(ph_num,
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< Handle< PROD > > getMany(SelectorBase const &selector=MatchAllSelector{}) const
std::vector< string > instanceNames
std::vector< art::Handle< SimEnergyDepositCollection > > inputCollections(art::Event const &) const
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
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.
QTextStream & endl(QTextStream &s)
Event finding and building.
std::vector< sim::SimEnergyDeposit > SimEnergyDepositCollection