11 #include "art_root_io/TFileService.h" 12 #include "art_root_io/TFileDirectory.h" 13 #include "canvas/Persistency/Common/FindMany.h" 45 Comment(
"tag of the input data product with the detector simulation information")
84 std::vector<art::Ptr<simb::MCTruth> > beamTruth;
86 if (beamTruthListHandle){
91 mf::LogError(
"ReadBeamInfo") <<
"Requested protoDUNE beam generator information with name " <<
fBeamLabel <<
" but none exists";
96 Int_t nPrimaries = beamTruth[0]->NParticles();
98 for(Int_t iPartp = 0; iPartp < nPrimaries; ++iPartp){
102 TVector3 beamVtx(partp.
Vx(), partp.
Vy(), partp.
Vz());
103 TVector3 beamMom(partp.
Px(), partp.
Py(), partp.
Pz());
104 TVector3 beamDir = beamMom.Unit();
105 double beamTime = partp.
T();
106 double beamMomentum = partp.
P();
107 double beamEnergy = partp.
E();
114 bool beamIsGood = partp.
Process()==
"primary";
121 std::cout <<
" -- Read " << type <<
" beam particle with pdg code " << beamPDG <<
" from event " << evt.
event() <<
std::endl;
124 std::cout <<
" - Vtx = (" << beamVtx.X() <<
", " << beamVtx.Y() <<
", " << beamVtx.Z() <<
")" <<
std::endl;
125 std::cout <<
" - Time = " << beamTime <<
std::endl;
126 std::cout <<
" - Dir = (" << beamDir.X() <<
", " << beamDir.Y() <<
", " << beamDir.Z() <<
")" <<
std::endl;
127 std::cout <<
" - Mom = (" << beamMom.X() <<
", " << beamMom.Y() <<
", " << beamMom.Z() <<
")" <<
std::endl;
128 std::cout <<
" - |Mom| = " << beamMomentum <<
std::endl;
129 std::cout <<
" - Energy = " << beamEnergy <<
std::endl;
130 std::cout <<
" - PDG = " << beamPDG <<
std::endl;
double E(const int i=0) const
EventNumber_t event() const
void analyze(const art::Event &event) override
fhicl::Atom< art::InputTag > BeamLabel
double Py(const int i=0) const
Handle< PROD > getHandle(SelectorBase const &) const
double Px(const int i=0) const
ChannelGroupService::Name Name
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
EDAnalyzer(fhicl::ParameterSet const &pset)
std::string Process() const
art framework interface to geometry description
#define DEFINE_ART_MODULE(klass)
ReadBeamInfo(Parameters const &pset)
double P(const int i=0) const
double T(const int i=0) const
Definition of data types for geometry description.
double Vx(const int i=0) const
double Pz(const int i=0) const
double Vz(const int i=0) const
Access the description of detector geometry.
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
double Vy(const int i=0) const
QTextStream & endl(QTextStream &s)
Event finding and building.
art::InputTag fBeamLabel
The name of the beam event producer.