test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RPCDBPopConAnalyzer.cc
Go to the documentation of this file.
22 
23 //typedef popcon::PopConAnalyzer<RPCDBHandler> RPCDBPopConAnalyzer;
24 
25 class RPCDBPopConAnalyzer: public popcon::PopConAnalyzer<RPCDBHandler>
26 {
27 public:
29 
31  popcon::PopConAnalyzer<RPCDBHandler>(pset),
32  m_populator(pset),
33  m_source(pset.getParameter<edm::ParameterSet>("Source")) {
34  subsystemFolder_= pset.getUntrackedParameter<std::string>("RPCFolder", "RPC");
35  recHitTypeFolder_= pset.getUntrackedParameter<std::string>("RecHitTypeFolder", "Noise");
36  summaryFolder_= pset.getUntrackedParameter<std::string>("SummaryFolder", "SummaryHistograms");
37  efficiencyFolder_= pset.getUntrackedParameter<std::string>("EfficiencyFolder", "RPCEfficiency");
38  }
39 
40 private:
41  virtual void endJob() override
42  {
44  write();
45  dbe =0;
46  }
47 
48  virtual void beginRun(const edm::Run& run, const edm::EventSetup& iSetup) override{
50  dbe->setCurrentFolder("RPCPVT");
51  }//beginRun
52 
53 
54  virtual void analyze(const edm::Event& ev, const edm::EventSetup& iSetup) override{ //}
55 
56  //virtual void endRun(const edm::Run& r, const edm::EventSetup& iSetup){
57 
58  rpcDQMObject = new RPCDQMObject();
59  RPCDQMObject::DQMObjectItem rpcDqmItem;
60 
62  iSetup.get<MuonGeometryRecord>().get(rpcGeo);
63  //Loop on RPC geometry to access ME for each roll
64 
66  rpcdqm::utils rpcUtils;
67 
68  for (TrackingGeometry::DetContainer::const_iterator it=rpcGeo->dets().begin();it<rpcGeo->dets().end();it++){
69  if(dynamic_cast< const RPCChamber* >( *it ) != 0 ){
70  const RPCChamber* ch = dynamic_cast< const RPCChamber* >( *it );
71  std::vector< const RPCRoll*> roles = (ch->rolls());
72  for(std::vector<const RPCRoll*>::const_iterator r = roles.begin();r != roles.end(); ++r){
73 
74  //Get RPC DetId
75  RPCDetId rpcId = (*r)->id();
76 
77  //Check if rpcId is Valid. If not continue;
78 
79  //Get roll name
80  RPCGeomServ rpcsrv(rpcId);
81  std::string nameRoll = rpcsrv.name();
82 
83  //Get ME
84  std::stringstream mepath;
85  mepath.str("");
86  // mepath<<"RPCPVT";
87  MonitorElement * MEnumcls = dbe->get(subsystemFolder_ + "/" + recHitTypeFolder_ + "/" + folderStr->folderStructure(rpcId) + "/" + "NumberOfClusters_" + nameRoll);
88  MonitorElement * MEcls = dbe->get(subsystemFolder_ + "/" + recHitTypeFolder_ + "/" + folderStr->folderStructure(rpcId) + "/" + "ClusterSize_" + nameRoll);
89  MonitorElement * MEocc= dbe->get(subsystemFolder_ + "/" + recHitTypeFolder_ + "/" + folderStr->folderStructure(rpcId) + "/" + "Occupancy_" + nameRoll);
90  MonitorElement * MEbx = dbe->get(subsystemFolder_ + "/" + recHitTypeFolder_ + "/" + folderStr->folderStructure(rpcId) + "/" + "BXN_" + nameRoll);
91 
92  MonitorElement * MEstatus = NULL;
93  MonitorElement * MEeff = NULL;
94  rpcDqmItem.status = -999;
95  rpcDqmItem.efficiency= -999;
96 
97  if( rpcId.region() == 0){ //BARREL
98 
99  int nr = rpcUtils.detId2RollNr(rpcId);
100  int sector = (int)rpcId.sector();
101 
102  //Status
103  mepath.str("");
104  mepath<<subsystemFolder_<<"/" << recHitTypeFolder_<<"/" << summaryFolder_<<"/RPCChamberQuality_Roll_vs_Sector_Wheel"<<rpcId.ring();
105  MEstatus = dbe->get(mepath.str());
106  if(MEstatus != 0 ){
107  rpcDqmItem.status = MEstatus->getBinContent(sector, nr);
108  }else{
109  edm::LogWarning("rpcdbclient")<< "[RPCDBClient] Did not find Status for Barrel "<< nameRoll;
110  }
111 
112  //Efficiency
113  mepath.str("");
114  if( rpcId.ring() > 0){
115  mepath<<subsystemFolder_<<"/" << efficiencyFolder_<<"/Efficiency_Roll_vs_Sector_Wheel_+"<<rpcId.ring();
116  }else{
117  mepath<<subsystemFolder_<<"/" << efficiencyFolder_<<"/Efficiency_Roll_vs_Sector_Wheel_"<<rpcId.ring();
118  }
119 
120  MEeff = dbe->get(mepath.str());
121  if(MEeff != 0 ){
122  rpcDqmItem.efficiency = MEeff->getBinContent(sector, nr);
123  }else{
124  edm::LogWarning("rpcdbclient")<< "[RPCDBClient] Did not find Efficiency for Barrel "<< nameRoll;
125  }
126 
127 
128  }else{
129  int segment = rpcsrv.segment() ;
130  int endcapbin = (rpcId.ring()-1)*3-rpcId.roll()+1;
131  int disk = (rpcId.region() * rpcId.layer());
132 
133  //Status
134  mepath.str("");
135  mepath<<subsystemFolder_<<"/" << recHitTypeFolder_<<"/" << summaryFolder_<<"/RPCChamberQuality_Ring_vs_Segment_Disk"<<disk;
136  MEstatus = dbe->get(mepath.str());
137  if(MEstatus != 0 ){
138  rpcDqmItem.status = MEstatus->getBinContent(segment,endcapbin);
139  }else{
140  edm::LogWarning("rpcdbclient")<< "[RPCDBClient] Did not find Status for Endcap "<< nameRoll;
141  }
142 
143 
144  //Efficiency
145  mepath.str("");
146  mepath<<subsystemFolder_<<"/" << efficiencyFolder_<<"/Efficiency_Roll_vs_Segment_Disk_"<<disk;
147  MEeff = dbe->get(mepath.str());
148  if(MEeff != 0 ){
149  rpcDqmItem.efficiency = MEeff->getBinContent(segment,endcapbin);
150  }else{
151  edm::LogWarning("rpcdbclient")<< "[RPCDBClient] Did not find Efficiency for Endcap "<< nameRoll;
152  }
153 
154 
155  }
156 
157  rpcDqmItem.dpid = (int)rpcId;
158  rpcDqmItem.clusterSize = -999;
159  rpcDqmItem.numdigi = -999;
160  rpcDqmItem.numcluster =-999;
161  rpcDqmItem.bx = -999;
162  rpcDqmItem.bxrms = -999;
163  //rpcDqmItem.status = -999;
164 
165  if (MEnumcls != 0) {
166  rpcDqmItem.numcluster = (float)MEnumcls->getMean();
167  }else{
168  edm::LogWarning("rpcdbclient")<< "[RPCDBClient] Did not find Number of Clusters for Roll "<< nameRoll;
169  }
170 
171  if (MEcls != 0) {
172  rpcDqmItem.clusterSize = (float)MEcls->getMean();
173  }else{
174  edm::LogWarning("rpcdbclient")<< "[RPCDBClient] Did not find ClusterSize for Roll "<< nameRoll;
175  }
176 
177  if (MEbx != 0) {
178  rpcDqmItem.bx = (float)MEbx->getMean();
179  rpcDqmItem.bxrms = (float)MEbx->getRMS();
180  }else{
181  edm::LogWarning("rpcdbclient")<< "[RPCDBClient] Did not find BX for Roll "<< nameRoll;
182  }
183 
184  if (MEocc != 0) {
185  rpcDqmItem.numdigi = (float)MEocc->getEntries();
186  }else{
187  edm::LogWarning("rpcdbclient")<< "[RPCDBClient] Did not find Occupancy for Roll "<< nameRoll;
188  }
189 
190 
191 
192  (rpcDQMObject->v_cls).push_back(rpcDqmItem);
193  }//End loop Rolls
194  }
195  }//End loop RPC Geometry
196 
197  }
198 
200 
201 private:
204 
211 
212 };
213 
215 
T getUntrackedParameter(std::string const &, T const &) const
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
std::vector< DQMObjectItem > v_cls
Definition: RPCDQMObject.h:39
#define NULL
Definition: scimark2.h:8
bool ev
double getEntries(void) const
get # of entries
double getMean(int axis=1) const
get mean value of histogram along x, y or z axis (axis=1, 2, 3 respectively)
void write(Source const &source)
Definition: PopCon.h:117
virtual std::string name()
Definition: RPCGeomServ.cc:20
int roll() const
Definition: RPCDetId.h:120
int ring() const
Definition: RPCDetId.h:72
const std::vector< const RPCRoll * > & rolls() const
Return the Rolls.
Definition: RPCChamber.cc:68
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1708
virtual void beginRun(const edm::Run &run, const edm::EventSetup &iSetup) override
RPCDBPopConAnalyzer(const edm::ParameterSet &pset)
int layer() const
Definition: RPCDetId.h:108
virtual int segment()
Definition: RPCGeomServ.cc:467
int detId2RollNr(const RPCDetId &_id)
Definition: utils.h:18
std::string folderStructure(RPCDetId detId)
const T & get() const
Definition: EventSetup.h:55
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
Definition: RPCDetId.h:102
double getBinContent(int binx) const
get content of bin (1-D)
double getRMS(int axis=1) const
get RMS of histogram along x, y or z axis (axis=1, 2, 3 respectively)
void initObject(RPCDQMObject *)
Definition: RPCDBHandler.cc:32
virtual void endJob() override
PopConAnalyzer(const edm::ParameterSet &pset)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:667
virtual void analyze(const edm::Event &ev, const edm::EventSetup &iSetup) override
Definition: Run.h:41
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:63