422 fTimeStamp = ts2.AsDouble();
426 if(!
evt.isRealData()){
427 for(
int k=0;
k < 6;
k++)
431 for(
int k=0;
k < 6;
k++)
437 bool beamTriggerEvent =
false;
439 if(!
evt.isRealData()){
442 auto mcTruths =
evt.getValidHandle<std::vector<simb::MCTruth>>(
fGeneratorTag);
457 if(geantGoodParticle != 0x0){
458 std::cout <<
"Found GEANT particle corresponding to the good particle with pdg = " << geantGoodParticle->PdgCode()
459 <<
" , track id = " << geantGoodParticle->TrackId()
460 <<
" , Vx/Vy/Vz = " << geantGoodParticle->Vx() <<
"/"<< geantGoodParticle->Vy() <<
"/" << geantGoodParticle->Vz()
463 beamTriggerEvent =
true;
482 std::vector< art::Ptr<beam::ProtoDUNEBeamEvent> > beaminfo;
483 auto pdbeamHandle =
evt.getHandle< std::vector<beam::ProtoDUNEBeamEvent> >(
fBeamModuleLabel);
486 for(
unsigned int i = 0; i < beaminfo.size(); ++i){
492 if(beaminfo[i]->GetTOFChan() >= 0)
493 ftof = beaminfo[i]->GetTOF();
496 if(beaminfo[i]->GetBITrigger() == 1){
502 auto &
tracks = beaminfo[i]->GetBeamTracks();
513 auto & beammom = beaminfo[i]->GetRecoBeamMomenta();
544 auto recoParticles =
evt.getValidHandle<std::vector<recob::PFParticle>>(
fPFParticleTag);
573 if(thisTrack != 0x0){
601 if(calovector.size() != 3)
602 std::cerr <<
"WARNING::Calorimetry vector size for primary is = " << calovector.size() <<
std::endl;
608 std::vector<double> tmp_primtrk_dqdx;
609 std::vector<double> tmp_primtrk_resrange;
610 std::vector<double> tmp_primtrk_dedx;
611 std::vector<double> tmp_primtrk_hitx;
612 std::vector<double> tmp_primtrk_hity;
613 std::vector<double> tmp_primtrk_hitz;
614 std::vector<double> tmp_primtrk_pitch;
615 for (
auto &
calo : calovector) {
616 if (
calo.PlaneID().Plane == 2){
618 for (
size_t ihit = 0; ihit <
calo.dQdx().size(); ++ihit){
619 tmp_primtrk_dqdx.push_back(
calo.dQdx()[ihit]);
620 tmp_primtrk_resrange.push_back(
calo.ResidualRange()[ihit]);
621 tmp_primtrk_dedx.push_back(
calo.dEdx()[ihit]);
622 tmp_primtrk_pitch.push_back(
calo.TrkPitchVec()[ihit]);
624 const auto &primtrk_pos=(
calo.XYZ())[ihit];
625 tmp_primtrk_hitx.push_back(primtrk_pos.X());
626 tmp_primtrk_hity.push_back(primtrk_pos.Y());
627 tmp_primtrk_hitz.push_back(primtrk_pos.Z());
628 std::cout<<
"dqdx="<<
calo.dQdx()[ihit]<<
"; resrange="<<
calo.ResidualRange()[ihit]<<
std::endl;
629 std::cout<<
"(X,Y,Z)="<<
"("<<
calo.XYZ()[ihit].X()<<
","<<
calo.XYZ()[ihit].Y()<<
","<<
calo.XYZ()[ihit].Z()<<
")"<<
std::endl;
643 tmp_primtrk_dqdx.clear();
644 tmp_primtrk_resrange.clear();
645 tmp_primtrk_dedx.clear();
646 tmp_primtrk_hitx.clear();
647 tmp_primtrk_hity.clear();
648 tmp_primtrk_hitz.clear();
649 tmp_primtrk_pitch.clear();
651 for(
size_t k = 0;
k < calovector.size() &&
k<3;
k++){
665 if(mcparticle1 != 0x0){
711 else if(thisShower != 0x0){
729 if( (thisShower->
dEdx()).
size() > 0 )
733 std::cout <<
"INFO::Primary pfParticle is not track or shower. Skip!" <<
std::endl;
750 std::cout <<
"INFO::Number of daughters is " << particle->NumDaughters() <<
". Only the first NMAXDAUGTHERS are processed." <<
std::endl;
753 for(
const int daughterID : particle->Daughters()){
756 std::cout <<
"Daughter " << daughterID <<
" has " << daughterParticle->
NumDaughters() <<
" daughters" <<
std::endl;
761 if(daughterTrack != 0x0){
786 if(daughtercalovector.size() != 3)
787 std::cerr <<
"WARNING::Calorimetry vector size for daughter is = " << daughtercalovector.size() <<
std::endl;
789 for(
size_t k = 0;
k < daughtercalovector.size() &&
k<3;
k++){
796 if(mcdaughterparticle != 0x0){
821 std::cout <<
"Daughter Process = " << (mcdaughterparticle->
Process()).c_str()
822 <<
" , mother = " << mcdaughterparticle->
Mother()
826 else if(daughterShower != 0x0){
842 if( (daughterShower->
dEdx()).
size() > 0 )
846 std::cout <<
"INFO::Daughter pfParticle is not track or shower. Skip!" <<
std::endl;
double E(const int i=0) const
double fdaughterLength[NMAXDAUGTHERS]
std::vector< std::vector< double > > primtrk_hitx
protoana::ProtoDUNEDataUtils dataUtil
const TVector3 & ShowerStart() const
double fdaughterShowerEnergy[NMAXDAUGTHERS]
std::string fPFParticleTag
double EndMomentum() const
std::string fCalorimetryTag
constexpr std::uint32_t timeLow() const
int fisdaughtershower[NMAXDAUGTHERS]
double Py(const int i=0) const
std::vector< std::vector< double > > primtrk_hity
std::vector< anab::T0 > GetPFParticleT0(const recob::PFParticle &particle, art::Event const &evt, std::string particleLabel) const
Get the T0(s) from a given PFParticle.
int NumDaughters() const
Returns the number of daughter particles flowing from this one.
double fprimaryMomentumByRangeProton
const simb::MCParticle * GetGeantGoodParticle(const simb::MCTruth &genTruth, const art::Event &evt) const
double fdaughter_truth_Theta[NMAXDAUGTHERS]
double fprimaryShowerdEdx
double fdaughterStartDirection[NMAXDAUGTHERS][3]
const recob::Shower * GetPFParticleShower(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel, const std::string showerLabel) const
Get the shower associated to this particle. Returns a null pointer if not found.
int fisdaughtertrack[NMAXDAUGTHERS]
const simb::MCTrajectory & Trajectory() const
double fdaughterMomentumByRangeProton[NMAXDAUGTHERS]
int fdaughterShowerBestPlane[NMAXDAUGTHERS]
double fdaughterTheta[NMAXDAUGTHERS]
const recob::TrackTrajectory & Trajectory() const
Access to the stored recob::TrackTrajectory.
std::vector< anab::Calorimetry > GetRecoTrackCalorimetry(const recob::Track &track, art::Event const &evt, const std::string trackModule, const std::string caloModule) const
Get the Calorimetry(s) from a given reco track.
constexpr std::uint32_t timeHigh() const
std::vector< std::vector< double > > primtrk_dqdx
const std::vector< const recob::Hit * > GetPFParticleHits(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel) const
Get the hits associated to the PFParticle.
const std::vector< double > & Energy() const
double Px(const int i=0) const
std::vector< double > primtrk_range
int fprimaryShowerBestPlane
const TVector3 GetPFParticleVertex(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel, const std::string trackLabel) const
Function to find the interaction vertex of a primary PFParticle.
double fdaughter_truth_EndPosition[NMAXDAUGTHERS][4]
double fdaughterShowerdEdx[NMAXDAUGTHERS]
double fdaughter_truth_StartPosition[NMAXDAUGTHERS][4]
protoana::ProtoDUNETrackUtils trackUtil
double fprimaryEndPosition[3]
std::string Process() const
unsigned char ProcessToKey(std::string const &process) const
int NumberDaughters() const
double fdaughter_truth_EndMomentum[NMAXDAUGTHERS][4]
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
double fbeamtrackMomentum
double fdaughterT0[NMAXDAUGTHERS]
double fdaughterEndMomentum[NMAXDAUGTHERS]
int fdaughterID[NMAXDAUGTHERS]
double fprimary_truth_Momentum[4]
int fprimary_truth_Isbeammatched
double Pt(const int i=0) const
double fdaughterShowerMIPEnergy[NMAXDAUGTHERS]
int fprimary_truth_Process
double Length(size_t p=0) const
Access to various track properties.
const std::vector< double > & dEdx() const
const std::vector< double > & MIPEnergy() const
std::string fGeneratorTag
std::string EndProcess() const
Point_t const & Start() const
Access to track position at different points.
double fdaughterEndDirection[NMAXDAUGTHERS][3]
double fdaughter_truth_Phi[NMAXDAUGTHERS]
int fdaughterNHits[NMAXDAUGTHERS]
double Theta() const
Access to spherical or geographical angles at vertex or at any point.
double P(const int i=0) const
const recob::Track * GetPFParticleTrack(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel, const std::string trackLabel) const
Get the track associated to this particle. Returns a null pointer if not found.
protoana::ProtoDUNETruthUtils truthUtil
int fprimary_truth_TrackId
double T(const int i=0) const
double fprimaryStartDirection[3]
double fprimaryKineticEnergy[3]
double fprimaryShowerEnergy
protoana::ProtoDUNEPFParticleUtils pfpUtil
double fdaughterKineticEnergy[NMAXDAUGTHERS][3]
double fdaughter_truth_Mass[NMAXDAUGTHERS]
std::string fprimary_truth_EndProcess
const simb::MCParticle * GetMCParticleFromRecoTrack(detinfo::DetectorClocksData const &clockData, const recob::Track &track, art::Event const &evt, std::string trackModule) const
const std::vector< const recob::PFParticle * > GetPFParticlesFromBeamSlice(art::Event const &evt, const std::string particleLabel) const
Return the pointers for the PFParticles in the beam slice. Returns an empty vector is no beam slice w...
const TVector3 & Direction() const
double fprimaryStartPosition[3]
std::vector< std::vector< double > > primtrk_hitz
double fdaughterMomentumByRangeMuon[NMAXDAUGTHERS]
double fdaughterMomentum[NMAXDAUGTHERS]
double fdaughterRange[NMAXDAUGTHERS][3]
double fprimaryEndDirection[3]
Vector_t EndDirection() const
Returns the direction of the trajectory at the last point.
double fdaughterOpeningAngle[NMAXDAUGTHERS]
double Vx(const int i=0) const
double fprimary_truth_Phi
double StartMomentum() const
Hierarchical representation of particle flow.
int fprimary_truth_NDaughters
std::vector< std::vector< double > > primtrk_resrange
std::vector< std::vector< double > > primtrk_pitch
double fprimary_truth_Theta
double fprimary_truth_EndMomentum[4]
int GetNActiveFembsForAPA(art::Event const &evt, int apa) const
Get number of active fembs in an APA.
int fdaughter_truth_TrackId[NMAXDAUGTHERS]
Point_t const & End() const
Returns the position of the last valid point of the trajectory [cm].
const TLorentzVector & Momentum(const int i=0) const
double Pz(const int i=0) const
const art::InputTag fBeamModuleLabel
double Vz(const int i=0) const
double fdaughter_truth_Pt[NMAXDAUGTHERS]
double fprimary_truth_Mass
const TVector3 GetPFParticleSecondaryVertex(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel, const std::string trackLabel) const
Function to find the secondary interaction vertex of a primary PFParticle.
Point_t const & End() const
double fdaughter_truth_Momentum[NMAXDAUGTHERS][4]
std::vector< std::vector< double > > primtrk_dedx
double fdaughterStartPosition[NMAXDAUGTHERS][3]
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
const simb::MCParticle * TrackIdToMotherParticle_P(int id) const
Vector_t StartDirection() const
Returns the direction of the trajectory at the first point.
double fprimaryShowerMIPEnergy
Point_t const & Start() const
Returns the position of the first valid point of the trajectory [cm].
double fprimaryOpeningAngle
int fdaughter_truth_Process[NMAXDAUGTHERS]
float GetBeamCosmicScore(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel) const
Access the BDT output used to decide if a slice is beam-like or cosmic-like.
int fdaughter_truth_Pdg[NMAXDAUGTHERS]
double fprimary_truth_EndPosition[4]
double Vy(const int i=0) const
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
double GetTrackMomentum(double trkrange, int pdg) const
double fdaughterPhi[NMAXDAUGTHERS]
QTextStream & endl(QTextStream &s)
bool IsBeamTrigger(art::Event const &evt) const
double fdaughter_truth_P[NMAXDAUGTHERS]
double fprimaryEndMomentum
double fprimary_truth_StartPosition[4]
double fprimaryMomentumByRangeMuon
double fdaughterEndPosition[NMAXDAUGTHERS][3]