10 #include <analysis/VariableManager/Manager.h>
13 #include <framework/core/Module.h>
14 #include <framework/datastore/StoreObjPtr.h>
15 #include <framework/datastore/StoreArray.h>
18 #include <ecl/geometry/ECLGeometryPar.h>
19 #include <framework/geometry/B2Vector3.h>
22 #include <mdst/dataobjects/ECLCluster.h>
23 #include <mdst/dataobjects/Track.h>
24 #include <mdst/dataobjects/MCParticle.h>
26 #include <analysis/dataobjects/Particle.h>
27 #include <ecl/dataobjects/ECLCalDigit.h>
28 #include <ecl/dataobjects/ECLShower.h>
29 #include <ecl/dataobjects/ECLCellIdMapping.h>
30 #include <tracking/dataobjects/ExtHit.h>
32 #include <ecl/dataobjects/ECLDsp.h>
33 #include <ecl/geometry/ECLGeometryPar.h>
43 namespace ECLCalDigitVariable {
50 twoComponentChi2 = 10,
51 twoComponentTotalEnergy = 11,
52 twoComponentHadronEnergy = 12,
53 twoComponentDiodeEnergy = 13,
54 twoComponentSavedChi2_PhotonHadron = 14,
55 twoComponentSavedChi2_PileUpPhoton = 15,
56 twoComponentSavedChi2_PhotonDiode = 16,
57 twoComponentFitType = 17,
81 int getCenterCell(
const Particle* particle)
84 const ECLCluster* cluster = particle->getECLCluster();
87 double maxEnergy = -1.;
89 auto clusterDigitRelations = cluster->getRelationsTo<ECLCalDigit>();
90 for (
unsigned int ir = 0; ir < clusterDigitRelations.size(); ++ir) {
91 const auto calDigit = clusterDigitRelations.object(ir);
93 if (calDigit->getEnergy() > maxEnergy) {
94 maxEnergy = calDigit->getEnergy();
95 maxCellId = calDigit->getCellId();
106 int getExtCell(
const Particle* particle)
108 Const::EDetector myDetID = Const::EDetector::ECL;
109 Const::ChargedStable hypothesis = Const::pion;
110 int pdgCode = abs(hypothesis.getPDGCode());
112 const Track* track = particle->getTrack();
114 for (
const auto& extHit : track->getRelationsTo<ExtHit>()) {
115 if (abs(extHit.getPdgCode()) != pdgCode)
continue;
116 if ((extHit.getDetectorID() != myDetID))
continue;
117 if (extHit.getStatus() != EXT_ENTER)
continue;
119 int copyid = extHit.getCopyID();
121 if (copyid == -1)
continue;
122 const int cellid = copyid + 1;
132 double getCellIdMagnitude(
int cellid)
136 return position.
Mag();
140 double getCalDigitExpertByEnergyRank(
const Particle* particle,
const std::vector<double>& vars)
143 if (vars.size() != 2) {
144 B2FATAL(
"Need exactly two parameters (energy rank, variable id).");
147 if (
int(std::lround(vars[0])) < 0) B2FATAL(
"Index cannot be negative.");
149 const unsigned int indexIn = int(std::lround(vars[0]));
151 const int varid = int(std::lround(vars[1]));
154 std::vector<std::tuple<double, unsigned int>> energyToSort;
156 const ECLCluster* cluster = particle->getECLCluster();
160 auto relatedDigits = cluster->getRelationsTo<ECLCalDigit>();
162 if (indexIn < relatedDigits.size()) {
164 for (
unsigned int iRel = 0; iRel < relatedDigits.size(); iRel++) {
166 const auto caldigit = relatedDigits.object(iRel);
168 energyToSort.emplace_back(caldigit->getEnergy(), iRel);
173 return std::numeric_limits<double>::quiet_NaN();
176 std::sort(energyToSort.begin(), energyToSort.end(), std::greater<>());
178 const auto [digitEnergy, caldigitIndex] = energyToSort[indexIn];
180 const auto caldigitSelected = relatedDigits.object(caldigitIndex);
183 StoreObjPtr<ECLCellIdMapping> mapping;
185 B2ERROR(
"Mapping not found, did you forget to run the eclFillCellIdMapping module?");
186 return std::numeric_limits<double>::quiet_NaN();
189 if (varid == varType::energy) {
190 return caldigitSelected->getEnergy();
191 }
else if (varid == varType::time) {
192 return caldigitSelected->getTime();
193 }
else if (varid == varType::twoComponentChi2) {
194 return caldigitSelected->getTwoComponentChi2();
195 }
else if (varid == varType::twoComponentTotalEnergy) {
196 return caldigitSelected->getTwoComponentTotalEnergy();
197 }
else if (varid == varType::twoComponentHadronEnergy) {
198 return caldigitSelected->getTwoComponentHadronEnergy();
199 }
else if (varid == varType::twoComponentSavedChi2_PhotonHadron) {
200 return caldigitSelected->getTwoComponentSavedChi2(ECLDsp::photonHadron);
201 }
else if (varid == varType::twoComponentSavedChi2_PileUpPhoton) {
202 return caldigitSelected->getTwoComponentSavedChi2(ECLDsp::photonHadronBackgroundPhoton);
203 }
else if (varid == varType::twoComponentSavedChi2_PhotonDiode) {
204 return caldigitSelected->getTwoComponentSavedChi2(ECLDsp::photonDiodeCrossing);
205 }
else if (varid == varType::twoComponentDiodeEnergy) {
206 return caldigitSelected->getTwoComponentDiodeEnergy();
207 }
else if (varid == varType::twoComponentFitType) {
208 return int(caldigitSelected->getTwoComponentFitType());
209 }
else if (varid == varType::cellId) {
210 return caldigitSelected->getCellId();
211 }
else if (varid == varType::weight) {
212 const auto weight = relatedDigits.weight(caldigitIndex);
214 }
else if (varid == varType::phi) {
215 return mapping->getCellIdToPhi(caldigitSelected->getCellId());
216 }
else if (varid == varType::theta) {
217 return mapping->getCellIdToTheta(caldigitSelected->getCellId());
218 }
else if (varid == varType::R_geom) {
219 return getCellIdMagnitude(caldigitSelected->getCellId());
221 B2FATAL(
"variable id not found.");
226 return std::numeric_limits<double>::quiet_NaN();
231 double getCalDigitExpert(
const Particle* particle,
const std::vector<double>& vars)
233 if (vars.size() != 4) {
234 B2FATAL(
"Need exactly four parameters (cellid, neighbour area size, variable id, and cluster center (0) or ext (1)).");
237 StoreObjPtr<ECLCellIdMapping> mapping;
238 const unsigned int posid = int(std::lround(vars[0]));
239 const int nneighbours = int(std::lround(vars[1]));
240 const int varid = int(std::lround(vars[2]));
241 const int extid = int(std::lround(vars[3]));
244 B2ERROR(
"Mapping not found, did you forget to run the eclFillCellIdMapping module?");
245 return std::numeric_limits<double>::quiet_NaN();
247 if (nneighbours != 5 and nneighbours != 7) {
248 B2FATAL(
"Please request 5 or 7 neighbour area.");
249 return std::numeric_limits<double>::quiet_NaN();
255 if (extid == centerType::extCell) {
256 maxCellId = getExtCell(particle);
258 maxCellId = getCenterCell(particle);
262 if (maxCellId < 0)
return std::numeric_limits<double>::quiet_NaN();
265 int neighbourid = -1;
266 std::vector<short int> neighbours;
268 if (nneighbours == 5) {
269 neighbours = mapping->getCellIdToNeighbour5(maxCellId);
270 }
else if (nneighbours == 7) {
271 neighbours = mapping->getCellIdToNeighbour7(maxCellId);
274 if (posid < neighbours.size()) {
275 neighbourid = neighbours[posid];
277 B2WARNING(
"This position id is not contained in the requested neighbours.");
278 return std::numeric_limits<double>::quiet_NaN();
282 if (varid == varType::phi) {
283 return mapping->getCellIdToPhi(neighbourid);
284 }
else if (varid == varType::theta) {
285 return mapping->getCellIdToTheta(neighbourid);
286 }
else if (varid == varType::R_geom) {
287 return getCellIdMagnitude(neighbourid);
288 }
else if (varid == varType::phiId) {
289 return mapping->getCellIdToPhiId(neighbourid);
290 }
else if (varid == varType::thetaId) {
291 return mapping->getCellIdToThetaId(neighbourid);
292 }
else if (varid == varType::cellId) {
297 const int storearraypos = mapping->getCellIdToStoreArray(neighbourid);
298 StoreArray<ECLCalDigit> eclCalDigits;
300 if (storearraypos >= 0) {
301 if (varid == varType::energy) {
302 return eclCalDigits[storearraypos]->getEnergy();
303 }
else if (varid == varType::time) {
304 return eclCalDigits[storearraypos]->getTime();
305 }
else if (varid == varType::timeResolution) {
306 return eclCalDigits[storearraypos]->getTimeResolution();
307 }
else if (varid == varType::twoComponentChi2) {
308 return eclCalDigits[storearraypos]->getTwoComponentChi2();
309 }
else if (varid == varType::twoComponentTotalEnergy) {
310 return eclCalDigits[storearraypos]->getTwoComponentTotalEnergy();
311 }
else if (varid == varType::twoComponentHadronEnergy) {
312 return eclCalDigits[storearraypos]->getTwoComponentHadronEnergy();
313 }
else if (varid == varType::twoComponentSavedChi2_PhotonHadron) {
314 return eclCalDigits[storearraypos]->getTwoComponentSavedChi2(ECLDsp::photonHadron);
315 }
else if (varid == varType::twoComponentSavedChi2_PileUpPhoton) {
316 return eclCalDigits[storearraypos]->getTwoComponentSavedChi2(ECLDsp::photonHadronBackgroundPhoton);
317 }
else if (varid == varType::twoComponentSavedChi2_PhotonDiode) {
318 return eclCalDigits[storearraypos]->getTwoComponentSavedChi2(ECLDsp::photonDiodeCrossing);
319 }
else if (varid == varType::twoComponentDiodeEnergy) {
320 return eclCalDigits[storearraypos]->getTwoComponentDiodeEnergy();
321 }
else if (varid == varType::twoComponentFitType) {
322 return int(eclCalDigits[storearraypos]->getTwoComponentFitType());
323 }
else if (varid == varType::mcenergy) {
325 auto digitMCRelations = eclCalDigits[storearraypos]->getRelationsTo<MCParticle>();
327 for (
unsigned int i = 0; i < digitMCRelations.size(); ++i) {
328 edep += digitMCRelations.weight(i);
331 }
else if (varid == varType::usedforenergy) {
332 const ECLCluster* cluster = particle->getECLCluster();
334 unsigned int cellid = eclCalDigits[storearraypos]->getCellId();
336 std::vector<unsigned int> listCellIds;
337 auto clusterShowerRelations = cluster->getRelationsWith<ECLShower>();
338 for (
unsigned int ir = 0; ir < clusterShowerRelations.size(); ++ir) {
339 const auto shower = clusterShowerRelations.object(ir);
340 listCellIds = shower->getListOfCrystalsForEnergy();
343 if (std::find(listCellIds.begin(), listCellIds.end(), cellid) != listCellIds.end()) {
349 return std::numeric_limits<double>::quiet_NaN();
353 return std::numeric_limits<double>::quiet_NaN();
357 return std::numeric_limits<double>::quiet_NaN();
360 double getExtCellExpert(
const Particle* particle,
int varid,
bool front)
362 ECL::ECLGeometryPar* geometry = ECL::ECLGeometryPar::Instance();
364 B2ERROR(
"Geometry not found!");
365 return std::numeric_limits<double>::quiet_NaN();
367 const Track* track = particle->getTrack();
369 ExtHit* edgeExtHit =
nullptr;
371 for (
const auto& extHit : track->getRelationsTo<ExtHit>()) {
372 if (extHit.getDetectorID() != Const::EDetector::ECL)
continue;
373 if (extHit.getStatus() != EXT_ENTER)
continue;
374 int crystalID = extHit.getCopyID() - 1;
375 if (crystalID == -1)
continue;
376 edgeExtHit =
new ExtHit(extHit);
380 auto extHits = track->getRelationsTo<ExtHit>();
381 for (
unsigned int iextHit(extHits.size() - 1); iextHit > 0; --iextHit) {
382 const auto extHit = extHits[iextHit];
383 if (extHit->getDetectorID() != Const::EDetector::ECL)
continue;
384 if (extHit->getStatus() != EXT_EXIT)
continue;
385 int crystalID = extHit->getCopyID() - 1;
386 if (crystalID == -1)
break;
387 edgeExtHit =
new ExtHit(*extHit);
392 if (!edgeExtHit)
return std::numeric_limits<double>::quiet_NaN();
393 const TVector3& extHitPosition = edgeExtHit->getPosition();
394 const TVector3& trackPointing = edgeExtHit->getMomentum();
396 geometry->Mapping(edgeExtHit->getCopyID() - 1);
397 const int thetaID = geometry->GetThetaID();
398 const int phiID = geometry->GetPhiID();
400 const TVector3& crystalCenterPosition = geometry->GetCrystalPos(geometry->GetCellID(thetaID, phiID));
401 const TVector3& crystalOrientation = geometry->GetCrystalVec(geometry->GetCellID(thetaID, phiID));
402 const TVector3& crystalPositionOnSurface = crystalCenterPosition - (crystalCenterPosition - extHitPosition).Dot(
403 crystalOrientation.Unit()) * crystalOrientation.Unit();
405 if (varid == varType::phiOffset) {
406 return extHitPosition.DeltaPhi(crystalPositionOnSurface);
407 }
else if (varid == varType::thetaOffset) {
408 return extHitPosition.Theta() - crystalPositionOnSurface.Theta();
409 }
else if (varid == varType::phiPointing) {
410 return trackPointing.DeltaPhi(crystalOrientation);
411 }
else if (varid == varType::thetaPointing) {
412 return trackPointing.Theta() - crystalOrientation.Theta();
416 return std::numeric_limits<double>::quiet_NaN();
423 double getECLCalDigitEnergyByEnergyRank(
const Particle* particle,
const std::vector<double>& vars)
425 if (vars.size() != 1) {
426 B2FATAL(
"Need exactly one parameters (energy index).");
428 std::vector<double> parameters {vars[0], ECLCalDigitVariable::varType::energy};
429 return ECLCalDigitVariable::getCalDigitExpertByEnergyRank(particle, parameters);
433 double getECLCalDigitTimeByEnergyRank(
const Particle* particle,
const std::vector<double>& vars)
435 if (vars.size() != 1) {
436 B2FATAL(
"Need exactly one parameters (energy index).");
438 std::vector<double> parameters {vars[0], ECLCalDigitVariable::varType::time};
439 return ECLCalDigitVariable::getCalDigitExpertByEnergyRank(particle, parameters);
443 double getCellIdByEnergyRank(
const Particle* particle,
const std::vector<double>& vars)
445 if (vars.size() != 1) {
446 B2FATAL(
"Need exactly one parameters (energy index).");
448 std::vector<double> parameters {vars[0], ECLCalDigitVariable::varType::cellId};
449 return ECLCalDigitVariable::getCalDigitExpertByEnergyRank(particle, parameters);
453 double getTwoComponentFitTypeByEnergyRank(
const Particle* particle,
const std::vector<double>& vars)
455 if (vars.size() != 1) {
456 B2FATAL(
"Need exactly one parameters (energy index).");
458 std::vector<double> parameters {vars[0], ECLCalDigitVariable::varType::twoComponentFitType};
459 return ECLCalDigitVariable::getCalDigitExpertByEnergyRank(particle, parameters);
463 double getTwoComponentChi2ByEnergyRank(
const Particle* particle,
const std::vector<double>& vars)
465 if (vars.size() != 1) {
466 B2FATAL(
"Need exactly one parameters (energy index).");
468 std::vector<double> parameters {vars[0], ECLCalDigitVariable::varType::twoComponentChi2};
469 return ECLCalDigitVariable::getCalDigitExpertByEnergyRank(particle, parameters);
473 double getTwoComponentTotalEnergyByEnergyRank(
const Particle* particle,
const std::vector<double>& vars)
475 if (vars.size() != 1) {
476 B2FATAL(
"Need exactly one parameters (energy index).");
478 std::vector<double> parameters {vars[0], ECLCalDigitVariable::varType::twoComponentTotalEnergy};
479 return ECLCalDigitVariable::getCalDigitExpertByEnergyRank(particle, parameters);
483 double getTwoComponentHadronEnergyByEnergyRank(
const Particle* particle,
const std::vector<double>& vars)
485 if (vars.size() != 1) {
486 B2FATAL(
"Need exactly one parameters (energy index).");
488 std::vector<double> parameters {vars[0], ECLCalDigitVariable::varType::twoComponentHadronEnergy};
489 return ECLCalDigitVariable::getCalDigitExpertByEnergyRank(particle, parameters);
493 double getTwoComponentDiodeEnergyByEnergyRank(
const Particle* particle,
const std::vector<double>& vars)
495 if (vars.size() != 1) {
496 B2FATAL(
"Need exactly one parameters (energy index).");
498 std::vector<double> parameters {vars[0], ECLCalDigitVariable::varType::twoComponentDiodeEnergy};
499 return ECLCalDigitVariable::getCalDigitExpertByEnergyRank(particle, parameters);
503 double getTwoComponentChi2SavedByEnergyRank_PhotonHadron(
const Particle* particle,
const std::vector<double>& vars)
505 if (vars.size() != 1) {
506 B2FATAL(
"Need exactly one parameters (energy index).");
508 std::vector<double> parameters {vars[0], ECLCalDigitVariable::varType::twoComponentSavedChi2_PhotonHadron};
509 return ECLCalDigitVariable::getCalDigitExpertByEnergyRank(particle, parameters);
513 double getTwoComponentChi2SavedByEnergyRank_PileUpPhoton(
const Particle* particle,
const std::vector<double>& vars)
515 if (vars.size() != 1) {
516 B2FATAL(
"Need exactly one parameters (energy index).");
518 std::vector<double> parameters {vars[0], ECLCalDigitVariable::varType::twoComponentSavedChi2_PileUpPhoton};
519 return ECLCalDigitVariable::getCalDigitExpertByEnergyRank(particle, parameters);
523 double getTwoComponentChi2SavedByEnergyRank_PhotonDiode(
const Particle* particle,
const std::vector<double>& vars)
525 if (vars.size() != 1) {
526 B2FATAL(
"Need exactly one parameters (energy index).");
528 std::vector<double> parameters {vars[0], ECLCalDigitVariable::varType::twoComponentSavedChi2_PhotonDiode};
529 return ECLCalDigitVariable::getCalDigitExpertByEnergyRank(particle, parameters);
533 double getWeightByEnergyRank(
const Particle* particle,
const std::vector<double>& vars)
535 if (vars.size() != 1) {
536 B2FATAL(
"Need exactly one parameters (energy index).");
538 std::vector<double> parameters {vars[0], ECLCalDigitVariable::varType::weight};
539 return ECLCalDigitVariable::getCalDigitExpertByEnergyRank(particle, parameters);
543 double getECLCalDigitEnergy(
const Particle* particle,
const std::vector<double>& vars)
545 if (vars.size() != 2) {
546 B2FATAL(
"Need exactly two parameters (cellid and neighbour area size).");
549 std::vector<double> parameters {vars[0], vars[1], ECLCalDigitVariable::varType::energy, ECLCalDigitVariable::centerType::maxCell};
550 return ECLCalDigitVariable::getCalDigitExpert(particle, parameters);
554 double getMCEnergy(
const Particle* particle,
const std::vector<double>& vars)
556 if (vars.size() != 2) {
557 B2FATAL(
"Need exactly two parameters (cellid and neighbour area size).");
560 std::vector<double> parameters {vars[0], vars[1], ECLCalDigitVariable::varType::mcenergy, ECLCalDigitVariable::centerType::maxCell};
561 return ECLCalDigitVariable::getCalDigitExpert(particle, parameters);
566 double getExtECLCalDigitEnergy(
const Particle* particle,
const std::vector<double>& vars)
568 if (vars.size() != 2) {
569 B2FATAL(
"Need exactly two parameters (cellid and neighbour area size).");
572 std::vector<double> parameters {vars[0], vars[1], ECLCalDigitVariable::varType::energy, ECLCalDigitVariable::centerType::extCell};
573 return ECLCalDigitVariable::getCalDigitExpert(particle, parameters);
578 double getECLCalDigitTime(
const Particle* particle,
const std::vector<double>& vars)
580 if (vars.size() != 2) {
581 B2FATAL(
"Need exactly two parameters (cellid and neighbour area size).");
584 std::vector<double> parameters {vars[0], vars[1], ECLCalDigitVariable::varType::time, ECLCalDigitVariable::centerType::maxCell};
585 return ECLCalDigitVariable::getCalDigitExpert(particle, parameters);
589 double getExtECLCalDigitTime(
const Particle* particle,
const std::vector<double>& vars)
591 if (vars.size() != 2) {
592 B2FATAL(
"Need exactly two parameters (cellid and neighbour area size).");
595 std::vector<double> parameters {vars[0], vars[1], ECLCalDigitVariable::varType::time, ECLCalDigitVariable::centerType::extCell};
596 return ECLCalDigitVariable::getCalDigitExpert(particle, parameters);
600 double getExtECLCalDigitTimeResolution(
const Particle* particle,
const std::vector<double>& vars)
602 if (vars.size() != 2) {
603 B2FATAL(
"Need exactly two parameters (cellid and neighbour area size).");
606 std::vector<double> parameters {vars[0], vars[1], ECLCalDigitVariable::varType::timeResolution, ECLCalDigitVariable::centerType::extCell};
607 return ECLCalDigitVariable::getCalDigitExpert(particle, parameters);
611 double getECLCalDigitTimeResolution(
const Particle* particle,
const std::vector<double>& vars)
613 if (vars.size() != 2) {
614 B2FATAL(
"Need exactly two parameters (cellid and neighbour area size).");
617 std::vector<double> parameters {vars[0], vars[1], ECLCalDigitVariable::varType::timeResolution, ECLCalDigitVariable::centerType::maxCell};
618 return ECLCalDigitVariable::getCalDigitExpert(particle, parameters);
622 double getTwoComponentChi2(
const Particle* particle,
const std::vector<double>& vars)
624 if (vars.size() != 2) {
625 B2FATAL(
"Need exactly two parameters (cellid and neighbour area size).");
628 std::vector<double> parameters {vars[0], vars[1], ECLCalDigitVariable::varType::twoComponentChi2, ECLCalDigitVariable::centerType::maxCell};
629 return ECLCalDigitVariable::getCalDigitExpert(particle, parameters);
633 double getExtECLCalDigitTwoComponentChi2(
const Particle* particle,
const std::vector<double>& vars)
635 if (vars.size() != 2) {
636 B2FATAL(
"Need exactly two parameters (cellid and neighbour area size).");
639 std::vector<double> parameters {vars[0], vars[1], ECLCalDigitVariable::varType::twoComponentChi2, ECLCalDigitVariable::centerType::extCell};
640 return ECLCalDigitVariable::getCalDigitExpert(particle, parameters);
644 double getTwoComponentTotalEnergy(
const Particle* particle,
const std::vector<double>& vars)
646 if (vars.size() != 2) {
647 B2FATAL(
"Need exactly two parameters (cellid and neighbour area size).");
650 std::vector<double> parameters {vars[0], vars[1], ECLCalDigitVariable::varType::twoComponentTotalEnergy, ECLCalDigitVariable::centerType::maxCell};
651 return ECLCalDigitVariable::getCalDigitExpert(particle, parameters);
655 double getExtECLCalDigitTwoComponentTotalEnergy(
const Particle* particle,
const std::vector<double>& vars)
657 if (vars.size() != 2) {
658 B2FATAL(
"Need exactly two parameters (cellid and neighbour area size).");
661 std::vector<double> parameters {vars[0], vars[1], ECLCalDigitVariable::varType::twoComponentTotalEnergy, ECLCalDigitVariable::centerType::extCell};
662 return ECLCalDigitVariable::getCalDigitExpert(particle, parameters);
666 double getTwoComponentHadronEnergy(
const Particle* particle,
const std::vector<double>& vars)
668 if (vars.size() != 2) {
669 B2FATAL(
"Need exactly two parameters (cellid and neighbour area size).");
672 std::vector<double> parameters {vars[0], vars[1], ECLCalDigitVariable::varType::twoComponentHadronEnergy, ECLCalDigitVariable::centerType::maxCell};
673 return ECLCalDigitVariable::getCalDigitExpert(particle, parameters);
677 double getUsedForClusterEnergy(
const Particle* particle,
const std::vector<double>& vars)
679 if (vars.size() != 2) {
680 B2FATAL(
"Need exactly two parameters (cellid and neighbour area size).");
683 std::vector<double> parameters {vars[0], vars[1], ECLCalDigitVariable::varType::usedforenergy, ECLCalDigitVariable::centerType::maxCell};
684 return ECLCalDigitVariable::getCalDigitExpert(particle, parameters);
688 double getExtECLCalDigitTwoComponentHadronEnergy(
const Particle* particle,
const std::vector<double>& vars)
690 if (vars.size() != 2) {
691 B2FATAL(
"Need exactly two parameters (cellid and neighbour area size).");
694 std::vector<double> parameters {vars[0], vars[1], ECLCalDigitVariable::varType::twoComponentHadronEnergy, ECLCalDigitVariable::centerType::extCell};
695 return ECLCalDigitVariable::getCalDigitExpert(particle, parameters);
699 double getECLCalDigitTwoComponentDiodeEnergy(
const Particle* particle,
const std::vector<double>& vars)
701 if (vars.size() != 2) {
702 B2FATAL(
"Need exactly two parameters (cellid and neighbour area size).");
705 std::vector<double> parameters {vars[0], vars[1], ECLCalDigitVariable::varType::twoComponentDiodeEnergy, ECLCalDigitVariable::centerType::maxCell};
706 return ECLCalDigitVariable::getCalDigitExpert(particle, parameters);
710 double getExtECLCalDigitTwoComponentDiodeEnergy(
const Particle* particle,
const std::vector<double>& vars)
712 if (vars.size() != 2) {
713 B2FATAL(
"Need exactly two parameters (cellid and neighbour area size).");
716 std::vector<double> parameters {vars[0], vars[1], ECLCalDigitVariable::varType::twoComponentDiodeEnergy, ECLCalDigitVariable::centerType::extCell};
717 return ECLCalDigitVariable::getCalDigitExpert(particle, parameters);
721 double getECLCalDigitTwoComponentFitType(
const Particle* particle,
const std::vector<double>& vars)
723 if (vars.size() != 2) {
724 B2FATAL(
"Need exactly two parameters (cellid and neighbour area size).");
727 std::vector<double> parameters {vars[0], vars[1], ECLCalDigitVariable::varType::twoComponentFitType, ECLCalDigitVariable::centerType::maxCell};
728 return ECLCalDigitVariable::getCalDigitExpert(particle, parameters);
732 double getExtECLCalDigitTwoComponentFitType(
const Particle* particle,
const std::vector<double>& vars)
734 if (vars.size() != 2) {
735 B2FATAL(
"Need exactly two parameters (cellid and neighbour area size).");
738 std::vector<double> parameters {vars[0], vars[1], ECLCalDigitVariable::varType::twoComponentFitType, ECLCalDigitVariable::centerType::extCell};
739 return ECLCalDigitVariable::getCalDigitExpert(particle, parameters);
743 double getECLCalDigitTwoComponentChi2Saved_PhotonHadron(
const Particle* particle,
const std::vector<double>& vars)
745 if (vars.size() != 2) {
746 B2FATAL(
"Need exactly two parameters (cellid and neighbour area size).");
749 std::vector<double> parameters {vars[0], vars[1], ECLCalDigitVariable::varType::twoComponentSavedChi2_PhotonHadron, ECLCalDigitVariable::centerType::maxCell};
750 return ECLCalDigitVariable::getCalDigitExpert(particle, parameters);
754 double getExtECLCalDigitTwoComponentChi2Saved_PhotonHadron(
const Particle* particle,
const std::vector<double>& vars)
756 if (vars.size() != 2) {
757 B2FATAL(
"Need exactly two parameters (cellid and neighbour area size).");
760 std::vector<double> parameters {vars[0], vars[1], ECLCalDigitVariable::varType::twoComponentSavedChi2_PhotonHadron, ECLCalDigitVariable::centerType::extCell};
761 return ECLCalDigitVariable::getCalDigitExpert(particle, parameters);
765 double getECLCalDigitTwoComponentChi2Saved_PileUpPhoton(
const Particle* particle,
const std::vector<double>& vars)
767 if (vars.size() != 2) {
768 B2FATAL(
"Need exactly two parameters (cellid and neighbour area size).");
771 std::vector<double> parameters {vars[0], vars[1], ECLCalDigitVariable::varType::twoComponentSavedChi2_PileUpPhoton, ECLCalDigitVariable::centerType::maxCell};
772 return ECLCalDigitVariable::getCalDigitExpert(particle, parameters);
776 double getExtECLCalDigitTwoComponentChi2Saved_PileUpPhoton(
const Particle* particle,
const std::vector<double>& vars)
778 if (vars.size() != 2) {
779 B2FATAL(
"Need exactly two parameters (cellid and neighbour area size).");
782 std::vector<double> parameters {vars[0], vars[1], ECLCalDigitVariable::varType::twoComponentSavedChi2_PileUpPhoton, ECLCalDigitVariable::centerType::extCell};
783 return ECLCalDigitVariable::getCalDigitExpert(particle, parameters);
787 double getECLCalDigitTwoComponentChi2Saved_PhotonDiode(
const Particle* particle,
const std::vector<double>& vars)
789 if (vars.size() != 2) {
790 B2FATAL(
"Need exactly two parameters (cellid and neighbour area size).");
793 std::vector<double> parameters {vars[0], vars[1], ECLCalDigitVariable::varType::twoComponentSavedChi2_PhotonDiode, ECLCalDigitVariable::centerType::maxCell};
794 return ECLCalDigitVariable::getCalDigitExpert(particle, parameters);
798 double getExtECLCalDigitTwoComponentChi2Saved_PhotonDiode(
const Particle* particle,
const std::vector<double>& vars)
800 if (vars.size() != 2) {
801 B2FATAL(
"Need exactly two parameters (cellid and neighbour area size).");
804 std::vector<double> parameters {vars[0], vars[1], ECLCalDigitVariable::varType::twoComponentSavedChi2_PhotonDiode, ECLCalDigitVariable::centerType::extCell};
805 return ECLCalDigitVariable::getCalDigitExpert(particle, parameters);
809 double getPhi(
const Particle* particle,
const std::vector<double>& vars)
811 if (vars.size() != 2) {
812 B2FATAL(
"Need exactly two parameters (cellid and neighbour area size).");
815 std::vector<double> parameters {vars[0], vars[1], ECLCalDigitVariable::varType::phi, ECLCalDigitVariable::centerType::maxCell};
816 return ECLCalDigitVariable::getCalDigitExpert(particle, parameters);
820 double getExtPhi(
const Particle* particle,
const std::vector<double>& vars)
822 if (vars.size() != 2) {
823 B2FATAL(
"Need exactly two parameters (cellid and neighbour area size).");
826 std::vector<double> parameters {vars[0], vars[1], ECLCalDigitVariable::varType::phi, ECLCalDigitVariable::centerType::extCell};
827 return ECLCalDigitVariable::getCalDigitExpert(particle, parameters);
831 double getTheta(
const Particle* particle,
const std::vector<double>& vars)
833 if (vars.size() != 2) {
834 B2FATAL(
"Need exactly two parameters (cellid and neighbour area size).");
837 std::vector<double> parameters {vars[0], vars[1], ECLCalDigitVariable::varType::theta, ECLCalDigitVariable::centerType::maxCell};
838 return ECLCalDigitVariable::getCalDigitExpert(particle, parameters);
842 double getExtTheta(
const Particle* particle,
const std::vector<double>& vars)
844 if (vars.size() != 2) {
845 B2FATAL(
"Need exactly two parameters (cellid and neighbour area size).");
848 std::vector<double> parameters {vars[0], vars[1], ECLCalDigitVariable::varType::theta, ECLCalDigitVariable::centerType::extCell};
849 return ECLCalDigitVariable::getCalDigitExpert(particle, parameters);
853 double getPhiId(
const Particle* particle,
const std::vector<double>& vars)
855 if (vars.size() != 2) {
856 B2FATAL(
"Need exactly two parameters (cellid and neighbour area size).");
859 std::vector<double> parameters {vars[0], vars[1], ECLCalDigitVariable::varType::phiId, ECLCalDigitVariable::centerType::maxCell};
860 return ECLCalDigitVariable::getCalDigitExpert(particle, parameters);
864 double getExtPhiId(
const Particle* particle,
const std::vector<double>& vars)
866 if (vars.size() != 2) {
867 B2FATAL(
"Need exactly two parameters (cellid and neighbour area size).");
870 std::vector<double> parameters {vars[0], vars[1], ECLCalDigitVariable::varType::phiId, ECLCalDigitVariable::centerType::extCell};
871 return ECLCalDigitVariable::getCalDigitExpert(particle, parameters);
875 double getThetaId(
const Particle* particle,
const std::vector<double>& vars)
877 if (vars.size() != 2) {
878 B2FATAL(
"Need exactly two parameters (cellid and neighbour area size).");
881 std::vector<double> parameters {vars[0], vars[1], ECLCalDigitVariable::varType::thetaId, ECLCalDigitVariable::centerType::maxCell};
882 return ECLCalDigitVariable::getCalDigitExpert(particle, parameters);
886 double getExtThetaId(
const Particle* particle,
const std::vector<double>& vars)
888 if (vars.size() != 2) {
889 B2FATAL(
"Need exactly two parameters (cellid and neighbour area size).");
892 std::vector<double> parameters {vars[0], vars[1], ECLCalDigitVariable::varType::thetaId, ECLCalDigitVariable::centerType::extCell};
893 return ECLCalDigitVariable::getCalDigitExpert(particle, parameters);
897 double getCellId(
const Particle* particle,
const std::vector<double>& vars)
899 if (vars.size() != 2) {
900 B2FATAL(
"Need exactly two parameters (cellid and neighbour area size).");
903 std::vector<double> parameters {vars[0], vars[1], ECLCalDigitVariable::varType::cellId, ECLCalDigitVariable::centerType::maxCell};
904 return ECLCalDigitVariable::getCalDigitExpert(particle, parameters);
908 double getCenterCellId(
const Particle* particle)
910 const int centercellid = ECLCalDigitVariable::getCenterCell(particle);
912 if (centercellid < 0)
return std::numeric_limits<double>::quiet_NaN();
917 double getCenterCellCrystalTheta(
const Particle* particle)
919 const int centercellid = ECLCalDigitVariable::getCenterCell(particle);
920 StoreObjPtr<ECLCellIdMapping> mapping;
923 B2ERROR(
"Mapping not found, did you forget to run the eclFillCellIdMapping module?");
924 return std::numeric_limits<double>::quiet_NaN();
927 if (centercellid < 0)
return std::numeric_limits<double>::quiet_NaN();
928 return mapping->getCellIdToTheta(centercellid);
932 double getCenterCellCrystalPhi(
const Particle* particle)
934 const int centercellid = ECLCalDigitVariable::getCenterCell(particle);
935 StoreObjPtr<ECLCellIdMapping> mapping;
938 B2ERROR(
"Mapping not found, did you forget to run the eclFillCellIdMapping module?");
939 return std::numeric_limits<double>::quiet_NaN();
942 if (centercellid < 0)
return std::numeric_limits<double>::quiet_NaN();
943 return mapping->getCellIdToPhi(centercellid);
947 double getExtCellId(
const Particle* particle)
949 const int extcellid = ECLCalDigitVariable::getExtCell(particle);
951 if (extcellid < 0)
return std::numeric_limits<double>::quiet_NaN();
956 double getCenterCellThetaId(
const Particle* particle)
958 const int centercellid = ECLCalDigitVariable::getCenterCell(particle);
959 StoreObjPtr<ECLCellIdMapping> mapping;
962 B2ERROR(
"Mapping not found, did you forget to run the eclFillCellIdMapping module?");
963 return std::numeric_limits<double>::quiet_NaN();
966 if (centercellid < 0)
return std::numeric_limits<double>::quiet_NaN();
967 return mapping->getCellIdToThetaId(centercellid);
971 double getCenterCellPhiId(
const Particle* particle)
973 const int centercellid = ECLCalDigitVariable::getCenterCell(particle);
974 StoreObjPtr<ECLCellIdMapping> mapping;
977 B2ERROR(
"Mapping not found, did you forget to run the eclFillCellIdMapping module?");
978 return std::numeric_limits<double>::quiet_NaN();
981 if (centercellid < 0)
return std::numeric_limits<double>::quiet_NaN();
982 return mapping->getCellIdToPhiId(centercellid);
986 double getExtCellThetaId(
const Particle* particle)
988 const int extcellid = ECLCalDigitVariable::getExtCell(particle);
989 StoreObjPtr<ECLCellIdMapping> mapping;
992 B2ERROR(
"Mapping not found, did you forget to run the eclFillCellIdMapping module?");
993 return std::numeric_limits<double>::quiet_NaN();
996 if (extcellid < 0)
return std::numeric_limits<double>::quiet_NaN();
997 return mapping->getCellIdToThetaId(extcellid);
1001 double getExtCellPhiId(
const Particle* particle)
1003 const int extcellid = ECLCalDigitVariable::getExtCell(particle);
1004 StoreObjPtr<ECLCellIdMapping> mapping;
1007 B2ERROR(
"Mapping not found, did you forget to run the eclFillCellIdMapping module?");
1008 return std::numeric_limits<double>::quiet_NaN();
1011 if (extcellid < 0)
return std::numeric_limits<double>::quiet_NaN();
1012 return mapping->getCellIdToPhiId(extcellid);
1016 double getExtCellCrystalTheta(
const Particle* particle)
1018 const int extcellid = ECLCalDigitVariable::getExtCell(particle);
1019 StoreObjPtr<ECLCellIdMapping> mapping;
1022 B2ERROR(
"Mapping not found, did you forget to run the eclFillCellIdMapping module?");
1023 return std::numeric_limits<double>::quiet_NaN();
1026 if (extcellid < 0)
return std::numeric_limits<double>::quiet_NaN();
1027 return mapping->getCellIdToTheta(extcellid);
1031 double getExtCellCrystalPhi(
const Particle* particle)
1033 const int extcellid = ECLCalDigitVariable::getExtCell(particle);
1034 StoreObjPtr<ECLCellIdMapping> mapping;
1037 B2ERROR(
"Mapping not found, did you forget to run the eclFillCellIdMapping module?");
1038 return std::numeric_limits<double>::quiet_NaN();
1041 if (extcellid < 0)
return std::numeric_limits<double>::quiet_NaN();
1042 return mapping->getCellIdToPhi(extcellid);
1046 double getCenterCellIndex(
const Particle* particle,
const std::vector<double>& vars)
1048 if (vars.size() != 1) {
1049 B2FATAL(
"Need exactly one parameters (neighbour area size).");
1052 StoreObjPtr<ECLCellIdMapping> mapping;
1053 const int nneighbours = int(std::lround(vars[0]));
1056 B2ERROR(
"Mapping not found, did you forget to run the eclFillCellIdMapping module?");
1057 return std::numeric_limits<double>::quiet_NaN();
1059 if (nneighbours != 5 and nneighbours != 7) {
1060 B2FATAL(
"Please request 5 or 7 neighbour area.");
1061 return std::numeric_limits<double>::quiet_NaN();
1064 const int centercellid = ECLCalDigitVariable::getCenterCell(particle);
1065 if (centercellid < 0)
return std::numeric_limits<double>::quiet_NaN();
1067 std::vector<short int> neighbours;
1069 if (nneighbours == 5) {
1070 neighbours = mapping->getCellIdToNeighbour5(centercellid);
1071 }
else if (nneighbours == 7) {
1072 neighbours = mapping->getCellIdToNeighbour7(centercellid);
1075 for (
unsigned int idx = 0; idx < neighbours.size(); idx++) {
1076 if (neighbours[idx] == centercellid)
return idx;
1079 return std::numeric_limits<double>::quiet_NaN();
1084 double getExtCenterCellIndex(
const Particle* particle,
const std::vector<double>& vars)
1086 if (vars.size() != 1) {
1087 B2FATAL(
"Need exactly one parameters (neighbour area size).");
1090 StoreObjPtr<ECLCellIdMapping> mapping;
1091 const int nneighbours = int(std::lround(vars[0]));
1094 B2ERROR(
"Mapping not found, did you forget to run the eclFillCellIdMapping module?");
1095 return std::numeric_limits<double>::quiet_NaN();
1097 if (nneighbours != 5 and nneighbours != 7) {
1098 B2FATAL(
"Please request 5 or 7 neighbour area.");
1099 return std::numeric_limits<double>::quiet_NaN();
1102 const int centercellid = ECLCalDigitVariable::getExtCell(particle);
1103 if (centercellid < 0)
return std::numeric_limits<double>::quiet_NaN();
1105 std::vector<short int> neighbours;
1107 if (nneighbours == 5) {
1108 neighbours = mapping->getCellIdToNeighbour5(centercellid);
1109 }
else if (nneighbours == 7) {
1110 neighbours = mapping->getCellIdToNeighbour7(centercellid);
1113 for (
unsigned int idx = 0; idx < neighbours.size(); idx++) {
1114 if (neighbours[idx] == centercellid)
return idx;
1117 return std::numeric_limits<double>::quiet_NaN();
1120 double getTotalECLCalDigitMCEnergy(
const Particle* particle)
1122 const MCParticle* mcparticle = particle->getRelatedTo<MCParticle>();
1123 if (mcparticle ==
nullptr)
1124 return std::numeric_limits<double>::quiet_NaN();
1127 auto mcDigitRelations = mcparticle->getRelationsWith<ECLCalDigit>();
1128 for (
unsigned int ir = 0; ir < mcDigitRelations.size(); ++ir) {
1129 sum += mcDigitRelations.weight(ir);
1136 double getClusterECLCalDigitMCEnergy(
const Particle* particle)
1139 const MCParticle* mcparticle = particle->getRelatedTo<MCParticle>();
1140 if (mcparticle ==
nullptr)
1141 return std::numeric_limits<double>::quiet_NaN();
1143 const ECLCluster* cluster = particle->getECLCluster();
1145 std::vector<unsigned int> listCellIds;
1146 auto clusterShowerRelations = cluster->getRelationsWith<ECLShower>();
1147 for (
unsigned int ir = 0; ir < clusterShowerRelations.size(); ++ir) {
1148 const auto shower = clusterShowerRelations.object(ir);
1149 listCellIds = shower->getListOfCrystalsForEnergy();
1153 auto clusterDigitRelations = mcparticle->getRelationsWith<ECLCalDigit>();
1154 for (
unsigned int ir = 0; ir < clusterDigitRelations.size(); ++ir) {
1157 unsigned int cellid = clusterDigitRelations.object(ir)->getCellId();
1158 if (std::find(listCellIds.begin(), listCellIds.end(), cellid) != listCellIds.end()) {
1159 sum += clusterDigitRelations.weight(ir);
1166 return std::numeric_limits<float>::quiet_NaN();
1170 double getExtFrontPositionPhiOffset(
const Particle* particle)
1172 return ECLCalDigitVariable::getExtCellExpert(particle, ECLCalDigitVariable::varType::phiOffset,
true);
1175 double getExtFrontPositionThetaOffset(
const Particle* particle)
1177 return ECLCalDigitVariable::getExtCellExpert(particle, ECLCalDigitVariable::varType::thetaOffset,
true);
1180 double getExtFrontPositionPhiPointing(
const Particle* particle)
1182 return ECLCalDigitVariable::getExtCellExpert(particle, ECLCalDigitVariable::varType::phiPointing,
true);
1185 double getExtFrontPositionThetaPointing(
const Particle* particle)
1187 return ECLCalDigitVariable::getExtCellExpert(particle, ECLCalDigitVariable::varType::thetaPointing,
true);
1190 double getExtBackPositionPhiOffset(
const Particle* particle)
1192 return ECLCalDigitVariable::getExtCellExpert(particle, ECLCalDigitVariable::varType::phiOffset,
false);
1195 double getExtBackPositionThetaOffset(
const Particle* particle)
1197 return ECLCalDigitVariable::getExtCellExpert(particle, ECLCalDigitVariable::varType::thetaOffset,
false);
1200 double getExtBackPositionPhiPointing(
const Particle* particle)
1202 return ECLCalDigitVariable::getExtCellExpert(particle, ECLCalDigitVariable::varType::phiPointing,
false);
1205 double getExtBackPositionThetaPointing(
const Particle* particle)
1207 return ECLCalDigitVariable::getExtCellExpert(particle, ECLCalDigitVariable::varType::thetaPointing,
false);
1211 double getPhiByEnergyRank(
const Particle* particle,
const std::vector<double>& vars)
1213 if (vars.size() != 1) {
1214 B2FATAL(
"Need exactly one parameters (energy index).");
1216 std::vector<double> parameters {vars[0], ECLCalDigitVariable::varType::phi};
1217 return ECLCalDigitVariable::getCalDigitExpertByEnergyRank(particle, parameters);
1221 double getThetaByEnergyRank(
const Particle* particle,
const std::vector<double>& vars)
1223 if (vars.size() != 1) {
1224 B2FATAL(
"Need exactly one parameters (energy index).");
1226 std::vector<double> parameters {vars[0], ECLCalDigitVariable::varType::theta};
1227 return ECLCalDigitVariable::getCalDigitExpertByEnergyRank(particle, parameters);
1231 double getR(
const Particle* particle,
const std::vector<double>& vars)
1233 if (vars.size() != 2) {
1234 B2FATAL(
"Need exactly two parameters (cellid and neighbour area size).");
1237 std::vector<double> parameters {vars[0], vars[1], ECLCalDigitVariable::varType::R_geom, ECLCalDigitVariable::centerType::maxCell};
1238 return ECLCalDigitVariable::getCalDigitExpert(particle, parameters);
1242 double getRByEnergyRank(
const Particle* particle,
const std::vector<double>& vars)
1244 if (vars.size() != 1) {
1245 B2FATAL(
"Need exactly one parameters (energy index).");
1247 std::vector<double> parameters {vars[0], ECLCalDigitVariable::varType::R_geom};
1248 return ECLCalDigitVariable::getCalDigitExpertByEnergyRank(particle, parameters);
1251 double getClusterNHitsThreshold(
const Particle* particle,
const std::vector<double>& vars)
1253 if (vars.size() != 1) {
1254 B2FATAL(
"Need exactly one parameter (energy threshold in GeV).");
1256 const double threshold = vars[0];
1258 const ECLCluster* cluster = particle->getECLCluster();
1262 auto clusterDigitRelations = cluster->getRelationsTo<ECLCalDigit>();
1263 for (
unsigned int ir = 0; ir < clusterDigitRelations.size(); ++ir) {
1264 const auto calDigit = clusterDigitRelations.object(ir);
1265 const auto weight = clusterDigitRelations.weight(ir);
1268 if (calDigit->getEnergy() > threshold) {
1275 return std::numeric_limits<float>::quiet_NaN();
1279 VARIABLE_GROUP(
"ECL Calibration (cDST)");
1280 REGISTER_VARIABLE(
"eclcaldigitEnergy(i, j)", getECLCalDigitEnergy,
1281 "[calibration] Returns the energy of the i-th caldigit for 5x5 (j=5) or 7x7 (j=7) neighbours");
1282 REGISTER_VARIABLE(
"eclcaldigitTime(i, j)", getECLCalDigitTime,
1283 "[calibration] Returns the time of the i-th caldigit for 5x5 (j=5) or 7x7 (j=7) neighbours");
1284 REGISTER_VARIABLE(
"eclcaldigitTimeResolution(i, j)", getECLCalDigitTimeResolution,
1285 "[calibration] Returns the time resolution (dt99) of the i-th caldigit for 5x5 (j=5) or 7x7 (j=7) neighbours");
1286 REGISTER_VARIABLE(
"eclcaldigitTwoComponentChi2(i, j)", getTwoComponentChi2,
1287 "[calibration] Returns the two component fit chi2 of the i-th caldigit for 5x5 (j=5) or 7x7 (j=7) neighbours");
1288 REGISTER_VARIABLE(
"eclcaldigitTwoComponentTotalEnergy(i, j)", getTwoComponentTotalEnergy,
1289 "[calibration] Returns the two component total energy of the i-th caldigit for 5x5 (j=5) or 7x7 (j=7) neighbours");
1290 REGISTER_VARIABLE(
"eclcaldigitTwoComponentHadronEnergy(i, j)", getTwoComponentHadronEnergy,
1291 "[calibration] Returns the two component hadron energy of the i-th caldigit for 5x5 (j=5) or 7x7 (j=7) neighbours");
1292 REGISTER_VARIABLE(
"eclcaldigitPhi(i, j)", getPhi,
1293 "[calibration] Returns phi of the i-th caldigit for 5x5 (j=5) or 7x7 (j=7) neighbours");
1294 REGISTER_VARIABLE(
"eclcaldigitTheta(i, j)", getTheta,
1295 "[calibration] Returns theta of the i-th caldigit for 5x5 (j=5) or 7x7 (j=7) neighbours");
1296 REGISTER_VARIABLE(
"eclcaldigitR(i, j)", getR,
1297 "Returns R (from a geometry object) of the i-th caldigit for 5x5 (j=5) or 7x7 (j=7) neighbours");
1298 REGISTER_VARIABLE(
"eclcaldigitPhiId(i, j)", getPhiId,
1299 "[calibration] Returns the phi Id of the i-th caldigit for 5x5 (j=5) or 7x7 (j=7) neighbours");
1300 REGISTER_VARIABLE(
"eclcaldigitThetaId(i, j)", getThetaId,
1301 "[calibration] Returns the theta Id of the i-th caldigit for 5x5 (j=5) or 7x7 (j=7) neighbours");
1302 REGISTER_VARIABLE(
"eclcaldigitCellId(i, j)", getCellId,
1303 "[calibration] Returns the cell id of the i-th caldigit for 5x5 (j=5) or 7x7 (j=7) neighbours (1-based)");
1304 REGISTER_VARIABLE(
"eclcaldigitUsedForClusterEnergy(i, j)", getUsedForClusterEnergy,
1305 " [calibration] Returns the 0 (not used) 1 (used) of the i-th caldigit for 5x5 (j=5) or 7x7 (j=7) neighbours (1-based)");
1307 REGISTER_VARIABLE(
"eclcaldigitCenterCellId", getCenterCellId,
"[calibration] Returns the center cell id");
1308 REGISTER_VARIABLE(
"eclcaldigitCenterCellThetaId", getCenterCellThetaId,
"[calibration] Returns the center cell theta id");
1309 REGISTER_VARIABLE(
"eclcaldigitCenterCellPhiId", getCenterCellPhiId,
"[calibration] Returns the center cell phi id");
1310 REGISTER_VARIABLE(
"eclcaldigitCenterCellCrystalTheta", getCenterCellCrystalTheta,
1311 "[calibration] Returns the center cell crystal theta");
1312 REGISTER_VARIABLE(
"eclcaldigitCenterCellCrystalPhi", getCenterCellCrystalPhi,
1313 "[calibration] Returns the center cell crystal phi");
1314 REGISTER_VARIABLE(
"eclcaldigitCenterCellIndex(i)", getCenterCellIndex,
1315 "[calibration] Returns the center cell index (within its 5x5 (i=5) or 7x7 (i=7) neighbours)");
1316 REGISTER_VARIABLE(
"eclcaldigitMCEnergy(i, j)", getMCEnergy,
1317 "[calibration] Returns the true deposited energy of all particles of the i-th caldigit for 5x5 (j=5) or 7x7 (j=7) neighbours (1-based)");
1318 REGISTER_VARIABLE(
"clusterNHitsThreshold(i)", getClusterNHitsThreshold,
1319 "[calibration] Returns sum of crystal weights sum(w_i) with w_i<=1 associated to this cluster above threshold (in GeV)");
1321 VARIABLE_GROUP(
"ECL Calibration (based on extrapolated tracks) (cDST)");
1322 REGISTER_VARIABLE(
"eclcaldigitExtEnergy(i, j)", getExtECLCalDigitEnergy,
1323 "[calibration] Returns the energy of the i-th caldigit for 5x5 (j=5) or 7x7 (j=7) neighbours for an ext track");
1324 REGISTER_VARIABLE(
"eclcaldigitExtTime(i, j)", getExtECLCalDigitTime,
1325 "[calibration] Returns the time of the i-th caldigit for 5x5 (j=5) or 7x7 (j=7) neighbours for an ext track");
1326 REGISTER_VARIABLE(
"eclcaldigitExtTimeResolution(i, j)", getExtECLCalDigitTimeResolution,
1327 "[calibration] Returns the time resolution (dt99) of the i-th caldigit for 5x5 (j=5) or 7x7 (j=7) neighbours for an ext track");
1328 REGISTER_VARIABLE(
"eclcaldigitExtTwoComponentTotalEnergy(i, j)", getExtECLCalDigitTwoComponentTotalEnergy,
1329 "[calibration] Returns the TwoComponentTotalEnergy of the i-th caldigit for 5x5 (j=5) or 7x7 (j=7) neighbours for an ext track");
1330 REGISTER_VARIABLE(
"eclcaldigitExtTwoComponentHadronEnergy(i, j)", getExtECLCalDigitTwoComponentHadronEnergy,
1331 "[calibration] Returns the TwoComponentHadronEnergy of the i-th caldigit for 5x5 (j=5) or 7x7 (j=7) neighbours for an ext track");
1332 REGISTER_VARIABLE(
"eclcaldigitExtTwoComponentChi2(i, j)", getExtECLCalDigitTwoComponentChi2,
1333 "[calibration] Returns the TwoComponentchi2 of the i-th caldigit for 5x5 (j=5) or 7x7 (j=7) neighbours for an ext track");
1334 REGISTER_VARIABLE(
"eclcaldigitExtPhi(i, j)", getExtPhi,
1335 "[calibration] Returns phi of the i-th caldigit for 5x5 (j=5) or 7x7 (j=7) neighbours for an extrapolated track");
1336 REGISTER_VARIABLE(
"eclcaldigitExtTheta(i, j)", getExtTheta,
1337 "[calibration] Returns theta of the i-th caldigit for 5x5 (j=5) or 7x7 (j=7) neighbours for an extrapolated track");
1338 REGISTER_VARIABLE(
"eclcaldigitExtPhiId(i, j)", getExtPhiId,
1339 "[calibration] Returns the phi Id of the i-th caldigit for 5x5 (j=5) or 7x7 (j=7) neighbours for an extrapolated track");
1340 REGISTER_VARIABLE(
"eclcaldigitExtThetaId(i, j)", getExtThetaId,
1341 "[calibration] Returns the theta Id of the i-th caldigit for 5x5 (j=5) or 7x7 (j=7) neighbours for an extrapolated track");
1342 REGISTER_VARIABLE(
"eclcaldigitExtCellId", getExtCellId,
"[calibration] Returns the extrapolated cell id");
1343 REGISTER_VARIABLE(
"eclcaldigitExtCellThetaId", getExtCellThetaId,
"[calibration] Returns the ext cell theta id");
1344 REGISTER_VARIABLE(
"eclcaldigitExtCellPhiId", getExtCellPhiId,
"[calibration] Returns the ext cell phi id");
1345 REGISTER_VARIABLE(
"eclcaldigitExtCellCrystalTheta", getExtCellCrystalTheta,
"[calibration] Returns the ext cell crystal theta");
1346 REGISTER_VARIABLE(
"eclcaldigitExtCellCrystalPhi", getExtCellCrystalPhi,
"[calibration] Returns the ext cell crystal phi");
1347 REGISTER_VARIABLE(
"eclcaldigitExtCenterCellIndex(i)", getExtCenterCellIndex,
1348 "[calibration] Returns the center cell index (within its 5x5 (i=5) or 7x7 (i=7) neighbours) for an ext track");
1350 REGISTER_VARIABLE(
"eclcaldigitExtFrontPositionPhiOffset", getExtFrontPositionPhiOffset,
1351 "[calibration] Returns the difference in the azimuthal angle (in radians)"
1352 "between the position where the track hit the front face of the ECL and the"
1353 "center of the struck crystal projected onto the front surface.");
1354 REGISTER_VARIABLE(
"eclcaldigitExtFrontPositionThetaOffset", getExtFrontPositionThetaOffset,
1355 "[calibration] Returns the difference in the polar angle (in radians)"
1356 "between the position where the track hit the front face of the ECL and the"
1357 "center of the struck crystal projected onto the front surface.");
1358 REGISTER_VARIABLE(
"eclcaldigitExtFrontPositionPhiPointing", getExtFrontPositionPhiPointing,
1359 "[calibration] Returns the difference in the azimuthal angle (in radians)"
1360 "between the momentum direction when the track hit the front face of the ECL and the"
1361 "orientation of the struck crystal.");
1362 REGISTER_VARIABLE(
"eclcaldigitExtFrontPositionThetaPointing", getExtFrontPositionThetaPointing,
1363 "[calibration] Returns the difference in the polar angle (in radians)"
1364 "between the momentum direction when the track hit the front face of the ECL and the"
1365 "orientation of the struck crystal.");
1367 REGISTER_VARIABLE(
"eclcaldigitExtTwoComponentFitType(i, j)", getExtECLCalDigitTwoComponentFitType,
1368 "[calibration] Returns the TwoComponentFitType of the i-th caldigit for 5x5 (j=5) or 7x7 (j=7) neighbours for an ext track");
1369 REGISTER_VARIABLE(
"eclcaldigitExtTwoComponentDiodeEnergy(i, j)", getExtECLCalDigitTwoComponentDiodeEnergy,
1370 "[calibration] Returns the TwoComponentDiodeEnergy of the i-th caldigit for 5x5 (j=5) or 7x7 (j=7) neighbours for an ext track");
1371 REGISTER_VARIABLE(
"eclcaldigitExtTwoComponentChi2Saved_PhotonHadron(i, j)", getExtECLCalDigitTwoComponentChi2Saved_PhotonHadron,
1372 "[calibration] Returns the TwoComponentChi2Saved_PhotonHadron of the i-th caldigit for 5x5 (j=5) or 7x7 (j=7) neighbours for an ext track");
1373 REGISTER_VARIABLE(
"eclcaldigitExtTwoComponentChi2Saved_PileUpPhoton(i, j)", getExtECLCalDigitTwoComponentChi2Saved_PileUpPhoton,
1374 "[calibration] Returns the TwoComponentChi2Saved_PileUpPhoton of the i-th caldigit for 5x5 (j=5) or 7x7 (j=7) neighbours for an ext track");
1375 REGISTER_VARIABLE(
"eclcaldigitExtTwoComponentChi2Saved_PhotonDiode(i, j)", getExtECLCalDigitTwoComponentChi2Saved_PhotonDiode,
1376 "[calibration] Returns the TwoComponentChi2Saved_PhotonDiode of the i-th caldigit for 5x5 (j=5) or 7x7 (j=7) neighbours for an ext track");
1378 REGISTER_VARIABLE(
"eclcaldigitTwoComponentFitType(i, j)", getECLCalDigitTwoComponentFitType,
1379 "[calibration] Returns the TwoComponentFitType of the i-th caldigit for 5x5 (j=5) or 7x7 (j=7) neighbours");
1380 REGISTER_VARIABLE(
"eclcaldigitTwoComponentDiodeEnergy(i, j)", getECLCalDigitTwoComponentDiodeEnergy,
1381 "[calibration] Returns the TwoComponentDiodeEnergy of the i-th caldigit for 5x5 (j=5) or 7x7 (j=7) neighbours");
1382 REGISTER_VARIABLE(
"eclcaldigitTwoComponentChi2Saved_PhotonHadron(i, j)", getECLCalDigitTwoComponentChi2Saved_PhotonHadron,
1383 "[calibration] Returns the TwoComponentChi2Saved_PhotonHadron of the i-th caldigit for 5x5 (j=5) or 7x7 (j=7) neighbours");
1384 REGISTER_VARIABLE(
"eclcaldigitTwoComponentChi2Saved_PileUpPhoton(i, j)", getECLCalDigitTwoComponentChi2Saved_PileUpPhoton,
1385 "[calibration] Returns the TwoComponentChi2Saved_PileUpPhoton of the i-th caldigit for 5x5 (j=5) or 7x7 (j=7) neighbours");
1386 REGISTER_VARIABLE(
"eclcaldigitTwoComponentChi2Saved_PhotonDiode(i, j)", getECLCalDigitTwoComponentChi2Saved_PhotonDiode,
1387 "[calibration] Returns the TwoComponentChi2Saved_PhotonDiode of the i-th caldigit for 5x5 (j=5) or 7x7 (j=7) neighbours");
1389 REGISTER_VARIABLE(
"eclcaldigitEnergyByEnergyRank(i)", getECLCalDigitEnergyByEnergyRank,
1390 "[calibration] Returns the caldigit energy of the i-th highest energy caldigit in the cluster (i>=0)");
1392 REGISTER_VARIABLE(
"eclcaldigitTimeByEnergyRank(i)", getECLCalDigitTimeByEnergyRank,
1393 "[calibration] Returns the caldigit time of the i-th highest energy caldigit in the cluster (i>=0)");
1395 REGISTER_VARIABLE(
"eclcaldigitTwoComponentFitTypeByEnergyRank(i)", getTwoComponentFitTypeByEnergyRank,
1396 "[calibration] Returns the offline fit type of the i-th highest energy caldigit in the cluster (i>=0)");
1398 REGISTER_VARIABLE(
"eclcaldigitTwoComponentChi2ByEnergyRank(i)", getTwoComponentChi2ByEnergyRank,
1399 "[calibration] Returns the two component chi2 of the i-th highest energy caldigit in the cluster (i>=0)");
1401 REGISTER_VARIABLE(
"eclcaldigitTwoComponentEnergyByEnergyRank(i)", getTwoComponentTotalEnergyByEnergyRank,
1402 "[calibration] Returns the two component total energy of the i-th highest energy caldigit in the cluster (i>=0)");
1404 REGISTER_VARIABLE(
"eclcaldigitTwoComponentHadronEnergyByEnergyRank(i)", getTwoComponentHadronEnergyByEnergyRank,
1405 "[calibration] Returns the two component fit Hadron Energy of the i-th highest energy caldigit in the cluster (i>=0)");
1407 REGISTER_VARIABLE(
"eclcaldigitTwoComponentDiodeEnergyByEnergyRank(i)", getTwoComponentDiodeEnergyByEnergyRank,
1408 "[calibration] Returns the two component fit Diode Energy of the i-th highest energy caldigit in the cluster (i>=0)");
1410 REGISTER_VARIABLE(
"eclcaldigitTwoComponentChi2SavedByEnergyRank_PhotonHadron(i)", getTwoComponentChi2SavedByEnergyRank_PhotonHadron,
1411 "[calibration] Returns the chi2 for the photo+hadron fit type of the i-th highest energy caldigit in the cluster (i>=0)");
1413 REGISTER_VARIABLE(
"eclcaldigitTwoComponentChi2SavedByEnergyRank_PileUpPhoton(i)", getTwoComponentChi2SavedByEnergyRank_PileUpPhoton,
1414 "[calibration] Returns the chi2 for the photo+hadron+pile-up photon fit type of the i-th highest energy caldigit in the cluster (i>=0)");
1416 REGISTER_VARIABLE(
"eclcaldigitTwoComponentChi2SavedByEnergyRank_PhotonDiode(i)", getTwoComponentChi2SavedByEnergyRank_PhotonDiode,
1417 "[calibration] Returns the chi2 for the photo+diode fit type of the i-th highest energy caldigit in the cluster (i>=0)");
1419 REGISTER_VARIABLE(
"eclcaldigitWeightByEnergyRank(i)", getWeightByEnergyRank,
1420 "[calibration] Returns the weight of the i-th highest energy caldigit in the cluster (i>=0)");
1422 REGISTER_VARIABLE(
"eclcaldigitCellIdByEnergyRank(i)", getCellIdByEnergyRank,
1423 "[calibration] Returns the cell id of the i-th highest energy caldigit in the cluster (i>=0)");
1425 REGISTER_VARIABLE(
"totalECLCalDigitMCEnergy", getTotalECLCalDigitMCEnergy,
1426 "[calibration] Returns total deposited MC energy in all ECLCalDigits for the MC particle");
1428 REGISTER_VARIABLE(
"clusterECLCalDigitMCEnergy", getClusterECLCalDigitMCEnergy,
1429 "[calibration] Returns total deposited MC energy in all ECLCalDigits for the MC particle that are used to calculate the cluster energy");
1431 REGISTER_VARIABLE(
"eclcaldigitPhiByEnergyRank(i)", getPhiByEnergyRank,
1432 "Returns phi of the i-th highest energy caldigit in the cluster (i>=0)");
1434 REGISTER_VARIABLE(
"eclcaldigitThetaByEnergyRank(i)", getThetaByEnergyRank,
1435 "Returns theta of the i-th highest energy caldigit in the cluster (i>=0)");
1437 REGISTER_VARIABLE(
"eclcaldigitRByEnergyRank(i)", getRByEnergyRank,
1438 "Returns R of the i-th highest energy caldigit in the cluster (i>=0)");
DataType Mag() const
The magnitude (rho in spherical coordinate system).
The Class for ECL Geometry Parameters.
static ECLGeometryPar * Instance()
Static method to get a reference to the ECLGeometryPar instance.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.