35 using namespace fhicl;
44 Comment(
"data product with the MC showers to be dumped")
48 Name(
"OutputCategory"),
49 Comment(
"name of the output stream (managed by the message facility)"),
54 Name(
"DaughtersPerLine"),
55 Comment(
"daughter IDs to print on each output line"),
74 <<
"Unexpected origin type #" << ((int) origin) <<
"\n";
79 template <
typename Stream>
80 void PrintMCStep(Stream&& out,
sim::MCStep const& step) {
82 << step.
X() <<
", " << step.
Y() <<
", " << step.
Z() <<
") cm, t=" 83 << step.
T() <<
" ns; momentum (" 84 << step.
Px() <<
", " << step.
Py() <<
", " << step.
Pz() <<
"; " 85 << step.
E() <<
") MeV/c";
124 template <
typename Stream>
127 std::string
indent =
"",
bool bIndentFirst =
true 152 template <
typename Stream>
155 std::string
indent ,
bool bIndentFirst
157 if (bIndentFirst) out <<
indent;
159 <<
"from GEANT track ID=" << shower.
TrackID()
160 <<
" PDG ID=" << shower.
PdgCode()
161 <<
" from " << OriginDescription(shower.
Origin())
162 <<
" via '" << shower.
Process() <<
"'";
163 out <<
"\n" << indent
165 ::PrintMCStep(out, shower.
Start());
166 out <<
"\n" << indent
168 ::PrintMCStep(out, shower.
End());
170 TVector3
const& startDir = shower.
StartDir();
171 out <<
"\n" << indent
172 <<
"pointing toward (" 173 << startDir.X() <<
", " << startDir.Y() <<
", " << startDir.Z() <<
") cm";
174 std::vector<double>
const& charges = shower.
Charge();
175 std::vector<double>
const& dQdx = shower.
dQdx();
176 size_t const nQPlanes = dQdx.size(), nChPlanes = charges.size();
177 size_t const nPlanes =
std::max(nQPlanes, nChPlanes);
181 <<
"dE/dx=" << shower.
dEdx() <<
" MeV/cm and dQ/dx (charge) on " 182 << nPlanes <<
" planes:";
183 for (
size_t iPlane = 0; iPlane < nPlanes; ++iPlane) {
184 out <<
" [#" << iPlane <<
"] ";
185 if (iPlane < dQdx.size()) out << dQdx[iPlane];
187 if (iPlane < charges.size()) out <<
" (" << charges[iPlane] <<
")";
191 else out <<
"no energy or charge information available";
194 out <<
"\n" << indent
195 <<
"combined energy deposition information: ";
197 out <<
"\n" << indent
198 << daughters.size() <<
" daughters, ID:";
199 for (
size_t i = 0; i < daughters.size(); ++i) {
201 out <<
" " << std::setw(8) << daughters[i];
204 out <<
"\n" << indent
208 out <<
"\n" << indent
211 out <<
"\n" << indent
215 out <<
"\n" << indent
219 out <<
"\n" << indent
222 out <<
"\n" << indent
234 = *(
event.getValidHandle<std::vector<sim::MCShower>>(
fInputShowers));
237 <<
"Event " <<
event.id() <<
": data product '" 239 << Showers.size() <<
" MCShower objects";
241 unsigned int iShower = 0;
246 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
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
EDAnalyzer(Table< Config > const &config)
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.