29 std::vector<std::string>
split;
30 std::string sub_string;
31 std::istringstream tokenStream(
key);
33 while (std::getline(tokenStream, sub_string,
'.'))
35 split.push_back(sub_string);
39 return std::find(calculations.begin(), calculations.end(),
split[1]) != calculations.end();
46 ATH_MSG_ERROR(
"JetCaloEnergies needs to have its input jet container configured!");
47 return StatusCode::FAILURE;
97 return StatusCode::SUCCESS;
106 size_t numConstit =
jet->numConstituents();
108 std::vector<float>& ePerSampling = ePerSamplingHandle(*
jet);
109 for (
float&
e : ePerSampling )
e = 0.0;
111 if ( numConstit == 0 ) {
133 ATH_MSG_VERBOSE(
" Constituents are FlowElements - Additional calculation");
137 std::vector<float>& ePerSamplingCluster = ePerSamplingClusterHandle(*
jet);
138 for (
float&
e : ePerSamplingCluster )
e = 0.0;
144 ATH_MSG_VERBOSE(
"Constituents are not CaloClusters, PFOs, or FlowElements.");
148 return StatusCode::SUCCESS;
153 size_t numConstit =
jet.numConstituents();
154 for (
size_t i=0;
i<numConstit;
i++ ) {
156 ATH_MSG_WARNING(
"Tried to call fillEperSamplingCluster with a jet constituent that is not a cluster!");
165 double fracSamplingMax = -999999999.;
166 int fracSamplingMaxIndex = -1;
167 double sumE_samplings = 0.0;
170 for(
unsigned int i = 0;
i < ePerSampling.size(); ++
i){
171 double e = ePerSampling[
i];
173 if (
e>fracSamplingMax){
175 fracSamplingMaxIndex =
i;
190 fracSamplingMaxHandle(
jet) = sumE_samplings != 0. ? fracSamplingMax/sumE_samplings : 0.;
192 fracSamplingMaxIndexHandle(
jet) = fracSamplingMaxIndex;
196 #define FillESamplingPFO( LAYERNAME ) \
197 float E_##LAYERNAME = 0.0; \
198 if (constit->attribute(xAOD::PFODetails::eflowRec_LAYERENERGY_##LAYERNAME, E_##LAYERNAME)) { \
199 ePerSampling[CaloSampling::LAYERNAME] += E_##LAYERNAME; \
207 size_t numConstit =
jet.numConstituents();
209 for (
size_t i=0;
i<numConstit;
i++ ) {
212 if ( fabs(constit->
charge())>FLT_MIN ){
215 eTot += constit->
e();
252 emTot += ( E_PreSamplerB+E_EMB1+E_EMB2+E_EMB3+
253 E_PreSamplerE+E_EME1+E_EME2+E_EME3+
255 hecTot += ( E_HEC0+E_HEC1+E_HEC2+E_HEC3 );
259 ATH_MSG_WARNING(
"Tried to call fillEperSamplingPFlow with a jet constituent that is not a PFO!");
265 emFracHandle(
jet) = emTot/
eTot;
272 emFracHandle(
jet) = 0.;
277 hecFracHandle(
jet) = hecTot/
eTot;
280 hecFracHandle(
jet) = 0.;
295 size_t numConstit =
jet.numConstituents();
297 std::vector<int> indicesNeutralFE;
298 std::vector<int> indicesChargedFE;
300 for (
size_t i=0;
i<numConstit;
i++ ) {
302 ATH_MSG_WARNING(
"Tried to call fillEperSamplingFE with a jet constituent that is not a FlowElement!");
321 eTot += constit->
e();
322 e2Tot += constit->
e()*constit->
e();
326 ePerSampling[
s] += constitEPerSampling[
s];
364 e2Tot += nFE->
e()*nFE->
e();
368 ePerSampling[
s] += neutralEPerSampling[
s];
394 if(
std::find(indicesChargedFE.begin(), indicesChargedFE.end(), FE_from_combined->
index()) == indicesChargedFE.end()){
395 eTot += FE_from_combined->
e();
396 e2Tot += FE_from_combined->
e()*FE_from_combined->
e();
397 indicesChargedFE.push_back(FE_from_combined->
index());
404 if(
std::find(indicesNeutralFE.begin(), indicesNeutralFE.end(), FE_from_combined->
index()) == indicesNeutralFE.end()){
405 eTot += FE_from_combined->
e();
406 e2Tot += FE_from_combined->
e()*FE_from_combined->
e();
409 ePerSampling[
s] += neutralFromCombEPerSampling[
s];
426 indicesNeutralFE.push_back(FE_from_combined->
index());
433 double fracSamplingMax = -999999999.;
434 int fracSamplingMaxIndex = -1;
435 double sumE_samplings = 0.0;
438 for(
unsigned int i = 0;
i < ePerSampling.size(); ++
i){
439 double e = ePerSampling[
i];
441 if (
e>fracSamplingMax){
443 fracSamplingMaxIndex =
i;
449 if ( calcN ==
"EMFrac" ) {
452 }
else if ( calcN ==
"HECFrac" ) {
454 hecFracHandle(
jet) =
eTot != 0. ? hecTot/
eTot : 0.;
455 }
else if ( calcN ==
"PSFrac" ) {
458 }
else if ( calcN ==
"EM3Frac" ) {
460 em3FracHandle(
jet) =
eTot != 0. ? em3Tot/
eTot : 0.;
461 }
else if ( calcN ==
"Tile0Frac" ) {
463 tile0FracHandle(
jet) =
eTot != 0. ? tile0Tot/
eTot : 0.;
464 }
else if ( calcN ==
"EffNClusts" ) {
466 effNClustsFracHandle(
jet) =
eTot != 0. ? std::sqrt(
eTot*
eTot/e2Tot) : 0.;
467 }
else if ( calcN ==
"FracSamplingMax" ){
469 fracSamplingMaxHandle(
jet) = sumE_samplings != 0. ? fracSamplingMax/sumE_samplings : 0.;
471 fracSamplingMaxIndexHandle(
jet) = fracSamplingMaxIndex;
487 size_t numConstit =
jet.numConstituents();
488 std::unique_ptr<std::vector<const xAOD::CaloCluster*> > constitV_tot = std::make_unique<std::vector<const xAOD::CaloCluster*>>();
490 for (
size_t i=0;
i<numConstit;
i++ ) {
492 ATH_MSG_WARNING(
"Tried to call fillEperSamplingFE with a jet constituent that is not a FlowElement!");
500 if(index_pfo<0)
continue;
516 if(!cluster)
continue;
518 if(
std::find(constitV_tot->begin(), constitV_tot->end(), cluster) == constitV_tot->end()){
523 e2Tot += cluster->
rawE()*cluster->
rawE();
540 constitV_tot->push_back(cluster);
545 float fracSamplingMax = -999999999.;
546 int fracSamplingMaxIndex = -1;
547 float sumE_samplings = 0.0;
550 for(
unsigned int i = 0;
i < ePerSampling.size(); ++
i){
551 float e = ePerSampling[
i];
553 if (
e>fracSamplingMax){
555 fracSamplingMaxIndex =
i;
561 if ( calcN ==
"EMFrac" ) {
563 emFracClusterHandle(
jet) =
eTot != 0. ? emTot/
eTot : 0.;
564 }
else if ( calcN ==
"HECFrac" ) {
566 hecFracClusterHandle(
jet) =
eTot != 0. ? hecTot/
eTot : 0.;
567 }
else if ( calcN ==
"PSFrac" ) {
569 psFracClusterHandle(
jet) =
eTot != 0. ? psTot/
eTot : 0.;
570 }
else if ( calcN ==
"EM3Frac" ) {
572 em3FracClusterHandle(
jet) =
eTot != 0. ? em3Tot/
eTot : 0.;
573 }
else if ( calcN ==
"Tile0Frac" ) {
575 tile0FracClusterHandle(
jet) =
eTot != 0. ? tile0Tot/
eTot : 0.;
576 }
else if ( calcN ==
"EffNClusts" ) {
578 effNClustsFracClusterHandle(
jet) =
eTot != 0. ? std::sqrt(
eTot*
eTot/e2Tot) : 0.;
579 }
else if ( calcN ==
"FracSamplingMax" ){
581 fracSamplingMaxClusterHandle(
jet) = sumE_samplings != 0. ? fracSamplingMax/sumE_samplings : 0.;
583 fracSamplingMaxIndexClusterHandle(
jet) = fracSamplingMaxIndex;