Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
calib::DetRespDrift Class Reference
Inheritance diagram for calib::DetRespDrift:
art::EDFilter art::detail::Filter art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Public Types

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

Public Member Functions

 DetRespDrift (fhicl::ParameterSet const &p)
 
virtual ~DetRespDrift ()
 
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
 
std::string workerType () const
 
void doBeginJob ()
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< TconsumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< TmayConsumeView (InputTag const &tag)
 

Static Public Attributes

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

Protected Member Functions

ConsumesCollector & consumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< Tconsumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< TmayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Private Member Functions

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

Private Attributes

TTree * fTree
 
int run
 
uint32_t EventTimeHigh
 
double path
 
double trueE
 
double PECorr
 
double pe
 
std::string pathQual
 
std::string fPCHitLabel
 
std::string fQualXYName
 
std::string fQualZName
 
std::string fQualAvgName
 
std::string fLabel
 

Detailed Description

Definition at line 51 of file DetRespDrift_module.cc.

Member Typedef Documentation

Definition at line 19 of file EDFilter.h.

template<typename UserConfig >
using art::detail::Filter::Table = Modifier::Table<UserConfig>
inherited

Definition at line 29 of file Filter.h.

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

Definition at line 20 of file EDFilter.h.

Constructor & Destructor Documentation

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

Definition at line 86 of file DetRespDrift_module.cc.

References reconfigure().

87  : EDFilter(p)
88  {
89  this->reconfigure(p);
90 
91  }
const char * p
Definition: xmltok.h:285
void reconfigure(fhicl::ParameterSet const &p)
EDFilter(fhicl::ParameterSet const &pset)
Definition: EDFilter.h:22
calib::DetRespDrift::~DetRespDrift ( )
virtual

Definition at line 93 of file DetRespDrift_module.cc.

94  {
95  // Clean up dynamic memory and other resources here.
96  }

Member Function Documentation

void calib::DetRespDrift::beginJob ( )
overridevirtual

Reimplemented from art::EDFilter.

Definition at line 193 of file DetRespDrift_module.cc.

References EventTimeHigh, fTree, path, pathQual, pe, PECorr, and trueE.

194  {
195  // histograms for output
197 
198  fTree = tfs->make<TTree>("fTree","tree to hold variables");
199  fTree->Branch("run",&run);
200  fTree->Branch("EventTimeHigh",&EventTimeHigh);
201  fTree->Branch("pe",&pe);
202  fTree->Branch("PECorr",&PECorr);
203  fTree->Branch("trueE",&trueE);
204  fTree->Branch("path",&path);
205  fTree->Branch("pathQual",&pathQual);
206 
207 
208  }
Definition: run.py:1
bool calib::DetRespDrift::beginRun ( art::Run r)
overridevirtual

Reimplemented from art::EDFilter.

Definition at line 210 of file DetRespDrift_module.cc.

210  {
211  return true;
212  }
template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::consumes ( InputTag const &  tag)
protectedinherited

Definition at line 55 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::consumes(), T, and getGoodRuns4SAM::tag.

56  {
57  return collector_.consumes<T, BT>(tag);
58  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
ProductToken< T > consumes(InputTag const &)
double T
Definition: Xdiff_gwt.C:5
ConsumesCollector& art::ModuleBase::consumesCollector ( )
protectedinherited
template<typename T , BranchType BT>
void art::ModuleBase::consumesMany ( )
protectedinherited

Definition at line 69 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::consumesMany(), and T.

70  {
71  collector_.consumesMany<T, BT>();
72  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
double T
Definition: Xdiff_gwt.C:5
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::consumesView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::consumesView ( InputTag const &  tag)
inherited

Definition at line 62 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::consumesView(), T, and getGoodRuns4SAM::tag.

63  {
64  return collector_.consumesView<T, BT>(tag);
65  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
ViewToken< Element > consumesView(InputTag const &)
double T
Definition: Xdiff_gwt.C:5
void art::detail::Filter::doBeginJob ( )
inherited
bool art::detail::Filter::doBeginRun ( RunPrincipal rp,
ModuleContext const &   
)
inherited
bool art::detail::Filter::doBeginSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited
void art::detail::Filter::doEndJob ( )
inherited
bool art::detail::Filter::doEndRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited
bool art::detail::Filter::doEndSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited
bool art::detail::Filter::doEvent ( EventPrincipal ep,
ModuleContext const &  mc,
std::atomic< std::size_t > &  counts_run,
std::atomic< std::size_t > &  counts_passed,
std::atomic< std::size_t > &  counts_failed 
)
inherited
void art::detail::Filter::doRespondToCloseInputFile ( FileBlock const &  fb)
inherited
void art::detail::Filter::doRespondToCloseOutputFiles ( FileBlock const &  fb)
inherited
void art::detail::Filter::doRespondToOpenInputFile ( FileBlock const &  fb)
inherited
void art::detail::Filter::doRespondToOpenOutputFiles ( FileBlock const &  fb)
inherited
void calib::DetRespDrift::endJob ( )
overridevirtual

Reimplemented from art::EDFilter.

Definition at line 221 of file DetRespDrift_module.cc.

References DEFINE_ART_MODULE().

222  {
223 
224  }
bool calib::DetRespDrift::endRun ( art::Run r)
overridevirtual

Reimplemented from art::EDFilter.

Definition at line 214 of file DetRespDrift_module.cc.

214  {
215 
217 
218  return true;
219  }
bool calib::DetRespDrift::filter ( art::Event e)
overridevirtual

Get the reconstructed tracks

Implements art::EDFilter.

Definition at line 98 of file DetRespDrift_module.cc.

References EventTimeHigh, fLabel, fPCHitLabel, fQualAvgName, fQualXYName, fQualZName, fTree, art::DataViewImpl::getByLabel(), getPECorr(), MECModelEnuComparisons::i, makeTrainCVSamples::int, calib::j, path, pathQual, pe, PECorr, art::DataViewImpl::run(), art::DataViewImpl::time(), art::Timestamp::timeHigh(), and trueE.

99  {
100  /// Get the reconstructed tracks
102  e.getByLabel(fLabel, tracks);
103  if( tracks->size() == 0 ) return true;
104 
105  run = (int)(e.run());
106  art::Timestamp ts = e.time();
107  EventTimeHigh = ts.timeHigh();
108 
112 
113  if( !PCHitAvgGetter.isValid() && !PCHitXYGetter.isValid() && !PCHitZGetter.isValid()) return false;
114 
115  // loop over stopping tracks in event
116  for( unsigned int i=0; i<tracks->size(); ++i ){
117 
118  // loop over PCHits associated to stopping track
119  std::vector<art::Ptr<caldp::PCHit> > hitsXY = PCHitXYGetter.at(i);
120  std::vector<art::Ptr<caldp::PCHit> > hitsZ = PCHitZGetter.at(i);
121  std::vector<art::Ptr<caldp::PCHit> > hitsAvg = PCHitAvgGetter.at(i);
122 
123  // XY hits
124  for( unsigned int j=0; j<hitsXY.size(); ++j ){
125 
126  path = hitsXY[j]->Path();
127  trueE = hitsXY[j]->TrueMeV();
128  PECorr = this->getPECorr(e,*hitsXY[j]);
129  pe = hitsXY[j]->PE();
130  pathQual = "XY";
131 
132  fTree->Fill(); //fill ttree
133  }
134 
135  // Z hits
136  for( unsigned int j=0; j<hitsZ.size(); ++j ){
137 
138  path = hitsZ[j]->Path();
139  trueE = hitsZ[j]->TrueMeV();
140  PECorr = this->getPECorr(e,*hitsZ[j]);
141  pe = hitsZ[j]->PE();
142  pathQual = "Z";
143 
144  fTree->Fill(); //fill ttree
145  }
146 
147  // Avg hits
148  for( unsigned int j=0; j<hitsAvg.size(); ++j ){
149 
150  path = hitsAvg[j]->Path();
151  trueE = hitsAvg[j]->TrueMeV();
152  PECorr = this->getPECorr(e,*hitsAvg[j]);
153  pe = hitsAvg[j]->PE();
154  pathQual = "Avg";
155 
156  fTree->Fill(); //fill ttree
157  }
158 
159  }
160 
161  return true;
162 
163  }
constexpr std::uint32_t timeHigh() const
Definition: Timestamp.h:34
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:446
Timestamp time() const
const double j
Definition: BetheBloch.cxx:29
RunNumber_t run() const
Definition: run.py:1
double getPECorr(art::Event &e, caldp::PCHit const &pchit)
std::array<std::vector<ProductInfo>, NumBranchTypes> const& art::ModuleBase::getConsumables ( ) const
inherited
double calib::DetRespDrift::getPECorr ( art::Event e,
caldp::PCHit const &  pchit 
)
private

Definition at line 165 of file DetRespDrift_module.cc.

References caldp::PCHit::Cell(), calib::Calibrator::GetPECorr(), caldp::PCHit::GoodTime(), art::DataViewImpl::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().

Referenced by filter().

165  {
166 
167  //Calibrator necessary to get Atten information
169 
170  //Make mock cellhit
171  rb::CellHit cellhit;
172  cellhit.SetPlane(pchit.Plane());
173  cellhit.SetCell(pchit.Cell());
174  cellhit.SetView(pchit.View());
175  cellhit.SetTNS(pchit.TNS(),pchit.GoodTime());
176  if(!e.isRealData())cellhit.SetMC(); // assume only filled for MC...
177  cellhit.SetPE(pchit.PE());
178 
179  double pecorr = calibrator->GetPECorr(cellhit, pchit.W());
180  return pecorr;
181  }
void SetTNS(float tns, bool good)
Definition: CellHit.h:56
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
bool isRealData() const
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)
template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::mayConsume ( InputTag const &  tag)
protectedinherited

Definition at line 76 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::mayConsume(), T, and getGoodRuns4SAM::tag.

77  {
78  return collector_.mayConsume<T, BT>(tag);
79  }
ProductToken< T > mayConsume(InputTag const &)
ConsumesCollector collector_
Definition: ModuleBase.h:50
double T
Definition: Xdiff_gwt.C:5
template<typename T , BranchType BT>
void art::ModuleBase::mayConsumeMany ( )
protectedinherited

Definition at line 90 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::mayConsumeMany(), and T.

91  {
93  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
double T
Definition: Xdiff_gwt.C:5
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::mayConsumeView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::mayConsumeView ( InputTag const &  tag)
inherited

Definition at line 83 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::mayConsumeView(), T, and getGoodRuns4SAM::tag.

84  {
85  return collector_.mayConsumeView<T, BT>(tag);
86  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
ViewToken< Element > mayConsumeView(InputTag const &)
double T
Definition: Xdiff_gwt.C:5
ModuleDescription const& art::ModuleBase::moduleDescription ( ) const
inherited
void calib::DetRespDrift::reconfigure ( fhicl::ParameterSet const &  p)

Definition at line 183 of file DetRespDrift_module.cc.

References fLabel, fPCHitLabel, fQualAvgName, fQualXYName, fQualZName, fhicl::ParameterSet::get(), and string.

Referenced by DetRespDrift().

184  {
185  fPCHitLabel = pset.get< std::string >("PCHitLabel"); //Label of PCHitList module
186  fQualXYName = pset.get< std::string >("QualXYName"); //Instance label, "XY" quality hits
187  fQualZName = pset.get< std::string >("QualZName"); //Instance label, "Z" quality hits
188  fQualAvgName = pset.get< std::string >("QualAvgName"); //Instance label, "Avg" quality hits
189  fLabel = pset.get<std::string>("Label");
190 
191  }
enum BeamMode string
void art::ModuleBase::setModuleDescription ( ModuleDescription const &  )
inherited
void art::ModuleBase::sortConsumables ( std::string const &  current_process_name)
inherited
std::string art::EDFilter::workerType ( ) const
inherited

Referenced by art::EDFilter::EDFilter().

Member Data Documentation

uint32_t calib::DetRespDrift::EventTimeHigh
private

Definition at line 69 of file DetRespDrift_module.cc.

Referenced by beginJob(), and filter().

constexpr bool art::detail::Filter::Fail {false}
staticinherited

Definition at line 26 of file Filter.h.

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

std::string calib::DetRespDrift::fLabel
private

Definition at line 81 of file DetRespDrift_module.cc.

Referenced by filter(), and reconfigure().

std::string calib::DetRespDrift::fPCHitLabel
private

Definition at line 77 of file DetRespDrift_module.cc.

Referenced by filter(), and reconfigure().

std::string calib::DetRespDrift::fQualAvgName
private

Definition at line 80 of file DetRespDrift_module.cc.

Referenced by filter(), and reconfigure().

std::string calib::DetRespDrift::fQualXYName
private

Definition at line 78 of file DetRespDrift_module.cc.

Referenced by filter(), and reconfigure().

std::string calib::DetRespDrift::fQualZName
private

Definition at line 79 of file DetRespDrift_module.cc.

Referenced by filter(), and reconfigure().

TTree* calib::DetRespDrift::fTree
private

Definition at line 66 of file DetRespDrift_module.cc.

Referenced by beginJob(), and filter().

constexpr bool art::detail::Filter::Pass {true}
staticinherited

Definition at line 25 of file Filter.h.

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

double calib::DetRespDrift::path
private
std::string calib::DetRespDrift::pathQual
private

Definition at line 74 of file DetRespDrift_module.cc.

Referenced by beginJob(), and filter().

double calib::DetRespDrift::pe
private

Definition at line 73 of file DetRespDrift_module.cc.

Referenced by beginJob(), and filter().

double calib::DetRespDrift::PECorr
private

Definition at line 72 of file DetRespDrift_module.cc.

Referenced by beginJob(), and filter().

int calib::DetRespDrift::run
private

Definition at line 68 of file DetRespDrift_module.cc.

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

double calib::DetRespDrift::trueE
private

Definition at line 71 of file DetRespDrift_module.cc.

Referenced by beginJob(), and filter().


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