25 using std::ostringstream;
42 void SplitAdc(
const std::vector<adc16_t>
adc,
size_t channel, uint32_t num_samples, std::vector<short> &adclist,
size_t LArchan);
45 double GetPedMean(
size_t RawChan,
std::vector< std::pair<double, double> > *fPedMap){
return fPedMap->at(RawChan).first; }
46 double GetPedRMS(
size_t RawChan,
std::vector< std::pair<double, double> > *fPedMap){
return fPedMap->at(RawChan).second; }
55 std::vector< std::pair<double, double> >
fPedMap;
66 file.open(PedestalFileName);
70 <<
"failed to open input file " << PedestalFileName <<
"\n";
75 size_t ch, cryo,
crate, rawch;
77 file >> rawch >> cryo >> crate >> ch >> mean >>
rms;
78 PedMap.emplace_back(mean, rms);
96 fEvt_num = p.get<
size_t>(
"Evt_num");
98 produces< std::vector<raw::RawDigit> >();
103 DataDecode.Open(fFilename);
114 size_t nch = DataDecode.GetNCh();
116 std::vector<adc16_t> adcvec;
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";
123 std::cout <<
"Maximum element of adcvec is: " << *max_adcvec <<
"\n";
124 std::cout <<
"The size of adcvec is: " << adcvec.size() <<
"\n";
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++){
132 SplitAdc(adcvec, Chan311, nsample, adclist, LAr_chan);
134 short unsigned int nTickReadout = nsample;
139 double pedval = ImportSingle311Event::GetPedMean(Chan311, &fPedMap);
140 double pedrms = ImportSingle311Event::GetPedRMS(Chan311, &fPedMap);
143 digcol->push_back(rd);
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]);
161 size_t crate = LAr_chan / 320;
164 LAr_chan = 8*(LAr_chan/8+1)-LAr_chan%8 -1;
168 LAr_chan = 32*(LAr_chan/32+1)-LAr_chan%32 -1;
169 size_t card = 4 - ((LAr_chan / 32) % 5);
172 size_t shift = 31 - (LAr_chan % 32);
173 Chan311 = (2*card)*32 + shift;
177 size_t shift = 31 - (LAr_chan % 32);
178 Chan311 = (2*card + 1)*32 + shift;
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)
187 size_t shift = new_LAr_chan % 32;
188 Chan311 = (2*card)*32 + shift;
192 size_t shift = new_LAr_chan % 32;
193 Chan311 = (2*card + 1)*32 + shift;
195 Chan311 = Chan311 + crate*320;
201 void ImportSingle311Event::endJob(){
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.
double rms(sqlite3 *db, std::string const &table_name, std::string const &column_name)
double GetPedMean(size_t RawChan, std::vector< std::pair< double, double > > *fPedMap)
void ReadPedestalFile(std::string PedestalFileName, std::vector< std::pair< double, double > > &PedMap)
art framework interface to geometry description
double GetPedRMS(size_t RawChan, std::vector< std::pair< double, double > > *fPedMap)
#define DEFINE_ART_MODULE(klass)
struct dune::tde::crate crate
std::string fPedestalFile
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
size_t Get311Chan(size_t LAr_chan)
std::vector< std::pair< double, double > > fPedMap
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
void SetPedestal(float ped, float sigma=1.)
Set pedestal and its RMS (the latter is 0 by default)
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
void SplitAdc(const std::vector< dlardaq::adc16_t > *adc, size_t channel, uint32_t num_samples, std::vector< short > &adclist)
unsigned int ChannelID_t
Type representing the ID of a readout channel.
double mean(sqlite3 *db, std::string const &table_name, std::string const &column_name)