9 #ifndef Muoncounter_Module 10 #define Muoncounter_Module 21 #include "art_root_io/TFileService.h" 22 #include "art_root_io/TFileDirectory.h" 44 #include "TTimeStamp.h" 182 unsigned int run = evt.
run();
184 unsigned int event = evt.
id().
event();
204 int NumADCs = 0, ConsistRCE = -1;
205 int ThisEv110 = 0, ThisEv111 = 0, ThisEv112 = 0, ThisEv113 = 0, ThisEv114 = 0, ThisEv115 = 0;
207 bool PTBPresent =
true;
213 try { PTBrawFragments->size(); }
215 mf::LogWarning(
"MuonCounter") <<
"WARNING: Raw PTB data not found in event " << evt.
event();
218 unsigned int total_Hits= 0;
221 if(!PTBrawFragments.
isValid()){
222 mf::LogError(
"MuonCounter") <<
"Run: " << evt.
run() <<
", SubRun: " << evt.
subRun() <<
", Event: " << evt.
event() <<
" is NOT VALID";
227 lbne::PennMicroSlice::Payload_Timestamp *FirstPTBTimestamp =
nullptr;
229 PTBTime = FirstPTBTimestamp->nova_timestamp;
233 total_Hits = trigs.size();
235 for(
unsigned int i = 0; i < total_Hits; i++) {
236 int auxdetid = trigs.at(i).GetTrigID();
237 if(auxdetid<=
u_TSU) {
239 }
else if(auxdetid>=
l_BSU && auxdetid<=
u_BSU) {
242 fHist1->Fill(auxdetid-49);
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;
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;
263 bool SSPPresent =
true;
267 try { SSPrawFragments->size(); }
269 mf::LogWarning(
"SSPToOffline") <<
"WARNING: Raw SSP data not found in event " << evt.
event();
274 if(!SSPrawFragments.
isValid()){
275 mf::LogError(
"SSPToOffline") <<
"Run: " << evt.
run() <<
", SubRun: " << evt.
subRun() <<
", Event: " << evt.
event() <<
" is NOT VALID";
280 artdaq::Fragments
const& rawFragmentsSSP = *SSPrawFragments;
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;
293 bool RCEPresent =
true;
297 try { RCErawFragments->size(); }
304 if(!RCErawFragments.
isValid()){
309 artdaq::Fragments
const& rawFragmentsRCE = *RCErawFragments;
313 std::cout <<
"Identifier:I had " << NumADCs <<
" ADCs in event " << evt.
event() <<
", first timestamp in this event is " <<
RCETime <<
"\n" <<
std::endl;
324 if (
RCETime && SSPTime && PTBTime) {
330 if (ConsistRCE == 1) {
340 std::cout <<
"Looking at event " << evt.
event() <<
" it had " <<
RCETime <<
" " << SSPTime <<
" " << PTBTime <<
" " << NumADCs
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");
369 fHeader = tfs->make<TTree>(
"Header",
"Subrun Information");
386 fHistNearlineVersion = tfs->make<TH1I>(
"hist_nearline_version",
"hist_nearline_version", 2, 0, 2);
396 gStyle->SetOptStat(0);
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);
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");
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);
419 fHist1->GetXaxis()->SetTitle(
"Counter Number");
420 fHist1->GetYaxis()->SetTitle(
"Frequency, [Hz]. (No Hits/Run Time)");
421 fHist1->GetYaxis()->SetTitleOffset(1.3);
423 fHist2->GetXaxis()->SetTitle(
"Counter Number");
424 fHist2->GetYaxis()->SetTitle(
"Frequency, [Hz]. (No Hits/Run Time)");
425 fHist2->GetYaxis()->SetTitleOffset(1.3);
427 fHist3->GetXaxis()->SetTitle(
"Counter Number");
428 fHist3->GetYaxis()->SetTitle(
"Frequency, [Hz]. (No Hits/Run Time)");
429 fHist3->GetYaxis()->SetTitleOffset(1.3);
431 for(
int i = 28; i < 38; i++)
433 TString
label = Form(
"WU%i", i-27);
434 fHist1->GetXaxis()->SetBinLabel(i+1, label);
436 for(
int i = 22; i < 28; i++)
438 TString
label = Form(
"NU%i", i-21);
439 fHist1->GetXaxis()->SetBinLabel(i+1, label);
441 for(
int i = 0; i < 6; i++)
443 TString
label = Form(
"SL%i", i+1);
444 fHist1->GetXaxis()->SetBinLabel(i+1, label);
446 for(
int i = 16; i < 22; i++)
448 TString
label = Form(
"NL%i", i-15);
449 fHist1->GetXaxis()->SetBinLabel(i+1, label);
451 for(
int i = 1; i < 5; i++)
453 TString
label = Form(
"XX%i", i);
454 fHist1->GetXaxis()->SetBinLabel(i+44, label);
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");
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);
476 for(
int i = 67; i < 83; i++)
478 TString
label = Form(
"RM%i", i-66);
479 fHist2->GetXaxis()->SetBinLabel(i-43, label);
481 for(
int i = 83; i < 93; i++)
483 TString
label = Form(
"RL%i", i-82);
484 fHist2->GetXaxis()->SetBinLabel(i-43, label);
486 for(
int i = 44; i < 57; i++)
488 TString
label = Form(
"CL%i", i-43);
489 fHist2->GetXaxis()->SetBinLabel(i-43, label);
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);
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
540 unsigned int hour, minute,
second;
553 const unsigned long int mask32 = 0xFFFFFFFFUL;
559 unsigned long int llo = (
fStartTime >> 32 ) & mask32;
561 TTimeStamp ts1(lup, (
int)llo);
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;
573 TTimeStamp ts2(lup, (
int)llo);
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;
589 #endif // Muoncounter_Module
std::string fRCERawDataLabel
EventNumber_t event() const
unsigned long long int fStartTime
const int NearlineMajorVersion
Declaration of signal hit object.
std::string fPTBRawDataLabel
void BuildPTBChannelMap(std::string MapDir, std::string MapFile, std::map< int, int > &channelMap)
void GetSSPFirstTimestamp(artdaq::Fragments const &Fragments, int &nSSPPayloads, long long &SSPTime)
unsigned long long int fEndTime
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
EDAnalyzer(fhicl::ParameterSet const &pset)
Muoncounter(fhicl::ParameterSet const &p)
constexpr TimeValue_t value() const
const int NearlineMinorVersion
DAQToOffline::SSPReformatterAlgs sspReform
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
object containing MC truth information necessary for making RawDigits and doing back tracking ...
#define DEFINE_ART_MODULE(klass)
TH1I * fHistNearlineVersion
T get(std::string const &key) const
SubRunNumber_t subRun() const
Encapsulate the geometry of a wire.
void analyze(const art::Event &evt)
std::string fSSPRawDataLabel
static constexpr Timestamp invalidTimestamp()
Utility object to perform functions of association.
Encapsulate the construction of a single detector plane.
void reconfigure(fhicl::ParameterSet const &pset)
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
EventNumber_t event() const
std::map< int, int > fPTBMap
void GetRCEFirstTimestamp(artdaq::Fragments const &Fragments, int &ConsistRCE, int &NumADCs, long long &RCETime)
auto const & get(AssnsNode< L, R, D > const &r)
std::vector< raw::ExternalTrigger > PennFragmentToExternalTrigger(artdaq::Fragments const &Fragments, std::map< int, int > &channelMap, lbne::PennMicroSlice::Payload_Timestamp *&FirstPTBTimestamp)
second_as<> second
Type of time stored in seconds, in double precision.
cet::coded_exception< error, detail::translate > exception
QTextStream & endl(QTextStream &s)
Event finding and building.
double fCombinedTimeDelay