Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:14:18

0001 #include "Geometry/CaloTopology/interface/EcalBarrelTopology.h"
0002 
0003 EBDetId EcalBarrelTopology::incrementIeta(const EBDetId& id) const {
0004   if (!(theGeom_->present(id)))
0005     return EBDetId(0);
0006 
0007   EBDetId nextPoint;
0008   if (id.ieta() == -1) {
0009     if (EBDetId::validDetId(1, id.iphi()))
0010       nextPoint = EBDetId(1, id.iphi());
0011     else
0012       return EBDetId(0);
0013   } else {
0014     if (EBDetId::validDetId(id.ieta() + 1, id.iphi()))
0015       nextPoint = EBDetId(id.ieta() + 1, id.iphi());
0016     else
0017       return EBDetId(0);
0018   }
0019   if (theGeom_->present(nextPoint))
0020     return nextPoint;
0021   else
0022     return EBDetId(0);
0023 }
0024 
0025 EBDetId EcalBarrelTopology::decrementIeta(const EBDetId& id) const {
0026   if (!(theGeom_->present(id)))
0027     return EBDetId(0);
0028 
0029   EBDetId nextPoint;
0030   if (id.ieta() == 1) {
0031     if (EBDetId::validDetId(-1, id.iphi()))
0032       nextPoint = EBDetId(-1, id.iphi());
0033     else
0034       return EBDetId(0);
0035   } else {
0036     if (EBDetId::validDetId(id.ieta() - 1, id.iphi()))
0037       nextPoint = EBDetId(id.ieta() - 1, id.iphi());
0038     else
0039       return EBDetId(0);
0040   }
0041 
0042   if (theGeom_->present(nextPoint))
0043     return nextPoint;
0044   else
0045     return EBDetId(0);
0046 }
0047 
0048 EBDetId EcalBarrelTopology::incrementIphi(const EBDetId& id) const {
0049   if (!(theGeom_->present(id)))
0050     return EBDetId(0);
0051 
0052   EBDetId nextPoint;
0053 
0054   if (id.iphi() == EBDetId::MAX_IPHI) {
0055     if (EBDetId::validDetId(id.ieta(), EBDetId::MIN_IPHI))
0056       nextPoint = EBDetId(id.ieta(), EBDetId::MIN_IPHI);
0057     else
0058       return EBDetId(0);
0059   } else {
0060     if (EBDetId::validDetId(id.ieta(), id.iphi() + 1))
0061       nextPoint = EBDetId(id.ieta(), id.iphi() + 1);
0062     else
0063       return EBDetId(0);
0064   }
0065 
0066   if (theGeom_->present(nextPoint))
0067     return nextPoint;
0068   else
0069     return EBDetId(0);
0070 }
0071 
0072 EBDetId EcalBarrelTopology::decrementIphi(const EBDetId& id) const {
0073   if (!(theGeom_->present(id)))
0074     return EBDetId(0);
0075 
0076   EBDetId nextPoint;
0077 
0078   if (id.iphi() == EBDetId::MIN_IPHI) {
0079     if (EBDetId::validDetId(id.ieta(), EBDetId::MAX_IPHI))
0080       nextPoint = EBDetId(id.ieta(), EBDetId::MAX_IPHI);
0081     else
0082       return EBDetId(0);
0083   } else {
0084     if (EBDetId::validDetId(id.ieta(), id.iphi() - 1))
0085       nextPoint = EBDetId(id.ieta(), id.iphi() - 1);
0086     else
0087       return EBDetId(0);
0088   }
0089 
0090   if (theGeom_->present(nextPoint))
0091     return nextPoint;
0092   else
0093     return EBDetId(0);
0094 }