Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
calib::MuondEdx Class Reference
Inheritance diagram for calib::MuondEdx:
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

 MuondEdx (fhicl::ParameterSet const &p)
 
virtual ~MuondEdx ()
 
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

TH2D * fdEdx
 
TH2D * fdEdx_minus
 
TH2D * fdEdx_plus
 
TH2D * fdEdx_true
 
std::string fPCHitLabel
 
std::string fQualXYName
 
std::string fStopperLabel
 
double fSysShift
 

Detailed Description

Definition at line 50 of file MuondEdx_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::MuondEdx::MuondEdx ( fhicl::ParameterSet const &  p)
explicit

Definition at line 79 of file MuondEdx_module.cc.

References reconfigure().

80  : EDFilter(p)
81  {
82  this->reconfigure(p);
83  produces< TH2D, art::InRun >("dEdx");
84  produces< TH2D, art::InRun >("dEdxMinus");
85  produces< TH2D, art::InRun >("dEdxPlus");
86  produces< TH2D, art::InRun >("dEdxTrue");
87  }
void reconfigure(fhicl::ParameterSet const &p)
const char * p
Definition: xmltok.h:285
EDFilter(fhicl::ParameterSet const &pset)
Definition: EDFilter.h:22
calib::MuondEdx::~MuondEdx ( )
virtual

Definition at line 89 of file MuondEdx_module.cc.

90  {
91  // Clean up dynamic memory and other resources here.
92  }

Member Function Documentation

void calib::MuondEdx::beginJob ( )
overridevirtual

Reimplemented from art::EDFilter.

Definition at line 178 of file MuondEdx_module.cc.

References fdEdx, fdEdx_minus, fdEdx_plus, and fdEdx_true.

179  {
180  // histograms for output
182  fdEdx = tfs->make<TH2D>("dEdx",";Distance to track end (cm);PECorr / cm;",
183  50,0.,500.,200,0.,200.);
184  fdEdx_minus = tfs->make<TH2D>("dEdx_minus",";Distance to track end (cm);PECorr / cm;",
185  50,0.,500.,200,0.,200.);
186  fdEdx_plus = tfs->make<TH2D>("dEdx_plus",";Distance to track end (cm);PECorr / cm;",
187  50,0.,500.,200,0.,200.);
188  fdEdx_true = tfs->make<TH2D>("dEdx_true",";Distance to track end (cm);True MeV / cm;",
189  50,0.,500.,200,0.,5.);
190  }
bool calib::MuondEdx::beginRun ( art::Run r)
overridevirtual

Reimplemented from art::EDFilter.

Definition at line 192 of file MuondEdx_module.cc.

192  {
193  return true;
194  }
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::MuondEdx::endJob ( )
overridevirtual

Reimplemented from art::EDFilter.

Definition at line 211 of file MuondEdx_module.cc.

References DEFINE_ART_MODULE().

212  {
213 
214  }
bool calib::MuondEdx::endRun ( art::Run r)
overridevirtual

Reimplemented from art::EDFilter.

Definition at line 196 of file MuondEdx_module.cc.

References fdEdx, fdEdx_minus, fdEdx_plus, fdEdx_true, and art::DataViewImpl::put().

196  {
197 
199  std::unique_ptr<TH2D> pdEdx(tfs->make<TH2D>(*fdEdx));
200  std::unique_ptr<TH2D> pdEdx_minus(tfs->make<TH2D>(*fdEdx_minus));
201  std::unique_ptr<TH2D> pdEdx_plus(tfs->make<TH2D>(*fdEdx_plus));
202  std::unique_ptr<TH2D> pdEdx_true(tfs->make<TH2D>(*fdEdx_true));
203 
204  r.put(std::move(pdEdx),"dEdx");
205  r.put(std::move(pdEdx_minus),"dEdxMinus");
206  r.put(std::move(pdEdx_plus),"dEdxPlus");
207  r.put(std::move(pdEdx_true),"dEdxTrue");
208  return true;
209  }
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
Definition: DataViewImpl.h:730
bool calib::MuondEdx::filter ( art::Event e)
overridevirtual

Get the reconstructed tracks

Implements art::EDFilter.

Definition at line 94 of file MuondEdx_module.cc.

References geo::GeometryBase::CellId(), PandAna.Demos.tute_pid_validation::cid, geo::GeometryBase::DetId(), fdEdx, fdEdx_minus, fdEdx_plus, fdEdx_true, geo::GeometryBase::FirstPlaneInMuonCatcher(), fPCHitLabel, fQualXYName, fStopperLabel, fSysShift, art::DataViewImpl::getByLabel(), getPECorr(), geo::GeometryBase::getPlaneID(), hits(), MECModelEnuComparisons::i, calib::j, novadaq::cnv::kNEARDET, path, and submit_syst::x.

95  {
96  /// Get the reconstructed tracks
98  e.getByLabel(fStopperLabel, tracks);
99  if( tracks->size() == 0 ) return true;
100 
102  if( !PCHitGetter.isValid() ) return false;
103 
104  // loop over stopping tracks in event
105  for( unsigned int i=0; i<tracks->size(); ++i ){
106 
107  // needed for track window, but good generally to reject protons
108  if( (*tracks)[i].TotalLength() < 200. ) continue;
109 
110  TVector3 stopXYZ;
113  int stopPlaneID = 10000;
114  int firstMuCPlane = -1;
115  bool isNearDet = false;
116 
117  //continue if track ends in the muon catcher
118  if(fGeo->DetId() == novadaq::cnv::kNEARDET){
119  isNearDet = true;
120  stopXYZ = (*tracks)[i].Start();
121  cid = fGeo->CellId(stopXYZ[0], stopXYZ[1], stopXYZ[2], 1.5, 1.5, 6., 1.0);
122  if(cid) stopPlaneID = fGeo->getPlaneID(cid);
123  firstMuCPlane = fGeo->FirstPlaneInMuonCatcher();
124  if(stopPlaneID >= firstMuCPlane) continue;
125  }
126 
127  // loop over PCHits associated to stopping track
128  std::vector<art::Ptr<caldp::PCHit> > hits = PCHitGetter.at(i);
129  if( hits.size() == 0 ) continue;
130  for( unsigned int j=0; j<hits.size(); ++j ){
131 
132  //cut if hit is inside muon catcher
133  if(isNearDet)
134  if(hits[j]->Plane() >= firstMuCPlane) continue;
135 
136  double x = (*tracks)[i].TotalLength() - hits[j]->FlightLen();
137  double path = hits[j]->Path();
138  double trueE = hits[j]->TrueMeV();
139  double PECorr = this->getPECorr(e,*hits[j]);
140  fdEdx->Fill(x,PECorr/path);
141  fdEdx_minus->Fill(x-fSysShift,PECorr/path);
142  fdEdx_plus->Fill(x+fSysShift,PECorr/path);
143  fdEdx_true->Fill(x,trueE/path);
144  }
145  }
146 
147 
148  return true;
149 
150 
151  }
std::string fStopperLabel
std::string fQualXYName
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:446
void hits()
Definition: readHits.C:15
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
const std::string path
Definition: plot_BEN.C:43
unsigned long long int CellUniqueId
Definition: CellUniqueId.h:15
double getPECorr(art::Event &e, caldp::PCHit const &pchit)
std::string fPCHitLabel
const unsigned int FirstPlaneInMuonCatcher() const
Returns the index of the first plane contained in the muon catcher.
std::array<std::vector<ProductInfo>, NumBranchTypes> const& art::ModuleBase::getConsumables ( ) const
inherited
double calib::MuondEdx::getPECorr ( art::Event e,
caldp::PCHit const &  pchit 
)
private

Definition at line 152 of file MuondEdx_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().

152  {
153 
154  //Calibrator necessary to get Atten information
156 
157  //Make mock cellhit
158  rb::CellHit cellhit;
159  cellhit.SetPlane(pchit.Plane());
160  cellhit.SetCell(pchit.Cell());
161  cellhit.SetView(pchit.View());
162  cellhit.SetTNS(pchit.TNS(),pchit.GoodTime());
163  if(!e.isRealData())cellhit.SetMC(); // assume only filled for MC...
164  cellhit.SetPE(pchit.PE());
165 
166  double pecorr = calibrator->GetPECorr(cellhit, pchit.W());
167  return pecorr;
168  }
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::MuondEdx::reconfigure ( fhicl::ParameterSet const &  p)

Definition at line 170 of file MuondEdx_module.cc.

References fPCHitLabel, fQualXYName, fStopperLabel, fSysShift, fhicl::ParameterSet::get(), and string.

Referenced by MuondEdx().

171  {
172  fPCHitLabel = pset.get< std::string >("PCHitLabel"); //Label of PCHitList module
173  fQualXYName = pset.get< std::string >("QualXYName"); //Instance label, "XY" quality hits
174  fStopperLabel = pset.get<std::string>("StopperLabel");
175  fSysShift = pset.get<double>("SysShift"); // track end point systematic shift
176  }
std::string fStopperLabel
std::string fQualXYName
std::string fPCHitLabel
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

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

Definition at line 26 of file Filter.h.

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

TH2D* calib::MuondEdx::fdEdx
private

Definition at line 65 of file MuondEdx_module.cc.

Referenced by beginJob(), endRun(), and filter().

TH2D* calib::MuondEdx::fdEdx_minus
private

Definition at line 66 of file MuondEdx_module.cc.

Referenced by beginJob(), endRun(), and filter().

TH2D* calib::MuondEdx::fdEdx_plus
private

Definition at line 67 of file MuondEdx_module.cc.

Referenced by beginJob(), endRun(), and filter().

TH2D* calib::MuondEdx::fdEdx_true
private

Definition at line 68 of file MuondEdx_module.cc.

Referenced by beginJob(), endRun(), and filter().

std::string calib::MuondEdx::fPCHitLabel
private

Definition at line 70 of file MuondEdx_module.cc.

Referenced by filter(), and reconfigure().

std::string calib::MuondEdx::fQualXYName
private

Definition at line 71 of file MuondEdx_module.cc.

Referenced by filter(), and reconfigure().

std::string calib::MuondEdx::fStopperLabel
private

Definition at line 72 of file MuondEdx_module.cc.

Referenced by filter(), and reconfigure().

double calib::MuondEdx::fSysShift
private

Definition at line 74 of file MuondEdx_module.cc.

Referenced by filter(), and reconfigure().

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

Definition at line 25 of file Filter.h.

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


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