32 using namespace fhicl;
41 Comment(
"data product with the MC showers to be dumped")};
44 Name(
"OutputCategory"),
45 Comment(
"name of the output stream (managed by the message facility)"),
50 Name(
"DaughtersPerLine"),
51 Comment(
"daughter IDs to print on each output line"),
66 return "single particles thrown at the detector";
71 <<
"Unexpected origin type #" << ((int)origin) <<
"\n";
75 template <
typename Stream>
76 void PrintMCStep(Stream&& out,
sim::MCStep const& step)
78 out <<
"(" << step.
X() <<
", " << step.
Y() <<
", " << step.
Z() <<
") cm, t=" << step.
T()
79 <<
" ns; momentum (" << step.
Px() <<
", " << step.
Py() <<
", " << step.
Pz() <<
"; " 80 << step.
E() <<
") MeV/c";
115 template <
typename Stream>
119 bool bIndentFirst =
true)
const;
140 template <
typename Stream>
147 if (bIndentFirst) out <<
indent;
148 out <<
"from GEANT track ID=" << shower.
TrackID() <<
" PDG ID=" << shower.
PdgCode() <<
" from " 149 << OriginDescription(shower.
Origin()) <<
" via '" << shower.
Process() <<
"'";
150 out <<
"\n" << indent <<
" starting at ";
151 ::PrintMCStep(out, shower.
Start());
152 out <<
"\n" << indent <<
" ending at ";
153 ::PrintMCStep(out, shower.
End());
155 TVector3
const& startDir = shower.
StartDir();
157 << indent <<
"pointing toward (" << startDir.X() <<
", " << startDir.Y() <<
", " 158 << startDir.Z() <<
") cm";
159 std::vector<double>
const& charges = shower.
Charge();
160 std::vector<double>
const& dQdx = shower.
dQdx();
161 size_t const nQPlanes = dQdx.size(), nChPlanes = charges.size();
162 size_t const nPlanes = std::max(nQPlanes, nChPlanes);
165 out <<
"dE/dx=" << shower.
dEdx() <<
" MeV/cm and dQ/dx (charge) on " << nPlanes <<
" planes:";
166 for (
size_t iPlane = 0; iPlane < nPlanes; ++iPlane) {
167 out <<
" [#" << iPlane <<
"] ";
168 if (iPlane < dQdx.size())
172 if (iPlane < charges.size())
173 out <<
" (" << charges[iPlane] <<
")";
179 out <<
"no energy or charge information available";
182 out <<
"\n" << indent <<
"combined energy deposition information: ";
184 out <<
"\n" << indent << daughters.size() <<
" daughters, ID:";
185 for (
size_t i = 0; i < daughters.size(); ++i) {
187 out <<
" " << std::setw(8) << daughters[i];
193 out <<
"\n" << indent <<
" starting at ";
195 out <<
"\n" << indent <<
" ending at ";
201 out <<
"\n" << indent <<
" starting at ";
203 out <<
"\n" << indent <<
" ending at ";
213 auto const& Showers = *(
event.getValidHandle<std::vector<sim::MCShower>>(
fInputShowers));
217 << Showers.size() <<
" MCShower objects";
219 unsigned int iShower = 0;
224 log <<
"\n[#" << (iShower++) <<
"] ";
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
const MCStep & End() const
art::InputTag fInputShowers
name of MCShower's data product
unsigned int TrackID() const
std::string fOutputCategory
name of the stream for output
DumpMCShowers(Parameters const &config)
Configuration-checking constructor.
enum simb::_ev_origin Origin_t
event origin types
DumpMCShowers & operator=(DumpMCShowers const &)=delete
EDAnalyzer(fhicl::ParameterSet const &pset)
Class def header for mcstep data container.
const std::vector< unsigned int > & DaughterTrackID() const
const TVector3 & StartDir() const
simb::Origin_t Origin() const
#define DEFINE_ART_MODULE(klass)
int MotherPdgCode() const
const std::string & AncestorProcess() const
single particles thrown at the detector
std::string indent(std::size_t const i)
unsigned int fDaughtersPerLine
number of daughter IDs printed per line
const MCStep & AncestorStart() const
const std::string & MotherProcess() const
unsigned int AncestorTrackID() const
const MCStep & AncestorEnd() const
const MCStep & DetProfile() const
const MCStep & Start() const
double Charge(size_t plane) const
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
virtual void analyze(art::Event const &event) override
const MCStep & MotherEnd() const
void DumpMCShower(Stream &&out, sim::MCShower const &shower, std::string indent="", bool bIndentFirst=true) const
Dumps the content of the specified particle in the output stream.
Class def header for MCShower data container.
unsigned int MotherTrackID() const
const std::string & Process() const
const MCStep & MotherStart() const
int AncestorPdgCode() const
double dQdx(size_t plane) const
constexpr Point origin()
Returns a origin position with a point of the specified type.
Event finding and building.