17 #include "art_root_io/TFileService.h" 19 #include "canvas/Persistency/Common/FindManyP.h" 46 #include "TTimeStamp.h" 61 class ProtoDUNEDPAnalCosmicTree;
76 virtual void endJob()
override;
179 fPandoraCosmics = tfs->make<TTree>(
"PandoraCosmics",
"Cosmic tracks reconstructed with Pandora");
254 if(npfParticles == 0){
255 std::cout <<
"WARNING::No PfParticles found! Skipping event!" <<
std::endl;
265 for(
unsigned int i = 0; i < recoParticles->size(); i++){
298 if(thisTrack != 0x0){
325 if(calovector.size() != 3)
326 std::cerr <<
"WARNING::Calorimetry vector size for cosmic is = " << calovector.size() <<
std::endl;
328 for(
size_t k = 0;
k < calovector.size() &&
k<3;
k++){
329 int plane = calovector[
k].PlaneID().Plane;
330 if(plane < 0)
continue;
331 if(plane > 2)
continue;
340 std::cerr <<
"WARNING::PID vector size for primary is = " << pids.size() <<
std::endl;
342 for(
size_t k = 0;
k < pids.size() &&
k<3;
k++){
343 int plane = pids[
k].PlaneID().Plane;
344 if(plane < 0)
continue;
345 if(plane > 2)
continue;
360 else if(thisShower != 0x0){
376 std::cout <<
"INFO::Cosmic pfParticle is not track or shower. Skip!" <<
std::endl;
395 for(
int k=0;
k < 5;
k++)
418 for(
int l=0;
l < 3;
l++){
double fcosmicTrkPitchC[NMAXCOSMICPARTICLES][3]
double fcosmicMomentumByRangeMuon[NMAXCOSMICPARTICLES]
int fiscosmicshower[NMAXCOSMICPARTICLES]
const TVector3 & ShowerStart() const
std::vector< anab::ParticleID > GetRecoTrackPID(const recob::Track &track, art::Event const &evt, const std::string trackModule, const std::string pidModule) const
Get the PID from a given track.
constexpr std::uint32_t timeLow() const
bool IsBeamParticle(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel) const
Use the pandora metadata to tell us if this is a beam particle or not.
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.
double fcosmicID[NMAXCOSMICPARTICLES]
std::string fGeneratorTag
double fcosmicStartDirection[NMAXCOSMICPARTICLES][3]
const int NMAXCOSMICPARTICLES
const art::InputTag fBeamModuleLabel
double fcosmicPID_Chi2Kaon[NMAXCOSMICPARTICLES][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.
std::string fParticleIDTag
std::string fCalorimetryTag
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
double fcosmicPID_MissingE[NMAXCOSMICPARTICLES][3]
double fcosmicPID_PIDA[NMAXCOSMICPARTICLES][3]
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.
protoana::ProtoDUNETrackUtils trackUtil
double fcosmicEndDirection[NMAXCOSMICPARTICLES][3]
bool IsClearCosmic(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel) const
Pandora tags and removes clear cosmics before slicing, so check if this particle is a clear cosmic...
void FillCosmicsTree(art::Event const &evt)
double fcosmicPID_Chi2Pion[NMAXCOSMICPARTICLES][3]
std::string fPFParticleTag
EDAnalyzer(fhicl::ParameterSet const &pset)
double fcosmicPID_Chi2Proton[NMAXCOSMICPARTICLES][3]
double fcosmicBDTScore[NMAXCOSMICPARTICLES]
double fcosmicStartPosition[NMAXCOSMICPARTICLES][3]
ProtoDUNEDPAnalCosmicTree & operator=(ProtoDUNEDPAnalCosmicTree const &)=delete
double fcosmicOpeningAngle[NMAXCOSMICPARTICLES]
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
int fcosmicShowerBestPlane[NMAXCOSMICPARTICLES]
double fcosmicPhi[NMAXCOSMICPARTICLES]
double Length(size_t p=0) const
Access to various track properties.
ProtoDUNEDPAnalCosmicTree(fhicl::ParameterSet const &p)
#define DEFINE_ART_MODULE(klass)
protoana::ProtoDUNEPFParticleUtils pfpUtil
double Theta() const
Access to spherical or geographical angles at vertex or at any point.
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.
double fcosmicPID_DeltaChi2[NMAXCOSMICPARTICLES][3]
int fcosmicNHits[NMAXCOSMICPARTICLES]
int fiscosmictrack[NMAXCOSMICPARTICLES]
double fcosmicPID_MissingEavg[NMAXCOSMICPARTICLES][3]
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
SubRunNumber_t subRun() const
double fcosmicRange[NMAXCOSMICPARTICLES][3]
bool IsPrimary() const
Returns whether the particle is the root of the flow.
const TVector3 & Direction() const
double fcosmicKineticEnergy[NMAXCOSMICPARTICLES][3]
double fcosmicMomentumByRangeProton[NMAXCOSMICPARTICLES]
double fcosmicEndPosition[NMAXCOSMICPARTICLES][3]
Vector_t EndDirection() const
Returns the direction of the trajectory at the last point.
double fcosmicLength[NMAXCOSMICPARTICLES]
virtual void beginJob() override
Declaration of signal hit object.
Hierarchical representation of particle flow.
virtual void endJob() override
protoana::ProtoDUNETruthUtils truthUtil
void analyze(art::Event const &evt) override
trkf::TrackMomentumCalculator trmom
double fcosmicPID_Chi2Muon[NMAXCOSMICPARTICLES][3]
Point_t const & End() const
Returns the position of the last valid point of the trajectory [cm].
double fMinimumTrackLength
Provides recob::Track data product.
EventNumber_t event() const
int fcosmicIsClear[NMAXCOSMICPARTICLES]
double fcosmicTheta[NMAXCOSMICPARTICLES]
double fcosmicT0[NMAXCOSMICPARTICLES]
auto const & get(AssnsNode< L, R, D > const &r)
unsigned int GetNumberPrimaryPFParticle(art::Event const &evt, const std::string particleLabel) const
Get the number of primary PFParticles.
Vector_t StartDirection() const
Returns the direction of the trajectory at the first point.
Point_t const & Start() const
Returns the position of the first valid point of the trajectory [cm].
int fcosmicPID_Pdg[NMAXCOSMICPARTICLES][3]
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.
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
double fcosmicPID_MinChi2[NMAXCOSMICPARTICLES][3]
double GetTrackMomentum(double trkrange, int pdg) const
QTextStream & endl(QTextStream &s)
int fcosmicPID_Ndf[NMAXCOSMICPARTICLES][3]