25 ATH_MSG_ERROR(
"OutputDecorKeys should not be configured manually!");
26 return StatusCode::FAILURE;
29 ATH_MSG_ERROR(
"JetCaloQualityToolFE needs to have its input jet container name configured!");
30 return StatusCode::FAILURE;
36 if(calcN ==
"LArQuality"){
39 else if(calcN ==
"HECQuality"){
42 else if(calcN ==
"NegativeE"){
45 else if(calcN ==
"AverageLArQF"){
48 else if(calcN ==
"Timing"){
51 else if(calcN ==
"Centroid"){
54 else if(calcN ==
"BchCorrCell"){
58 if(calcN ==
"Centroid"){
70 s << std::setprecision(0) << std::fixed <<
"OotFracClusters" << timeCut;
76 std::ostringstream sout;
77 sout <<
"N" << fracCut <<
"Constituents";
89 return StatusCode::SUCCESS;
101 return StatusCode::SUCCESS;
106 std::vector<const xAOD::CaloCluster*> clusters;
113 for (
size_t i = 0; i <
jet.numConstituents(); i++ ) {
115 clusters.push_back(constit);
127 ATH_MSG_VERBOSE(
" Constituents are ParticleFlow objects stored as FlowElements.");
128 for (
size_t i = 0; i <
jet.numConstituents(); i++ ) {
136 if(cluster !=
nullptr){
137 clusters.push_back(cluster);
145 for (
size_t i = 0; i <
jet.numConstituents(); i++ ) {
156 if(index_pfo<0)
continue;
167 if(!cluster){
continue;}
169 if(std::find(clusters.begin(), clusters.end(), cluster) == clusters.end()){
170 clusters.push_back(cluster);
188 float sum_E_square = 0.0;
190 float sum_badLarQ = 0.0;
191 float sum_badHECQ = 0.0;
192 float sum_e_HEC = 0.0;
193 float sum_e_neg = 0.0;
194 float sum_avg_lar_q = 0.0;
195 float sum_timing = 0.0;
196 float centroid_x = 0.0, centroid_y = 0.0, centroid_z = 0.0;
197 float sum_e_bad_cells = 0.0;
199 std::vector<float> sum_OOT;
202 std::vector<int> counter_Nfrac;
205 std::vector<float> cluster_energies;
207 for (
size_t i = 0; i < clusters.size(); i++){
214 sum_E_square += cluster_E*cluster_E;
216 cluster_energies.push_back(cluster_E);
224 sum_badLarQ += bad_frac*cluster_E;
228 float e_HEC = constit->
eSample( CaloSampling::HEC0) + constit->
eSample( CaloSampling::HEC1) + constit->
eSample( CaloSampling::HEC2) + constit->
eSample( CaloSampling::HEC3);
230 sum_badHECQ += bad_frac*e_HEC;
238 sum_e_neg += cluster_E - e_pos;
243 double avg_lar_q=0.0;
245 sum_avg_lar_q += avg_lar_q*cluster_E*cluster_E;
250 double x = 0.0,
y = 0.0,
z = 0.0;
255 centroid_x +=
x*cluster_E;
256 centroid_y +=
y*cluster_E;
257 centroid_z +=
z*cluster_E;
262 double cells_bad_E = 0.0;
264 sum_e_bad_cells += cells_bad_E;
269 double timing = constit->
time();
272 sum_timing += timing*cluster_E*cluster_E;
278 sum_OOT[j] += cluster_E;
287 std::sort(cluster_energies.rbegin(),cluster_energies.rend());
289 for(
size_t iFracCut = 0; iFracCut <
m_thresholdCuts.size(); iFracCut++){
294 for(
unsigned int iClus = 0; iClus < cluster_energies.size(); iClus++){
295 tmp_sum += cluster_energies[iClus];
299 counter_Nfrac[iFracCut] = counter;
309 if(calcN ==
"LArQuality"){
310 decHandle(
jet) = sum_E != 0. ? sum_badLarQ/sum_E : 0.;
312 else if(calcN ==
"HECQuality"){
313 decHandle(
jet) = sum_e_HEC != 0. ? sum_badHECQ/sum_e_HEC : 0.;
315 else if(calcN ==
"NegativeE"){
316 decHandle(
jet) = sum_e_neg;
318 else if(calcN ==
"AverageLArQF"){
319 decHandle(
jet) = sum_E_square != 0. ? sum_avg_lar_q/sum_E_square : 0.;
321 else if(calcN ==
"Timing"){
322 decHandle(
jet) = sum_E_square != 0. ? sum_timing/sum_E_square : 0.;
324 else if(calcN ==
"Centroid"){
325 decHandle(
jet) = sum_E_square != 0. ? sqrt(centroid_x*centroid_x+centroid_y*centroid_y+centroid_z*centroid_z)/sum_E_square : 0.;
327 else if(calcN ==
"BchCorrCell"){
334 decHandle_timing(
jet) = sum_E != 0. ? sum_OOT[iCut]/sum_E : 0. ;
337 for(
size_t iFracCut = 0; iFracCut <
m_thresholdCuts.size(); iFracCut++){
341 decHandle_frac(
jet) = counter_Nfrac[iFracCut];
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_VERBOSE(x,...)
size_t size() const
Number of registered mappings.
Handle class for adding a decoration to an object.
bool retrieveMoment(MomentType type, double &value) const
Retrieve individual moment.
flt_t time() const
Access cluster time.
virtual double e() const
The total energy of the particle.
float eSample(const CaloSample sampling) const
@ AVG_LAR_Q
Sum(E_cell_LAr^2 Q_cell_LAr)/Sum(E_cell_LAr^2).
@ CENTER_Z
Cluster Centroid ( ).
@ ENG_BAD_CELLS
Total em-scale energy of bad cells in this cluster.
@ ENG_POS
Total positive Energy of this cluster.
@ BADLARQ_FRAC
Energy fraction of LAr cells with quality larger than a given cut.
@ CENTER_X
Cluster Centroid ( ).
@ CENTER_Y
Cluster Centroid ( ).
std::size_t nOtherObjects() const
std::vector< const xAOD::IParticle * > otherObjects() const
signal_t signalType() const
const xAOD::IParticle * otherObject(std::size_t i) const
virtual Type::ObjectType type() const =0
The type of the object as a simple enumeration.
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
ObjectType
Type of objects that have a representation in the xAOD EDM.
@ FlowElement
The object is a track-calo-cluster.
@ CaloCluster
The object is a calorimeter cluster.
Jet_v1 Jet
Definition of the current "jet version".
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
FlowElement_v1 FlowElement
Definition of the current "pfo version".
JetContainer_v1 JetContainer
Definition of the current "jet container version".