CMS 3D CMS Logo

RPCOccupancyTest.cc
Go to the documentation of this file.
1 /* \author Anna Cimmino*/
5 
6 // Framework
8 //Geometry
10 
12  edm::LogVerbatim("rpceventsummary") << "[RPCOccupancyTest]: Constructor";
13 
14  prescaleFactor_ = ps.getUntrackedParameter<int>("DiagnosticPrescale", 1);
15  numberOfDisks_ = ps.getUntrackedParameter<int>("NumberOfEndcapDisks", 4);
16  numberOfRings_ = ps.getUntrackedParameter<int>("NumberOfEndcapRings", 2);
17  useNormalization_ = ps.getUntrackedParameter<bool>("testMode", true);
18  useRollInfo_ = ps.getUntrackedParameter<bool>("useRollInfo_", false);
19 
20  std::string subsystemFolder = ps.getUntrackedParameter<std::string>("RPCFolder", "RPC");
21  std::string recHitTypeFolder = ps.getUntrackedParameter<std::string>("RecHitTypeFolder", "AllHits");
22 
23  prefixDir_ = subsystemFolder + "/" + recHitTypeFolder;
24 }
25 
27  edm::LogVerbatim("rpceventsummary") << "[RPCOccupancyTest]: Begin job ";
28  globalFolder_ = workingFolder;
29 
30  totalStrips_ = 0.;
31  totalActive_ = 0.;
32 }
33 
34 void RPCOccupancyTest::getMonitorElements(std::vector<MonitorElement*>& meVector,
35  std::vector<RPCDetId>& detIdVector,
36  std::string& clientHistoName) {
37  //Get NumberOfDigi ME for each roll
38  for (unsigned int i = 0; i < meVector.size(); i++) {
39  std::string meName = meVector[i]->getName();
40 
41  if (meName.find(clientHistoName) != std::string::npos) {
42  myOccupancyMe_.push_back(meVector[i]);
43  myDetIds_.push_back(detIdVector[i]);
44  }
45  }
46 }
47 
49  edm::LogVerbatim("rpceventsummary") << "[RPCOccupancyTest]: Client Operation";
50 
51  //Loop on MEs
52  for (unsigned int i = 0; i < myOccupancyMe_.size(); i++) {
54  } //End loop on MEs
55 
56  //Active Channels
57  if (Active_Fraction && totalStrips_ != 0.) {
59  }
60  if (Active_Dead) {
63  }
64 }
65 
68 
69  std::stringstream histoName;
70 
71  histoName.str("");
72  histoName << "RPC_Active_Channel_Fractions";
73  Active_Fraction = ibooker.book1D(histoName.str().c_str(), histoName.str().c_str(), 1, 0.5, 1.5);
74  Active_Fraction->setBinLabel(1, "Active Fraction", 1);
75 
76  histoName.str("");
77  histoName << "RPC_Active_Inactive_Strips";
78  Active_Dead = ibooker.book1D(histoName.str().c_str(), histoName.str().c_str(), 2, 0.5, 2.5);
79  Active_Dead->setBinLabel(1, "Active Strips", 1);
80  Active_Dead->setBinLabel(2, "Inactive Strips", 1);
81 
82  for (int w = -2; w <= 2; w++) { //loop on wheels
83 
84  histoName.str("");
85  histoName << "AsymmetryLeftRight_Roll_vs_Sector_Wheel" << w;
86 
87  auto me = RPCRollMapHisto::bookBarrel(ibooker, w, histoName.str(), histoName.str(), useRollInfo_);
88  AsyMeWheel[w + 2] = dynamic_cast<MonitorElement*>(me);
89  } //end Barrel
90 
91  for (int d = -numberOfDisks_; d <= numberOfDisks_; d++) {
92  if (d == 0)
93  continue;
94 
95  int offset = numberOfDisks_;
96  if (d > 0)
97  offset--; //used to skip case equale to zero
98 
99  histoName.str("");
100  histoName << "AsymmetryLeftRight_Ring_vs_Segment_Disk" << d;
101  auto me = RPCRollMapHisto::bookEndcap(ibooker, d, histoName.str(), histoName.str(), useRollInfo_);
102  AsyMeDisk[d + offset] = dynamic_cast<MonitorElement*>(me);
103  } //End loop on Endcap
104 }
105 
107  if (!myMe)
108  return;
109 
110  MonitorElement* AsyMe = nullptr; //Left Right Asymetry
111 
112  if (detId.region() == 0) {
113  AsyMe = AsyMeWheel[detId.ring() + 2];
114 
115  } else {
116  if (-detId.station() + numberOfDisks_ >= 0) {
117  if (detId.region() < 0) {
118  AsyMe = AsyMeDisk[-detId.station() + numberOfDisks_];
119  } else {
120  AsyMe = AsyMeDisk[detId.station() + numberOfDisks_ - 1];
121  }
122  }
123  }
124 
125  int xBin, yBin;
126  if (detId.region() == 0) { //Barrel
127  xBin = detId.sector();
128  rpcdqm::utils rollNumber;
129  yBin = rollNumber.detId2RollNr(detId);
130  } else { //Endcap
131  //get segment number
132  RPCGeomServ RPCServ(detId);
133  xBin = RPCServ.segment();
134  (numberOfRings_ == 3 ? yBin = detId.ring() * 3 - detId.roll() + 1
135  : yBin = (detId.ring() - 1) * 3 - detId.roll() + 1);
136  }
137 
138  int stripInRoll = myMe->getNbinsX();
139  totalStrips_ += (float)stripInRoll;
140  float FOccupancy = 0;
141  float BOccupancy = 0;
142 
143  float totEnt = myMe->getEntries();
144  for (int strip = 1; strip <= stripInRoll; strip++) {
145  float stripEntries = myMe->getBinContent(strip);
146  if (stripEntries > 0) {
147  totalActive_++;
148  }
149  if (strip <= stripInRoll / 2) {
150  FOccupancy += myMe->getBinContent(strip);
151  } else {
152  BOccupancy += myMe->getBinContent(strip);
153  }
154  }
155 
156  float asym = 0;
157  if (totEnt != 0)
158  asym = fabs((FOccupancy - BOccupancy) / totEnt);
159 
160  if (AsyMe)
161  AsyMe->setBinContent(xBin, yBin, asym);
162 }
RPCRollMapHisto::bookBarrel
static MonitorElement * bookBarrel(IBooker &booker, const int wheel, const std::string &prefix, const std::string &title, const bool useRollInfo)
Definition: RPCRollMapHisto.cc:8
RPCOccupancyTest::useRollInfo_
bool useRollInfo_
Definition: RPCOccupancyTest.h:29
RPCOccupancyTest::Active_Dead
MonitorElement * Active_Dead
Definition: RPCOccupancyTest.h:41
mps_fire.i
i
Definition: mps_fire.py:428
RPCGeomServ
Definition: RPCGeomServ.h:8
MessageLogger.h
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
RPCDetId::station
int station() const
Definition: RPCDetId.h:78
RPCDetId::region
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:53
photonAnalyzer_cfi.xBin
xBin
Definition: photonAnalyzer_cfi.py:81
RPCOccupancyTest::globalFolder_
std::string globalFolder_
Definition: RPCOccupancyTest.h:27
RPCOccupancyTest::totalActive_
float totalActive_
Definition: RPCOccupancyTest.h:34
RPCOccupancyTest::prefixDir_
std::string prefixDir_
Definition: RPCOccupancyTest.h:27
utils.h
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
RPCOccupancyTest::numberOfDisks_
int numberOfDisks_
Definition: RPCOccupancyTest.h:36
RPCDetId
Definition: RPCDetId.h:16
RPCOccupancyTest::useNormalization_
bool useNormalization_
Definition: RPCOccupancyTest.h:28
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
RPCOccupancyTest::myBooker
void myBooker(DQMStore::IBooker &) override
Definition: RPCOccupancyTest.cc:66
RPCOccupancyTest::RPCOccupancyTest
RPCOccupancyTest(const edm::ParameterSet &ps)
Definition: RPCOccupancyTest.cc:11
RPCOccupancyTest::totalStrips_
float totalStrips_
Definition: RPCOccupancyTest.h:34
dqm::legacy::MonitorElement
Definition: MonitorElement.h:462
photonAnalyzer_cfi.yBin
yBin
Definition: photonAnalyzer_cfi.py:85
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
RPCOccupancyTest::fillGlobalME
void fillGlobalME(RPCDetId &, MonitorElement *)
Definition: RPCOccupancyTest.cc:106
RPCOccupancyTest::myOccupancyMe_
std::vector< MonitorElement * > myOccupancyMe_
Definition: RPCOccupancyTest.h:30
RPCGeomServ.h
RPCRollMapHisto::bookEndcap
static MonitorElement * bookEndcap(IBooker &booker, const int disk, const std::string &prefix, const std::string &title, const bool useRollInfo)
Definition: RPCRollMapHisto.cc:81
RPCOccupancyTest::getMonitorElements
void getMonitorElements(std::vector< MonitorElement * > &, std::vector< RPCDetId > &, std::string &) override
Definition: RPCOccupancyTest.cc:34
rpcdqm::utils
Definition: utils.h:29
RPCOccupancyTest::beginJob
void beginJob(std::string &) override
Definition: RPCOccupancyTest.cc:26
w
const double w
Definition: UKUtility.cc:23
RPCOccupancyTest.h
RPCRollMapHisto.h
dqm::impl::MonitorElement::getEntries
virtual double getEntries() const
get # of entries
Definition: MonitorElement.cc:619
RPCDetId::roll
int roll() const
Definition: RPCDetId.h:92
edm::ParameterSet
Definition: ParameterSet.h:47
RPCOccupancyTest::clientOperation
void clientOperation() override
Definition: RPCOccupancyTest.cc:48
RPCOccupancyTest::AsyMeWheel
MonitorElement * AsyMeWheel[5]
Definition: RPCOccupancyTest.h:43
dqm::impl::MonitorElement::setBinLabel
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
Definition: MonitorElement.cc:762
RPCOccupancyTest::prescaleFactor_
int prescaleFactor_
Definition: RPCOccupancyTest.h:32
rpcdqm::utils::detId2RollNr
int detId2RollNr(const RPCDetId &_id)
Definition: utils.h:31
RPCOccupancyTest::Active_Fraction
MonitorElement * Active_Fraction
Definition: RPCOccupancyTest.h:40
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
RPCDetId::ring
int ring() const
Definition: RPCDetId.h:59
RPCGeomServ::segment
virtual int segment()
Definition: RPCGeomServ.cc:361
dqm::impl::MonitorElement::setBinContent
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
Definition: MonitorElement.cc:682
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
dqm::impl::MonitorElement::getNbinsX
virtual int getNbinsX() const
get # of bins in X-axis
Definition: MonitorElement.cc:565
RPCDetId::sector
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
Definition: RPCDetId.h:81
HltBtagPostValidation_cff.histoName
histoName
Definition: HltBtagPostValidation_cff.py:17
dqm::implementation::IBooker
Definition: DQMStore.h:43
ztail.d
d
Definition: ztail.py:151
hlt_dqm_clientPB-live_cfg.me
me
Definition: hlt_dqm_clientPB-live_cfg.py:61
RPCOccupancyTest::AsyMeDisk
MonitorElement * AsyMeDisk[10]
Definition: RPCOccupancyTest.h:47
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
dqm::impl::MonitorElement::getBinContent
virtual double getBinContent(int binx) const
get content of bin (1-D)
Definition: MonitorElement.cc:583
RPCOccupancyTest::numberOfRings_
int numberOfRings_
Definition: RPCOccupancyTest.h:36
RPCOccupancyTest::myDetIds_
std::vector< RPCDetId > myDetIds_
Definition: RPCOccupancyTest.h:31
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98