All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
TrackHitAna::TrackHitAna Class Reference
Inheritance diagram for TrackHitAna::TrackHitAna:

Public Member Functions

 TrackHitAna (fhicl::ParameterSet const &pset)
 
virtual ~TrackHitAna ()
 
void beginJob ()
 
void endJob ()
 
void beginRun (const art::Run &run)
 
void reconfigure (fhicl::ParameterSet const &pset)
 
void analyze (const art::Event &evt)
 

Private Member Functions

int traversePFParticleHierarchy (art::Handle< std::vector< recob::PFParticle >> &, size_t, const art::FindManyP< recob::Track > &, const art::FindManyP< recob::Vertex > &, int &, int &) const
 
double length (const recob::Track *track)
 
double projectedLength (const recob::Track *track)
 

Private Attributes

std::vector< art::InputTag > fHitProducerLabelVec
 
std::vector< art::InputTag > fWireProducerLabelVec
 
std::vector< art::InputTag > fPFParticleProducerLabelVec
 
std::vector< art::InputTag > fTrackProducerLabelVec
 
int fEvent
 
int fRun
 
int fSubRun
 
int fNumEvents
 
std::vector< std::unique_ptr
< IHitHistogramTool > > 
fHitHistogramToolVec
 
std::vector< std::vector
< double > > 
fChannelPedVec
 
const geo::GeometryCorefGeometry
 
const lariov::DetPedestalProviderfPedestalRetrievalAlg
 Keep track of an instance to the pedestal retrieval alg. More...
 

Detailed Description

Definition at line 76 of file TrackHitAna_module.cc.

Constructor & Destructor Documentation

TrackHitAna::TrackHitAna::TrackHitAna ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 147 of file TrackHitAna_module.cc.

148  : EDAnalyzer(parameterSet),
149  fPedestalRetrievalAlg(*lar::providerFrom<lariov::DetPedestalService>())
150 
151 {
152  fGeometry = lar::providerFrom<geo::Geometry>();
153 
154  // Read in the parameters from the .fcl file.
155  this->reconfigure(parameterSet);
156 }
void reconfigure(fhicl::ParameterSet const &pset)
const geo::GeometryCore * fGeometry
const lariov::DetPedestalProvider & fPedestalRetrievalAlg
Keep track of an instance to the pedestal retrieval alg.
TrackHitAna::TrackHitAna::~TrackHitAna ( )
virtual

Definition at line 160 of file TrackHitAna_module.cc.

161 {}

Member Function Documentation

void TrackHitAna::TrackHitAna::analyze ( const art::Event &  evt)

Definition at line 213 of file TrackHitAna_module.cc.

214 {
215  // Start by fetching some basic event information for our n-tuple.
216  fEvent = event.id().event();
217  fRun = event.run();
218  fSubRun = event.subRun();
219 
220  fNumEvents++;
221 
222  for(const auto& hitLabel : fHitProducerLabelVec)
223  {
224  // Make a pass through all hits to make contrasting plots
225  art::Handle< std::vector<recob::Hit> > hitHandle;
226  event.getByLabel(hitLabel, hitHandle);
227 
228  if (hitHandle.isValid())
229  {
231  art::fill_ptr_vector(allHitVec, hitHandle);
232 
233  for(auto& hitHistTool : fHitHistogramToolVec) hitHistTool->fillHistograms(allHitVec);
234  }
235  }
236 
237  return;
238 }
std::vector< std::unique_ptr< IHitHistogramTool > > fHitHistogramToolVec
std::vector< art::InputTag > fHitProducerLabelVec
std::vector< art::Ptr< recob::Hit >> HitPtrVec
Interface for filling histograms.
void TrackHitAna::TrackHitAna::beginJob ( )

Definition at line 164 of file TrackHitAna_module.cc.

165 {
166  // Get the detector length, to determine the maximum bin edge of one
167  // of the histograms.
168  //double detectorLength = fGeometry->DetLength();
169 
170  // Access ART's TFileService, which will handle creating and writing
171  // histograms and n-tuples for us.
172  art::ServiceHandle<art::TFileService> tfs;
173 
174  // The arguments to 'make<whatever>' are the same as those passed
175  // to the 'whatever' constructor, provided 'whatever' is a ROOT
176  // class that TFileService recognizes.
177  for (auto& hitHistTool : fHitHistogramToolVec) hitHistTool->initializeHists(tfs, "AllHits");
178 
179  // zero out the event counter
180  fNumEvents = 0;
181 }
std::vector< std::unique_ptr< IHitHistogramTool > > fHitHistogramToolVec
art::ServiceHandle< art::TFileService > tfs
void TrackHitAna::TrackHitAna::beginRun ( const art::Run &  run)

Definition at line 184 of file TrackHitAna_module.cc.

185 {
186  // How to convert from number of electrons to GeV. The ultimate
187  // source of this conversion factor is
188  // ${LARSIM_DIR}/include/SimpleTypesAndConstants/PhysicalConstants.h.
189 // art::ServiceHandle<sim::LArG4Parameters> larParameters;
190 // fElectronsToGeV = 1./larParameters->GeVToElectrons();
191 }
void TrackHitAna::TrackHitAna::endJob ( )

Definition at line 240 of file TrackHitAna_module.cc.

241 {
242  // Make a call to normalize histograms if so desired
243  for(auto& hitHistTool : fHitHistogramToolVec) hitHistTool->endJob(fNumEvents);
244 
245  return;
246 }
std::vector< std::unique_ptr< IHitHistogramTool > > fHitHistogramToolVec
double TrackHitAna::TrackHitAna::length ( const recob::Track track)
private

Definition at line 250 of file TrackHitAna_module.cc.

251 {
252  double result(0.);
253 /*
254  TVector3 disp(track->LocationAtPoint(0));
255  TVector3 lastPoint(track->LocationAtPoint(0));
256  TVector3 lastDir(0.,0.,0.);
257  int n(track->NumberTrajectoryPoints());
258 
259  for(int i = 1; i < n; ++i)
260  {
261  const TVector3& pos = track->LocationAtPoint(i);
262 
263  TVector3 trajDir = pos - lastPoint;
264 
265  if (trajDir.Mag2()) trajDir.SetMag(1.);
266 
267 // if (lastDir.Dot(trajDir) >= 0.)
268 // {
269  disp -= pos;
270  result += disp.Mag();
271  disp = pos;
272 // }
273 
274  lastPoint = pos;
275  lastDir = trajDir;
276  }
277 */
278  return result;
279 }
double TrackHitAna::TrackHitAna::projectedLength ( const recob::Track track)
private

Definition at line 283 of file TrackHitAna_module.cc.

284 {
285  double result(0.);
286 /*
287  TVector3 lastPoint(track->LocationAtPoint(0));
288  TVector3 lastDir(track->DirectionAtPoint(0));
289  int n(track->NumberTrajectoryPoints());
290 
291  for(int i = 1; i < n; ++i)
292  {
293  const TVector3& newPoint = track->LocationAtPoint(i);
294 
295  TVector3 lastToNewPoint = newPoint - lastPoint;
296  double arcLenToDoca = lastDir.Dot(lastToNewPoint);
297 
298  result += arcLenToDoca;
299  lastPoint = lastPoint + arcLenToDoca * lastDir;
300  lastDir = track->DirectionAtPoint(i);
301  }
302 */
303  return result;
304 }
void TrackHitAna::TrackHitAna::reconfigure ( fhicl::ParameterSet const &  pset)

Definition at line 194 of file TrackHitAna_module.cc.

195 {
196  // Read parameters from the .fcl file. The names in the arguments
197  // to p.get<TYPE> must match names in the .fcl file.
198  fHitProducerLabelVec = p.get< std::vector<art::InputTag> >("HitModuleLabel", std::vector<art::InputTag>() = {"gauss"});
199  fPFParticleProducerLabelVec = p.get< std::vector<art::InputTag> >("PFParticleProducerLabel", std::vector<art::InputTag>() = {"cluster3d"});
200  fTrackProducerLabelVec = p.get< std::vector<art::InputTag> >("TrackProducerLabel", std::vector<art::InputTag>() = {"trackkalmanhit"});
201  fWireProducerLabelVec = p.get< std::vector<art::InputTag> >("WireProducerLabel", std::vector<art::InputTag>() = {"caldata"});
202 
203  // Implement the tools for handling the responses
204  const std::vector<fhicl::ParameterSet>& hitHistogramToolVec = p.get<std::vector<fhicl::ParameterSet>>("HitHistogramToolList");
205 
206  for(auto& hitHistogramTool : hitHistogramToolVec)
207  fHitHistogramToolVec.push_back(art::make_tool<IHitHistogramTool>(hitHistogramTool));
208 
209  return;
210 }
std::vector< std::unique_ptr< IHitHistogramTool > > fHitHistogramToolVec
std::vector< art::InputTag > fPFParticleProducerLabelVec
std::vector< art::InputTag > fHitProducerLabelVec
pdgs p
Definition: selectors.fcl:22
std::vector< art::InputTag > fTrackProducerLabelVec
std::vector< art::InputTag > fWireProducerLabelVec
int TrackHitAna::TrackHitAna::traversePFParticleHierarchy ( art::Handle< std::vector< recob::PFParticle >> &  pfParticleHandle,
size_t  pfParticleIdx,
const art::FindManyP< recob::Track > &  trackAssns,
const art::FindManyP< recob::Vertex > &  vertexAssns,
int &  nTracks,
int &  nVertices 
) const
private

Definition at line 306 of file TrackHitAna_module.cc.

312 {
313  // So far no daughters...
314  int nDaughters(0);
315 /*
316  // Get pointer to PFParticle
317  art::Ptr<recob::PFParticle> pfParticle(pfParticleHandle,pfParticleIdx);
318 
319  // Recover tracks/vertices associated to this PFParticle
320  std::vector<art::Ptr<recob::Track>> pfPartTrackVec = trackAssns.at(pfParticle.key());
321  std::vector<art::Ptr<recob::Vertex>> pfPartVertexVec = vertexAssns.at(pfParticle.key());
322 
323  nTracks += pfPartTrackVec.size();
324  nVertices += pfPartVertexVec.size();
325  nDaughters += pfParticle->Daughters().size();
326 
327  for(auto& daughterIdx : pfParticle->Daughters())
328  {
329  nDaughters += traversePFParticleHierarchy(pfParticleHandle, daughterIdx, trackAssns, vertexAssns, nTracks, nVertices);
330  }
331 */
332  return nDaughters;
333 }

Member Data Documentation

std::vector<std::vector<double> > TrackHitAna::TrackHitAna::fChannelPedVec
private

Definition at line 133 of file TrackHitAna_module.cc.

int TrackHitAna::TrackHitAna::fEvent
private

Definition at line 125 of file TrackHitAna_module.cc.

const geo::GeometryCore* TrackHitAna::TrackHitAna::fGeometry
private

Definition at line 136 of file TrackHitAna_module.cc.

std::vector<std::unique_ptr<IHitHistogramTool> > TrackHitAna::TrackHitAna::fHitHistogramToolVec
private

Definition at line 131 of file TrackHitAna_module.cc.

std::vector<art::InputTag> TrackHitAna::TrackHitAna::fHitProducerLabelVec
private

Definition at line 119 of file TrackHitAna_module.cc.

int TrackHitAna::TrackHitAna::fNumEvents
private

Definition at line 128 of file TrackHitAna_module.cc.

const lariov::DetPedestalProvider& TrackHitAna::TrackHitAna::fPedestalRetrievalAlg
private

Keep track of an instance to the pedestal retrieval alg.

Definition at line 137 of file TrackHitAna_module.cc.

std::vector<art::InputTag> TrackHitAna::TrackHitAna::fPFParticleProducerLabelVec
private

Definition at line 121 of file TrackHitAna_module.cc.

int TrackHitAna::TrackHitAna::fRun
private

Definition at line 126 of file TrackHitAna_module.cc.

int TrackHitAna::TrackHitAna::fSubRun
private

Definition at line 127 of file TrackHitAna_module.cc.

std::vector<art::InputTag> TrackHitAna::TrackHitAna::fTrackProducerLabelVec
private

Definition at line 122 of file TrackHitAna_module.cc.

std::vector<art::InputTag> TrackHitAna::TrackHitAna::fWireProducerLabelVec
private

Definition at line 120 of file TrackHitAna_module.cc.


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