3 #include <Event/Event.h>
4 #include <Event/EventTypes.h>
5 #include <Event/packetConstants.h>
6 #include <Event/packet.h>
7 #include <Event/packet_hbd_fpgashort.h>
12 #include <pdbcalbase/PdbParameterMap.h>
13 #include <phparameter/PHParameters.h>
15 #include <trackbase/TrkrDefUtil.h>
19 #include <mvtx/MvtxDefUtil.h>
20 #include <mvtx/MvtxHitSetv1.h>
38 for (
int ichip=0; ichip<
NCHIP; ichip++){
49 cout <<
"-----MvtxUnpackPRDF::Init-----" << endl;
60 cout <<
"-----MvtxUnpackPRDF::Init-----" << endl;
69 _event = findNode::getClass<Event>(topNode,
"PRDF");
72 cout <<
"MvtxUnpackPRDF::Process_Event - Event not found" << endl;
77 cout <<
"MvtxUnpackPRDF::Process_Event - non-data event type " <<
_event->
getEvtType() << endl;
81 _hitsetcon = findNode::getClass<TrkrHitSetContainer>(topNode,
"TrkrHitSetContainer");
84 cout <<
"MvtxUnpackPRDF::Process_Event - TrkrHitSetContainer not found" << endl;
89 MvtxDefUtil *mvtxdef =
new MvtxDefUtil();
91 for (
int ichip=0; ichip<
NCHIP; ichip++){
92 MvtxHitSetv1 *hitset =
new MvtxHitSetv1();
93 hitset->SetHitSetKey(mvtxdef->GenHitSetKey(
char(ichip),uint8_t(0),uint8_t(ichip)));
94 _hitsetcon->AddHitSetSpecifyKey(hitset->GetHitSetKey(),hitset);
97 cout <<
"-----MvtxUnpackPRDF::CreateNodeTree, Create hitset " << hitset->GetHitSetKey() << endl;
103 cout <<
"-----MvtxUnpackPRDF::process_event Create HitSet" << endl;
111 cout <<
"EVENT: " <<
_nevents << endl;
130 cout <<
"PHComposite node created: DST" << endl;
147 trkrNode->
addNode(hitsetconNode);
169 int nhits_for_this = 0;
176 int chipmax = p->
iValue(0,
"HIGHEST_CHIP") + 1;
179 cout <<
"CHIPMAX: " << chipmax << endl;
184 cout <<
"WARNING!! Event: " <<
_nevents <<
" More chips than expected!"
185 <<
" NCHIP:" <<
NCHIP <<
" HIGHEST_CHIP:" << chipmax << endl;
190 int excess_data_bytes = p->
iValue(0,
"EXCESS_DATA_BYTES");
191 if ( excess_data_bytes>0 )
193 cout <<
"WARNING!! Event: " <<
_nevents <<
" Data found past chip trailer"
194 <<
" EXCESS_DATA_BYTES: " << excess_data_bytes << endl;
200 for (
int ichip=0; ichip<
NCHIP; ichip++)
202 int header_found = p->
iValue(ichip,
"HEADER_FOUND");
203 int trailer_found = p->
iValue(ichip,
"TRAILER_FOUND");
204 int bunchcounter = p->
iValue(ichip,
"BUNCHCOUNTER");
208 if ( header_found==0 || trailer_found==0 )
212 cout <<
"WARNING!! Event: " <<
_nevents <<
" Missing chip " << ichip <<
" HEADER_FOUND: " << header_found <<
" TRAILER_FOUND: " << trailer_found <<
" BUNCHCOUNTER: " << bunchcounter << endl;
218 MvtxDefUtil *mvtxdef =
new MvtxDefUtil();
220 for (
int ichip=0; ichip<chipmax; ichip++)
223 int header_found = p->
iValue(ichip,
"HEADER_FOUND");
224 int trailer_found = p->
iValue(ichip,
"TRAILER_FOUND");
225 if (header_found==0 || trailer_found==0)
continue;
226 TrkrDefs::hitsetkey mvtx_hitsetkey = mvtxdef->GenHitSetKey(
char(ichip),uint8_t(0),uint8_t(ichip));
228 for (
int irow=0; irow<
NROW; irow++)
230 int regions = p->
iValue(ichip, irow);
231 if ( regions==0 )
continue;
234 cout <<
"ICHIP: " << ichip <<
",IROW: " << irow <<
", REGIONS: " << regions << endl;
236 for (
int iregion=0; iregion<
NREGION; iregion++)
238 if ( (regions>>iregion)&1 )
241 cout <<
"REGIONS: " << regions <<
", I: " << iregion << endl;
243 int bits = p->
iValue(ichip, iregion, irow);
244 if ( bits==0 )
continue;
248 if ( (bits>>icol)&1 )
252 int col = iregion*NCOL_PER_REGION + icol;
254 MvtxHitSetv1 *hitset =
static_cast<MvtxHitSetv1 *
>(
_hitsetcon->FindOrAddHitSet(mvtx_hitsetkey)->second);
258 hitset->AddHit(uint16_t(col),uint16_t(row));
263 cout <<
"NO HITSET!" << endl;
279 cout <<
"-----MvtxUnpackPRDF::process_event Check HitSetCon" << endl;
283 for (
int ichip=0; ichip<
NCHIP; ichip++){
284 TrkrDefs::hitsetkey mvtx_hitsetkey = mvtxdef->GenHitSetKey(
char(ichip),uint8_t(0),uint8_t(ichip));
285 MvtxHitSetv1 *hitset =
static_cast<MvtxHitSetv1 *
>(
_hitsetcon->FindHitSet(mvtx_hitsetkey));
286 MvtxHitSetv1::ConstRange itr_range = hitset->GetHits();
288 for (MvtxHitSetv1::ConstIterator itr = itr_range.first; itr != itr_range.second; ++itr){
292 cout <<
"N HITS: " << nhits_for_this <<
", " << nhits << endl;
305 cout <<
"-----MvtxUnpackPRDF::End-----" << endl;
309 MvtxDefUtil *mvtxdef =
new MvtxDefUtil();
311 cout <<
"-----MvtxUnpackPRDF::End::PrintSummary-----" << endl;
312 for (
int ichip=0; ichip<
NCHIP; ichip++){
314 cout <<
"CHIP, " << ichip <<
", "