40 double energyEta = 0.;
41 double energyPhi = 0.;
44 double energyNegPhi = 0.;
45 double energyNegPhiConv = 0.;
46 double energyPosPhi = 0.;
57 double seedEnergy = 0.;
58 double seedPhi = 999.;
59 double seedEta = 999.;
64 float etaL1 = rtrigEmCluster.
eta();
65 float phiL1 = rtrigEmCluster.
phi();
68 const LArCell* seedCell =
nullptr;
69 const LArCell* hotCell =
nullptr;
71 if (larcell->energy() > seedEnergy) {
72 float deta = std::abs(etaL1 - larcell->eta());
74 float dphi = std::abs(phiL1 - larcell->phi());
75 dphi = std::abs(
M_PI - dphi);
76 dphi = std::abs(
M_PI - dphi);
78 seedEnergy = larcell->energy();
85 if (seedCell !=
nullptr) {
86 seedEta = seedCell->
eta();
87 seedPhi = seedCell->
phi();
89 caloDDE = (seedCell->
caloDDE());
91 hotEta = hotCell->
eta();
92 hotPhi = hotCell->
phi();
95 return StatusCode::SUCCESS;
98 std::map<const LArCell*, float>
windows;
100 float deta = std::abs(seedEta - larcell->eta());
101 if (deta < 0.025 + 0.002) {
103 float dphi = std::abs(seedPhi - larcell->phi());
104 dphi = std::abs(
M_PI - dphi);
105 dphi = std::abs(
M_PI - dphi);
106 if (dphi < 0.025 + 0.002) {
114 double etaCell = larcell->eta();
115 double phiCell = larcell->phi();
116 double energyCell = larcell->et();
119 float deta = std::abs(etaCell - seedEta);
120 if (deta > 0.05 + 0.002)
continue;
122 float deta1 = std::abs(etaCell -
cell->eta());
123 float dphi = std::abs(phiCell -
cell->phi());
124 if (dphi >
M_PI) dphi = 2. *
M_PI - dphi;
145 if (deta1 <= 0.5 *
double(nCellsEta - 1) * cellSizeEta + 0.01 &&
146 dphi <= 0.5 *
double(nCellsPhi - 1) * cellSizePhi + 0.01) {
160 if (seedCell !=
nullptr) {
161 seedEta = seedCell->
eta();
162 seedPhi = seedCell->
phi();
164 caloDDE = (seedCell->
caloDDE());
167 return StatusCode::SUCCESS;
170 bool cluster_in_barrel =
true;
175 double energy37Lay2 = 0.;
176 double energy37Lay2NegPhi = 0.;
177 double energy37Lay2PosPhi = 0.;
178 double energy77Lay2 = 0.;
179 double energy35Lay2 = 0.;
180 double energy33Lay2 = 0.;
181 double weightEta = 0.;
182 double weightEta2 = 0.;
183 double clusterWidth35 = 0.;
189 double totalEnergy = 0;
193 double etaCell = larcell->eta();
194 double phiCell = larcell->phi();
195 double energyCell = larcell->energy();
198 deta = std::abs(etaCell - seedEta);
199 dphi = std::abs(phiCell - seedPhi);
200 if (dphi >
M_PI) dphi = 2. *
M_PI - dphi;
202 double detaH = std::abs(etaCell - hotEta);
203 double dphiH = std::abs(phiCell - hotPhi);
204 if (dphiH >
M_PI) dphiH = 2. *
M_PI - dphiH;
226 if (detaH <= 0.5 *
double(nCellsEta - 1) * cellSizeEta + 0.01 &&
227 dphiH <= 0.5 *
double(nCellsPhi - 1) * cellSizePhi + 0.01) {
231 if (detaH <= 0.5 *
double(nCellsEta - 1) * cellSizeEta + 0.01 &&
232 dphiH <= 0.5 *
double(nCellsPhi - 1) * cellSizePhi + 0.01) {
233 energy37Lay2 += energyCell;
235 energy77Lay2 += energyCell;
241 if (deta <= 0.5 *
double(nCellsEta - 1) * cellSizeEta + 0.005 &&
242 dphi <= 0.5 *
double(nCellsPhi - 1) * cellSizePhi + 0.005) {
246 if (deta <= 0.5 *
double(nCellsEta - 1) * cellSizeEta + 0.002 &&
247 dphi <= 0.5 *
double(nCellsPhi - 1) * cellSizePhi + 0.002) {
248 energyEta += energyCell * etaCell;
251 if (cluster_in_barrel) {
252 samp = larcell->caloDDE()->getSampling();
256 energyPosPhi +=
double(energyCell) * phiCell;
257 energy37Lay2PosPhi += energyCell;
260 energyNegPhi +=
double(energyCell) * phiCell;
261 energyNegPhiConv +=
double(energyCell) * (phiCell + 2.0 *
M_PI);
262 energy37Lay2NegPhi += energyCell;
267 if (deta <= 0.5 *
double(nCellsEta - 1) * cellSizeEta + 0.01 &&
268 dphi <= 0.5 *
double(nCellsPhi - 1) * cellSizePhi + 0.01) {
269 weightEta += energyCell * etaCell;
270 weightEta2 += energyCell * etaCell * etaCell;
271 energy35Lay2 += energyCell;
275 if (deta <= 0.5 *
double(nCellsEta - 1) * cellSizeEta + 0.01 &&
276 dphi <= 0.5 *
double(nCellsPhi - 1) * cellSizePhi + 0.01) {
277 energy33Lay2 += energyCell;
285 if ((!cluster_in_barrel) && deta <= 0.5 *
double(nCellsEta - 1) * cellSizeEta + 0.005 &&
286 dphi <= 0.5 *
double(nCellsPhi - 1) * cellSizePhi + 0.005) {
287 samp = larcell->caloDDE()->getSampling();
295 if ((energy37Lay2PosPhi + energy37Lay2NegPhi) > 0.) {
297 double AvgNegPhi = 0.;
298 double AvgPosPhi = 0.;
300 energyEta /= (energy37Lay2PosPhi + energy37Lay2NegPhi);
302 if (energy37Lay2NegPhi > 0.) {
303 AvgNegPhi = energyNegPhi / energy37Lay2NegPhi;
309 if (energy37Lay2PosPhi > 0.) {
310 AvgPosPhi = energyPosPhi / energy37Lay2PosPhi;
316 if (AvgPosPhi == -999.0) {
317 if (AvgNegPhi != -999.0) {
318 energyPhi = AvgNegPhi;
322 if (AvgNegPhi == -999.0) {
323 if (AvgPosPhi != -999.0) {
324 energyPhi = AvgPosPhi;
328 if (AvgNegPhi != -999.0 && AvgPosPhi != -999.0) {
329 if ((AvgNegPhi > (-
M_PI / 2.0)) && (AvgPosPhi < (
M_PI / 2.0))) {
330 energyPhi = (energyNegPhi + energyPosPhi) / (energy37Lay2NegPhi + energy37Lay2PosPhi);
333 if ((AvgNegPhi < (-
M_PI / 2.0)) && (AvgPosPhi > (
M_PI / 2.0))) {
334 energyPhi = (energyNegPhiConv + energyPosPhi) / (energy37Lay2NegPhi + energy37Lay2PosPhi);
335 if (energyPhi >
M_PI) {
336 energyPhi = energyPhi - 2 *
M_PI;
348 double etaCell = larcell->eta();
349 double phiCell = larcell->phi();
350 double energyCell = larcell->energy();
353 deta = std::abs(etaCell - energyEta);
354 dphi = std::abs(phiCell - energyPhi);
355 if (dphi >
M_PI) dphi = 2. *
M_PI - dphi;
370 if ((deta <= 0.5 *
double(nCellsEta - 1) * cellSizeEta + 0.01) &&
371 (dphi <= 0.5 *
double(nCellsPhi - 1) * cellSizePhi + 0.01)) {
373 if (cluster_in_barrel) {
374 totalEnergy += energyCell;
376 samp = larcell->caloDDE()->getSampling();
377 rtrigEmCluster.
setEnergy(samp, rtrigEmCluster.
energy(samp) + energyCell);
384 if ((!cluster_in_barrel) && (deta <= 0.5 *
double(nCellsEta - 1) * cellSizeEta + 0.01) &&
385 (dphi <= 0.5 *
double(nCellsPhi - 1) * cellSizePhi + 0.01)) {
386 totalEnergy += energyCell;
388 samp = larcell->caloDDE()->getSampling();
389 rtrigEmCluster.
setEnergy(samp, rtrigEmCluster.
energy(samp) + energyCell);
397 if (energy35Lay2 > 0.) {
398 const double inv_energy35Lay2 = 1. / energy35Lay2;
399 clusterWidth35 = (weightEta2 * inv_energy35Lay2) -
400 (weightEta * inv_energy35Lay2) * (weightEta * inv_energy35Lay2);
401 clusterWidth35 > 0. ? clusterWidth35 = sqrt(clusterWidth35) : clusterWidth35 = 99.;
404 clusterWidth35 = 99.;
410 rtrigEmCluster.
setE233(energy33Lay2);
411 rtrigEmCluster.
setE237(energy37Lay2);
412 rtrigEmCluster.
setE277(energy77Lay2);
413 rtrigEmCluster.
setWeta2(clusterWidth35);
415 rtrigEmCluster.
setEta(energyEta);
416 rtrigEmCluster.
setPhi(energyPhi);
421 return StatusCode::SUCCESS;