518 std::vector<DetId> gapDetIds;
520 double gapEnergy = 0;
522 bool nextToBorder =
false;
525 gapEnergy +=
hit->energy();
526 EcalDetId hitdetid = (EcalDetId)
hit->
id();
527 gapDetIds.push_back(hitdetid);
530 double eta = cellGeom->getPosition().eta();
531 gapET +=
hit->energy() / cosh(
eta);
534 edm::LogInfo(
"EcalBoundaryInfoCalculator") <<
"Find Border RecHits...";
538 <<
"Starting at : (" << ((
EBDetId)hitdetid).ieta() <<
"," << ((
EBDetId)hitdetid).iphi() <<
")";
541 <<
"Starting at : (" << ((
EEDetId)hitdetid).ix() <<
"," << ((
EEDetId)hitdetid).iy() <<
")";
548 bool reverseOrientation =
false;
551 EcalDetId
start = hitdetid;
552 EcalDetId current =
start;
555 bool startAlgo =
false;
559 theEcalNav->setHome(
start);
561 if (
next == EcalDetId(0)) {
566 currDirection =
turnLeft(currDirection, reverseOrientation);
569 throw cms::Exception(
"NoStartingDirection") <<
"EcalBoundaryInfoCalculator: No starting direction can be found: " 570 "This should never happen if RecHit is at border!";
576 currDirection =
turnLeft(currDirection, reverseOrientation);
579 bool endIsFound =
false;
580 bool startIsEnd =
false;
582 while (!endIsFound) {
583 bool nextStepFound =
false;
586 while (!nextStepFound) {
588 theEcalNav->setHome(current);
591 status = (chit != ecalStatus.
end()) ? chit->getStatusCode() & 0x1F : -1;
596 }
else if (
next == EcalDetId(0)) {
598 currDirection =
turnLeft(currDirection, reverseOrientation);
601 nextStepFound =
true;
610 <<
"EcalBoundaryInfoCalculator: No valid next direction can be found: This should never happen!";
622 edm::LogInfo(
"EcalBoundaryInfoCalculator") <<
"Path along gap reached starting position!";
627 <<
"Next step: " << (EcalDetId)
next <<
" Status: " <<
status <<
" Start: " << (EcalDetId)
start;
629 edm::LogInfo(
"EcalBoundaryInfoCalculator") <<
"End of gap cluster is found going left";
634 gapDetIds.push_back(
next);
638 gapEnergy += nexthit.
energy();
640 eta = cellGeom->getPosition().eta();
646 currDirection =
turnRight(currDirection, reverseOrientation);
650 theEcalNav->setHome(
start);
653 currDirection = startDirection;
654 currDirection =
turnRight(currDirection, reverseOrientation);
660 while (!endIsFound) {
661 bool nextStepFound =
false;
664 while (!nextStepFound) {
666 theEcalNav->setHome(current);
669 status = (chit != ecalStatus.
end()) ? chit->getStatusCode() & 0x1F : -1;
674 }
else if (
next == EcalDetId(0)) {
676 currDirection =
turnRight(currDirection, reverseOrientation);
679 nextStepFound =
true;
688 <<
"EcalBoundaryInfoCalculator: No valid next direction can be found: This should never happen!";
698 <<
"Next step: " << (EcalDetId)
next <<
" Status: " <<
status <<
" Start: " << (EcalDetId)
start;
700 edm::LogInfo(
"EcalBoundaryInfoCalculator") <<
"End of gap cluster is found going right";
705 gapDetIds.push_back(
next);
709 gapEnergy += nexthit.
energy();
711 eta = cellGeom->getPosition().eta();
717 currDirection =
turnLeft(currDirection, reverseOrientation);
722 edm::LogInfo(
"EcalBoundaryInfoCalculator") <<
"<<<<<<<<<<<<<<< Final Gap object <<<<<<<<<<<<<<<";
724 edm::LogInfo(
"EcalBoundaryInfoCalculator") <<
"No of DetIds along gap: " << gapDetIds.size();
725 edm::LogInfo(
"EcalBoundaryInfoCalculator") <<
"Gap energy: " << gapEnergy;
726 edm::LogInfo(
"EcalBoundaryInfoCalculator") <<
"Gap ET: " << gapET;
730 gapInfo.
subdet = hitdetid.subdet();
731 gapInfo.
detIds = gapDetIds;
736 std::vector<int> stati;
CdOrientation turnRight(CdOrientation currDirection, bool reverseOrientation) const
BoundaryInformation gapRecHits(const EcalRecHitCollection &, const EcalRecHit *, const CaloTopology &theCaloTopology, const EcalChannelStatus &ecalStatus, const CaloGeometry &geometry) const
const_iterator find(uint32_t rawId) const
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
const_iterator end() const
Log< level::Info, false > LogInfo
EcalDetId makeStepInDirection(CdOrientation direction, const CaloNavigator< EcalDetId > *theNavi) const
std::vector< Item >::const_iterator const_iterator
std::unique_ptr< CaloNavigator< EcalDetId > > initializeEcalNavigator(DetId startE, const CaloTopology &theCaloTopology, EcalSubdetector ecalSubDet) const
CdOrientation turnLeft(CdOrientation currDirection, bool reverseOrientation) const
iterator find(key_type k)
const_iterator end() const