Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
novaddt::HorizontalMuonAna Class Reference
Inheritance diagram for novaddt::HorizontalMuonAna:
art::EDAnalyzer art::EDAnalyzer art::EventObserverBase art::Consumer art::EngineCreator art::EventObserverBase art::Consumer art::EngineCreator

Public Types

using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 

Public Member Functions

 HorizontalMuonAna (fhicl::ParameterSet const &p)
 
 HorizontalMuonAna (HorizontalMuonAna const &)=delete
 
 HorizontalMuonAna (HorizontalMuonAna &&)=delete
 
HorizontalMuonAnaoperator= (HorizontalMuonAna const &)=delete
 
HorizontalMuonAnaoperator= (HorizontalMuonAna &&)=delete
 
void analyze (art::Event const &e) override
 
void beginJob () override
 
virtual void endJob () override
 
 HorizontalMuonAna (fhicl::ParameterSet const &p)
 
 HorizontalMuonAna (HorizontalMuonAna const &)=delete
 
 HorizontalMuonAna (HorizontalMuonAna &&)=delete
 
HorizontalMuonAnaoperator= (HorizontalMuonAna const &)=delete
 
HorizontalMuonAnaoperator= (HorizontalMuonAna &&)=delete
 
void analyze (art::Event const &e) override
 
void beginJob () override
 
virtual void endJob () override
 
std::string workerType () const
 
bool modifiesEvent () const
 
void registerProducts (MasterProductRegistry &, ProductDescriptions &, ModuleDescription const &)
 
std::string const & processName () const
 
bool wantAllEvents () const
 
bool wantEvent (Event const &e)
 
fhicl::ParameterSetID selectorConfig () const
 
art::Handle< art::TriggerResultsgetTriggerResults (Event const &e) const
 
template<typename T , BranchType = InEvent>
ProductToken< Tconsumes (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< Tconsumes (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< TconsumesView (InputTag const &it)
 
template<typename T , BranchType = InEvent>
ProductToken< TmayConsume (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< TmayConsume (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< TmayConsumeView (InputTag const &it)
 
base_engine_tcreateEngine (seed_t seed)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make, label_t const &engine_label)
 
seed_t get_seed_value (fhicl::ParameterSet const &pset, char const key[]="seed", seed_t const implicit_seed=-1)
 

Static Public Member Functions

static cet::exempt_ptr< Consumernon_module_context ()
 

Protected Member Functions

CurrentProcessingContext const * currentContext () const
 
detail::CachedProducts & cachedProducts ()
 
void validateConsumedProduct (BranchType const bt, ProductInfo const &pi)
 
void prepareForJob (fhicl::ParameterSet const &pset)
 
void showMissingConsumes () const
 

Private Member Functions

bool FrontBackPlanesHits (const std::vector< uint16_t > &missedFrontPlanes, const std::vector< uint16_t > &missedBackPlaness)
 
bool MissingPlanesInBounds (const std::vector< uint16_t > &allMissingPlanes)
 
bool TimingInBounds (const unsigned long long &minTime, const unsigned long long &maxTime)
 
bool IsHorzMuonTrack (const novaddt::HitList &track, unsigned long long &minTime, unsigned long long &maxTime)
 
bool FrontBackPlanesHits (const std::vector< unsigned short > &missedFrontPlanes, const std::vector< unsigned short > &missedBackPlaness)
 
bool MissingPlanesInBounds (const std::vector< unsigned short > &allMissingPlanes)
 
bool TimingInBounds (const float &minTime, const float &maxTime)
 
bool IsHorzMuonTrack (const rb::Track &track, float &minTime, float &maxTime)
 

Private Attributes

uint16_t fNumFrontBackPlanes
 
int16_t fMinFrontBackPlanes
 
int16_t fMaxMissing
 
double fMaxTime
 
std::string fTracksTag
 
unsigned _prescale
 
unsigned _trigger_counts = 0
 
unsigned _after_prescale = 0
 
int nEvents = 0
 
int nTracks = 0
 
int n3DTracks = 0
 
int nHorzMuons = 0
 
unsigned int fRun
 Run number. More...
 
unsigned int fSubRun
 Subrun number. More...
 
unsigned int fEvent
 Event number. More...
 
TVector3 * fStart
 Start position of track. More...
 
TVector3 * fStop
 End position of track. More...
 
double fMissingPlanes
 Number of missing planes for passing track. More...
 
unsigned long long fTimeTDC
 Time (in TNS) for track. More...
 
std::vector< uint16_t > fFrontPlanes
 Front CellPlanes hit. More...
 
std::vector< uint16_t > fBackPlanes
 
std::vector< uint16_t > fHitPlanes
 
std::vector< unsigned long long > fHitTimes
 
std::vector< uint8_t > fHitViews
 
art::ServiceHandle< art::TFileServicetfs
 
TTree * fTrackTree
 
unsigned short fNumFrontBackPlanes
 
short fMinFrontBackPlanes
 
short fMaxMissing
 
unsigned short fStoreAllHits
 
unsigned int fMissingPlanes
 Number of missing planes for passing track. More...
 
float fTimeTNS
 Time (in TNS) for track. More...
 
float fTotalGeV
 TotalGeV deposited in track. More...
 
float fTotalPE
 TotalPE deposited in track. More...
 
std::vector< unsigned short > fFrontPlanes
 Front CellPlanes hit. More...
 
std::vector< unsigned short > fBackPlanes
 
std::vector< unsigned short > fHitPlanes
 
std::vector< float > fHitTimes
 
std::vector< unsigned short > fHitViews
 
std::vector< unsigned short > fHitCells
 

Detailed Description

Definition at line 40 of file HorizontalMuonAna_module.cc.

Member Typedef Documentation

Definition at line 39 of file EDAnalyzer.h.

Definition at line 38 of file EDAnalyzer.h.

Constructor & Destructor Documentation

novaddt::HorizontalMuonAna::HorizontalMuonAna ( fhicl::ParameterSet const &  p)
explicit

Definition at line 103 of file HorizontalMuonAna_module.cc.

104  :
105  EDAnalyzer(p),
106  fNumFrontBackPlanes( p.get<uint16_t> ("numFrontBackPlanes")),
107  fMinFrontBackPlanes( p.get<int16_t> ("minFrontBackPlanes")),
108  fMaxMissing( p.get<int16_t> ("maxMissingPlanes")),
109  fMaxTime( p.get<double> ("maxTime")),
110  fTracksTag( p.get<std::string> ("tracksTag")),
111  _prescale( p.get<unsigned> ("prescale"))
112 
113  {
114  // Nothing produced into the art event.
115  }
const char * p
Definition: xmltok.h:285
EDAnalyzer(Table< Config > const &config)
Definition: EDAnalyzer.h:100
enum BeamMode string
novaddt::HorizontalMuonAna::HorizontalMuonAna ( HorizontalMuonAna const &  )
delete
novaddt::HorizontalMuonAna::HorizontalMuonAna ( HorizontalMuonAna &&  )
delete
novaddt::HorizontalMuonAna::HorizontalMuonAna ( fhicl::ParameterSet const &  p)
explicit
novaddt::HorizontalMuonAna::HorizontalMuonAna ( HorizontalMuonAna const &  )
delete
novaddt::HorizontalMuonAna::HorizontalMuonAna ( HorizontalMuonAna &&  )
delete

Member Function Documentation

void novaddt::HorizontalMuonAna::analyze ( art::Event const &  e)
overridevirtual

Implements art::EDAnalyzer.

void novaddt::HorizontalMuonAna::analyze ( art::Event const &  e)
overridevirtual

Implements art::EDAnalyzer.

Definition at line 118 of file HorizontalMuonAna_module.cc.

References _after_prescale, _trigger_counts, novaddt::Track3D::End(), allTimeWatchdog::endl, art::Event::event(), art::Handle< T >::failedToGet(), fEvent, fRun, fStart, fStop, fSubRun, fTimeTDC, fTracksTag, fTrackTree, art::DataViewImpl::getByLabel(), novaddt::Track3D::Is3D(), IsHorzMuonTrack(), n3DTracks, nEvents, nHorzMuons, nTracks, art::Event::run(), novaddt::Track3D::Start(), art::Event::subRun(), and art::Handle< T >::whyFailed().

119  {
120  nEvents++;
121 
122  // Grab all Track objects from event
124  // art::Handle<novaddt::HitList> eventHits;
125  e.getByLabel(fTracksTag, eventTracks);
126  if (eventTracks.failedToGet()){
127  mf::LogError("HorizontalMuonAna") << "Error: " << eventTracks.whyFailed()->what() << std::endl;
128  return;
129  }
130 
131  art::FindOneP<novaddt::Track3D> houghTrack(eventTracks, e, fTracksTag);
132 
133  // Loop through tracks. Only one needs to pass to accept the event.
134  for(unsigned long trackIndex = 0; trackIndex < eventTracks->size(); trackIndex++){
135  nTracks++;
136  // Look through each track
137  novaddt::HitList trackHits = eventTracks->at(trackIndex);
138  art::Ptr<novaddt::Track3D> thisTrack3d = houghTrack.at(trackIndex);
139  if (thisTrack3d->Is3D()){
140  n3DTracks++;
141 
142  // Holders for track time (passed by reference)
143  unsigned long long minTime = ULLONG_MAX -1;
144  unsigned long long maxTime = 0;
145  if (IsHorzMuonTrack(trackHits, minTime, maxTime)){
146  nHorzMuons++;
147 
148  fRun = e.run();
149  fSubRun = e.subRun();
150  fEvent = e.event();
151 
152  fStart = new TVector3(thisTrack3d->Start());
153  fStop = new TVector3(thisTrack3d->End());
154  fTimeTDC = maxTime - minTime;
155 
156  fTrackTree->Fill();
157 
158  _trigger_counts++;
159  // if(_trigger_counts%_prescale == _prescale-1){
160  _after_prescale++;
161  // }
162  }
163  }
164  }
165 
166  return;
167  }
unsigned long long fTimeTDC
Time (in TNS) for track.
TVector3 * fStop
End position of track.
std::vector< DAQHit > HitList
Definition: HitList.h:15
unsigned int fSubRun
Subrun number.
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
TVector3 const & End() const
Definition: Track3D.h:46
bool IsHorzMuonTrack(const novaddt::HitList &track, unsigned long long &minTime, unsigned long long &maxTime)
TVector3 const & Start() const
Definition: Track3D.h:45
bool const & Is3D() const
Definition: Track3D.h:43
TVector3 * fStart
Start position of track.
unsigned int fEvent
Event number.
std::shared_ptr< art::Exception const > whyFailed() const
Definition: Handle.h:219
Float_t e
Definition: plot.C:35
Definition: fwd.h:28
bool failedToGet() const
Definition: Handle.h:196
void novaddt::HorizontalMuonAna::beginJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

void novaddt::HorizontalMuonAna::beginJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 265 of file HorizontalMuonAna_module.cc.

References fBackPlanes, fEvent, fFrontPlanes, fHitPlanes, fHitTimes, fHitViews, fMissingPlanes, fRun, fStart, fStop, fSubRun, fTimeTDC, fTrackTree, art::TFileDirectory::make(), and tfs.

Referenced by IsHorzMuonTrack().

265  {
266  fTrackTree = tfs->make<TTree>("HorzMuonTracks", "Horizontal Muon Tracks");
267 
268  // Must instantiate objects before adding to TTree.
269  fStart = new TVector3;
270  fStop = new TVector3;
271 
272  // Define the branches and set the addresses of the TTree
273  fTrackTree->Branch("Run", &fRun);
274  fTrackTree->Branch("SubRun", &fSubRun);
275  fTrackTree->Branch("Event", &fEvent);
276  fTrackTree->Branch("Start", &fStart);
277  fTrackTree->Branch("Stop", &fStop);
278  fTrackTree->Branch("MissingPlanes", &fMissingPlanes);
279  fTrackTree->Branch("Time", &fTimeTDC);
280 
281  fTrackTree->Branch("FrontPlanesHit",&fFrontPlanes);
282  fTrackTree->Branch("BackPlanesHit", &fBackPlanes);
283 
284  fTrackTree->Branch("HitPlanes", &fHitPlanes);
285  fTrackTree->Branch("HitTimes", &fHitTimes);
286  fTrackTree->Branch("HitViews", &fHitViews);
287  }
unsigned long long fTimeTDC
Time (in TNS) for track.
TVector3 * fStop
End position of track.
art::ServiceHandle< art::TFileService > tfs
std::vector< uint16_t > fBackPlanes
double fMissingPlanes
Number of missing planes for passing track.
std::vector< uint16_t > fHitPlanes
std::vector< unsigned long long > fHitTimes
unsigned int fSubRun
Subrun number.
std::vector< uint16_t > fFrontPlanes
Front CellPlanes hit.
TVector3 * fStart
Start position of track.
T * make(ARGS...args) const
unsigned int fEvent
Event number.
detail::CachedProducts& art::EventObserverBase::cachedProducts ( )
inlineprotectedinherited

Definition at line 79 of file EventObserverBase.h.

References art::EventObserverBase::selectors_.

80  {
81  return selectors_;
82  }
detail::CachedProducts selectors_
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::consumes ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::consumes ( InputTag const &  it)
inherited

Definition at line 146 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

147 {
148  if (!moduleContext_)
149  return ProductToken<T>::invalid();
150 
151  consumables_[BT].emplace_back(ConsumableType::Product,
152  TypeID{typeid(T)},
153  it.label(),
154  it.instance(),
155  it.process());
156  return ProductToken<T>{it};
157 }
set< int >::iterator it
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename T , art::BranchType BT>
void art::Consumer::consumesMany ( )
inherited

Definition at line 161 of file Consumer.h.

References T.

162 {
163  if (!moduleContext_)
164  return;
165 
166  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
167 }
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::consumesView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::consumesView ( InputTag const &  it)
inherited

Definition at line 171 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

172 {
173  if (!moduleContext_)
174  return ViewToken<T>::invalid();
175 
176  consumables_[BT].emplace_back(ConsumableType::ViewElement,
177  TypeID{typeid(T)},
178  it.label(),
179  it.instance(),
180  it.process());
181  return ViewToken<T>{it};
182 }
set< int >::iterator it
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed)
inherited
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make 
)
inherited
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make,
label_t const &  engine_label 
)
inherited
CurrentProcessingContext const* art::EDAnalyzer::currentContext ( ) const
protectedinherited
virtual void novaddt::HorizontalMuonAna::endJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

void novaddt::HorizontalMuonAna::endJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 289 of file HorizontalMuonAna_module.cc.

References _after_prescale, _trigger_counts, om::cout, DEFINE_ART_MODULE(), allTimeWatchdog::endl, n3DTracks, nEvents, nHorzMuons, and nTracks.

Referenced by IsHorzMuonTrack().

289  {
290  std::cout << "=== novaddt::HorizontalMuonAna endJob" << std::endl;
291  std::cout << "\tNumber of events: " << nEvents << std::endl;
292  std::cout << "\tNumber of tracks: " << nTracks << std::endl;
293  std::cout << "\tNumber of 3D tracks: " << n3DTracks << std::endl;
294  std::cout << "\tNumber of Horizontal Muons: " << nHorzMuons << std::endl;
295  std::cout << "\tNumber of Times Triggered: " << _trigger_counts << std::endl;
296  std::cout << "\tNumber after prescale: " << _after_prescale << std::endl;
297  }
OStream cout
Definition: OStream.cxx:6
bool novaddt::HorizontalMuonAna::FrontBackPlanesHits ( const std::vector< unsigned short > &  missedFrontPlanes,
const std::vector< unsigned short > &  missedBackPlaness 
)
private
bool novaddt::HorizontalMuonAna::FrontBackPlanesHits ( const std::vector< uint16_t > &  missedFrontPlanes,
const std::vector< uint16_t > &  missedBackPlaness 
)
private

Definition at line 169 of file HorizontalMuonAna_module.cc.

References fMinFrontBackPlanes, and fNumFrontBackPlanes.

Referenced by IsHorzMuonTrack().

169  {
170  // If there is a minimum number of acceptable planes (numFound = Total - numRemaining : numFound >= minFound)
171  if (fMinFrontBackPlanes > 0)
172  return ((int16_t) (fNumFrontBackPlanes - missedFrontPlanes.size()) >= fMinFrontBackPlanes && (int16_t) (fNumFrontBackPlanes - missedBackPlanes.size()) >= fMinFrontBackPlanes);
173 
174  // If no minimum provided, they all must be found.
175  return (missedFrontPlanes.empty() && missedBackPlanes.empty());
176  }
seed_t art::EngineCreator::get_seed_value ( fhicl::ParameterSet const &  pset,
char const  key[] = "seed",
seed_t const  implicit_seed = -1 
)
inherited
art::Handle<art::TriggerResults> art::EventObserverBase::getTriggerResults ( Event const &  e) const
inlineinherited

Definition at line 61 of file EventObserverBase.h.

References art::detail::CachedProducts::getOneTriggerResults(), and art::EventObserverBase::selectors_.

62  {
64  }
detail::CachedProducts selectors_
art::Handle< art::TriggerResults > getOneTriggerResults(Event const &) const
Float_t e
Definition: plot.C:35
bool novaddt::HorizontalMuonAna::IsHorzMuonTrack ( const rb::Track track,
float &  minTime,
float &  maxTime 
)
private

Definition at line 190 of file HorizontalMuonAna_module.cc.

References rb::Cluster::AllCells(), beginJob(), rb::CellHit::Cell(), om::cout, DEFINE_ART_MODULE(), endJob(), allTimeWatchdog::endl, fBackPlanes, fEvent, fFrontPlanes, fHitCells, fHitPlanes, fHitTimes, fHitViews, fMissingPlanes, fNumFrontBackPlanes, FrontBackPlanesHits(), fRun, fStart, fStop, fStoreAllHits, fSubRun, fTimeTNS, fTotalGeV, fTotalPE, fTrackTree, MECModelEnuComparisons::i, rb::Cluster::IsNoise(), art::TFileDirectory::make(), MissingPlanesInBounds(), n3DTracks, nEvents, nHorzMuons, nTracks, rb::CellHit::Plane(), art::PtrVector< T >::push_back(), fillBadChanDBTables::result, art::PtrVector< T >::size(), tfs, TimingInBounds(), rb::CellHit::TNS(), TOTAL_FD_PLANES, rb::Track::TotalLength(), and rb::CellHit::View().

190  {
191  // Initial obvious tests, to make sure we're not doing something stupid.
192  if (track.TotalLength() < 4000 || track.IsNoise())
193  return false;
194 
195  // At this point, study the track
196  const art::PtrVector<rb::CellHit> trackCells = track.AllCells();
197  // Make list of planes which must have a hit in them.
198  // Different sets for front and back planes, in case requirements differ between them
199  std::vector<uint16_t> RequiredFrontPlanes, RequiredBackPlanes, AllPlanes;
200  for (uint16_t i = 0; i < fNumFrontBackPlanes; i++)
201  RequiredFrontPlanes.push_back(i);
202  for (uint16_t i = 0; i < fNumFrontBackPlanes; i++)
203  RequiredBackPlanes.push_back(TOTAL_FD_PLANES - i - 1);
204  for (uint16_t i = 0; i < TOTAL_FD_PLANES; i++)
205  AllPlanes.push_back(i);
206 
207  fHitPlanes.clear();
208  fHitTimes.clear();
209  fHitViews.clear();
210  fHitCells.clear();
211 
212  // Loop through hits, keeping track of Planes and timing.
213  for (unsigned int i = 0; i < trackCells.size(); i++){
214  const art::Ptr<rb::CellHit> hit = trackCells[i];
215  if (hit->TNS() > maxTime)
216  maxTime = hit->TNS();
217  if (hit->TNS() < minTime)
218  minTime = hit->TNS();
219 
220  // If the plane matches any required plane, remove it from the list to search through.
221  RequiredFrontPlanes.erase(
222  std::remove(RequiredFrontPlanes.begin(), RequiredFrontPlanes.end(), hit->Plane()),
223  RequiredFrontPlanes.end());
224 
225  RequiredBackPlanes.erase(
226  std::remove(RequiredBackPlanes.begin(), RequiredBackPlanes.end(), hit->Plane()),
227  RequiredBackPlanes.end());
228 
229  AllPlanes.erase(
230  std::remove(AllPlanes.begin(), AllPlanes.end(), hit->Plane()),
231  AllPlanes.end());
232 
233  fHitPlanes.push_back(hit->Plane());
234  fHitTimes.push_back(hit->TNS());
235  fHitViews.push_back(hit->View());
236  fHitCells.push_back(hit->Cell());
237  }
238 
239  bool result = TimingInBounds(minTime, maxTime) && MissingPlanesInBounds(AllPlanes) && FrontBackPlanesHits(RequiredFrontPlanes, RequiredBackPlanes);
240 
241  // Fill in analyzer variables if needed.
242  if (result){
243  fMissingPlanes = AllPlanes.size(); // The remianing planes are ones without hits.
244 
245  // Store which planes have hits near the front and back by inverting the "missing" planes that are stored.
246  fFrontPlanes.clear();
247  fBackPlanes.clear();
248  for (uint16_t i = 0; i < fNumFrontBackPlanes; i++){
249  fFrontPlanes.push_back(i);
250  fBackPlanes.push_back(TOTAL_FD_PLANES - i - 1);
251  }
252 
253  // Invert the "missing planes" to only store existing planes in fFrontPlanes and fBackPlanes variables.
254  for (const uint16_t missingPlane : RequiredFrontPlanes)
255  fFrontPlanes.erase(std::remove(fFrontPlanes.begin(), fFrontPlanes.end(), missingPlane), fFrontPlanes.end());
256  for (const uint16_t missingPlane : RequiredBackPlanes)
257  fBackPlanes.erase(std::remove(fBackPlanes.begin(), fBackPlanes.end(), missingPlane), fBackPlanes.end());
258  }
259 
260  return result;
261  }
float TNS() const
Definition: CellHit.h:46
std::vector< uint16_t > fBackPlanes
double fMissingPlanes
Number of missing planes for passing track.
std::vector< uint16_t > fHitPlanes
unsigned short Plane() const
Definition: CellHit.h:39
std::vector< unsigned long long > fHitTimes
geo::View_t View() const
Definition: CellHit.h:41
bool TimingInBounds(const unsigned long long &minTime, const unsigned long long &maxTime)
const uint16_t TOTAL_FD_PLANES
art::PtrVector< rb::CellHit > AllCells() const
Get all cells from both views.
Definition: Cluster.cxx:180
virtual double TotalLength() const
Length (cm) of all the track segments.
Definition: Track.cxx:213
std::vector< uint16_t > fFrontPlanes
Front CellPlanes hit.
unsigned short Cell() const
Definition: CellHit.h:40
void push_back(Ptr< U > const &p)
Definition: PtrVector.h:441
size_type size() const
Definition: PtrVector.h:308
bool MissingPlanesInBounds(const std::vector< uint16_t > &allMissingPlanes)
Definition: structs.h:12
bool IsNoise() const
Is the noise flag set?
Definition: Cluster.h:163
bool FrontBackPlanesHits(const std::vector< uint16_t > &missedFrontPlanes, const std::vector< uint16_t > &missedBackPlaness)
std::vector< unsigned short > fHitCells
bool novaddt::HorizontalMuonAna::IsHorzMuonTrack ( const novaddt::HitList track,
unsigned long long &  minTime,
unsigned long long &  maxTime 
)
private

Definition at line 188 of file HorizontalMuonAna_module.cc.

References fBackPlanes, fFrontPlanes, fHitPlanes, fHitTimes, fHitViews, fMissingPlanes, fNumFrontBackPlanes, FrontBackPlanesHits(), MECModelEnuComparisons::i, MissingPlanesInBounds(), novaddt::DAQHit::Plane(), fillBadChanDBTables::result, novaddt::DAQHit::TDC(), TimingInBounds(), TOTAL_FD_PLANES, novaddt::TDC::val, novaddt::Plane::val, novaddt::View::val, and novaddt::DAQHit::View().

Referenced by analyze().

188  {
189  // Make list of planes which must have a hit in them.
190  // Different sets for front and back planes, in case requirements differ between them
191  std::vector<uint16_t> RequiredFrontPlanes, RequiredBackPlanes, AllPlanes;
192  for (uint16_t i = 0; i < fNumFrontBackPlanes; i++)
193  RequiredFrontPlanes.push_back(i);
194  for (uint16_t i = 0; i < fNumFrontBackPlanes; i++)
195  RequiredBackPlanes.push_back(TOTAL_FD_PLANES - i - 1);
196  for (uint16_t i = 0; i < TOTAL_FD_PLANES; i++)
197  AllPlanes.push_back(i);
198 
199  fHitPlanes.clear();
200  fHitTimes.clear();
201  fHitViews.clear();
202 
203  // Loop through hits, keeping track of Planes and timing.
204  for (unsigned int i = 0; i < track.size(); i++){
205  const novaddt::DAQHit & hit = track[i];
206  if (hit.TDC().val > maxTime)
207  maxTime = hit.TDC().val;
208  if (hit.TDC().val < minTime)
209  minTime = hit.TDC().val;
210 
211  // If the plane matches any required plane, remove it from the list to search through.
212  RequiredFrontPlanes.erase(
213  std::remove(RequiredFrontPlanes.begin(), RequiredFrontPlanes.end(), hit.Plane().val),
214  RequiredFrontPlanes.end());
215 
216  RequiredBackPlanes.erase(
217  std::remove(RequiredBackPlanes.begin(), RequiredBackPlanes.end(), hit.Plane().val),
218  RequiredBackPlanes.end());
219 
220  AllPlanes.erase(
221  std::remove(AllPlanes.begin(), AllPlanes.end(), hit.Plane().val),
222  AllPlanes.end());
223 
224  fHitPlanes.push_back(hit.Plane().val);
225  fHitTimes.push_back(hit.TDC().val);
226  fHitViews.push_back(hit.View().val);
227  }
228 
229  bool result = TimingInBounds(minTime, maxTime) && MissingPlanesInBounds(AllPlanes) && FrontBackPlanesHits(RequiredFrontPlanes, RequiredBackPlanes);
230 
231  // Fill in analyzer variables if needed.
232  if (result){
233  fMissingPlanes = AllPlanes.size(); // The remianing planes are ones without hits.
234 
235  // Store which planes have hits near the front and back by inverting the "missing" planes that are stored.
236  fFrontPlanes.clear();
237  fBackPlanes.clear();
238  for (uint16_t i = 0; i < fNumFrontBackPlanes; i++){
239  fFrontPlanes.push_back(i);
240  fBackPlanes.push_back(TOTAL_FD_PLANES - i - 1);
241  }
242 
243  // Invert the "missing planes" to only store existing planes in fFrontPlanes and fBackPlanes variables.
244  for (const uint16_t missingPlane : RequiredFrontPlanes)
245  fFrontPlanes.erase(std::remove(fFrontPlanes.begin(), fFrontPlanes.end(), missingPlane), fFrontPlanes.end());
246  for (const uint16_t missingPlane : RequiredBackPlanes)
247  fBackPlanes.erase(std::remove(fBackPlanes.begin(), fBackPlanes.end(), missingPlane), fBackPlanes.end());
248  }
249 
250  return result;
251  }
std::vector< uint16_t > fBackPlanes
value_type val
Definition: BaseProducts.h:34
double fMissingPlanes
Number of missing planes for passing track.
novaddt::Plane const & Plane() const
Definition: DAQHit.h:70
std::vector< uint16_t > fHitPlanes
std::vector< unsigned long long > fHitTimes
novaddt::TDC const & TDC() const
Definition: DAQHit.h:74
bool TimingInBounds(const unsigned long long &minTime, const unsigned long long &maxTime)
Definition: event.h:19
const uint16_t TOTAL_FD_PLANES
std::vector< uint16_t > fFrontPlanes
Front CellPlanes hit.
novaddt::View const & View() const
Definition: DAQHit.h:72
value_type val
Definition: BaseProducts.h:84
bool MissingPlanesInBounds(const std::vector< uint16_t > &allMissingPlanes)
Definition: structs.h:12
value_type val
Definition: BaseProducts.h:137
bool FrontBackPlanesHits(const std::vector< uint16_t > &missedFrontPlanes, const std::vector< uint16_t > &missedBackPlaness)
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::mayConsume ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::mayConsume ( InputTag const &  it)
inherited

Definition at line 189 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

190 {
191  if (!moduleContext_)
192  return ProductToken<T>::invalid();
193 
194  consumables_[BT].emplace_back(ConsumableType::Product,
195  TypeID{typeid(T)},
196  it.label(),
197  it.instance(),
198  it.process());
199  return ProductToken<T>{it};
200 }
set< int >::iterator it
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename T , art::BranchType BT>
void art::Consumer::mayConsumeMany ( )
inherited

Definition at line 204 of file Consumer.h.

References T.

205 {
206  if (!moduleContext_)
207  return;
208 
209  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
210 }
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::mayConsumeView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::mayConsumeView ( InputTag const &  it)
inherited

Definition at line 214 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

215 {
216  if (!moduleContext_)
217  return ViewToken<T>::invalid();
218 
219  consumables_[BT].emplace_back(ConsumableType::ViewElement,
220  TypeID{typeid(T)},
221  it.label(),
222  it.instance(),
223  it.process());
224  return ViewToken<T>{it};
225 }
set< int >::iterator it
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
bool novaddt::HorizontalMuonAna::MissingPlanesInBounds ( const std::vector< unsigned short > &  allMissingPlanes)
private
bool novaddt::HorizontalMuonAna::MissingPlanesInBounds ( const std::vector< uint16_t > &  allMissingPlanes)
private

Definition at line 178 of file HorizontalMuonAna_module.cc.

References fMaxMissing.

Referenced by IsHorzMuonTrack().

178  {
179  if (fMaxMissing < 0) return true;
180  return ((int16_t) allMissingPlanes.size() <= fMaxMissing);
181  }
bool art::EventObserverBase::modifiesEvent ( ) const
inlineinherited

Definition at line 25 of file EventObserverBase.h.

26  {
27  return false;
28  }
static cet::exempt_ptr<Consumer> art::Consumer::non_module_context ( )
staticinherited
HorizontalMuonAna& novaddt::HorizontalMuonAna::operator= ( HorizontalMuonAna const &  )
delete
HorizontalMuonAna& novaddt::HorizontalMuonAna::operator= ( HorizontalMuonAna const &  )
delete
HorizontalMuonAna& novaddt::HorizontalMuonAna::operator= ( HorizontalMuonAna &&  )
delete
HorizontalMuonAna& novaddt::HorizontalMuonAna::operator= ( HorizontalMuonAna &&  )
delete
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited
std::string const& art::EventObserverBase::processName ( ) const
inlineinherited
void art::EventObserverBase::registerProducts ( MasterProductRegistry ,
ProductDescriptions ,
ModuleDescription const &   
)
inlineinherited

Definition at line 33 of file EventObserverBase.h.

References string.

36  {}
fhicl::ParameterSetID art::EventObserverBase::selectorConfig ( ) const
inlineinherited

Definition at line 56 of file EventObserverBase.h.

References art::EventObserverBase::selector_config_id_.

57  {
58  return selector_config_id_;
59  }
fhicl::ParameterSetID selector_config_id_
void art::Consumer::showMissingConsumes ( ) const
protectedinherited

Referenced by art::RootOutput::endJob().

bool novaddt::HorizontalMuonAna::TimingInBounds ( const float &  minTime,
const float &  maxTime 
)
private

Definition at line 185 of file HorizontalMuonAna_module.cc.

References fMaxTime.

185  {
186  if (fMaxTime < 0) return true;
187  return (maxTime - minTime <= fMaxTime);
188  }
bool novaddt::HorizontalMuonAna::TimingInBounds ( const unsigned long long &  minTime,
const unsigned long long &  maxTime 
)
private

Definition at line 183 of file HorizontalMuonAna_module.cc.

References fMaxTime.

Referenced by IsHorzMuonTrack().

183  {
184  if (fMaxTime < 0) return true;
185  return (maxTime - minTime <= fMaxTime);
186  }
void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited
bool art::EventObserverBase::wantAllEvents ( ) const
inlineinherited

Definition at line 46 of file EventObserverBase.h.

References art::EventObserverBase::wantAllEvents_.

Referenced by art::RootOutput::RootOutput().

47  {
48  return wantAllEvents_;
49  }
bool art::EventObserverBase::wantEvent ( Event const &  e)
inlineinherited

Definition at line 51 of file EventObserverBase.h.

References art::EventObserverBase::selectors_, and art::detail::CachedProducts::wantEvent().

52  {
53  return selectors_.wantEvent(e);
54  }
detail::CachedProducts selectors_
Float_t e
Definition: plot.C:35
bool wantEvent(Event const &)
std::string art::EDAnalyzer::workerType ( ) const
inlineinherited

Definition at line 109 of file EDAnalyzer.h.

References art::EDAnalyzer::currentContext().

110  {
111  return "WorkerT<EDAnalyzer>";
112  }

Member Data Documentation

unsigned novaddt::HorizontalMuonAna::_after_prescale = 0
private

Definition at line 69 of file HorizontalMuonAna_module.cc.

Referenced by analyze(), and endJob().

unsigned novaddt::HorizontalMuonAna::_prescale
private

Definition at line 66 of file HorizontalMuonAna_module.cc.

unsigned novaddt::HorizontalMuonAna::_trigger_counts = 0
private

Definition at line 68 of file HorizontalMuonAna_module.cc.

Referenced by analyze(), and endJob().

std::vector<uint16_t> novaddt::HorizontalMuonAna::fBackPlanes
private

Definition at line 92 of file HorizontalMuonAna_module.cc.

Referenced by beginJob(), and IsHorzMuonTrack().

std::vector<unsigned short> novaddt::HorizontalMuonAna::fBackPlanes
private

Definition at line 94 of file HorizontalMuonAna_module.cc.

unsigned int novaddt::HorizontalMuonAna::fEvent
private

Event number.

Definition at line 86 of file HorizontalMuonAna_module.cc.

Referenced by analyze(), beginJob(), and IsHorzMuonTrack().

std::vector<uint16_t> novaddt::HorizontalMuonAna::fFrontPlanes
private

Front CellPlanes hit.

Definition at line 91 of file HorizontalMuonAna_module.cc.

Referenced by beginJob(), and IsHorzMuonTrack().

std::vector<unsigned short> novaddt::HorizontalMuonAna::fFrontPlanes
private

Front CellPlanes hit.

Definition at line 93 of file HorizontalMuonAna_module.cc.

std::vector<unsigned short> novaddt::HorizontalMuonAna::fHitCells
private

Definition at line 98 of file HorizontalMuonAna_module.cc.

Referenced by IsHorzMuonTrack().

std::vector<uint16_t> novaddt::HorizontalMuonAna::fHitPlanes
private

Definition at line 93 of file HorizontalMuonAna_module.cc.

Referenced by beginJob(), and IsHorzMuonTrack().

std::vector<unsigned short> novaddt::HorizontalMuonAna::fHitPlanes
private

Definition at line 95 of file HorizontalMuonAna_module.cc.

std::vector<unsigned long long> novaddt::HorizontalMuonAna::fHitTimes
private

Definition at line 94 of file HorizontalMuonAna_module.cc.

Referenced by beginJob(), and IsHorzMuonTrack().

std::vector<float> novaddt::HorizontalMuonAna::fHitTimes
private

Definition at line 96 of file HorizontalMuonAna_module.cc.

std::vector<uint8_t> novaddt::HorizontalMuonAna::fHitViews
private

Definition at line 95 of file HorizontalMuonAna_module.cc.

Referenced by beginJob(), and IsHorzMuonTrack().

std::vector<unsigned short> novaddt::HorizontalMuonAna::fHitViews
private

Definition at line 97 of file HorizontalMuonAna_module.cc.

short novaddt::HorizontalMuonAna::fMaxMissing
private

Definition at line 62 of file HorizontalMuonAna_module.cc.

int16_t novaddt::HorizontalMuonAna::fMaxMissing
private

Definition at line 63 of file HorizontalMuonAna_module.cc.

Referenced by MissingPlanesInBounds().

double novaddt::HorizontalMuonAna::fMaxTime
private

Definition at line 64 of file HorizontalMuonAna_module.cc.

Referenced by TimingInBounds().

short novaddt::HorizontalMuonAna::fMinFrontBackPlanes
private

Definition at line 61 of file HorizontalMuonAna_module.cc.

int16_t novaddt::HorizontalMuonAna::fMinFrontBackPlanes
private

Definition at line 62 of file HorizontalMuonAna_module.cc.

Referenced by FrontBackPlanesHits().

unsigned int novaddt::HorizontalMuonAna::fMissingPlanes
private

Number of missing planes for passing track.

Definition at line 87 of file HorizontalMuonAna_module.cc.

double novaddt::HorizontalMuonAna::fMissingPlanes
private

Number of missing planes for passing track.

Definition at line 89 of file HorizontalMuonAna_module.cc.

Referenced by beginJob(), and IsHorzMuonTrack().

unsigned short novaddt::HorizontalMuonAna::fNumFrontBackPlanes
private

Definition at line 60 of file HorizontalMuonAna_module.cc.

uint16_t novaddt::HorizontalMuonAna::fNumFrontBackPlanes
private

Definition at line 61 of file HorizontalMuonAna_module.cc.

Referenced by FrontBackPlanesHits(), and IsHorzMuonTrack().

unsigned int novaddt::HorizontalMuonAna::fRun
private

Run number.

Definition at line 84 of file HorizontalMuonAna_module.cc.

Referenced by analyze(), beginJob(), and IsHorzMuonTrack().

TVector3 * novaddt::HorizontalMuonAna::fStart
private

Start position of track.

Definition at line 87 of file HorizontalMuonAna_module.cc.

Referenced by analyze(), beginJob(), and IsHorzMuonTrack().

TVector3 * novaddt::HorizontalMuonAna::fStop
private

End position of track.

Definition at line 88 of file HorizontalMuonAna_module.cc.

Referenced by analyze(), beginJob(), and IsHorzMuonTrack().

unsigned short novaddt::HorizontalMuonAna::fStoreAllHits
private

Definition at line 65 of file HorizontalMuonAna_module.cc.

Referenced by IsHorzMuonTrack().

unsigned int novaddt::HorizontalMuonAna::fSubRun
private

Subrun number.

Definition at line 85 of file HorizontalMuonAna_module.cc.

Referenced by analyze(), beginJob(), and IsHorzMuonTrack().

unsigned long long novaddt::HorizontalMuonAna::fTimeTDC
private

Time (in TNS) for track.

Definition at line 90 of file HorizontalMuonAna_module.cc.

Referenced by analyze(), and beginJob().

float novaddt::HorizontalMuonAna::fTimeTNS
private

Time (in TNS) for track.

Definition at line 88 of file HorizontalMuonAna_module.cc.

Referenced by IsHorzMuonTrack().

float novaddt::HorizontalMuonAna::fTotalGeV
private

TotalGeV deposited in track.

Definition at line 89 of file HorizontalMuonAna_module.cc.

Referenced by IsHorzMuonTrack().

float novaddt::HorizontalMuonAna::fTotalPE
private

TotalPE deposited in track.

Definition at line 90 of file HorizontalMuonAna_module.cc.

Referenced by IsHorzMuonTrack().

std::string novaddt::HorizontalMuonAna::fTracksTag
private

Definition at line 65 of file HorizontalMuonAna_module.cc.

Referenced by analyze().

TTree * novaddt::HorizontalMuonAna::fTrackTree
private

Definition at line 99 of file HorizontalMuonAna_module.cc.

Referenced by analyze(), beginJob(), and IsHorzMuonTrack().

int novaddt::HorizontalMuonAna::n3DTracks = 0
private

Definition at line 74 of file HorizontalMuonAna_module.cc.

Referenced by analyze(), endJob(), and IsHorzMuonTrack().

int novaddt::HorizontalMuonAna::nEvents = 0
private

Definition at line 72 of file HorizontalMuonAna_module.cc.

Referenced by analyze(), endJob(), and IsHorzMuonTrack().

int novaddt::HorizontalMuonAna::nHorzMuons = 0
private

Definition at line 75 of file HorizontalMuonAna_module.cc.

Referenced by analyze(), endJob(), and IsHorzMuonTrack().

int novaddt::HorizontalMuonAna::nTracks = 0
private

Definition at line 73 of file HorizontalMuonAna_module.cc.

Referenced by analyze(), endJob(), and IsHorzMuonTrack().

art::ServiceHandle< art::TFileService > novaddt::HorizontalMuonAna::tfs
private

Definition at line 98 of file HorizontalMuonAna_module.cc.

Referenced by beginJob(), and IsHorzMuonTrack().


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