12 #include <vdt/vdtMath.h> 85 if(
nullptr != recHitsEB ) {
92 if(
nullptr != recHitsEE ) {
103 std::pair<double, double>
p;
116 const double raw_energy = sc.
rawEnergy();
119 std::vector<float> localCovariances = EcalClusterTools::localCovariances(seedCluster,recHits,topo) ;
122 std::array<float, 30> eval;
124 const float eLeft = EcalClusterTools::eLeft(seedCluster,recHits,topo);
125 const float eRight = EcalClusterTools::eRight(seedCluster,recHits,topo);
126 const float eTop = EcalClusterTools::eTop(seedCluster,recHits,topo);
127 const float eBottom = EcalClusterTools::eBottom(seedCluster,recHits,topo);
129 float sigmaIetaIeta =
sqrt(localCovariances[0]);
137 if( see_by_spp > 0 ) {
138 sigmaIetaIphi = localCovariances[1] / see_by_spp;
139 }
else if ( localCovariances[1] > 0 ) {
142 sigmaIetaIphi = -1.f;
146 std::vector<float> clusterRawEnergy;
147 clusterRawEnergy.resize(
std::max(3, numberOfClusters), 0);
148 std::vector<float> clusterDEtaToSeed;
149 clusterDEtaToSeed.resize(
std::max(3, numberOfClusters), 0);
150 std::vector<float> clusterDPhiToSeed;
151 clusterDPhiToSeed.resize(
std::max(3, numberOfClusters), 0);
152 float clusterMaxDR = 999.;
153 float clusterMaxDRDPhi = 999.;
154 float clusterMaxDRDEta = 999.;
155 float clusterMaxDRRawEnergy = 0.;
163 for(
auto clus = sc.
clustersBegin(); clus != clusend; ++clus ) {
166 if(theseed == pclus )
168 clusterRawEnergy[iclus] = pclus->
energy();
170 clusterDEtaToSeed[iclus] = pclus->
eta() - theseed->
eta();
176 clusterMaxDR =
maxDR;
177 clusterMaxDRDPhi = clusterDPhiToSeed[iclus];
178 clusterMaxDRDEta = clusterDEtaToSeed[iclus];
179 clusterMaxDRRawEnergy = clusterRawEnergy[iclus];
186 eval[1] = raw_energy;
189 eval[4] = EcalClusterTools::e3x3(seedCluster,recHits,topo)/raw_energy;
190 eval[5] = seedCluster.
energy()/raw_energy;
192 eval[7] = EcalClusterTools::e2nd(seedCluster,recHits)/raw_energy;
193 eval[8] = (eLeft + eRight != 0.f ? (eLeft-eRight)/(eLeft+eRight) : 0.f);
194 eval[9] = (eTop + eBottom != 0.f ? (eTop-eBottom)/(eTop+eBottom) : 0.f);
195 eval[10] = sigmaIetaIeta;
196 eval[11] = sigmaIetaIphi;
197 eval[12] = sigmaIphiIphi;
198 eval[13] =
std::max(0,numberOfClusters-1);
199 eval[14] = clusterMaxDR;
200 eval[15] = clusterMaxDRDPhi;
201 eval[16] = clusterMaxDRDEta;
202 eval[17] = clusterMaxDRRawEnergy/raw_energy;
203 eval[18] = clusterRawEnergy[0]/raw_energy;
204 eval[19] = clusterRawEnergy[1]/raw_energy;
205 eval[20] = clusterRawEnergy[2]/raw_energy;
206 eval[21] = clusterDPhiToSeed[0];
207 eval[22] = clusterDPhiToSeed[1];
208 eval[23] = clusterDPhiToSeed[2];
209 eval[24] = clusterDEtaToSeed[0];
210 eval[25] = clusterDEtaToSeed[1];
211 eval[26] = clusterDEtaToSeed[2];
214 eval[27] = ebseedid.
ieta();
215 eval[28] = ebseedid.iphi();
218 eval[27] = eeseedid.
ix();
219 eval[28] = eeseedid.iy();
223 eval[29] = seedCluster.
eta();
230 constexpr double meanoffset = meanlimlow + 0.5*(meanlimhigh-meanlimlow);
231 constexpr double meanscale = 0.5*(meanlimhigh-meanlimlow);
235 constexpr double sigmaoffset = sigmalimlow + 0.5*(sigmalimhigh-sigmalimlow);
236 constexpr double sigmascale = 0.5*(sigmalimhigh-sigmalimlow);
242 double rawmean = forestmean->
GetResponse(eval.data());
243 double rawsigma = forestsigma->
GetResponse(eval.data());
246 double mean = meanoffset + meanscale*vdt::fast_sin(rawmean);
247 double sigma = sigmaoffset + sigmascale*vdt::fast_sin(rawsigma);
249 double ecor = mean*(eval[1]);
250 const double sigmacor = sigma*ecor;
257 std::array<float, 7> eval;
258 float clusterMaxDR = 999.;
267 for(
auto clus = sc.
clustersBegin(); clus != clusend; ++clus ) {
270 if(theseed == pclus )
277 clusterMaxDR =
maxDR;
286 eval[3] = EcalClusterTools::e3x3(seedCluster,recHits,topo)/raw_energy;
287 eval[4] =
std::max(0,numberOfClusters-1);
288 eval[5] = clusterMaxDR;
289 eval[6] = raw_energy;
295 constexpr double meanoffset = meanlimlow + 0.5*(meanlimhigh-meanlimlow);
296 constexpr double meanscale = 0.5*(meanlimhigh-meanlimlow);
300 double rawmean = forestmean->
GetResponse(eval.data());
301 double mean = meanoffset + meanscale*vdt::fast_sin(rawmean);
303 double ecor = mean*eval[6];
318 if(cor.first<0)
return;
constexpr double deltaPhi(double phi1, double phi2)
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
double GetResponse(const float *vector) const
size_type size() const
Size of the RefVector.
double phiWidth() const
obtain phi and eta width of the Super Cluster
bool getByToken(EDGetToken token, Handle< PROD > &result) const
constexpr bool isNotFinite(T x)
void modifyObject(reco::SuperCluster &sc)
std::string regressionKeyEE_
const GBRForestD * forestee_
std::vector< EcalRecHit >::const_iterator const_iterator
void setEnergy(double energy)
std::vector< Vertex > VertexCollection
collection of Vertex objects
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
const GBRForestD * forestsigmaee_
SCEnergyCorrectorSemiParm()
const CaloClusterPtrVector & clusters() const
const access to the cluster list itself
edm::Handle< EcalRecHitCollection > rechitsEE_
double eta() const
pseudorapidity of cluster centroid
edm::EDGetTokenT< EcalRecHitCollection > tokenEERecHits_
const GBRForestD * forestsigmaeb_
edm::Handle< EcalRecHitCollection > rechitsEB_
edm::ESHandle< CaloTopology > calotopo_
void setCorrectedEnergy(double cenergy)
std::string regressionKeyEB_
const GBRForestD * foresteb_
std::string uncertaintyKeyEE_
void setEventSetup(const edm::EventSetup &es)
double energy() const
cluster energy
int ieta() const
get the crystal ieta
std::string uncertaintyKeyEB_
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
const_iterator end() const
double rawEnergy() const
raw uncorrected energy (sum of energies of component BasicClusters)
DetId seed() const
return DetId of seed
~SCEnergyCorrectorSemiParm()
edm::EDGetTokenT< EcalRecHitCollection > tokenEBRecHits_
void setEvent(const edm::Event &e)
bool applySigmaIetaIphiBug_
edm::Handle< reco::VertexCollection > vertices_
void setTokens(const edm::ParameterSet &iConfig, edm::ConsumesCollector &cc)
CaloCluster_iterator clustersBegin() const
fist iterator over BasicCluster constituents
edm::EDGetTokenT< reco::VertexCollection > tokenVertices_
const CaloClusterPtr & seed() const
seed BasicCluster
double preshowerEnergy() const
energy deposited in preshower
double phi() const
azimuthal angle of cluster centroid
void setCorrectedEnergyUncertainty(float energyerr)
T const * product() const
const_iterator begin() const
std::pair< double, double > getCorrections(const reco::SuperCluster &sc) const
edm::ESHandle< CaloGeometry > calogeom_
CaloCluster_iterator clustersEnd() const
last iterator over BasicCluster constituents
constexpr Detector det() const
get the detector field from this detid