Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
calib::MuonTrackHits Class Reference
Inheritance diagram for calib::MuonTrackHits:
art::EDFilter art::ProducerBase art::Consumer art::EngineCreator art::ProductRegistryHelper

Public Types

using ModuleType = EDFilter
 
using WorkerType = WorkerT< EDFilter >
 
template<typename UserConfig >
using Table = ProducerBase::Table< UserConfig >
 

Public Member Functions

 MuonTrackHits (fhicl::ParameterSet const &p)
 
virtual ~MuonTrackHits ()
 
bool filter (art::Event &e) override
 
void reconfigure (fhicl::ParameterSet const &p)
 
void beginJob () override
 
void endJob () override
 
bool beginRun (art::Run &r) override
 
bool endRun (art::Run &r) override
 
template<typename PROD , BranchType B = InEvent>
ProductID getProductID (std::string const &instanceName={}) const
 
template<typename PROD , BranchType B>
ProductID getProductID (ModuleDescription const &moduleDescription, std::string const &instanceName) const
 
bool modifiesEvent () 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 ()
 

Static Public Attributes

static constexpr bool Pass {true}
 
static constexpr bool Fail {false}
 

Protected Member Functions

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

Private Member Functions

double getPECorr (art::Event &e, caldp::PCHit const &pchit)
 
double getPECorrToGeV (art::Event &e, caldp::PCHit const &pchit)
 

Private Attributes

TH2D * fdEdx
 
TH2D * fdEdx_minus
 
TH2D * fdEdx_plus
 
TH2D * fdEdx_true
 
TTree * fTree
 
TTree * fTree_CalibTracks
 
int diblock
 
int view
 
double FlightLength
 
double TotalTrackLength
 
double x
 
double xCust
 
double plane
 
double path
 
double trueE
 
double PE
 
double PECorr
 
double tns
 
uint32_t EventTimeHigh
 
double cell
 
double w
 
double PECorrToGeV
 
double RecoGeV
 
double distanceToLiveDetEdgeZ
 
int run
 
int subRun
 
int event
 
int evt_year
 
int evt_month
 
int evt_day
 
int evt_hour
 
int evt_min
 
int evt_sec
 
int APD
 
int sameAPDhitsEvent
 
int sameAPDhitDiblockEvent
 
int nhits
 
int navghits
 
int nzhits
 
int ntricells
 
int nXYHits
 
int hitId
 
bool badTNS
 
double xStart
 
double yStart
 
double zStart
 
double xEnd
 
double yEnd
 
double zEnd
 
double dCosX
 
double dCosY
 
double dCosZ
 
int totalPlanes
 
int xPlanes
 
int yPlanes
 
int continuity
 
std::string fPCHitLabel
 
std::string fQualXYName
 
std::string fQualZName
 
std::string fQualAvgName
 
std::string fStopperLabel
 
double fSysShift
 

Detailed Description

Definition at line 60 of file MuonTrackHits_module.cc.

Member Typedef Documentation

using art::EDFilter::ModuleType = EDFilter
inherited

Definition at line 37 of file EDFilter.h.

template<typename UserConfig >
using art::EDFilter::Table = ProducerBase::Table<UserConfig>
inherited

Definition at line 46 of file EDFilter.h.

using art::EDFilter::WorkerType = WorkerT<EDFilter>
inherited

Definition at line 38 of file EDFilter.h.

Constructor & Destructor Documentation

calib::MuonTrackHits::MuonTrackHits ( fhicl::ParameterSet const &  p)
explicit

Definition at line 161 of file MuonTrackHits_module.cc.

162  {
163  this->reconfigure(p);
164  produces< TH2D, art::InRun >("dEdx");
165  produces< TH2D, art::InRun >("dEdxMinus");
166  produces< TH2D, art::InRun >("dEdxPlus");
167  produces< TH2D, art::InRun >("dEdxTrue");
168  }
void reconfigure(fhicl::ParameterSet const &p)
const char * p
Definition: xmltok.h:285
calib::MuonTrackHits::~MuonTrackHits ( )
virtual

Definition at line 170 of file MuonTrackHits_module.cc.

171  {
172  // Clean up dynamic memory and other resources here.
173  }

Member Function Documentation

void calib::MuonTrackHits::beginJob ( )
overridevirtual

Reimplemented from art::EDFilter.

Definition at line 570 of file MuonTrackHits_module.cc.

References getBrightness::cell, geo2elec::diblock, art::TFileDirectory::make(), path, NDAPDHVSetting::plane, POTSpillRate::view, w, and submit_syst::x.

571  {
572  // histograms for output
574 
575  fTree = tfs->make<TTree>("fTree","tree to hold muon hits within each track variables");
576  fTree->Branch("nXYHits",&nXYHits);
577  fTree->Branch("nhits",&nhits);
578  fTree->Branch("hitId",&hitId);
579  fTree->Branch("xStart",&xStart);
580  fTree->Branch("yStart",&yStart);
581  fTree->Branch("zStart",&zStart);
582  fTree->Branch("dCosX",&dCosX);
583  fTree->Branch("dCosY",&dCosY);
584  fTree->Branch("dCosZ",&dCosZ);
585  // fTree->Branch("zenith",&zenith);
586  // fTree->Branch("azimuth",&azimuth);
587  fTree->Branch("x",&x);
588  fTree->Branch("badTNS",&badTNS);
589  fTree->Branch("run",&run);
590  fTree->Branch("diblock",&diblock);
591  fTree->Branch("view",&view);
592  fTree->Branch("FlightLength",&FlightLength);
593  fTree->Branch("TotalTrackLength",&TotalTrackLength);
594  fTree->Branch("xCust",&xCust);
595  fTree->Branch("distanceToLiveDetEdgeZ",&distanceToLiveDetEdgeZ);
596  fTree->Branch("plane",&plane);
597  fTree->Branch("path",&path);
598  fTree->Branch("trueE",&trueE);
599  fTree->Branch("PE",&PE);
600  fTree->Branch("PECorr",&PECorr);
601  fTree->Branch("tns",&tns);
602  fTree->Branch("cell",&cell);
603  fTree->Branch("w",&w);
604  fTree->Branch("PECorrToGeV",&PECorrToGeV);
605  fTree->Branch("RecoGeV",&RecoGeV);
606  fTree->Branch("EventTimeHigh",&EventTimeHigh);
607  fTree->Branch("evt_year",&evt_year);
608  fTree->Branch("evt_month",&evt_month);
609  fTree->Branch("evt_day",&evt_day);
610  fTree->Branch("evt_hour",&evt_hour);
611  fTree->Branch("evt_min",&evt_min);
612  fTree->Branch("evt_sec",&evt_sec);
613  fTree->Branch("APD",&APD);
614  fTree->Branch("sameAPDhitsEvent",&sameAPDhitsEvent);
615  fTree->Branch("sameAPDhitDiblockEvent",&sameAPDhitDiblockEvent);
616  fTree->Branch("totalPlanes",&totalPlanes);
617  fTree->Branch("xPlanes",&xPlanes);
618  fTree->Branch("yPlanes",&yPlanes);
619  fTree->Branch("continuity",&continuity);
620 
621  fTree_CalibTracks = tfs->make<TTree>("fTree_CalibTracks","tree to hold info about muon tracks");
622  fTree_CalibTracks->Branch("run",&run);
623  fTree_CalibTracks->Branch("subRun",&subRun);
624  fTree_CalibTracks->Branch("event",&event);
625  fTree_CalibTracks->Branch("nhits",&nhits);
626  fTree_CalibTracks->Branch("totalPlanes",&totalPlanes);
627  fTree_CalibTracks->Branch("xPlanes",&xPlanes);
628  fTree_CalibTracks->Branch("yPlanes",&yPlanes);
629  fTree_CalibTracks->Branch("continuity",&continuity);
630  fTree_CalibTracks->Branch("navghits",&navghits);
631  fTree_CalibTracks->Branch("nzhits",&nzhits);
632  fTree_CalibTracks->Branch("ntricells",&ntricells);
633  fTree_CalibTracks->Branch("totalPlanes",&totalPlanes);
634  fTree_CalibTracks->Branch("xStart",&xStart);
635  fTree_CalibTracks->Branch("yStart",&yStart);
636  fTree_CalibTracks->Branch("zStart",&zStart);
637  fTree_CalibTracks->Branch("xEnd",&xEnd);
638  fTree_CalibTracks->Branch("yEnd",&yEnd);
639  fTree_CalibTracks->Branch("zEnd",&zEnd);
640  fTree_CalibTracks->Branch("dCosX",&dCosX);
641  fTree_CalibTracks->Branch("dCosY",&dCosY);
642  fTree_CalibTracks->Branch("dCosZ",&dCosZ);
643  // fTree_CalibTracks->Branch("zenith",&zenith);
644  // fTree_CalibTracks->Branch("azimuth",&azimuth);
645  fTree_CalibTracks->Branch("TotalTrackLength",&TotalTrackLength);
646 
647 
648  fdEdx = tfs->make<TH2D>("dEdx",";Distance to track end (cm);PECorr / cm;",
649  50,0.,500.,200,0.,200.);
650  fdEdx_minus = tfs->make<TH2D>("dEdx_minus",";Distance to track end (cm);PECorr / cm;",
651  50,0.,500.,200,0.,200.);
652  fdEdx_plus = tfs->make<TH2D>("dEdx_plus",";Distance to track end (cm);PECorr / cm;",
653  50,0.,500.,200,0.,200.);
654  fdEdx_true = tfs->make<TH2D>("dEdx_true",";Distance to track end (cm);True MeV / cm;",
655  50,0.,500.,200,0.,5.);
656 
657  }
Definition: run.py:1
T * make(ARGS...args) const
bool calib::MuonTrackHits::beginRun ( art::Run r)
overridevirtual

Reimplemented from art::EDFilter.

Definition at line 659 of file MuonTrackHits_module.cc.

659  {
660  return true;
661  }
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::EDFilter::currentContext ( ) const
protectedinherited
void calib::MuonTrackHits::endJob ( )
overridevirtual

Reimplemented from art::EDFilter.

Definition at line 678 of file MuonTrackHits_module.cc.

References DEFINE_ART_MODULE().

679  {
680 
681  }
bool calib::MuonTrackHits::endRun ( art::Run r)
overridevirtual

Reimplemented from art::EDFilter.

Definition at line 663 of file MuonTrackHits_module.cc.

References art::TFileDirectory::make(), and art::Run::put().

663  {
664 
666  std::unique_ptr<TH2D> pdEdx(tfs->make<TH2D>(*fdEdx));
667  std::unique_ptr<TH2D> pdEdx_minus(tfs->make<TH2D>(*fdEdx_minus));
668  std::unique_ptr<TH2D> pdEdx_plus(tfs->make<TH2D>(*fdEdx_plus));
669  std::unique_ptr<TH2D> pdEdx_true(tfs->make<TH2D>(*fdEdx_true));
670 
671  r.put(std::move(pdEdx),"dEdx");
672  r.put(std::move(pdEdx_minus),"dEdxMinus");
673  r.put(std::move(pdEdx_plus),"dEdxPlus");
674  r.put(std::move(pdEdx_true),"dEdxTrue");
675  return true;
676  }
art::ProductID put(std::unique_ptr< PROD > &&)
Definition: Run.h:149
T * make(ARGS...args) const
bool calib::MuonTrackHits::filter ( art::Event e)
overridevirtual

Get the reconstructed tracks

Implements art::EDFilter.

Definition at line 175 of file MuonTrackHits_module.cc.

References getBrightness::cell, geo::GeometryBase::CellId(), PandAna.Demos.tute_pid_validation::cid, om::cout, geo::GeometryBase::DetId(), geo2elec::diblock, geo::LiveGeometry::DistToEdgeZ(), allTimeWatchdog::endl, art::Event::event(), geo::GeometryBase::FirstPlaneInMuonCatcher(), art::DataViewImpl::getByLabel(), geo::GeometryBase::getPlaneID(), hits(), MECModelEnuComparisons::i, makeTrainCVSamples::int, calib::j, novadaq::cnv::kNEARDET, Mag(), getGoodRuns4SAM::n, path, NDAPDHVSetting::plane, art::Event::run(), art::Event::subRun(), art::Event::time(), art::Timestamp::timeHigh(), POTSpillRate::view, w, and submit_syst::x.

176  {
177 
178  run = (int)(e.run());
179  subRun = (int)(e.subRun());
180  event = (int)(e.event());
181 
182 
183  art::Timestamp ts = e.time();
184  EventTimeHigh = ts.timeHigh();
185  const time_t timeSec = ts.timeHigh();
186  struct tm* timeStruct = localtime(&timeSec);
187  evt_year=timeStruct->tm_year+1900;
188  evt_month=timeStruct->tm_mon+1;
189  evt_day=timeStruct->tm_mday;
190  evt_hour=timeStruct->tm_hour+1;
191  evt_min=timeStruct->tm_min;
192  evt_sec=timeStruct->tm_sec;
193 
194  /// Get the reconstructed tracks
196  e.getByLabel(fStopperLabel, tracks);
197  if( tracks->size() == 0 ) return false;
198 
202  if( !PCHitGetter.isValid() ) return false;
203 
204  // loop over stopping tracks in event
205  for( unsigned int i=0; i<tracks->size(); ++i ){
206 
207  //track level counters:
208  int windowTricells = 0;
209  int windowAvgHits = 0;
210  int windowZHits = 0;
211  int windowPlanes = 0;
212 
213  totalPlanes = 0;
214  xPlanes = 0;
215  yPlanes = 0;
216 
217  std::vector<bool> trackWindowPlanes (1000, false); //vector to prevent double counting planes
218 
219  std::vector<bool> trackPlanes (1000, false); //vector to prevent double counting total number of planes in track
220  std::vector<bool> trackXPlanes (1000, false); //vector to prevent double counting total number of x planes in track
221  std::vector<bool> trackYPlanes (1000, false); //vector to prevent double counting total number of y planes in track
222 
223  bool windowXView = false;
224  bool windowYView = false;
225 
226  //make custom track length to check against inbuilt length
227  TVector3 startXYZ = (*tracks)[i].Start();
228  TVector3 stopXYZ = (*tracks)[i].Stop();
229  double trackLength = (startXYZ-stopXYZ).Mag();
230  xStart = startXYZ.X();
231  yStart = startXYZ.Y();
232  zStart = startXYZ.Z();
233  xEnd = stopXYZ.X();
234  yEnd = stopXYZ.Y();
235  zEnd = stopXYZ.Z();
236  // zenith = startXYZ.Theta();
237  // azimuth = startXYZ.Phi();
238 
239  //cosine giving initial direction of track
240  dCosX = (*tracks)[i].Dir().X()/(*tracks)[i].Dir().Mag();
241  dCosY = (*tracks)[i].Dir().Y()/(*tracks)[i].Dir().Mag();
242  dCosZ = (*tracks)[i].Dir().Z()/(*tracks)[i].Dir().Mag();
243 
244 
245  // needed for track window, but good generally to reject protons
246  // if( (*tracks)[i].TotalLength() < 200. ) continue;
247 
250  int stopPlaneID = 10000;
251  int firstMuCPlane = -1;
252  bool isNearDet = false;
253 
254  //remove tracks that stop outside/ near edge of the active detector. New files won't need this as the selection is in the updated pchitslist_module.
256  distanceToLiveDetEdgeZ = fLiveGeom->DistToEdgeZ((*tracks)[i].Stop());
257 
258  //continue if track ends in the muon catcher
259  if(fGeo->DetId() == novadaq::cnv::kNEARDET){
260  isNearDet = true;
261  cid = fGeo->CellId(stopXYZ[0], stopXYZ[1], stopXYZ[2], 1.5, 1.5, 6., 1.0);
262  if(cid) stopPlaneID = fGeo->getPlaneID(cid);
263  firstMuCPlane = fGeo->FirstPlaneInMuonCatcher();
264  if(stopPlaneID >= firstMuCPlane) continue;
265  }
266 
268 
269  // loop over PCHits associated to stopping track
270  std::vector<art::Ptr<caldp::PCHit> > hits = PCHitGetter.at(i);
271  std::vector<art::Ptr<caldp::PCHit> > avghits = PCHitAvgGetter.at(i);
272  std::vector<art::Ptr<caldp::PCHit> > zhits = PCHitZGetter.at(i);
273 
274  navghits = avghits.size();
275  nzhits = zhits.size();
276  ntricells = hits.size();
277  nhits = hits.size() + avghits.size() + zhits.size();
278 
279  int tplane;
280  int trackView;
281 
282  for(unsigned int k=0; k<hits.size(); ++k){
283 
284  tplane = hits[k]->Plane();
285  trackView = (int)hits[k]->View();
286 
287  if(trackPlanes[tplane] == false) {
288  totalPlanes ++;
289  trackPlanes[tplane] = true;
290  };
291  if(trackView == 0 && trackXPlanes[tplane] == false){
292  xPlanes ++;
293  trackXPlanes[tplane] = true;
294  };
295  if(trackView == 1 && trackYPlanes[tplane] == false){
296  yPlanes ++;
297  trackYPlanes[tplane] = true;
298  };
299 
300  };
301 
302  for(unsigned int k=0; k<avghits.size(); ++k){
303  tplane = avghits[k]->Plane();
304  trackView = (int)avghits[k]->View();
305 
306  if(trackPlanes[tplane] == false){
307  totalPlanes ++;
308  trackPlanes[tplane] = true;
309  };
310  if(trackView == 0 && trackXPlanes[tplane] == false){
311  xPlanes ++;
312  trackXPlanes[tplane] = true;
313  };
314  if(trackView == 1 && trackYPlanes[tplane] == false){
315  yPlanes ++;
316  trackYPlanes[tplane] = true;
317  };
318 
319  };
320 
321  for(unsigned int k=0; k<zhits.size(); ++k){
322  tplane = zhits[k]->Plane();
323  trackView = (int)zhits[k]->View();
324 
325  if(trackPlanes[tplane] == false){
326  totalPlanes ++;
327  trackPlanes[tplane] = true;
328  };
329  if(trackView == 0 && trackXPlanes[tplane] == false){
330  xPlanes ++;
331  trackXPlanes[tplane] = true;
332  };
333  if(trackView == 1 && trackYPlanes[tplane] == false){
334  yPlanes ++;
335  trackYPlanes[tplane] = true;
336  };
337 
338  };
339 
340 
341  /*
342  if(xPlanes==0 || yPlanes==0){
343  std::cout << "***** HEY! *****" << std::endl;
344  std::cout << "run: " << run << ", subRun: " << subRun << ", event: " << event << " xPlanes: " << xPlanes << " yPlanes: " << yPlanes << ", TotalTrackLength: " << TotalTrackLength << std::endl;
345  std::cout << "xStart: " << xStart << ", yStart: " << yStart << ", zStart: " << zStart << std::endl;
346  std::cout << "xEnd: " << xEnd << ", yEnd: " << yEnd << ", zEnd: " << zEnd << std::endl;
347  std::cout << "* * * * * * * * * *" << std::endl;
348  }
349  */
350 
351  int cont;
352  for(unsigned int k=0; k<1000;k++){
353  cont = 0;
354  if(trackPlanes[k] == true){
355  for(unsigned int kk=0;kk<6;kk++){
356  if(trackPlanes[k+kk]==true) cont ++;
357  //else cont = cont;
358  };
359  if (cont>=5) break;
360  };
361  };
362 
363  if(cont>=5) continuity = 1;
364  else continuity = 0;
365 
366 
367  fTree_CalibTracks->Fill();
368 
369  // ---------------- Fill vector containing hits per APD ---------------------- //
370  std::vector<int> APDhits (100,0);
371  std::vector< std::vector<int> > DiblockAPDhits (100, std::vector<int> (100,0));
372  badTNS = false; //temporary handle for showery events in old data
373 
374  //avg. hits
375  if(avghits.size() != 0)
376  for( unsigned int p=0; p<avghits.size(); ++p ) {
377  APDhits[avghits[p]->APD()] += 1;
378  DiblockAPDhits.at(avghits[p]->Diblock()).at(avghits[p]->APD()) += 1;
379  if(avghits[p]->TNS() < 0 || avghits[p]->TNS() > 1400) badTNS = true;
380  FlightLength = avghits[p]->FlightLen();
381  TotalTrackLength = (*tracks)[i].TotalLength();
382  x = trackLength - FlightLength;
383  if(x<100 || x>200) continue;
384  windowAvgHits ++; //track level counters
385  }
386  //z hits
387  if(zhits.size() != 0)
388  for( unsigned int q=0; q<zhits.size(); ++q ){
389  APDhits[zhits[q]->APD()] += 1;
390  DiblockAPDhits.at(zhits[q]->Diblock()).at(zhits[q]->APD()) += 1;
391  if(zhits[q]->TNS() < 0 || zhits[q]->TNS() > 1400) badTNS = true;
392  FlightLength = zhits[q]->FlightLen();
393  TotalTrackLength = (*tracks)[i].TotalLength();
394  x = trackLength - FlightLength;
395  if(x<100 || x>200) continue;
396  windowZHits ++; //track level counters
397  }
398  // tricell hits
399  if(hits.size() != 0)
400  for( unsigned int n=0; n<hits.size(); ++n ){
401  APDhits[hits[n]->APD()] += 1;
402  DiblockAPDhits.at(hits[n]->Diblock()).at(hits[n]->APD()) += 1;
403  if(hits[n]->TNS() < 0 || hits[n]->TNS() > 1400) badTNS = true;
404  FlightLength = hits[n]->FlightLen();
405  TotalTrackLength = (*tracks)[i].TotalLength();
406  x = trackLength - FlightLength;
407  if(x<100 || x>200) continue;
408  windowTricells ++; //track level counters
409  }
410  // ---------------- Filled APD vector -------------------------------------------- //
411 
412 
413  for( unsigned int j=0; j<avghits.size(); ++j) {
414  if(isNearDet)
415  if(avghits[j]->Plane() >= firstMuCPlane) continue;
416 
417  hitId = 0;
418  nXYHits = avghits.size();
419  diblock = avghits[j]->Diblock();
420  view = (int)avghits[j]->View();
421  FlightLength = avghits[j]->FlightLen();
422  TotalTrackLength= (*tracks)[i].TotalLength();
423  x = trackLength - FlightLength;
424  plane = avghits[j]->Plane();
425  path = avghits[j]->Path();
426  trueE = avghits[j]->TrueMeV();
427  PE = avghits[j]->PE();
428  PECorr = this->getPECorr(e,*avghits[j]);
429  PECorrToGeV = this->getPECorrToGeV(e,*avghits[j]);
431  tns = avghits[j]->TNS();
432  cell = avghits[j]->Cell();
433  w = avghits[j]->W();
434  APD = avghits[j]->APD();
435  sameAPDhitsEvent= APDhits[APD];
436  sameAPDhitDiblockEvent= DiblockAPDhits[diblock][APD];
437 
438  fTree->Fill(); //fill ttree
439 
440  }
441 
442 
443  for( unsigned int j=0; j<zhits.size(); ++j) {
444  if(isNearDet)
445  if(zhits[j]->Plane() >= firstMuCPlane) continue;
446 
447  hitId = 1;
448  nXYHits = zhits.size();
449  diblock = zhits[j]->Diblock();
450  view = (int)zhits[j]->View();
451  FlightLength = zhits[j]->FlightLen();
452  TotalTrackLength= (*tracks)[i].TotalLength();
453  x = trackLength - FlightLength;
454  plane = zhits[j]->Plane();
455  path = zhits[j]->Path();
456  trueE = zhits[j]->TrueMeV();
457  PE = zhits[j]->PE();
458  PECorr = this->getPECorr(e,*zhits[j]);
459  PECorrToGeV = this->getPECorrToGeV(e,*zhits[j]);
461  tns = zhits[j]->TNS();
462  cell = zhits[j]->Cell();
463  w = zhits[j]->W();
464  APD = zhits[j]->APD();
465  sameAPDhitsEvent= APDhits[APD];
466  sameAPDhitDiblockEvent= DiblockAPDhits[diblock][APD];
467 
468  fTree->Fill(); //fill ttree
469 
470  }
471 
472 
473  for( unsigned int j=0; j<hits.size(); ++j ) { // loop over number of tricells per track
474 
475  if(isNearDet)
476  if(hits[j]->Plane() >= firstMuCPlane) continue;
477 
478  //test poisson lambda:
479  double poissonLambda = hits[j]->PoissonLambda();
480  std::cout<< "poissonLambda: " << poissonLambda <<std::endl;
481 
482  hitId = 2;
483  nXYHits = hits.size();
484  diblock = hits[j]->Diblock();
485  view = (int)hits[j]->View();
486  FlightLength = hits[j]->FlightLen();
487  TotalTrackLength= (*tracks)[i].TotalLength();
488  x = trackLength - FlightLength;
489  plane = hits[j]->Plane();
490  path = hits[j]->Path();
491  trueE = hits[j]->TrueMeV();
492  PE = hits[j]->PE();
493  PECorr = this->getPECorr(e,*hits[j]);
494  PECorrToGeV = this->getPECorrToGeV(e,*hits[j]);
496  tns = hits[j]->TNS();
497  cell = hits[j]->Cell();
498  w = hits[j]->W();
499  APD = hits[j]->APD();
500  sameAPDhitsEvent= APDhits[APD];
501  sameAPDhitDiblockEvent= DiblockAPDhits[diblock][APD];
502 
503  fTree->Fill(); //fill ttree
504 
505 
506  if(x<100 || x>200) continue;
507 
508  //track level counters
509  if(view == 0) windowXView = true;
510  if(view == 1) windowYView = true;
511  //check if plane already counted
512  if(trackWindowPlanes[plane] == false) windowPlanes ++;
513  trackWindowPlanes[plane] = true;
514 
515 
516  } // end loop over tricells
517 
518 
519  int nViewsInWindow = 0;
520  if(windowXView == true) nViewsInWindow++;
521  if(windowYView == true) nViewsInWindow++;
522 
523 
524 
525  }// loop over tracks
526 
527  return true;
528  }
SubRunNumber_t subRun() const
Definition: Event.h:72
const char * p
Definition: xmltok.h:285
constexpr std::uint32_t timeHigh() const
Definition: Timestamp.h:35
void hits()
Definition: readHits.C:15
double DistToEdgeZ(TVector3 vertex)
int getPlaneID(const CellUniqueId &id) const
novadaq::cnv::DetId DetId() const
Prefer ds::DetectorService::DetId() instead.
Definition: GeometryBase.h:243
Near Detector in the NuMI cavern.
const CellUniqueId CellId(const double &x, const double &y, const double &z, double dxds=0., double dyds=0., double dzds=1., double step=0.01) const
const double j
Definition: BetheBloch.cxx:29
EventNumber_t event() const
Definition: Event.h:67
Definition: View.py:1
Definition: run.py:1
OStream cout
Definition: OStream.cxx:6
unsigned long long int CellUniqueId
Definition: CellUniqueId.h:15
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
double getPECorr(art::Event &e, caldp::PCHit const &pchit)
float Mag() const
Timestamp time() const
Definition: Event.h:61
double getPECorrToGeV(art::Event &e, caldp::PCHit const &pchit)
RunNumber_t run() const
Definition: Event.h:77
const unsigned int FirstPlaneInMuonCatcher() const
Returns the index of the first plane contained in the muon catcher.
seed_t art::EngineCreator::get_seed_value ( fhicl::ParameterSet const &  pset,
char const  key[] = "seed",
seed_t const  implicit_seed = -1 
)
inherited
double calib::MuonTrackHits::getPECorr ( art::Event e,
caldp::PCHit const &  pchit 
)
private

Definition at line 531 of file MuonTrackHits_module.cc.

References caldp::PCHit::Cell(), calib::Calibrator::GetPECorr(), caldp::PCHit::GoodTime(), art::Event::isRealData(), caldp::PCHit::PE(), caldp::PCHit::Plane(), rb::CellHit::SetCell(), rawdata::RawDigit::SetMC(), rb::CellHit::SetPE(), rb::CellHit::SetPlane(), rb::CellHit::SetTNS(), rb::CellHit::SetView(), caldp::PCHit::TNS(), caldp::PCHit::View(), and caldp::PCHit::W().

531  {
532 
533  //Calibrator necessary to get Atten information
535 
536  //Make mock cellhit
537  rb::CellHit cellhit;
538  cellhit.SetPlane(pchit.Plane());
539  cellhit.SetCell(pchit.Cell());
540  cellhit.SetView(pchit.View());
541  cellhit.SetTNS(pchit.TNS(),pchit.GoodTime());
542  if(!e.isRealData())cellhit.SetMC(); // assume only filled for MC...
543  cellhit.SetPE(pchit.PE());
544 
545  double pecorr = calibrator->GetPECorr(cellhit, pchit.W());
546  return pecorr;
547  }
void SetTNS(float tns, bool good)
Definition: CellHit.h:56
bool isRealData() const
Definition: Event.h:83
void SetView(geo::View_t view)
Definition: CellHit.h:54
void SetPlane(unsigned short plane)
Definition: CellHit.h:53
void SetCell(unsigned short cell)
Definition: CellHit.h:52
void SetPE(float pe)
Definition: CellHit.h:55
void SetMC(bool isMC=true)
Definition: RawDigit.h:106
A rawdata::RawDigit with channel information decoded.
Definition: CellHit.h:27
double GetPECorr(rb::CellHit const &cellhit, double w)
double calib::MuonTrackHits::getPECorrToGeV ( art::Event e,
caldp::PCHit const &  pchit 
)
private

Definition at line 549 of file MuonTrackHits_module.cc.

References calib::Calibrator::GetPECorrToGeVScale(), art::Event::isRealData(), and rawdata::RawDigit::SetMC().

549  {
550 
551  //Calibrator necessary to get Atten information
553  rb::CellHit cellhit;
554  if(!e.isRealData())cellhit.SetMC(); // assume only filled for MC...
555 
556  double pecorrtogev = calibrator->GetPECorrToGeVScale(cellhit);
557  return pecorrtogev;
558  }
double GetPECorrToGeVScale(rb::CellHit const &cellhit)
bool isRealData() const
Definition: Event.h:83
void SetMC(bool isMC=true)
Definition: RawDigit.h:106
A rawdata::RawDigit with channel information decoded.
Definition: CellHit.h:27
template<typename PROD , BranchType B>
ProductID art::EDFilter::getProductID ( std::string const &  instanceName = {}) const
inlineinherited

Definition at line 131 of file EDFilter.h.

References art::EDFilter::moduleDescription_.

Referenced by novaddt::HoughTrackMaker::create_associations().

132  {
133  return ProducerBase::getProductID<PROD, B>(moduleDescription_,
134  instanceName);
135  }
ModuleDescription moduleDescription_
Definition: EDFilter.h:124
template<typename PROD , BranchType B>
ProductID art::ProducerBase::getProductID ( ModuleDescription const &  moduleDescription,
std::string const &  instanceName 
) const
inherited

Definition at line 56 of file ProducerBase.h.

References art::ModuleDescription::moduleLabel().

Referenced by art::ProducerBase::modifiesEvent().

58  {
59  auto const& pd =
60  get_ProductDescription<PROD>(B, md.moduleLabel(), instanceName);
61  return pd.productID();
62  }
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 art::ProducerBase::modifiesEvent ( ) const
inlineinherited

Definition at line 40 of file ProducerBase.h.

References art::ProducerBase::getProductID(), and string.

41  {
42  return true;
43  }
static cet::exempt_ptr<Consumer> art::Consumer::non_module_context ( )
staticinherited
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited
void calib::MuonTrackHits::reconfigure ( fhicl::ParameterSet const &  p)

Definition at line 560 of file MuonTrackHits_module.cc.

References fhicl::ParameterSet::get(), and string.

561  {
562  fPCHitLabel = pset.get< std::string >("PCHitLabel"); //Label of PCHitList module
563  fQualXYName = pset.get< std::string >("QualXYName"); //Instance label, "XY" quality hits
564  fQualZName = pset.get< std::string >("QualZName"); //Instance label, "Z" quality hits
565  fQualAvgName = pset.get< std::string >("QualAvgName"); //Instance label, "Avg" quality hits
566  fStopperLabel = pset.get<std::string>("StopperLabel");
567  fSysShift = pset.get<double>("SysShift"); // track end point systematic shift
568  }
enum BeamMode string
void art::Consumer::showMissingConsumes ( ) const
protectedinherited

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

void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited

Member Data Documentation

int calib::MuonTrackHits::APD
private

Definition at line 113 of file MuonTrackHits_module.cc.

bool calib::MuonTrackHits::badTNS
private

Definition at line 123 of file MuonTrackHits_module.cc.

double calib::MuonTrackHits::cell
private

Definition at line 99 of file MuonTrackHits_module.cc.

int calib::MuonTrackHits::continuity
private

Definition at line 140 of file MuonTrackHits_module.cc.

double calib::MuonTrackHits::dCosX
private

Definition at line 132 of file MuonTrackHits_module.cc.

double calib::MuonTrackHits::dCosY
private

Definition at line 133 of file MuonTrackHits_module.cc.

double calib::MuonTrackHits::dCosZ
private

Definition at line 134 of file MuonTrackHits_module.cc.

int calib::MuonTrackHits::diblock
private

Definition at line 86 of file MuonTrackHits_module.cc.

double calib::MuonTrackHits::distanceToLiveDetEdgeZ
private

Definition at line 103 of file MuonTrackHits_module.cc.

int calib::MuonTrackHits::event
private

Definition at line 106 of file MuonTrackHits_module.cc.

uint32_t calib::MuonTrackHits::EventTimeHigh
private

Definition at line 98 of file MuonTrackHits_module.cc.

int calib::MuonTrackHits::evt_day
private

Definition at line 109 of file MuonTrackHits_module.cc.

int calib::MuonTrackHits::evt_hour
private

Definition at line 110 of file MuonTrackHits_module.cc.

int calib::MuonTrackHits::evt_min
private

Definition at line 111 of file MuonTrackHits_module.cc.

int calib::MuonTrackHits::evt_month
private

Definition at line 108 of file MuonTrackHits_module.cc.

int calib::MuonTrackHits::evt_sec
private

Definition at line 112 of file MuonTrackHits_module.cc.

int calib::MuonTrackHits::evt_year
private

Definition at line 107 of file MuonTrackHits_module.cc.

constexpr bool art::EDFilter::Fail {false}
staticinherited

Definition at line 33 of file EDFilter.h.

Referenced by evgen::GENIEFilter::filter().

TH2D* calib::MuonTrackHits::fdEdx
private

Definition at line 77 of file MuonTrackHits_module.cc.

TH2D* calib::MuonTrackHits::fdEdx_minus
private

Definition at line 78 of file MuonTrackHits_module.cc.

TH2D* calib::MuonTrackHits::fdEdx_plus
private

Definition at line 79 of file MuonTrackHits_module.cc.

TH2D* calib::MuonTrackHits::fdEdx_true
private

Definition at line 80 of file MuonTrackHits_module.cc.

double calib::MuonTrackHits::FlightLength
private

Definition at line 88 of file MuonTrackHits_module.cc.

std::string calib::MuonTrackHits::fPCHitLabel
private

Definition at line 142 of file MuonTrackHits_module.cc.

std::string calib::MuonTrackHits::fQualAvgName
private

Definition at line 145 of file MuonTrackHits_module.cc.

std::string calib::MuonTrackHits::fQualXYName
private

Definition at line 143 of file MuonTrackHits_module.cc.

std::string calib::MuonTrackHits::fQualZName
private

Definition at line 144 of file MuonTrackHits_module.cc.

std::string calib::MuonTrackHits::fStopperLabel
private

Definition at line 146 of file MuonTrackHits_module.cc.

double calib::MuonTrackHits::fSysShift
private

Definition at line 148 of file MuonTrackHits_module.cc.

TTree* calib::MuonTrackHits::fTree
private

Definition at line 83 of file MuonTrackHits_module.cc.

TTree* calib::MuonTrackHits::fTree_CalibTracks
private

Definition at line 84 of file MuonTrackHits_module.cc.

int calib::MuonTrackHits::hitId
private

Definition at line 121 of file MuonTrackHits_module.cc.

int calib::MuonTrackHits::navghits
private

Definition at line 117 of file MuonTrackHits_module.cc.

int calib::MuonTrackHits::nhits
private

Definition at line 116 of file MuonTrackHits_module.cc.

int calib::MuonTrackHits::ntricells
private

Definition at line 119 of file MuonTrackHits_module.cc.

int calib::MuonTrackHits::nXYHits
private

Definition at line 120 of file MuonTrackHits_module.cc.

int calib::MuonTrackHits::nzhits
private

Definition at line 118 of file MuonTrackHits_module.cc.

constexpr bool art::EDFilter::Pass {true}
staticinherited

Definition at line 32 of file EDFilter.h.

Referenced by evgen::GENIEFilter::filter().

double calib::MuonTrackHits::path
private
double calib::MuonTrackHits::PE
private

Definition at line 95 of file MuonTrackHits_module.cc.

double calib::MuonTrackHits::PECorr
private

Definition at line 96 of file MuonTrackHits_module.cc.

double calib::MuonTrackHits::PECorrToGeV
private

Definition at line 101 of file MuonTrackHits_module.cc.

double calib::MuonTrackHits::plane
private

Definition at line 92 of file MuonTrackHits_module.cc.

double calib::MuonTrackHits::RecoGeV
private

Definition at line 102 of file MuonTrackHits_module.cc.

int calib::MuonTrackHits::run
private

Definition at line 104 of file MuonTrackHits_module.cc.

Referenced by Metric.Metric::__repr__(), and fabricate.Builder::memoize().

int calib::MuonTrackHits::sameAPDhitDiblockEvent
private

Definition at line 115 of file MuonTrackHits_module.cc.

int calib::MuonTrackHits::sameAPDhitsEvent
private

Definition at line 114 of file MuonTrackHits_module.cc.

int calib::MuonTrackHits::subRun
private

Definition at line 105 of file MuonTrackHits_module.cc.

double calib::MuonTrackHits::tns
private

Definition at line 97 of file MuonTrackHits_module.cc.

int calib::MuonTrackHits::totalPlanes
private

Definition at line 137 of file MuonTrackHits_module.cc.

double calib::MuonTrackHits::TotalTrackLength
private

Definition at line 89 of file MuonTrackHits_module.cc.

double calib::MuonTrackHits::trueE
private

Definition at line 94 of file MuonTrackHits_module.cc.

int calib::MuonTrackHits::view
private

Definition at line 87 of file MuonTrackHits_module.cc.

double calib::MuonTrackHits::w
private

Definition at line 100 of file MuonTrackHits_module.cc.

double calib::MuonTrackHits::x
private
double calib::MuonTrackHits::xCust
private

Definition at line 91 of file MuonTrackHits_module.cc.

double calib::MuonTrackHits::xEnd
private

Definition at line 128 of file MuonTrackHits_module.cc.

int calib::MuonTrackHits::xPlanes
private

Definition at line 138 of file MuonTrackHits_module.cc.

double calib::MuonTrackHits::xStart
private

Definition at line 125 of file MuonTrackHits_module.cc.

double calib::MuonTrackHits::yEnd
private

Definition at line 129 of file MuonTrackHits_module.cc.

int calib::MuonTrackHits::yPlanes
private

Definition at line 139 of file MuonTrackHits_module.cc.

double calib::MuonTrackHits::yStart
private

Definition at line 126 of file MuonTrackHits_module.cc.

double calib::MuonTrackHits::zEnd
private

Definition at line 130 of file MuonTrackHits_module.cc.

double calib::MuonTrackHits::zStart
private

Definition at line 127 of file MuonTrackHits_module.cc.


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