31 using namespace fhicl;
39 Comment(
"data product with the MC tracks to be dumped")};
42 Name(
"OutputCategory"),
43 Comment(
"name of the output stream (managed by the message facility)"),
58 return "single particles thrown at the detector";
63 <<
"Unexpected origin type #" << ((int)origin) <<
"\n";
67 template <
typename Stream>
68 void PrintMCStep(Stream&& out,
sim::MCStep const& step)
70 out <<
"(" << step.
X() <<
", " << step.
Y() <<
", " << step.
Z() <<
") cm, t=" << step.
T()
71 <<
" ns; momentum (" << step.
Px() <<
", " << step.
Py() <<
", " << step.
Pz() <<
"; " 72 << step.
E() <<
") MeV/c";
107 template <
typename Stream>
111 bool bIndentFirst =
true)
const;
130 template <
typename Stream>
137 if (bIndentFirst) out <<
indent;
138 out <<
"from GEANT track ID=" << track.
TrackID() <<
" PDG ID=" << track.
PdgCode() <<
" from " 139 << OriginDescription(track.
Origin()) <<
" via '" << track.
Process() <<
"'";
140 out <<
"\n" << indent <<
" starting at ";
141 ::PrintMCStep(out, track.
Start());
142 out <<
"\n" << indent <<
" ending at ";
143 ::PrintMCStep(out, track.
End());
145 std::vector<std::vector<double>>
const& dQdx = track.
dQdx();
146 std::vector<double>
const&
dEdx = track.
dEdx();
147 size_t const nQSteps = dQdx.size(), nESteps = dEdx.size();
148 size_t const nSteps = std::max(nQSteps, nESteps);
151 out <<
"energy information for " << nSteps <<
" steps (dE/dX in MeV/cm, then dQ/dx per plane):";
152 for (
size_t iStep = 0; iStep < nSteps; ++iStep) {
153 out <<
"\n" << indent <<
" [#" << iStep <<
"] dE/dx=";
159 if (iStep < nQSteps) {
160 std::vector<double>
const& step_dQdx = dQdx[iStep];
161 for (
size_t iPlane = 0; iPlane < step_dQdx.size(); ++iPlane) {
162 out <<
" [#" << iPlane <<
"] " << step_dQdx[iPlane];
170 out <<
"no energy or charge information available";
175 out <<
"\n" << indent <<
" starting at ";
177 out <<
"\n" << indent <<
" ending at ";
183 out <<
"\n" << indent <<
" starting at ";
185 out <<
"\n" << indent <<
" ending at ";
195 auto const& Tracks = *(
event.getValidHandle<std::vector<sim::MCTrack>>(
fInputTracks));
198 <<
"Event " <<
event.id() <<
": data product '" <<
fInputTracks.
encode() <<
"' contains " 199 << Tracks.size() <<
" MCTrack objects";
201 unsigned int iTrack = 0;
206 log <<
"\n[#" << (iTrack++) <<
"] ";
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
simb::Origin_t Origin() const
const std::vector< std::vector< double > > & dQdx() const
const std::string & AncestorProcess() const
enum simb::_ev_origin Origin_t
event origin types
art::InputTag fInputTracks
name of MCTrack's data product
const MCStep & MotherEnd() const
unsigned int AncestorTrackID() const
EDAnalyzer(fhicl::ParameterSet const &pset)
int AncestorPdgCode() const
const MCStep & End() const
Class def header for mcstep data container.
unsigned int MotherTrackID() const
#define DEFINE_ART_MODULE(klass)
DumpMCTracks & operator=(DumpMCTracks const &)=delete
single particles thrown at the detector
std::string indent(std::size_t const i)
Class def header for mctrack data container.
const MCStep & AncestorStart() const
float dEdx(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, TP3D &tp3d)
void DumpMCTrack(Stream &&out, sim::MCTrack const &track, std::string indent="", bool bIndentFirst=true) const
Dumps the content of the specified particle in the output stream.
std::string fOutputCategory
name of the stream for output
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
const MCStep & MotherStart() const
int MotherPdgCode() const
const std::string & Process() const
const std::string & MotherProcess() const
const MCStep & Start() const
unsigned int TrackID() const
const std::vector< double > & dEdx() const
DumpMCTracks(Parameters const &config)
Configuration-checking constructor.
virtual void analyze(art::Event const &event) override
const MCStep & AncestorEnd() const
constexpr Point origin()
Returns a origin position with a point of the specified type.
Event finding and building.