Public Member Functions | Private Attributes | List of all members
lar_pandora::PFParticleTrackAna Class Reference

PFParticleTrackAna class. More...

Inheritance diagram for lar_pandora::PFParticleTrackAna:
art::EDAnalyzer art::detail::Analyzer art::detail::LegacyModule art::Observer art::ModuleBase

Public Member Functions

 PFParticleTrackAna (fhicl::ParameterSet const &pset)
 Constructor. More...
 
virtual ~PFParticleTrackAna ()
 Destructor. More...
 
void beginJob ()
 
void endJob ()
 
void analyze (const art::Event &evt)
 
void reconfigure (fhicl::ParameterSet const &pset)
 
- Public Member Functions inherited from art::EDAnalyzer
 EDAnalyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDAnalyzer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Analyzer
virtual ~Analyzer () noexcept
 
 Analyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 Analyzer (Table< Config > const &config)
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Observer
 ~Observer () noexcept
 
 Observer (Observer const &)=delete
 
 Observer (Observer &&)=delete
 
Observeroperator= (Observer const &)=delete
 
Observeroperator= (Observer &&)=delete
 
void registerProducts (ProductDescriptions &, ModuleDescription const &)
 
void fillDescriptions (ModuleDescription const &)
 
fhicl::ParameterSetID selectorConfig () const
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Attributes

TTree * m_pCaloTree
 
int m_run
 
int m_event
 
int m_index
 
int m_ntracks
 
int m_trkid
 
int m_plane
 
double m_length
 
double m_dEdx
 
double m_dNdx
 
double m_dQdx
 
double m_residualRange
 
double m_x
 
double m_y
 
double m_z
 
double m_px
 
double m_py
 
double m_pz
 
bool m_useModBox
 
bool m_isCheated
 
std::string m_trackModuleLabel
 

Additional Inherited Members

- Public Types inherited from art::EDAnalyzer
using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 
- Protected Member Functions inherited from art::Observer
std::string const & processName () const
 
bool wantAllEvents () const noexcept
 
bool wantEvent (ScheduleID id, Event const &e) const
 
Handle< TriggerResultsgetTriggerResults (Event const &e) const
 
 Observer (fhicl::ParameterSet const &config)
 
 Observer (std::vector< std::string > const &select_paths, std::vector< std::string > const &reject_paths, fhicl::ParameterSet const &config)
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Detailed Description

PFParticleTrackAna class.

Definition at line 21 of file PFParticleTrackAna_module.cc.

Constructor & Destructor Documentation

lar_pandora::PFParticleTrackAna::PFParticleTrackAna ( fhicl::ParameterSet const &  pset)

Constructor.

Parameters
pset

Definition at line 97 of file PFParticleTrackAna_module.cc.

97  : art::EDAnalyzer(pset)
98  {
99  this->reconfigure(pset);
100  }
void reconfigure(fhicl::ParameterSet const &pset)
lar_pandora::PFParticleTrackAna::~PFParticleTrackAna ( )
virtual

Destructor.

Definition at line 104 of file PFParticleTrackAna_module.cc.

104 {}

Member Function Documentation

void lar_pandora::PFParticleTrackAna::analyze ( const art::Event evt)

Definition at line 153 of file PFParticleTrackAna_module.cc.

154  {
155  std::cout << " *** PFParticleTrackAna::analyze(...) *** " << std::endl;
156 
157  m_run = evt.run();
158  m_event = evt.id().event();
159  m_index = 0;
160 
161  m_ntracks = 0;
162  m_trkid = 0;
163  m_plane = 0;
164  m_length = 0.0;
165  m_dEdx = 0.0;
166  m_dNdx = 0.0;
167  m_dQdx = 0.0;
168  m_residualRange = 0.0;
169 
170  m_x = 0.0;
171  m_y = 0.0;
172  m_z = 0.0;
173  m_px = 0.0;
174  m_py = 0.0;
175  m_pz = 0.0;
176 
177  std::cout << " Run: " << m_run << std::endl;
178  std::cout << " Event: " << m_event << std::endl;
179 
180  TrackVector trackVector;
181  TracksToHits tracksToHits;
182  LArPandoraHelper::CollectTracks(evt, m_trackModuleLabel, trackVector, tracksToHits);
183 
184  std::cout << " Tracks: " << trackVector.size() << std::endl;
185 
186  // art::ServiceHandle<geo::Geometry const> theGeometry;
187  // auto const* theDetector = lar::providerFrom<detinfo::DetectorPropertiesService>();
188 
189  ///// microboone_calorimetryalgmc.CalAreaConstants: [ 5.0142e-3, 5.1605e-3, 5.4354e-3 ]
190  ///// lbne35t_calorimetryalgmc.CalAreaConstants: [ 5.1822e-3, 5.2682e-3, 5.3962e-3 ]
191 
192  // const double adc2eU(5.1e-3);
193  // const double adc2eV(5.2e-3);
194  // const double adc2eW(5.4e-3);
195  // const double adc2eCheat(theDetector->ElectronsToADC());
196 
197  // const double tau(theDetector->ElectronLifetime());
198 
199  m_ntracks = trackVector.size();
200 
201  for (TrackVector::const_iterator iter = trackVector.begin(), iterEnd = trackVector.end();
202  iter != iterEnd;
203  ++iter) {
204  const art::Ptr<recob::Track> track = *iter;
205 
206  m_trkid = track->ID();
207  m_length = track->Length();
208 
209  m_plane = 0;
210  m_dEdx = 0.0;
211  m_dNdx = 0.0;
212  m_dQdx = 0.0;
213  m_residualRange = 0.0;
214 
215  m_x = 0.0;
216  m_y = 0.0;
217  m_z = 0.0;
218  m_px = 0.0;
219  m_py = 0.0;
220  m_pz = 0.0;
221 
222  for (unsigned int p = 0; p < track->NumberTrajectoryPoints(); ++p) {
223  auto pos = track->LocationAtPoint(p);
224  auto dir = track->DirectionAtPoint(p);
225 
226  m_residualRange = track->Length(p);
227 
228  m_x = pos.x();
229  m_y = pos.y();
230  m_z = pos.z();
231  m_px = dir.x();
232  m_py = dir.y();
233  m_pz = dir.z();
234 
235  /*************************************************************/
236  /* WARNING */
237  /*************************************************************/
238  /* The dQdx information in recob::Track has been deprecated */
239  /* since 2016 and in 11/2018 the recob::Track interface was */
240  /* changed and DQdxAtPoint and NumberdQdx were removed. */
241  /* Therefore the code below is now commented out */
242  /* (note that it was most likely not functional anyways). */
243  /* For any issue please contact: larsoft-team@fnal.gov */
244  /*************************************************************/
245  /*
246  const double dQdxU(track->DQdxAtPoint(p, geo::kU)); // plane 0
247  const double dQdxV(track->DQdxAtPoint(p, geo::kV)); // plane 1
248  const double dQdxW(track->DQdxAtPoint(p, geo::kW)); // plane 2
249 
250  m_plane = ((dQdxU > 0.0) ? geo::kU : (dQdxV > 0.0) ? geo::kV : geo::kW);
251 
252  const double adc2e(m_isCheated ? adc2eCheat : (geo::kU == m_plane) ? adc2eU : (geo::kV == m_plane) ? adc2eV : adc2eW);
253 
254  m_dQdx = ((geo::kU == m_plane) ? dQdxU : (geo::kV == m_plane) ? dQdxV : dQdxW);
255 
256  // TODO: Need to include T0 information (currently assume T0 = 0)
257 
258  m_dNdx = ((m_dQdx / adc2e) * exp((m_x / theDetector->GetXTicksCoefficient()) * theDetector->SamplingRate() * 1.e-3 / tau));
259 
260  m_dEdx = (m_useModBox ? theDetector->ModBoxCorrection(m_dNdx) : theDetector->BirksCorrection(m_dNdx));
261  */
262  /*************************************************************/
263 
264  m_pCaloTree->Fill();
265  ++m_index;
266  }
267  }
268  }
Point_t const & LocationAtPoint(size_t i) const
Definition: Track.h:126
size_t NumberTrajectoryPoints() const
Various functions related to the presence and the number of (valid) points.
Definition: Track.h:102
intermediate_table::const_iterator const_iterator
string dir
double Length(size_t p=0) const
Access to various track properties.
Definition: Track.h:167
p
Definition: test.py:223
std::vector< art::Ptr< recob::Track > > TrackVector
RunNumber_t run() const
Definition: DataViewImpl.cc:71
std::map< art::Ptr< recob::Track >, HitVector > TracksToHits
static void CollectTracks(const art::Event &evt, const std::string &label, TrackVector &trackVector, PFParticlesToTracks &particlesToTracks)
Collect the reconstructed PFParticles and associated Tracks from the ART event record.
int ID() const
Definition: Track.h:198
EventNumber_t event() const
Definition: EventID.h:116
Vector_t DirectionAtPoint(size_t i) const
Definition: Track.h:134
EventID id() const
Definition: Event.cc:34
QTextStream & endl(QTextStream &s)
void lar_pandora::PFParticleTrackAna::beginJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 119 of file PFParticleTrackAna_module.cc.

120  {
121  //
123 
124  m_pCaloTree = tfs->make<TTree>("calorimetry", "LAr Track Calo Tree");
125  m_pCaloTree->Branch("run", &m_run, "run/I");
126  m_pCaloTree->Branch("event", &m_event, "event/I");
127  m_pCaloTree->Branch("index", &m_index, "index/I");
128  m_pCaloTree->Branch("ntracks", &m_ntracks, "ntracks/I");
129  m_pCaloTree->Branch("trkid", &m_trkid, "trkid/I");
130  m_pCaloTree->Branch("plane", &m_plane, "plane/I");
131  m_pCaloTree->Branch("length", &m_length, "length/D");
132  m_pCaloTree->Branch("dEdx", &m_dEdx, "dEdx/D");
133  m_pCaloTree->Branch("dNdx", &m_dNdx, "dNdx/D");
134  m_pCaloTree->Branch("dQdx", &m_dQdx, "dQdx/D");
135  m_pCaloTree->Branch("residualRange", &m_residualRange, "residualRange/D");
136  m_pCaloTree->Branch("x", &m_x, "x/D");
137  m_pCaloTree->Branch("y", &m_y, "y/D");
138  m_pCaloTree->Branch("z", &m_z, "z/D");
139  m_pCaloTree->Branch("px", &m_px, "px/D");
140  m_pCaloTree->Branch("py", &m_py, "py/D");
141  m_pCaloTree->Branch("pz", &m_pz, "pz/D");
142  }
void lar_pandora::PFParticleTrackAna::endJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 147 of file PFParticleTrackAna_module.cc.

148  {}
void lar_pandora::PFParticleTrackAna::reconfigure ( fhicl::ParameterSet const &  pset)

Definition at line 109 of file PFParticleTrackAna_module.cc.

110  {
111  m_useModBox = pset.get<bool>("UeModBox", true);
112  m_isCheated = pset.get<bool>("IsCheated", false);
113  m_trackModuleLabel = pset.get<std::string>("TrackModule", "pandora");
114  }
std::string string
Definition: nybbler.cc:12

Member Data Documentation

double lar_pandora::PFParticleTrackAna::m_dEdx
private

Definition at line 51 of file PFParticleTrackAna_module.cc.

double lar_pandora::PFParticleTrackAna::m_dNdx
private

Definition at line 52 of file PFParticleTrackAna_module.cc.

double lar_pandora::PFParticleTrackAna::m_dQdx
private

Definition at line 53 of file PFParticleTrackAna_module.cc.

int lar_pandora::PFParticleTrackAna::m_event
private

Definition at line 44 of file PFParticleTrackAna_module.cc.

int lar_pandora::PFParticleTrackAna::m_index
private

Definition at line 45 of file PFParticleTrackAna_module.cc.

bool lar_pandora::PFParticleTrackAna::m_isCheated
private

Definition at line 64 of file PFParticleTrackAna_module.cc.

double lar_pandora::PFParticleTrackAna::m_length
private

Definition at line 50 of file PFParticleTrackAna_module.cc.

int lar_pandora::PFParticleTrackAna::m_ntracks
private

Definition at line 46 of file PFParticleTrackAna_module.cc.

TTree* lar_pandora::PFParticleTrackAna::m_pCaloTree
private

Definition at line 41 of file PFParticleTrackAna_module.cc.

int lar_pandora::PFParticleTrackAna::m_plane
private

Definition at line 48 of file PFParticleTrackAna_module.cc.

double lar_pandora::PFParticleTrackAna::m_px
private

Definition at line 59 of file PFParticleTrackAna_module.cc.

double lar_pandora::PFParticleTrackAna::m_py
private

Definition at line 60 of file PFParticleTrackAna_module.cc.

double lar_pandora::PFParticleTrackAna::m_pz
private

Definition at line 61 of file PFParticleTrackAna_module.cc.

double lar_pandora::PFParticleTrackAna::m_residualRange
private

Definition at line 54 of file PFParticleTrackAna_module.cc.

int lar_pandora::PFParticleTrackAna::m_run
private

Definition at line 43 of file PFParticleTrackAna_module.cc.

std::string lar_pandora::PFParticleTrackAna::m_trackModuleLabel
private

Definition at line 66 of file PFParticleTrackAna_module.cc.

int lar_pandora::PFParticleTrackAna::m_trkid
private

Definition at line 47 of file PFParticleTrackAna_module.cc.

bool lar_pandora::PFParticleTrackAna::m_useModBox
private

Definition at line 63 of file PFParticleTrackAna_module.cc.

double lar_pandora::PFParticleTrackAna::m_x
private

Definition at line 56 of file PFParticleTrackAna_module.cc.

double lar_pandora::PFParticleTrackAna::m_y
private

Definition at line 57 of file PFParticleTrackAna_module.cc.

double lar_pandora::PFParticleTrackAna::m_z
private

Definition at line 58 of file PFParticleTrackAna_module.cc.


The documentation for this class was generated from the following file: