00001
00012 #include <FWCore/Framework/interface/Frameworkfwd.h>
00013 #include <FWCore/Framework/interface/EDAnalyzer.h>
00014 #include <FWCore/Framework/interface/Event.h>
00015 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00016 #include "FWCore/ServiceRegistry/interface/Service.h"
00017
00018 #include "DQMServices/Core/interface/DQMStore.h"
00019 #include "DQMServices/Core/interface/MonitorElement.h"
00020
00021 #include <DataFormats/MuonDetId/interface/RPCDetId.h>
00022 #include "FWCore/Framework/interface/ESHandle.h"
00023 #include <Geometry/RPCGeometry/interface/RPCGeometry.h>
00024 #include <Geometry/DTGeometry/interface/DTGeometry.h>
00025 #include <Geometry/CSCGeometry/interface/CSCGeometry.h>
00026
00027 #include<string>
00028 #include<map>
00029 #include<fstream>
00030
00031 class RPCDetId;
00032 class TFile;
00033 class TH1F;
00034 class TFile;
00035 class TCanvas;
00036 class TH2F;
00037 class TString;
00038
00039
00040 class DTStationIndex{
00041 public:
00042 DTStationIndex():_region(0),_wheel(0),_sector(0),_station(0){}
00043 DTStationIndex(int region, int wheel, int sector, int station) :
00044 _region(region),
00045 _wheel(wheel),
00046 _sector(sector),
00047 _station(station){}
00048 ~DTStationIndex(){}
00049 int region() const {return _region;}
00050 int wheel() const {return _wheel;}
00051 int sector() const {return _sector;}
00052 int station() const {return _station;}
00053 bool operator<(const DTStationIndex& dtind) const{
00054 if(dtind.region()!=this->region())
00055 return dtind.region()<this->region();
00056 else if(dtind.wheel()!=this->wheel())
00057 return dtind.wheel()<this->wheel();
00058 else if(dtind.sector()!=this->sector())
00059 return dtind.sector()<this->sector();
00060 else if(dtind.station()!=this->station())
00061 return dtind.station()<this->station();
00062 return false;
00063 }
00064 private:
00065 int _region;
00066 int _wheel;
00067 int _sector;
00068 int _station;
00069 };
00070
00071
00072 class CSCStationIndex{
00073 public:
00074 CSCStationIndex():_region(0),_station(0),_ring(0),_chamber(0){}
00075 CSCStationIndex(int region, int station, int ring, int chamber):
00076 _region(region),
00077 _station(station),
00078 _ring(ring),
00079 _chamber(chamber){}
00080 ~CSCStationIndex(){}
00081 int region() const {return _region;}
00082 int station() const {return _station;}
00083 int ring() const {return _ring;}
00084 int chamber() const {return _chamber;}
00085 bool operator<(const CSCStationIndex& cscind) const{
00086 if(cscind.region()!=this->region())
00087 return cscind.region()<this->region();
00088 else if(cscind.station()!=this->station())
00089 return cscind.station()<this->station();
00090 else if(cscind.ring()!=this->ring())
00091 return cscind.ring()<this->ring();
00092 else if(cscind.chamber()!=this->chamber())
00093 return cscind.chamber()<this->chamber();
00094 return false;
00095 }
00096
00097 private:
00098 int _region;
00099 int _station;
00100 int _ring;
00101 int _chamber;
00102 };
00103
00104 class RPCEfficiency : public edm::EDAnalyzer {
00105 public:
00106 explicit RPCEfficiency(const edm::ParameterSet&);
00107 ~RPCEfficiency();
00108 virtual void beginJob() ;
00109 virtual void beginRun(const edm::Run&, const edm::EventSetup&);
00110 virtual void analyze(const edm::Event&, const edm::EventSetup&);
00111 virtual void endJob() ;
00112 std::map<std::string, MonitorElement*> bookDetUnitSeg(RPCDetId & detId,int nstrips);
00113 virtual void endRun(const edm::Run& r, const edm::EventSetup& iSetup);
00114 std::map<DTStationIndex,std::set<RPCDetId> > rollstoreDT;
00115 std::map<CSCStationIndex,std::set<RPCDetId> > rollstoreCSC;
00116 edm::ESHandle<RPCGeometry> rpcGeo;
00117 edm::ESHandle<DTGeometry> dtGeo;
00118 edm::ESHandle<CSCGeometry> cscGeo;
00119
00120 MonitorElement * statistics;
00121
00122
00123 MonitorElement * DistBorderClu1La1;
00124 MonitorElement * DistBorderClu1La2;
00125 MonitorElement * DistBorderClu1La3;
00126 MonitorElement * DistBorderClu1La4;
00127 MonitorElement * DistBorderClu1La5;
00128 MonitorElement * DistBorderClu1La6;
00129
00130 MonitorElement * DistBorderClu2La1;
00131 MonitorElement * DistBorderClu2La2;
00132 MonitorElement * DistBorderClu2La3;
00133 MonitorElement * DistBorderClu2La4;
00134 MonitorElement * DistBorderClu2La5;
00135 MonitorElement * DistBorderClu2La6;
00136
00137 MonitorElement * DistBorderClu3La1;
00138 MonitorElement * DistBorderClu3La2;
00139 MonitorElement * DistBorderClu3La3;
00140 MonitorElement * DistBorderClu3La4;
00141 MonitorElement * DistBorderClu3La5;
00142 MonitorElement * DistBorderClu3La6;
00143
00144
00145 MonitorElement * AngClu1La1;
00146 MonitorElement * AngClu1La2;
00147 MonitorElement * AngClu1La3;
00148 MonitorElement * AngClu1La4;
00149 MonitorElement * AngClu1La5;
00150 MonitorElement * AngClu1La6;
00151
00152 MonitorElement * AngClu2La1;
00153 MonitorElement * AngClu2La2;
00154 MonitorElement * AngClu2La3;
00155 MonitorElement * AngClu2La4;
00156 MonitorElement * AngClu2La5;
00157 MonitorElement * AngClu2La6;
00158
00159 MonitorElement * AngClu3La1;
00160 MonitorElement * AngClu3La2;
00161 MonitorElement * AngClu3La3;
00162 MonitorElement * AngClu3La4;
00163 MonitorElement * AngClu3La5;
00164 MonitorElement * AngClu3La6;
00165
00166
00167
00168 MonitorElement * hGlobalResClu1La1;
00169 MonitorElement * hGlobalResClu1La2;
00170 MonitorElement * hGlobalResClu1La3;
00171 MonitorElement * hGlobalResClu1La4;
00172 MonitorElement * hGlobalResClu1La5;
00173 MonitorElement * hGlobalResClu1La6;
00174
00175 MonitorElement * hGlobalResClu2La1;
00176 MonitorElement * hGlobalResClu2La2;
00177 MonitorElement * hGlobalResClu2La3;
00178 MonitorElement * hGlobalResClu2La4;
00179 MonitorElement * hGlobalResClu2La5;
00180 MonitorElement * hGlobalResClu2La6;
00181
00182 MonitorElement * hGlobalResClu3La1;
00183 MonitorElement * hGlobalResClu3La2;
00184 MonitorElement * hGlobalResClu3La3;
00185 MonitorElement * hGlobalResClu3La4;
00186 MonitorElement * hGlobalResClu3La5;
00187 MonitorElement * hGlobalResClu3La6;
00188
00189
00190 MonitorElement * hGlobalResClu1R3C;
00191 MonitorElement * hGlobalResClu1R3B;
00192 MonitorElement * hGlobalResClu1R3A;
00193 MonitorElement * hGlobalResClu1R2C;
00194 MonitorElement * hGlobalResClu1R2B;
00195 MonitorElement * hGlobalResClu1R2A;
00196
00197 MonitorElement * hGlobalResClu2R3C;
00198 MonitorElement * hGlobalResClu2R3B;
00199 MonitorElement * hGlobalResClu2R3A;
00200 MonitorElement * hGlobalResClu2R2C;
00201 MonitorElement * hGlobalResClu2R2B;
00202 MonitorElement * hGlobalResClu2R2A;
00203
00204 MonitorElement * hGlobalResClu3R3C;
00205 MonitorElement * hGlobalResClu3R3B;
00206 MonitorElement * hGlobalResClu3R3A;
00207 MonitorElement * hGlobalResClu3R2C;
00208 MonitorElement * hGlobalResClu3R2B;
00209 MonitorElement * hGlobalResClu3R2A;
00210
00211 private:
00212 std::vector<std::map<RPCDetId, int> > counter;
00213 std::vector<int> totalcounter;
00214 std::ofstream ofrej;
00215 bool incldt;
00216 bool incldtMB4;
00217 bool inclcsc;
00218 bool debug;
00219 bool paper;
00220 bool inves;
00221 double rangestrips;
00222 double rangestripsRB4;
00223 double MinCosAng;
00224 double MaxD;
00225 double MaxDrb4;
00226 int dupli;
00227 std::string muonRPCDigis;
00228 std::string cscSegments;
00229 std::string dt4DSegments;
00230 std::string rejected;
00231 std::string rollseff;
00232
00233 std::map<std::string, std::map<std::string, MonitorElement*> > meCollection;
00234
00235 bool EffSaveRootFile;
00236 std::string EffRootFileName;
00237 std::string nameInLog;
00238
00239 DQMStore * dbe;
00240 };