CMS 3D CMS Logo

Classes | Public Member Functions | Private Member Functions | Private Attributes

SiStripDetInfoFileReader Class Reference

#include <CalibTracker/SiStripCommon/src/SiStripDetInfoFileReader.cc>

List of all members.

Classes

struct  DetInfo

Public Member Functions

const std::map< uint32_t,
DetInfo > & 
getAllData () const
const std::vector< uint32_t > & getAllDetIds () const
const std::pair< unsigned
short, double > 
getNumberOfApvsAndStripLength (uint32_t detId) const
const float & getThickness (uint32_t detId) const
SiStripDetInfoFileReaderoperator= (const SiStripDetInfoFileReader &copy)
 SiStripDetInfoFileReader (std::string filePath)
 SiStripDetInfoFileReader (const SiStripDetInfoFileReader &)
 SiStripDetInfoFileReader (const edm::ParameterSet &, const edm::ActivityRegistry &)
 SiStripDetInfoFileReader ()
 ~SiStripDetInfoFileReader ()

Private Member Functions

void reader (std::string filePath)

Private Attributes

std::map< uint32_t, DetInfodetData_
std::vector< uint32_t > detIds_
std::ifstream inputFile_

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 31 of file SiStripDetInfoFileReader.h.


Constructor & Destructor Documentation

SiStripDetInfoFileReader::SiStripDetInfoFileReader ( ) [inline, explicit]

Definition at line 46 of file SiStripDetInfoFileReader.h.

{};
SiStripDetInfoFileReader::SiStripDetInfoFileReader ( const edm::ParameterSet pset,
const edm::ActivityRegistry ar 
) [explicit]

Definition at line 22 of file SiStripDetInfoFileReader.cc.

References edm::FileInPath::fullPath(), and edm::ParameterSet::getUntrackedParameter().

                                                                                                            {
  edm::FileInPath fp(pset.getUntrackedParameter<std::string>("filePath","CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"));
  reader(fp.fullPath());
}
SiStripDetInfoFileReader::SiStripDetInfoFileReader ( std::string  filePath) [explicit]

Definition at line 32 of file SiStripDetInfoFileReader.cc.

                                                                     {
  reader(filePath);
}
SiStripDetInfoFileReader::SiStripDetInfoFileReader ( const SiStripDetInfoFileReader copy) [explicit]

Definition at line 27 of file SiStripDetInfoFileReader.cc.

References detData_, and detIds_.

                                                                                       {
  detData_=copy.detData_;
  detIds_=copy.detIds_;
}
SiStripDetInfoFileReader::~SiStripDetInfoFileReader ( )

Definition at line 117 of file SiStripDetInfoFileReader.cc.

                                                   {
}

Member Function Documentation

const std::map<uint32_t, DetInfo >& SiStripDetInfoFileReader::getAllData ( ) const [inline]
const std::vector<uint32_t>& SiStripDetInfoFileReader::getAllDetIds ( ) const [inline]
const std::pair< unsigned short, double > SiStripDetInfoFileReader::getNumberOfApvsAndStripLength ( uint32_t  detId) const

Definition at line 121 of file SiStripDetInfoFileReader.cc.

Referenced by SiStripQuality::add(), SiStripHitEffFromCalibTree::algoAnalyze(), SiStripQualityStatistics::analyze(), SiStripBaseCondObjDQM::bookProfileMEs(), SiStripBaseCondObjDQM::bookSummaryProfileMEs(), SiStripQuality::compact(), SiStripQuality::fillBadComponents(), SiStripThresholdDQM::fillMEsForDet(), SiStripQualityDQM::fillMEsForDet(), SiStripPedestalsDQM::fillMEsForDet(), SiStripNoisesDQM::fillMEsForDet(), SiStripApvGainsDQM::fillMEsForDet(), SiStripQualityDQM::fillMEsForLayer(), SiStripApvGainsDQM::fillMEsForLayer(), SiStripThresholdDQM::fillMEsForLayer(), SiStripPedestalsDQM::fillMEsForLayer(), SiStripNoisesDQM::fillMEsForLayer(), SiStripBadModuleByHandBuilder::getNewObject(), SiStripCorrelateBadStripAndNoise::iterateOnBadStrips(), SiStripHitEffFromCalibTree::makeSQLite(), SiStripQuality::operator-=(), SiStripCondObjBuilderFromDb::retrieveNumberAPVPairs(), SiStripQualityStatistics::SetBadComponents(), SiStripHitEffFromCalibTree::SetBadComponents(), SiStripQualityDQM::SetBadComponents(), and SiStripCondObjBuilderFromDb::setValuesApvLatency().

                                                                                                                  {

  std::map<uint32_t, DetInfo >::const_iterator it = detData_.find(detId);

  if(it!=detData_.end()){

    return std::pair<unsigned short, double>(it->second.nApvs,it->second.stripLength); 

  }
  else{

    static std::pair<unsigned short, double> defaultValue(0,0);
    edm::LogWarning("SiStripDetInfoFileReader::getNumberOfApvsAndStripLength - Unable to find requested detid. Returning invalid data ")<<endl; 
    return defaultValue;

  }

}
const float & SiStripDetInfoFileReader::getThickness ( uint32_t  detId) const

Definition at line 140 of file SiStripDetInfoFileReader.cc.

                                                                        {

  std::map<uint32_t, DetInfo >::const_iterator it = detData_.find(detId);

  if(it!=detData_.end()){

    return it->second.thickness; 

  }
  else{

    static float defaultValue=0;
    edm::LogWarning("SiStripDetInfoFileReader::getThickness - Unable to find requested detid. Returning invalid data ")<<endl; 
    return defaultValue;

  }

}
SiStripDetInfoFileReader & SiStripDetInfoFileReader::operator= ( const SiStripDetInfoFileReader copy)

Definition at line 16 of file SiStripDetInfoFileReader.cc.

References detData_, and detIds_.

                                                                                                  {
  detData_=copy.detData_;
  detIds_=copy.detIds_;
  return *this;  
}
void SiStripDetInfoFileReader::reader ( std::string  filePath) [private]

Definition at line 36 of file SiStripDetInfoFileReader.cc.

References cond::rpcobgas::detid.

                                                        {

//   if(filePath==std::string("")){
//     filePath = edm::FileInPath(std::string("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat") ).fullPath();
//   }

  edm::LogInfo("SiStripDetInfoFileReader") << "filePath " << filePath << std::endl;


  detData_.clear();
  detIds_.clear();

  inputFile_.open(filePath.c_str());

  if (inputFile_.is_open()){

    for(;;) {

      uint32_t detid; 
      double stripLength;
      unsigned short numberOfAPVs;
      float thickness;

      inputFile_ >> detid >> numberOfAPVs  >> stripLength >> thickness;

      if (!(inputFile_.eof() || inputFile_.fail())){

        detIds_.push_back(detid);

        //      inputFile_ >> numberOfAPVs;
        //      inputFile_ >> stripLength;

        //      edm::LogInfo("SiStripDetInfoFileReader::SiStripDetInfoFileReader") << detid <<" " <<numberOfAPVs <<" " <<stripLength << " "<< thickness<< endl;

        std::map<uint32_t, DetInfo >::const_iterator it = detData_.find(detid);

        if(it==detData_.end()){
          detData_[detid]=DetInfo(numberOfAPVs, stripLength,thickness);
        }
        else{

          edm::LogError("SiStripDetInfoFileReader::SiStripDetInfoFileReader") <<"DetId " << detid << " already found on file. Ignoring new data"<<endl;
        
          detIds_.pop_back();
          continue;
        }
      }
      else if (inputFile_.eof()){

        edm::LogInfo("SiStripDetInfoFileReader::SiStripDetInfoFileReader - END of file reached")<<endl;
        break;

      }
      else if (inputFile_.fail()) {
      
        edm::LogError("SiStripDetInfoFileReader::SiStripDetInfoFileReader - ERROR while reading file")<<endl;     
        break;
      }
    }

    inputFile_.close();

  }  
  else {

    edm::LogError("SiStripDetInfoFileReader::SiStripDetInfoFileReader - Unable to open file")<<endl;
    return;
  
  }

//   int i=0;
//   for(std::map<uint32_t, std::pair<unsigned short, double> >::iterator it =detData_.begin(); it!=detData_.end(); it++ ) {
//     std::cout<< it->first << " " << (it->second).first << " " << (it->second).second<<endl;
//     i++;
//   }
//   std::cout<<i;


}

Member Data Documentation

std::map<uint32_t, DetInfo> SiStripDetInfoFileReader::detData_ [private]

Definition at line 73 of file SiStripDetInfoFileReader.h.

Referenced by getAllData(), operator=(), and SiStripDetInfoFileReader().

std::vector<uint32_t> SiStripDetInfoFileReader::detIds_ [private]

Definition at line 76 of file SiStripDetInfoFileReader.h.

Referenced by getAllDetIds(), operator=(), and SiStripDetInfoFileReader().

std::ifstream SiStripDetInfoFileReader::inputFile_ [private]

Definition at line 70 of file SiStripDetInfoFileReader.h.