CMS 3D CMS Logo

RPCClusterSizeTest.cc
Go to the documentation of this file.
4 
7 
9  edm::LogVerbatim("rpceventsummary") << "[RPCClusterSizeTest]: Constructor";
10 
11  prescaleFactor_ = ps.getUntrackedParameter<int>("DiagnosticPrescale", 1);
12 
13  numberOfDisks_ = ps.getUntrackedParameter<int>("NumberOfEndcapDisks", 4);
14  numberOfRings_ = ps.getUntrackedParameter<int>("NumberOfEndcapRings", 2);
15  testMode_ = ps.getUntrackedParameter<bool>("testMode", false);
16  useRollInfo_ = ps.getUntrackedParameter<bool>("useRollInfo", true);
17 
18  resetMEArrays();
19 }
20 
22  edm::LogVerbatim("rpceventsummary") << "[RPCClusterSizeTest]: Begin job ";
23 
24  globalFolder_ = workingFolder;
25 }
26 
27 void RPCClusterSizeTest::getMonitorElements(std::vector<MonitorElement*>& meVector,
28  std::vector<RPCDetId>& detIdVector,
29  std::string& clientHistoName) {
30  //Get ME for each roll
31  for (unsigned int i = 0; i < meVector.size(); i++)
32  myClusterMe_.push_back(meVector[i]);
33 }
34 
36  edm::LogVerbatim("rpceventsummary") << "[RPCClusterSizeTest]:Client Operation";
37 
38  //check some statements and prescale Factor
39  if (myClusterMe_.empty())
40  return;
41 
42  MonitorElement* MEAN = nullptr; // Mean ClusterSize, Roll vs Sector
43  MonitorElement* MEAND = nullptr; // Mean ClusterSize, Distribution
44 
45  //Loop on summary histograms
46  for (unsigned int i = 0; i < myClusterMe_.size(); ++i) {
47  MonitorElement* myMe = myClusterMe_[i];
48  if (!myMe || myMe->getEntries() == 0)
49  continue;
50  std::string meName = myMe->getName();
51 
52  int xBin = 0, yBin = 0;
53  float meanCLS = 0.;
54 
55  //Barrel
56  for (int wheel = -2; wheel <= 2; wheel++) {
57  for (int sector = 1; sector <= 12; sector++) {
58  std::string tmpName = fmt::format("ClusterSize_Wheel_{}_Sector_{}", wheel, sector);
59 
60  if (tmpName == meName) {
61  MEAN = MEANWheel[wheel + 2];
62  if (testMode_) {
63  MEAND = MEANDWheel[wheel + 2];
64  }
65 
66  xBin = sector;
67  for (int yBin_ = 1; yBin_ <= myMe->getNbinsY(); yBin_++) {
68  int nbinsX = myMe->getNbinsX() - 1; //Exclude overflow
69  TH1F* h = new TH1F("h", "h", nbinsX, 0.5, 0.5 + nbinsX);
70  for (int xBin_ = 1; xBin_ <= nbinsX; xBin_++) {
71  int cl = myMe->getBinContent(xBin_, yBin_);
72  h->SetBinContent(xBin_, cl);
73  }
74  yBin = yBin_;
75 
76  meanCLS = h->GetMean();
77 
78  if (MEAN)
79  MEAN->setBinContent(xBin, yBin, meanCLS);
80 
81  if (testMode_) {
82  if (MEAND)
83  MEAND->Fill(meanCLS);
84  }
85  }
86  }
87  }
88  }
89 
90  //Endcap
91  const std::array<std::string, 4> chNames = {{"CH01-CH09", "CH10-CH18", "CH19-CH27", "CH28-CH36"}};
92 
93  for (int region = -1; region <= 1; region++) {
94  if (region == 0)
95  continue;
96 
97  for (int disk = 1; disk <= numberOfDisks_; disk++) {
98  for (int ring = 2; ring < numberOfRings_ + 2; ring++) {
99  for (unsigned int ich = 0; ich < chNames.size(); ich++) {
100  std::string tmpName = fmt::format("ClusterSize_Disk_{}_Ring_{}_{}", (region * disk), ring, chNames[ich]);
101 
102  if (tmpName == meName) {
103  xBin = (ich * 9);
104 
105  if (((disk * region) + numberOfDisks_) >= 0) {
106  if (region < 0) {
107  MEAN = MEANDisk[(disk * region) + numberOfDisks_];
108  if (testMode_) {
109  MEAND = MEANDDisk[(disk * region) + numberOfDisks_];
110  }
111  } else {
112  MEAN = MEANDisk[(disk * region) + numberOfDisks_ - 1];
113  if (testMode_) {
114  MEAND = MEANDDisk[(disk * region) + numberOfDisks_ - 1];
115  }
116  }
117  }
118 
119  for (int yBin_ = 1; yBin_ <= myMe->getNbinsY(); yBin_++) {
120  int nbinsX = myMe->getNbinsX() - 1; //Exclude overflow
121  TH1F* h = new TH1F("h", "h", nbinsX, 0.5, 0.5 + nbinsX);
122  for (int xBin_ = 1; xBin_ <= nbinsX; xBin_++) {
123  int cl = myMe->getBinContent(xBin_, yBin_);
124  h->SetBinContent(xBin_, cl);
125  }
126 
127  yBin = yBin_ - (3 * ((yBin_ - 1) / 3)) + (3 * (ring - 2));
128  if (yBin % 3 == 1)
129  xBin++;
130 
131  meanCLS = h->GetMean();
132 
133  if (MEAN)
134  MEAN->setBinContent(xBin, yBin, meanCLS);
135 
136  if (testMode_) {
137  if (MEAND)
138  MEAND->Fill(meanCLS);
139  }
140  }
141  } //name check
142  }
143  }
144  }
145  }
146  } //End loop on chambers
147 }
148 
150  memset((void*)MEANWheel, 0, sizeof(MonitorElement*) * kWheels);
151  memset((void*)MEANDWheel, 0, sizeof(MonitorElement*) * kWheels);
152 
153  memset((void*)MEANDisk, 0, sizeof(MonitorElement*) * kDisks);
154  memset((void*)MEANDDisk, 0, sizeof(MonitorElement*) * kDisks);
155 }
156 
158  resetMEArrays();
159 
161 
162  std::stringstream histoName;
163 
164  rpcdqm::utils rpcUtils;
165 
166  // Loop over wheels
167  for (int w = -2; w <= 2; w++) {
168  histoName.str("");
169  histoName << "ClusterSizeMean_Roll_vs_Sector_Wheel" << w; // Avarage ClusterSize (2D Roll vs Sector)
170  auto me = RPCRollMapHisto::bookBarrel(ibooker, w, histoName.str(), histoName.str(), useRollInfo_);
171  MEANWheel[w + 2] = dynamic_cast<MonitorElement*>(me);
172 
173  if (testMode_) {
174  histoName.str("");
175  histoName << "ClusterSizeMean_Distribution_Wheel" << w; // Avarage ClusterSize Distribution
176  MEANDWheel[w + 2] = ibooker.book1D(histoName.str().c_str(), histoName.str().c_str(), 100, 1, 11);
177  }
178  } //end loop on wheels
179 
180  for (int d = -numberOfDisks_; d <= numberOfDisks_; d++) {
181  if (d == 0)
182  continue;
183  //Endcap
184  int offset = numberOfDisks_;
185  if (d > 0)
186  offset--;
187 
188  histoName.str("");
189  histoName << "ClusterSizeMean_Ring_vs_Segment_Disk" << d; // Avarage ClusterSize (2D Roll vs Sector)
190  auto me = RPCRollMapHisto::bookEndcap(ibooker, d, histoName.str(), histoName.str(), useRollInfo_);
191  MEANDisk[d + offset] = dynamic_cast<MonitorElement*>(me);
192 
193  if (testMode_) {
194  histoName.str("");
195  histoName << "ClusterSizeMean_Distribution_Disk" << d; // Avarage ClusterSize Distribution
196  MEANDDisk[d + offset] = ibooker.book1D(histoName.str().c_str(), histoName.str().c_str(), 100, 1, 11);
197  }
198  }
199 }
Log< level::Info, true > LogVerbatim
MonitorElement * MEANWheel[kWheels]
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
T w() const
void myBooker(DQMStore::IBooker &) override
MonitorElement * MEANDWheel[kWheels]
void clientOperation() override
void beginJob(std::string &) override
T getUntrackedParameter(std::string const &, T const &) const
void Fill(long long x)
MonitorElement * MEANDisk[kDisks]
MonitorElement * MEANDDisk[kDisks]
virtual double getEntries() const
get # of entries
std::vector< MonitorElement * > myClusterMe_
d
Definition: ztail.py:151
virtual int getNbinsY() const
get # of bins in Y-axis
RPCClusterSizeTest(const edm::ParameterSet &ps)
Constructor.
static MonitorElement * bookBarrel(IBooker &booker, const int wheel, const std::string &prefix, const std::string &title, const bool useRollInfo)
const std::string & getName() const
get name of ME
virtual int getNbinsX() const
get # of bins in X-axis
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
static MonitorElement * bookEndcap(IBooker &booker, const int disk, const std::string &prefix, const std::string &title, const bool useRollInfo)
void getMonitorElements(std::vector< MonitorElement *> &, std::vector< RPCDetId > &, std::string &) override
virtual double getBinContent(int binx) const
get content of bin (1-D)