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

Public Member Functions

 Muoncounter (fhicl::ParameterSet const &p)
 
virtual ~Muoncounter ()
 
void beginJob ()
 
void endJob ()
 
void reconfigure (fhicl::ParameterSet const &pset)
 
void analyze (const art::Event &evt)
 
- 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

int l_TSU = 0
 
int u_TSU = 43
 
int l_BSU = 44
 
int u_BSU = 92
 
int l_Extra = 93
 
int u_Extra = 96
 
int l_Trig = 100
 
int u_Trig = 120
 
int event_Count = 0
 
double event_Length = 10e-3
 
TH1D * fHist1
 
TH1D * fHist2
 
TH1D * fHist3
 
double fCombinedTimeDelay
 
std::string fRCEFragType
 
std::string fRCERawDataLabel
 
std::string fSSPFragType
 
std::string fSSPRawDataLabel
 
std::string fPTBFragType
 
std::string fPTBRawDataLabel
 
long long RCETime = 0
 
long long SSPTime = 0
 
long long PTBTime = 0
 
long long RCE_PTB_diff = 0
 
long long RCE_SSP_diff = 0
 
long long SSP_PTB_diff = 0
 
int nSynchronousEvents = 0
 
int nSSPPayloads = 0
 
int nRCEPayloads = 0
 
int nPTBPayloads = 0
 
int nConsistRCEPayloads = 0
 
int nPTBTrigsOn110 = 0
 
int nPTBTrigsOn111 = 0
 
int nPTBTrigsOn112 = 0
 
int nPTBTrigsOn113 = 0
 
int nPTBTrigsOn114 = 0
 
int nPTBTrigsOn115 = 0
 
int sumNADCs = 0
 
TH1D * fGoodRunHisto
 
TTree * fHeader
 
unsigned int fRun
 
unsigned int fSubrun
 
int fFirstEvent
 
int fLastEvent
 
int fNevents
 
unsigned int fStartYear
 
unsigned int fEndYear
 
unsigned int fStartMonth
 
unsigned int fEndMonth
 
unsigned int fStartDay
 
unsigned int fEndDay
 
double fStartHour
 
double fEndHour
 
unsigned long long int fStartTime
 
unsigned long long int fEndTime
 
DAQToOffline::SSPReformatterAlgs sspReform
 
TH1I * fHistNearlineVersion
 
std::string fPTBMapFile
 
std::string fPTBMapDir
 
std::map< int, int > fPTBMap
 

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 54 of file MuonCounter_module.cc.

Constructor & Destructor Documentation

MyMuoncounter::Muoncounter::Muoncounter ( fhicl::ParameterSet const &  p)
explicit

Definition at line 130 of file MuonCounter_module.cc.

131  : EDAnalyzer(pset),
132  fHeader(0),
133  fRun(0),
134  fSubrun(0),
135  fFirstEvent(1e9),
136  fLastEvent(-1),
137  fNevents(0),
138  fStartYear(0),
139  fEndYear(0),
140  fStartMonth(0),
141  fEndMonth(0),
142  fStartDay(0),
143  fEndDay(0),
144  fStartHour(0.0),
145  fEndHour(0.0),
146  fStartTime(-1), // this is an unsigned int so it will default to a huge number
147  fEndTime(0),
148  sspReform(pset.get<fhicl::ParameterSet>("SSPReformatter"))
149 {
150  // Read in the parameters from the .fcl file.
151  this->reconfigure(pset);
152 }
unsigned long long int fStartTime
unsigned long long int fEndTime
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:27
DAQToOffline::SSPReformatterAlgs sspReform
void reconfigure(fhicl::ParameterSet const &pset)
MyMuoncounter::Muoncounter::~Muoncounter ( )
virtual

Definition at line 170 of file MuonCounter_module.cc.

171 {
172  // Clean up dynamic memory and other resources here.
173 }

Member Function Documentation

void MyMuoncounter::Muoncounter::analyze ( const art::Event evt)

Definition at line 175 of file MuonCounter_module.cc.

176 {
177 
178  // Get event number / timing information required by Nearline
179  //
180  // Extract event info for the header...
181  //
182  unsigned int run = evt.run();
183  unsigned int subrun = evt.subRun();
184  unsigned int event = evt.id().event();
185  unsigned long long int time = evt.time().value();
186 
187  fNevents++;
188  fRun = run;
189  fSubrun = subrun;
190 
191  // Don't assume first/last events are coorelated with start/end times...
192  if(time < fStartTime && evt.time() != art::Timestamp::invalidTimestamp()) fStartTime = time;
193  if((int)event < fFirstEvent) fFirstEvent = event;
194  if(time > fEndTime) fEndTime = time;
195  if((int)event > fLastEvent) fLastEvent = event;
196 
197  run = evt.run();
198  subrun = evt.subRun();
199  event = evt.id().event();
200 
201  // Reset some Good Events List parameters
202  RCETime = SSPTime = PTBTime = 0;
204  int NumADCs = 0, ConsistRCE = -1;
205  int ThisEv110 = 0, ThisEv111 = 0, ThisEv112 = 0, ThisEv113 = 0, ThisEv114 = 0, ThisEv115 = 0;
206 
207  bool PTBPresent = true;
208  art::Handle<artdaq::Fragments> PTBrawFragments;
209  evt.getByLabel(fPTBRawDataLabel, fPTBFragType, PTBrawFragments);
210 
211  // Check if there is PTB data in this event
212  // Don't crash code if not present, just don't save anything
213  try { PTBrawFragments->size(); }
214  catch(std::exception const&) {
215  mf::LogWarning("MuonCounter") << "WARNING: Raw PTB data not found in event " << evt.event();
216  PTBPresent = false;
217  }
218  unsigned int total_Hits= 0;
219  if (PTBPresent) {
220  // Check that the data is valid
221  if(!PTBrawFragments.isValid()){
222  mf::LogError("MuonCounter") << "Run: " << evt.run() << ", SubRun: " << evt.subRun() << ", Event: " << evt.event() << " is NOT VALID";
223  throw cet::exception("raw NOT VALID");
224  return;
225  }
226 
227  lbne::PennMicroSlice::Payload_Timestamp *FirstPTBTimestamp = nullptr;
228  auto trigs = DAQToOffline::PennFragmentToExternalTrigger(*PTBrawFragments, fPTBMap, FirstPTBTimestamp);
229  PTBTime = FirstPTBTimestamp->nova_timestamp;
230  if (PTBTime) ++nPTBPayloads;
231  //std::cout << "Got PTB start time, it is " << PTBTime << std::endl;
232 
233  total_Hits = trigs.size();
234 
235  for(unsigned int i = 0; i < total_Hits; i++) {
236  int auxdetid = trigs.at(i).GetTrigID();
237  if(auxdetid<=u_TSU) {
238  fHist1->Fill(auxdetid);
239  } else if(auxdetid>=l_BSU && auxdetid<=u_BSU) {
240  fHist2->Fill(auxdetid);
241  } else if(auxdetid>=l_Extra && auxdetid<=u_Extra) {
242  fHist1->Fill(auxdetid-49);
243  } else {
244  fHist3->Fill(auxdetid);
245  }
246 
247  // Want to count the number of PTB trigs for in this event.
248  if ( trigs.at(i).GetTrigID() == 110 ) ++ThisEv110;
249  else if ( trigs.at(i).GetTrigID() == 111 ) ++ThisEv111;
250  else if ( trigs.at(i).GetTrigID() == 112 ) ++ThisEv112;
251  else if ( trigs.at(i).GetTrigID() == 113 ) ++ThisEv113;
252  else if ( trigs.at(i).GetTrigID() == 114 ) ++ThisEv114;
253  else if ( trigs.at(i).GetTrigID() == 115 ) ++ThisEv115;
254 
255  if ( trigs.at(i).GetTrigID() > 109 ) {
256  std::cout << "Identifier:I Had a PTB trigger in event " << evt.event() << " on channel " << trigs.at(i).GetTrigID() << " at time " << trigs.at(i).GetTrigTime() << std::endl;
257  }
258  }
259  }
260  event_Count+=1;
261 
262  //---------------- SSP Good Event Timing stuff ----------------
263  bool SSPPresent = true;
264  art::Handle<artdaq::Fragments> SSPrawFragments;
265  evt.getByLabel(fSSPRawDataLabel, fSSPFragType, SSPrawFragments);
266 
267  try { SSPrawFragments->size(); }
268  catch(std::exception const&) {
269  mf::LogWarning("SSPToOffline") << "WARNING: Raw SSP data not found in event " << evt.event();
270  SSPPresent = false;
271  }
272 
273  if (SSPPresent) {
274  if(!SSPrawFragments.isValid()){
275  mf::LogError("SSPToOffline") << "Run: " << evt.run() << ", SubRun: " << evt.subRun() << ", Event: " << evt.event() << " is NOT VALID";
276  throw cet::exception("raw NOT VALID");
277  return;
278  }
279 
280  artdaq::Fragments const& rawFragmentsSSP = *SSPrawFragments;
282  //std::cout << "Got SSP start time, it is " << SSPTime << std::endl;
283 
284  // Checking whether I have any waveforms......
285  std::vector<raw::OpDetWaveform> waveforms = sspReform.SSPFragmentToOpDetWaveform(rawFragmentsSSP);
286  if ( waveforms.size() ) {
287  std::cout << "Identifier:Looking at event " << evt.event() << ", I have a vector of waveforms which has size " << waveforms.size() << std::endl;
288  std::cout << "Identifier:This event had " << total_Hits << " counter + trigger words " << std::endl;
289  }
290  } // SSP Present
291 
292  //---------------- RCE Good Event Timing stuff ----------------
293  bool RCEPresent = true;
294  art::Handle<artdaq::Fragments> RCErawFragments;
295  evt.getByLabel(fRCERawDataLabel, fRCEFragType, RCErawFragments);
296 
297  try { RCErawFragments->size(); }
298  catch(std::exception const&) {
299  mf::LogWarning("MuonCounter") << "WARNING: Raw RCE data not found in event " << evt.event() << std::endl;
300  RCEPresent = false;
301  }
302 
303  if (RCEPresent) {
304  if(!RCErawFragments.isValid()){
305  mf::LogError("SSPToOffline") << "Run: " << evt.run() << ", SubRun: " << evt.subRun() << ", Event: " << evt.event() << " is NOT VALID" << std::endl;
306  throw cet::exception("RCErawFragments NOT VALID");
307  return;
308  }
309  artdaq::Fragments const& rawFragmentsRCE = *RCErawFragments;
310  DAQToOffline::GetRCEFirstTimestamp ( rawFragmentsRCE, ConsistRCE, NumADCs, RCETime );
311  sumNADCs += NumADCs;
312  if (NumADCs)
313  std::cout << "Identifier:I had " << NumADCs << " ADCs in event " << evt.event() << ", first timestamp in this event is " << RCETime << "\n" << std::endl;
314  } //RCEPresent
315  //std::cout << "Got RCE start time, it is " << RCETime << std::endl;
316  if (ConsistRCE > -1 ) ++nRCEPayloads;
317  if (ConsistRCE == 1 ) ++nConsistRCEPayloads;
318 
319  // ---------------- Get the Good Event stuff ready for this event ----------------
322  if (SSPTime && PTBTime) SSP_PTB_diff = SSPTime - PTBTime;
323 
324  if (RCETime && SSPTime && PTBTime) { // Check that all components are synchronous.
327  if ( RCE_PTB_diff == 0 && RCE_SSP_diff == 0 ) ++nSynchronousEvents;
328  }
329 
330  if (ConsistRCE == 1) {
331  //std::cout << "!!!Got consistent RCEs so adding the trigger numbers" << std::endl;
332  nPTBTrigsOn110 += ThisEv110;
333  nPTBTrigsOn111 += ThisEv111;
334  nPTBTrigsOn112 += ThisEv112;
335  nPTBTrigsOn113 += ThisEv113;
336  nPTBTrigsOn114 += ThisEv114;
337  nPTBTrigsOn115 += ThisEv115;
338  }
339  if (fNevents%1000 == 0)
340  std::cout << "Looking at event " << evt.event() << " it had " << RCETime << " " << SSPTime << " " << PTBTime << " " << NumADCs
341  << " RCE_SSP " << RCE_SSP_diff << " RCE_PTB " << RCE_PTB_diff << " SSP_PTB " << SSP_PTB_diff << ". "
342  << "So far have had " << nPTBTrigsOn110 << " " << nPTBTrigsOn111 << " " << nPTBTrigsOn112 << " " << nPTBTrigsOn113 << " " << nPTBTrigsOn114 << " " << nPTBTrigsOn115 << " trigs on each coincidence"
343  << ", and " << sumNADCs << " ADCs." << std::endl;
344 }
EventNumber_t event() const
Definition: DataViewImpl.cc:96
unsigned long long int fStartTime
unsigned int subrun
void GetSSPFirstTimestamp(artdaq::Fragments const &Fragments, int &nSSPPayloads, long long &SSPTime)
Definition: CheckTime.cc:58
unsigned long long int fEndTime
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
constexpr TimeValue_t value() const
Definition: Timestamp.h:23
bool isValid() const
Definition: Handle.h:183
DAQToOffline::SSPReformatterAlgs sspReform
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:446
Timestamp time() const
SubRunNumber_t subRun() const
Definition: DataViewImpl.cc:89
RunNumber_t run() const
Definition: DataViewImpl.cc:82
static constexpr Timestamp invalidTimestamp()
Definition: Timestamp.h:82
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
EventNumber_t event() const
Definition: EventID.h:116
std::map< int, int > fPTBMap
void GetRCEFirstTimestamp(artdaq::Fragments const &Fragments, int &ConsistRCE, int &NumADCs, long long &RCETime)
Definition: CheckTime.cc:14
std::vector< raw::OpDetWaveform > SSPFragmentToOpDetWaveform(artdaq::Fragments const &raw)
Construct a waveform from each trigger.
std::vector< raw::ExternalTrigger > PennFragmentToExternalTrigger(artdaq::Fragments const &Fragments, std::map< int, int > &channelMap, lbne::PennMicroSlice::Payload_Timestamp *&FirstPTBTimestamp)
EventID id() const
Definition: Event.cc:37
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
QTextStream & endl(QTextStream &s)
Event finding and building.
unsigned int run
void MyMuoncounter::Muoncounter::beginJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 346 of file MuonCounter_module.cc.

346  {
347  // Implementation of optional member function here.
349  fHist1 = tfs->make<TH1D>("h1", "h1", u_TSU-l_TSU+1+4, l_TSU, u_TSU+1+4);
350  fHist2 = tfs->make<TH1D>("h2", "h2", u_BSU-l_BSU+1, l_BSU, u_BSU+1);
351  fHist3 = tfs->make<TH1D>("h3", "h3", u_Trig-l_Trig, l_Trig, u_Trig);
352 
353  fGoodRunHisto = tfs->make<TH1D>("GoddRunHisto","GoodRunHisto", 12, 0, 12);
354  fGoodRunHisto->GetXaxis()->SetBinLabel(1 ,"PTB payload ratio");
355  fGoodRunHisto->GetXaxis()->SetBinLabel(2 ,"SSP payload ratio");
356  fGoodRunHisto->GetXaxis()->SetBinLabel(3 ,"RCE payload ratio");
357  fGoodRunHisto->GetXaxis()->SetBinLabel(4 ,"Consistent RCE ratio");
358  fGoodRunHisto->GetXaxis()->SetBinLabel(5 ,"Synchronous event ratio");
359  fGoodRunHisto->GetXaxis()->SetBinLabel(6 ,"Trigs on Chan 110");
360  fGoodRunHisto->GetXaxis()->SetBinLabel(7 ,"Trigs on Chan 111");
361  fGoodRunHisto->GetXaxis()->SetBinLabel(8 ,"Trigs on Chan 112");
362  fGoodRunHisto->GetXaxis()->SetBinLabel(9 ,"Trigs on Chan 113");
363  fGoodRunHisto->GetXaxis()->SetBinLabel(10,"Trigs on Chan 114");
364  fGoodRunHisto->GetXaxis()->SetBinLabel(11,"Trigs on Chan 115");
365  fGoodRunHisto->GetXaxis()->SetBinLabel(12,"Total ADCs");
366 
367 
368  //Making the Nearline header information tree
369  fHeader = tfs->make<TTree>("Header","Subrun Information");
370 
371  fHeader->Branch("Run",&fRun);
372  fHeader->Branch("Subrun",&fSubrun);
373  fHeader->Branch("FirstEvent",&fFirstEvent);
374  fHeader->Branch("LastEvent",&fLastEvent);
375  fHeader->Branch("Nevents",&fNevents);
376  fHeader->Branch("StartYear",&fStartYear);
377  fHeader->Branch("StartMonth",&fStartMonth);
378  fHeader->Branch("StartDay",&fStartDay);
379  fHeader->Branch("StartHour",&fStartHour);
380  fHeader->Branch("EndYear",&fEndYear);
381  fHeader->Branch("EndMonth",&fEndMonth);
382  fHeader->Branch("EndDay",&fEndDay);
383  fHeader->Branch("EndHour",&fEndHour);
384 
385  // Set Nearline Version Number
386  fHistNearlineVersion = tfs->make<TH1I>("hist_nearline_version", "hist_nearline_version", 2, 0, 2);
387  fHistNearlineVersion->GetXaxis()->SetBinLabel(1,"NearlineMinorVersion");
388  fHistNearlineVersion->GetXaxis()->SetBinLabel(2,"NearlineMajorVersion");
389  fHistNearlineVersion->SetBinContent(1, NearlineMinorVersion);
390  fHistNearlineVersion->SetBinContent(2, NearlineMajorVersion);
391 }
const int NearlineMajorVersion
const int NearlineMinorVersion
void MyMuoncounter::Muoncounter::endJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 393 of file MuonCounter_module.cc.

394 {
395  double total_Time = (double)(event_Length*event_Count);
396  gStyle->SetOptStat(0);
397 
398  fHist1->Sumw2();
399  fHist2->Sumw2();
400  fHist3->Sumw2();
401  if(total_Time > 0.0) fHist1->Scale(1/total_Time);
402  if(total_Time > 0.0) fHist2->Scale(1/total_Time);
403  if(total_Time > 0.0) fHist3->Scale(1/total_Time);
404 
405  TString fHist1_Title = Form("TSU Frequency");
406  TString fHist2_Title = Form("BSU Frequency");
407  TString fHist3_Title = Form("Trigger Frequency");
408  TString fHist1_Name = Form("TSUs");
409  TString fHist2_Name = Form("BSUs");
410  TString fHist3_Name = Form("Triggers");
411 
412  fHist1->SetTitle(fHist1_Title);
413  fHist1->SetName(fHist1_Name);
414  fHist2->SetTitle(fHist2_Title);
415  fHist2->SetName(fHist2_Name);
416  fHist3->SetTitle(fHist3_Title);
417  fHist3->SetName(fHist3_Name);
418 
419  fHist1->GetXaxis()->SetTitle("Counter Number");
420  fHist1->GetYaxis()->SetTitle("Frequency, [Hz]. (No Hits/Run Time)");
421  fHist1->GetYaxis()->SetTitleOffset(1.3);
422 
423  fHist2->GetXaxis()->SetTitle("Counter Number");
424  fHist2->GetYaxis()->SetTitle("Frequency, [Hz]. (No Hits/Run Time)");
425  fHist2->GetYaxis()->SetTitleOffset(1.3);
426 
427  fHist3->GetXaxis()->SetTitle("Counter Number");
428  fHist3->GetYaxis()->SetTitle("Frequency, [Hz]. (No Hits/Run Time)");
429  fHist3->GetYaxis()->SetTitleOffset(1.3);
430 
431  for(int i = 28; i < 38; i++)
432  {
433  TString label = Form("WU%i", i-27);
434  fHist1->GetXaxis()->SetBinLabel(i+1, label);
435  }
436  for(int i = 22; i < 28; i++)
437  {
438  TString label = Form("NU%i", i-21);
439  fHist1->GetXaxis()->SetBinLabel(i+1, label);
440  }
441  for(int i = 0; i < 6; i++)
442  {
443  TString label = Form("SL%i", i+1);
444  fHist1->GetXaxis()->SetBinLabel(i+1, label);
445  }
446  for(int i = 16; i < 22; i++)
447  {
448  TString label = Form("NL%i", i-15);
449  fHist1->GetXaxis()->SetBinLabel(i+1, label);
450  }
451  for(int i = 1; i < 5; i++)
452  {
453  TString label = Form("XX%i", i);
454  fHist1->GetXaxis()->SetBinLabel(i+44, label);
455  }
456 
457  fHist1->GetXaxis()->SetBinLabel(15+1, "EL1");
458  fHist1->GetXaxis()->SetBinLabel(14+1, "EL2");
459  fHist1->GetXaxis()->SetBinLabel(13+1, "EL3");
460  fHist1->GetXaxis()->SetBinLabel(12+1, "EL4");
461  fHist1->GetXaxis()->SetBinLabel(11+1, "EL5");
462  fHist1->GetXaxis()->SetBinLabel(10+1, "EL6");
463  fHist1->GetXaxis()->SetBinLabel(9+1, "EL7");
464  fHist1->GetXaxis()->SetBinLabel(8+1, "EL8");
465  fHist1->GetXaxis()->SetBinLabel(7+1, "EL9");
466  fHist1->GetXaxis()->SetBinLabel(6+1, "EL10");
467 
468  fHist1->GetXaxis()->SetBinLabel(43+1, "SU1");
469  fHist1->GetXaxis()->SetBinLabel(42+1, "SU2");
470  fHist1->GetXaxis()->SetBinLabel(41+1, "SU3");
471  fHist1->GetXaxis()->SetBinLabel(40+1, "SU4");
472  fHist1->GetXaxis()->SetBinLabel(39+1, "SU5");
473  fHist1->GetXaxis()->SetBinLabel(38+1, "SU6");
474  fHist1->GetXaxis()->SetLabelSize(0.018);
475 
476  for(int i = 67; i < 83; i++)
477  {
478  TString label = Form("RM%i", i-66);
479  fHist2->GetXaxis()->SetBinLabel(i-43, label);
480  }
481  for(int i = 83; i < 93; i++)
482  {
483  TString label = Form("RL%i", i-82);
484  fHist2->GetXaxis()->SetBinLabel(i-43, label);
485  }
486  for(int i = 44; i < 57; i++)
487  {
488  TString label = Form("CL%i", i-43);
489  fHist2->GetXaxis()->SetBinLabel(i-43, label);
490  }
491 
492  fHist2->GetXaxis()->SetBinLabel(66+1-44, "CU1");
493  fHist2->GetXaxis()->SetBinLabel(65+1-44, "CU2");
494  fHist2->GetXaxis()->SetBinLabel(64+1-44, "CU3");
495  fHist2->GetXaxis()->SetBinLabel(63+1-44, "CU4");
496  fHist2->GetXaxis()->SetBinLabel(62+1-44, "CU5");
497  fHist2->GetXaxis()->SetBinLabel(61+1-44, "CU6");
498  fHist2->GetXaxis()->SetBinLabel(60+1-44, "CU7");
499  fHist2->GetXaxis()->SetBinLabel(59+1-44, "CU8");
500  fHist2->GetXaxis()->SetBinLabel(58+1-44, "CU9");
501  fHist2->GetXaxis()->SetBinLabel(57+1-44, "CU10");
502  fHist2->GetXaxis()->SetLabelSize(0.025);
503 
504  // -------------------- Stuff for Good Events List ---------------------
505  double PTBPayloadRat = nPTBPayloads / (double)fNevents;
506  double SSPPayloadRat = nSSPPayloads / (double)fNevents;
507  double RCEPayloadRat = nRCEPayloads / (double)fNevents;
508  double ConsistRCERat = nConsistRCEPayloads / (double)nRCEPayloads;
509  double SynchronRat = nSynchronousEvents / (double)fNevents;
510 
511  fGoodRunHisto->SetBinContent(1 , PTBPayloadRat);
512  fGoodRunHisto->SetBinContent(2 , SSPPayloadRat);
513  fGoodRunHisto->SetBinContent(3 , RCEPayloadRat);
514  fGoodRunHisto->SetBinContent(4 , ConsistRCERat);
515  fGoodRunHisto->SetBinContent(5 , SynchronRat);
516  fGoodRunHisto->SetBinContent(6 , nPTBTrigsOn110);
517  fGoodRunHisto->SetBinContent(7 , nPTBTrigsOn111);
518  fGoodRunHisto->SetBinContent(8 , nPTBTrigsOn112);
519  fGoodRunHisto->SetBinContent(9 , nPTBTrigsOn113);
520  fGoodRunHisto->SetBinContent(10, nPTBTrigsOn114);
521  fGoodRunHisto->SetBinContent(11, nPTBTrigsOn115);
522  fGoodRunHisto->SetBinContent(12, sumNADCs);
523 
524 
525  std::cout << "IDENTIFIER: Run: " << fRun << " SubRun " << fSubrun << " has " << fNevents << " events in total"
526  << ", ratio that have PTB payloads " << PTBPayloadRat
527  << ", ratio that have SSP payloads " << SSPPayloadRat
528  << ", ratio that have RCE payloads " << RCEPayloadRat << ", ratio which were consistent " << ConsistRCERat << ", I had a total of " << sumNADCs << " ADCs"
529  << ", ratio of synchronous events " << SynchronRat
530  << ". I had " << nPTBTrigsOn110 << " " << nPTBTrigsOn111 << " " << nPTBTrigsOn112 << " " << nPTBTrigsOn113 << " " << nPTBTrigsOn114 << " " << nPTBTrigsOn115 << " trigs on each coincidence."
531  << std::endl;
532 
533  //
534  // Compute header info.
535  //
536 
537  //
538  // DISECTING the time from evt.time().value() into "human readable" format to display the date & time
539  //
540  unsigned int hour, minute, second;
541  int nano;
542 
543  // Get the time stamp. art::Timestamp::value() returns a TimeValue_t which is a typedef to unsigned long long.
544  // The conventional use is for the upper 32 bits to have the seconds since 1970 epoch and the lower 32 bits to be
545  // the number of nanoseconds with the current second.
546  //
547  // NOTE: It seems that the above is NOT the convention for the 35t events. They only seem to use the lower 32 bits
548  // for the year/month/day/hour/second. For now, I have reversed the values of lup and llo to get the time right.
549  //
550  // THESE VARIABLES WILL NEED TO BE SWITCHED BACK IF USING THE LOWER 32 BITS FOR NANOSECONDS IS IMPLEMENTED!!!
551 
552 
553  const unsigned long int mask32 = 0xFFFFFFFFUL;
554 
555  // taking start time apart
556 
557  // unsigned long int lup = ( fStartTime >> 32 ) & mask32;
558  // unsigned long int llo = fStartTime & mask32;
559  unsigned long int llo = ( fStartTime >> 32 ) & mask32; // reversed value (see above comment)
560  unsigned long int lup = fStartTime & mask32; // reversed value (see above comment)
561  TTimeStamp ts1(lup, (int)llo);
562  ts1.GetDate(kTRUE,0,&fStartYear,&fStartMonth,&fStartDay);
563  ts1.GetTime(kTRUE,0,&hour,&minute,&second);
564  nano = ts1.GetNanoSec();
565  double sec = ((double)second + (double)nano/1.0e9);
566  fStartHour = (double)hour + (double)minute/60.0 + sec/3600.0;
567 
568  // taking end time apart
569  // lup = ( fEndTime >> 32 ) & mask32;
570  // llo = fEndTime & mask32;
571  llo = ( fEndTime >> 32 ) & mask32; // reversed value (see above comment)
572  lup = fEndTime & mask32; // reversed value (see above comment)
573  TTimeStamp ts2(lup, (int)llo);
574  ts2.GetDate(kTRUE,0,&fEndYear,&fEndMonth,&fEndDay);
575  ts2.GetTime(kTRUE,0,&hour,&minute,&second);
576  nano = ts2.GetNanoSec();
577  sec = ((double)second + (double)nano/1.0e9);
578  fEndHour = (double)hour + (double)minute/60.0 + sec/3600.0;
579 
580  fHeader->Fill();
581 
582 }
unsigned long long int fStartTime
unsigned long long int fEndTime
second_as<> second
Type of time stored in seconds, in double precision.
Definition: spacetime.h:80
QTextStream & endl(QTextStream &s)
void MyMuoncounter::Muoncounter::reconfigure ( fhicl::ParameterSet const &  pset)

Definition at line 154 of file MuonCounter_module.cc.

155 { // Read parameters from the .fcl file. The names in the arguments
156  // to p.get<TYPE> must match names in the .fcl file.
157  fCombinedTimeDelay = p.get< double >("CombinedTimeDelay");
158  fPTBMapFile = p.get<std::string>("PTBMapFile");
159  fPTBMapDir = p.get<std::string>("PTBMapDir");
160  fRCEFragType = p.get<std::string>("RCEFragType");
161  fRCERawDataLabel = p.get<std::string>("RCERawDataLabel");
162  fSSPFragType = p.get<std::string>("SSPFragType");
163  fSSPRawDataLabel = p.get<std::string>("SSPRawDataLabel");
164  fPTBFragType = p.get<std::string>("PTBFragType");
165  fPTBRawDataLabel = p.get<std::string>("PTBRawDataLabel");
166  DAQToOffline::BuildPTBChannelMap(fPTBMapDir, fPTBMapFile, fPTBMap);
167  return;
168 }
std::string string
Definition: nybbler.cc:12
void BuildPTBChannelMap(std::string MapDir, std::string MapFile, std::map< int, int > &channelMap)
p
Definition: test.py:223
std::map< int, int > fPTBMap

Member Data Documentation

int MyMuoncounter::Muoncounter::event_Count = 0
private

Definition at line 75 of file MuonCounter_module.cc.

double MyMuoncounter::Muoncounter::event_Length = 10e-3
private

Definition at line 76 of file MuonCounter_module.cc.

double MyMuoncounter::Muoncounter::fCombinedTimeDelay
private

Definition at line 82 of file MuonCounter_module.cc.

unsigned int MyMuoncounter::Muoncounter::fEndDay
private

Definition at line 113 of file MuonCounter_module.cc.

double MyMuoncounter::Muoncounter::fEndHour
private

Definition at line 115 of file MuonCounter_module.cc.

unsigned int MyMuoncounter::Muoncounter::fEndMonth
private

Definition at line 111 of file MuonCounter_module.cc.

unsigned long long int MyMuoncounter::Muoncounter::fEndTime
private

Definition at line 117 of file MuonCounter_module.cc.

unsigned int MyMuoncounter::Muoncounter::fEndYear
private

Definition at line 109 of file MuonCounter_module.cc.

int MyMuoncounter::Muoncounter::fFirstEvent
private

Definition at line 105 of file MuonCounter_module.cc.

TH1D* MyMuoncounter::Muoncounter::fGoodRunHisto
private

Definition at line 99 of file MuonCounter_module.cc.

TTree* MyMuoncounter::Muoncounter::fHeader
private

Definition at line 102 of file MuonCounter_module.cc.

TH1D* MyMuoncounter::Muoncounter::fHist1
private

Definition at line 78 of file MuonCounter_module.cc.

TH1D* MyMuoncounter::Muoncounter::fHist2
private

Definition at line 79 of file MuonCounter_module.cc.

TH1D* MyMuoncounter::Muoncounter::fHist3
private

Definition at line 80 of file MuonCounter_module.cc.

TH1I* MyMuoncounter::Muoncounter::fHistNearlineVersion
private

Definition at line 121 of file MuonCounter_module.cc.

int MyMuoncounter::Muoncounter::fLastEvent
private

Definition at line 106 of file MuonCounter_module.cc.

int MyMuoncounter::Muoncounter::fNevents
private

Definition at line 107 of file MuonCounter_module.cc.

std::string MyMuoncounter::Muoncounter::fPTBFragType
private

Definition at line 89 of file MuonCounter_module.cc.

std::map<int,int> MyMuoncounter::Muoncounter::fPTBMap
private

Definition at line 127 of file MuonCounter_module.cc.

std::string MyMuoncounter::Muoncounter::fPTBMapDir
private

Definition at line 125 of file MuonCounter_module.cc.

std::string MyMuoncounter::Muoncounter::fPTBMapFile
private

Definition at line 124 of file MuonCounter_module.cc.

std::string MyMuoncounter::Muoncounter::fPTBRawDataLabel
private

Definition at line 89 of file MuonCounter_module.cc.

std::string MyMuoncounter::Muoncounter::fRCEFragType
private

Definition at line 85 of file MuonCounter_module.cc.

std::string MyMuoncounter::Muoncounter::fRCERawDataLabel
private

Definition at line 85 of file MuonCounter_module.cc.

unsigned int MyMuoncounter::Muoncounter::fRun
private

Definition at line 103 of file MuonCounter_module.cc.

std::string MyMuoncounter::Muoncounter::fSSPFragType
private

Definition at line 87 of file MuonCounter_module.cc.

std::string MyMuoncounter::Muoncounter::fSSPRawDataLabel
private

Definition at line 87 of file MuonCounter_module.cc.

unsigned int MyMuoncounter::Muoncounter::fStartDay
private

Definition at line 112 of file MuonCounter_module.cc.

double MyMuoncounter::Muoncounter::fStartHour
private

Definition at line 114 of file MuonCounter_module.cc.

unsigned int MyMuoncounter::Muoncounter::fStartMonth
private

Definition at line 110 of file MuonCounter_module.cc.

unsigned long long int MyMuoncounter::Muoncounter::fStartTime
private

Definition at line 116 of file MuonCounter_module.cc.

unsigned int MyMuoncounter::Muoncounter::fStartYear
private

Definition at line 108 of file MuonCounter_module.cc.

unsigned int MyMuoncounter::Muoncounter::fSubrun
private

Definition at line 104 of file MuonCounter_module.cc.

int MyMuoncounter::Muoncounter::l_BSU = 44
private

Definition at line 69 of file MuonCounter_module.cc.

int MyMuoncounter::Muoncounter::l_Extra = 93
private

Definition at line 71 of file MuonCounter_module.cc.

int MyMuoncounter::Muoncounter::l_Trig = 100
private

Definition at line 73 of file MuonCounter_module.cc.

int MyMuoncounter::Muoncounter::l_TSU = 0
private

Definition at line 67 of file MuonCounter_module.cc.

int MyMuoncounter::Muoncounter::nConsistRCEPayloads = 0
private

Definition at line 96 of file MuonCounter_module.cc.

int MyMuoncounter::Muoncounter::nPTBPayloads = 0
private

Definition at line 95 of file MuonCounter_module.cc.

int MyMuoncounter::Muoncounter::nPTBTrigsOn110 = 0
private

Definition at line 97 of file MuonCounter_module.cc.

int MyMuoncounter::Muoncounter::nPTBTrigsOn111 = 0
private

Definition at line 97 of file MuonCounter_module.cc.

int MyMuoncounter::Muoncounter::nPTBTrigsOn112 = 0
private

Definition at line 97 of file MuonCounter_module.cc.

int MyMuoncounter::Muoncounter::nPTBTrigsOn113 = 0
private

Definition at line 97 of file MuonCounter_module.cc.

int MyMuoncounter::Muoncounter::nPTBTrigsOn114 = 0
private

Definition at line 97 of file MuonCounter_module.cc.

int MyMuoncounter::Muoncounter::nPTBTrigsOn115 = 0
private

Definition at line 97 of file MuonCounter_module.cc.

int MyMuoncounter::Muoncounter::nRCEPayloads = 0
private

Definition at line 95 of file MuonCounter_module.cc.

int MyMuoncounter::Muoncounter::nSSPPayloads = 0
private

Definition at line 95 of file MuonCounter_module.cc.

int MyMuoncounter::Muoncounter::nSynchronousEvents = 0
private

Definition at line 94 of file MuonCounter_module.cc.

long long MyMuoncounter::Muoncounter::PTBTime = 0
private

Definition at line 92 of file MuonCounter_module.cc.

long long MyMuoncounter::Muoncounter::RCE_PTB_diff = 0
private

Definition at line 93 of file MuonCounter_module.cc.

long long MyMuoncounter::Muoncounter::RCE_SSP_diff = 0
private

Definition at line 93 of file MuonCounter_module.cc.

long long MyMuoncounter::Muoncounter::RCETime = 0
private

Definition at line 92 of file MuonCounter_module.cc.

long long MyMuoncounter::Muoncounter::SSP_PTB_diff = 0
private

Definition at line 93 of file MuonCounter_module.cc.

DAQToOffline::SSPReformatterAlgs MyMuoncounter::Muoncounter::sspReform
private

Definition at line 118 of file MuonCounter_module.cc.

long long MyMuoncounter::Muoncounter::SSPTime = 0
private

Definition at line 92 of file MuonCounter_module.cc.

int MyMuoncounter::Muoncounter::sumNADCs = 0
private

Definition at line 98 of file MuonCounter_module.cc.

int MyMuoncounter::Muoncounter::u_BSU = 92
private

Definition at line 70 of file MuonCounter_module.cc.

int MyMuoncounter::Muoncounter::u_Extra = 96
private

Definition at line 72 of file MuonCounter_module.cc.

int MyMuoncounter::Muoncounter::u_Trig = 120
private

Definition at line 74 of file MuonCounter_module.cc.

int MyMuoncounter::Muoncounter::u_TSU = 43
private

Definition at line 68 of file MuonCounter_module.cc.


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