23 for (
int i=0;
i<2; ++
i)
24 for (
int j=0;
j<2; ++
j)
25 for (
int k=0;
k<40; ++
k)
26 for (
int m=0;
m<40; ++
m) {
27 fed_[
i][
j][
k][
m] = -1;
28 kchip_[
i][
j][
k][
m] = -1;
31 for (
int i=0;
i<56; ++
i) {
34 slinkCRCStatus_[
i] = -1;
35 for (
int j=0;
j<36; ++
j)
36 fiberStatus_[
i][
j] = -1;
39 int nLines_,
z, iz, ip, ix, iy, fed, kchip, pace, bundle, fiber, optorx;
41 file.open(lookup_.fullPath().c_str());
42 if( file.is_open() ) {
46 for (
int i=0;
i<nLines_; ++
i) {
47 file>> iz >> ip >> ix >> iy >> fed >> kchip >> pace >> bundle >> fiber >> optorx;
50 fed_[z-1][ip-1][ix-1][iy-1] = fed;
51 kchip_[z-1][ip-1][ix-1][iy-1] = kchip;
52 fiber_[z-1][ip-1][ix-1][iy-1] = (fiber-1)+(optorx-1)*12;
56 cout<<
"ESIntegrityClient : Look up table file can not be found in "<<lookup_.fullPath().c_str()<<endl;
68 hOrbitNumberDiff_ = 0;
82 if ( debug_ )
cout <<
"ESIntegrityClient: beginJob" << endl;
90 if ( debug_ )
cout <<
"ESIntegrityClient: beginRun" << endl;
100 if ( debug_ )
cout <<
"ESIntegrityClient: endJob, ievt = " << ievt_ << endl;
108 if ( debug_ )
cout <<
"ESIntegrityClient: endRun, jevt = " << jevt_ << endl;
118 dqmStore_->setCurrentFolder( prefixME_ +
"/ESIntegrityClient" );
120 for (
int i=0 ;
i<2; ++
i)
121 for (
int j=0 ;
j<2; ++
j) {
122 int iz = (
i==0)? 1:-1;
123 snprintf(histo, 200,
"ES Integrity Summary 1 Z %d P %d", iz,
j+1);
124 meFED_[
i][
j] = dqmStore_->book2D(histo, histo, 40, 0.5, 40.5, 40, 0.5, 40.5);
125 meFED_[
i][
j]->setAxisTitle(
"Si X", 1);
126 meFED_[
i][
j]->setAxisTitle(
"Si Y", 2);
128 snprintf(histo, 200,
"ES Integrity Summary 2 Z %d P %d", iz,
j+1);
129 meKCHIP_[
i][
j] = dqmStore_->book2D(histo, histo, 40, 0.5, 40.5, 40, 0.5, 40.5);
130 meKCHIP_[
i][
j]->setAxisTitle(
"Si X", 1);
131 meKCHIP_[
i][
j]->setAxisTitle(
"Si Y", 2);
137 if ( ! enableCleanup_ )
return;
143 double nDI_FedErr[56];
144 for (
int i=0;
i<56; ++
i) nDI_FedErr[
i] = 0;
148 me = dqmStore_->get(prefixME_ +
"/ESIntegrityTask/ES FEDs used for data taking");
149 hFED_ =
getHisto(me, cloneME_, hFED_);
151 me = dqmStore_->get(prefixME_ +
"/ESIntegrityTask/ES Fiber Off");
152 hFiberOff_ =
getHisto(me, cloneME_, hFiberOff_);
154 me = dqmStore_->get(prefixME_ +
"/ESIntegrityTask/ES Fiber Bad Status");
155 hFiberBadStatus_ =
getHisto(me, cloneME_, hFiberBadStatus_);
157 me = dqmStore_->get(prefixME_ +
"/ESIntegrityTask/ES SLink CRC Errors");
158 hSLinkCRCErr_ =
getHisto(me, cloneME_, hSLinkCRCErr_);
163 for (
int i=1;
i<=56; ++
i)
164 if (nevFEDs < hFED_->GetBinContent(
i))
165 nevFEDs = (int) hFED_->GetBinContent(
i);
169 for (
int i=1;
i<=56; ++
i) {
171 if (hFED_->GetBinContent(
i) > 0)
175 if (hSLinkCRCErr_->GetBinContent(
i) > 0)
176 slinkCRCStatus_[
i-1] = 1;
178 for (
int j=0;
j<36; ++
j) {
179 if (hFiberBadStatus_) {
180 if (hFiberBadStatus_->GetBinContent(
i,
j+1) > 0)
181 fiberStatus_[
i-1][
j] = 2;
183 fiberStatus_[
i-1][
j] = 1;
186 if (hFiberOff_->GetBinContent(
i,
j+1) > 0) {
187 fiberStatus_[
i-1][
j] = 0;
193 me = dqmStore_->get(prefixME_ +
"/ESRawDataTask/ES L1A DCC errors");
194 hL1ADiff_ =
getHisto(me, cloneME_, hL1ADiff_);
196 me = dqmStore_->get(prefixME_ +
"/ESRawDataTask/ES BX DCC errors");
197 hBXDiff_ =
getHisto(me, cloneME_, hBXDiff_);
199 me = dqmStore_->get(prefixME_ +
"/ESRawDataTask/ES Orbit Number DCC errors");
200 hOrbitNumberDiff_ =
getHisto(me, cloneME_, hOrbitNumberDiff_);
202 for (
int i=1;
i<=56; ++
i) {
203 if (hL1ADiff_ && hBXDiff_) {
204 if (hL1ADiff_->GetBinContent(
i) > 0 || hBXDiff_->GetBinContent(
i) > 0) {
205 syncStatus_[
i-1] = 1;
206 if (hL1ADiff_->GetBinContent(
i) > nDI_FedErr[
i-1]) nDI_FedErr[
i-1] = hL1ADiff_->GetBinContent(
i);
207 if (hBXDiff_->GetBinContent(
i) > nDI_FedErr[
i-1]) nDI_FedErr[
i-1] = hBXDiff_->GetBinContent(
i);
214 me = dqmStore_->get(prefixME_ +
"/ESIntegrityTask/ES KChip Flag 1 Error codes");
215 hKF1_ =
getHisto(me, cloneME_, hKF1_);
217 me = dqmStore_->get(prefixME_ +
"/ESIntegrityTask/ES KChip Flag 2 Error codes");
218 hKF2_ =
getHisto(me, cloneME_, hKF2_);
220 me = dqmStore_->get(prefixME_ +
"/ESIntegrityTask/ES KChip BC mismatch with OptoRX");
221 hKBC_ =
getHisto(me, cloneME_, hKBC_);
223 me = dqmStore_->get(prefixME_ +
"/ESIntegrityTask/ES KChip EC mismatch with OptoRX");
224 hKEC_ =
getHisto(me, cloneME_, hKEC_);
226 Int_t kchip_xval[1550];
227 for (
int i=0;
i<1550; ++
i) {
231 for (
int j=1;
j<16; ++
j) {
233 if (hKF1_->GetBinContent(
i,
j+1)>0) {
239 if (hKF2_->GetBinContent(
i,
j+1)>0) {
246 if (hKBC_->GetBinContent(
i)>0) {
252 if (hKEC_->GetBinContent(
i)>0) {
257 if (kErr>1) xval = 7;
258 kchip_xval[
i] = xval;
262 for (
int iz=0; iz<2; ++iz)
263 for (
int ip=0; ip<2; ++ip)
264 for (
int ix=0; ix<40; ++ix)
265 for (
int iy=0; iy<40; ++iy) {
266 if (fed_[iz][ip][ix][iy] == -1)
continue;
267 if (fedStatus_[fed_[iz][ip][ix][iy]-520]==-1 || fiberStatus_[fed_[iz][ip][ix][iy]-520][fiber_[iz][ip][ix][iy]] == 0)
268 kchip_xval[kchip_[iz][ip][ix][iy]-1] = 0;
269 if ((kchip_[iz][ip][ix][iy]-2) >= 0)
270 meKCHIP_[iz][ip]->setBinContent(ix+1, iy+1, kchip_xval[kchip_[iz][ip][ix][iy]-2]);
275 for (
int iz=0; iz<2; ++iz)
276 for (
int ip=0; ip<2; ++ip)
277 for (
int ix=0; ix<40; ++ix)
278 for (
int iy=0; iy<40; ++iy) {
280 if (fed_[iz][ip][ix][iy] == -1)
continue;
283 if (fedStatus_[fed_[iz][ip][ix][iy]-520] == 1) {
286 if (hFED_->GetBinContent(fed_[iz][ip][ix][iy]-520+1) == nevFEDs)
294 if (fiberStatus_[fed_[iz][ip][ix][iy]-520][fiber_[iz][ip][ix][iy]] == 2) {
298 if (fiberStatus_[fed_[iz][ip][ix][iy]-520][fiber_[iz][ip][ix][iy]] == 0) {
301 if (kchip_xval[kchip_[iz][ip][ix][iy]-1] != 3 && kchip_xval[kchip_[iz][ip][ix][iy]-1] != 0) {
305 if (syncStatus_[fed_[iz][ip][ix][iy]-520] == 1) {
309 if (slinkCRCStatus_[fed_[iz][ip][ix][iy]-520] == 1) {
313 if (nErr > 1) xval = 7;
314 }
else if (fedStatus_[fed_[iz][ip][ix][iy]-520] == -1) {
318 meFED_[iz][ip]->setBinContent(ix+1, iy+1, xval);
void softReset(bool flag)
SoftReset.
T getUntrackedParameter(std::string const &, T const &) const
void beginRun(void)
BeginRun.
static void cleanup(const Factory::MakerMap::value_type &v)
virtual ~ESIntegrityClient()
Destructor.
void cleanup(void)
Cleanup.
void beginJob(DQMStore *dqmStore)
BeginJob.
ESIntegrityClient(const edm::ParameterSet &ps)
Constructor.
TH1F * getHisto(std::string name, std::string process, DQMStore *dbe_, bool verb=false, bool clone=false)
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
void analyze(void)
Analyze.