CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiStripHistoryDQMService.cc
Go to the documentation of this file.
9 
10 
12 : DQMHistoryServiceBase::DQMHistoryServiceBase(iConfig, aReg), iConfig_(iConfig)
13 {
14  edm::LogInfo("SiStripHistoryDQMService") << "[SiStripHistoryDQMService::SiStripHistoryDQMService]";
15 }
16 
17 
19  edm::LogInfo("SiStripHistoryDQMService") << "[SiStripHistoryDQMService::~SiStripHistoryDQMService]";
20 }
21 
22 
24  LogTrace("SiStripHistoryDQMService") << "[SiStripHistoryDQMService::returnDetComponent]";
25  std::string str=ME->getName();
26  size_t __key_length__=7;
27  size_t __detid_length__=9;
28 
29  uint32_t layer=0,side=0;
30 
31  if(str.find("__det__")!= std::string::npos){
32  return atoi(str.substr(str.find("__det__")+__key_length__,__detid_length__).c_str());
33  }
34  //TIB
35  else if(str.find("TIB")!= std::string::npos){
36  if (str.find("layer")!= std::string::npos)
37  layer=atoi(str.substr(str.find("layer__")+__key_length__,1).c_str());
38  return TIBDetId(layer,0,0,0,0,0).rawId();
39  }
40  //TOB
41  else if(str.find("TOB")!= std::string::npos){
42  if (str.find("layer")!= std::string::npos)
43  layer=atoi(str.substr(str.find("layer__")+__key_length__,1).c_str());
44  return TOBDetId(layer,0,0,0,0).rawId();
45  }
46  //TID
47  else if(str.find("TID")!= std::string::npos){
48  if (str.find("side")!= std::string::npos){
49  side=atoi(str.substr(str.find("_side__")+__key_length__,1).c_str());
50  if (str.find("wheel")!= std::string::npos){
51  layer=atoi(str.substr(str.find("wheel__")+__key_length__,1).c_str());
52  }
53  }
54  return TIDDetId(side,layer,0,0,0,0).rawId();
55  }
56  //TEC
57  else if(str.find("TEC")!= std::string::npos){
58  if (str.find("side")!= std::string::npos){
59  side=atoi(str.substr(str.find("_side__")+__key_length__,1).c_str());
60  if (str.find("wheel")!= std::string::npos){
61  layer=atoi(str.substr(str.find("wheel__")+__key_length__,1).c_str());
62  }
63  }
64  return TECDetId(side,layer,0,0,0,0,0).rawId();
65  }
66  else
67  return SiStripDetId(DetId::Tracker,0).rawId(); //Full Tracker
68 }
69 
70 //Example on how to define an user function for the statistic extraction
71 bool SiStripHistoryDQMService::setDBLabelsForUser (std::string& keyName, std::vector<std::string>& userDBContent, std::string& quantity){
72  if (quantity == "user_2DYmean") {
73  userDBContent.push_back(keyName+fSep+std::string("yMean"));
74  userDBContent.push_back(keyName+fSep+std::string("yError"));
75  } else {
76  edm::LogError("SiStripHistoryDQMService") << "ERROR: quantity does not exist in SiStripHistoryDQMService::setDBValuesForUser(): " << quantity;
77  return false;
78  }
79  return true;
80 }
81 bool SiStripHistoryDQMService::setDBValuesForUser(std::vector<MonitorElement*>::const_iterator iterMes, HDQMSummary::InputVector& values, std::string& quantity ){
82  if (quantity == "user_2DYmean") {
83  TH2F* Hist = (TH2F*) (*iterMes)->getTH2F();
84  values.push_back( Hist->GetMean(2) );
85  values.push_back( Hist->GetRMS(2) );
86  } else {
87  edm::LogError("SiStripHistoryDQMService") << "ERROR: quantity does not exist in SiStripHistoryDQMService::setDBValuesForUser(): " << quantity;
88  return false;
89  }
90  return true;
91 }
92 
const std::string & getName(void) const
get name of ME
uint32_t returnDetComponent(const MonitorElement *ME)
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
Definition: ME.h:11
bool setDBValuesForUser(std::vector< MonitorElement * >::const_iterator iterMes, HDQMSummary::InputVector &values, std::string &quantity)
std::vector< float > InputVector
Definition: HDQMSummary.h:62
#define LogTrace(id)
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
bool setDBLabelsForUser(std::string &keyName, std::vector< std::string > &userDBContent, std::string &quantity)
SiStripHistoryDQMService(const edm::ParameterSet &, const edm::ActivityRegistry &)