27 for (
auto *
ptr : trackClusterLink) {
41 double expectedEnergy(0.0);
42 for(
unsigned iTrack=0; iTrack <
nTracks(); ++iTrack) {
45 return expectedEnergy;
49 double expectedVariance(0.0);
50 for(
unsigned iTrack=0; iTrack <
nTracks(); ++iTrack) {
53 return expectedVariance;
57 double clusterEnergy(0.0);
58 for(
unsigned iCluster=0; iCluster <
nClusters(); ++iCluster) {
69 std::vector<eflowRecCluster*> matchedClusters;
70 matchedClusters.clear();
71 std::vector<eflowTrackClusterLink*>
links = thisEfRecTrack->getClusterMatches();
74 for (; itLink != endLink; ++itLink) {
75 matchedClusters.push_back((*itLink)->getCluster());
78 double trackEM1eta = thisEfRecTrack->getTrackCaloPoints().getEM1eta();
80 if(trackEM1eta<-998.) trackEM1eta = thisEfRecTrack->getTrackCaloPoints().getEM2eta();
82 if(trackEM1eta<-998.) trackEM1eta = thisEfRecTrack->getTrackCaloPoints().getFCAL0eta();
84 double trackE = thisEfRecTrack->getTrack()->e();
86 if (!binnedParameters->
binExists(trackE, trackEM1eta)) {
87 thisEfRecTrack->setHasBin(
false);
96 thisEfRecTrack->setLayerHED(j1st);
100 cellSubtractionManager.
getOrdering(binnedParameters, trackE, trackEM1eta, j1st,useLegacyEnergyBinIndexing);
103 const double expectedEnergy = energyP ? energyP->
nnEnergyPrediction(thisEfRecTrack) : cellSubtractionManager.
fudgeMean() * thisEfRecTrack->getTrack()->e();
104 const double expectedEnergySigma = fabs(cellSubtractionManager.
fudgeStdDev() * thisEfRecTrack->getTrack()->e());
106 const std::vector<eflowTrackClusterLink*>* bestClusters_015 = thisEfRecTrack->getAlternativeClusterMatches(
"cone_015");
107 const std::vector<eflowTrackClusterLink*>* bestClusters_02 = thisEfRecTrack->getAlternativeClusterMatches(
"cone_02");
110 float totalE_015 = 0.0;
113 if (bestClusters_015){
116 if (thisBestCluster){
119 if (theCluster->
e()>0.0){
120 totalE_015 += theCluster->
e();
127 double pull_015 = NAN;
128 if (expectedEnergySigma > 1
e-6 ) pull_015 = (totalE_015-expectedEnergy)/expectedEnergySigma;
129 thisEfRecTrack->setpull15(pull_015);
131 double trackPt = thisEfRecTrack->getTrack()->pt();
133 if (!std::isnan(pull_015)){
139 if (pull_015 > 0.0 + (log10(40000)-log10(
trackPt))*33.2 && 0.0 != expectedEnergySigma && bestClusters_015 && bestClusters_02){
140 thisEfRecTrack->setSubtracted();
141 thisEfRecTrack->setIsInDenseEnvironment();
144 std::vector<eflowRecCluster*> theBestEfRecClusters_02;
145 for (
eflowTrackClusterLink* thisLink : *bestClusters_02)
if (thisLink->getCluster()->getCluster()->e() > 0.0) theBestEfRecClusters_02.push_back(thisLink->getCluster());
146 integrator->
measureNewClus(theBestEfRecClusters_02, thisEfRecTrack);
148 cellSubtractionManager.
getOrdering(binnedParameters, trackE, trackEM1eta, j1st,useLegacyEnergyBinIndexing);
149 thisEfRecTrack->setEExpect(cellSubtractionManager.
fudgeMean() * trackE, fabs(cellSubtractionManager.
fudgeStdDev()*trackE)*fabs(cellSubtractionManager.
fudgeStdDev()*trackE));
152 thisEfRecTrack->setEExpect(expectedEnergy, expectedEnergySigma*expectedEnergySigma);