#include <tmp/EcalTrigTowerConstituentsMapBuilder/interface/EcalTrigTowerConstituentsMapBuilder.h>
Public Types | |
typedef std::auto_ptr < EcalTrigTowerConstituentsMap > | ReturnType |
Public Member Functions | |
EcalTrigTowerConstituentsMapBuilder (const edm::ParameterSet &) | |
ReturnType | produce (const IdealGeometryRecord &) |
~EcalTrigTowerConstituentsMapBuilder () | |
Private Member Functions | |
void | parseTextMap (const std::string &filename, EcalTrigTowerConstituentsMap &theMap) |
Private Attributes | |
std::string | mapFile_ |
Implementation: <Notes on="" implementation>="">
Definition at line 38 of file EcalTrigTowerConstituentsMapBuilder.h.
typedef std::auto_ptr<EcalTrigTowerConstituentsMap> EcalTrigTowerConstituentsMapBuilder::ReturnType |
Definition at line 43 of file EcalTrigTowerConstituentsMapBuilder.h.
EcalTrigTowerConstituentsMapBuilder::EcalTrigTowerConstituentsMapBuilder | ( | const edm::ParameterSet & | iConfig | ) |
Definition at line 34 of file EcalTrigTowerConstituentsMapBuilder.cc.
References edm::ESProducer::setWhatProduced().
00034 : 00035 mapFile_(iConfig.getUntrackedParameter<std::string>("MapFile","")) 00036 { 00037 //the following line is needed to tell the framework what 00038 // data is being produced 00039 setWhatProduced(this); 00040 00041 //now do what ever other initialization is needed 00042 }
EcalTrigTowerConstituentsMapBuilder::~EcalTrigTowerConstituentsMapBuilder | ( | ) |
void EcalTrigTowerConstituentsMapBuilder::parseTextMap | ( | const std::string & | filename, | |
EcalTrigTowerConstituentsMap & | theMap | |||
) | [private] |
Definition at line 66 of file EcalTrigTowerConstituentsMapBuilder.cc.
References EcalTrigTowerConstituentsMap::assign(), EcalEndcap, f, edm::FileInPath::fullPath(), parsecf::pyparsing::line(), and mod().
Referenced by produce().
00066 { 00067 edm::FileInPath eff(filename); 00068 00069 std::ifstream f(eff.fullPath().c_str()); 00070 if (!f.good()) 00071 return; 00072 00073 int mod,cry,ietaTower,iphiTower; 00074 int ix,iy,iz; 00075 char line[80]; // a buffer for the line to read 00076 char ch; // a temporary for holding the end of line 00077 while ((ch = f.peek()) != '-') { 00078 f.get(line,80,'\n'); // read 80 characters to end of line 00079 f.get(ch); // eat out the '\n' 00080 // extract the numbers 00081 /* 00082 int nread = sscanf (line, " %d %d %d %d",&mod,&cry,&ietaTower,&iphiTower); 00083 if (nread == 4 ) 00084 { 00085 EEDetId eeid(mod,cry,1,EEDetId::SCCRYSTALMODE); 00086 EcalTrigTowerDetId etid(1,EcalEndcap,ietaTower-45+17,iphiTower); 00087 // std::cout << eeid << "\n->" << etid << std::endl; 00088 theMap.assign(DetId(eeid),etid); 00089 } 00090 */ 00091 int nread = sscanf (line, " %d %d %d %d %d",&ix,&iy,&iz,&ietaTower, &iphiTower); 00092 if (nread == 5) { 00093 EEDetId eeid(ix,iy,iz,0); 00094 // std::cout << "-- manu ix eta phi " << DetId(eeid).rawId() << " " << iz << " " << ietaTower << " " << iphiTower << std::endl; 00095 EcalTrigTowerDetId etid(iz,EcalEndcap,ietaTower,iphiTower); 00096 theMap.assign(DetId(eeid),etid); 00097 } 00098 00099 } 00100 // Pass comment line 00101 f.get(line,80,'\n'); // read 80 characters to end of line 00102 f.get(ch); // eat out the '\n' 00103 // Next info line 00104 f.get(line,80,'\n'); // read 80 characters to end of line 00105 f.get(ch); // eat out the '\n' 00106 // extract the numbers 00107 // int nTE; 00108 // sscanf (line, " %d",&nTE); 00109 // nTowEta_e=nTE; 00110 // while ((ch = f.peek()) != EOF) { 00111 // f.get(line,80,'\n'); // read 80 characters to end of line 00112 // f.get(ch); // eat out the '\n' 00113 // // extract the numbers 00114 // float bound; 00115 // sscanf (line, " %f", &bound); 00116 // eta_boundaries.push_back(bound); 00117 // } 00118 00119 f.close(); 00120 return; 00121 }
EcalTrigTowerConstituentsMapBuilder::ReturnType EcalTrigTowerConstituentsMapBuilder::produce | ( | const IdealGeometryRecord & | iRecord | ) |
Definition at line 55 of file EcalTrigTowerConstituentsMapBuilder.cc.
References mapFile_, and parseTextMap().
00056 { 00057 using namespace edm::es; 00058 std::auto_ptr<EcalTrigTowerConstituentsMap> prod(new EcalTrigTowerConstituentsMap()); 00059 00060 if (!mapFile_.empty()) { 00061 parseTextMap(mapFile_,*prod); 00062 } 00063 return prod; 00064 }
std::string EcalTrigTowerConstituentsMapBuilder::mapFile_ [private] |