36 #include "art_root_io/TFileService.h" 58 #include "RtypesCore.h" 60 #include "TLorentzVector.h" 159 int nReflectedPhotons,
160 double reflectedT0 = 0.0)
const;
176 fInputModule = pset.
get<std::vector<std::string>>(
"InputModule", {
"largeant"});
179 fInputModule.push_back(pset.
get<std::string>(
"InputModule",
"largeant"));
193 <<
"Building a library with reflected light time is not supported when using " 204 std::cout <<
"Optical Channels positions: " << geo->
Cryostat().
NOpDet() << std::endl;
207 std::cout << ch <<
" " << OpDetCenter.X() <<
" " << OpDetCenter.Y() <<
" " 208 << OpDetCenter.Z() << std::endl;
212 std::cout <<
"Cryo Boundaries" << std::endl;
213 std::cout <<
"Xmin: " << CryoBounds.
MinX() <<
" Xmax: " << CryoBounds.MaxX()
214 <<
" Ymin: " << CryoBounds.MinY() <<
" Ymax: " << CryoBounds.MaxY()
215 <<
" Zmin: " << CryoBounds.MinZ() <<
" Zmax: " << CryoBounds.MaxZ() << std::endl;
223 <<
"ParticleInventoryService service is not configured!" 224 " Please add it in the job configuration." 225 " In the meanwhile, some checks to particles will be skipped.";
267 fTheEventTree = tfs->make<TTree>(
"OpDetEvents",
"OpDetEvents");
311 std::vector<simb::MCParticle>
const* mcpartVec =
nullptr;
314 std::vector<double> totalEnergy_track;
318 mcpartVec = evt.
getHandle<std::vector<simb::MCParticle>>(
"largeant").product();
320 size_t maxNtracks = 1000U;
325 for (
size_t itrack = 0; itrack != maxNtracks; itrack++) {
326 fSignals_vuv[itrack].resize(wireReadoutGeom.NOpChannels());
327 fSignals_vis[itrack].resize(wireReadoutGeom.NOpChannels());
329 totalEnergy_track.resize(maxNtracks, 0.);
336 std::vector<const sim::SimChannel*> sccol;
340 for (
size_t sc = 0;
sc < sccol.size(); ++
sc) {
341 const auto& tdcidemap = sccol[
sc]->TDCIDEMap();
343 for (
auto mapitr = tdcidemap.begin(); mapitr != tdcidemap.end(); mapitr++) {
344 const std::vector<sim::IDE> idevec = (*mapitr).second;
346 for (
size_t iv = 0; iv < idevec.size(); ++iv) {
348 if (plist->
find(idevec[iv].trackID) == plist->
end() &&
350 mf::LogWarning(
"LArG4Ana") << idevec[iv].trackID <<
" is not in particle list";
353 if (idevec[iv].trackID < 0)
continue;
355 totalEnergy_track[idevec[iv].trackID] += idevec[iv].energy / 3.;
369 auto photon_handles = evt.
getMany<std::vector<sim::SimPhotons>>();
370 if (photon_handles.size() == 0)
372 <<
"sim SimPhotons retrieved and you requested them.";
377 for (
auto const& ph_handle : photon_handles) {
379 if (!ph_handle.isValid())
continue;
380 if (ph_handle.provenance()->moduleLabel() != mod)
383 bool Reflected = (ph_handle.provenance()->productInstanceName() ==
"Reflected");
385 if ((*ph_handle).size() > 0) {
388 const int maxNtracks = 1000;
389 for (
size_t itrack = 0; itrack != maxNtracks; itrack++) {
390 for (
size_t pmt_i = 0; pmt_i != wireReadoutGeom.NOpChannels(); pmt_i++) {
399 std::cout <<
"Found OpDet hit collection of size " << (*ph_handle).size() << std::endl;
401 if ((*ph_handle).size() > 0) {
402 for (
auto const& itOpDet : (*ph_handle)) {
425 foriginX = Phot.InitialPosition.X();
426 foriginY = Phot.InitialPosition.Y();
427 foriginZ = Phot.InitialPosition.Z();
451 std::cout <<
"OpDetResponseInterface PerPhoton : Event " <<
fEventID 453 <<
" Detected 1 " << std::endl;
457 std::cout <<
"OpDetResponseInterface PerPhoton : Event " <<
fEventID 459 <<
" Detected 0 " << std::endl;
485 std::cout <<
"OpDetResponseInterface PerPhoton : Event " <<
fEventID 487 <<
" Detected 1 " << std::endl;
491 std::cout <<
"OpDetResponseInterface PerPhoton : Event " <<
fEventID 493 <<
" Detected 0 " << std::endl;
513 std::cout <<
"OpDetResponseInterface PerOpDet : Event " <<
fEventID <<
" OpDet " 523 std::cout <<
"OpDetResponseInterface PerEvent : Event " <<
fEventID <<
" All " 535 std::cout <<
"Filling the analysis tree" << std::endl;
538 std::vector<double> this_xyz;
543 if (pPart.Process() ==
"primary")
fEnergy = pPart.E();
553 fpdg = pPart.PdgCode();
560 for (
size_t i_s = 1; i_s < pPart.NumberTrajectoryPoints(); i_s++) {
563 this_xyz[0] = pPart.Position(i_s).X();
564 this_xyz[1] = pPart.Position(i_s).Y();
565 this_xyz[2] = pPart.Position(i_s).Z();
567 fstepTimes.push_back(pPart.Position(i_s).T());
579 auto photon_handles = evt.
getMany<std::vector<sim::SimPhotonsLite>>();
580 if (photon_handles.size() == 0)
582 <<
"sim SimPhotons retrieved and you requested them.";
587 for (
auto const& ph_handle : photon_handles) {
589 if (!ph_handle.isValid())
continue;
590 if (ph_handle.provenance()->moduleLabel() != mod)
593 bool Reflected = (ph_handle.provenance()->productInstanceName() ==
"Reflected");
600 std::cout <<
"Found OpDet hit collection of size " << (*ph_handle).size() << std::endl;
602 if ((*ph_handle).size() > 0) {
604 for (
auto const& photon : (*ph_handle)) {
607 std::map<int, int> PhotonsMap = photon.DetectedPhotons;
614 for (
auto it = PhotonsMap.begin(); it != PhotonsMap.end(); it++) {
624 for (
int i = 0; i < it->second; i++) {
633 else if (Reflected) {
637 std::cout <<
"OpDetResponseInterface PerPhoton : Event " <<
fEventID 639 <<
" Detected 1 " << std::endl;
642 std::cout <<
"OpDetResponseInterface PerPhoton : Event " <<
fEventID 644 <<
" Detected 0 " << std::endl;
659 std::cout <<
"OpDetResponseInterface PerOpDet : Event " <<
fEventID <<
" OpDet " 668 std::cout <<
"OpDetResponseInterface PerEvent : Event " <<
fEventID <<
" All " 684 int nReflectedPhotons,
701 pvs.
SetLibraryEntry(VoxID, channel,
double(nReflectedPhotons) / NProd,
true);
Store parameters for running LArG4.
Int_t fCountOpDetDetected
std::vector< std::vector< double > > fstepPositions
TVector3 initialPhotonPosition
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
Point_t const & GetCenter() 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
cout<< "Opened file "<< fin<< " ixs= "<< ixs<< endl;if(ixs==0) hhh=(TH1F *) fff-> Get("h1")
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.
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
CryostatGeo const & Cryostat(CryostatID const &cryoid=details::cryostat_zero) const
Returns the specified cryostat.
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.
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.
BoxBoundedGeo const & Boundaries() const
Returns boundaries of the cryostat (in centimetres).
std::vector< std::vector< double > > fSignalsvis
Int_t fCountOpDetReflDetected
Particle list in DetSim contains Monte Carlo particle information.
virtual float wavelength(double energy) const
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
OpDetGeo const & OpDetGeoFromOpDet(unsigned int OpDet) const
Returns the geo::OpDetGeo object for the given detector number.
Event finding and building.
std::vector< Handle< PROD > > getMany(SelectorBase const &selector=MatchAllSelector{}) const
cheat::ParticleInventoryService const * pi_serv