@@ -68,6 +68,8 @@ class sbnd::ptb::PTBAnalysis : public art::EDAnalyzer {
6868
6969 std::vector<uint64_t > _ptb_hlt_trigger;
7070 std::vector<uint64_t > _ptb_hlt_timestamp;
71+ std::vector<uint64_t > _ptb_hlt_unmask_timestamp;
72+ std::vector<uint64_t > _ptb_llt_unmask_timestamp;
7173 std::vector<int > _ptb_hlt_trunmask;
7274 std::vector<uint64_t > _ptb_llt_trigger;
7375 std::vector<uint64_t > _ptb_llt_timestamp;
@@ -124,6 +126,8 @@ sbnd::ptb::PTBAnalysis::PTBAnalysis(fhicl::ParameterSet const& p)
124126 fTree ->Branch (" ptb_hlt_trigger" , " std::vector<uint64_t>" , &_ptb_hlt_trigger);
125127 fTree ->Branch (" ptb_hlt_trunmask" , " std::vector<int>" , &_ptb_hlt_trunmask);
126128 fTree ->Branch (" ptb_hlt_timestamp" , " std::vector<uint64_t>" , &_ptb_hlt_timestamp);
129+ fTree ->Branch (" ptb_hlt_unmask_timestamp" , " std::vector<uint64_t>" , &_ptb_hlt_unmask_timestamp);
130+ fTree ->Branch (" ptb_llt_unmask_timestamp" , " std::vector<uint64_t>" , &_ptb_llt_unmask_timestamp);
127131 fTree ->Branch (" ptb_llt_trigger" , " std::vector<uint64_t>" , &_ptb_llt_trigger);
128132 fTree ->Branch (" ptb_chStatus_timestamp" , " std::vector<uint64_t>" , &_ptb_chStatus_timestamp);
129133 fTree ->Branch (" ptb_chStatus_beam" , " std::vector<uint64_t>" , &_ptb_chStatus_beam);
@@ -516,6 +520,7 @@ void sbnd::ptb::PTBAnalysis::AnalysePTBs(std::vector<art::Ptr<raw::ptb::sbndptb>
516520 _ptb_hlt_trigger.resize (nHLTs);
517521 _ptb_hlt_timestamp.resize (nHLTs);
518522 _ptb_hlt_trunmask.resize (nHLTs);
523+ _ptb_hlt_unmask_timestamp.resize (nHLTs);
519524
520525
521526 unsigned hlt_i = 0 ; // For multiple upbits in trigger words for unmasking
@@ -529,28 +534,35 @@ void sbnd::ptb::PTBAnalysis::AnalysePTBs(std::vector<art::Ptr<raw::ptb::sbndptb>
529534 h_i++;
530535
531536 int val = ptb->GetHLTrigger (i).trigger_word ;
532- int upBit[10 ] = {-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 };
537+ int upBit[32 ];
538+
539+ for (int u=0 ; u<32 ; u++){ // setting default values for maximum of 32 bits
540+ upBit[u]=-1 ;
541+ }
542+
533543 int numOfTrig =0 ;
534- for (int i =0 ; i <32 ;i ++){
544+ for (int b =0 ; b <32 ;b ++){
535545 if ((val & 0x01 ) ==1 ){
536- upBit[numOfTrig] = i ;
546+ upBit[numOfTrig] = b ;
537547 numOfTrig++;
538548 }
539549 val = val >> 1 ;
540550 }
541551
542552 if (numOfTrig ==1 ){
553+ _ptb_hlt_unmask_timestamp[hlt_i] = _ptb_hlt_timestamp[h_i-1 ];
543554 _ptb_hlt_trunmask[hlt_i] = upBit[0 ];
544555 hlt_i++;
545556 }// End of if statement for single upbit
546557
547558 else if (numOfTrig > 1 ){
548559 nHLTs += (numOfTrig -1 );
549- _ptb_hlt_timestamp .resize (nHLTs);
560+ _ptb_hlt_unmask_timestamp .resize (nHLTs);
550561 _ptb_hlt_trunmask.resize (nHLTs);
551562
552563 for (int mult =0 ; mult < numOfTrig; mult++){
553564 _ptb_hlt_trunmask[hlt_i] = upBit[mult];
565+ _ptb_hlt_unmask_timestamp[hlt_i] = _ptb_hlt_timestamp[h_i-1 ];
554566 hlt_i++;
555567 } // End of loop over multiple upbits
556568 } // End of else statement for multiple triggers
@@ -576,6 +588,7 @@ void sbnd::ptb::PTBAnalysis::AnalysePTBs(std::vector<art::Ptr<raw::ptb::sbndptb>
576588 _ptb_llt_trigger.resize (nLLTs);
577589 _ptb_llt_timestamp.resize (nLLTs);
578590 _ptb_llt_trunmask.resize (nLLTs);
591+ _ptb_llt_unmask_timestamp.resize (nLLTs);
579592
580593 unsigned llt_i = 0 ; // For ptb_llt_trunmask and perevent, includes the multiples with multiple upbits per word
581594 unsigned l_i=0 ; // For ptb_llt_trigger, records only unique words
@@ -590,28 +603,34 @@ void sbnd::ptb::PTBAnalysis::AnalysePTBs(std::vector<art::Ptr<raw::ptb::sbndptb>
590603
591604 int val = ptb->GetLLTrigger (i).trigger_word ;
592605
593- int upBit[10 ] = {-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 };
606+ int upBit[32 ];
607+ for (int u=0 ; u<32 ; u++){
608+ upBit[u]=-1 ;
609+ }
610+
594611 int numOfTrig =0 ;
595- for (int i =0 ; i <32 ;i ++){
612+ for (int b =0 ; b <32 ;b ++){
596613 if ((val & 0x01 ) ==1 ){
597- upBit[numOfTrig] = i ;
614+ upBit[numOfTrig] = b ;
598615 numOfTrig++;
599616 }
600617 val = val >> 1 ;
601618 }// End of loop over bits
602619
603620
604621 if (numOfTrig ==1 ){
622+ _ptb_llt_unmask_timestamp[llt_i] = _ptb_llt_timestamp[h_i-1 ];
605623 _ptb_llt_trunmask[llt_i] = upBit[0 ];
606624 llt_i++;
607625 } // End of if statement for single triggers
608626
609627 else if (numOfTrig > 1 ){
610628 nLLTs += (numOfTrig -1 );
611- _ptb_llt_timestamp .resize (nLLTs);
629+ _ptb_llt_unmask_timestamp .resize (nLLTs);
612630 _ptb_llt_trunmask.resize (nLLTs);
613631
614632 for (int mult =0 ; mult < numOfTrig; mult++){
633+ _ptb_llt_unmask_timestamp[llt_i] = _ptb_llt_timestamp[h_i-1 ];
615634 _ptb_llt_trunmask[llt_i] = upBit[mult];
616635 llt_i++;
617636 } // End of loop over multiple upBits
0 commit comments