24 #include "art_root_io/TFileService.h" 32 #include "DAQChannelMap/DAQChannelMap.h" 33 #include "NovaDAQConventions/DAQConventions.h" 36 #include "NovaTimingUtilities/TimingUtilities.h" 64 std::vector<uint32_t>
dcm;
65 std::vector<uint32_t>
feb;
75 std::set< std::pair<unsigned int, unsigned int> >
fSubRuns;
76 std::set< std::tuple<unsigned int, unsigned int, double> >
fTimes;
80 std::map< std::pair<unsigned int, unsigned int> ,
82 std::map< std::pair<unsigned int, unsigned int> ,
83 std::pair<unsigned int, unsigned int> >
fFEBhits;
85 std::map< std::pair<unsigned int, unsigned int>,
87 std::map< std::pair<unsigned int, unsigned int>,
135 std::getline(ifs, buff);
136 if (buff[0]==
'#')
continue;
141 sscanf(buff.c_str(),
"%d %d %d %lf", &
run, &
subrun, &event, &
time);
145 fEventMap.insert( std::pair<double, unsigned int>(time, event) );
146 fTimes.insert(std::make_tuple(run, subrun, time));
152 <<
" Failed to open file " <<
fEventFile <<
" for read" 190 for (
unsigned int dcmId=1; dcmId<4; ++dcmId){
191 for (
unsigned int febId=0; febId<64; ++febId){
192 if ( (dcmId<3&&(febId==8||febId==24||febId==40||febId==56)) || (dcmId==2&&(febId==47||febId==63)) || (dcmId==3&&febId>7) )
194 fFEBhitsNULL.insert(std::pair <std::pair <unsigned int, unsigned int>, std::pair <unsigned int, unsigned int> >
198 fShutoffMapNULL.insert(std::pair <std::pair <unsigned int, unsigned int>, std::pair <bool, double> >
251 unsigned long int unixTimeSec = unixTime.tv_sec;
252 unsigned long int unixTimeNanoSec = unixTime.tv_nsec;
256 std::set< std::tuple<unsigned int, unsigned int, double> >::iterator setIt
261 double beamlineEvtTime_prev = std::get<2>(*setIt);
264 if (
abs(diff2)<
abs(diff)){
271 if ( (diff-0.11<0 || diff-0.11>0.2) && (diff+fWindow<0 || diff+fWindow>0.2) )
288 double hitTimePrev = 0;
289 for (
unsigned int hitIdx=0; hitIdx<cellhits->size(); ++hitIdx){
292 unsigned int dcmId = cmap->
Map()->
getDCM(dchan);
293 unsigned int febId = cmap->
Map()->
getFEB(dchan);
294 double hitTime = spillEvtTime + ihit->
TNS()*1
e-9;
301 if ( febStatusNano == 32) {
306 else if (febStatusNano == 48 && hitTime > hitTimePrev ) {
331 dcm.push_back((mapIt.first).first);
332 feb.push_back((mapIt.first).second);
333 nhit_pre.push_back((mapIt.second).first);
334 nhit_post.push_back((mapIt.second).second);
double fWindow
Time window to check before/after event.
EventNumber_t event() const
void ClearMapAndVectors()
std::vector< bool > febShutoffBit
1 if shutoff bit set prior to event time and FEB recorded no hits after
std::string fEventFile
List of run/subrun/event/evt_times.
std::vector< uint32_t > feb
Double_t spillEvtTime
Trigger time of current art event.
std::map< std::pair< unsigned int, unsigned int >, std::pair< bool, double > > fShutoffMapNULL
Null map to reset shutoff state for every FEB.
vector< vector< double > > clear
const daqchannelmap::DAQChannelMap * Map() const
std::pair< Spectrum *, CheatDecomp * > make_pair(SpectrumLoaderBase &loader_data, SpectrumLoaderBase &loader_mc, HistAxis *axis, Cut *cut, const SystShifts &shift, const Var &wei)
std::string fCellHitLabel
Module that produced cell hits.
EDAnalyzer(fhicl::ParameterSet const &pset)
DEFINE_ART_MODULE(TestTMapFile)
bool convertNovaTimeToUnixTime(uint64_t const &inputNovaTime, struct timespec &outputUnixTime)
::xsd::cxx::tree::time< char, simple_type > time
std::vector< uint32_t > dcm
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
uint32_t DaqChannel() const
std::vector< int > nhit_pre
Number of hits in fWindow before beamline event time.
std::map< std::pair< unsigned int, unsigned int >, std::pair< unsigned int, unsigned int > > fFEBhits
Map of hits counts before and after event for each dcm,feb combination.
std::set< std::pair< unsigned int, unsigned int > > fSubRuns
SubRunNumber_t subRun() const
Double_t beamlineEvtTime
Trigger time of corresponding Beamline event.
std::set< std::tuple< unsigned int, unsigned int, double > > fTimes
bool completePost
Have we looked at the full fWindow after the event?
std::map< std::pair< unsigned int, unsigned int >, std::pair< bool, double > > fShutoffMap
Map of shutoff status and last hit time for each dcm,feb combination.
unsigned int fNhitCut
If # hits on an FEB in fWindow before or after the event time is below this, the feb is marked bad...
bool completePre
Have we looked at the full fWindow before the event?
EventFEBStatus(fhicl::ParameterSet const &pset)
std::map< double, unsigned int > fEventMap
Map of beamline event time to event number.
unsigned long long fTriggerTimingMarker_TimeStart
void analyze(const art::Event &evt) override
int beamlineEvent
Event number of corresponding event in Beamline stream (provided in event-list file) ...
int spillEvent
Event number of current art event (last event with window in it is the number that goes in the TTree)...
dcm_id_t getDCM(dchan daqchan) const
Decode the dcm ID from a dchan.
std::map< std::pair< unsigned int, unsigned int >, std::pair< unsigned int, unsigned int > > fFEBhitsNULL
Null map to set hit count to zero for every FEB.
std::set< unsigned int > fRuns
uint32_t dchan
< DAQ Channel Map Package
bool eventStatus
0 if any FEB has a status of 0
std::vector< bool > febStatus
0 if nhit_pre or nhit_post is less than fNhitCut
std::vector< int > nhit_post
Number of hits in fWindow after beamline event time.
std::string fRawDataLabel
Module that produced raw digits (to get trigger/event time)
feb_t getFEB(dchan daqchan) const
Decode the feb id from a dchan.