#include <EcalTBCrystalMap.h>
Public Types | |
typedef std::map< std::pair < double, double >, int > | CrystalTBIndexMap |
Public Member Functions | |
int | CrystalIndex (double thisEta, double thisPhi) |
EcalTBCrystalMap (std::string const &MapFileName) | |
void | findCrystalAngles (const int thisCrysIndex, double &thisEta, double &thisPhi) |
~EcalTBCrystalMap () | |
Static Public Attributes | |
static const int | NCRYSTAL = 1700 |
Private Attributes | |
double | crysEta |
int | crysIndex |
double | crysPhi |
CrystalTBIndexMap | map_ |
Definition at line 19 of file EcalTBCrystalMap.h.
typedef std::map< std::pair< double, double >, int > EcalTBCrystalMap::CrystalTBIndexMap |
Definition at line 23 of file EcalTBCrystalMap.h.
EcalTBCrystalMap::EcalTBCrystalMap | ( | std::string const & | MapFileName | ) |
Definition at line 3 of file EcalTBCrystalMap.cc.
References crysEta, crysIndex, crysPhi, Exception, recoMuon::in, collect_tpl::input, map_, and NCRYSTAL.
{ // check if File exists std::ifstream * input= new std::ifstream(MapFileName.c_str(), std::ios::in); if(! (*input)) { throw cms::Exception("FileNotFound", "Ecal TB Crystal map file not found") << "\n" << MapFileName << " could not be opened.\n"; } if (input){ int nCrysCount = 0; while (nCrysCount <= NCRYSTAL ) { (*input) >> crysIndex >> crysEta >> crysPhi; map_[std::pair<double,double>(crysEta,crysPhi)] = crysIndex; nCrysCount++; } input->close(); } }
EcalTBCrystalMap::~EcalTBCrystalMap | ( | ) |
Definition at line 30 of file EcalTBCrystalMap.cc.
{ }
int EcalTBCrystalMap::CrystalIndex | ( | double | thisEta, |
double | thisPhi | ||
) |
Definition at line 33 of file EcalTBCrystalMap.cc.
References map_.
void EcalTBCrystalMap::findCrystalAngles | ( | const int | thisCrysIndex, |
double & | thisEta, | ||
double & | thisPhi | ||
) |
Definition at line 46 of file EcalTBCrystalMap.cc.
References first, map_, NCRYSTAL, and edm::second().
Referenced by EcalTBMCInfoProducer::EcalTBMCInfoProducer().
{ thisEta = thisPhi = 0.; if ( thisCrysIndex < 1 || thisCrysIndex > NCRYSTAL ) { edm::LogError("OutOfBounds") << "Required crystal number " << thisCrysIndex << " outside range"; return; } for ( CrystalTBIndexMap::const_iterator mapItr = map_.begin() ; mapItr != map_.end() ; ++mapItr) { int theCrysIndex = mapItr->second; if ( theCrysIndex == thisCrysIndex ) { thisEta = (mapItr->first).first; thisPhi = (mapItr->first).second; return; } } }
double EcalTBCrystalMap::crysEta [private] |
Definition at line 35 of file EcalTBCrystalMap.h.
Referenced by EcalTBCrystalMap().
int EcalTBCrystalMap::crysIndex [private] |
Definition at line 36 of file EcalTBCrystalMap.h.
Referenced by EcalTBCrystalMap().
double EcalTBCrystalMap::crysPhi [private] |
Definition at line 35 of file EcalTBCrystalMap.h.
Referenced by EcalTBCrystalMap().
CrystalTBIndexMap EcalTBCrystalMap::map_ [private] |
Definition at line 38 of file EcalTBCrystalMap.h.
Referenced by CrystalIndex(), EcalTBCrystalMap(), and findCrystalAngles().
const int EcalTBCrystalMap::NCRYSTAL = 1700 [static] |
Definition at line 31 of file EcalTBCrystalMap.h.
Referenced by EcalTBCrystalMap(), EcalTBMCInfoProducer::EcalTBMCInfoProducer(), and findCrystalAngles().