test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Static Public Attributes | Private Attributes
EcalTBCrystalMap Class Reference

#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_
 

Detailed Description

Definition at line 18 of file EcalTBCrystalMap.h.

Member Typedef Documentation

typedef std::map< std::pair< double, double >, int > EcalTBCrystalMap::CrystalTBIndexMap

Definition at line 22 of file EcalTBCrystalMap.h.

Constructor & Destructor Documentation

EcalTBCrystalMap::EcalTBCrystalMap ( std::string const &  MapFileName)

Definition at line 3 of file EcalTBCrystalMap.cc.

References crysEta, crysIndex, crysPhi, Exception, recoMuon::in, input, map_, and NCRYSTAL.

3  {
4 
5  // check if File exists
6  std::ifstream * input= new std::ifstream(MapFileName.c_str(), std::ios::in);
7  if(! (*input))
8  {
9  throw cms::Exception("FileNotFound", "Ecal TB Crystal map file not found")
10  << "\n" << MapFileName << " could not be opened.\n";
11  }
12  if (input){
13 
14  int nCrysCount = 0;
15 
16  while (nCrysCount <= NCRYSTAL ) {
17 
18  (*input) >> crysIndex >> crysEta >> crysPhi;
19  map_[std::pair<double,double>(crysEta,crysPhi)] = crysIndex;
20 
21  nCrysCount++;
22 
23  }
24 
25  input->close();
26  }
27 
28 }
CrystalTBIndexMap map_
static const int NCRYSTAL
static std::string const input
Definition: EdmProvDump.cc:44
EcalTBCrystalMap::~EcalTBCrystalMap ( )

Definition at line 30 of file EcalTBCrystalMap.cc.

30  {
31 }

Member Function Documentation

int EcalTBCrystalMap::CrystalIndex ( double  thisEta,
double  thisPhi 
)

Definition at line 33 of file EcalTBCrystalMap.cc.

References map_.

33  {
34 
35  int thisCrysIndex = 0;
36 
37  CrystalTBIndexMap::const_iterator mapItr = map_.find(std::make_pair(thisEta,thisPhi));
38  if ( mapItr != map_.end() ) {
39  thisCrysIndex = mapItr->second;
40  }
41 
42  return thisCrysIndex;
43 
44 }
CrystalTBIndexMap map_
void EcalTBCrystalMap::findCrystalAngles ( const int  thisCrysIndex,
double &  thisEta,
double &  thisPhi 
)

Definition at line 46 of file EcalTBCrystalMap.cc.

References plotBeamSpotDB::first, map_, NCRYSTAL, and edm::second().

46  {
47 
48  thisEta = thisPhi = 0.;
49 
50  if ( thisCrysIndex < 1 || thisCrysIndex > NCRYSTAL ) {
51  edm::LogError("OutOfBounds") << "Required crystal number " << thisCrysIndex << " outside range";
52  return;
53  }
54 
55  for ( CrystalTBIndexMap::const_iterator mapItr = map_.begin() ; mapItr != map_.end() ; ++mapItr) {
56  int theCrysIndex = mapItr->second;
57  if ( theCrysIndex == thisCrysIndex ) {
58  thisEta = (mapItr->first).first;
59  thisPhi = (mapItr->first).second;
60  return;
61  }
62  }
63 
64 }
CrystalTBIndexMap map_
static const int NCRYSTAL
U second(std::pair< T, U > const &p)

Member Data Documentation

double EcalTBCrystalMap::crysEta
private

Definition at line 34 of file EcalTBCrystalMap.h.

Referenced by EcalTBCrystalMap().

int EcalTBCrystalMap::crysIndex
private

Definition at line 35 of file EcalTBCrystalMap.h.

Referenced by EcalTBCrystalMap().

double EcalTBCrystalMap::crysPhi
private

Definition at line 34 of file EcalTBCrystalMap.h.

Referenced by EcalTBCrystalMap().

CrystalTBIndexMap EcalTBCrystalMap::map_
private

Definition at line 37 of file EcalTBCrystalMap.h.

Referenced by CrystalIndex(), EcalTBCrystalMap(), and findCrystalAngles().

const int EcalTBCrystalMap::NCRYSTAL = 1700
static