CMS 3D CMS Logo

RPCMultiplicityTest.cc
Go to the documentation of this file.
1 /*
2  * \author Anna Cimmino
3  */
6 
7 // Framework
9 //DQMServices
11 // Geometry
13 
14 #include <sstream>
15 
17 
18  edm::LogVerbatim ("multiplicity") << "[RPCMultiplicityTest]: Constructor";
19  useRollInfo_ = ps.getUntrackedParameter<bool>("UseRollInfo", false);
20  prescaleFactor_ = ps.getUntrackedParameter<int>("DiagnosticPrescale", 1);
21  numberOfDisks_ = ps.getUntrackedParameter<int>("NumberOfEndcapDisks", 4);
22  numberOfRings_ = ps.getUntrackedParameter<int>("NumberOfEndcapRings", 2);
23  testMode_ = ps.getUntrackedParameter<bool>("testMode", false);
24 
25 }
26 
28 
29 
31 
32  edm::LogVerbatim ("multiplicity") << "[RPCMultiplicityTest]: Begin job";
33  globalFolder_ = workingFolder;
34 
35 }
36 
37 
39 
40 
42 
43  std::stringstream histoName;
44  rpcdqm::utils rpcUtils;
45 
46  for (int i = -2; i<=2;i++ ){//loop on wheels and disks
47 
48  histoName.str("");
49  histoName<<"NumberOfDigi_Mean_Roll_vs_Sector_Wheel"<<i;
50 
51  MULTWheel[i+2] = ibooker.book2D(histoName.str().c_str(), histoName.str().c_str(), 12, 0.5, 12.5, 21, 0.5, 21.5);
52 
53  rpcUtils.labelXAxisSector( MULTWheel[i+2]);
54  rpcUtils.labelYAxisRoll( MULTWheel[i+2], 0, i,useRollInfo_ );
55 
56  if(testMode_){
57  histoName.str("");
58  histoName<<"NumberOfDigi_Mean_Distribution_Wheel"<<i;
59  MULTDWheel[i+2] = ibooker.book1D(histoName.str().c_str(), histoName.str().c_str(), 100, 0.5, 50.5);
60  }
61 
62  }//end wheels
63 
64  for(int d = -numberOfDisks_; d<=numberOfDisks_; d++ ){
65  if (d == 0 )continue;
66 
67  int offset = numberOfDisks_;
68  if (d>0) offset --; //used to skip case equale to zero
69 
70  histoName.str("");
71  histoName<<"NumberOfDigi_Mean_Ring_vs_Segment_Disk"<<d;
72  MULTDisk[d+offset] = ibooker.book2D(histoName.str().c_str(), histoName.str().c_str(),36, 0.5, 36.5, 3*numberOfRings_, 0.5,3*numberOfRings_+ 0.5);
73  rpcUtils.labelXAxisSegment(MULTDisk[d+offset]);
74  rpcUtils.labelYAxisRing(MULTDisk[d+offset], numberOfRings_,useRollInfo_ );
75 
76  if(testMode_){
77  histoName.str("");
78  histoName<<"NumberOfDigi_Mean_Distribution_Disk"<<d;
79  MULTDDisk[d+offset] = ibooker.book1D(histoName.str().c_str(), histoName.str().c_str(), 100, 0.5, 50.5);
80  }
81  }//end loop on wheels and disks
82 }
83 
84 
85 
86 
87 
88 
89 void RPCMultiplicityTest::getMonitorElements(std::vector<MonitorElement *> & meVector, std::vector<RPCDetId> & detIdVector, std::string & clientHistoName){
90 
91  //Get NumberOfDigi ME for each roll
92  for (unsigned int i = 0 ; i<meVector.size(); i++){
93 
94  std::string meName = meVector[i]->getName();
95 
96  if(meName.find(clientHistoName) != std::string::npos){
97  myNumDigiMe_.push_back(meVector[i]);
98  myDetIds_.push_back(detIdVector[i]);
99  }
100  }
101 }
102 
103 
104 
106 
107  edm::LogVerbatim ("multiplicity") <<"[RPCMultiplicityTest]: Client Operation";
108 
109  //Loop on MEs
110  for (unsigned int i = 0 ; i<myNumDigiMe_.size();i++){
112  }//End loop on MEs
113 }
114 
115 
116 
117 
119 
120  MonitorElement * MULT =nullptr;
121  MonitorElement * MULTD = nullptr;
122 
123  if (detId.region()==0) {
124  MULT = MULTWheel[detId.ring()+2];
125  if(testMode_) { MULTD = MULTDWheel[detId.ring()+2];}
126  }else{
127  if(-detId.station() + numberOfDisks_ >= 0 ){
128 
129  if(detId.region()<0){
130  MULT = MULTDisk[-detId.station() + numberOfDisks_];
131  if(testMode_) { MULTD = MULTDDisk[-detId.station()+ numberOfDisks_];}
132  }else{
133  MULT = MULTDisk[detId.station()+ numberOfDisks_ -1];
134  if(testMode_) { MULTD = MULTDDisk[detId.station()+ numberOfDisks_-1];}
135  }
136  }
137  }
138 
139  int xBin,yBin;
140  if(detId.region()==0){//Barrel
141  xBin= detId.sector();
142  rpcdqm::utils rollNumber;
143  yBin = rollNumber.detId2RollNr(detId);
144  }else{//Endcap
145  //get segment number
146  RPCGeomServ RPCServ(detId);
147  xBin = RPCServ.segment();
148  (numberOfRings_ == 3 ? yBin= detId.ring()*3-detId.roll()+1 : yBin= (detId.ring()-1)*3-detId.roll()+1);
149  }
150 
151  float mean = myMe->getMean();
152 
153  if(MULT) {MULT->setBinContent(xBin,yBin, mean );}
154  if(testMode_ && MULTD) {MULTD->Fill(mean);}
155 
156 }
T getUntrackedParameter(std::string const &, T const &) const
void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * MULTDDisk[10]
MonitorElement * MULTDisk[10]
void labelXAxisSegment(MonitorElement *myMe)
Definition: utils.h:264
void labelYAxisRoll(MonitorElement *myMe, int region, int ring, bool useRollInfo)
Definition: utils.h:283
RPCMultiplicityTest(const edm::ParameterSet &ps)
Constructor.
double getMean(int axis=1) const
get mean value of histogram along x, y or z axis (axis=1, 2, 3 respectively)
void getMonitorElements(std::vector< MonitorElement * > &, std::vector< RPCDetId > &, std::string &) override
void Fill(long long x)
void labelYAxisRing(MonitorElement *myMe, int numberOfRings, bool useRollInfo)
Definition: utils.h:311
int roll() const
Definition: RPCDetId.h:120
int ring() const
Definition: RPCDetId.h:72
void fillGlobalME(RPCDetId &detId, MonitorElement *myMe)
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:118
MonitorElement * MULTDWheel[5]
MonitorElement * MULTWheel[5]
void labelXAxisSector(MonitorElement *myMe)
Definition: utils.h:249
void clientOperation() override
~RPCMultiplicityTest() override
Destructor.
void myBooker(DQMStore::IBooker &) override
virtual int segment()
Definition: RPCGeomServ.cc:469
int detId2RollNr(const RPCDetId &_id)
Definition: utils.h:31
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:279
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:136
void beginJob(std::string &) override
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
Definition: RPCDetId.h:102
std::vector< RPCDetId > myDetIds_
yBin
Definition: cuy.py:891
std::vector< MonitorElement * > myNumDigiMe_
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:63
int station() const
Definition: RPCDetId.h:96