342 std::vector<DetId> boundaryDetIds;
343 std::vector<int> stati;
345 double boundaryEnergy = 0;
346 double boundaryET = 0;
347 int beCellCounter = 0;
348 bool nextToBorder =
false;
350 boundaryRecHits.push_back(*hit);
352 boundaryEnergy += hit->
energy();
353 EcalDetId hitdetid = (EcalDetId) hit->
id();
354 boundaryDetIds.push_back(hitdetid);
358 boundaryET += hit->
energy() / cosh(eta);
361 std::cout <<
"Find Boundary RecHits..." << std::endl;
376 bool reverseOrientation =
false;
379 EcalDetId
start = hitdetid;
381 int current_status = 0;
384 bool startAlgo =
false;
391 int status = (chit != ecalStatus->end()) ? chit->getStatusCode() & 0x1F : -1;
393 stati.push_back(status);
397 currDirection =
turnLeft(currDirection, reverseOrientation);
401 cout <<
"No starting direction can be found: This should never happen if RecHit has a dead neighbour!" << endl;
408 currDirection =
turnRight(currDirection, reverseOrientation);
411 bool nextIsStart =
false;
412 bool atBorder =
false;
414 while (!nextIsStart) {
416 bool nextStepFound =
false;
419 while (!nextStepFound) {
424 status = (chit != ecalStatus->end()) ? chit->getStatusCode() & 0x1F : -1;
427 bool present =
false;
428 for (vector<int>::const_iterator
s = stati.begin();
s != stati.end(); ++
s) {
435 stati.push_back(status);
438 nextStepFound =
true;
440 currDirection =
turnRight(currDirection, reverseOrientation);
442 }
else if (
next == EcalDetId(0)) {
444 currDirection =
turnLeft(currDirection, reverseOrientation);
446 }
else if (status == 0) {
447 nextStepFound =
true;
451 cout <<
"No valid next direction can be found: This should never happen!" << endl;
463 cout <<
"Boundary path reached starting position!" << endl;
467 cout <<
"Next step: " << (EcalDetId)
next <<
" Status: " << status <<
" Start: " << (EcalDetId) start << endl;
470 if ((!atBorder || status == 0) && !nextIsStart) {
471 boundaryDetIds.push_back(
next);
472 if (RecHits->find(
next) != RecHits->end() && status == 0) {
475 boundaryRecHits.push_back(nexthit);
476 boundaryEnergy += nexthit.
energy();
479 boundaryET += nexthit.
energy() / cosh(eta);
483 if (current_status == 0 && status == 0 && atBorder) {
485 currDirection =
turnRight(currDirection, reverseOrientation);
488 if (status == 0 && atBorder) {
490 currDirection =
turnLeft(currDirection, reverseOrientation);
494 currDirection =
turnLeft(currDirection, reverseOrientation);
497 currDirection =
turnRight(currDirection, reverseOrientation);
508 cout <<
"<<<<<<<<<<<<<<< Final Boundary object <<<<<<<<<<<<<<<" << endl;
509 cout <<
"no of neighbouring RecHits: " << boundaryRecHits.size() << endl;
510 cout <<
"no of neighbouring DetIds: " << boundaryDetIds.size() << endl;
511 cout <<
"boundary energy: " << boundaryEnergy << endl;
512 cout <<
"boundary ET: " << boundaryET << endl;
513 cout <<
"no of cells contributing to boundary energy: " << beCellCounter << endl;
514 cout <<
"Channel stati: ";
515 for (vector<int>::iterator it = stati.begin(); it != stati.end(); ++it) {
522 boundInfo.
subdet = hitdetid.subdet();
523 boundInfo.
detIds = boundaryDetIds;
void setHome(const T &startingPoint)
set the starting position
CdOrientation turnRight(CdOrientation currDirection, bool reverseOrientation)
void home() const
move the navigator back to the starting point
BoundaryInformation boundaryRecHits(const edm::Handle< EcalRecHitCollection > &, const EcalRecHit *, const edm::ESHandle< CaloTopology > theCaloTopology, const edm::ESHandle< EcalChannelStatus > ecalStatus, const edm::ESHandle< CaloGeometry > geometry)
void initializeEcalNavigator(DetId startE, const edm::ESHandle< CaloTopology > theCaloTopology, EcalSubdetector ecalSubDet)
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
CaloNavigator< EcalDetId > * theEcalNav
CdOrientation turnLeft(CdOrientation currDirection, bool reverseOrientation)
EcalDetId makeStepInDirection(CdOrientation direction, CaloNavigator< EcalDetId > *theNavi)
DetId id() const
get the id
std::vector< Item >::const_iterator const_iterator
perl if(1 lt scalar(@::datatypes))