9 #include <Event/Event.h>
10 #include <Event/EventTypes.h>
11 #include <Event/packet.h>
49 std::cout <<
"MicromegasRawDataDecoder::InitRun - DST Node missing, doing nothing." << std::endl;
54 auto hitsetcontainer = findNode::getClass<TrkrHitSetContainer>(topNode,
"TRKR_HITSET");
57 std::cout <<
"MicromegasRawDataDecoder::InitRun - creating TRKR_HITSET." << std::endl;
65 dstNode->addNode(trkrnode);
71 trkrnode->addNode(newNode);
84 auto trkrhitsetcontainer = findNode::getClass<TrkrHitSetContainer>(topNode,
"TRKR_HITSET");
85 assert(trkrhitsetcontainer);
88 auto event = findNode::getClass<Event>(topNode,
"PRDF");
92 if(
event->getEvtType() >= 8)
98 std::unique_ptr<Packet> packet(
event->getPacket(packet_id) );
103 { std::cout <<
"MicromegasRawDataDecoder::process_event - event contains no TPOT data" << std::endl; }
108 const auto n_waveforms = packet->iValue(0,
"NR_WF" );
110 { std::cout <<
"MicromegasRawDataDecoder::process_event - n_waveforms: " << n_waveforms << std::endl; }
111 for(
int iwf=0; iwf<n_waveforms; ++iwf )
114 const int fee = packet->iValue(iwf,
"FEE" );
115 const auto channel = packet->iValue( iwf,
"CHANNEL" );
116 const int samples = packet->iValue( iwf,
"SAMPLES" );
119 [[maybe_unused]]
const int bco = packet->iValue(iwf,
"BCO");
120 [[maybe_unused]]
const int checksum = packet->iValue(iwf,
"CHECKSUM");
121 [[maybe_unused]]
const int checksum_error = packet->iValue(iwf,
"CHECKSUMERROR");
128 if( rms <= 0 )
continue;
131 std::vector<int> adc;
133 { adc.push_back( packet->iValue( iwf, is ) ); }
135 if( adc.empty() )
continue;
139 auto max_adc = *std::max_element( adc.begin(), adc.end() );
145 if( max_adc < pedestal +
m_n_sigma * rms )
continue;
153 if( !hitsetkey )
continue;
157 if( strip < 0 )
continue;
161 std::cout <<
"MicromegasRawDataDecoder::process_event -"
163 <<
" errir: " << checksum_error
167 <<
" strip: " << strip
168 <<
" adc: " << max_adc
173 const auto hitset_it = trkrhitsetcontainer->findOrAddHitSet(hitsetkey);
179 auto hit = hitset_it->second->getHit(hitkey);
189 hitset_it->second->addHitSpecificKey(hitkey, hit);
204 { std::cout <<
"MicromegasRawDataDecoder::End - hitsetkey: " <<
hitsetkey <<
", count: " <<
count << std::endl; }