39 #include <TMatrixFfwd.h>
41 #include <TMatrixTUtils.h>
60 { std::cout <<
PHWHERE <<
"Construct TpcRawWriter" << std::endl; }
66 std::cout <<
PHWHERE <<
"Init TpcRawWriter" << std::endl;
73 std::cout <<
PHWHERE <<
"DST Node missing, doing nothing." << std::endl;
78 auto trkrclusters = findNode::getClass<TrkrClusterContainer>(dstNode,
"TRKR_CLUSTER");
87 dstNode->addNode(DetNode);
93 DetNode->
addNode(TrkrClusterContainerNode);
96 auto clusterhitassoc = findNode::getClass<TrkrClusterHitAssoc>(topNode,
"TRKR_CLUSTERHITASSOC");
105 dstNode->addNode(DetNode);
114 m_rawhits = findNode::getClass<RawHitSetContainerv1>(topNode,
"TRKR_RAWHITSET");
122 dstNode->addNode(DetNode);
127 DetNode->addNode(newNode);
139 std::cout <<
"TpcRawWriter::Process_Event" << std::endl;
145 std::cout <<
PHWHERE <<
"DST Node missing, doing nothing." << std::endl;
150 m_hits = findNode::getClass<TrkrHitSetContainer>(topNode,
"TRKR_HITSET");
153 std::cout <<
PHWHERE <<
"ERROR: Can't find node TRKR_HITSET" << std::endl;
158 m_rawhits = findNode::getClass<RawHitSetContainerv1>(topNode,
"TRKR_RAWHITSET");
161 std::cout <<
PHWHERE <<
"ERROR: Can't find node TRKR_HITSET" << std::endl;
166 m_clusterlist = findNode::getClass<TrkrClusterContainer>(topNode,
"TRKR_CLUSTER");
169 std::cout <<
PHWHERE <<
" ERROR: Can't find TRKR_CLUSTER." << std::endl;
174 m_clusterhitassoc = findNode::getClass<TrkrClusterHitAssoc>(topNode,
"TRKR_CLUSTERHITASSOC");
177 std::cout <<
PHWHERE <<
" ERROR: Can't find TRKR_CLUSTERHITASSOC" << std::endl;
182 findNode::getClass<PHG4TpcCylinderGeomContainer>(topNode,
"CYLINDERCELLGEOM_SVTX");
185 std::cout <<
PHWHERE <<
"ERROR: Can't find node CYLINDERCELLGEOM_SVTX" << std::endl;
189 m_tGeometry = findNode::getClass<ActsGeometry>(topNode,
194 <<
"ActsTrackingGeometry not found on node tree. Exiting"
204 std::cout <<
"processing mvtx" << std::endl;
210 hitsetitr != mvtxhitsetrange.second;
220 hitr != hitrangei.second;
222 unsigned short adc = (
unsigned short)(hitr->second->getAdc());
236 std::cout <<
"processing intt" << std::endl;
242 hitsetitr != intt_hitsetrange.second;
252 hitr != hitrangei.second;
257 unsigned short adc = (
unsigned short)(hitr->second->getAdc());
272 std::cout <<
"processing mm" << std::endl;
278 hitsetitr != mm_hitsetrange.second;
288 hitr != hitrangei.second;
291 unsigned short adc = (
unsigned short)(hitr->second->getAdc());
296 unsigned short it = 0;
306 std::cout <<
"processing tpc" << std::endl;
315 hitsetitr != tpc_hitsetrange.second;
325 unsigned short NPhiBins = (
unsigned short) layergeom->
get_phibins();
326 unsigned short NPhiBinsSector = NPhiBins/12;
327 unsigned short NZBins = (
unsigned short)layergeom->
get_zbins();
329 unsigned short NZBinsSide = NZBins;
330 unsigned short NZBinsMin = 0;
331 unsigned short PhiOffset = NPhiBinsSector * sector;
332 unsigned short ZOffset = NZBinsMin;
333 std::vector<int> nhits_thispad;
334 std::vector<std::vector<unsigned short>> adcval;
335 adcval.resize(NPhiBins);
337 for(
int nz= 0;
nz < NZBins;
nz++){
338 adcval[
nphi].push_back(0);
339 nhits_thispad.push_back(0);
353 if(layer>=7 && layer <22){
354 int etacut = 249 - ((50+(layer-7))/105.5)*249;
358 if(layer>=22 && layer <=48){
359 int etacut = 249 - ((65+((40.5/26)*(layer-22)))/105.5)*249;
366 hitr != hitrangei.second;
378 if(phibin>=NPhiBinsSector){
382 if(zbin>=NZBinsSide){
386 if(zbinorg>zbinmax||zbinorg<zbinmin)
388 float_t fadc = (hitr->second->getAdc()) -
pedestal;
389 unsigned short adc = 0;
390 if(fadc>0) adc = (
unsigned short) fadc;
393 nhits_thispad[phibin]++;
395 adcval[phibin][
it] = adc;
409 for(
int nz= 0;
nz < NZBins;
nz++){
427 if(nhits_thispad[
nphi]==0)
continue;
428 for(
int nz= 0;
nz < NZBins;
nz++){
441 thisadc = adcval[
nphi][
nz];
447 if(layer==222&§or==6&&
nphi==10)std::cout <<
"0#"<<
nphi<<
"nz= " <<
nz <<
" filling " << (int)thisadc <<
" at " << rhitset->
m_tpchits[
nphi].size() << std::endl;
469 if(layer==222&§or==6&&
nphi==10)
470 std::cout <<
"3#"<<
nphi<<
"nz= " <<
nz <<
" filling " << zero_count-1 <<
" at " << rhitset->
m_tpchits[
nphi].size() <<
" nz+2 " << (
nz+2) <<
" adcval[nz+2]" << (
int) adcval[
nphi][
nz+2] << std::endl;
474 if(layer==222&§or==6&&
nphi==10)std::cout <<
"4#"<<
nphi<<
"nz= " <<
nz <<
" filling " << 0 <<
" at " << rhitset->
m_tpchits[
nphi].size() << std::endl;
483 if(layer==222&§or==6&&
nphi==10)std::cout <<
"5#"<<
nphi<<
"nz= " <<
nz <<
" filling " << 0 <<
" at " << rhitset->
m_tpchits[
nphi].size() << std::endl;
487 if(zero_count == 254){
491 if(layer==222&§or==6&&
nphi==10)std::cout <<
"6#"<<
nphi<<
"nz= " <<
nz <<
" filling " << 254-1 <<
" at " << rhitset->
m_tpchits[
nphi].size() << std::endl;
515 std::vector<std::vector<uint8_t>> outval;
516 outval.resize(NPhiBins);
518 outval[
nphi].resize(NZBins,0);
519 for(
int nz= 0;
nz < NZBins;
nz++){
521 std::cout <<
"WARNING!" << std::endl;
529 for(
unsigned int nzo = 0;nzo<rhitset->
m_tpchits[
nphi].size();nzo++){
536 outval[
nphi][pindex++]=val;
541 outval[
nphi][pindex++]=val;
554 for(
int nz= 0;
nz < NZBins;
nz++){
557 if(outval[
nphi][nz]!=255){
565 std::cout <<
"sector: " << sector <<
" lay: " << layer <<
" # " <<
nphi <<
" bad:" << bad <<
" packsize: "<< (int)rhitset->
m_tpchits[
nphi].size() << std::endl;
567 for(
int nz= 0;
nz < NZBins;
nz++){
568 std::cout <<
"sector: " << sector <<
" lay: " << layer <<
" # " <<
nphi <<
"|"<<
nz <<
" bad:" << bad <<
" org: " << (int)adcval[
nphi][
nz] <<
" pack: "<< (
int)outval[
nphi][
nz] << std::endl;
571 std::cout <<
"lay: " << layer <<
" # " <<
nphi <<
"|"<<
nz <<
" bad:" << bad <<
" pack: " << (int) rhitset->
m_tpchits[
nphi][
nz] << std::endl;
584 std::cout <<
" number of hits checked " << ncheck <<
" bad: " << allbad << std::endl;