Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include "Validation/EventGenerator/interface/CaloCellId.h"
00012
00013 #include "CLHEP/Units/defs.h"
00014 #include "CLHEP/Units/PhysicalConstants.h"
00015 #include "CLHEP/Units/SystemOfUnits.h"
00016
00017 #include <iostream>
00018 #include <iomanip>
00019 #include <cmath>
00020
00021 CaloCellId::CaloCellId( double theEtaMin, double theEtaMax, double thePhiMin, double thePhiMax, System theSubSys ):
00022 etaMin(theEtaMin),etaMax(theEtaMax),phiMin(thePhiMin),phiMax(thePhiMax),subSys(theSubSys)
00023 {}
00024
00025 CaloCellId::CaloCellId( const CaloCellId& id):
00026 etaMin(id.etaMin),etaMax(id.etaMax),phiMin(id.phiMin),phiMax(id.phiMax),subSys(id.subSys)
00027 {}
00028
00029 CaloCellId::~CaloCellId() {}
00030
00031 bool CaloCellId::operator==(const CaloCellId& id) const {
00032
00033 return (etaMin == id.etaMin && etaMax == id.etaMax && phiMin == id.phiMin && phiMax == id.phiMax && subSys == id.subSys) ? true : false ;
00034
00035 }
00036
00037 bool CaloCellId::isInCell(double thisEta, double thisPhi){
00038
00039 double myPhi = thisPhi;
00040
00041 bool itIs = false;
00042 if ( myPhi < -1.*CLHEP::pi ) { myPhi = myPhi+CLHEP::twopi; }
00043 else if ( myPhi > CLHEP::pi ) { myPhi = myPhi-CLHEP::twopi; }
00044 if ( thisEta >= etaMin && thisEta < etaMax && myPhi >= phiMin && myPhi < phiMax ) { itIs = true; }
00045 return itIs;
00046
00047 }
00048
00049 double CaloCellId::getThetaCell(){
00050
00051 double etaAve = 0.5*(etaMax+etaMin);
00052 double theta = 2.*std::atan(std::exp(-1.*etaAve));
00053 return theta;
00054
00055 }
00056
00057 std::ostream& operator<<(std::ostream& os, const CaloCellId& id) {
00058 os << "Eta range = ["
00059 << std::fixed << std::setw(7) << std::setfill(' ') << std::setprecision(4) << id.getEtaMin() << ","
00060 << std::fixed << std::setw(7) << std::setfill(' ') << std::setprecision(4) << id.getEtaMax() << "], Phi range = ["
00061 << std::fixed << std::setw(7) << std::setfill(' ') << std::setprecision(4) << id.getPhiMin() << ","
00062 << std::fixed << std::setw(7) << std::setfill(' ') << std::setprecision(4) << id.getPhiMax() << "], subsystem = " << id.getSubSys();
00063 return os;
00064 }
00065
00066