518 std::vector<DetId> gapDetIds;
520 double gapEnergy = 0;
522 int gapCellCounter = 0;
523 bool nextToBorder =
false;
527 gapEnergy +=
hit->energy();
528 EcalDetId hitdetid = (EcalDetId)
hit->
id();
529 gapDetIds.push_back(hitdetid);
532 double eta = cellGeom->getPosition().eta();
533 gapET +=
hit->energy() / cosh(
eta);
536 edm::LogInfo(
"EcalBoundaryInfoCalculator") <<
"Find Border RecHits...";
540 <<
"Starting at : (" << ((
EBDetId)hitdetid).ieta() <<
"," << ((
EBDetId)hitdetid).iphi() <<
")";
543 <<
"Starting at : (" << ((
EEDetId)hitdetid).ix() <<
"," << ((
EEDetId)hitdetid).iy() <<
")";
550 bool reverseOrientation =
false;
553 EcalDetId
start = hitdetid;
554 EcalDetId current =
start;
557 bool startAlgo =
false;
561 theEcalNav->setHome(
start);
563 if (
next == EcalDetId(0)) {
568 currDirection =
turnLeft(currDirection, reverseOrientation);
571 throw cms::Exception(
"NoStartingDirection") <<
"EcalBoundaryInfoCalculator: No starting direction can be found: " 572 "This should never happen if RecHit is at border!";
578 currDirection =
turnLeft(currDirection, reverseOrientation);
581 bool endIsFound =
false;
582 bool startIsEnd =
false;
584 while (!endIsFound) {
585 bool nextStepFound =
false;
588 while (!nextStepFound) {
590 theEcalNav->setHome(current);
593 status = (chit != ecalStatus.
end()) ? chit->getStatusCode() & 0x1F : -1;
598 }
else if (
next == EcalDetId(0)) {
600 currDirection =
turnLeft(currDirection, reverseOrientation);
603 nextStepFound =
true;
612 <<
"EcalBoundaryInfoCalculator: No valid next direction can be found: This should never happen!";
624 edm::LogInfo(
"EcalBoundaryInfoCalculator") <<
"Path along gap reached starting position!";
629 <<
"Next step: " << (EcalDetId)
next <<
" Status: " <<
status <<
" Start: " << (EcalDetId)
start;
631 edm::LogInfo(
"EcalBoundaryInfoCalculator") <<
"End of gap cluster is found going left";
636 gapDetIds.push_back(
next);
641 gapEnergy += nexthit.
energy();
643 eta = cellGeom->getPosition().eta();
649 currDirection =
turnRight(currDirection, reverseOrientation);
653 theEcalNav->setHome(
start);
656 currDirection = startDirection;
657 currDirection =
turnRight(currDirection, reverseOrientation);
663 while (!endIsFound) {
664 bool nextStepFound =
false;
667 while (!nextStepFound) {
669 theEcalNav->setHome(current);
672 status = (chit != ecalStatus.
end()) ? chit->getStatusCode() & 0x1F : -1;
677 }
else if (
next == EcalDetId(0)) {
679 currDirection =
turnRight(currDirection, reverseOrientation);
682 nextStepFound =
true;
691 <<
"EcalBoundaryInfoCalculator: No valid next direction can be found: This should never happen!";
701 <<
"Next step: " << (EcalDetId)
next <<
" Status: " <<
status <<
" Start: " << (EcalDetId)
start;
703 edm::LogInfo(
"EcalBoundaryInfoCalculator") <<
"End of gap cluster is found going right";
708 gapDetIds.push_back(
next);
713 gapEnergy += nexthit.
energy();
715 eta = cellGeom->getPosition().eta();
721 currDirection =
turnLeft(currDirection, reverseOrientation);
726 edm::LogInfo(
"EcalBoundaryInfoCalculator") <<
"<<<<<<<<<<<<<<< Final Gap object <<<<<<<<<<<<<<<";
728 edm::LogInfo(
"EcalBoundaryInfoCalculator") <<
"No of DetIds along gap: " << gapDetIds.size();
729 edm::LogInfo(
"EcalBoundaryInfoCalculator") <<
"Gap energy: " << gapEnergy;
730 edm::LogInfo(
"EcalBoundaryInfoCalculator") <<
"Gap ET: " << gapET;
734 gapInfo.
subdet = hitdetid.subdet();
735 gapInfo.
detIds = gapDetIds;
740 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