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

Public Member Functions

 WireChgAna (fhicl::ParameterSet const &p)
 
 WireChgAna (WireChgAna const &)=delete
 
 WireChgAna (WireChgAna &&)=delete
 
WireChgAnaoperator= (WireChgAna const &)=delete
 
WireChgAnaoperator= (WireChgAna &&)=delete
 
void analyze (art::Event const &e) override
 
void beginJob () override
 
void endJob () override
 
- 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 Attributes

TTree * ftree
 
TH1D * rawwf [3][800]
 
TH1D * deconwf [3][800]
 
double charge [3][800]
 
double deconchg [3][800]
 
double hitchg [3][800]
 
double hitsumadc [3][800]
 
double nelec [3][800]
 

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 35 of file WireChgAna_module.cc.

Constructor & Destructor Documentation

pdsp::WireChgAna::WireChgAna ( fhicl::ParameterSet const &  p)
explicit

Definition at line 69 of file WireChgAna_module.cc.

70  : EDAnalyzer{p} // ,
71  // More initializers here.
72 {
73  // Call appropriate consumes<>() for any products to be retrieved by this module.
74 }
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
p
Definition: test.py:223
pdsp::WireChgAna::WireChgAna ( WireChgAna const &  )
delete
pdsp::WireChgAna::WireChgAna ( WireChgAna &&  )
delete

Member Function Documentation

void pdsp::WireChgAna::analyze ( art::Event const &  e)
overridevirtual

Implements art::EDAnalyzer.

Definition at line 76 of file WireChgAna_module.cc.

77 {
78 
79  for (int i = 0; i<3; ++i){
80  for (int j = 0; j<800; ++j){
81  charge[i][j] = 0;
82  nelec[i][j] = 0;
83  deconchg[i][j] = 0;
84  hitchg[i][j] = 0;
85  hitsumadc[i][j] = 0;
86  }
87  }
88 
89  // Implementation of required member function here.
90  std::vector<art::Ptr<raw::RawDigit> > rawlist;
91  art::InputTag itag("tpcrawdecoder","daq");
92  auto rawListHandle = e.getHandle< std::vector<raw::RawDigit> >(itag);
93  if (rawListHandle) art::fill_ptr_vector(rawlist, rawListHandle);
94 
95  std::vector < art::Ptr < recob::Wire > > wires;
96  art::InputTag itag2("wclsdatanfsp","gauss");
97  auto wireListHandle = e.getHandle< std::vector < recob::Wire > >(itag2);
98  if (wireListHandle) {
99  art::fill_ptr_vector(wires, wireListHandle);
100  }
101 
102  std::vector <art::Ptr<recob::Hit> > hits;
103  auto hitListHandle = e.getHandle<std::vector<recob::Hit> >("gaushit");
104  if (hitListHandle) {
105  art::fill_ptr_vector(hits, hitListHandle);
106  }
107 
108  auto const* geo = lar::providerFrom<geo::Geometry>();
109 
110  auto simChannelHandle = e.getValidHandle<std::vector<sim::SimChannel>>("tpcrawdecoder:simpleSC");
111 
112  for (unsigned int ich = 0; ich < rawlist.size(); ++ich){
113  const auto & digitVec = rawlist[ich];
114  const auto & wireid = geo->ChannelToWire(digitVec->Channel());
115  if (wireid[0].TPC != 1) continue;
116  //if (wireid[0].Plane != 2) continue;
117  int wire = wireid[0].Wire;
118  int plane = wireid[0].Plane;
119  double this_charge = 0;
120  std::vector<short> rawadc(6000);
121  raw::Uncompress(digitVec->ADCs(), rawadc, digitVec->GetPedestal(), digitVec->Compression());
122  for (size_t itck = 0; itck < rawadc.size(); ++itck){
123  this_charge += rawadc[itck] - digitVec->GetPedestal();
124  rawwf[plane][wire]->SetBinContent(itck, rawadc[itck] - digitVec->GetPedestal());
125  }
126  charge[plane][wire] = this_charge;
127  }
128 
129  for ( auto const& channel : (*simChannelHandle) ){
130  const auto & wireid = geo->ChannelToWire(channel.Channel());
131  if (wireid[0].TPC != 1) continue;
132  //if (wireid[0].Plane != 2) continue;
133  int wire = wireid[0].Wire;
134  int plane = wireid[0].Plane;
135  double this_nelec = 0;
136  auto const& timeSlices = channel.TDCIDEMap();
137  for ( auto const& timeSlice : timeSlices ){
138  auto const& energyDeposits = timeSlice.second;
139  for ( auto const& energyDeposit : energyDeposits ){
140  this_nelec += energyDeposit.numElectrons;
141  }
142  }
143  nelec[plane][wire] = this_nelec;
144  }
145 
146  for (unsigned int ich = 0; ich < wires.size(); ++ich){
147  const auto & wireid = geo->ChannelToWire(wires[ich]->Channel());
148  if (wireid[0].TPC != 1) continue;
149  //if (wireid[0].Plane != 2) continue;
150  int wire = wireid[0].Wire;
151  int plane = wireid[0].Plane;
152  double this_charge = 0;
153  const auto & signal = wires[ich]->Signal();
154 
155  for (size_t itck = 0; itck < signal.size(); ++itck){
156  this_charge += signal[itck];
157  deconwf[plane][wire]->SetBinContent(itck, signal[itck]);
158  }
159  deconchg[plane][wire] = this_charge;
160  }
161 
162  for (auto const & hit : hits){
163  if (hit->WireID().TPC != 1) continue;
164  int wire = hit->WireID().Wire;
165  int plane = hit->WireID().Plane;
166  hitchg[plane][wire] += hit->Integral();
167  hitsumadc[plane][wire] += hit->SummedADC();
168  }
169 
170  ftree->Fill();
171 }
TH1D * rawwf[3][800]
double nelec[3][800]
double charge[3][800]
double hitchg[3][800]
uint8_t channel
Definition: CRTFragment.hh:201
double hitsumadc[3][800]
const double e
double deconchg[3][800]
Detector simulation of raw signals on wires.
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:297
void Uncompress(const std::vector< short > &adc, std::vector< short > &uncompressed, raw::Compress_t compress)
Uncompresses a raw data buffer.
Definition: raw.cxx:776
LArSoft geometry interface.
Definition: ChannelGeo.h:16
TH1D * deconwf[3][800]
void pdsp::WireChgAna::beginJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 173 of file WireChgAna_module.cc.

174 {
175  art::ServiceHandle<art::TFileService> fileServiceHandle;
176  ftree = fileServiceHandle->make<TTree>("ftree", "raw digit info");
177  ftree->Branch("charge", charge, "charge[3][800]/D");
178  ftree->Branch("nelec", nelec, "nelec[3][800]/D");
179  ftree->Branch("deconchg", deconchg, "deconchg[3][800]/D");
180  ftree->Branch("hitchg", hitchg, "hitchg[3][800]/D");
181  ftree->Branch("hitsumadc", hitsumadc, "hitsumadc[3][800]/D");
182 
183  for (int i = 0; i<3; ++i){
184  for (int j = 0; j<800; ++j){
185  rawwf[i][j] = fileServiceHandle->make<TH1D>(Form("rawwf_%d_%d",i,j),Form("Plane %d Wire %d",i,j),6000,0,6000);
186  deconwf[i][j] = fileServiceHandle->make<TH1D>(Form("deconwf_%d_%d",i,j),Form("Plane %d Wire %d",i,j),6000,0,6000);
187  }
188  }
189 
190 }
TH1D * rawwf[3][800]
double nelec[3][800]
double charge[3][800]
double hitchg[3][800]
double hitsumadc[3][800]
double deconchg[3][800]
TH1D * deconwf[3][800]
void pdsp::WireChgAna::endJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 192 of file WireChgAna_module.cc.

193 {
194  // Implementation of optional member function here.
195 }
WireChgAna& pdsp::WireChgAna::operator= ( WireChgAna const &  )
delete
WireChgAna& pdsp::WireChgAna::operator= ( WireChgAna &&  )
delete

Member Data Documentation

double pdsp::WireChgAna::charge[3][800]
private

Definition at line 60 of file WireChgAna_module.cc.

double pdsp::WireChgAna::deconchg[3][800]
private

Definition at line 61 of file WireChgAna_module.cc.

TH1D* pdsp::WireChgAna::deconwf[3][800]
private

Definition at line 59 of file WireChgAna_module.cc.

TTree* pdsp::WireChgAna::ftree
private

Definition at line 57 of file WireChgAna_module.cc.

double pdsp::WireChgAna::hitchg[3][800]
private

Definition at line 62 of file WireChgAna_module.cc.

double pdsp::WireChgAna::hitsumadc[3][800]
private

Definition at line 63 of file WireChgAna_module.cc.

double pdsp::WireChgAna::nelec[3][800]
private

Definition at line 64 of file WireChgAna_module.cc.

TH1D* pdsp::WireChgAna::rawwf[3][800]
private

Definition at line 58 of file WireChgAna_module.cc.


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