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

Public Member Functions

 TpcDAQToOffline (fhicl::ParameterSet const &pset)
 
 TpcDAQToOffline (TpcDAQToOffline const &)=delete
 
 TpcDAQToOffline (TpcDAQToOffline &&)=delete
 
TpcDAQToOfflineoperator= (TpcDAQToOffline const &)=delete
 
TpcDAQToOfflineoperator= (TpcDAQToOffline &&)=delete
 
void produce (art::Event &evt) override
 
void reconfigure (const fhicl::ParameterSet &pset)
 
void printParameterSet ()
 
void beginJob () override
 
- 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 ()
 
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 Reset ()
 

Private Attributes

std::string fFragType
 
std::string fRawDataLabel
 
std::string fOutputDataLabel
 
bool fUseChannelMap
 
bool fDebug
 
bool fMakeTree
 
raw::Compress_t fCompression
 compression type to use More...
 
unsigned int fZeroThreshold
 Zero suppression threshold. More...
 
art::ServiceHandle< lbne::ChannelMapService > fChannelMap
 
TTree * fTree
 
int DigSize
 
int NSamples
 
float Channel [MaxChannels]
 
float ADCs [MaxChannels][MaxSamples]
 
float Pedestal [MaxChannels]
 

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 52 of file TpcDAQToOffline_module.cc.

Constructor & Destructor Documentation

DAQToOffline::TpcDAQToOffline::TpcDAQToOffline ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 90 of file TpcDAQToOffline_module.cc.

90  : EDProducer{pset} {
91 
92  this->reconfigure(pset);
93 
94  produces< std::vector<raw::RawDigit> > (fOutputDataLabel);
95 
96 }
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
void reconfigure(const fhicl::ParameterSet &pset)
DAQToOffline::TpcDAQToOffline::TpcDAQToOffline ( TpcDAQToOffline const &  )
delete
DAQToOffline::TpcDAQToOffline::TpcDAQToOffline ( TpcDAQToOffline &&  )
delete

Member Function Documentation

void DAQToOffline::TpcDAQToOffline::beginJob ( )
overridevirtual

Reimplemented from art::EDProducer.

Definition at line 112 of file TpcDAQToOffline_module.cc.

112  {
114  fTree = tfs->make<TTree>("FlatDigitTree","FlatDigitTree");
115  fTree->Branch("NSamples",&NSamples,"NSamples/I" );
116  fTree->Branch("DigSize" ,&DigSize, "DigSize/I" );
117  fTree->Branch("Channel" ,&Channel ,"Channel[DigSize]/F" );
118  fTree->Branch("Pedestal",&Pedestal,"Pedestal[DigSize]/F");
119  fTree->Branch("ADCs" ,&ADCs ,"ADCs[DigSize][15000]/F");
120 }
float ADCs[MaxChannels][MaxSamples]
ChannelMappingService::Channel Channel
TpcDAQToOffline& DAQToOffline::TpcDAQToOffline::operator= ( TpcDAQToOffline const &  )
delete
TpcDAQToOffline& DAQToOffline::TpcDAQToOffline::operator= ( TpcDAQToOffline &&  )
delete
void DAQToOffline::TpcDAQToOffline::printParameterSet ( )

Definition at line 122 of file TpcDAQToOffline_module.cc.

122  {
123 
124  for(int i=0;i<20;i++) std::cout << "=";
125  std::cout << std::endl;
126  std::cout << "Parameter Set" << std::endl;
127  for(int i=0;i<20;i++) std::cout << "=";
128  std::cout << std::endl;
129 
130  std::cout << "fFragType: " << fFragType << std::endl;
131  std::cout << "fRawDataLabel: " << fRawDataLabel << std::endl;
132  std::cout << "fOutputDataLabel: " << fOutputDataLabel << std::endl;
133  std::cout << "fDebug: ";
134  if(fDebug) std::cout << "true" << std::endl;
135  else std::cout << "false" << std::endl;
136 
137  for(int i=0;i<20;i++) std::cout << "=";
138  std::cout << std::endl;
139 
140 
141 }
QTextStream & endl(QTextStream &s)
void DAQToOffline::TpcDAQToOffline::produce ( art::Event evt)
overridevirtual

Implements art::EDProducer.

Definition at line 143 of file TpcDAQToOffline_module.cc.

144 {
145  art::Handle<artdaq::Fragments> rawFragments;
146  evt.getByLabel(fRawDataLabel, fFragType, rawFragments);
147 
148  art::EventNumber_t eventNumber = evt.event();
149 
150  // Check if there is RCE data in this event
151  // Don't crash code if not present, just don't save anything
152  try { rawFragments->size(); }
153  catch(std::exception const&) {
154  std::cout << "WARNING: Raw RCE data not found in event " << eventNumber << std::endl;
155  std::vector<raw::RawDigit> digits;
156  evt.put(std::make_unique<std::vector<raw::RawDigit>>(std::move(digits)), fOutputDataLabel);
157  return;
158  }
159 
160  //Check that the data is valid
161  if(!rawFragments.isValid()){
162  std::cerr << "Run: " << evt.run()
163  << ", SubRun: " << evt.subRun()
164  << ", Event: " << eventNumber
165  << " is NOT VALID" << std::endl;
166  throw cet::exception("rawFragments NOT VALID");
167  }
168 
169  lbne::TpcNanoSlice::Header::nova_timestamp_t firstTimestamp;
170  std::vector<std::pair< std::pair<unsigned int,unsigned int>, lbne::TpcNanoSlice::Header::nova_timestamp_t> > DigitsIndexList;
171  auto digits = tpcFragmentToRawDigits(*rawFragments, DigitsIndexList, firstTimestamp, fChannelMap, fUseChannelMap, fDebug, fCompression, fZeroThreshold);
172 
173  // Make a flat rce tree.....
174  Reset();
175  DigSize = digits.size();
176  NSamples = digits[0].Samples();
177  if (NSamples && fMakeTree) {
178  std::cout << "Digits has size " << digits.size() << " digits[0] has " << digits[0].Samples() << std::endl;
179  dune::DetPedestalDUNE pedestals("dune35t");
180  pedestals.SetDetName("dune35t");
181  pedestals.SetUseDefaults(false);
182  pedestals.SetUseDB(true);
183  pedestals.Update(evt.run());
184 
185  for (int dig=0; dig<DigSize; ++dig ) {
186  int Chan = digits[dig].Channel();
187  Channel[dig] = Chan;
188  Pedestal[dig] = pedestals.PedMean(Chan);
189  for (int tick=0; tick<NSamples; ++tick) {
190  ADCs[dig][tick] = digits[dig].ADC(tick);
191  }
192  }
193  fTree->Fill();
194  }
195 
197  std::cout << "JPD: this_time_stamp: " << this_time_stamp.value() << std::endl;
198  std::cout << "JPD: event.time().value(): " << evt.time().value() << std::endl;
199 
200  evt.put(std::make_unique<decltype(digits)>(std::move(digits)), fOutputDataLabel);
201 }
unsigned int fZeroThreshold
Zero suppression threshold.
EventNumber_t event() const
Definition: DataViewImpl.cc:96
raw::Compress_t fCompression
compression type to use
constexpr TimeValue_t value() const
Definition: Timestamp.h:23
std::vector< raw::RawDigit > tpcFragmentToRawDigits(artdaq::Fragments const &rawFragments, std::vector< std::pair< std::pair< unsigned int, unsigned int >, lbne::TpcNanoSlice::Header::nova_timestamp_t > > &DigitsIndexList, lbne::TpcNanoSlice::Header::nova_timestamp_t &firstTimestamp, art::ServiceHandle< lbne::ChannelMapService > const &channelMap, bool useChannelMap, bool debug, raw::Compress_t compression, unsigned int zeroThreshold)
bool isValid() const
Definition: Handle.h:183
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:446
Timestamp time() const
art::Timestamp make_art_timestamp_from_nova_timestamp(lbne::TpcNanoSlice::Header::nova_timestamp_t this_nova_timestamp)
def move(depos, offset)
Definition: depos.py:107
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
Definition: electronics.h:74
SubRunNumber_t subRun() const
Definition: DataViewImpl.cc:89
RunNumber_t run() const
Definition: DataViewImpl.cc:82
float ADCs[MaxChannels][MaxSamples]
art::ServiceHandle< lbne::ChannelMapService > fChannelMap
ChannelMappingService::Channel Channel
IDNumber_t< Level::Event > EventNumber_t
Definition: IDNumber.h:118
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
Definition: DataViewImpl.h:730
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
QTextStream & endl(QTextStream &s)
void DAQToOffline::TpcDAQToOffline::reconfigure ( const fhicl::ParameterSet pset)

Definition at line 98 of file TpcDAQToOffline_module.cc.

98  {
99 
100  fFragType = pset.get<std::string>("FragType");
101  fRawDataLabel = pset.get<std::string>("RawDataLabel");
102  fOutputDataLabel = pset.get<std::string>("OutputDataLabel");
103  fUseChannelMap = pset.get<bool>("UseChannelMap");
104  fDebug = pset.get<bool>("Debug");
105  fMakeTree = pset.get<bool>("MakeTree");
106  fZeroThreshold=0;
108  if(fDebug) printParameterSet();
109 
110 }
unsigned int fZeroThreshold
Zero suppression threshold.
std::string string
Definition: nybbler.cc:12
raw::Compress_t fCompression
compression type to use
no compression
Definition: RawTypes.h:9
T get(std::string const &key) const
Definition: ParameterSet.h:231
void DAQToOffline::TpcDAQToOffline::Reset ( )
private

Definition at line 203 of file TpcDAQToOffline_module.cc.

203  {
204  for (int ii=0; ii<MaxChannels; ++ii) {
205  Channel[ii] = -1;
206  Pedestal[ii] = -1;
207  for (int kk=0; kk<MaxSamples; ++kk) {
208  ADCs[ii][kk] = -1;
209  }
210  }
211 }
const int MaxSamples
const int MaxChannels
float ADCs[MaxChannels][MaxSamples]
ChannelMappingService::Channel Channel

Member Data Documentation

float DAQToOffline::TpcDAQToOffline::ADCs[MaxChannels][MaxSamples]
private

Definition at line 85 of file TpcDAQToOffline_module.cc.

float DAQToOffline::TpcDAQToOffline::Channel[MaxChannels]
private

Definition at line 84 of file TpcDAQToOffline_module.cc.

int DAQToOffline::TpcDAQToOffline::DigSize
private

Definition at line 82 of file TpcDAQToOffline_module.cc.

art::ServiceHandle<lbne::ChannelMapService> DAQToOffline::TpcDAQToOffline::fChannelMap
private

Definition at line 79 of file TpcDAQToOffline_module.cc.

raw::Compress_t DAQToOffline::TpcDAQToOffline::fCompression
private

compression type to use

Definition at line 76 of file TpcDAQToOffline_module.cc.

bool DAQToOffline::TpcDAQToOffline::fDebug
private

Definition at line 74 of file TpcDAQToOffline_module.cc.

std::string DAQToOffline::TpcDAQToOffline::fFragType
private

Definition at line 70 of file TpcDAQToOffline_module.cc.

bool DAQToOffline::TpcDAQToOffline::fMakeTree
private

Definition at line 75 of file TpcDAQToOffline_module.cc.

std::string DAQToOffline::TpcDAQToOffline::fOutputDataLabel
private

Definition at line 72 of file TpcDAQToOffline_module.cc.

std::string DAQToOffline::TpcDAQToOffline::fRawDataLabel
private

Definition at line 71 of file TpcDAQToOffline_module.cc.

TTree* DAQToOffline::TpcDAQToOffline::fTree
private

Definition at line 81 of file TpcDAQToOffline_module.cc.

bool DAQToOffline::TpcDAQToOffline::fUseChannelMap
private

Definition at line 73 of file TpcDAQToOffline_module.cc.

unsigned int DAQToOffline::TpcDAQToOffline::fZeroThreshold
private

Zero suppression threshold.

Definition at line 77 of file TpcDAQToOffline_module.cc.

int DAQToOffline::TpcDAQToOffline::NSamples
private

Definition at line 83 of file TpcDAQToOffline_module.cc.

float DAQToOffline::TpcDAQToOffline::Pedestal[MaxChannels]
private

Definition at line 86 of file TpcDAQToOffline_module.cc.


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