CMS 3D CMS Logo

SiStripPopConHistoryDQM.cc
Go to the documentation of this file.
5 
7 
15 {
16 public:
19  {}
20 
21  void initES(const edm::EventSetup&) override;
22 
23  ~SiStripPopConHistoryDQM() override;
24 private:
25  uint32_t returnDetComponent(const MonitorElement* ME) const override;
26  bool setDBLabelsForUser(const std::string& keyName, std::vector<std::string>& userDBContent, const std::string& quantity) const override;
27  bool setDBValuesForUser(const MonitorElement* me, HDQMSummary::InputVector& values, const std::string& quantity) const override;
28 private:
30 };
31 
33 
35 {
37  setup.get<TrackerTopologyRcd>().get(tTopo);
38  trackerTopo_ = tTopo.product();
39 }
40 
42 {
43  LogTrace("SiStripHistoryDQMService") << "[SiStripHistoryDQMService::returnDetComponent]";
44  const std::string& str{ME->getName()};
45  const size_t __key_length__=7;
46  const size_t __detid_length__=9;
47 
48  uint32_t layer=0,side=0;
49 
50  if ( str.find("__det__") != std::string::npos ) {
51  return atoi(str.substr(str.find("__det__")+__key_length__,__detid_length__).c_str());
52  }
53  //TIB
54  else if ( str.find("TIB") != std::string::npos ) {
55  if ( str.find("layer")!= std::string::npos )
56  layer = atoi(str.substr(str.find("layer__")+__key_length__,1).c_str());
57  return trackerTopo_->tibDetId(layer,0,0,0,0,0).rawId();
58  }
59  //TOB
60  else if ( str.find("TOB") != std::string::npos ) {
61  if ( str.find("layer") != std::string::npos )
62  layer = atoi(str.substr(str.find("layer__")+__key_length__,1).c_str());
63  return trackerTopo_->tobDetId(layer,0,0,0,0).rawId();
64  }
65  //TID
66  else if ( str.find("TID") != std::string::npos ) {
67  if ( str.find("side") != std::string::npos ) {
68  side = atoi(str.substr(str.find("_side__")+__key_length__,1).c_str());
69  if ( str.find("wheel") != std::string::npos ) {
70  layer = atoi(str.substr(str.find("wheel__")+__key_length__,1).c_str());
71  }
72  }
73  return trackerTopo_->tidDetId(side,layer,0,0,0,0).rawId();
74  }
75  //TEC
76  else if ( str.find("TEC") != std::string::npos ) {
77  if ( str.find("side") != std::string::npos ) {
78  side = atoi(str.substr(str.find("_side__")+__key_length__,1).c_str());
79  if ( str.find("wheel") != std::string::npos ) {
80  layer = atoi(str.substr(str.find("wheel__")+__key_length__,1).c_str());
81  }
82  }
83  return trackerTopo_->tecDetId(side,layer,0,0,0,0,0).rawId();
84  }
85  else
86  return DetId(DetId::Tracker,0).rawId(); //Full Tracker
87 }
88 
89 //Example on how to define an user function for the statistic extraction
90 bool SiStripPopConHistoryDQM::setDBLabelsForUser(const std::string& keyName, std::vector<std::string>& userDBContent, const std::string& quantity) const
91 {
92  if (quantity == "user_2DYmean") {
93  userDBContent.push_back(keyName+sep()+std::string("yMean"));
94  userDBContent.push_back(keyName+sep()+std::string("yError"));
95  } else {
96  edm::LogError("SiStripHistoryDQMService") << "ERROR: quantity does not exist in SiStripHistoryDQMService::setDBValuesForUser(): " << quantity;
97  return false;
98  }
99  return true;
100 }
101 
103 {
104  if (quantity == "user_2DYmean") {
105  TH2F* Hist = (TH2F*) me->getTH2F();
106  values.push_back( Hist->GetMean(2) );
107  values.push_back( Hist->GetRMS(2) );
108  } else {
109  edm::LogError("SiStripHistoryDQMService") << "ERROR: quantity does not exist in SiStripHistoryDQMService::setDBValuesForUser(): " << quantity;
110  return false;
111  }
112  return true;
113 }
114 
SiStripPopConHistoryDQM(const edm::ParameterSet &pset)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:47
const std::string & getName() const
get name of ME
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:1
void initES(const edm::EventSetup &) override
Definition: ME.h:11
std::vector< float > InputVector
Definition: HDQMSummary.h:62
DetId tobDetId(uint32_t layer, uint32_t rod_fw_bw, uint32_t rod, uint32_t module, uint32_t ster) const
DetId tidDetId(uint32_t side, uint32_t wheel, uint32_t ring, uint32_t module_fw_bw, uint32_t module, uint32_t ster) const
bool setDBValuesForUser(const MonitorElement *me, HDQMSummary::InputVector &values, const std::string &quantity) const override
uint32_t returnDetComponent(const MonitorElement *ME) const override
#define LogTrace(id)
TH2F * getTH2F() const
Definition: DetId.h:18
DetId tibDetId(uint32_t layer, uint32_t str_fw_bw, uint32_t str_int_ext, uint32_t str, uint32_t module, uint32_t ster) const
T get() const
Definition: EventSetup.h:63
const TrackerTopology * trackerTopo_
bool setDBLabelsForUser(const std::string &keyName, std::vector< std::string > &userDBContent, const std::string &quantity) const override
#define str(s)
DetId tecDetId(uint32_t side, uint32_t wheel, uint32_t petal_fw_bw, uint32_t petal, uint32_t ring, uint32_t module, uint32_t ster) const
T const * product() const
Definition: ESHandle.h:86