30 #include <boost/format.hpp>
31 #include <boost/math/special_functions/sign.hpp>
51 , _runnumber(runnumber)
83 cout <<
"========================= TrackerEventDisplay::End() ============================" << endl;
84 cout <<
" " <<
_ievent <<
" events of output written to: " <<
_filename << endl;
85 cout <<
"===========================================================================" << endl;
95 cout <<
"TrackerEventDisplay::makeJsonFile() entered" << endl;
98 ActsGeometry* tgeometry = findNode::getClass<ActsGeometry>(topNode,
"ActsGeometry");
101 std::cout <<
"No Acts geometry on node tree. Can't continue."
107 findNode::getClass<PHG4TpcCylinderGeomContainer>(topNode,
"CYLINDERCELLGEOM_SVTX");
110 std::cout <<
PHWHERE <<
"ERROR: Can't find node CYLINDERCELLGEOM_SVTX" << std::endl;
120 bool firstHit =
true;
126 cerr <<
"ERROR: file could not be opened" << endl;
130 outdata <<
"{\n \"EVENT\": {\n \"runid\":" <<
_runnumber <<
", \n \"evtid\": 1, \n \"time\": 0, \n \"timeStr\": \"2023-08-23, 15:23:30 EST\", \n \"type\": \"Cosmics\", \n \"s_nn\": 0, \n \"B\": 0.0,\n \"pv\": [0,0,0],\n \"runstats\": [ \n \"sPHENIX Time Projection Chamber\", \"" <<
_date <<
", Run " <<
_runnumber <<
" - Event " <<
_ievent <<
"\", \"All Hits in Event\"] \n },\n" << endl;
132 outdata <<
" \"META\": {\n \"HITS\": {\n \"INNERTRACKER\": {\n \"type\": \"3D\",\n \"options\": {\n \"size\": 2,\n \"color\": 16777215\n } \n },\n" << endl;
133 outdata <<
" \"TRACKHITS\": {\n \"type\": \"3D\",\n \"options\": {\n \"size\": 2,\n \"transparent\": 0.5,\n \"color\": 16777215\n } \n },\n" << endl;
134 outdata <<
" \"JETS\": {\n \"type\": \"JET\",\n \"options\": {\n \"rmin\": 0,\n \"rmax\": 78,\n \"emin\": 0,\n \"emax\": 30,\n \"color\": 16777215,\n \"transparent\": 0.5 \n }\n }\n }\n }\n," << endl;
135 outdata <<
" \"HITS\": {\n \"CEMC\":[{\"eta\": 0, \"phi\": 0, \"e\": 0}\n ],\n \"HCALIN\": [{\"eta\": 0, \"phi\": 0, \"e\": 0}\n ],\n \"HCALOUT\": [{\"eta\": 0, \"phi\": 0, \"e\": 0}\n \n ],\n\n" << endl;
136 outdata <<
" \"TRACKHITS\": [\n\n ";
138 auto m_tGeometry = findNode::getClass<ActsGeometry>(topNode,
"ActsGeometry");
142 cout <<
"Filling hit json" << endl;
145 TrkrHitSetContainer* hitmap = findNode::getClass<TrkrHitSetContainer>(topNode,
"TRKR_HITSET");
151 iter != all_hitsets.second;
159 hitr != hitrangei.second;
167 float adc = hit->
getAdc();
177 float phi_center = NAN;
190 double zdriftlength = tbin * m_tGeometry->get_drift_velocity() *
AdcClockPeriod;
193 unsigned short NTBins = (
unsigned short) GeoLayer_local->
get_zbins();
195 double clusz = (m_tdriftmax * m_tGeometry->get_drift_velocity()) - zdriftlength;
202 x = radius * cos(phi_center);
203 y = radius * sin(phi_center);
207 if (firstHit) firstHit =
false;
227 outdata <<
"],\n \"JETS\": [\n ]\n }," << endl;
228 outdata <<
"\"TRACKS\": {" << endl;
229 outdata <<
"\""<<
"INNERTRACKER"<<
"\": [";
242 bool firstHit =
true;
248 cerr <<
"ERROR: file could not be opened" << endl;
252 outdata <<
"{\n \"EVENT\": {\n \"runid\":" <<
_runnumber <<
", \n \"evtid\": 1, \n \"time\": 0, \n \"timeStr\": \"2023-08-23, 15:23:30 EST\", \n \"type\": \"Cosmics\", \n \"s_nn\": 0, \n \"B\": 0.0,\n \"pv\": [0,0,0],\n \"runstats\": [ \n \"sPHENIX Time Projection Chamber\", \"" <<
_date <<
", Run " <<
_runnumber <<
" - Event " <<
_ievent <<
"\", \"All Clusters in Event\"] \n },\n" << endl;
254 outdata <<
" \"META\": {\n \"HITS\": {\n \"INNERTRACKER\": {\n \"type\": \"3D\",\n \"options\": {\n \"size\": 2,\n \"color\": 16777215\n } \n },\n" << endl;
255 outdata <<
" \"TRACKHITS\": {\n \"type\": \"3D\",\n \"options\": {\n \"size\": 2,\n \"transparent\": 0.5,\n \"color\": 16777215\n } \n },\n" << endl;
256 outdata <<
" \"JETS\": {\n \"type\": \"JET\",\n \"options\": {\n \"rmin\": 0,\n \"rmax\": 78,\n \"emin\": 0,\n \"emax\": 30,\n \"color\": 16777215,\n \"transparent\": 0.5 \n }\n }\n }\n }\n," << endl;
257 outdata <<
" \"HITS\": {\n \"CEMC\":[{\"eta\": 0, \"phi\": 0, \"e\": 0}\n ],\n \"HCALIN\": [{\"eta\": 0, \"phi\": 0, \"e\": 0}\n ],\n \"HCALOUT\": [{\"eta\": 0, \"phi\": 0, \"e\": 0}\n \n ],\n\n" << endl;
258 outdata <<
" \"TRACKHITS\": [\n\n ";
262 cout <<
"Filling cluster json " << endl;
266 TrkrClusterContainer* clustermap = findNode::getClass<TrkrClusterContainer>(topNode,
"CORRECTED_TRKR_CLUSTER");
269 clustermap = findNode::getClass<TrkrClusterContainer>(topNode,
"TRKR_CLUSTER");
274 if (clustermap !=
nullptr)
276 cout <<
"got clustermap" << endl;
280 cout <<
"no clustermap" << endl;
289 for (
auto iter = range.first; iter != range.second; ++iter)
299 float adc = cluster->
getAdc();
303 if (firstHit) firstHit =
false;
322 outdata <<
"],\n \"JETS\": [\n ]\n }," << endl;
323 outdata <<
"\"TRACKS\": {" << endl;
324 outdata <<
"\""<<
"INNERTRACKER"<<
"\": [";