32 using namespace fhicl;
41 Comment(
"data product with the MC tracks to be dumped")
45 Name(
"OutputCategory"),
46 Comment(
"name of the output stream (managed by the message facility)"),
65 <<
"Unexpected origin type #" << ((
int) origin) <<
"\n";
70 template <
typename Stream>
73 << step.
X() <<
", " << step.
Y() <<
", " << step.
Z() <<
") cm, t=" 74 << step.
T() <<
" ns; momentum (" 75 << step.
Px() <<
", " << step.
Py() <<
", " << step.
Pz() <<
"; " 76 << step.
E() <<
") MeV/c";
115 template <
typename Stream>
141 template <
typename Stream>
146 if (bIndentFirst) out <<
indent;
148 <<
"from GEANT track ID=" << track.
TrackID()
149 <<
" PDG ID=" << track.
PdgCode()
150 <<
" from " << OriginDescription(track.
Origin())
151 <<
" via '" << track.
Process() <<
"'";
152 out <<
"\n" << indent
154 ::PrintMCStep(out, track.
Start());
155 out <<
"\n" << indent
157 ::PrintMCStep(out, track.
End());
159 std::vector<std::vector<double>>
const& dQdx = track.
dQdx();
160 std::vector<double>
const&
dEdx = track.
dEdx();
161 size_t const nQSteps = dQdx.size(), nESteps = dEdx.size();
162 size_t const nSteps =
std::max(nQSteps, nESteps);
166 <<
"energy information for " << nSteps
167 <<
" steps (dE/dX in MeV/cm, then dQ/dx per plane):";
168 for (
size_t iStep = 0; iStep < nSteps; ++iStep) {
169 out <<
"\n" << indent
170 <<
" [#" << iStep <<
"] dE/dx=";
171 if (iStep < nESteps) out << dEdx[iStep];
174 if (iStep < nQSteps) {
175 std::vector<double>
const& step_dQdx = dQdx[iStep];
176 for (
size_t iPlane = 0; iPlane < step_dQdx.size(); ++iPlane) {
177 out <<
" [#" << iPlane <<
"] " << step_dQdx[iPlane];
183 else out <<
"no energy or charge information available";
185 out <<
"\n" << indent
189 out <<
"\n" << indent
192 out <<
"\n" << indent
196 out <<
"\n" << indent
200 out <<
"\n" << indent
203 out <<
"\n" << indent
215 = *(
event.getValidHandle<std::vector<sim::MCTrack>>(
fInputTracks));
218 <<
"Event " <<
event.id() <<
": data product '" 220 << Tracks.size() <<
" MCTrack objects";
222 unsigned int iTrack = 0;
227 log <<
"\n[#" << (iTrack++) <<
"] ";
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
simb::Origin_t Origin() const
const std::string & AncestorProcess() const
enum simb::_ev_origin Origin_t
event origin types
art::InputTag fInputTracks
name of MCTrack's data product
ChannelGroupService::Name Name
const MCStep & MotherEnd() const
unsigned int AncestorTrackID() const
EDAnalyzer(fhicl::ParameterSet const &pset)
int AncestorPdgCode() const
const MCStep & End() const
const std::vector< std::vector< double > > & dQdx() const
Class def header for mcstep data container.
unsigned int MotherTrackID() const
typename config_impl< T >::type Config
double dEdx(float dqdx, float Efield)
#define DEFINE_ART_MODULE(klass)
DumpMCTracks & operator=(DumpMCTracks const &)=delete
single particles thrown at the detector
static int max(int a, int b)
Class def header for mctrack data container.
const MCStep & AncestorStart() const
Code to link reconstructed objects back to the MC truth information.
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.