00001 #include "RecoParticleFlow/PFClusterTools/interface/DetectorElement.h" 00002 #include "RecoParticleFlow/PFClusterTools/interface/PFToolsException.h" 00003 #include <ostream> 00004 using namespace pftools; 00005 //A comment 00006 DetectorElement::DetectorElement(DetectorElementType type, double calib) : 00007 myType(type), myCalib(calib) { 00008 00009 } 00010 00011 void DetectorElement::setCalibCore(double calib) throw(PFToolsException&){ 00012 //I'll tolerate very small negative numbers (artefacts of the minimisation algo 00013 //but otherwise this shouldn't be allowed. 00014 // if(calib > -0.01) { 00015 myCalib = calib; 00016 // } 00017 // else { 00018 // MinimiserException me("Setting calibration <= 0!"); 00019 // throw me; 00020 // } 00021 } 00022 00023 double DetectorElement::getCalibCore() const { 00024 if(myType == OFFSET && myCalib == 1) { 00025 return 1.0; 00026 } 00027 return myCalib; 00028 } 00029 00030 double DetectorElement::getCalibCore(double eta, double phi) const { 00031 return getCalib(); 00032 } 00033 00034 DetectorElement::~DetectorElement() { 00035 } 00036 00037 00038 std::ostream& pftools::operator<<(std::ostream& s, const DetectorElement& de) { 00039 s << "DetectorElement: " << pftools::DetElNames[de.getType()] << ", \tcalib: " << de.getCalib(); 00040 00041 return s; 00042 } 00043