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

Public Types

using ModuleType = EDProducer
 
using WorkerType = WorkerT< EDProducer >
 
template<typename UserConfig , typename KeysToIgnore = void>
using Table = ProducerBase::Table< UserConfig, KeysToIgnore >
 

Public Member Functions

 PCHitsList (fhicl::ParameterSet const &pset)
 
virtual ~PCHitsList ()
 
void produce (art::Event &e) override
 
void reconfigure (fhicl::ParameterSet const &p)
 
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 ()
 

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

bool IsGoodTrack (rb::Track const &track, rb::Cluster const &slice)
 
bool GoodSteps (rb::Track const &track)
 
void GetTrueEnergyPathAndLightForCell (const rb::Track *track, size_t const &ihit, double &mev, double &truePath, double &trueW, double &truePE, double &poissonLambda) const
 
double TrueW (const sim::FLSHit &fls) const
 
void ProcessTrack (const rb::Track *track, daqchannelmap::DAQChannelMap *cmap, std::vector< caldp::PCHit > *pcHitsXY, std::vector< caldp::PCHit > *pcHitsZ, std::vector< caldp::PCHit > *pcHitsAvg) const
 
void ProcessTrackTrajectory (const rb::Track *track, daqchannelmap::DAQChannelMap *cmap, std::set< double > const &zPlaneBounds, std::vector< caldp::PCHit > *pcHitsTraj) const
 
void ProcessTrackForBelowThresholdHits (const rb::Track *track, daqchannelmap::DAQChannelMap *cmap, std::vector< caldp::PCHit > *pcHitsXYThresh) const
 
void ProcessTrackForFLSHits (const rb::Track *track2, daqchannelmap::DAQChannelMap *cmap, std::vector< caldp::PCHit > *pcHitsXY) const
 
caldp::PCHit CellHitToPCHit (const rb::CellHit *chit, const rb::Track *trk, double const &path, double const &mev, double const &truePE, double const &truePath, double const &trueW, double const &poissonLambda, daqchannelmap::DAQChannelMap *cmap) const
 

Private Attributes

std::string fCosmicLabel
 
std::string fQualXYName
 
std::string fQualZName
 
std::string fQualAvgName
 
std::string fQualTrajName
 
std::string fQualXYThreshName
 
std::string fQualXYFLSName
 
bool fIsBeam
 
double fPathCut
 Only keep hits with pathlength less than this. More...
 
double fMinPath
 Only keep hits with pathlength greater than this. More...
 
int fExtentZCut
 Only keep tracks crossing this distance in z. More...
 
double fDirZCut
 Only keep tracks shallower than this. More...
 
double fCompletenessCut
 Only keep tracks with more than this fraction of slice hits included in each view. More...
 
double fMaxVtxDistFromEdge
 Only keep tracks with an initial point within this dist (cm) from the edge. More...
 
double fMaxEndDistFromEdge
 Only keep tracks whose final point is not more than this distance from the edge. More...
 
double fBadStepSizeLimit
 Only keep tracks without steps outside this limit, see GoodSteps comments. More...
 
double fMaxCellsPerPlane
 Only keep tracks with fewer <cells/plane> than this limit. More...
 
double fMaxDeltaEndPlane
 
double fMaxPlaneAsymmetry
 
art::ServiceHandle< cheat::BackTrackerfBT
 
art::ServiceHandle< geo::GeometryfGeom
 
art::ServiceHandle< geo::LiveGeometryfLiveGeom
 
art::ServiceHandle< ds::DetectorServicefDS
 

Detailed Description

Definition at line 45 of file PCHitsList_module.cc.

Member Typedef Documentation

using art::EDProducer::ModuleType = EDProducer
inherited

Definition at line 34 of file EDProducer.h.

template<typename UserConfig , typename KeysToIgnore = void>
using art::EDProducer::Table = ProducerBase::Table<UserConfig, KeysToIgnore>
inherited

Definition at line 43 of file EDProducer.h.

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

Definition at line 35 of file EDProducer.h.

Constructor & Destructor Documentation

calib::PCHitsList::PCHitsList ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 134 of file PCHitsList_module.cc.

135  {
136  reconfigure(pset);
137 
138  produces< std::vector<caldp::PCHit> >(fQualXYName);
139  produces< std::vector<caldp::PCHit> >(fQualZName);
140  produces< std::vector<caldp::PCHit> >(fQualAvgName);
141  produces< std::vector<caldp::PCHit> >(fQualTrajName);
142  produces< std::vector<caldp::PCHit> >(fQualXYThreshName);
143  produces< std::vector<caldp::PCHit> >(fQualXYFLSName);
144 
145  produces< art::Assns<caldp::PCHit, rb::Track> >(fQualXYName);
146  produces< art::Assns<caldp::PCHit, rb::Track> >(fQualZName);
147  produces< art::Assns<caldp::PCHit, rb::Track> >(fQualAvgName);
148  produces< art::Assns<caldp::PCHit, rb::Track> >(fQualTrajName);
149  produces< art::Assns<caldp::PCHit, rb::Track> >(fQualXYThreshName);
150  produces< art::Assns<caldp::PCHit, rb::Track> >(fQualXYFLSName);
151  }
std::string fQualXYThreshName
std::string fQualXYFLSName
void reconfigure(fhicl::ParameterSet const &p)
calib::PCHitsList::~PCHitsList ( )
virtual

Definition at line 155 of file PCHitsList_module.cc.

156  {
157  }

Member Function Documentation

caldp::PCHit calib::PCHitsList::CellHitToPCHit ( const rb::CellHit chit,
const rb::Track trk,
double const &  path,
double const &  mev,
double const &  truePE,
double const &  truePath,
double const &  trueW,
double const &  poissonLambda,
daqchannelmap::DAQChannelMap cmap 
) const
private

Definition at line 866 of file PCHitsList_module.cc.

References std::abs(), febshutoff_auto::apd, rb::CellHit::Cell(), febshutoff_auto::dcm, DEFINE_ART_MODULE(), geo2elec::diblock, rb::Track::DistanceFromStart(), daqchannelmap::DAQChannelMap::encodeDChan(), daqchannelmap::DAQChannelMap::encodeLChan(), daqchannelmap::DAQChannelMap::getDCM(), daqchannelmap::DAQChannelMap::getDiBlock(), daqchannelmap::DAQChannelMap::getFEB(), daqchannelmap::DAQChannelMap::getPixel(), calib::GetXYZD(), rb::CellHit::GoodTiming(), rb::CellHit::OfflineChan(), rb::CellHit::PE(), rb::CellHit::Plane(), caldp::PCHit::SetAPD(), caldp::PCHit::SetCell(), caldp::PCHit::SetDCM(), caldp::PCHit::SetDiblock(), caldp::PCHit::SetFlightLen(), caldp::PCHit::SetGoodTime(), caldp::PCHit::SetPath(), caldp::PCHit::SetPE(), caldp::PCHit::SetPixel(), caldp::PCHit::SetPlane(), caldp::PCHit::SetPoissonLambda(), caldp::PCHit::SetReadDist(), caldp::PCHit::SetTNS(), caldp::PCHit::SetTrueMeV(), caldp::PCHit::SetTruePath(), caldp::PCHit::SetTruePE(), caldp::PCHit::SetTrueW(), caldp::PCHit::SetView(), caldp::PCHit::SetW(), rb::CellHit::TNS(), rb::CellHit::View(), w, and rb::Track::W().

875  {
876  //get more information on hit location
877  uint32_t lchan = cmap->encodeLChan(fGeom->DetId(), chit->Plane(), chit->Cell());
878  uint32_t dchan = cmap->encodeDChan(lchan);
879  uint32_t pixel = cmap->getPixel(dchan);
880  uint32_t apd = cmap->getFEB(dchan);
881  uint32_t dcm = cmap->getDCM(dchan);
882  uint32_t diblock = cmap->getDiBlock(dchan);
883 
884  double w = trk->W(chit);
885 
886  //get distance to readout electronics
887  double xyzd[4];
888  GetXYZD(chit->OfflineChan(), w, xyzd);
889  //make sure the reconstructed hit coordinate is inside the physical
890  //detector if not then change the distance to the electronics to -1.0
891  if(std::abs(xyzd[0]) > fGeom->DetHalfWidth() ||
892  std::abs(xyzd[1]) > fGeom->DetHalfHeight() ||
893  xyzd[2] > fGeom->DetLength() ||
894  xyzd[2] < 0.0) xyzd[3] = -1.0;
895 
896  double flightlen = trk->DistanceFromStart(xyzd[2]);
897 
898  //Define and fill a PCHit for this cell hit
899  caldp::PCHit pchit;
900  pchit.SetPlane ( chit->Plane() ); //Set plane number
901  pchit.SetCell ( chit->Cell() ); //Set cell number
902  pchit.SetPixel ( pixel ); //Set pixel number
903  pchit.SetAPD ( apd ); //Set apd number
904  pchit.SetDCM ( dcm ); //Set dcm number
905  pchit.SetDiblock ( diblock ); //set diblock number
906  pchit.SetView ( chit->View() ); //set hit view
907  pchit.SetPE ( chit->PE() ); //Set uncalibrated PE
908  pchit.SetPath ( path ); //Set path length
909  pchit.SetW ( w ); //Set W (unmeasured coordinate) value
910  pchit.SetTrueMeV ( mev ); //Set true energy of hit
911  pchit.SetTruePE ( truePE ); //Set true PE of hit
912  pchit.SetTruePath ( truePath ); //Set true pathlength through cell
913  pchit.SetTrueW ( trueW );
914  pchit.SetPoissonLambda(poissonLambda );
915  pchit.SetTNS ( chit->TNS() ); //Set time of hit
916  pchit.SetFlightLen ( flightlen ); //Set path from start of track to hit
917  pchit.SetReadDist ( xyzd[3] ); //Set distance from hit to readout electronics
918  pchit.SetGoodTime ( chit->GoodTiming()); //Set if cell had a proper time fit
919 
920  return pchit;
921  } // end CellHitToPCHit
float TNS() const
Definition: CellHit.h:46
void SetTNS(float aTNS)
Set hit time (ns)
Definition: PCHit.h:91
diblock
print "ROW IS " print row
Definition: geo2elec.py:31
void SetPE(float aPE)
Set PE value.
Definition: PCHit.h:77
void SetAPD(int aAPD)
Set apd value.
Definition: PCHit.h:71
void SetPixel(int aPixel)
Set pixel value.
Definition: PCHit.h:73
virtual double W(const rb::CellHit *chit) const
Estimate the unmeasured coordinate of chit.
Definition: Track.cxx:281
void SetFlightLen(float aLen)
Set path length from start of track.
Definition: PCHit.h:95
unsigned short Plane() const
Definition: CellHit.h:39
void SetPoissonLambda(float aLambda)
Set number of simulated photons at readout before fluctuations.
Definition: PCHit.h:99
geo::View_t View() const
Definition: CellHit.h:41
void SetTruePE(float aTruePE)
Set True PE value.
Definition: PCHit.h:85
double DetLength() const
geo::OfflineChan OfflineChan() const
Definition: CellHit.h:49
lchan encodeLChan(int detId, plane_t plane, cell_t cell) const
float abs(float number)
Definition: d0nt_math.hpp:39
void SetTrueW(float aTrueW)
Set True W value.
Definition: PCHit.h:89
"Pre-calibration hit". Common input to calibration procedures
Definition: PCHit.h:16
art::ServiceHandle< geo::Geometry > fGeom
unsigned short Cell() const
Definition: CellHit.h:40
void SetView(geo::View_t aView)
Set view value.
Definition: PCHit.h:75
void SetReadDist(float aDist)
Set distance to cell readout.
Definition: PCHit.h:97
void SetPath(float aPath)
Set Path value.
Definition: PCHit.h:79
void SetGoodTime(bool aGoodT)
Set quality of timing fit.
Definition: PCHit.h:93
novadaq::cnv::DetId DetId() const
Prefer ds::DetectorService::DetId() instead.
Definition: GeometryBase.h:243
float PE() const
Definition: CellHit.h:42
void GetXYZD(geo::OfflineChan chan, double w, double *xyzd)
Return position in world coordninates and distance to the readout.
Definition: CalibUtil.cxx:294
void SetDCM(int aDCM)
Set dcm value.
Definition: PCHit.h:69
void SetDiblock(int aDiblock)
Set diblock value.
Definition: PCHit.h:67
double DetHalfHeight() const
virtual double DistanceFromStart(double z) const
Definition: Track.cxx:229
const std::string path
Definition: plot_BEN.C:43
pixel_t getPixel(dchan daqchan) const
Decode the pixel id from a dchan.
double DetHalfWidth() const
void SetPlane(int aPlane)
Set plane value.
Definition: PCHit.h:63
void SetW(float aW)
Set W value.
Definition: PCHit.h:81
dcm_id_t getDCM(dchan daqchan) const
Decode the dcm ID from a dchan.
dchan encodeDChan(int detID, diblock_t diblock, dcm_id_t dcm, feb_t feb, pixel_t pixel) const
bool GoodTiming() const
Definition: CellHit.h:48
uint32_t dchan
< DAQ Channel Map Package
void SetTruePath(float aTruePath)
Set True path length value.
Definition: PCHit.h:87
Float_t w
Definition: plot.C:20
diblock_t getDiBlock(dchan daqchan) const
Decode the diblock ID from a dchan.
void SetCell(int aCell)
Set cell value.
Definition: PCHit.h:65
feb_t getFEB(dchan daqchan) const
Decode the feb id from a dchan.
void SetTrueMeV(float aTrueMeV)
Set True energy (MeV) value.
Definition: PCHit.h:83
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::EDProducer::currentContext ( ) const
protectedinherited
seed_t art::EngineCreator::get_seed_value ( fhicl::ParameterSet const &  pset,
char const  key[] = "seed",
seed_t const  implicit_seed = -1 
)
inherited
template<typename PROD , BranchType B>
ProductID art::EDProducer::getProductID ( std::string const &  instanceName = {}) const
inlineinherited

Definition at line 123 of file EDProducer.h.

References art::EDProducer::moduleDescription_.

Referenced by skim::NueSkimmer::CopyMichelSlice(), and skim::NueSkimmer::CopyMichelTrack().

124  {
125  return ProducerBase::getProductID<PROD, B>(moduleDescription_,
126  instanceName);
127  }
ModuleDescription moduleDescription_
Definition: EDProducer.h:115
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  }
void calib::PCHitsList::GetTrueEnergyPathAndLightForCell ( const rb::Track track,
size_t const &  ihit,
double &  mev,
double &  truePath,
double &  trueW,
double &  truePE,
double &  poissonLambda 
) const
private

Definition at line 465 of file PCHitsList_module.cc.

References rb::CellHit::Cell(), rb::Cluster::Cell(), getGoodRuns4SAM::n, and rb::CellHit::Plane().

472  {
473 
474  if (fBT->HaveTruthInfo()){
475  const std::vector<cheat::TrackIDE> ides = fBT->HitToTrackIDE(track->Cell(ihit));
476 
477  for(size_t n = 0; n < ides.size(); ++n){
478  mev += ides[n].energy*1000;
479 
480  // the ides are sorted to have the most contributing track id be first in the list
481  // so grab that track id and get the particle it corresponds to
482  if(n < 1){
483  auto particle = fBT->ParticleNavigator()[ides[n].trackID];
484 
485  std::vector<sim::FLSHit> flsHits = fBT->ParticleToFLSHit(particle->TrackId(), particle->PdgCode());
486  for(auto fls : flsHits){
487  if(fls.GetPlaneID() == track->Cell(ihit)->Plane() &&
488  fls.GetCellID() == track->Cell(ihit)->Cell() ){
489  truePath = fls.GetTotalPathLength();
490  trueW = TrueW(fls);
491  break;
492  }
493  }
494  } // end if on the first ide
495  } // end loop over ides
496 
497  const std::vector<sim::PhotonSignal> pes = fBT->HitToPhotonSignal(track->Cell(ihit));
498  for(size_t n = 0; n < pes.size(); ++n){
499  truePE += pes[n].NPhoton();
500  poissonLambda += pes[n].PoissonLambda();
501  }
502 
503  }
504 
505  return;
506  }
std::vector< TrackIDE > HitToTrackIDE(const rb::CellHit &hit, bool useBirksE=false) const
Convenience function. HitsToTrackIDE but for a single hit.
const sim::ParticleNavigator & ParticleNavigator() const
Get a reference to the ParticleNavigator.
Definition: BackTracker.h:744
unsigned short Plane() const
Definition: CellHit.h:39
std::vector< sim::FLSHit > ParticleToFLSHit(const int &trackID) const
All the FLSHits that were created by the track id trackID, sorted from most to least light...
unsigned short Cell() const
Definition: CellHit.h:40
double TrueW(const sim::FLSHit &fls) const
art::Ptr< rb::CellHit > Cell(geo::View_t view, unsigned int viewIdx) const
Get the ith cell from view view.
Definition: Cluster.cxx:145
const std::vector< sim::PhotonSignal > HitToPhotonSignal(const art::Ptr< rb::CellHit > &hit) const
Returns the PhotonSignals contributing the signal in the specified hit.
bool HaveTruthInfo() const
Is this a file with truth info in? (Is BackTracker going to be any use to you?)
Definition: BackTracker.h:133
art::ServiceHandle< cheat::BackTracker > fBT
bool calib::PCHitsList::GoodSteps ( rb::Track const &  track)
private

Definition at line 424 of file PCHitsList_module.cc.

References Mag(), std::max(), median(), rb::Track::NTrajectoryPoints(), gen_flatrecord::size, confusionMatrixTree::t, and rb::Track::TrajectoryPoint().

425  {
426 
427  // first find the median step size
428  size_t size = track.NTrajectoryPoints() - 1;
429 
430  // track with only two distances between trajectory points,
431  // probably not very useful for the analysis so return false
432  if(size < 3) return false;
433 
434  std::vector<float> stepsize(size, 0.);
435  float largestStep = -1.;
436  for(size_t t = 1; t < size+1; ++t){
437  TVector3 const& tp1 = track.TrajectoryPoint(t-1);
438  TVector3 const& tp2 = track.TrajectoryPoint(t);
439  stepsize[t-1] = (tp1 - tp2).Mag();
440  largestStep = std::max(stepsize[t-1], largestStep);
441  }
442 
443  // sort the vector of step sizes and find the median
444  std::sort(stepsize.begin(), stepsize.end());
445 
446  float median = 0.;
447  if(size%2 == 0)
448  median = 0.5*(stepsize[size/2] + stepsize[(size/2) - 1]);
449  else
450  median = stepsize[size/2];
451 
452  // the median represents the value of the step size
453  // distribution where half of the distribution is
454  // below that value and half is above it. If the
455  // largest step is more than twice the median, then
456  // it is very far outside the distribution and this
457  // track was not well reconstructed
458  if(largestStep > median*fBadStepSizeLimit) return false;
459 
460  return true;
461  }
T max(const caf::Proxy< T > &a, T b)
Definition: event.h:19
double fBadStepSizeLimit
Only keep tracks without steps outside this limit, see GoodSteps comments.
double median(TH1D *h)
Definition: absCal.cxx:524
float Mag() const
bool calib::PCHitsList::IsGoodTrack ( rb::Track const &  track,
rb::Cluster const &  slice 
)
private

Definition at line 304 of file PCHitsList_module.cc.

References std::abs(), plot_validation_datamc::c, rb::Cluster::Cell(), rb::Prong::Dir(), dx, dy, dz, e, std::isnan(), novadaq::cnv::kFARDET, geo::kX, geo::kY, LOG_DEBUG, std::max(), rb::Cluster::MaxPlane(), rb::Cluster::MinPlane(), rb::Cluster::NCell(), rb::Cluster::NXCell(), rb::Cluster::NYCell(), rb::CellHit::Plane(), util::pythag(), rb::Prong::Start(), rb::Track::Stop(), and rb::CellHit::View().

306  {
307  LOG_DEBUG("PCHitsList") << "NCellsX=" << track.NXCell() << " NCellsY=" << track.NYCell();
308 
309  //Track must have at least two X cells and 2 Y cells:
310  if(track.NXCell() < 2 || track.NYCell() < 2) {
311  LOG_DEBUG("PCHitsList") << "!---->Failed NCell Cut!";
312  return false;
313  }
314 
315  //Check that direction vector is well-defined:
316  const TVector3 dr = track.Dir().Unit();
317  const double dx = std::abs(dr.X());
318  const double dy = std::abs(dr.Y());
319  const double dz = std::abs(dr.Z());
320 
321  //No undefined directions:
322  if(std::isnan(dx) ||
323  std::isnan(dy) ||
324  std::isnan(dz)) return false;
325 
326  //At least one direction must be non-zero:
327  if(dx == 0 &&
328  dy == 0 &&
329  dz == 0) {
330  LOG_DEBUG("PCHitsList") << "!---->Failed Direction Cut!";
331  return false;
332  }
333 
334  //Must be a unit vector (otherwise, abort event, something went very wrong):
335  if ( std::abs( util::pythag(dx, dy, dz)-1 ) > 1e-4){
336  throw cet::exception("SkipEvent") << "ERROR: Direction was not a unit vector. Skipping Event.\n";
337  }
338 
339  // Additional quality cuts. These remove tracks that often have
340  // badly-reconstructed W positions.
341 
342  // Cut very steep tracks two ways. These can be misreconstructed, or
343  // they can simply make it difficult for the W estimation to do a good
344  // job. OK to use the rb::Track::Dir() method here because the initial
345  // direction of the track is what we want to cut on
346  if(std::abs(track.Start().Z() - track.Stop().Z() ) <= fExtentZCut ||
347  std::abs(track.Dir().Z()) < fDirZCut) return false;
348 
349  // Cut out actual reconstruction failures, where the track doesn't use
350  // a significant amount of the slice hits. If either view is not
351  // complete enough discard the whole thing
352  if(track.NXCell() < fCompletenessCut*slice.NXCell() ||
353  track.NYCell() < fCompletenessCut*slice.NYCell()) return false;
354 
355  // Check that the average number of cells per plane is similar in
356  // each view. If the value is very high in either view, or larger in
357  // one view than the other then you might have some form of FEB flash
358  // or cosmic ray brem that will mess up the calibration
359  std::set<unsigned short> xPlaneList;
360  std::set<unsigned short> yPlaneList;
361  for(size_t c = 0; c < track.NCell(); ++c){
362  if (track.Cell(c)->View() == geo::kX) xPlaneList.insert(track.Cell(c)->Plane());
363  else if(track.Cell(c)->View() == geo::kY) yPlaneList.insert(track.Cell(c)->Plane());
364  }// end loop over cells in track
365 
366  double xCells = track.NXCell();
367  double yCells = track.NYCell();
368  double xPlanes = 1. * xPlaneList.size();
369  double yPlanes = 1. * yPlaneList.size();
370  double cellsPerPlaneX = (xPlanes > 0) ? xCells/xPlanes : 999.;
371  double cellsPerPlaneY = (yPlanes > 0) ? yCells/yPlanes : 999.;
372  if( std::max(cellsPerPlaneX, cellsPerPlaneY) > fMaxCellsPerPlane ) return false;
373 
374  // remove tracks where there is an asymmetry between the number
375  // of planes hit in each view. One class of asymmetry is where
376  // there are extra planes off either end of the track in one view.
377  // Since there is no information in the other view for those planes
378  // you can't be sure you got the length/containment correct
379  double xStart = track.MaxPlane(geo::kX);
380  double yStart = track.MaxPlane(geo::kY);
381  double xEnd = track.MinPlane(geo::kX);
382  double yEnd = track.MinPlane(geo::kY);
383  if(std::abs(xStart - yStart) > fMaxDeltaEndPlane ||
384  std::abs(xEnd - yEnd ) > fMaxDeltaEndPlane ||
385  std::abs(xPlanes - yPlanes) > fMaxPlaneAsymmetry*(xPlanes + yPlanes) ) return false;
386 
387 
388  // Check that the track doesn't take one or two big steps
389  // compared to the rest, that is usually a reconstruction failure.
390  if(!this->GoodSteps(track) ) return false;
391 
392  int junk = -999;
393 
394  // Remove tracks whose vertex position is well away from the edge of the
395  // detector. Muon catcher is not counted as part of the detector proper in
396  // ND so have to check for that as well.
401  return false;
402  }
403 
404  // Remove tracks whose end position is more than fMaxEndDistFromEdge
405  // outside of the detector The minus sign is because LiveGeometry returns a
406  // negative value if the point is outside of the active detector. A track
407  // can stop anywhere inside the detector and still be OK.
408  if( !fIsBeam && (fLiveGeom->DistToEdgeXY(track.Stop()) < -fMaxEndDistFromEdge ||
412  return false;
413  }
414 
415  return true;
416  }
T max(const caf::Proxy< T > &a, T b)
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
novadaq::cnv::DetId DetId() const
What detector are we in?
int fExtentZCut
Only keep tracks crossing this distance in z.
double DistToEdgeXY(TVector3 vertex)
Vertical planes which measure X.
Definition: PlaneGeo.h:28
Definition: event.h:19
double DistanceToEdgeInMC(TVector3 vertex, int &wall)
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
double fMaxEndDistFromEdge
Only keep tracks whose final point is not more than this distance from the edge.
float abs(float number)
Definition: d0nt_math.hpp:39
Horizontal planes which measure Y.
Definition: PlaneGeo.h:29
int isnan(const stan::math::var &a)
Definition: std_isnan.hpp:18
double fCompletenessCut
Only keep tracks with more than this fraction of slice hits included in each view.
Far Detector at Ash River, MN.
double dy[NP][NC]
double dx[NP][NC]
double DistToEdgeZ(TVector3 vertex)
double dz[NP][NC]
art::ServiceHandle< geo::LiveGeometry > fLiveGeom
double pythag(double x, double y)
2D Euclidean distance
Definition: MathUtil.h:29
art::ServiceHandle< ds::DetectorService > fDS
double fMaxVtxDistFromEdge
Only keep tracks with an initial point within this dist (cm) from the edge.
double fDirZCut
Only keep tracks shallower than this.
Float_t e
Definition: plot.C:35
double fMaxCellsPerPlane
Only keep tracks with fewer <cells/plane> than this limit.
bool GoodSteps(rb::Track const &track)
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::PCHitsList::ProcessTrack ( const rb::Track track,
daqchannelmap::DAQChannelMap cmap,
std::vector< caldp::PCHit > *  pcHitsXY,
std::vector< caldp::PCHit > *  pcHitsZ,
std::vector< caldp::PCHit > *  pcHitsAvg 
) const
private

Definition at line 537 of file PCHitsList_module.cc.

References calib::BestPathEstimates(), rb::CellHit::Cell(), rb::Cluster::Cell(), art::Ptr< T >::get(), calib::kAverage, calib::kBadTrack, calib::kXYAdjacents, calib::kZAdjacents, LOG_DEBUG, rb::Cluster::NCell(), rb::Cluster::OfflineChans(), path, TB_WatchdogFx::paths, rb::CellHit::PE(), rb::CellHit::Plane(), rb::Track::PlaneDirMap(), and rb::Track::W().

542  {
543  std::vector<rb::CellHit> chits;
544  for(unsigned int ihit = 0; ihit < track->NCell(); ++ihit){
545  chits.push_back(*track->Cell(ihit).get());
546  }
547 
548  //Calculate path quality:
549  std::vector<EPathQuality> quals;
550  const std::vector<double> paths = BestPathEstimates(track->OfflineChans(), track->PlaneDirMap(), quals);
551 
552  //Check there is a path and quality measure for each cell; if not, something wrong, abort event:
553  if(chits.size() != quals.size() ||
554  chits.size() != paths.size()){
555  throw cet::exception("SkipEvent") << "ERROR: Number of pathlengths or qualities != number of cells. Skipping Event.\n";
556  }
557 
558  //Loop through cells in track:
559  for(size_t ihit = 0; ihit < chits.size(); ++ihit){
560 
561  //Get hit
562  const rb::CellHit& chit = chits[ihit];
563 
564  //Get path:
565  const double path = paths[ihit]; //RBT: Way of ensuring cell and path line up??
566 
567  //Check path not too long:
568  if(path > fPathCut) continue;
569 
570  //Get the correct MeV and true PE in this hit
571  double mev = 0.;
572  double truePE = 0.;
573  double poissonLambda = 0.;
574  double truePath = 0.;
575  double trueW = -9999.;
576  this->GetTrueEnergyPathAndLightForCell(track, ihit, mev, truePath, trueW, truePE, poissonLambda);
577 
578  caldp::PCHit pchit = CellHitToPCHit(&chit, track,
579  path, mev, truePE, truePath, trueW, poissonLambda,
580  cmap);
581 
582  switch(quals[ihit]){
583 
584  case kXYAdjacents:
585  LOG_DEBUG("PCHitsList")
586  << "Quality XY! - hit=" << ihit << " FILLS TO -> plane=" << chit.Plane()
587  << " cell=" << chit.Cell() << " pe=" << chit.PE() << " path=" << path
588  << " W=" << track->W(&chit) << " mev=" << mev;
589  pcHitsXY->push_back(pchit);
590  break;
591 
592  case kZAdjacents:
593  LOG_DEBUG("PCHitsList")
594  << "Quality Z! - hit=" << ihit << " FILLS TO -> plane=" << chit.Plane()
595  << " cell=" << chit.Cell() << " pe=" << chit.PE() << " path=" << path
596  << " W=" << track->W(&chit) << " mev=" << mev;
597  pcHitsZ->push_back(pchit);
598  break;
599 
600  case kAverage:
601  LOG_DEBUG("PCHitsList")
602  << "Quality Avg! - hit=" << ihit << " FILLS TO -> plane=" << chit.Plane()
603  << " cell=" << chit.Cell() << " pe=" << chit.PE() << " path=" << path
604  << " W=" << track->W(&chit) << " mev=" << mev;
605  pcHitsAvg->push_back(pchit);
606  break;
607 
608  case kBadTrack:
609  LOG_DEBUG("PCHitsList") << "!!!!!!BAD hit/track!!!!!! - hit=" << ihit;
610  // Something wrong with this hit/track, so do nothing
611  break;
612 
613  default:
614  throw cet::exception("SkipEvent") << "ERROR: Unknown Path Quality type. Skipping Event.\n";
615  //Unknown path type; something went very wrong; abort this event.
616  }
617 
618  }//End cell loop
619 
620  }//end ProcessTrack
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
caldp::PCHit CellHitToPCHit(const rb::CellHit *chit, const rb::Track *trk, double const &path, double const &mev, double const &truePE, double const &truePath, double const &trueW, double const &poissonLambda, daqchannelmap::DAQChannelMap *cmap) const
std::vector< geo::OfflineChan > OfflineChans() const
Positions of all the CellHits.
Definition: Cluster.cxx:190
unsigned int NCell(geo::View_t view) const
Number of cells in view view.
Definition: Cluster.cxx:134
void GetTrueEnergyPathAndLightForCell(const rb::Track *track, size_t const &ihit, double &mev, double &truePath, double &trueW, double &truePE, double &poissonLambda) const
virtual double W(const rb::CellHit *chit) const
Estimate the unmeasured coordinate of chit.
Definition: Track.cxx:281
unsigned short Plane() const
Definition: CellHit.h:39
std::vector< double > BestPathEstimates(std::vector< geo::OfflineChan > const &chans, std::map< unsigned int, TVector3 > const &directions, std::vector< EPathQuality > &quals, std::vector< geo::OfflineChan > const &extras)
Definition: CalibUtil.cxx:98
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
"Pre-calibration hit". Common input to calibration procedures
Definition: PCHit.h:16
unsigned short Cell() const
Definition: CellHit.h:40
float PE() const
Definition: CellHit.h:42
const std::string path
Definition: plot_BEN.C:43
std::map< unsigned int, TVector3 > PlaneDirMap() const
map of the direction cosines at each plane (ie z)
Definition: Track.cxx:496
art::Ptr< rb::CellHit > Cell(geo::View_t view, unsigned int viewIdx) const
Get the ith cell from view view.
Definition: Cluster.cxx:145
A rawdata::RawDigit with channel information decoded.
Definition: CellHit.h:27
T const * get() const
Definition: Ptr.h:321
double fPathCut
Only keep hits with pathlength less than this.
void calib::PCHitsList::ProcessTrackForBelowThresholdHits ( const rb::Track track,
daqchannelmap::DAQChannelMap cmap,
std::vector< caldp::PCHit > *  pcHitsXYThresh 
) const
private

Definition at line 693 of file PCHitsList_module.cc.

References rb::Cluster::AllCells(), getBrightness::cell, febshutoff_auto::chan, APDHVSetting::dummy, calib::FindBelowThresholdCalibCandidates(), calib::kXYAdjacents, rb::Cluster::OfflineChans(), submit_concat_project::parts, path, NDAPDHVSetting::plane, rb::Track::PlaneDirMap(), rb::CellHit::SetCell(), rb::CellHit::SetPlane(), rb::CellHit::SetView(), and POTSpillRate::view.

696  {
697  std::map<geo::OfflineChan, double> trueE;
698  std::map<geo::OfflineChan, double> truePE;
699  std::map<geo::OfflineChan, double> truePath;
700  std::map<geo::OfflineChan, double> trueW;
701  std::map<geo::OfflineChan, double> poissonLambda;
702  if(fBT->HaveTruthInfo()){
703  const std::vector<const sim::Particle*> parts = fBT->HitsToParticle(track->AllCells());
704  if(!parts.empty()){
705  const int id = parts[0]->TrackId(); // Biggest contributor
706  std::set<geo::OfflineChan> flsChans;
707  const std::vector<sim::FLSHit> flss = fBT->ParticleToFLSHit(id);
708  for(const sim::FLSHit& fls: flss){
709  const geo::OfflineChan chan(fls.GetPlaneID(), fls.GetCellID());
710  trueE[chan] += 1000*fls.GetEdep();
711  truePath[chan] = fls.GetTotalPathLength();
712  trueW[chan] = TrueW(fls);
713  flsChans.insert(chan);
714  }
715 
716  for(geo::OfflineChan chan: flsChans){
717  // We won't have an actual CellHit for this cell, so have to use
718  // CellTo not HitTo. Could try to do something clever with matching
719  // the times up. But this must be a small effect.
720  const std::vector<sim::PhotonSignal> pes = fBT->CellToPhotonSignal(chan.Plane(), chan.Cell());
721  for(sim::PhotonSignal pe: pes){
722  truePE[chan] += pe.NPhoton();
723  poissonLambda[chan] += pe.PoissonLambda();
724  }
725  }
726  }
727  }
728 
729  // Find cells that would have made it into the sample if they'd been
730  // hit. Downstream analyzers can interpret these as a threshold effect.
731  std::vector<EPathQuality> threshQuals;
732  std::vector<double> threshPaths;
733  std::vector<geo::OfflineChan> threshChans;
734 
735  FindBelowThresholdCalibCandidates(track->OfflineChans(), track->PlaneDirMap(), threshQuals, threshPaths, threshChans);
736 
737  for(unsigned int threshIdx = 0; threshIdx < threshQuals.size(); ++threshIdx){
738  const double path = threshPaths[threshIdx];
739  // Check path not too long. Apply same cut as normal candidates so as
740  // not to bias ourselves.
741  if(path > 10) continue;
742 
743  const int plane = threshChans[threshIdx].Plane();
744  const int cell = threshChans[threshIdx].Cell();
745  const geo::OfflineChan chan(plane, cell);
746  const geo::View_t view = fGeom->Plane(plane)->View();
748  dummy.SetPlane(plane);
749  dummy.SetCell(cell);
750  dummy.SetView(view);
751 
752  caldp::PCHit pchit = CellHitToPCHit(&dummy, track,
753  path, trueE[chan],
754  truePE[chan], truePath[chan], trueW[chan], poissonLambda[chan],
755  cmap);
756 
757  if(threshQuals[threshIdx] == kXYAdjacents)
758  pcHitsXYThresh->push_back(pchit);
759  } // end for threshIdx
760 
761  } // end ProcessTrackForBelowThresholdHits
caldp::PCHit CellHitToPCHit(const rb::CellHit *chit, const rb::Track *trk, double const &path, double const &mev, double const &truePE, double const &truePath, double const &trueW, double const &poissonLambda, daqchannelmap::DAQChannelMap *cmap) const
std::vector< geo::OfflineChan > OfflineChans() const
Positions of all the CellHits.
Definition: Cluster.cxx:190
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
std::vector< sim::FLSHit > ParticleToFLSHit(const int &trackID) const
All the FLSHits that were created by the track id trackID, sorted from most to least light...
A single unit of energy deposition in the liquid scintillator.
Definition: FLSHit.h:19
const PlaneGeo * Plane(unsigned int i) const
"Pre-calibration hit". Common input to calibration procedures
Definition: PCHit.h:16
art::PtrVector< rb::CellHit > AllCells() const
Get all cells from both views.
Definition: Cluster.cxx:180
art::ServiceHandle< geo::Geometry > fGeom
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
View_t View() const
Which coordinate does this plane measure.
Definition: PlaneGeo.h:53
double TrueW(const sim::FLSHit &fls) const
void FindBelowThresholdCalibCandidates(const std::vector< geo::OfflineChan > &trkchans, const std::map< unsigned int, TVector3 > &directions, std::vector< EPathQuality > &quals, std::vector< double > &paths, std::vector< geo::OfflineChan > &chans)
Find empty cells that would have contributed to the calibration if they&#39;d been hit. We assume they fell below threshold.
Definition: CalibUtil.cxx:232
const std::string path
Definition: plot_BEN.C:43
std::map< unsigned int, TVector3 > PlaneDirMap() const
map of the direction cosines at each plane (ie z)
Definition: Track.cxx:496
const std::vector< sim::PhotonSignal > CellToPhotonSignal(unsigned int const &plane, unsigned int const &cell) const
Returns the PhotonSignals contributing the signal in the specified cell. WARNING: Use with extreme ca...
A rawdata::RawDigit with channel information decoded.
Definition: CellHit.h:27
A (plane, cell) pair.
Definition: OfflineChan.h:17
bool HaveTruthInfo() const
Is this a file with truth info in? (Is BackTracker going to be any use to you?)
Definition: BackTracker.h:133
art::ServiceHandle< cheat::BackTracker > fBT
std::vector< const sim::Particle * > HitsToParticle(const std::vector< const rb::CellHit * > &hits) const
Returns vector of sim::Particle objects contributing to the given collection of hits.
void calib::PCHitsList::ProcessTrackForFLSHits ( const rb::Track track2,
daqchannelmap::DAQChannelMap cmap,
std::vector< caldp::PCHit > *  pcHitsXY 
) const
private

Definition at line 764 of file PCHitsList_module.cc.

References rb::Cluster::AllCells(), calib::BestPathEstimates(), geo::OfflineChan::Cell(), febshutoff_auto::chan, rb::Cluster::Clear(), sim::FLSHit::GetCellID(), sim::FLSHit::GetEdep(), sim::FLSHit::GetPlaneID(), sim::FLSHit::GetTotalPathLength(), sim::FLSHit::GetXAverage(), sim::FLSHit::GetYAverage(), geo::kX, calib::kXYAdjacents, geo::kY, rb::Cluster::MeanTNS(), rb::Cluster::OfflineChans(), submit_concat_project::parts, path, TB_WatchdogFx::paths, geo::OfflineChan::Plane(), rb::Track::PlaneDirMap(), rb::CellHit::SetCell(), rb::CellHit::SetPE(), rb::CellHit::SetPlane(), rb::CellHit::SetTNS(), and rb::CellHit::SetView().

767  {
768  if(!fBT->HaveTruthInfo()) return;
769 
770  rb::HitMap hmap(track->AllCells());
771 
772  // BackTracker won't be able to figure out the true energy, since
773  // there's no CellHit to work back from. Accumulate it here.
774  std::map<geo::OfflineChan, double> extrasTruthMap;
775  std::map<geo::OfflineChan, double> extrasPEMap;
776  std::map<geo::OfflineChan, double> extrasTruePath;
777  std::map<geo::OfflineChan, double> extrasTrueW;
778  std::map<geo::OfflineChan, double> extrasPoissonLambda;
779  std::vector<geo::OfflineChan> extras;
780 
781  const std::vector<const sim::Particle*> parts = fBT->HitsToParticle(track->AllCells());
782  if(!parts.empty()){
783  const int id = parts[0]->TrackId(); // Biggest contributor
784  const std::vector<sim::FLSHit> flss = fBT->ParticleToFLSHit(id);
785  const unsigned int nFLS = flss.size();
786  std::set<geo::OfflineChan> extraset;
787  std::set<geo::OfflineChan> flsCells;
788  for(unsigned int flsIdx = 0; flsIdx < nFLS; ++flsIdx){
789  const sim::FLSHit& fls = flss[flsIdx];
790  const geo::OfflineChan chan(fls.GetPlaneID(), fls.GetCellID());
791  extraset.insert(chan);
792  extrasTruthMap[chan] += 1000*fls.GetEdep();
793  extrasTruePath[chan] = fls.GetTotalPathLength();
794  if(fGeom->Plane(fls.GetPlaneID())->View() == geo::kX)
795  extrasTrueW[chan] = fls.GetYAverage();
796  else if(fGeom->Plane(fls.GetPlaneID())->View() == geo::kY)
797  extrasTrueW[chan] = fls.GetXAverage();
798  flsCells.insert(chan);
799  }
800 
801  for(geo::OfflineChan chan: flsCells){
802  // We might not have an actual CellHit for this cell, so have to use
803  // CellTo not HitTo. Could try to do something clever with matching
804  // the times up. But this must be a small effect.
805  const std::vector<sim::PhotonSignal> pes = fBT->CellToPhotonSignal(chan.Plane(), chan.Cell());
806  for(sim::PhotonSignal pe: pes){
807  extrasPEMap[chan] += pe.NPhoton();
808  extrasPoissonLambda[chan] += pe.PoissonLambda();
809  }
810  }
811 
812  // extraset is a set to get a collection of distinct cells, but
813  // later on we need it to be a vector.
814  extras.insert(extras.end(), extraset.begin(), extraset.end());
815  }
816 
817  const double meant = track->MeanTNS();
818 
819  rb::Track trackNoHits(*track);
820  trackNoHits.Clear();
821 
822  //Calculate path quality
823  std::vector<EPathQuality> quals;
824  const std::vector<double> paths = BestPathEstimates(trackNoHits.OfflineChans(), trackNoHits.PlaneDirMap(), quals, extras);
825 
826  //Loop through cells in track:
827  for(unsigned int ihit = 0; ihit < extras.size(); ++ihit){
828  const geo::OfflineChan chan = extras[ihit];
829 
830  //Get path:
831  const double path = paths[ihit];
832  //Check path not too long:
833  if(path > 10) continue;
834 
835  if(quals[ihit] == kXYAdjacents){
836  //Get the correct MeV in this hit
837  const double mev = extrasTruthMap[chan];
838  const double truePE = extrasPEMap[chan];
839  const double truePath = extrasTruePath[chan];
840  const double trueW = extrasTrueW[chan];
841  const double poissonLambda = extrasPoissonLambda[chan];
842 
843  rb::CellHit chit;
844  chit.SetPlane(chan.Plane());
845  chit.SetCell(chan.Cell());
846  chit.SetView(fGeom->Plane(chan.Plane())->View());
847  if(hmap.CellExists(chan.Plane(), chan.Cell())){
848  chit.SetPE(hmap.Cell(chan.Plane(), chan.Cell())->PE());
849  }
850  else{
851  chit.SetPE(0);
852  }
853  chit.SetTNS(meant, true);
854 
855  caldp::PCHit pchit = CellHitToPCHit(&chit, track,
856  path, mev, truePE, truePath, trueW, poissonLambda,
857  cmap);
858 
859  pcHitsXY->push_back(pchit);
860  }
861  }//End cell loop
862 
863  }//end ProcessTrackForFLSHit
caldp::PCHit CellHitToPCHit(const rb::CellHit *chit, const rb::Track *trk, double const &path, double const &mev, double const &truePE, double const &truePath, double const &trueW, double const &poissonLambda, daqchannelmap::DAQChannelMap *cmap) const
void SetTNS(float tns, bool good)
Definition: CellHit.h:56
int GetPlaneID() const
Plane ID.
Definition: FLSHit.h:37
int GetCellID() const
Cell ID.
Definition: FLSHit.h:39
float GetTotalPathLength() const
Get path length of all steps in FLSHit.
Definition: FLSHit.cxx:70
std::vector< sim::FLSHit > ParticleToFLSHit(const int &trackID) const
All the FLSHits that were created by the track id trackID, sorted from most to least light...
Vertical planes which measure X.
Definition: PlaneGeo.h:28
std::vector< double > BestPathEstimates(std::vector< geo::OfflineChan > const &chans, std::map< unsigned int, TVector3 > const &directions, std::vector< EPathQuality > &quals, std::vector< geo::OfflineChan > const &extras)
Definition: CalibUtil.cxx:98
Definition: event.h:19
A rb::Prong with full reconstructed trajectory.
Definition: Track.h:20
A single unit of energy deposition in the liquid scintillator.
Definition: FLSHit.h:19
const PlaneGeo * Plane(unsigned int i) const
Horizontal planes which measure Y.
Definition: PlaneGeo.h:29
"Pre-calibration hit". Common input to calibration procedures
Definition: PCHit.h:16
art::ServiceHandle< geo::Geometry > fGeom
void SetView(geo::View_t view)
Definition: CellHit.h:54
void SetPlane(unsigned short plane)
Definition: CellHit.h:53
Provides efficient lookup of CellHits by plane and cell number.
Definition: HitMap.h:22
void SetCell(unsigned short cell)
Definition: CellHit.h:52
void SetPE(float pe)
Definition: CellHit.h:55
float GetXAverage(const int step) const
Get X-average for the step. This is in local coordinates.
Definition: FLSHit.h:76
Definition: View.py:1
unsigned short Plane() const
Definition: OfflineChan.h:31
const std::string path
Definition: plot_BEN.C:43
const std::vector< sim::PhotonSignal > CellToPhotonSignal(unsigned int const &plane, unsigned int const &cell) const
Returns the PhotonSignals contributing the signal in the specified cell. WARNING: Use with extreme ca...
A rawdata::RawDigit with channel information decoded.
Definition: CellHit.h:27
unsigned short Cell() const
Definition: OfflineChan.h:32
A (plane, cell) pair.
Definition: OfflineChan.h:17
bool HaveTruthInfo() const
Is this a file with truth info in? (Is BackTracker going to be any use to you?)
Definition: BackTracker.h:133
float GetEdep() const
Get total Energy deposited into the cell for the whole FLSHit.
Definition: FLSHit.h:31
float GetYAverage(const int step) const
Get Y-average for the step. This is in local coordinates.
Definition: FLSHit.h:78
art::ServiceHandle< cheat::BackTracker > fBT
std::vector< const sim::Particle * > HitsToParticle(const std::vector< const rb::CellHit * > &hits) const
Returns vector of sim::Particle objects contributing to the given collection of hits.
void calib::PCHitsList::ProcessTrackTrajectory ( const rb::Track track,
daqchannelmap::DAQChannelMap cmap,
std::set< double > const &  zPlaneBounds,
std::vector< caldp::PCHit > *  pcHitsTraj 
) const
private

Definition at line 623 of file PCHitsList_module.cc.

References rb::CellHit::Cell(), rb::Cluster::Cell(), e, LOG_DEBUG, LOG_WARNING, calib::MakeZBoundaryMap(), rb::Cluster::NCell(), path, calib::PathLengthInCell(), python.hepunit::pc, rb::CellHit::Plane(), rb::Track::Trajectory(), rb::CellHit::View(), and rb::Track::W().

627  {
628  auto boundaryMap = calib::MakeZBoundaryMap(zPlaneBounds, track->Trajectory());
629 
630  // don't bother with this track if no z boundaries were found, that implies
631  // that all of the trajectory points are outside of the live geometry
632  if(boundaryMap.empty()) return;
633 
634  for(unsigned int ihit = 0; ihit < track->NCell(); ++ihit){
635  const rb::CellHit& chit = *track->Cell(ihit);
636 
637  std::pair<uint32_t, uint32_t> pc = {chit.Plane(), chit.Cell()};
638 
639  double xyz[3];
640  fGeom->Plane(chit.Plane())->Cell(chit.Cell())->GetCenter(xyz);
641  xyz[1-chit.View()] = track->W(&chit);
642  // TODO - wouldn't this be a better estimate of the hit position?
643  // track->InterpolateXY(xyz[2], xyz[0], xyz[1]);
644  TVector3 point(xyz[0], xyz[1], xyz[2]);
645 
646  LOG_DEBUG("PCHitsList")
647  << ihit << "/" << track->NCell()
648  << " recohit: " << point.X()
649  << " " << point.Y() << " " << point.Z();
650 
651  // don't bother with the point if it is reconstructed outside of the detector
652  // silly but apparently true, IsPointLive cannot handle the muon catcher
653  // IsMuonCatcher returns false if in the FD, so in the FD this check
654  // should be determined by IsPointLive
655  if( !fLiveGeom->IsPointLive(point) && !fLiveGeom->InMuonCatcher(point) ){
656  LOG_DEBUG("PCHitsList")
657  << ihit
658  << " is not valid "
659  << "(x,y,z) = "
660  << point.X() << "," << point.Y() << "," << point.Z();
661  continue;
662  }
663 
664  try{
665  float path = calib::PathLengthInCell(boundaryMap, point, pc);
666 
667  //Check path not too long:
668  if(path > fPathCut || path < fMinPath) continue;
669 
670  //Get the correct MeV and true PE in this hit
671  double mev = 0.;
672  double truePE = 0.;
673  double trueW = -9999.;
674  double truePath = 0.;
675  double poissonLambda = 0.;
676  this->GetTrueEnergyPathAndLightForCell(track, ihit, mev, truePath, trueW, truePE, poissonLambda);
677 
678  pcHitsTraj->push_back(CellHitToPCHit(&chit, track,
679  path, mev, truePE, truePath, trueW, poissonLambda,
680  cmap));
681  }
682  catch(cet::exception &e){
683  LOG_WARNING("PCHitsList")
684  << "caught exception \n" << e
685  << "\n cell " << pc.first << " " << pc.second << " not added to PCHitsList";
686  }
687 
688  }//End cell loop
689 
690  }//end ProcessTrackTrajectory
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
caldp::PCHit CellHitToPCHit(const rb::CellHit *chit, const rb::Track *trk, double const &path, double const &mev, double const &truePE, double const &truePath, double const &trueW, double const &poissonLambda, daqchannelmap::DAQChannelMap *cmap) const
unsigned int NCell(geo::View_t view) const
Number of cells in view view.
Definition: Cluster.cxx:134
void GetTrueEnergyPathAndLightForCell(const rb::Track *track, size_t const &ihit, double &mev, double &truePath, double &trueW, double &truePE, double &poissonLambda) const
zBoundMap MakeZBoundaryMap(std::set< double > const &planeZBounds, std::vector< TVector3 > const &trajectory)
Return a map of the z position of each trajectory point on a track to the bounding positions of where...
Definition: CalibUtil.cxx:354
virtual double W(const rb::CellHit *chit) const
Estimate the unmeasured coordinate of chit.
Definition: Track.cxx:281
unsigned short Plane() const
Definition: CellHit.h:39
geo::View_t View() const
Definition: CellHit.h:41
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
const PlaneGeo * Plane(unsigned int i) const
art::ServiceHandle< geo::Geometry > fGeom
unsigned short Cell() const
Definition: CellHit.h:40
art::ServiceHandle< geo::LiveGeometry > fLiveGeom
#define LOG_WARNING(category)
const std::string path
Definition: plot_BEN.C:43
art::Ptr< rb::CellHit > Cell(geo::View_t view, unsigned int viewIdx) const
Get the ith cell from view view.
Definition: Cluster.cxx:145
A rawdata::RawDigit with channel information decoded.
Definition: CellHit.h:27
bool IsPointLive(TVector3 vertex)
Note the muon catcher is considered bad; use in combination with InMuonCatcher if needed...
std::vector< TVector3 > const & Trajectory() const
return a constant reference to the track trajectory points
Definition: Track.h:86
double fPathCut
Only keep hits with pathlength less than this.
bool InMuonCatcher(TVector3 vertex)
double fMinPath
Only keep hits with pathlength greater than this.
Float_t e
Definition: plot.C:35
float PathLengthInCell(zBoundMap const &zBounds, TVector3 const &recoHitLoc, std::pair< uint32_t, uint32_t > const &pc)
Return the path length of a track in the cell in question.
Definition: CalibUtil.cxx:498
void calib::PCHitsList::produce ( art::Event e)
overridevirtual

Implements art::EDProducer.

Definition at line 190 of file PCHitsList_module.cc.

References visualisationForPaperMasterPlot::cmap, util::CreateAssn(), art::fill_ptr_vector(), calib::FindZBoundaries(), art::Ptr< T >::get(), art::DataViewImpl::getByLabel(), daqchannelmap::DAQChannelMap::getInstance(), LOG_DEBUG, rb::Cluster::NCell(), and art::Event::put().

191  {
192  //Ptrs to vectors to be filled (one instance for each degree of hit quality)
193  std::unique_ptr< std::vector<caldp::PCHit> > pcHitsXY (new std::vector<caldp::PCHit>);
194  std::unique_ptr< std::vector<caldp::PCHit> > pcHitsZ (new std::vector<caldp::PCHit>);
195  std::unique_ptr< std::vector<caldp::PCHit> > pcHitsAvg (new std::vector<caldp::PCHit>);
196  std::unique_ptr< std::vector<caldp::PCHit> > pcHitsTraj (new std::vector<caldp::PCHit>);
197  std::unique_ptr< std::vector<caldp::PCHit> > pcHitsXYThresh(new std::vector<caldp::PCHit>);
198  std::unique_ptr< std::vector<caldp::PCHit> > pcHitsXYFLS (new std::vector<caldp::PCHit>);
199 
200  std::unique_ptr<art::Assns<caldp::PCHit, rb::Track> > hitAssnsXY (new art::Assns<caldp::PCHit, rb::Track>);
201  std::unique_ptr<art::Assns<caldp::PCHit, rb::Track> > hitAssnsZ (new art::Assns<caldp::PCHit, rb::Track>);
202  std::unique_ptr<art::Assns<caldp::PCHit, rb::Track> > hitAssnsAvg (new art::Assns<caldp::PCHit, rb::Track>);
203  std::unique_ptr<art::Assns<caldp::PCHit, rb::Track> > hitAssnsTraj (new art::Assns<caldp::PCHit, rb::Track>);
204  std::unique_ptr<art::Assns<caldp::PCHit, rb::Track> > hitAssnsXYThresh(new art::Assns<caldp::PCHit, rb::Track>);
205  std::unique_ptr<art::Assns<caldp::PCHit, rb::Track> > hitAssnsXYFLS (new art::Assns<caldp::PCHit, rb::Track>);
206 
207  //Get cosmic tracks to use for calibration:
209  e.getByLabel(fCosmicLabel, trackcol);
210 
211  std::vector< art::Ptr<rb::Track> > tracks;
212  art::fill_ptr_vector(tracks, trackcol);
213 
214  art::FindManyP<rb::Cluster> fmpslc(trackcol, e, fCosmicLabel);
215 
217 
218  // prepare to find the path lengths in a cell based on the track trajectory
219  std::set<double> planeZBounds;
220  calib::FindZBoundaries(planeZBounds);
221 
222  for(size_t itrk = 0; itrk < tracks.size(); ++itrk){
223 
224  // Find the slice associated with this track
225  // There should be exactly one
226  const std::vector<art::Ptr<rb::Cluster> > slices = fmpslc.at(itrk);
227  if(slices.size() != 1)
228  throw cet::exception("PCHitsList") << "incorrect number of slices associated to track";
229 
230  const rb::Cluster& slice = *slices[0];
231 
232  // Remember how many hits of each type we had so far, so we know what
233  // index to start associating from when we're done with this track.
234  const size_t xyBeginIdx = pcHitsXY->size();
235  const size_t zBeginIdx = pcHitsZ->size();
236  const size_t avgBeginIdx = pcHitsAvg->size();
237  const size_t trajBeginIdx = pcHitsTraj->size();
238  const size_t xyThreshBeginIdx = pcHitsXYThresh->size();
239  const size_t xyFLSBeginIdx = pcHitsXYFLS->size();
240 
241  const art::Ptr<rb::Track> track = tracks[itrk];
242 
243  LOG_DEBUG("PCHitsList") << "TRACK " << itrk << ": " << track->NCell() << " cells to process.";
244 
245  //-------Track cuts:----------------//
246  if( !this->IsGoodTrack(*track, slice) ) continue;
247 
248  // track passes the cuts, so process it
249  ProcessTrack(track.get(),
250  cmap,
251  pcHitsXY.get(),
252  pcHitsZ.get(),
253  pcHitsAvg.get());
254 
255  ProcessTrackTrajectory(track.get(),
256  cmap,
257  planeZBounds,
258  pcHitsTraj.get());
259 
261  cmap,
262  pcHitsXYThresh.get());
263 
264  ProcessTrackForFLSHits(track.get(),
265  cmap,
266  pcHitsXYFLS.get());
267 
268 
269  // Associate all the PCHits we created for this track. We do this in
270  // bulk because making lots of individual calls as we go is slow.
271  util::CreateAssn(*this, e, *pcHitsXY, track, *hitAssnsXY, xyBeginIdx, UINT_MAX, fQualXYName);
272  util::CreateAssn(*this, e, *pcHitsZ, track, *hitAssnsZ, zBeginIdx, UINT_MAX, fQualZName);
273  util::CreateAssn(*this, e, *pcHitsAvg, track, *hitAssnsAvg, avgBeginIdx, UINT_MAX, fQualAvgName);
274  util::CreateAssn(*this, e, *pcHitsTraj, track, *hitAssnsTraj, trajBeginIdx, UINT_MAX, fQualTrajName);
275  util::CreateAssn(*this, e, *pcHitsXYThresh, track, *hitAssnsXYThresh, xyThreshBeginIdx, UINT_MAX, fQualXYThreshName);
276  util::CreateAssn(*this, e, *pcHitsXYFLS, track, *hitAssnsXYFLS, xyFLSBeginIdx, UINT_MAX, fQualXYFLSName);
277 
278  }//End track loop
279 
280  LOG_DEBUG("PCHitsList")
281  << "SUMMARY: Size of XY vector = " << pcHitsXY->size()
282  << ", Size of Z vector = " << pcHitsZ->size()
283  << ", Size of Avg vector = " << pcHitsAvg->size();
284 
285  e.put(std::move(pcHitsXY), fQualXYName);
286  e.put(std::move(pcHitsZ), fQualZName);
287  e.put(std::move(pcHitsAvg), fQualAvgName);
288  e.put(std::move(pcHitsTraj), fQualTrajName);
289  e.put(std::move(pcHitsXYThresh), fQualXYThreshName);
290  e.put(std::move(pcHitsXYFLS), fQualXYFLSName);
291  e.put(std::move(hitAssnsXY), fQualXYName);
292  e.put(std::move(hitAssnsZ), fQualZName);
293  e.put(std::move(hitAssnsAvg), fQualAvgName);
294  e.put(std::move(hitAssnsTraj), fQualTrajName);
295  e.put(std::move(hitAssnsXYThresh), fQualXYThreshName);
296  e.put(std::move(hitAssnsXYFLS), fQualXYFLSName);
297 
298  LOG_DEBUG("PCHitsList") << "Event finished successfully.";
299 
300  }//end produce
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
novadaq::cnv::DetId DetId() const
What detector are we in?
static bool CreateAssn(art::EDProducer const &prod, art::Event &evt, std::vector< T > &a, art::Ptr< U > b, art::Assns< T, U > &assn, size_t indx=UINT_MAX, std::string const &instance=std::string())
Create a 1 to 1 association between a new product and one already in the event.
std::string fQualXYThreshName
unsigned int NCell(geo::View_t view) const
Number of cells in view view.
Definition: Cluster.cxx:134
std::string fQualXYFLSName
Definition: event.h:19
A collection of associated CellHits.
Definition: Cluster.h:47
void ProcessTrack(const rb::Track *track, daqchannelmap::DAQChannelMap *cmap, std::vector< caldp::PCHit > *pcHitsXY, std::vector< caldp::PCHit > *pcHitsZ, std::vector< caldp::PCHit > *pcHitsAvg) const
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
void ProcessTrackForFLSHits(const rb::Track *track2, daqchannelmap::DAQChannelMap *cmap, std::vector< caldp::PCHit > *pcHitsXY) const
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
static DAQChannelMap * getInstance(int detID)
bool IsGoodTrack(rb::Track const &track, rb::Cluster const &slice)
void ProcessTrackTrajectory(const rb::Track *track, daqchannelmap::DAQChannelMap *cmap, std::set< double > const &zPlaneBounds, std::vector< caldp::PCHit > *pcHitsTraj) const
T const * get() const
Definition: Ptr.h:321
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
art::ServiceHandle< ds::DetectorService > fDS
cmap::CMap class source code
Definition: CMap.cxx:17
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:464
void FindZBoundaries(std::set< double > &planeZBounds)
Find the boundaries in the z direction of planes in the detector.
Definition: CalibUtil.cxx:332
void ProcessTrackForBelowThresholdHits(const rb::Track *track, daqchannelmap::DAQChannelMap *cmap, std::vector< caldp::PCHit > *pcHitsXYThresh) const
void calib::PCHitsList::reconfigure ( fhicl::ParameterSet const &  p)

Definition at line 161 of file PCHitsList_module.cc.

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

162  {
163  fCosmicLabel = pset.get< std::string >("CosmicLabel"); // Label of tracker module
164  fQualXYName = pset.get< std::string >("QualXYName"); // Instance label, "XY" quality hits
165  fQualZName = pset.get< std::string >("QualZName"); // Instance label, "Z" quality hits
166  fQualAvgName = pset.get< std::string >("QualAvgName"); // Instance label, "Avg" quality hits
167  fQualTrajName = pset.get< std::string >("QualTrajName"); // Instance label, "Traj" quality hits
168  fQualXYThreshName = pset.get< std::string >("QualXYThreshName"); // Instance label, "XY" quality hits
169  // falling below threshold
170  fQualXYFLSName = pset.get< std::string >("QualXYFLSName"); // Instance label, "XY" quality hits from FLS
171 
172  fIsBeam = pset.get< bool >("IsBeam");
173  fPathCut = pset.get< double >("PathCut");
174  fMinPath = pset.get< double >("MinPathlength");
175  fExtentZCut = pset.get< int >("ExtentZCut");
176  fDirZCut = pset.get< double >("DirZCut");
177  fCompletenessCut = pset.get< double >("CompletenessCut");
178  fMaxVtxDistFromEdge = pset.get< double >("MaxVtxDistFromEdge", 10.);
179  fMaxEndDistFromEdge = pset.get< double >("MaxEndDistFromEdge", 10.);
180  fBadStepSizeLimit = pset.get< double >("BadStepSizeLimit", 2. );
181  fMaxCellsPerPlane = pset.get< double >("MaxCellsPerPlane", 6. );
182  fMaxDeltaEndPlane = pset.get< double >("MaxDeltaEndPlane", 3. );
183  fMaxPlaneAsymmetry = pset.get< double >("MaxPlaneAsymmetry", 0.1);
184 
185  return;
186  }
std::string fQualXYThreshName
int fExtentZCut
Only keep tracks crossing this distance in z.
std::string fQualXYFLSName
double fMaxEndDistFromEdge
Only keep tracks whose final point is not more than this distance from the edge.
double fBadStepSizeLimit
Only keep tracks without steps outside this limit, see GoodSteps comments.
double fCompletenessCut
Only keep tracks with more than this fraction of slice hits included in each view.
double fMaxVtxDistFromEdge
Only keep tracks with an initial point within this dist (cm) from the edge.
double fPathCut
Only keep hits with pathlength less than this.
double fDirZCut
Only keep tracks shallower than this.
double fMinPath
Only keep hits with pathlength greater than this.
double fMaxCellsPerPlane
Only keep tracks with fewer <cells/plane> than this limit.
enum BeamMode string
void art::Consumer::showMissingConsumes ( ) const
protectedinherited

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

double calib::PCHitsList::TrueW ( const sim::FLSHit fls) const
private

Definition at line 511 of file PCHitsList_module.cc.

References exit(), sim::FLSHit::GetCellID(), sim::FLSHit::GetEntryX(), sim::FLSHit::GetEntryY(), sim::FLSHit::GetEntryZ(), sim::FLSHit::GetExitX(), sim::FLSHit::GetExitY(), sim::FLSHit::GetExitZ(), sim::FLSHit::GetPlaneID(), ip, novadaq::cnv::kTESTBEAM, geo::kX, and geo::kY.

512  {
513  double local_enter[3] = {fls.GetEntryX(), fls.GetEntryY(), fls.GetEntryZ()};
514  double local_exit[3] = {fls.GetExitX(), fls.GetExitY(), fls.GetExitZ()};
515  double enter[3], exit[3];
516  int ip = fls.GetPlaneID();
517  int ic = fls.GetCellID();
518 
519  (fGeom->Plane(ip)->Cell(ic))->LocalToWorld(local_enter,enter);
520  (fGeom->Plane(ip)->Cell(ic))->LocalToWorld(local_exit ,exit);
521 
522  if(fGeom->Plane(fls.GetPlaneID())->View() == geo::kX)
523  return ( enter[1] + exit[1] )/2;
524  else if(fGeom->Plane(fls.GetPlaneID())->View() == geo::kY){
525  // TB horizontal modules (Y-view) have readout on opposite end as ND/FD
527  return -( enter[0] + exit[0] )/2;
528  return ( enter[0] + exit[0] )/2;
529  }
530  else
531  mf::LogError("TrueW") << "bad view for fls hit";
532  return 9999.;
533  }
float GetEntryX() const
Entry point of the particle (position, time and energy)
Definition: FLSHit.h:48
int GetPlaneID() const
Plane ID.
Definition: FLSHit.h:37
int GetCellID() const
Cell ID.
Definition: FLSHit.h:39
const CellGeo * Cell(int icell) const
Definition: PlaneGeo.h:48
Vertical planes which measure X.
Definition: PlaneGeo.h:28
TString ip
Definition: loadincs.C:5
const PlaneGeo * Plane(unsigned int i) const
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
float GetExitX() const
Exit point of the particle (position, time and energy)
Definition: FLSHit.h:54
Horizontal planes which measure Y.
Definition: PlaneGeo.h:29
art::ServiceHandle< geo::Geometry > fGeom
novadaq::cnv::DetId DetId() const
Prefer ds::DetectorService::DetId() instead.
Definition: GeometryBase.h:243
Definition: View.py:1
float GetEntryZ() const
Definition: FLSHit.h:50
exit(0)
float GetExitY() const
Definition: FLSHit.h:55
float GetExitZ() const
Definition: FLSHit.h:56
float GetEntryY() const
Definition: FLSHit.h:49
void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited

Member Data Documentation

double calib::PCHitsList::fBadStepSizeLimit
private

Only keep tracks without steps outside this limit, see GoodSteps comments.

Definition at line 116 of file PCHitsList_module.cc.

art::ServiceHandle<cheat::BackTracker> calib::PCHitsList::fBT
private

Definition at line 123 of file PCHitsList_module.cc.

double calib::PCHitsList::fCompletenessCut
private

Only keep tracks with more than this fraction of slice hits included in each view.

Definition at line 113 of file PCHitsList_module.cc.

std::string calib::PCHitsList::fCosmicLabel
private

Definition at line 100 of file PCHitsList_module.cc.

double calib::PCHitsList::fDirZCut
private

Only keep tracks shallower than this.

Definition at line 112 of file PCHitsList_module.cc.

art::ServiceHandle<ds::DetectorService> calib::PCHitsList::fDS
private

Definition at line 126 of file PCHitsList_module.cc.

int calib::PCHitsList::fExtentZCut
private

Only keep tracks crossing this distance in z.

Definition at line 111 of file PCHitsList_module.cc.

art::ServiceHandle<geo::Geometry> calib::PCHitsList::fGeom
private

Definition at line 124 of file PCHitsList_module.cc.

bool calib::PCHitsList::fIsBeam
private

Definition at line 108 of file PCHitsList_module.cc.

art::ServiceHandle<geo::LiveGeometry> calib::PCHitsList::fLiveGeom
private

Definition at line 125 of file PCHitsList_module.cc.

double calib::PCHitsList::fMaxCellsPerPlane
private

Only keep tracks with fewer <cells/plane> than this limit.

Definition at line 117 of file PCHitsList_module.cc.

double calib::PCHitsList::fMaxDeltaEndPlane
private

Only keep tracks where the difference in end plane between the views is less than this number

Definition at line 118 of file PCHitsList_module.cc.

double calib::PCHitsList::fMaxEndDistFromEdge
private

Only keep tracks whose final point is not more than this distance from the edge.

Definition at line 115 of file PCHitsList_module.cc.

double calib::PCHitsList::fMaxPlaneAsymmetry
private

Only keep tracks where the asymmetry in the planes in the views is less than this number

Definition at line 120 of file PCHitsList_module.cc.

double calib::PCHitsList::fMaxVtxDistFromEdge
private

Only keep tracks with an initial point within this dist (cm) from the edge.

Definition at line 114 of file PCHitsList_module.cc.

double calib::PCHitsList::fMinPath
private

Only keep hits with pathlength greater than this.

Definition at line 110 of file PCHitsList_module.cc.

double calib::PCHitsList::fPathCut
private

Only keep hits with pathlength less than this.

Definition at line 109 of file PCHitsList_module.cc.

std::string calib::PCHitsList::fQualAvgName
private

Definition at line 103 of file PCHitsList_module.cc.

std::string calib::PCHitsList::fQualTrajName
private

Definition at line 104 of file PCHitsList_module.cc.

std::string calib::PCHitsList::fQualXYFLSName
private

Definition at line 106 of file PCHitsList_module.cc.

std::string calib::PCHitsList::fQualXYName
private

Definition at line 101 of file PCHitsList_module.cc.

std::string calib::PCHitsList::fQualXYThreshName
private

Definition at line 105 of file PCHitsList_module.cc.

std::string calib::PCHitsList::fQualZName
private

Definition at line 102 of file PCHitsList_module.cc.


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