CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
RPCClusterSizeTest Class Reference

#include <RPCClusterSizeTest.h>

Inheritance diagram for RPCClusterSizeTest:
RPCClient

Public Member Functions

void beginJob (std::string &) override
 
void clientOperation () override
 
void getMonitorElements (std::vector< MonitorElement *> &, std::vector< RPCDetId > &, std::string &) override
 
void myBooker (DQMStore::IBooker &) override
 
 RPCClusterSizeTest (const edm::ParameterSet &ps)
 Constructor. More...
 
 ~RPCClusterSizeTest () override=default
 Destructor. More...
 
- Public Member Functions inherited from RPCClient
virtual ~RPCClient (void)
 

Private Types

enum  MEArraySizes { kWheels = 5, kDisks = 10 }
 

Private Member Functions

void resetMEArrays (void)
 

Private Attributes

std::string globalFolder_
 
MonitorElementMEANDDisk [kDisks]
 
MonitorElementMEANDisk [kDisks]
 
MonitorElementMEANDWheel [kWheels]
 
MonitorElementMEANWheel [kWheels]
 
std::vector< MonitorElement * > myClusterMe_
 
std::vector< RPCDetIdmyDetIds_
 
int numberOfDisks_
 
int numberOfRings_
 
int prescaleFactor_
 
bool testMode_
 
bool useRollInfo_
 

Additional Inherited Members

- Public Types inherited from RPCClient
typedef dqm::harvesting::DQMStore DQMStore
 
typedef dqm::harvesting::MonitorElement MonitorElement
 

Detailed Description

Definition at line 10 of file RPCClusterSizeTest.h.

Member Enumeration Documentation

◆ MEArraySizes

Enumerator
kWheels 
kDisks 

Definition at line 31 of file RPCClusterSizeTest.h.

Constructor & Destructor Documentation

◆ RPCClusterSizeTest()

RPCClusterSizeTest::RPCClusterSizeTest ( const edm::ParameterSet ps)

Constructor.

Definition at line 8 of file RPCClusterSizeTest.cc.

References edm::ParameterSet::getUntrackedParameter(), numberOfDisks_, numberOfRings_, prescaleFactor_, resetMEArrays(), testMode_, and useRollInfo_.

8  {
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 }
Log< level::Info, true > LogVerbatim
T getUntrackedParameter(std::string const &, T const &) const

◆ ~RPCClusterSizeTest()

RPCClusterSizeTest::~RPCClusterSizeTest ( )
overridedefault

Destructor.

Member Function Documentation

◆ beginJob()

void RPCClusterSizeTest::beginJob ( std::string &  workingFolder)
overridevirtual

Implements RPCClient.

Definition at line 21 of file RPCClusterSizeTest.cc.

References globalFolder_.

21  {
22  edm::LogVerbatim("rpceventsummary") << "[RPCClusterSizeTest]: Begin job ";
23 
24  globalFolder_ = workingFolder;
25 }
Log< level::Info, true > LogVerbatim

◆ clientOperation()

void RPCClusterSizeTest::clientOperation ( )
overridevirtual

Implements RPCClient.

Definition at line 35 of file RPCClusterSizeTest.cc.

References haddnano::cl, dqm::impl::MonitorElement::Fill(), dqm-mbProfile::format, dqm::impl::MonitorElement::getBinContent(), dqm::impl::MonitorElement::getEntries(), dqm::impl::MonitorElement::getName(), dqm::impl::MonitorElement::getNbinsX(), dqm::impl::MonitorElement::getNbinsY(), h, mps_fire::i, PVValHelper::MEAN, MEANDDisk, MEANDisk, MEANDWheel, MEANWheel, myClusterMe_, hlt_dqm_clientPB-live_cfg::nbinsX, numberOfDisks_, numberOfRings_, nano_mu_digi_cff::region, relativeConstraints::ring, nano_mu_digi_cff::sector, AlCaHLTBitMon_QueryRunRegistry::string, testMode_, makeMuonMisalignmentScenario::wheel, photonAnalyzer_cfi::xBin, and photonAnalyzer_cfi::yBin.

35  {
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 }
Log< level::Info, true > LogVerbatim
MonitorElement * MEANWheel[kWheels]
MonitorElement * MEANDWheel[kWheels]
void Fill(long long x)
MonitorElement * MEANDisk[kDisks]
MonitorElement * MEANDDisk[kDisks]
virtual double getEntries() const
get # of entries
std::vector< MonitorElement * > myClusterMe_
virtual int getNbinsY() const
get # of bins in Y-axis
const std::string & getName() const
get name of ME
virtual int getNbinsX() const
get # of bins in X-axis
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
virtual double getBinContent(int binx) const
get content of bin (1-D)

◆ getMonitorElements()

void RPCClusterSizeTest::getMonitorElements ( std::vector< MonitorElement *> &  meVector,
std::vector< RPCDetId > &  detIdVector,
std::string &  clientHistoName 
)
overridevirtual

Implements RPCClient.

Definition at line 27 of file RPCClusterSizeTest.cc.

References mps_fire::i, and myClusterMe_.

29  {
30  //Get ME for each roll
31  for (unsigned int i = 0; i < meVector.size(); i++)
32  myClusterMe_.push_back(meVector[i]);
33 }
std::vector< MonitorElement * > myClusterMe_

◆ myBooker()

void RPCClusterSizeTest::myBooker ( DQMStore::IBooker ibooker)
overridevirtual

Implements RPCClient.

Definition at line 157 of file RPCClusterSizeTest.cc.

References dqm::implementation::IBooker::book1D(), RPCRollMapHisto::bookBarrel(), RPCRollMapHisto::bookEndcap(), ztail::d, globalFolder_, HltBtagPostValidation_cff::histoName, hlt_dqm_clientPB-live_cfg::me, MEANDDisk, MEANDisk, MEANDWheel, MEANWheel, numberOfDisks_, hltrates_dqm_sourceclient-live_cfg::offset, resetMEArrays(), dqm::implementation::NavigatorBase::setCurrentFolder(), testMode_, useRollInfo_, and w().

157  {
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 }
MonitorElement * MEANWheel[kWheels]
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
T w() const
MonitorElement * MEANDWheel[kWheels]
MonitorElement * MEANDisk[kDisks]
MonitorElement * MEANDDisk[kDisks]
d
Definition: ztail.py:151
static MonitorElement * bookBarrel(IBooker &booker, const int wheel, const std::string &prefix, const std::string &title, const bool useRollInfo)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
static MonitorElement * bookEndcap(IBooker &booker, const int disk, const std::string &prefix, const std::string &title, const bool useRollInfo)

◆ resetMEArrays()

void RPCClusterSizeTest::resetMEArrays ( void  )
private

Definition at line 149 of file RPCClusterSizeTest.cc.

References kDisks, kWheels, MEANDDisk, MEANDisk, MEANDWheel, and MEANWheel.

Referenced by myBooker(), and RPCClusterSizeTest().

149  {
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 }
MonitorElement * MEANWheel[kWheels]
MonitorElement * MEANDWheel[kWheels]
MonitorElement * MEANDisk[kDisks]
MonitorElement * MEANDDisk[kDisks]

Member Data Documentation

◆ globalFolder_

std::string RPCClusterSizeTest::globalFolder_
private

Definition at line 23 of file RPCClusterSizeTest.h.

Referenced by beginJob(), and myBooker().

◆ MEANDDisk

MonitorElement* RPCClusterSizeTest::MEANDDisk[kDisks]
private

Definition at line 37 of file RPCClusterSizeTest.h.

Referenced by clientOperation(), myBooker(), and resetMEArrays().

◆ MEANDisk

MonitorElement* RPCClusterSizeTest::MEANDisk[kDisks]
private

Definition at line 36 of file RPCClusterSizeTest.h.

Referenced by clientOperation(), myBooker(), and resetMEArrays().

◆ MEANDWheel

MonitorElement* RPCClusterSizeTest::MEANDWheel[kWheels]
private

Definition at line 34 of file RPCClusterSizeTest.h.

Referenced by clientOperation(), myBooker(), and resetMEArrays().

◆ MEANWheel

MonitorElement* RPCClusterSizeTest::MEANWheel[kWheels]
private

Definition at line 33 of file RPCClusterSizeTest.h.

Referenced by clientOperation(), myBooker(), and resetMEArrays().

◆ myClusterMe_

std::vector<MonitorElement *> RPCClusterSizeTest::myClusterMe_
private

Definition at line 29 of file RPCClusterSizeTest.h.

Referenced by clientOperation(), and getMonitorElements().

◆ myDetIds_

std::vector<RPCDetId> RPCClusterSizeTest::myDetIds_
private

Definition at line 30 of file RPCClusterSizeTest.h.

◆ numberOfDisks_

int RPCClusterSizeTest::numberOfDisks_
private

Definition at line 24 of file RPCClusterSizeTest.h.

Referenced by clientOperation(), myBooker(), and RPCClusterSizeTest().

◆ numberOfRings_

int RPCClusterSizeTest::numberOfRings_
private

Definition at line 25 of file RPCClusterSizeTest.h.

Referenced by clientOperation(), and RPCClusterSizeTest().

◆ prescaleFactor_

int RPCClusterSizeTest::prescaleFactor_
private

Definition at line 26 of file RPCClusterSizeTest.h.

Referenced by RPCClusterSizeTest().

◆ testMode_

bool RPCClusterSizeTest::testMode_
private

Definition at line 27 of file RPCClusterSizeTest.h.

Referenced by clientOperation(), myBooker(), and RPCClusterSizeTest().

◆ useRollInfo_

bool RPCClusterSizeTest::useRollInfo_
private

Definition at line 28 of file RPCClusterSizeTest.h.

Referenced by myBooker(), and RPCClusterSizeTest().