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

Public Member Functions

 GoodRun (fhicl::ParameterSet const &p)
 
virtual ~GoodRun ()
 
void analyze (art::Event const &evt) override
 
void beginJob () override
 
void beginRun (const art::Run &r) override
 
void endRun (const art::Run &r) override
 
void endJob () override
 
void printParameterSet ()
 
- 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

TTree * fTree
 
int RunNumber
 
int TotEvents
 
int NumberOfRCEs
 
double FracRCEs
 
double AvADCPedDiff
 
double FracWaveforms
 
double FracOpHits
 
int nPTBTrigsOn110
 
int nPTBTrigsOn111
 
int nPTBTrigsOn112
 
int nPTBTrigsOn113
 
int nPTBTrigsOn114
 
int nPTBTrigsOn115
 
int EvJustSSPs
 
TTree * FlatTree
 
int Event
 
unsigned int DigSize
 
unsigned int NSamples
 
std::vector< int > ChanNum
 
std::vector< float > ADCVec
 
bool fMakeFlatTree
 
std::string fCounterModuleLabel
 
std::string fWaveformModuleLabel
 
std::string fRawDigitModuleLabel
 
std::string fOpHitModuleLabel
 
short unsigned int fMaxSamples
 
std::vector< int > MyUsefulChans
 

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 47 of file GoodRun_module.cc.

Constructor & Destructor Documentation

DAQToOffline::GoodRun::GoodRun ( fhicl::ParameterSet const &  p)
explicit

Definition at line 96 of file GoodRun_module.cc.

97  : EDAnalyzer(pset)
98  , fMakeFlatTree (pset.get<bool>("MakeFlatTree"))
99  //---------------------------RCE--------------------------------------
100  , fCounterModuleLabel (pset.get<std::string>("CounterModuleLabel"))
101  , fWaveformModuleLabel(pset.get<std::string>("WaveformModuleLabel"))
102  , fRawDigitModuleLabel(pset.get<std::string>("RawDigitModuleLabel"))
103  , fOpHitModuleLabel (pset.get<std::string>("OpHitModuleLabel"))
104  , fMaxSamples (pset.get<short unsigned int>("MaxSamples", 2048))
105  //---------------------------SSP--------------------------------------
106 // ,fSSPFragType ( pset.get<std::string>("SSPFragType"))
107 // ,fSSPRawDataLabel ( pset.get<std::string>("SSPRawDataLabel"))
108  //---------------------------PTB--------------------------------------
109 // ,fPTBFragType ( pset.get<std::string>("PTBFragType"))
110 // ,fPTBRawDataLabel ( pset.get<std::string>("PTBRawDataLabel"))
111  //--------------------------------------------------------------------
112 {
113 }
std::string fCounterModuleLabel
short unsigned int fMaxSamples
std::string string
Definition: nybbler.cc:12
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:27
std::string fWaveformModuleLabel
std::string fOpHitModuleLabel
std::string fRawDigitModuleLabel
DAQToOffline::GoodRun::~GoodRun ( )
virtual

Definition at line 115 of file GoodRun_module.cc.

115  {
116 }

Member Function Documentation

void DAQToOffline::GoodRun::analyze ( art::Event const &  evt)
overridevirtual

Implements art::EDAnalyzer.

Definition at line 166 of file GoodRun_module.cc.

167 {
168  if (TotEvents==0) {
169  RunNumber = evt.run();
170  std::cout << "Got runNumber it is " << RunNumber << std::endl;
171  }
172  ++TotEvents;
173 
174  // get raw::RawDigits
175  art::Handle< std::vector< raw::RawDigit> > externalRawDigitListHandle;
176  std::vector< art::Ptr< raw::RawDigit> > digits;
177  if (evt.getByLabel(fRawDigitModuleLabel, externalRawDigitListHandle) )
178  art::fill_ptr_vector(digits,externalRawDigitListHandle);
179 
180  if (fMakeFlatTree) {
181  Event = evt.event();
182  DigSize = digits.size();
183  NSamples = digits[0]->Samples();
185  // skip this because types may be different: NSamples = std::min( digits[0]->Samples(), fMaxSamples );
186 
187  ADCVec.clear();
188  for (unsigned int dig=0; dig<DigSize; ++dig ) {
189  ChanNum.push_back( digits[dig]->Channel() );
190  unsigned int Samp=0;
191  while ( Samp < NSamples ) {
192  //std::cerr << "Looking at digit " << dig << ", sample " << Samp << ", my value is " << digits[dig]->ADC(Samp) << std::endl;
193  ADCVec.push_back ( digits[dig]->ADC(Samp) );
194  ++Samp;
195  }
196  //std::cout << "Looking at Event " << Event << ", DigSize " << DigSize << ", ChanNum " << ChanNum[dig] << ", NSamples " << NSamples << ", ADCVec.size() " << ADCVec.size() << std::endl;
197  }
198  FlatTree->Fill();
199  } else {
200  // get raw::ExternalTriggers
201  art::Handle< std::vector< raw::ExternalTrigger> > externalTriggerListHandle;
202  std::vector< art::Ptr< raw::ExternalTrigger> > trigs;
203  if (evt.getByLabel(fCounterModuleLabel, externalTriggerListHandle) )
204  art::fill_ptr_vector(trigs,externalTriggerListHandle);
205 
206  // get raw::OpDetWaveforms
207  art::Handle< std::vector< raw::OpDetWaveform> > externalWaveformListHandle;
208  std::vector< art::Ptr< raw::OpDetWaveform> > waveforms;
209  if (evt.getByLabel(fWaveformModuleLabel, externalWaveformListHandle) )
210  art::fill_ptr_vector(waveforms,externalWaveformListHandle);
211 
212  // get recob::OpHits
213  art::Handle< std::vector< recob::OpHit> > externalOpHitListHandle;
214  std::vector< art::Ptr< recob::OpHit> > ophits;
215  if (evt.getByLabel(fOpHitModuleLabel, externalOpHitListHandle) )
216  art::fill_ptr_vector(ophits,externalOpHitListHandle);
217 
218  bool RCEsPresent = false;
219  //bool PTBPresent = false;
220  bool WavePresent = false;
221  //bool OHitPresent = false;
222 
223  // RCEs
224  if (digits.size()) {
225  RCEsPresent = true;
226  ++FracRCEs;
227  if (NumberOfRCEs == 0) {
228  NumberOfRCEs = digits.size() / 128;
229 
230  //GET THE LIST OF BAD CHANNELS.
232  lariov::ChannelStatusProvider::ChannelSet_t const BadChannels = channelStatus.BadChannels();
233 
234  for (size_t dig=0; dig<digits.size(); ++dig) {
235  double AvADC = 0;
236  unsigned int Channel = digits[dig]->Channel();
237  double Pedestal = digits[dig]->GetPedestal();
238  for (size_t samp=0; samp<digits[dig]->Samples(); ++samp)
239  AvADC += digits[dig]->ADC(samp);
240  AvADC = AvADC / digits[dig]->Samples();
241  // Do I want to use this channel? Both AvADC and Pedestal, plus not a 'bad' channel...
242  bool UseChan = true;
243  if ( AvADC == 0 && Pedestal == 0)
244  UseChan = false;
245  for (auto it = BadChannels.begin(); it != BadChannels.end(); it++) {
246  if(Channel==*it) {
247  UseChan = false;
248  break;
249  }
250  } // Loop through bad chans.
251  if ( UseChan ) {
252  double ADCPedDiff = AvADC - Pedestal;
253  //ADCDiff->Fill( Channel, ADCPedDiff );
254  //ADCPed ->Fill( AvADC , Pedestal );
255  AvADCPedDiff += fabs(ADCPedDiff);
256  } // If have data for this tick, ie not turned off.
257  } // Loop over digits
258  AvADCPedDiff = AvADCPedDiff / digits.size();
259  } // NumberOfRCEs == 0
260  }
261 
262  // PTB
263  if (trigs.size()) {
264  //PTBPresent = true;
265  for (size_t tr=0; tr<trigs.size(); ++tr) {
266  if (trigs[tr]->GetTrigID() < 100) continue;
267  if (trigs[tr]->GetTrigID() == 110) ++nPTBTrigsOn110;
268  if (trigs[tr]->GetTrigID() == 111) ++nPTBTrigsOn111;
269  if (trigs[tr]->GetTrigID() == 112) ++nPTBTrigsOn112;
270  if (trigs[tr]->GetTrigID() == 113) ++nPTBTrigsOn113;
271  if (trigs[tr]->GetTrigID() == 114) ++nPTBTrigsOn114;
272  if (trigs[tr]->GetTrigID() == 115) ++nPTBTrigsOn115;
273  }
274  }
275 
276  // Waveforms
277  if (waveforms.size()) {
278  WavePresent = true;
279  ++FracWaveforms;
280  if (!RCEsPresent) ++EvJustSSPs;
281  }
282 
283  // OpHits
284  if (ophits.size()) {
285  //OHitPresent = true;
286  ++FracOpHits;
287  if (!RCEsPresent && !WavePresent) ++EvJustSSPs;
288  }
289  }
290 }
std::vector< float > ADCVec
std::string fCounterModuleLabel
virtual ChannelSet_t BadChannels() const =0
Returns a copy of set of bad channel IDs for the current run.
unsigned int event
Definition: DataStructs.h:574
std::set< raw::ChannelID_t > ChannelSet_t
Type of set of channel IDs.
short unsigned int fMaxSamples
unsigned int run
Definition: DataStructs.h:575
std::string fWaveformModuleLabel
Class providing information about the quality of channels.
std::string fOpHitModuleLabel
ChannelMappingService::Channel Channel
std::string fRawDigitModuleLabel
TCEvent evt
Definition: DataStructs.cxx:7
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:291
QTextStream & endl(QTextStream &s)
std::vector< int > ChanNum
void DAQToOffline::GoodRun::beginJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 118 of file GoodRun_module.cc.

118  {
119 
121 
122  if (!fMakeFlatTree) {
123  fTree = tfs->make<TTree>("RunList","RunList Information");
124  fTree->Branch("RunNumber" ,&RunNumber );
125  fTree->Branch("TotEvents" ,&TotEvents );
126  fTree->Branch("NumberOfRCEs" ,&NumberOfRCEs );
127  fTree->Branch("FracRCEs" ,&FracRCEs );
128  fTree->Branch("AvADCPedDiff" ,&AvADCPedDiff );
129  fTree->Branch("FracWaveforms" ,&FracWaveforms );
130  fTree->Branch("FracOpHits" ,&FracOpHits );
131  fTree->Branch("nPTBTrigsOn110",&nPTBTrigsOn110);
132  fTree->Branch("nPTBTrigsOn111",&nPTBTrigsOn111);
133  fTree->Branch("nPTBTrigsOn112",&nPTBTrigsOn112);
134  fTree->Branch("nPTBTrigsOn113",&nPTBTrigsOn113);
135  fTree->Branch("nPTBTrigsOn114",&nPTBTrigsOn114);
136  fTree->Branch("nPTBTrigsOn115",&nPTBTrigsOn115);
137  fTree->Branch("EvJustSSPs" ,&EvJustSSPs );
138  //ADCDiff = tfs->make<TH2D>("ADCDiff","Difference in average ADC value and pedestal; Channel number; Difference (ADCs)", 2049,0,2048, 400,-50,50);
139  //ADCPed = tfs->make<TH2D>("ADCPed" ,"Comparison of Average ADC values, and pedestal; Average ADC; Pedestal", 1200, 400, 1000, 1200, 400, 1000);
140 
141  } else {
142 
143  // I need to choose which channels I want to look at.....
144  // Runs 18407 - 18411 used RCEs 0, 4, 12, 15
145  // Runs 18412 - 18422 used RCEs 0, 4, 11, 12, 13, 15
146  // Runs 18423 - 18430 used RCEs 0, 4, 11
147 
148  // To convert from the RCE number to the channels I want to store, look at Mikes detailed channel map here:
149  // https://cdcvs.fnal.gov/redmine/projects/35ton/wiki/Channel_map
150  FlatTree = tfs->make<TTree>("FlatDigitTree","FlatDigitTree");
151  FlatTree->Branch("Event" ,&Event ,"Event/I" );
152  FlatTree->Branch("NSamples",&NSamples,"NSamples/I");
153  FlatTree->Branch("DigSize" ,&DigSize ,"DigSize/I" );
154  FlatTree->Branch("ChanNum" ,&ChanNum);
155  FlatTree->Branch("ADCVec" ,&ADCVec );
156  }
157 }
std::vector< float > ADCVec
std::vector< int > ChanNum
void DAQToOffline::GoodRun::beginRun ( const art::Run r)
override

Definition at line 159 of file GoodRun_module.cc.

159  {
160 
162  std::cout << "At the start of the run....going to reset all the variables. " << std::endl;
163 
164 }
QTextStream & endl(QTextStream &s)
void DAQToOffline::GoodRun::endJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 306 of file GoodRun_module.cc.

306  {
307 }
void DAQToOffline::GoodRun::endRun ( const art::Run r)
override

Definition at line 292 of file GoodRun_module.cc.

293 {
294  if (!fMakeFlatTree) {
298  std::cout << "At the end of the run, I am putting the following into the TTree:\n"
299  << RunNumber << " " << TotEvents << " " << NumberOfRCEs << " " << FracRCEs << " " << AvADCPedDiff << " " << FracWaveforms << " " << FracOpHits << " "
300  << nPTBTrigsOn110 << " " << nPTBTrigsOn111 << " " << nPTBTrigsOn112 << " " << nPTBTrigsOn113 << " " << nPTBTrigsOn114 << " " << nPTBTrigsOn115 << " " << EvJustSSPs
301  << std::endl;
302  fTree->Fill();
303  }
304 }
QTextStream & endl(QTextStream &s)
void DAQToOffline::GoodRun::printParameterSet ( )

Member Data Documentation

std::vector<float> DAQToOffline::GoodRun::ADCVec
private

Definition at line 87 of file GoodRun_module.cc.

double DAQToOffline::GoodRun::AvADCPedDiff
private

Definition at line 67 of file GoodRun_module.cc.

std::vector<int > DAQToOffline::GoodRun::ChanNum
private

Definition at line 86 of file GoodRun_module.cc.

unsigned int DAQToOffline::GoodRun::DigSize
private

Definition at line 84 of file GoodRun_module.cc.

int DAQToOffline::GoodRun::Event
private

Definition at line 83 of file GoodRun_module.cc.

int DAQToOffline::GoodRun::EvJustSSPs
private

Definition at line 76 of file GoodRun_module.cc.

std::string DAQToOffline::GoodRun::fCounterModuleLabel
private

Definition at line 90 of file GoodRun_module.cc.

TTree* DAQToOffline::GoodRun::FlatTree
private

Definition at line 82 of file GoodRun_module.cc.

bool DAQToOffline::GoodRun::fMakeFlatTree
private

Definition at line 89 of file GoodRun_module.cc.

short unsigned int DAQToOffline::GoodRun::fMaxSamples
private

Definition at line 91 of file GoodRun_module.cc.

std::string DAQToOffline::GoodRun::fOpHitModuleLabel
private

Definition at line 90 of file GoodRun_module.cc.

double DAQToOffline::GoodRun::FracOpHits
private

Definition at line 69 of file GoodRun_module.cc.

double DAQToOffline::GoodRun::FracRCEs
private

Definition at line 66 of file GoodRun_module.cc.

double DAQToOffline::GoodRun::FracWaveforms
private

Definition at line 68 of file GoodRun_module.cc.

std::string DAQToOffline::GoodRun::fRawDigitModuleLabel
private

Definition at line 90 of file GoodRun_module.cc.

TTree* DAQToOffline::GoodRun::fTree
private

Definition at line 62 of file GoodRun_module.cc.

std::string DAQToOffline::GoodRun::fWaveformModuleLabel
private

Definition at line 90 of file GoodRun_module.cc.

std::vector<int> DAQToOffline::GoodRun::MyUsefulChans
private

Definition at line 93 of file GoodRun_module.cc.

int DAQToOffline::GoodRun::nPTBTrigsOn110
private

Definition at line 70 of file GoodRun_module.cc.

int DAQToOffline::GoodRun::nPTBTrigsOn111
private

Definition at line 71 of file GoodRun_module.cc.

int DAQToOffline::GoodRun::nPTBTrigsOn112
private

Definition at line 72 of file GoodRun_module.cc.

int DAQToOffline::GoodRun::nPTBTrigsOn113
private

Definition at line 73 of file GoodRun_module.cc.

int DAQToOffline::GoodRun::nPTBTrigsOn114
private

Definition at line 74 of file GoodRun_module.cc.

int DAQToOffline::GoodRun::nPTBTrigsOn115
private

Definition at line 75 of file GoodRun_module.cc.

unsigned int DAQToOffline::GoodRun::NSamples
private

Definition at line 85 of file GoodRun_module.cc.

int DAQToOffline::GoodRun::NumberOfRCEs
private

Definition at line 65 of file GoodRun_module.cc.

int DAQToOffline::GoodRun::RunNumber
private

Definition at line 63 of file GoodRun_module.cc.

int DAQToOffline::GoodRun::TotEvents
private

Definition at line 64 of file GoodRun_module.cc.


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