All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TrackCaloSkimmer.h
Go to the documentation of this file.
1 #ifndef SBN_TrackCaloSkimmer
2 #define SBN_TrackCaloSkimmer
3 
4 ////////////////////////////////////////////////////////////////////////
5 // Class: TrackCaloSkimmer
6 // Plugin Type: analyzer (art v3_06_03)
7 //
8 // Generated at Mon May 17 09:46:34 2021 by Gray Putnam using cetskelgen
9 // from cetlib version v3_11_01.
10 ////////////////////////////////////////////////////////////////////////
11 
12 
13 #include <cstdlib>
14 #include <iostream>
15 
16 #include "TTree.h"
17 #include "TFitter.h"
18 
19 #include "art/Framework/Core/EDAnalyzer.h"
20 #include "art/Framework/Core/ModuleMacros.h"
21 #include "art/Framework/Principal/Event.h"
22 #include "art/Framework/Principal/Handle.h"
23 #include "art/Framework/Principal/Run.h"
24 #include "art/Framework/Principal/SubRun.h"
25 #include "canvas/Utilities/InputTag.h"
26 #include "fhiclcpp/ParameterSet.h"
27 #include "messagefacility/MessageLogger/MessageLogger.h"
28 
29 #include "art_root_io/TFileService.h"
30 
31 #include "canvas/Persistency/Common/FindMany.h"
32 #include "canvas/Persistency/Common/FindManyP.h"
33 #include "canvas/Persistency/Common/FindOne.h"
34 #include "canvas/Persistency/Common/FindOneP.h"
35 #include "canvas/Persistency/Common/Ptr.h"
36 #include "canvas/Persistency/Common/PtrVector.h"
37 
49 
51 
60 
61 #include "nusimdata/SimulationBase/MCParticle.h"
64 
66 #include "ITCSSelectionTool.h"
67 
68 namespace sbn {
69  class TrackCaloSkimmer;
71 }
72 
73 class sbn::TrackCaloSkimmer : public art::EDAnalyzer {
74 public:
75  explicit TrackCaloSkimmer(fhicl::ParameterSet const& p);
76  // The compiler-generated destructor is fine for non-base
77  // classes without bare pointers or other resource use.
78 
79  // Plugins should not be copied or assigned.
80  TrackCaloSkimmer(TrackCaloSkimmer const&) = delete;
84 
86 
87  void analyze(art::Event const& e) override;
88 
89  void respondToOpenInputFile(const art::FileBlock& fb) override {
90  (void) fb;
91  fMeta.ifile ++;
92  }
93 
94 private:
95  // Internal data struct
96  struct GlobalTrackInfo {
101  int ID;
102  };
103 
104 
105  // Represents a "Snippet" of ADCs shared by a set of hits on a wire
106  struct Snippet {
109  int end_tick;
110 
111  bool operator==(const Snippet &rhs) const {
112  return wire == rhs.wire && start_tick == rhs.start_tick && end_tick == rhs.end_tick;
113  }
114 
115  bool operator<(const Snippet &rhs) const {
116  return wire < rhs.wire || (wire == rhs.wire && start_tick < rhs.start_tick);
117  }
118  };
119 
120  // Fill vars
121  void FillTrack(const recob::Track &track,
122  const recob::PFParticle &pfp, float t0,
123  const std::vector<art::Ptr<recob::Hit>> &hits,
124  const std::vector<const recob::TrackHitMeta*> &thms,
125  const std::vector<art::Ptr<recob::SpacePoint>> &sps,
126  const std::vector<art::Ptr<anab::Calorimetry>> &calo,
127  const std::map<geo::WireID, art::Ptr<raw::RawDigit>> &rawdigits,
128  const std::vector<GlobalTrackInfo> &tracks,
129  const geo::GeometryCore *geo,
130  const detinfo::DetectorClocksData &clock_data,
131  const cheat::BackTrackerService *bt_serv,
132  const sbn::EDet det);
133 
134  void FillTrackDaughterRays(const recob::Track &trk,
135  const recob::PFParticle &pfp,
136  const std::vector<art::Ptr<recob::PFParticle>> &PFParticleList,
137  const art::FindManyP<recob::SpacePoint> &PFParticleSPs);
138 
140  const detinfo::DetectorPropertiesData &dprop,
141  const recob::Track &track,
142  const std::vector<art::Ptr<recob::Hit>> &allHits,
143  const art::FindManyP<recob::SpacePoint> &allHitSPs);
144 
145  void FillTrackTruth(const detinfo::DetectorClocksData &clock_data,
146  const std::vector<art::Ptr<recob::Hit>> &trkHits,
147  const std::vector<art::Ptr<simb::MCParticle>> &mcparticles,
148  const std::vector<geo::BoxBoundedGeo> &active_volumes,
149  const std::vector<std::vector<geo::BoxBoundedGeo>> &tpc_volumes,
150  const std::map<int, std::vector<std::pair<geo::WireID, const sim::IDE*>>> id_to_ide_map,
151  const std::map<int, std::vector<art::Ptr<recob::Hit>>> id_to_truehit_map,
152  const detinfo::DetectorPropertiesData &dprop,
153  const geo::GeometryCore *geo);
154 
156  unsigned hkey,
157  const recob::TrackHitMeta &thm,
158  const recob::Track &trk,
159  const art::Ptr<recob::SpacePoint> &sp,
160  const std::vector<art::Ptr<anab::Calorimetry>> &calo,
161  const geo::GeometryCore *geo,
162  const detinfo::DetectorClocksData &dclock,
163  const cheat::BackTrackerService *bt_serv);
164 
165  void DoTailFit();
166 
167  // config
168 
169  // tags
170  art::InputTag fPFPproducer;
171  std::vector<art::InputTag> fT0producers;
172  art::InputTag fCALOproducer;
173  art::InputTag fTRKproducer;
174  art::InputTag fTRKHMproducer;
175  art::InputTag fHITproducer;
176  std::vector<art::InputTag> fRawDigitproducers;
177  std::string fG4producer;
178  std::string fSimChannelproducer;
181  bool fVerbose;
189 
190  // tools
191  std::vector<std::unique_ptr<sbn::ITCSSelectionTool>> fSelectionTools;
192 
193  // persistent info
195 
196  std::map<Snippet, int> fSnippetCount;
197  std::map<geo::WireID, std::pair<int, int>> fWiresToSave;
198 
199  // Output
200  TTree *fTree;
202 
203  // Fitting info
204  TFitter fFitExp;
205  TFitter fFitConst;
206 };
207 #endif
void analyze(art::Event const &e) override
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
Definition: geo_vectors.h:164
std::map< geo::WireID, std::pair< int, int > > fWiresToSave
art::InputTag fHITproducer
Utilities related to art service access.
int ifile
Index of file into processing.
ClusterModuleLabel join with tracks
const geo::GeometryCore * geometry
Declaration of signal hit object.
std::map< Snippet, int > fSnippetCount
pdgs p
Definition: selectors.fcl:22
void FillTrackEndHits(const geo::GeometryCore *geometry, const detinfo::DetectorPropertiesData &dprop, const recob::Track &track, const std::vector< art::Ptr< recob::Hit >> &allHits, const art::FindManyP< recob::SpacePoint > &allHitSPs)
Class to keep data related to recob::Hit associated with recob::Track.
std::vector< art::InputTag > fRawDigitproducers
Definition of basic raw digits.
process_name use argoneut_mc_hitfinder track
void FillTrackDaughterRays(const recob::Track &trk, const recob::PFParticle &pfp, const std::vector< art::Ptr< recob::PFParticle >> &PFParticleList, const art::FindManyP< recob::SpacePoint > &PFParticleSPs)
Data related to recob::Hit associated with recob::Track.The purpose is to collect several variables t...
Definition: TrackHitMeta.h:43
process_name hit
Definition: cheaterreco.fcl:51
void FillTrackTruth(const detinfo::DetectorClocksData &clock_data, const std::vector< art::Ptr< recob::Hit >> &trkHits, const std::vector< art::Ptr< simb::MCParticle >> &mcparticles, const std::vector< geo::BoxBoundedGeo > &active_volumes, const std::vector< std::vector< geo::BoxBoundedGeo >> &tpc_volumes, const std::map< int, std::vector< std::pair< geo::WireID, const sim::IDE * >>> id_to_ide_map, const std::map< int, std::vector< art::Ptr< recob::Hit >>> id_to_truehit_map, const detinfo::DetectorPropertiesData &dprop, const geo::GeometryCore *geo)
process_name can override from command line with o or output calo
Definition: pid.fcl:40
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
Access the description of detector geometry.
TrackHitInfo MakeHit(const recob::Hit &hit, unsigned hkey, const recob::TrackHitMeta &thm, const recob::Track &trk, const art::Ptr< recob::SpacePoint > &sp, const std::vector< art::Ptr< anab::Calorimetry >> &calo, const geo::GeometryCore *geo, const detinfo::DetectorClocksData &dclock, const cheat::BackTrackerService *bt_serv)
bool operator<(const Snippet &rhs) const
TrackCaloSkimmer(fhicl::ParameterSet const &p)
void FillTrack(const recob::Track &track, const recob::PFParticle &pfp, float t0, const std::vector< art::Ptr< recob::Hit >> &hits, const std::vector< const recob::TrackHitMeta * > &thms, const std::vector< art::Ptr< recob::SpacePoint >> &sps, const std::vector< art::Ptr< anab::Calorimetry >> &calo, const std::map< geo::WireID, art::Ptr< raw::RawDigit >> &rawdigits, const std::vector< GlobalTrackInfo > &tracks, const geo::GeometryCore *geo, const detinfo::DetectorClocksData &clock_data, const cheat::BackTrackerService *bt_serv, const sbn::EDet det)
void respondToOpenInputFile(const art::FileBlock &fb) override
std::string fSimChannelproducer
art::InputTag fPFPproducer
art::InputTag fTRKproducer
j template void())
Definition: json.hpp:3108
Description of geometry of one entire detector.
Declaration of cluster object.
Provides recob::Track data product.
Hierarchical representation of particle flow.
Definition: PFParticle.h:44
Contains all timing reference information for the detector.
do i e
art::InputTag fCALOproducer
art::InputTag fTRKHMproducer
Declaration of basic channel signal object.
std::vector< art::InputTag > fT0producers
TrackCaloSkimmer & operator=(TrackCaloSkimmer const &)=delete
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:48
bool operator==(const Snippet &rhs) const
std::vector< std::unique_ptr< sbn::ITCSSelectionTool > > fSelectionTools
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Definition: geo_vectors.h:184
art framework interface to geometry description
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a &quot;fitted&quot; track: