Public Member Functions | Private Member Functions | Private Attributes | List of all members
EventGen::ImportSingle311Event Class Reference
Inheritance diagram for EventGen::ImportSingle311Event:
art::EDProducer art::detail::Producer art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Public Member Functions

 ImportSingle311Event (fhicl::ParameterSet const &p)
 
void produce (art::Event &evt)
 
void beginJob ()
 
void endJob ()
 
- Public Member Functions inherited from art::EDProducer
 EDProducer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDProducer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Producer
virtual ~Producer () noexcept
 
 Producer (fhicl::ParameterSet const &)
 
 Producer (Producer const &)=delete
 
 Producer (Producer &&)=delete
 
Produceroperator= (Producer const &)=delete
 
Produceroperator= (Producer &&)=delete
 
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::Modifier
 ~Modifier () noexcept
 
 Modifier ()
 
 Modifier (Modifier const &)=delete
 
 Modifier (Modifier &&)=delete
 
Modifieroperator= (Modifier const &)=delete
 
Modifieroperator= (Modifier &&)=delete
 
- 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 SplitAdc (const std::vector< adc16_t > adc, size_t channel, uint32_t num_samples, std::vector< short > &adclist, size_t LArchan)
 
size_t Get311Chan (size_t LAr_chan)
 
double GetPedMean (size_t RawChan, std::vector< std::pair< double, double > > *fPedMap)
 
double GetPedRMS (size_t RawChan, std::vector< std::pair< double, double > > *fPedMap)
 

Private Attributes

EventDecoder DataDecode {1280, 1}
 
std::string fFilename
 
size_t fEvt_num
 
std::string fPedestalFile
 
std::vector< std::pair< double, double > > fPedMap
 

Additional Inherited Members

- Public Types inherited from art::EDProducer
using ModuleType = EDProducer
 
using WorkerType = WorkerT< EDProducer >
 
- Public Types inherited from art::detail::Producer
template<typename UserConfig , typename KeysToIgnore = void>
using Table = Modifier::Table< UserConfig, KeysToIgnore >
 
- Public Types inherited from art::Modifier
template<typename UserConfig , typename UserKeysToIgnore = void>
using Table = ProducerTable< UserConfig, detail::ModuleConfig, UserKeysToIgnore >
 
- Static Public Member Functions inherited from art::EDProducer
static void commitEvent (EventPrincipal &ep, Event &e)
 
- 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 32 of file ImportSingle311Event_module.cc.

Constructor & Destructor Documentation

EventGen::ImportSingle311Event::ImportSingle311Event ( fhicl::ParameterSet const &  p)
explicit

Definition at line 92 of file ImportSingle311Event_module.cc.

93  : EDProducer(p)
94  {
95  fFilename = p.get<std::string>("Filename");
96  fEvt_num = p.get<size_t>("Evt_num");
97  fPedestalFile = p.get<std::string>("PedestalFile");
98  produces< std::vector<raw::RawDigit> >();
99  }
std::string string
Definition: nybbler.cc:12
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
p
Definition: test.py:223

Member Function Documentation

void EventGen::ImportSingle311Event::beginJob ( )
virtual

Reimplemented from art::EDProducer.

Definition at line 102 of file ImportSingle311Event_module.cc.

void EventGen::ImportSingle311Event::endJob ( )
virtual

Reimplemented from art::EDProducer.

Definition at line 201 of file ImportSingle311Event_module.cc.

size_t EventGen::ImportSingle311Event::Get311Chan ( size_t  LAr_chan)
private

Definition at line 159 of file ImportSingle311Event_module.cc.

159  {
160 
161  size_t crate = LAr_chan / 320;
162  size_t Chan311;
163 
164  LAr_chan = 8*(LAr_chan/8+1)-LAr_chan%8 -1;
165 
166  if(crate == 0)
167  {
168  LAr_chan = 32*(LAr_chan/32+1)-LAr_chan%32 -1;
169  size_t card = 4 - ((LAr_chan / 32) % 5);
170  if(LAr_chan > 159)
171  {
172  size_t shift = 31 - (LAr_chan % 32);
173  Chan311 = (2*card)*32 + shift;
174  }
175  else
176  {
177  size_t shift = 31 - (LAr_chan % 32);
178  Chan311 = (2*card + 1)*32 + shift;
179  }
180  }
181  else
182  {
183  size_t new_LAr_chan = LAr_chan - crate*320;
184  size_t card = ((new_LAr_chan / 32) % 5);
185  if(new_LAr_chan > 159)
186  {
187  size_t shift = new_LAr_chan % 32;
188  Chan311 = (2*card)*32 + shift;
189  }
190  else
191  {
192  size_t shift = new_LAr_chan % 32;
193  Chan311 = (2*card + 1)*32 + shift;
194  }
195  Chan311 = Chan311 + crate*320;
196  } // end of if/else statementi
197 
198  return Chan311;
199  } // Get311Chan
struct dune::tde::crate crate
double EventGen::ImportSingle311Event::GetPedMean ( size_t  RawChan,
std::vector< std::pair< double, double > > *  fPedMap 
)
inlineprivate

Definition at line 45 of file ImportSingle311Event_module.cc.

45 { return fPedMap->at(RawChan).first; }
double EventGen::ImportSingle311Event::GetPedRMS ( size_t  RawChan,
std::vector< std::pair< double, double > > *  fPedMap 
)
inlineprivate

Definition at line 46 of file ImportSingle311Event_module.cc.

46 { return fPedMap->at(RawChan).second; }
void EventGen::ImportSingle311Event::produce ( art::Event evt)
virtual

Implements art::EDProducer.

Definition at line 107 of file ImportSingle311Event_module.cc.

107  {
109 
110  //ImportSingle311Event(fhicl::ParameterSet const & p);
111  //beginJob();
112 
113  uint32_t nsample;
114  size_t nch = DataDecode.GetNCh();
115  dlardaq::evheader_t EveHead;
116  std::vector<adc16_t> adcvec;
117 
118  ssize_t blabla = DataDecode.GetEvent(fEvt_num, EveHead, adcvec);
119  std::cout << "Fetching event " << blabla << "\n";
120  nsample = (uint32_t) EveHead.ev_size/(nch*1.5);
121  std::cout << "The size of the event is " << nsample << "\n";
122  auto max_adcvec = std::max_element(std::begin(adcvec), std::end(adcvec));
123  std::cout << "Maximum element of adcvec is: " << *max_adcvec << "\n";
124  std::cout << "The size of adcvec is: " << adcvec.size() << "\n";
125  // std::cout << "The size in bytes of adcvec is: " << sizeof(adcvec) << "\n";
126 
127  std::vector<short> adclist;
128  std::unique_ptr<std::vector<raw::RawDigit>> digcol(new std::vector<raw::RawDigit>);
129  for(size_t LAr_chan = 0; LAr_chan < nch; LAr_chan++){
130  adclist.clear();
131  size_t Chan311 = Get311Chan(LAr_chan);
132  SplitAdc(adcvec, Chan311, nsample, adclist, LAr_chan);
133 
134  short unsigned int nTickReadout = nsample;
135  raw::ChannelID_t channel = LAr_chan;
137 
138  raw::RawDigit rd(channel, nTickReadout, adclist, comp);
139  double pedval = ImportSingle311Event::GetPedMean(Chan311, &fPedMap);
140  double pedrms = ImportSingle311Event::GetPedRMS(Chan311, &fPedMap);
141  rd.SetPedestal(pedval, pedrms);
142 
143  digcol->push_back(rd);
144  }
145 
146  evt.put(std::move(digcol));
147  //endJob();
148  }
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
enum raw::_compress Compress_t
Collection of charge vs time digitized from a single readout channel.
Definition: RawDigit.h:69
void SplitAdc(const std::vector< adc16_t > adc, size_t channel, uint32_t num_samples, std::vector< short > &adclist, size_t LArchan)
double GetPedMean(size_t RawChan, std::vector< std::pair< double, double > > *fPedMap)
size_t GetNCh() const
Definition: EventDecoder.h:34
void ReadPedestalFile(std::string PedestalFileName, std::vector< std::pair< double, double > > &PedMap)
uint8_t channel
Definition: CRTFragment.hh:201
no compression
Definition: RawTypes.h:9
double GetPedRMS(size_t RawChan, std::vector< std::pair< double, double > > *fPedMap)
def move(depos, offset)
Definition: depos.py:107
uint32_t ev_size
Definition: dlardaq.h:86
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: DataViewImpl.h:686
std::vector< std::pair< double, double > > fPedMap
ssize_t GetEvent(size_t evnum, dlardaq::evheader_t &eh, std::vector< adc16_t > &adc)
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:72
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
void EventGen::ImportSingle311Event::SplitAdc ( const std::vector< adc16_t adc,
size_t  channel,
uint32_t  num_samples,
std::vector< short > &  adclist,
size_t  LArchan 
)
private

Definition at line 151 of file ImportSingle311Event_module.cc.

151  {
152  adclist.resize(num_samples);
153  for (uint32_t i = 0; i<num_samples; i++){
154  adclist[i] = static_cast<short>(adc[channel*num_samples + i]);
155  }
156  }
uint8_t channel
Definition: CRTFragment.hh:201

Member Data Documentation

EventDecoder EventGen::ImportSingle311Event::DataDecode {1280, 1}
private

Definition at line 48 of file ImportSingle311Event_module.cc.

size_t EventGen::ImportSingle311Event::fEvt_num
private

Definition at line 52 of file ImportSingle311Event_module.cc.

std::string EventGen::ImportSingle311Event::fFilename
private

Definition at line 51 of file ImportSingle311Event_module.cc.

std::string EventGen::ImportSingle311Event::fPedestalFile
private

Definition at line 53 of file ImportSingle311Event_module.cc.

std::vector< std::pair<double, double> > EventGen::ImportSingle311Event::fPedMap
private

Definition at line 55 of file ImportSingle311Event_module.cc.


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