CMS 3D CMS Logo

RPCCalibSetUp Class Reference

#include <CalibMuon/RPCCalibration/interface/RPCCalibSetUp.h>

List of all members.

Public Member Functions

std::map< int, std::vector
< double > > 
getClsMap ()
std::vector< float > getEff (uint32_t id)
const RPCGeometrygetGeometry ()
std::vector< float > getNoise (uint32_t id)
float getTime (uint32_t id)
 RPCCalibSetUp (const edm::ParameterSet &ps)
void setGeometry (const RPCGeometry *geom)
 sets geometry
virtual ~RPCCalibSetUp ()

Public Attributes

std::map< RPCDetId, float > _bxmap
std::map< int, std::vector
< double > > 
_clsMap
std::map< uint32_t,
std::vector< float > > 
_mapDetIdEff
std::map< uint32_t,
std::vector< float > > 
_mapDetIdNoise
const RPCGeometrytheGeometry


Detailed Description

Definition at line 23 of file RPCCalibSetUp.h.


Constructor & Destructor Documentation

RPCCalibSetUp::RPCCalibSetUp ( const edm::ParameterSet ps  )  [explicit]

Definition at line 31 of file RPCCalibSetUp.cc.

References _bxmap, _clsMap, _mapDetIdEff, _mapDetIdNoise, count, counter(), edm::FileInPath::fullPath(), edm::ParameterSet::getParameter(), i, in, row, ss, sum(), and value.

00031                                                       {
00032   
00033   _mapDetIdNoise.clear();
00034   _mapDetIdEff.clear();
00035   _bxmap.clear();
00036 
00037     //------------------------ Noise Reading ----------------------------
00038     
00039   edm::FileInPath fp1 = ps.getParameter<edm::FileInPath>("noisemapfile");
00040   std::ifstream _infile1(fp1.fullPath().c_str(), std::ios::in);
00041   
00042   std::vector<float>  vnoise;
00043 
00044   int rpcdetid = 0;
00045   std::string buff;
00046   
00047   std::vector< std::string > words;
00048 
00049   int count = 0;
00050   while( getline(_infile1, buff, '\n') ){
00051     
00052     words.clear();
00053     vnoise.clear();
00054     
00055     stringstream ss;
00056     std::string chname;
00057     ss<<buff;
00058     ss>>chname>>rpcdetid;
00059 
00060     std::string::size_type pos = 0, prev_pos = 0;
00061 
00062     while ( (pos = buff.find("  ",pos)) != string::npos){
00063       
00064       words.push_back(buff.substr(prev_pos, pos - prev_pos));
00065       prev_pos = ++pos;
00066     }
00067     words.push_back(buff.substr(prev_pos, pos - prev_pos));
00068     
00069     for(unsigned int i = 2; i < words.size(); ++i){
00070       float value = atof( ((words)[i]).c_str() );
00071       vnoise.push_back(value);
00072     }
00073     
00074     _mapDetIdNoise.insert(make_pair(static_cast<uint32_t>(rpcdetid),vnoise));
00075     
00076     count++;
00077   }
00078    _infile1.close();
00079 
00080   //------------------------ Eff Reading ----------------------------
00081   
00082   edm::FileInPath fp2 = ps.getParameter<edm::FileInPath>("effmapfile");
00083   std::ifstream _infile2(fp2.fullPath().c_str(), std::ios::in);
00084 
00085   std::vector<float> veff ;
00086   rpcdetid = 0;
00087   
00088   while( getline(_infile2, buff, '\n') ){
00089 
00090     words.clear();
00091     veff.clear();
00092     
00093     stringstream ss;
00094     std::string chname;
00095     ss<<buff;
00096     ss>>chname>>rpcdetid;
00097     
00098     std::string::size_type pos = 0, prev_pos = 0;
00099     while ( (pos = buff.find("  ",pos)) != string::npos){
00100       
00101       words.push_back(buff.substr(prev_pos, pos - prev_pos));
00102       prev_pos = ++pos;
00103     }
00104     words.push_back(buff.substr(prev_pos, pos - prev_pos));
00105     
00106     for(unsigned int i = 2; i < words.size(); ++i){
00107       float value = atof(((words)[i]).c_str());
00108       veff.push_back(value);
00109     }
00110     _mapDetIdEff.insert(make_pair(static_cast<uint32_t>(rpcdetid),veff));
00111   }
00112   _infile2.close();
00113 
00114   //---------------------- Timing reading ------------------------------------
00115 
00116   edm::FileInPath fp3 = ps.getParameter<edm::FileInPath>("timingMap");
00117   std::ifstream _infile3(fp3.fullPath().c_str(), std::ios::in);
00118 
00119   uint32_t detUnit = 0;
00120   float timing = 0.;
00121   while(!_infile3.eof()){
00122     _infile3>>detUnit>>timing;
00123     _bxmap[RPCDetId(detUnit)] = timing;
00124   }
00125   _infile3.close();
00126 
00127   //---------------------- Cluster size --------------------------------------
00128 
00129   edm::FileInPath fp4 = ps.getParameter<edm::FileInPath>("clsmapfile");
00130   std::ifstream _infile4(fp4.fullPath().c_str(), ios::in);
00131 
00132   string buffer;
00133   double sum = 0;
00134   unsigned int counter = 1;
00135   unsigned int row = 1;
00136   std::vector<double> sum_clsize;
00137 
00138   while ( _infile4 >> buffer ) {
00139     const char *buffer1 = buffer.c_str();
00140     double dato = atof(buffer1);
00141     sum += dato;
00142     sum_clsize.push_back(sum);
00143 
00144     if(counter == row*20) {
00145       _clsMap[row] = sum_clsize;
00146       row++;
00147       sum = 0;
00148       sum_clsize.clear();
00149     }
00150     counter++;
00151   }
00152   _infile4.close();
00153 
00154 }

RPCCalibSetUp::~RPCCalibSetUp (  )  [virtual]

Definition at line 180 of file RPCCalibSetUp.cc.

00180 {}


Member Function Documentation

std::map< int, std::vector< double > > RPCCalibSetUp::getClsMap (  ) 

Definition at line 175 of file RPCCalibSetUp.cc.

References _clsMap.

00176 {
00177   return _clsMap;
00178 }

std::vector< float > RPCCalibSetUp::getEff ( uint32_t  id  ) 

Definition at line 162 of file RPCCalibSetUp.cc.

References _mapDetIdEff, and iter.

Referenced by RPCFakeCalibration::makeNoise().

00163 {
00164   map<uint32_t,std::vector<float> >::iterator iter = _mapDetIdEff.find(id);
00165   return iter->second;
00166 }

const RPCGeometry* RPCCalibSetUp::getGeometry (  )  [inline]

Definition at line 37 of file RPCCalibSetUp.h.

References theGeometry.

00037 { return theGeometry; }

std::vector< float > RPCCalibSetUp::getNoise ( uint32_t  id  ) 

Definition at line 156 of file RPCCalibSetUp.cc.

References _mapDetIdNoise, and iter.

00157 {
00158   map<uint32_t,std::vector<float> >::iterator iter = _mapDetIdNoise.find(id);
00159   return (iter->second);
00160 }

float RPCCalibSetUp::getTime ( uint32_t  id  ) 

Definition at line 168 of file RPCCalibSetUp.cc.

References _bxmap, and iter.

Referenced by RPCFakeCalibration::makeNoise().

00169 {
00170   RPCDetId rpcid(id);
00171   std::map<RPCDetId, float>::iterator iter = _bxmap.find(rpcid);
00172   return iter->second;
00173 }

void RPCCalibSetUp::setGeometry ( const RPCGeometry geom  )  [inline]

sets geometry

Definition at line 36 of file RPCCalibSetUp.h.

References theGeometry.

00036 {theGeometry = geom;}


Member Data Documentation

std::map<RPCDetId, float> RPCCalibSetUp::_bxmap

Definition at line 43 of file RPCCalibSetUp.h.

Referenced by getTime(), and RPCCalibSetUp().

std::map< int, std::vector<double> > RPCCalibSetUp::_clsMap

Definition at line 44 of file RPCCalibSetUp.h.

Referenced by getClsMap(), RPCFakeCalibration::makeNoise(), and RPCCalibSetUp().

std::map<uint32_t, std::vector<float> > RPCCalibSetUp::_mapDetIdEff

Definition at line 42 of file RPCCalibSetUp.h.

Referenced by getEff(), and RPCCalibSetUp().

std::map<uint32_t, std::vector<float> > RPCCalibSetUp::_mapDetIdNoise

Definition at line 41 of file RPCCalibSetUp.h.

Referenced by getNoise(), RPCFakeCalibration::makeNoise(), and RPCCalibSetUp().

const RPCGeometry* RPCCalibSetUp::theGeometry

Definition at line 39 of file RPCCalibSetUp.h.

Referenced by getGeometry(), and setGeometry().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:30:53 2009 for CMSSW by  doxygen 1.5.4