CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

SiStripHistoId Class Reference

#include <DQM/SiStripCommon/interface/SiStripHistoId.h>

List of all members.

Public Member Functions

std::string createHistoId (std::string description, std::string id_type, uint32_t component_id)
std::string createHistoLayer (std::string description, std::string id_type, std::string path, std::string flag)
uint32_t getComponentId (std::string histoid)
std::string getComponentType (std::string histoid)
std::string getSubdetid (uint32_t id, bool flag_ring)
 SiStripHistoId ()
virtual ~SiStripHistoId ()

Private Member Functions

const SiStripHistoIdoperator= (const SiStripHistoId &)
std::string returnIdPart (std::string histoid, uint32_t whichpart)
 SiStripHistoId (const SiStripHistoId &)

Private Attributes

std::string separator1
std::string separator2

Detailed Description

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

Usage: <usage>

Definition at line 26 of file SiStripHistoId.h.


Constructor & Destructor Documentation

SiStripHistoId::SiStripHistoId ( )

Definition at line 26 of file SiStripHistoId.cc.

References separator1, and separator2.

{
 separator1="__";
 separator2="__";
}
SiStripHistoId::~SiStripHistoId ( ) [virtual]

Definition at line 33 of file SiStripHistoId.cc.

{
}
SiStripHistoId::SiStripHistoId ( const SiStripHistoId ) [private]

Member Function Documentation

std::string SiStripHistoId::createHistoId ( std::string  description,
std::string  id_type,
uint32_t  component_id 
)

Definition at line 38 of file SiStripHistoId.cc.

References idDealer::description, separator1, and separator2.

Referenced by SiStripLAProfileBooker::beginRun(), SiStripBaseCondObjDQM::bookCumulMEs(), SiStripMonitorTrack::bookModMEs(), SiStripBaseCondObjDQM::bookProfileMEs(), SiStripMonitorTrack::clusterInfos(), SiStripMonitorPedestals::createMEs(), SiStripMonitorCluster::createModuleMEs(), SiStripMonitorDigi::createModuleMEs(), and SiStripMonitorQuality::getQualityME().

                                                                                                     {
  size_t pos1 = description.find( separator1, 0 ); // check if std::string 'description' contains by mistake the 'separator1'
  size_t pos2 = description.find( separator2, 0 ); // check if std::string 'description' contains by mistake the 'separator2'
  std::string local_histo_id;
  std::ostringstream compid;
  compid<<component_id; // use std::ostringstream for casting integer to std::string
      
  if ( pos1 == std::string::npos && pos2 == std::string::npos ){ // ok, not found either separator
    if(id_type=="fed" || id_type=="det" || id_type=="fec"){ // ok! is one of the accepted id_type-s
      local_histo_id = description + separator1 + id_type + separator2 + compid.str();
    }else{
      local_histo_id = description + separator1 + "dummy" + separator2 + compid.str();
      edm::LogError("SiStripHistoId") <<" SiStripHistoId::WrongInput " 
                                 <<" no such type of component accepted: "<<id_type
                                 <<" id_type can be: fed, det, or fec.";      
    }
  }else{
    local_histo_id = description + "_dummy_" + separator1 + id_type + separator2 + compid.str();
    edm::LogError("SiStripHistoId") <<" SiStripHistoId::WrongInput " 
                               <<" histogram description cannot contain: "<<separator1<<" or: "<<separator2
                               <<" histogram description = "<<description;
  }
  return local_histo_id;
}
std::string SiStripHistoId::createHistoLayer ( std::string  description,
std::string  id_type,
std::string  path,
std::string  flag 
)

Definition at line 63 of file SiStripHistoId.cc.

References idDealer::description, LogTrace, path(), separator1, and separator2.

Referenced by SiStripMonitorTrack::bookLayerMEs(), SiStripBaseCondObjDQM::bookSummaryCumulMEs(), SiStripBaseCondObjDQM::bookSummaryMEs(), SiStripBaseCondObjDQM::bookSummaryProfileMEs(), SiStripMonitorCluster::createLayerMEs(), SiStripMonitorDigi::createLayerMEs(), SiStripLorentzAngleDQM::fillMEsForLayer(), SiStripApvGainsDQM::fillMEsForLayer(), SiStripQualityDQM::fillMEsForLayer(), SiStripThresholdDQM::fillMEsForLayer(), SiStripNoisesDQM::fillMEsForLayer(), and SiStripPedestalsDQM::fillMEsForLayer().

                                                                                                                {
  size_t pos1 = description.find( separator1, 0 ); // check if std::string 'description' contains by mistake the 'separator1'
  size_t pos2 = description.find( separator2, 0 ); // check if std::string 'description' contains by mistake the 'separator2'
  std::string local_histo_id;
  if ( pos1 == std::string::npos && pos2 == std::string::npos ){ // ok, not found either separator
    if(id_type=="fed" || id_type=="det" || id_type=="fec"  || id_type=="layer"){ // ok! is one of the accepted id_type-s
      if(flag.size() > 0)
        local_histo_id = description + separator1 + flag + separator2 + path;
      else 
        local_histo_id = description + separator2 + path;
      LogTrace("SiStripHistoId") << "Local_histo_ID " << local_histo_id << std::endl;
    }else{
      local_histo_id = description + separator2 + "_dummy_" + path;
      edm::LogError("SiStripHistoId") <<" SiStripHistoId::WrongInput " 
                                 <<" no such type of component accepted: "<<id_type
                                 <<" id_type can be: fed, det, fec or layer ";
    }
  }else{
    local_histo_id = description + "_dummy_" + separator2 +  path;
    edm::LogWarning("SiStripHistoId") <<" SiStripHistoId::WrongInput " 
                                 <<" histogram description cannot contain: "<<separator1<<" or: "<<separator2
                                 <<" histogram description = "<<description;
  }
  return local_histo_id;
}
uint32_t SiStripHistoId::getComponentId ( std::string  histoid)

Definition at line 122 of file SiStripHistoId.cc.

References collect_tpl::input, and returnIdPart().

Referenced by SiStripCalibLorentzAngle::algoBeginJob().

                                                        {
  uint32_t local_component_id;
  std::istringstream input(returnIdPart(histoid,3)); input >> local_component_id; // use std::istringstream for casting from std::string to uint32_t
  return local_component_id;
}
std::string SiStripHistoId::getComponentType ( std::string  histoid)

Definition at line 129 of file SiStripHistoId.cc.

References returnIdPart().

                                                           {
 return returnIdPart(histoid,2);
}
std::string SiStripHistoId::getSubdetid ( uint32_t  id,
bool  flag_ring 
)

Definition at line 89 of file SiStripHistoId.cc.

References TIBDetId::layer(), TOBDetId::layer(), TIDDetId::ring(), TECDetId::ring(), TIDDetId::side(), TECDetId::side(), DetId::subdetId(), sistripsummary::TEC, sistripsummary::TIB, sistripsummary::TID, sistripsummary::TOB, TIDDetId::wheel(), and TECDetId::wheel().

Referenced by SiStripMonitorTrack::book(), SiStripMonitorCluster::createMEs(), SiStripMonitorDigi::createMEs(), and SiStripMonitorTrack::fillMEs().

                                                               {  std::string rest1;
  
  const int buf_len = 50;
  char temp_str[buf_len];

  StripSubdetector subdet(id);
  if( subdet.subdetId() == StripSubdetector::TIB){
    // ---------------------------  TIB  --------------------------- //
    TIBDetId tib1 = TIBDetId(id);
    snprintf(temp_str, buf_len, "TIB__layer__%i", tib1.layer());
  }else if( subdet.subdetId() == StripSubdetector::TID){
    // ---------------------------  TID  --------------------------- //
    TIDDetId tid1 = TIDDetId(id);
    if (flag_ring) snprintf(temp_str, buf_len, "TID__side__%i__ring__%i", tid1.side(), tid1.ring());
    else snprintf(temp_str, buf_len, "TID__side__%i__wheel__%i", tid1.side(), tid1.wheel());
  }else if(subdet.subdetId() == StripSubdetector::TOB){ 
    // ---------------------------  TOB  --------------------------- //
    TOBDetId tob1 = TOBDetId(id);
    snprintf(temp_str, buf_len, "TOB__layer__%i",tob1.layer()); 
  }else if(subdet.subdetId() == StripSubdetector::TEC){
    // ---------------------------  TEC  --------------------------- //
    TECDetId tec1 = TECDetId(id);
    if (flag_ring) snprintf(temp_str, buf_len, "TEC__side__%i__ring__%i", tec1.side(), tec1.ring());
    else snprintf(temp_str, buf_len, "TEC__side__%i__wheel__%i", tec1.side(), tec1.wheel()); 
  }else{
    // ---------------------------  ???  --------------------------- //
    edm::LogError("SiStripTkDQM|WrongInput")<<"no such subdetector type :"<<subdet.subdetId()<<" no folder set!"<<std::endl;
    snprintf(temp_str,0,"%s","");  
  }
  
  return std::string(temp_str);
}
const SiStripHistoId& SiStripHistoId::operator= ( const SiStripHistoId ) [private]
std::string SiStripHistoId::returnIdPart ( std::string  histoid,
uint32_t  whichpart 
) [private]

Definition at line 134 of file SiStripHistoId.cc.

References separator1, and separator2.

Referenced by getComponentId(), and getComponentType().

                                                                           {
  size_t length1=histoid.find(separator1,0);
  if(length1==std::string::npos){ // no separator1 found
    edm::LogWarning("SiStripTkDQM|UnregularInput")<<"no regular histoid. Returning 0";
    return "0";
  }
  std::string part1 = histoid.substr(0,length1); // part of 'histoid' up to 'separator1'
  if(whichpart==1) return part1;
  std::string remain1 = histoid.substr(length1+separator1.size()); // rest of 'histoid' starting at end of 'separator1'
  size_t length2=remain1.find(separator2,0);
  if(length2==std::string::npos){ // no separator2 found
    edm::LogWarning("SiStripTkDQM|UnregularInput")<<"no regular histoid. Returning 0";
    return "0";
  }
  std::string part2 = remain1.substr(0,length2); // part of 'remain1' up to 'separator2'
  if(whichpart==2) return part2;
  std::string part3 = remain1.substr(length2+separator2.size()); // rest of remain1 starting at end of 'separator2'
  if(whichpart==3) return part3;
  edm::LogWarning("SiStripTkDQM|UnregularInput")<<"no such whichpart="<<whichpart<<" returning 0";
  return "0";
}

Member Data Documentation

std::string SiStripHistoId::separator1 [private]

Definition at line 43 of file SiStripHistoId.h.

Referenced by createHistoId(), createHistoLayer(), returnIdPart(), and SiStripHistoId().

std::string SiStripHistoId::separator2 [private]

Definition at line 44 of file SiStripHistoId.h.

Referenced by createHistoId(), createHistoLayer(), returnIdPart(), and SiStripHistoId().