29 #ifndef SimPhotonCounterModule_h 30 #define SimPhotonCounterModule_h 1 71 #include "CLHEP/Random/RandFlat.h" 72 #include "CLHEP/Random/RandGaussQ.h" 167 fInputModule = pset.
get<std::vector<std::string>>(
"InputModule",{
"largeant"});
171 fInputModule.push_back(pset.
get<std::string>(
"InputModule",
"largeant"));
197 <<
"ParticleInventoryService service is not configured!" 198 " Please add it in the job configuration." 199 " In the meanwhile, some checks to particles will be skipped." 264 const int maxNtracks = 1000;
269 for(
size_t itrack=0; itrack!=maxNtracks; itrack++) {
319 double totalEnergy_track[1000] = {0.};
325 std::vector<const sim::SimChannel*> sccol;
329 double totalCharge=0.0;
330 double totalEnergy=0.0;
332 for(
size_t sc = 0; sc < sccol.size(); ++sc){
336 const auto & tdcidemap = sccol[sc]->TDCIDEMap();
338 for(
auto mapitr = tdcidemap.begin(); mapitr != tdcidemap.end(); mapitr++){
339 const std::vector<sim::IDE> idevec = (*mapitr).second;
340 numIDEs += idevec.size();
342 for(
size_t iv = 0; iv < idevec.size(); ++iv){
344 if(plist->
find( idevec[iv].trackID ) == plist->
end()
347 mf::LogWarning(
"LArG4Ana") << idevec[iv].trackID <<
" is not in particle list";
350 if(idevec[iv].trackID < 0)
continue;
351 totalCharge +=idevec[iv].numElectrons;
352 scCharge += idevec[iv].numElectrons;
353 totalEnergy +=idevec[iv].energy;
354 scEnergy += idevec[iv].energy;
356 totalEnergy_track[idevec[iv].trackID] += idevec[iv].energy/3.;
377 if(TheHitCollection.size()>0)
381 const int maxNtracks = 1000;
382 for(
size_t itrack=0; itrack!=maxNtracks; itrack++) {
383 for(
size_t pmt_i=0; pmt_i!=geo->
NOpChannels(); pmt_i++) {
390 if(
fVerbosity > 0) std::cout<<
"Found OpDet hit collection of size "<< TheHitCollection.size()<<std::endl;
391 if(TheHitCollection.size()>0)
440 std::cout<<
"OpDetResponseInterface PerPhoton : Event "<<
fEventID<<
" OpChannel " <<
fOpChannel <<
" Wavelength " <<
fWavelength <<
" Detected 1 "<<std::endl;
443 std::cout<<
"OpDetResponseInterface PerPhoton : Event "<<
fEventID<<
" OpChannel " <<
fOpChannel <<
" Wavelength " <<
fWavelength <<
" Detected 0 "<<std::endl;
488 int VoxID;
double NProd;
522 std::cout<<
"Building the analysis tree"<<std::endl;
525 std::vector<double> thisPrexyz;
526 std::vector<double> thisPostxyz;
530 std::vector<sim::MCTrack>
const& mctrackVec(*mctrackHandle);
533 fEnergy = mctrackVec[0][0].E();
534 for(
size_t i_p=0; i_p < mctrackVec.size(); i_p++){
544 fTrackID = mctrackVec[i_p].TrackID();
545 fpdg = mctrackVec[i_p].PdgCode();
550 fProcess = mctrackVec[i_p].Process();
552 for(
size_t i_s=1; i_s < mctrackVec[i_p].size(); i_s++){
553 TVector3
const& vec1 = mctrackVec[i_p][i_s-1].Position().Vect();
554 TVector3
const& vec2 = mctrackVec[i_p][i_s].Position().Vect();
556 thisPrexyz.resize(3);
557 thisPrexyz[0] = vec1.X();
558 thisPrexyz[1] = vec1.Y();
559 thisPrexyz[2] = vec1.Z();
562 thisPostxyz.resize(3);
563 thisPostxyz[0] = vec2.X();
564 thisPostxyz[1] = vec2.Y();
565 thisPostxyz[2] = vec2.Z();
597 if(
fVerbosity > 0) std::cout<<
"Found OpDet hit collection of size "<< (*photonHandle).size()<<std::endl;
600 if((*photonHandle).size()>0)
603 for (
auto const& photon : (*photonHandle) )
607 std::map<int, int> PhotonsMap = photon.DetectedPhotons;
615 for(
auto it = PhotonsMap.begin(); it!= PhotonsMap.end(); it++)
624 for(
int i = 0; i < it->second ; i++)
633 std::cout<<
"OpDetResponseInterface PerPhoton : Event "<<
fEventID<<
" OpChannel " <<
fOpChannel <<
" Wavelength " <<
fWavelength <<
" Detected 1 "<<std::endl;
636 std::cout<<
"OpDetResponseInterface PerPhoton : Event "<<
fEventID<<
" OpChannel " <<
fOpChannel <<
" Wavelength " <<
fWavelength <<
" Detected 0 "<<std::endl;
642 for(
auto it = PhotonsMap.begin(); it!= PhotonsMap.end(); it++)
648 for(
int i = 0; i < it->second; i++)
Store parameters for running LArG4.
virtual ~SimPhotonCounter()
Int_t fCountOpDetDetected
TVector3 initialPhotonPosition
void RetrieveLightProd(int &VoxID, double &N) const
TTree * fLightAnalysisTree
std::vector< std::vector< double > > fstepPostPositions
cheat::ParticleInventoryService * pi_serv
bool fMakeLightAnalysisTree
std::vector< double > fPosition0
std::vector< std::vector< double > > fSignalsvuv
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
virtual bool detected(int OpChannel, const sim::OnePhoton &Phot, int &newOpChannel) const
unsigned int NOpChannels() const
Number of electronics channels for all the optical detectors.
TVector3 finalPhotonPosition
std::vector< std::vector< double > > fstepPrePositions
iterator find(const key_type &key)
std::vector< std::string > fInputModule
bool StoreReflected() const
std::size_t getView(std::string const &moduleLabel, std::string const &productInstanceName, std::vector< ELEMENT const * > &result) const
#define DEFINE_ART_MODULE(klass)
void analyze(art::Event const &)
bool fMakeDetectedPhotonsTree
static const int NoParticleId
TTree * fThePhotonTreeDetected
void SetLibraryReflT0Entry(int VoxID, int OpChannel, float value)
T get(std::string const &key) const
TTree * fThePhotonTreeAll
void SetLibraryEntry(int VoxID, int OpChannel, float N, bool wantReflected=false)
EDAnalyzer(Table< Config > const &config)
Int_t fCountEventDetected
Class def header for mctrack data container.
bool fMakeOpDetEventsTree
virtual bool detectedLite(int OpChannel, int &newOpChannel) const
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
T * make(ARGS...args) const
std::vector< double > fstepPostTimes
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
list_type::const_iterator const_iterator
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
EventNumber_t event() const
std::vector< std::vector< double > > fSignalsvis
const sim::ParticleList & ParticleList()
Int_t fCountOpDetReflDetected
virtual float wavelength(double energy) const
Namespace collecting geometry-related classes utilities.
std::vector< std::vector< std::vector< double > > > fSignals_vuv
std::vector< double > fstepPreTimes
Tools and modules for checking out the basics of the Monte Carlo.
static sim::SimPhotonsCollection GetSimPhotonsCollection(const art::Event &evt, std::string moduleLabel)
bool UseLitePhotons() const
Event finding and building.