Public Member Functions | Private Member Functions | Private Attributes | List of all members
pdunedp::DEdxdp Class Reference
Inheritance diagram for pdunedp::DEdxdp:
art::EDAnalyzer art::detail::Analyzer art::detail::LegacyModule art::Observer art::ModuleBase

Public Member Functions

 DEdxdp (fhicl::ParameterSet const &p)
 
 DEdxdp (DEdxdp const &)=delete
 
 DEdxdp (DEdxdp &&)=delete
 
DEdxdpoperator= (DEdxdp const &)=delete
 
DEdxdpoperator= (DEdxdp &&)=delete
 
void analyze (art::Event const &e) override
 
void beginJob () override
 
void endJob () override
 
void reconfigure (fhicl::ParameterSet const &p)
 
- Public Member Functions inherited from art::EDAnalyzer
 EDAnalyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDAnalyzer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Analyzer
virtual ~Analyzer () noexcept
 
 Analyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 Analyzer (Table< Config > const &config)
 
void doBeginJob (SharedResources const &resources)
 
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 &mc)
 
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)
 
- Public Member Functions inherited from art::Observer
 ~Observer () noexcept
 
 Observer (Observer const &)=delete
 
 Observer (Observer &&)=delete
 
Observeroperator= (Observer const &)=delete
 
Observeroperator= (Observer &&)=delete
 
void registerProducts (ProductDescriptions &, ModuleDescription const &)
 
void fillDescriptions (ModuleDescription const &)
 
fhicl::ParameterSetID selectorConfig () const
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
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< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Member Functions

void CountdEdx (detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const std::vector< art::Ptr< recob::Hit > > &hits, const std::vector< recob::TrackHitMeta const * > &data)
 
void ResetVars ()
 

Private Attributes

TTree * fTree
 
TTree * fTreere
 
int fRun
 
int fSubRun
 
int fEvent
 
int fCryo
 
int fTPC
 
int fView
 
int fTrackID
 
size_t fNumberOfTracks
 
double fdQdx
 
double fdEdx
 
double fdQ
 
double fdx
 
std::string fHitModuleLabel
 
std::string fTrackModuleLabel
 
std::string fCalorimetryModuleLabel
 
calo::CalorimetryAlg fCalorimetryAlg
 
int fGainPerView
 

Additional Inherited Members

- Public Types inherited from art::EDAnalyzer
using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 
- Protected Member Functions inherited from art::Observer
std::string const & processName () const
 
bool wantAllEvents () const noexcept
 
bool wantEvent (ScheduleID id, Event const &e) const
 
Handle< TriggerResultsgetTriggerResults (Event const &e) const
 
 Observer (fhicl::ParameterSet const &config)
 
 Observer (std::vector< std::string > const &select_paths, std::vector< std::string > const &reject_paths, fhicl::ParameterSet const &config)
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (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< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Detailed Description

Definition at line 51 of file DEdxdp_module.cc.

Constructor & Destructor Documentation

pdunedp::DEdxdp::DEdxdp ( fhicl::ParameterSet const &  p)
explicit

Definition at line 103 of file DEdxdp_module.cc.

104  :
105  EDAnalyzer(p),
106  fCalorimetryAlg(p.get<fhicl::ParameterSet>("CalorimetryAlg"))
107  // More initializers here.
108 {
109  reconfigure(p);
110 }
calo::CalorimetryAlg fCalorimetryAlg
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
void reconfigure(fhicl::ParameterSet const &p)
p
Definition: test.py:223
pdunedp::DEdxdp::DEdxdp ( DEdxdp const &  )
delete
pdunedp::DEdxdp::DEdxdp ( DEdxdp &&  )
delete

Member Function Documentation

void pdunedp::DEdxdp::analyze ( art::Event const &  e)
overridevirtual

Implements art::EDAnalyzer.

Definition at line 146 of file DEdxdp_module.cc.

147 {
148  // Implementation of required member function here.
149  ResetVars();
150  fRun = e.run();
151  fSubRun = e.subRun();
152  fEvent = e.id().event();
153 
154  // tracks
155  auto trkHandle = e.getValidHandle< std::vector<recob::Track> >(fTrackModuleLabel);
156  fNumberOfTracks = trkHandle->size();
157 
158  const art::FindManyP<recob::Hit, recob::TrackHitMeta> fmthm(trkHandle, e, fTrackModuleLabel);
159  auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(e);
160  auto const detProp = art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(e, clockData);
161 
162  if (fmthm.isValid())
163  {
164  // loop over tracks
165  for (size_t t = 0; t < trkHandle->size(); ++t)
166  {
167  auto vhit = fmthm.at(t);
168  auto vmeta = fmthm.data(t);
169 
170  fTrackID = t;
171  CountdEdx(clockData, detProp, vhit, vmeta);
172  }
173  }
174  fTreere->Fill();
175 }
size_t fNumberOfTracks
std::string fTrackModuleLabel
const double e
void CountdEdx(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const std::vector< art::Ptr< recob::Hit > > &hits, const std::vector< recob::TrackHitMeta const * > &data)
void pdunedp::DEdxdp::beginJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 112 of file DEdxdp_module.cc.

113 {
115  fTreere = tfs->make<TTree>("entries","entries tree");
116  fTree = tfs->make<TTree>("DEdx","dedx tree");
117 
118  fTreere->Branch("fRun", &fRun, "fRun/I");
119  fTreere->Branch("fEvent", &fEvent, "fEvent/I");
120  fTreere->Branch("fNumberOfTracks", &fNumberOfTracks, "fNumberOfTracks/I");
121 
122  fTree->Branch("fRun", &fRun, "fRun/I");
123  fTree->Branch("fSubRun", &fSubRun, "fSubRun/I");
124  fTree->Branch("fEvent", &fEvent, "fEvent/I");
125  fTree->Branch("fCryo", &fCryo, "fCryo/I");
126  fTree->Branch("fTPC", &fTPC, "fTPC/I");
127  fTree->Branch("fTrackID", &fTrackID, "fTrackID/I");
128  fTree->Branch("fView", &fView, "fView/I");
129  fTree->Branch("fdQdx", &fdQdx, "fdQdx/D");
130  fTree->Branch("fdEdx", &fdEdx, "fdEdx/D");
131  fTree->Branch("fdQ", &fdQ, "fdQ/D");
132  fTree->Branch("fdx", &fdx, "fdx/D");
133 }
size_t fNumberOfTracks
void pdunedp::DEdxdp::CountdEdx ( detinfo::DetectorClocksData const &  clockData,
detinfo::DetectorPropertiesData const &  detProp,
const std::vector< art::Ptr< recob::Hit > > &  hits,
const std::vector< recob::TrackHitMeta const * > &  data 
)
private

Definition at line 177 of file DEdxdp_module.cc.

180 {
181  for (size_t h = 0; h < hits.size(); ++h)
182  {
183  fCryo = hits[h]->WireID().Cryostat;
184  fTPC = hits[h]->WireID().TPC;
185  fView = hits[h]->WireID().Plane;
186 
187  unsigned short plane = hits[h]->WireID().Plane;
188  unsigned short time = hits[h]->PeakTime();
189 
190  double dqadc = hits[h]->Integral();
191  if (!std::isnormal(dqadc) || (dqadc < 0)) dqadc = 0.0;
192 
193  double t0 = 0;
194 
195  fdQdx = 0.0;
196 
197  fdQ = dqadc;
198  fdx = data[h]->Dx();
199  if ((fdx > 0) && (fdQ > 0))
200  {
201  fdQdx = fdQ/fdx;
202  fdQdx /= fGainPerView;
203  fdEdx = fCalorimetryAlg.dEdx_AREA(clockData, detProp, fdQdx, time, plane, t0);
204  fdQdx *= fCalorimetryAlg.LifetimeCorrection(clockData, detProp, time, t0);
205  //if (fdEdx > 35) fdEdx = 35;
206  }
207  fTree->Fill();
208  }
209 }
code to link reconstructed objects back to the MC truth information
calo::CalorimetryAlg fCalorimetryAlg
double dEdx_AREA(detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, recob::Hit const &hit, double pitch, double T0=0) const
double LifetimeCorrection(detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, double time, double T0=0) const
void pdunedp::DEdxdp::endJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 135 of file DEdxdp_module.cc.

136 {
137 }
DEdxdp& pdunedp::DEdxdp::operator= ( DEdxdp const &  )
delete
DEdxdp& pdunedp::DEdxdp::operator= ( DEdxdp &&  )
delete
void pdunedp::DEdxdp::reconfigure ( fhicl::ParameterSet const &  p)

Definition at line 139 of file DEdxdp_module.cc.

140 {
141  fHitModuleLabel = p.get< std::string >("HitModuleLabel");
142  fTrackModuleLabel = p.get< std::string >("TrackModuleLabel");
143  fGainPerView = p.get<int>("GainPerView");
144 }
std::string string
Definition: nybbler.cc:12
std::string fHitModuleLabel
std::string fTrackModuleLabel
p
Definition: test.py:223
void pdunedp::DEdxdp::ResetVars ( )
private

Definition at line 211 of file DEdxdp_module.cc.

212 {
213  fdQdx = 0.0;
214  fdEdx = 0.0;
215  fdQ = 0.0;
216  fdx = 0.0;
217  fNumberOfTracks = 0;
218 }
size_t fNumberOfTracks

Member Data Documentation

calo::CalorimetryAlg pdunedp::DEdxdp::fCalorimetryAlg
private

Definition at line 98 of file DEdxdp_module.cc.

std::string pdunedp::DEdxdp::fCalorimetryModuleLabel
private

Definition at line 97 of file DEdxdp_module.cc.

int pdunedp::DEdxdp::fCryo
private

Definition at line 83 of file DEdxdp_module.cc.

double pdunedp::DEdxdp::fdEdx
private

Definition at line 90 of file DEdxdp_module.cc.

double pdunedp::DEdxdp::fdQ
private

Definition at line 91 of file DEdxdp_module.cc.

double pdunedp::DEdxdp::fdQdx
private

Definition at line 89 of file DEdxdp_module.cc.

double pdunedp::DEdxdp::fdx
private

Definition at line 92 of file DEdxdp_module.cc.

int pdunedp::DEdxdp::fEvent
private

Definition at line 82 of file DEdxdp_module.cc.

int pdunedp::DEdxdp::fGainPerView
private

Definition at line 99 of file DEdxdp_module.cc.

std::string pdunedp::DEdxdp::fHitModuleLabel
private

Definition at line 95 of file DEdxdp_module.cc.

size_t pdunedp::DEdxdp::fNumberOfTracks
private

Definition at line 87 of file DEdxdp_module.cc.

int pdunedp::DEdxdp::fRun
private

Definition at line 80 of file DEdxdp_module.cc.

int pdunedp::DEdxdp::fSubRun
private

Definition at line 81 of file DEdxdp_module.cc.

int pdunedp::DEdxdp::fTPC
private

Definition at line 84 of file DEdxdp_module.cc.

int pdunedp::DEdxdp::fTrackID
private

Definition at line 86 of file DEdxdp_module.cc.

std::string pdunedp::DEdxdp::fTrackModuleLabel
private

Definition at line 96 of file DEdxdp_module.cc.

TTree* pdunedp::DEdxdp::fTree
private

Definition at line 78 of file DEdxdp_module.cc.

TTree* pdunedp::DEdxdp::fTreere
private

Definition at line 79 of file DEdxdp_module.cc.

int pdunedp::DEdxdp::fView
private

Definition at line 85 of file DEdxdp_module.cc.


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