GCC Code Coverage Report


Directory: ./
File: src/dp/abstractEventSource.cc
Date: 2025-09-01 06:19:01
Exec Total Coverage
Lines: 4 52 7.7%
Functions: 1 8 12.5%
Branches: 2 5 40.0%

Line Branch Exec Source
1 #include "na64dp/abstractEventSource.hh"
2 #include "na64util/str-fmt.hh"
3 #include "na64detID/TBName.hh"
4
5 #include <cstring>
6
7 namespace na64dp {
8
9 bool
10 AbstractEventSource::read_prev(event::Event &, event::LocalMemory &) {
11 throw errors::UnsupportedDataSourceFeature("Access to previous event is"
12 " not implemented by data source.");
13 }
14
15 bool
16 AbstractEventSource::read_by_id(EventID, event::Event &, event::LocalMemory &) {
17 throw errors::UnsupportedDataSourceFeature("Random acces to events is"
18 " not implemented by data source.");
19 }
20
21 size_t
22 AbstractEventSource::list_events(std::vector<EventID> &, size_t nPage, size_t nPerPage) {
23 throw errors::UnsupportedDataSourceFeature("Events listing is"
24 " not implemented by data source.");
25 }
26
27 1 AbstractEventSource::AbstractEventSource( iEvProcInfo * epi )
28
2/2
✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
1 : _log(log4cpp::Category::getInstance("sources"))
29 1 , _epi(epi)
30 1 {}
31
32 AbstractEventSource::AbstractEventSource( iEvProcInfo * epi
33 , log4cpp::Category & logCat )
34 : _log(logCat)
35 , _epi(epi)
36 {}
37
38 void
39 AbstractNameCachedEventSource::handle_update( const nameutils::DetectorNaming & names ) {
40 calib::Handle<nameutils::DetectorNaming>::handle_update(names);
41 // Chips cache
42 _detIDsCache.kSADC = names.chip_id( "SADC" );
43 _detIDsCache.kAPV = names.chip_id( "APV" );
44 _detIDsCache.kStwTDC = names.chip_id( "NA64TDC" );
45 _detIDsCache.kF1 = names.chip_id( "F1" );
46 _detIDsCache.kNA64WB = names.chip_id( "NA64WB" );
47 // ... add new chip here
48 // Kins caches
49 // - SADC
50 _detIDsCache.kECAL = names.kin_id("ECAL").second;
51 _detIDsCache.kHCAL = names.kin_id("HCAL").second;
52 _detIDsCache.kWCAL = names.kin_id("WCAL").second;
53 _detIDsCache.kVHCAL = names.kin_id("WCAL").second;
54 _detIDsCache.kWCAT = names.kin_id("WCAT").second;
55 _detIDsCache.kZDCAL = names.kin_id("ZDCAL").second;
56 _detIDsCache.kSRD = names.kin_id("SRD").second;
57 _detIDsCache.kVETO = names.kin_id("VETO").second;
58 _detIDsCache.kV = names.kin_id("V").second;
59 _detIDsCache.kS = names.kin_id("S").second;
60 _detIDsCache.kVTEC = names.kin_id("VTEC").second;
61 _detIDsCache.kVTWC = names.kin_id("VTWC").second;
62 _detIDsCache.kDM = names.kin_id("DM").second;
63 // - NA64TDC
64 _detIDsCache.kSt = names.kin_id("ST").second;
65 _detIDsCache.kStt = names.kin_id("STT").second;
66 // - APV
67 _detIDsCache.kMM = names.kin_id("MM").second;
68 _detIDsCache.kGEM = names.kin_id("GM").second;
69 // - F1
70 _detIDsCache.kBMS = names.kin_id("BM").second;
71 _log.debug( "Source's names cache updated." );
72 // ... add new detector kin here
73 }
74
75 const AbstractNameCachedEventSource::NameCache &
76 AbstractNameCachedEventSource::naming() const {
77 if( _detIDsCache.kSADC == _detIDsCache.kAPV
78 && _detIDsCache.kAPV == _detIDsCache.kStwTDC
79 && 0x0 == _detIDsCache.kAPV ) {
80 char errbf[256];
81 snprintf( errbf, sizeof(errbf), "Chip IDs are not set for source %p;"
82 " this probably indicates that none valid event number was given"
83 " to calibration manager.", this );
84 throw std::runtime_error( errbf );
85 }
86 return _detIDsCache;
87 }
88
89 AbstractNameCachedEventSource::AbstractNameCachedEventSource( calib::Manager & mgr
90 , log4cpp::Category & logCat
91 , const std::string & namingClass
92 , iEvProcInfo * epi
93 )
94 : AbstractEventSource(epi, logCat)
95 , calib::Handle<nameutils::DetectorNaming>(namingClass, mgr)
96 , _mgr(mgr)
97 { memset( &_detIDsCache, 0, sizeof(_detIDsCache) ); }
98
99 } // namespace na64dp
100
101