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

Public Member Functions

 DEdx (fhicl::ParameterSet const &p)
 
 DEdx (DEdx const &)=delete
 
 DEdx (DEdx &&)=delete
 
DEdxoperator= (DEdx const &)=delete
 
DEdxoperator= (DEdx &&)=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

bool fCosmics
 
TTree * fTree
 
TTree * fTreere
 
int fRun
 
int fEvent
 
int fChosenView
 
size_t fNumberOfTracks
 
size_t fNumberOfTaggedTracks
 
double fdQdx
 
double fdEdx
 
double fdQ
 
double fdx
 
std::string fHitModuleLabel
 
std::string fTrackModuleLabel
 
std::string fCalorimetryModuleLabel
 
calo::CalorimetryAlg fCalorimetryAlg
 

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 DEdx_module.cc.

Constructor & Destructor Documentation

proto::DEdx::DEdx ( fhicl::ParameterSet const &  p)
explicit

Definition at line 101 of file DEdx_module.cc.

102  :
103  EDAnalyzer(p),
104  fCalorimetryAlg(p.get<fhicl::ParameterSet>("CalorimetryAlg"))
105  // More initializers here.
106 {
107  reconfigure(p);
108 }
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
void reconfigure(fhicl::ParameterSet const &p)
Definition: DEdx_module.cc:132
p
Definition: test.py:223
calo::CalorimetryAlg fCalorimetryAlg
Definition: DEdx_module.cc:97
proto::DEdx::DEdx ( DEdx const &  )
delete
proto::DEdx::DEdx ( DEdx &&  )
delete

Member Function Documentation

void proto::DEdx::analyze ( art::Event const &  e)
overridevirtual

Implements art::EDAnalyzer.

Definition at line 140 of file DEdx_module.cc.

141 {
142  // Implementation of required member function here.
143  ResetVars();
144  fRun = e.run();
145  fEvent = e.id().event();
146 
147  // tracks
148  auto trkHandle = e.getValidHandle< std::vector<recob::Track> >(fTrackModuleLabel);
149  fNumberOfTracks = trkHandle->size();
150 
151  const art::FindManyP<recob::Hit, recob::TrackHitMeta> fmthm(trkHandle, e, fTrackModuleLabel);
152 
153  // Find the tagged tracks as cosmic muons
154  const art::FindManyP<anab::CosmicTag> ct(trkHandle, e, fTrackModuleLabel);
155 
156  auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService>()->DataFor(e);
157  auto const detProp = art::ServiceHandle<detinfo::DetectorPropertiesService>()->DataFor(e, clockData);
158  if (fCosmics)
159  {
160  if (ct.isValid())
161  {
162  // loop over tracks
163  for (size_t t = 0; t < trkHandle->size(); ++t)
164  {
165  if (ct.at(t).size())
166  {
168 
169  auto vhit = fmthm.at(t);
170  auto vmeta = fmthm.data(t);
171 
172  CountdEdx(clockData, detProp, vhit, vmeta);
173  }
174  }
175  }
176  }
177  else if (fmthm.isValid())
178  {
179 
180  // loop over tracks
181  for (size_t t = 0; t < trkHandle->size(); ++t)
182  {
183  auto vhit = fmthm.at(t);
184  auto vmeta = fmthm.data(t);
185 
186  CountdEdx(clockData, detProp, vhit, vmeta);
187  }
188  }
189 
190  fTreere->Fill();
191 }
void ResetVars()
Definition: DEdx_module.cc:229
TTree * fTreere
Definition: DEdx_module.cc:81
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)
Definition: DEdx_module.cc:193
size_t fNumberOfTracks
Definition: DEdx_module.cc:85
std::string fTrackModuleLabel
Definition: DEdx_module.cc:95
size_t fNumberOfTaggedTracks
Definition: DEdx_module.cc:86
void proto::DEdx::beginJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 110 of file DEdx_module.cc.

111 {
113  fTreere = tfs->make<TTree>("entries","entries tree");
114  fTree = tfs->make<TTree>("dedx","dedx tree");
115 
116  fTreere->Branch("fRun", &fRun, "fRun/I");
117  fTreere->Branch("fEvent", &fEvent, "fEvent/I");
118  fTreere->Branch("fChosenView", &fChosenView, "fChosenView/I");
119  fTreere->Branch("fNumberOfTracks", &fNumberOfTracks, "fNumberOfTracks/I");
120  fTreere->Branch("fNumberOfTaggedTracks", &fNumberOfTaggedTracks, "fNumberOfTaggedTracks/I");
121 
122  fTree->Branch("fdQdx", &fdQdx, "fdQdx/D");
123  fTree->Branch("fdEdx", &fdEdx, "fdEdx/D");
124  fTree->Branch("fdQ", &fdQ, "fdQ/D");
125  fTree->Branch("fdx", &fdx, "fdx/D");
126 }
double fdQ
Definition: DEdx_module.cc:90
TTree * fTreere
Definition: DEdx_module.cc:81
TTree * fTree
Definition: DEdx_module.cc:80
double fdx
Definition: DEdx_module.cc:91
double fdQdx
Definition: DEdx_module.cc:88
size_t fNumberOfTracks
Definition: DEdx_module.cc:85
double fdEdx
Definition: DEdx_module.cc:89
size_t fNumberOfTaggedTracks
Definition: DEdx_module.cc:86
void proto::DEdx::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 193 of file DEdx_module.cc.

197 {
198  for (size_t h = 0; h < hits.size(); ++h)
199  {
200  unsigned short plane = hits[h]->WireID().Plane;
201  unsigned short time = hits[h]->PeakTime();
202 
203  if (plane == fChosenView)
204  {
205  double dqadc = hits[h]->Integral();
206  if (!std::isnormal(dqadc) || (dqadc < 0)) dqadc = 0.0;
207 
208  double t0 = 0;
209 
210  fdQdx = 0.0;
211  fdQ = dqadc;
212  fdx = data[h]->Dx();
213  if ((fdx > 0) && (fdQ > 0))
214  {
215  fdQdx = fdQ/fdx;
216  fdEdx = fCalorimetryAlg.dEdx_AREA(clockData, detProp, fdQdx, time, plane, t0);
217  if (fdEdx > 35) fdEdx = 35;
218  }
219  else if ((fdx == 0) && (fdQ > 0))
220  {
221 // std::cout << " the charge is positive but dx is equal zero " << std::endl;
222  }
223 
224  fTree->Fill();
225  }
226  }
227 }
code to link reconstructed objects back to the MC truth information
double fdQ
Definition: DEdx_module.cc:90
TTree * fTree
Definition: DEdx_module.cc:80
double fdx
Definition: DEdx_module.cc:91
double fdQdx
Definition: DEdx_module.cc:88
double fdEdx
Definition: DEdx_module.cc:89
double dEdx_AREA(detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, recob::Hit const &hit, double pitch, double T0=0) const
calo::CalorimetryAlg fCalorimetryAlg
Definition: DEdx_module.cc:97
void proto::DEdx::endJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 128 of file DEdx_module.cc.

129 {
130 }
DEdx& proto::DEdx::operator= ( DEdx const &  )
delete
DEdx& proto::DEdx::operator= ( DEdx &&  )
delete
void proto::DEdx::reconfigure ( fhicl::ParameterSet const &  p)

Definition at line 132 of file DEdx_module.cc.

133 {
134  fChosenView = p.get<int>("ChosenView");
135  fCosmics = p.get<bool>("Cosmics");
136  fHitModuleLabel = p.get< std::string >("HitModuleLabel");
137  fTrackModuleLabel = p.get< std::string >("TrackModuleLabel");
138 }
std::string string
Definition: nybbler.cc:12
std::string fHitModuleLabel
Definition: DEdx_module.cc:94
p
Definition: test.py:223
std::string fTrackModuleLabel
Definition: DEdx_module.cc:95
void proto::DEdx::ResetVars ( void  )
private

Definition at line 229 of file DEdx_module.cc.

230 {
231  fdQdx = 0.0;
232  fdEdx = 0.0;
233  fdQ = 0.0;
234  fdx = 0.0;
235  fNumberOfTracks = 0;
237 }
double fdQ
Definition: DEdx_module.cc:90
double fdx
Definition: DEdx_module.cc:91
double fdQdx
Definition: DEdx_module.cc:88
size_t fNumberOfTracks
Definition: DEdx_module.cc:85
double fdEdx
Definition: DEdx_module.cc:89
size_t fNumberOfTaggedTracks
Definition: DEdx_module.cc:86

Member Data Documentation

calo::CalorimetryAlg proto::DEdx::fCalorimetryAlg
private

Definition at line 97 of file DEdx_module.cc.

std::string proto::DEdx::fCalorimetryModuleLabel
private

Definition at line 96 of file DEdx_module.cc.

int proto::DEdx::fChosenView
private

Definition at line 84 of file DEdx_module.cc.

bool proto::DEdx::fCosmics
private

Definition at line 78 of file DEdx_module.cc.

double proto::DEdx::fdEdx
private

Definition at line 89 of file DEdx_module.cc.

double proto::DEdx::fdQ
private

Definition at line 90 of file DEdx_module.cc.

double proto::DEdx::fdQdx
private

Definition at line 88 of file DEdx_module.cc.

double proto::DEdx::fdx
private

Definition at line 91 of file DEdx_module.cc.

int proto::DEdx::fEvent
private

Definition at line 83 of file DEdx_module.cc.

std::string proto::DEdx::fHitModuleLabel
private

Definition at line 94 of file DEdx_module.cc.

size_t proto::DEdx::fNumberOfTaggedTracks
private

Definition at line 86 of file DEdx_module.cc.

size_t proto::DEdx::fNumberOfTracks
private

Definition at line 85 of file DEdx_module.cc.

int proto::DEdx::fRun
private

Definition at line 82 of file DEdx_module.cc.

std::string proto::DEdx::fTrackModuleLabel
private

Definition at line 95 of file DEdx_module.cc.

TTree* proto::DEdx::fTree
private

Definition at line 80 of file DEdx_module.cc.

TTree* proto::DEdx::fTreere
private

Definition at line 81 of file DEdx_module.cc.


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