36 #include "art_root_io/TFileService.h" 57 #include "RtypesCore.h" 59 #include "TLorentzVector.h" 158 int nReflectedPhotons,
159 double reflectedT0 = 0.0)
const;
175 fInputModule = pset.
get<std::vector<std::string>>(
"InputModule", {
"largeant"});
178 fInputModule.push_back(pset.
get<std::string>(
"InputModule",
"largeant"));
192 <<
"Building a library with reflected light time is not supported when using " 203 std::cout <<
"Optical Channels positions: " << geo->
Cryostat().
NOpDet() << std::endl;
206 std::cout << ch <<
" " << OpDetCenter.X() <<
" " << OpDetCenter.Y() <<
" " 207 << OpDetCenter.Z() << std::endl;
211 std::cout <<
"Cryo Boundaries" << std::endl;
212 std::cout <<
"Xmin: " << CryoBounds.
MinX() <<
" Xmax: " << CryoBounds.MaxX()
213 <<
" Ymin: " << CryoBounds.MinY() <<
" Ymax: " << CryoBounds.MaxY()
214 <<
" Zmin: " << CryoBounds.MinZ() <<
" Zmax: " << CryoBounds.MaxZ() << std::endl;
222 <<
"ParticleInventoryService service is not configured!" 223 " Please add it in the job configuration." 224 " In the meanwhile, some checks to particles will be skipped.";
266 fTheEventTree = tfs->make<TTree>(
"OpDetEvents",
"OpDetEvents");
311 std::vector<simb::MCParticle>
const* mcpartVec =
nullptr;
314 std::vector<double> totalEnergy_track;
319 mcpartVec = evt.
getHandle<std::vector<simb::MCParticle>>(
"largeant").product();
321 size_t maxNtracks = 1000U;
326 for (
size_t itrack = 0; itrack != maxNtracks; itrack++) {
330 totalEnergy_track.resize(maxNtracks, 0.);
337 std::vector<const sim::SimChannel*> sccol;
342 for (
size_t sc = 0;
sc < sccol.size(); ++
sc) {
343 const auto& tdcidemap = sccol[
sc]->TDCIDEMap();
345 for (
auto mapitr = tdcidemap.begin(); mapitr != tdcidemap.end(); mapitr++) {
346 const std::vector<sim::IDE> idevec = (*mapitr).second;
348 for (
size_t iv = 0; iv < idevec.size(); ++iv) {
350 if (plist->
find(idevec[iv].trackID) == plist->
end() &&
352 mf::LogWarning(
"LArG4Ana") << idevec[iv].trackID <<
" is not in particle list";
355 if (idevec[iv].trackID < 0)
continue;
357 totalEnergy_track[idevec[iv].trackID] += idevec[iv].energy / 3.;
373 auto photon_handles = evt.
getMany<std::vector<sim::SimPhotons>>();
374 if (photon_handles.size() == 0)
376 <<
"sim SimPhotons retrieved and you requested them.";
382 for (
auto const& ph_handle : photon_handles) {
384 if (!ph_handle.isValid())
continue;
385 if (ph_handle.provenance()->moduleLabel() != mod)
388 bool Reflected = (ph_handle.provenance()->productInstanceName() ==
"Reflected");
390 if ((*ph_handle).size() > 0) {
393 const int maxNtracks = 1000;
394 for (
size_t itrack = 0; itrack != maxNtracks; itrack++) {
395 for (
size_t pmt_i = 0; pmt_i != geo->
NOpChannels(); pmt_i++) {
405 std::cout <<
"Found OpDet hit collection of size " << (*ph_handle).size() << std::endl;
407 if ((*ph_handle).size() > 0) {
409 for (
auto const& itOpDet : (*ph_handle)) {
434 foriginX = Phot.InitialPosition.X();
435 foriginY = Phot.InitialPosition.Y();
436 foriginZ = Phot.InitialPosition.Z();
460 std::cout <<
"OpDetResponseInterface PerPhoton : Event " <<
fEventID 462 <<
" Detected 1 " << std::endl;
466 std::cout <<
"OpDetResponseInterface PerPhoton : Event " <<
fEventID 468 <<
" Detected 0 " << std::endl;
494 std::cout <<
"OpDetResponseInterface PerPhoton : Event " <<
fEventID 496 <<
" Detected 1 " << std::endl;
500 std::cout <<
"OpDetResponseInterface PerPhoton : Event " <<
fEventID 502 <<
" Detected 0 " << std::endl;
522 std::cout <<
"OpDetResponseInterface PerOpDet : Event " <<
fEventID <<
" OpDet " 532 std::cout <<
"OpDetResponseInterface PerEvent : Event " <<
fEventID <<
" All " 544 std::cout <<
"Filling the analysis tree" << std::endl;
547 std::vector<double> this_xyz;
552 if (pPart.Process() ==
"primary")
fEnergy = pPart.E();
562 fpdg = pPart.PdgCode();
569 for (
size_t i_s = 1; i_s < pPart.NumberTrajectoryPoints(); i_s++) {
572 this_xyz[0] = pPart.Position(i_s).X();
573 this_xyz[1] = pPart.Position(i_s).Y();
574 this_xyz[2] = pPart.Position(i_s).Z();
576 fstepTimes.push_back(pPart.Position(i_s).T());
590 auto photon_handles = evt.
getMany<std::vector<sim::SimPhotonsLite>>();
591 if (photon_handles.size() == 0)
593 <<
"sim SimPhotons retrieved and you requested them.";
601 for (
auto const& ph_handle : photon_handles) {
603 if (!ph_handle.isValid())
continue;
604 if (ph_handle.provenance()->moduleLabel() != mod)
607 bool Reflected = (ph_handle.provenance()->productInstanceName() ==
"Reflected");
614 std::cout <<
"Found OpDet hit collection of size " << (*ph_handle).size() << std::endl;
616 if ((*ph_handle).size() > 0) {
618 for (
auto const& photon : (*ph_handle)) {
621 std::map<int, int> PhotonsMap = photon.DetectedPhotons;
628 for (
auto it = PhotonsMap.begin(); it != PhotonsMap.end(); it++) {
639 for (
int i = 0; i < it->second; i++) {
648 else if (Reflected) {
652 std::cout <<
"OpDetResponseInterface PerPhoton : Event " <<
fEventID 654 <<
" Detected 1 " << std::endl;
657 std::cout <<
"OpDetResponseInterface PerPhoton : Event " <<
fEventID 659 <<
" Detected 0 " << std::endl;
674 std::cout <<
"OpDetResponseInterface PerOpDet : Event " <<
fEventID <<
" OpDet " 683 std::cout <<
"OpDetResponseInterface PerEvent : Event " <<
fEventID <<
" All " 699 int nReflectedPhotons,
716 pvs.
SetLibraryEntry(VoxID, channel,
double(nReflectedPhotons) / NProd,
true);
Store parameters for running LArG4.
Int_t fCountOpDetDetected
std::vector< std::vector< double > > fstepPositions
TVector3 initialPhotonPosition
OpDetGeo const & OpDetGeoFromOpDet(unsigned int OpDet) const
Returns the geo::OpDetGeo object for the given detector number.
void RetrieveLightProd(int &VoxID, double &N) const
Encapsulate the construction of a single cyostat.
TTree * fLightAnalysisTree
void storeVisibility(int channel, int nDirectPhotons, int nReflectedPhotons, double reflectedT0=0.0) const
double MinX() const
Returns the world x coordinate of the start of the box.
bool fMakeLightAnalysisTree
std::vector< double > fPosition0
All information of a photon entering the sensitive optical detector volume.
phot::PhotonVisibilityService const * fPVS
std::vector< std::vector< double > > fSignalsvuv
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
virtual bool detected(int OpChannel, const sim::OnePhoton &Phot, int &newOpChannel) const
EDAnalyzer(fhicl::ParameterSet const &pset)
static constexpr double kVUVWavelength
Value used when a typical ultraviolet light wavelength is needed.
CryostatGeo const & Cryostat(CryostatID const &cryoid=cryostat_zero) const
Returns the specified cryostat.
unsigned int NOpChannels() const
Number of electronics channels for all the optical detectors.
TVector3 finalPhotonPosition
std::vector< double > fstepTimes
iterator find(const key_type &key)
std::vector< std::string > fInputModule
bool StoreReflected() const
Simulation objects for optical detectors.
bool isVisible(double wavelength) const
Returns if we label as "visibile" a photon with specified wavelength [nm].
#define DEFINE_ART_MODULE(klass)
void analyze(art::Event const &)
bool fMakeDetectedPhotonsTree
static const int NoParticleId
static constexpr double kVisibleWavelength
Value used when a typical visible light wavelength is needed.
TTree * fThePhotonTreeDetected
void SetLibraryReflT0Entry(int VoxID, int OpChannel, float value)
T get(std::string const &key) const
TTree * fThePhotonTreeAll
Int_t fCountEventDetected
Class def header for mctrack data container.
bool fMakeOpDetEventsTree
virtual bool detectedLite(int OpChannel, int &newOpChannel) const
const sim::ParticleList & ParticleList() const
std::size_t getView(std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName, std::vector< ELEMENT const * > &result) const
Encapsulate the geometry of an optical detector.
geo::Point_t const & GetCenter() const
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Collection of photons which recorded on one channel.
Handle< PROD > getHandle(SelectorBase const &) const
void SetLibraryEntry(int VoxID, OpDetID_t libOpChannel, float N, bool wantReflected=false)
unsigned int NOpDet() const
Number of optical detectors in this TPC.
std::vector< std::vector< std::vector< double > > > fSignals_vis
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
object containing MC truth information necessary for making RawDigits and doing back tracking ...
IDNumber_t< Level::Event > EventNumber_t
bool const fUseLitePhotons
EventNumber_t event() const
static constexpr double kVisibleThreshold
Threshold used to resolve between visible and ultraviolet light.
std::vector< std::vector< double > > fSignalsvis
Int_t fCountOpDetReflDetected
geo::BoxBoundedGeo const & Boundaries() const
Returns boundaries of the cryostat (in centimetres).
Particle list in DetSim contains Monte Carlo particle information.
virtual float wavelength(double energy) const
Namespace collecting geometry-related classes utilities.
std::vector< std::vector< std::vector< double > > > fSignals_vuv
Tools and modules for checking out the basics of the Monte Carlo.
art framework interface to geometry description
Event finding and building.
std::vector< Handle< PROD > > getMany(SelectorBase const &selector=MatchAllSelector{}) const
cheat::ParticleInventoryService const * pi_serv