Public Member Functions | Private Attributes | List of all members
pddpana::TrackHitInfo Class Reference
Inheritance diagram for pddpana::TrackHitInfo:
art::EDAnalyzer art::detail::Analyzer art::detail::LegacyModule art::Observer art::ModuleBase

Public Member Functions

 TrackHitInfo (fhicl::ParameterSet const &p)
 
 TrackHitInfo (TrackHitInfo const &)=delete
 
 TrackHitInfo (TrackHitInfo &&)=delete
 
TrackHitInfooperator= (TrackHitInfo const &)=delete
 
TrackHitInfooperator= (TrackHitInfo &&)=delete
 
void analyze (art::Event const &e) override
 
void beginJob () override
 
void endJob () override
 
- 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

int fLogLevel
 
string fTrackModuleLabel
 
unsigned fTracksTotal
 
unsigned fTracksRejected
 
protoana::ProtoDUNETrackUtils trackUtil
 
const geo::GeometryfGeom
 

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

Definition at line 54 of file TrackHitInfo_module.cc.

Constructor & Destructor Documentation

pddpana::TrackHitInfo::TrackHitInfo ( fhicl::ParameterSet const &  p)
explicit

Definition at line 90 of file TrackHitInfo_module.cc.

91  : EDAnalyzer{p} ,
92  fLogLevel( p.get< int >("LogLevel") ),
93  fTrackModuleLabel( p.get< std::string >("TrackModuleLabel") )
94  {
96  //fDetprop = lar::providerFrom<detinfo::DetectorPropertiesService>();
97 
98  }
std::string string
Definition: nybbler.cc:12
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
p
Definition: test.py:223
const geo::Geometry * fGeom
pddpana::TrackHitInfo::TrackHitInfo ( TrackHitInfo const &  )
delete
pddpana::TrackHitInfo::TrackHitInfo ( TrackHitInfo &&  )
delete

Member Function Documentation

void pddpana::TrackHitInfo::analyze ( art::Event const &  e)
overridevirtual

Implements art::EDAnalyzer.

Definition at line 101 of file TrackHitInfo_module.cc.

102 {
103  const string myname = "pddpana::TrackHitInfo::analyze: ";
104 
105  // get hits ValidHandle< std::vector<recob::Hits> >
106  auto Tracks = e.getValidHandle<vector<recob::Track>>(fTrackModuleLabel);
107 
108  if( fLogLevel >= 2 ){
109  cout<<myname<<"The event contains "<< Tracks->size() <<" tracks\n";
110  }
111 
112  unsigned EventId = e.id().event();
113 
114  fTracksTotal += Tracks->size();
115 
116  // loop over tracks
117  for (unsigned itrk = 0; itrk < Tracks->size(); ++itrk) {
118  const recob::Track& track = Tracks->at(itrk);
119  unsigned TrackId = itrk;
120  unsigned TrajPnts = track.NumberTrajectoryPoints();
121  float TrackLen = track.Length();
122 
123  if( fLogLevel >= 3 ){
124  cout<<myname<<"Track ID "<<TrackId<<" has "
125  <<TrajPnts<<" points and is "<<TrackLen<<" cm long"
126  << "\n start at: ( " << track.Vertex().X()
127  << " ; " << track.Vertex().Y()
128  << " ; " << track.Vertex().Z()
129  << "\n end at: ( " << track.End().X()
130  << " ; " << track.End().Y()
131  << " ; " << track.End().Z()<<" )"<<endl;
132  }
133 
134  vector<unsigned> hitsTpcId( fGeom->Nplanes() );
135 
136  // loop over the planes
137  for(size_t i_plane = 0; i_plane<fGeom->Nplanes(); i_plane++) {
138 
139  // get hits in this plane
140  auto hits = trackUtil.GetRecoTrackHitsFromPlane( track, e, fTrackModuleLabel, i_plane );
141  if( fLogLevel >= 3 ){
142  cout<<myname<<"Hits in plane "<<i_plane<<" "<<hits.size()<<endl;
143  }
144 
145  vector<unsigned> plane_hits_tpcid( hits.size() );
146  // loop over hits
147  for(size_t i_hit = 0; i_hit<hits.size(); i_hit++ ){
148  plane_hits_tpcid[i_hit] = hits[i_hit]->WireID().TPC;
149  }
150 
151  int this_tpcid = -1;
152  auto start = plane_hits_tpcid.begin();
153  auto end = plane_hits_tpcid.end();
154  if( std::equal(start + 1, end, start)) {
155  this_tpcid = (int)(*start);
156  } //
157  else {
158  if( fLogLevel>= 2){
159  cout<<myname<<"hits for the same plane have mixed TPC IDs. Skipping...\n";
160  }
161  }
162  if( this_tpcid < 0 ){
163  hitsTpcId.clear();
164  break;
165  }
166  else{
167  hitsTpcId[i_plane] = (unsigned)this_tpcid;
168  }
169  }// end plane loop
170 
171  if( hitsTpcId.empty() ) continue;
172 
173  auto start = hitsTpcId.begin();
174  auto end = hitsTpcId.end();
175  if( !std::equal(start + 1, end, start)) {
176  if( fLogLevel >= 2 ){
177  cout<<myname<<"mismatch in TPC ID for the initial hits: ";
178  cout<<" event ID "<<EventId<<"; hit TPC IDs ";
179  for( auto const &v: hitsTpcId ){ cout<<v<<" ";}
180  cout<<endl;
181  }
182  fTracksRejected++;
183  } //
184 
185  }// end track loop
186 
187  //
188 
189 } // end analyze()
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
size_t NumberTrajectoryPoints() const
Various functions related to the presence and the number of (valid) points.
Definition: Track.h:102
unsigned int Nplanes(unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wire planes in the specified TPC.
const double e
double Length(size_t p=0) const
Access to various track properties.
Definition: Track.h:167
Point_t const & Vertex() const
Definition: Track.h:124
const std::vector< const recob::Hit * > GetRecoTrackHitsFromPlane(const recob::Track &track, art::Event const &evt, const std::string trackModule, unsigned int planeID) const
Get the hits from a given reco track from a specific plane.
protoana::ProtoDUNETrackUtils trackUtil
Point_t const & End() const
Definition: Track.h:125
const geo::Geometry * fGeom
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
Definition: Track.h:49
QTextStream & endl(QTextStream &s)
void pddpana::TrackHitInfo::beginJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 193 of file TrackHitInfo_module.cc.

194 {
195  fTracksTotal = 0;
196  fTracksRejected = 0;
197 }
void pddpana::TrackHitInfo::endJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 201 of file TrackHitInfo_module.cc.

202 {
203  cout<<"Tracks total : "<<fTracksTotal<<endl;
204  cout<<"Tracks rejected : "<<fTracksRejected<<endl;
205 }
QTextStream & endl(QTextStream &s)
TrackHitInfo& pddpana::TrackHitInfo::operator= ( TrackHitInfo const &  )
delete
TrackHitInfo& pddpana::TrackHitInfo::operator= ( TrackHitInfo &&  )
delete

Member Data Documentation

const geo::Geometry* pddpana::TrackHitInfo::fGeom
private

Definition at line 84 of file TrackHitInfo_module.cc.

int pddpana::TrackHitInfo::fLogLevel
private

Definition at line 75 of file TrackHitInfo_module.cc.

string pddpana::TrackHitInfo::fTrackModuleLabel
private

Definition at line 76 of file TrackHitInfo_module.cc.

unsigned pddpana::TrackHitInfo::fTracksRejected
private

Definition at line 78 of file TrackHitInfo_module.cc.

unsigned pddpana::TrackHitInfo::fTracksTotal
private

Definition at line 77 of file TrackHitInfo_module.cc.

protoana::ProtoDUNETrackUtils pddpana::TrackHitInfo::trackUtil
private

Definition at line 81 of file TrackHitInfo_module.cc.


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