30 , _centrality_calibration_params(name)
37 std::cout <<
"PHG4CentralityReco::InitRun : enter " << std::endl;
43 catch (std::exception &
e)
45 std::cout <<
PHWHERE <<
": " << e.what() << std::endl;
49 auto bhits = findNode::getClass<PHG4HitContainer>(topNode,
"G4HIT_BBC");
51 std::cout <<
"PHG4CentralityReco::InitRun : cannot find G4HIT_BBC, will not use MBD centrality" << std::endl;
53 auto ehits = findNode::getClass<PHG4HitContainer>(topNode,
"G4HIT_EPD");
55 std::cout <<
"PHG4CentralityReco::InitRun : cannot find G4HIT_EPD, will not use sEPD centrality" << std::endl;
61 std::cout <<
"PHG4CentralityReco::InitRun : Centrality calibration description : " << std::endl
66 for (
int n = 0;
n < 101;
n++)
68 std::ostringstream s1;
69 s1 <<
"epd_centile_" <<
n;
77 for (
int n = 0;
n < 101;
n++)
79 std::ostringstream s2;
80 s2 <<
"mbd_centile_" <<
n;
88 for (
int n = 0;
n < 101;
n++)
90 std::ostringstream s3;
91 s3 <<
"bimp_centile_" <<
n;
102 std::cout <<
"PHG4CentralityReco::InitRun : no centrality calibration found!" << std::endl;
111 auto event_header = findNode::getClass<EventHeaderv1>(topNode,
"EventHeader");
114 _bimp = event_header->get_floatval(
"bimp");
117 std::cout <<
"PHG4CentralityReco::process_event : Hijing impact parameter b = " <<
_bimp << std::endl;
122 std::cout <<
"PHG4CentralityReco::process_event : No Hijing impact parameter info, setting b = 101" << std::endl;
129 auto bhits = findNode::getClass<PHG4HitContainer>(topNode,
"G4HIT_BBC");
133 auto brange = bhits->getHits();
134 for (
auto it = brange.first;
it != brange.second; ++
it)
136 if ((
it->second->get_t(0) > -50) && (
it->second->get_t(1) < 50))
139 int id =
it->second->get_layer();
140 if ((
id & 0x40) == 0)
148 std::cout <<
"PHG4CentralityReco::process_event : MBD Sum Charge N / S / N+S = " <<
_mbd_N <<
" / " <<
_mbd_S <<
" / " <<
_mbd_NS << std::endl;
153 std::cout <<
"PHG4CentralityReco::process_event : No MBD info, setting all Sum Charges = 0" << std::endl;
160 auto ehits = findNode::getClass<PHG4HitContainer>(topNode,
"G4HIT_EPD");
164 auto erange = ehits->getHits();
165 for (
auto it = erange.first;
it != erange.second; ++
it)
166 if ((
it->second->get_t(0) > -50) && (
it->second->get_t(1) < 50))
180 std::cout <<
"PHG4CentralityReco::process_event : sEPD Sum Energy N / S / N+S = " <<
_epd_N <<
" / " <<
_epd_S <<
" / " <<
_epd_NS << std::endl;
185 std::cout <<
"PHG4CentralityReco::process_event : No sEPD info, setting all Sum Energies = 0" << std::endl;
189 std::cout <<
"PHG4CentralityReco::process_event : summary MBD (N, S, N+S) = (" <<
_mbd_N <<
", " <<
_mbd_S <<
", " <<
_mbd_NS <<
"), sEPD (N, S, N+S) = (" <<
_epd_N <<
", " <<
_epd_S <<
", " <<
_epd_NS <<
")" << std::endl;
194 float low_epd_val = -10000;
195 float high_epd_val = 10000;
196 int low_epd_centile = -1;
197 int high_epd_centile = -1;
202 int cent =
it->second;
204 if (signal < _epd_NS && signal > low_epd_val)
207 low_epd_centile = cent;
209 if (signal >
_epd_NS && signal < high_epd_val)
212 high_epd_centile = cent;
217 if (low_epd_centile >= 0 && high_epd_centile >= 0)
219 _epd_cent = (low_epd_centile + high_epd_centile) / 2.0;
221 std::cout <<
"PHG4CentralityReco::process_event : lower EPD value is " << low_epd_val <<
" (" << low_epd_centile <<
"%), higher is " << high_epd_val <<
" (" << high_epd_centile <<
"%), assigning " <<
_epd_cent <<
"%" << std::endl;
227 std::cout <<
"PHG4CentralityReco::process_event : not able to map EPD value to a centrality. debug info = " << low_epd_val <<
"/" << low_epd_centile <<
"/" << high_epd_val <<
"/" << high_epd_centile << std::endl;
231 float low_mbd_val = -10000;
232 float high_mbd_val = 10000;
233 int low_mbd_centile = -1;
234 int high_mbd_centile = -1;
239 int cent =
it->second;
241 if (signal < _mbd_NS && signal > low_mbd_val)
244 low_mbd_centile = cent;
246 if (signal >
_mbd_NS && signal < high_mbd_val)
249 high_mbd_centile = cent;
254 if (low_mbd_centile >= 0 && high_mbd_centile >= 0)
256 _mbd_cent = (low_mbd_centile + high_mbd_centile) / 2.0;
258 std::cout <<
"PHG4CentralityReco::process_event : lower MBD value is " << low_mbd_val <<
" (" << low_mbd_centile <<
"%), higher is " << high_mbd_val <<
" (" << high_mbd_centile <<
"%), assigning " <<
_mbd_cent <<
"%" << std::endl;
264 std::cout <<
"PHG4CentralityReco::process_event : not able to map MBD value to a centrality. debug info = " << low_mbd_val <<
"/" << low_mbd_centile <<
"/" << high_mbd_val <<
"/" << high_mbd_centile << std::endl;
268 float low_bimp_val = -1;
269 float high_bimp_val = 10000;
270 int low_bimp_centile = -1;
271 int high_bimp_centile = -1;
276 int cent =
it->second;
278 if (signal < _bimp && signal > low_bimp_val)
281 low_bimp_centile = cent;
283 if (signal >
_bimp && signal < high_bimp_val)
286 high_bimp_centile = cent;
291 if (low_bimp_centile >= 0 && high_bimp_centile >= 0)
293 _bimp_cent = (low_bimp_centile + high_bimp_centile) / 2.0;
295 std::cout <<
"PHG4CentralityReco::process_event : lower b value is " << low_bimp_val <<
" (" << low_bimp_centile <<
"%), higher is " << high_bimp_val <<
" (" << high_bimp_centile <<
"%), assigning " <<
_bimp_cent <<
"%" << std::endl;
301 std::cout <<
"PHG4CentralityReco::process_event : not able to map b value to a centrality. debug info = " << low_bimp_val <<
"/" << low_bimp_centile <<
"/" << high_bimp_val <<
"/" << high_bimp_centile << std::endl;
318 CentralityInfo *cent = findNode::getClass<CentralityInfo>(topNode,
"CentralityInfo");
321 std::cout <<
" ERROR -- can't find CentralityInfo node after it should have been created" << std::endl;
347 std::cerr <<
PHWHERE <<
"DST Node missing, doing nothing." << std::endl;
348 throw std::runtime_error(
"Failed to find DST node in PHG4CentralityReco::CreateNode");