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

Public Member Functions

 RawEVD35tTree (fhicl::ParameterSet const &pset)
 
virtual ~RawEVD35tTree ()
 
void beginJob ()
 
void beginRun (const art::Run &run)
 
void reconfigure (fhicl::ParameterSet const &pset)
 
void analyze (const art::Event &evt)
 
void analyzeRCE (const std::vector< art::Ptr< raw::RawDigit > > RawDigits)
 
void analyzeSSP (const std::vector< art::Ptr< raw::OpDetPulse > > RawPulses)
 
- 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 ()
 
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 &)
 
std::string const & processName () const
 
bool wantAllEvents () const
 
bool wantEvent (Event const &e)
 
fhicl::ParameterSetID selectorConfig () const
 
Handle< TriggerResultsgetTriggerResults (Event const &e) 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

std::string fRawDigitLabel
 
std::string fTPCInput
 
std::string fTPCInstance
 
std::string fSSPInput
 
std::string fSSPInstance
 
unsigned int fEvent
 
unsigned int fRun
 
unsigned int fSubRun
 
unsigned int fNUCh
 
unsigned int fNVCh
 
unsigned int fNZ0Ch
 
unsigned int fNZ1Ch
 
unsigned int fUChanMin
 
unsigned int fUChanMax
 
unsigned int fVChanMin
 
unsigned int fVChanMax
 
unsigned int fZ0ChanMin
 
unsigned int fZ0ChanMax
 
unsigned int fZ1ChanMin
 
unsigned int fZ1ChanMax
 
unsigned int fNticks
 
unsigned int fNofAPA
 
unsigned int fChansPerAPA
 
std::vector< unsigned int > fChan
 
std::vector< unsigned int > fAPA
 
std::vector< unsigned int > fPlane
 
std::vector< std::vector< int > > fADC
 
std::vector< std::vector< int > > fTDC
 
std::vector< int > fOpChannel
 
std::vector< int > fPMTFrame
 
std::vector< std::vector< int > > fWaveform
 
art::ServiceHandle< geo::GeometryfGeom
 
bool fIsRCE = true
 
bool fIsSSP = true
 
TTree * tRD
 

Additional Inherited Members

- Public Types inherited from art::EDAnalyzer
using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 
- Protected Member Functions inherited from art::Observer
 Observer (fhicl::ParameterSet const &config)
 
 Observer (std::vector< std::string > const &paths, fhicl::ParameterSet const &config)
 
detail::ProcessAndEventSelectorsprocessAndEventSelectors ()
 
- 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 63 of file RawEVD35tTree_module.cc.

Constructor & Destructor Documentation

AnalysisExample::RawEVD35tTree::RawEVD35tTree ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 136 of file RawEVD35tTree_module.cc.

136  : EDAnalyzer(parameterSet) {
137  this->reconfigure(parameterSet);
138  }
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:27
void reconfigure(fhicl::ParameterSet const &pset)
AnalysisExample::RawEVD35tTree::~RawEVD35tTree ( )
virtual

Definition at line 156 of file RawEVD35tTree_module.cc.

156 {}

Member Function Documentation

void AnalysisExample::RawEVD35tTree::analyze ( const art::Event evt)

Definition at line 230 of file RawEVD35tTree_module.cc.

230  {
231 
232  fEvent = event.id().event();
233  fRun = event.run();
234  fSubRun = event.subRun();
235  // unsigned int tpcid, cryoid;
236 
237  // Get the objects holding raw information: RawDigit for TPC data, OpDetPulse for SSP data
239  event.getByLabel(fTPCInput, fTPCInstance, RawTPC);
241  event.getByLabel(fSSPInput, fSSPInstance, RawSSP);
242 
243  // Check to see which data is present
244  try { RawTPC->size(); }
245  catch(std::exception const&) { fIsRCE = false; }
246  try { RawSSP->size(); }
247  catch(std::exception const&) { fIsSSP = false; }
248 
249  // Fill pointer vectors - more useful form for the raw data
250  std::vector< art::Ptr<raw::RawDigit> > RawDigits;
251  if (fIsRCE) art::fill_ptr_vector(RawDigits, RawTPC);
252  std::vector< art::Ptr<raw::OpDetPulse> > RawPulses;
253  if (fIsSSP) art::fill_ptr_vector(RawPulses, RawSSP);
254 
255  fADC.clear();
256  fTDC.clear();
257  fChan.clear();
258  fAPA.clear();
259  fPlane.clear();
260  fWaveform.clear();
261 
262  if (fIsRCE) analyzeRCE(RawDigits);
263  if (fIsSSP) analyzeSSP(RawPulses);
264 
265  tRD->Fill();
266  return;
267 
268  }
std::vector< std::vector< int > > fWaveform
std::vector< unsigned int > fPlane
void analyzeRCE(const std::vector< art::Ptr< raw::RawDigit > > RawDigits)
std::vector< std::vector< int > > fADC
void analyzeSSP(const std::vector< art::Ptr< raw::OpDetPulse > > RawPulses)
std::vector< unsigned int > fChan
std::vector< std::vector< int > > fTDC
std::vector< unsigned int > fAPA
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:291
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void AnalysisExample::RawEVD35tTree::analyzeRCE ( const std::vector< art::Ptr< raw::RawDigit > >  RawDigits)

Definition at line 270 of file RawEVD35tTree_module.cc.

270  {
271 
272  // Loop over RawDigits (TPC channels)
273  for(size_t d = 0; d < RawDigits.size(); d++) {
274 
276  digit = RawDigits.at(d);
277 
278  // Get the channel number for this digit
279  uint32_t chan = digit->Channel();
280  int nSamples = digit->Samples();
281  unsigned int apa = std::floor( chan/fChansPerAPA );
282  // tpcid=fGeom->ChannelToWire(chan)[0].TPC;
283  // cryoid=fGeom->ChannelToWire(chan)[0].Cryostat;
284  int Plane=0;
285  if( fGeom->View(chan) == geo::kU) Plane=0;
286  if( fGeom->View(chan) == geo::kV) Plane=1;
287  if ( fGeom->View(chan) == geo::kZ && fGeom->ChannelToWire(chan)[0].TPC % 2 == 0) Plane=2;
288  if ( fGeom->View(chan) == geo::kZ && fGeom->ChannelToWire(chan)[0].TPC % 2 == 1) Plane=3;
289 
290  std::vector<short> uncompressed(digit->Samples());
291  raw::Uncompress(digit->ADCs(), uncompressed, digit->Compression());
292 
293  std::vector<int> tmpADC;
294  std::vector<int> tmpTDC;
295  for (int i=0; i<nSamples; i++) {
296  short adc = uncompressed[i];
297  if(adc!=0) {
298  tmpADC.push_back(int(adc));
299  tmpTDC.push_back(int(i));
300  }
301  }
302 
303  fADC.push_back(tmpADC);
304  fTDC.push_back(tmpTDC);
305  fChan.push_back(chan);
306  fAPA.push_back(apa);
307  fPlane.push_back(Plane);
308 
309  } // End RawDigit function
310 
311  }
const ADCvector_t & ADCs() const
Reference to the compressed ADC count vector.
Definition: RawDigit.h:210
ULong64_t Samples() const
Number of samples in the uncompressed ADC data.
Definition: RawDigit.h:213
Planes which measure V.
Definition: geo_types.h:126
std::vector< unsigned int > fPlane
ChannelID_t Channel() const
DAQ channel this raw data was read from.
Definition: RawDigit.h:212
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
Planes which measure Z direction.
Definition: geo_types.h:128
Planes which measure U.
Definition: geo_types.h:125
unsigned int uint32_t
Definition: stdint.h:126
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
raw::Compress_t Compression() const
Compression algorithm used to store the ADC counts.
Definition: RawDigit.h:216
std::vector< std::vector< int > > fADC
std::vector< unsigned int > fChan
std::vector< std::vector< int > > fTDC
std::vector< unsigned int > fAPA
void Uncompress(const std::vector< short > &adc, std::vector< short > &uncompressed, raw::Compress_t compress)
Uncompresses a raw data buffer.
Definition: raw.cxx:755
recob::tracking::Plane Plane
Definition: TrackState.h:17
art::ServiceHandle< geo::Geometry > fGeom
void AnalysisExample::RawEVD35tTree::analyzeSSP ( const std::vector< art::Ptr< raw::OpDetPulse > >  RawPulses)

Definition at line 313 of file RawEVD35tTree_module.cc.

313  {
314 
315  // Loop over OpDetPulses (SSP channels)
316  for(size_t p = 0; p < RawPulses.size(); p++) {
317 
318  art::Ptr<raw::OpDetPulse> pulsePtr;
319  pulsePtr = RawPulses.at(p);
320  raw::OpDetPulse pulse = *pulsePtr;
321 
322  unsigned short opchan = pulse.OpChannel();
323  unsigned short nsamples = pulse.Samples();
324  std::vector<short> waveform = pulse.Waveform();
325  unsigned int PMTFrame = pulse.PMTFrame();
326 
327  std::vector<int> tmpWaveform;
328  for (int i=0; i<nsamples; i++) {
329  short adc = waveform[i];
330  tmpWaveform.push_back(int(adc));
331  }
332 
333  fWaveform.push_back(tmpWaveform);
334  fOpChannel.push_back(opchan);
335  fPMTFrame.push_back(PMTFrame);
336 
337  } // End OpDetPulse function
338 
339  }
std::vector< std::vector< int > > fWaveform
unsigned short OpChannel() const
Definition: OpDetPulse.h:61
const std::vector< short > & Waveform() const
Definition: OpDetPulse.h:59
unsigned short Samples() const
Definition: OpDetPulse.h:62
p
Definition: test.py:223
Definition: fwd.h:29
unsigned int PMTFrame() const
Definition: OpDetPulse.h:63
void AnalysisExample::RawEVD35tTree::beginJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 160 of file RawEVD35tTree_module.cc.

160  {
161 
163 
164  // Accquiring geometry data
167 
168  // Defining a Tree
169  tRD = tfs->make<TTree>("RawData","Raw Data Display");
170  tRD->Branch("Run",&fRun,"Run/i");
171  tRD->Branch("SubRun",&fSubRun,"SubRun/i");
172  tRD->Branch("Event",&fEvent,"Event/i");
173 
174  // TPC info
175  tRD->Branch("ADC",&fADC);
176  tRD->Branch("TDC",&fTDC);
177  tRD->Branch("Nticks",&fNticks,"Nticks/i");
178  tRD->Branch("NofUChan",&fNUCh,"NofUChan/i");
179  tRD->Branch("NofVChan",&fNVCh,"NofVChan/i");
180  tRD->Branch("NofZ0Chan",&fNZ0Ch,"NofZ0Chan/i");
181  tRD->Branch("NofZ1Chan",&fNZ1Ch,"NofZ1Chan/i");
182  tRD->Branch("Chan",&fChan);
183  tRD->Branch("APA",&fAPA);
184  tRD->Branch("Plane",&fPlane);
185 
186  // SSP info
187  tRD->Branch("Waveform",&fWaveform);
188  tRD->Branch("OpChan",&fOpChannel);
189  tRD->Branch("PMTFrame",&fPMTFrame);
190 
191  // loop through channels in the first APA to find the channel boundaries for each view
192  // will adjust for desired APA after
193  fUChanMin = 0;
196  fZ1ChanMax = fChansPerAPA - 1;
197  for ( unsigned int c = fUChanMin + 1; c < fZ1ChanMax; c++ ){
198  if ( fGeom->View(c) == geo::kV && fGeom->View(c-1) == geo::kU ){
199  fVChanMin = c;
200  fUChanMax = c - 1;
201  }
202  if ( fGeom->View(c) == geo::kZ && fGeom->View(c-1) == geo::kV ){
203  fZ0ChanMin = c;
204  fVChanMax = c-1;
205  }
206  if ( fGeom->View(c) == geo::kZ && fGeom->ChannelToWire(c)[0].TPC == fGeom->ChannelToWire(c-1)[0].TPC + 1 ){
207  fZ1ChanMin = c;
208  fZ0ChanMax = c-1;
209  }
210  }
211 
215  fNZ1Ch=fZ1ChanMax-fZ1ChanMin+1;
216 
217  // ofstream outfile;
218  // outfile.open("msglog.txt");
219  //outfile<<fNUCh<<" "<<fNVCh<<" "<<fNZ0Ch<<" "<<fNZ1Ch<<std::endl;
220  }
std::vector< std::vector< int > > fWaveform
Planes which measure V.
Definition: geo_types.h:126
std::vector< unsigned int > fPlane
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
Planes which measure Z direction.
Definition: geo_types.h:128
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
unsigned int Nchannels() const
Returns the number of TPC readout channels in the detector.
Planes which measure U.
Definition: geo_types.h:125
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
unsigned int NTPC(unsigned int cstat=0) const
Returns the total number of TPCs in the specified cryostat.
std::vector< std::vector< int > > fADC
std::vector< unsigned int > fChan
std::vector< std::vector< int > > fTDC
std::vector< unsigned int > fAPA
art::ServiceHandle< geo::Geometry > fGeom
void AnalysisExample::RawEVD35tTree::beginRun ( const art::Run run)

Definition at line 224 of file RawEVD35tTree_module.cc.

224  {
225  }
void AnalysisExample::RawEVD35tTree::reconfigure ( fhicl::ParameterSet const &  pset)

Definition at line 143 of file RawEVD35tTree_module.cc.

143  {
144  fTPCInput = p.get< std::string >("TPCInputModule");
145  fTPCInstance = p.get< std::string >("TPCInstanceName");
146  fSSPInput = p.get< std::string >("SSPInputModule");
147  fSSPInstance = p.get< std::string >("SSPInstanceName");
148  auto const *fDetProp = lar::providerFrom<detinfo::DetectorPropertiesService>();
149  fNticks = fDetProp->NumberTimeSamples();
150  return;
151  }
std::string string
Definition: nybbler.cc:12
p
Definition: test.py:223

Member Data Documentation

std::vector<std::vector<int> > AnalysisExample::RawEVD35tTree::fADC
private

Definition at line 115 of file RawEVD35tTree_module.cc.

std::vector<unsigned int> AnalysisExample::RawEVD35tTree::fAPA
private

Definition at line 113 of file RawEVD35tTree_module.cc.

std::vector<unsigned int> AnalysisExample::RawEVD35tTree::fChan
private

Definition at line 112 of file RawEVD35tTree_module.cc.

unsigned int AnalysisExample::RawEVD35tTree::fChansPerAPA
private

Definition at line 111 of file RawEVD35tTree_module.cc.

unsigned int AnalysisExample::RawEVD35tTree::fEvent
private

Definition at line 91 of file RawEVD35tTree_module.cc.

art::ServiceHandle<geo::Geometry> AnalysisExample::RawEVD35tTree::fGeom
private

Definition at line 123 of file RawEVD35tTree_module.cc.

bool AnalysisExample::RawEVD35tTree::fIsRCE = true
private

Definition at line 126 of file RawEVD35tTree_module.cc.

bool AnalysisExample::RawEVD35tTree::fIsSSP = true
private

Definition at line 127 of file RawEVD35tTree_module.cc.

unsigned int AnalysisExample::RawEVD35tTree::fNofAPA
private

Definition at line 110 of file RawEVD35tTree_module.cc.

unsigned int AnalysisExample::RawEVD35tTree::fNticks
private

Definition at line 109 of file RawEVD35tTree_module.cc.

unsigned int AnalysisExample::RawEVD35tTree::fNUCh
private

Definition at line 96 of file RawEVD35tTree_module.cc.

unsigned int AnalysisExample::RawEVD35tTree::fNVCh
private

Definition at line 97 of file RawEVD35tTree_module.cc.

unsigned int AnalysisExample::RawEVD35tTree::fNZ0Ch
private

Definition at line 98 of file RawEVD35tTree_module.cc.

unsigned int AnalysisExample::RawEVD35tTree::fNZ1Ch
private

Definition at line 99 of file RawEVD35tTree_module.cc.

std::vector<int> AnalysisExample::RawEVD35tTree::fOpChannel
private

Definition at line 119 of file RawEVD35tTree_module.cc.

std::vector<unsigned int> AnalysisExample::RawEVD35tTree::fPlane
private

Definition at line 114 of file RawEVD35tTree_module.cc.

std::vector<int> AnalysisExample::RawEVD35tTree::fPMTFrame
private

Definition at line 120 of file RawEVD35tTree_module.cc.

std::string AnalysisExample::RawEVD35tTree::fRawDigitLabel
private

Definition at line 84 of file RawEVD35tTree_module.cc.

unsigned int AnalysisExample::RawEVD35tTree::fRun
private

Definition at line 92 of file RawEVD35tTree_module.cc.

std::string AnalysisExample::RawEVD35tTree::fSSPInput
private

Definition at line 87 of file RawEVD35tTree_module.cc.

std::string AnalysisExample::RawEVD35tTree::fSSPInstance
private

Definition at line 88 of file RawEVD35tTree_module.cc.

unsigned int AnalysisExample::RawEVD35tTree::fSubRun
private

Definition at line 93 of file RawEVD35tTree_module.cc.

std::vector<std::vector<int> > AnalysisExample::RawEVD35tTree::fTDC
private

Definition at line 116 of file RawEVD35tTree_module.cc.

std::string AnalysisExample::RawEVD35tTree::fTPCInput
private

Definition at line 85 of file RawEVD35tTree_module.cc.

std::string AnalysisExample::RawEVD35tTree::fTPCInstance
private

Definition at line 86 of file RawEVD35tTree_module.cc.

unsigned int AnalysisExample::RawEVD35tTree::fUChanMax
private

Definition at line 102 of file RawEVD35tTree_module.cc.

unsigned int AnalysisExample::RawEVD35tTree::fUChanMin
private

Definition at line 101 of file RawEVD35tTree_module.cc.

unsigned int AnalysisExample::RawEVD35tTree::fVChanMax
private

Definition at line 104 of file RawEVD35tTree_module.cc.

unsigned int AnalysisExample::RawEVD35tTree::fVChanMin
private

Definition at line 103 of file RawEVD35tTree_module.cc.

std::vector<std::vector<int> > AnalysisExample::RawEVD35tTree::fWaveform
private

Definition at line 121 of file RawEVD35tTree_module.cc.

unsigned int AnalysisExample::RawEVD35tTree::fZ0ChanMax
private

Definition at line 106 of file RawEVD35tTree_module.cc.

unsigned int AnalysisExample::RawEVD35tTree::fZ0ChanMin
private

Definition at line 105 of file RawEVD35tTree_module.cc.

unsigned int AnalysisExample::RawEVD35tTree::fZ1ChanMax
private

Definition at line 108 of file RawEVD35tTree_module.cc.

unsigned int AnalysisExample::RawEVD35tTree::fZ1ChanMin
private

Definition at line 107 of file RawEVD35tTree_module.cc.

TTree* AnalysisExample::RawEVD35tTree::tRD
private

Definition at line 130 of file RawEVD35tTree_module.cc.


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