CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_6/src/DQM/EcalCommon/src/EcalDQMStatusWriter.cc

Go to the documentation of this file.
00001 /*
00002  * \file EcalDQMStatusWriter.cc
00003  *
00004  * $Date: 2010/08/30 13:14:08 $
00005  * $Revision: 1.19 $
00006  * \author G. Della Ricca
00007  *
00008 */
00009 
00010 #include <fstream>
00011 #include <iostream>
00012 #include <string>
00013 #include <cstring>
00014 #include <time.h>
00015 #include <unistd.h>
00016 
00017 #include "FWCore/ServiceRegistry/interface/Service.h"
00018 #include "CondCore/DBOutputService/interface/PoolDBOutputService.h"
00019 
00020 #include "DQM/EcalCommon/interface/Numbers.h"
00021 
00022 #include "DataFormats/EcalDetId/interface/EBDetId.h"
00023 #include "DataFormats/EcalDetId/interface/EEDetId.h"
00024 #include "DataFormats/EcalDetId/interface/EcalTrigTowerDetId.h"
00025 #include "DataFormats/EcalDetId/interface/EcalScDetId.h"
00026 
00027 #include "DQM/EcalCommon/interface/EcalDQMStatusDictionary.h"
00028 
00029 #include "DQM/EcalCommon/interface/EcalDQMStatusWriter.h"
00030 
00031 EcalDQMStatusWriter::EcalDQMStatusWriter(const edm::ParameterSet& ps) {
00032 
00033   verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
00034 
00035   typedef std::vector<edm::ParameterSet> Parameters;
00036   Parameters toPut = ps.getParameter<Parameters>("toPut");
00037 
00038   for ( Parameters::iterator itToPut=toPut.begin(); itToPut!=toPut.end(); itToPut++ ) {
00039     inpFileName_.push_back(itToPut->getUntrackedParameter<std::string>("inputFile"));
00040     objectName_.push_back(itToPut->getUntrackedParameter<std::string>("conditionType"));
00041     since_.push_back(itToPut->getUntrackedParameter<unsigned int>("since"));
00042   }
00043 
00044 }
00045 
00046 void EcalDQMStatusWriter::beginRun(const edm::Run& r, const edm::EventSetup& c) {
00047 
00048   Numbers::initGeometry(c, verbose_);
00049 
00050   edm::Service<cond::service::PoolDBOutputService> dbservice;
00051   if ( !dbservice.isAvailable() ){
00052     std::cout << "PoolDBOutputService is unavailable" << std::endl;
00053     return;
00054   }
00055 
00056   for ( unsigned int i=0; i<objectName_.size(); i++ ) {
00057 
00058     bool toAppend;
00059     cond::Time_t newTime;
00060 
00061     if ( dbservice->isNewTagRequest( objectName_[i]+std::string("Rcd") ) ) {
00062       // This is the first object for this tag.
00063       // Append mode should be off.
00064       // newTime is the end of this new objects IOV.
00065       toAppend = false;
00066       newTime = dbservice->beginOfTime();
00067     } else {
00068       // There should already be an object in the DB for this tag.
00069       // Append IOV mode should be on.
00070       // newTime is the beginning of this new objects IOV.
00071       toAppend = true;
00072       newTime = (cond::Time_t) since_[i];
00073     }
00074 
00075     std::cout << "Reading " << objectName_[i] << " from file and writing to DB with newTime " << newTime << std::endl;
00076 
00077     if (objectName_[i]  ==  "EcalDQMChannelStatus") {
00078 
00079       EcalDQMChannelStatus* status = readEcalDQMChannelStatusFromFile(inpFileName_[i].c_str());
00080 
00081       if ( !toAppend ) {
00082         dbservice->createNewIOV<EcalDQMChannelStatus>(status, newTime, dbservice->endOfTime(), "EcalDQMChannelStatusRcd");
00083       } else {
00084         dbservice->appendSinceTime<EcalDQMChannelStatus>(status, newTime, "EcalDQMChannelStatusRcd");
00085       }
00086 
00087     } else if (objectName_[i]  ==  "EcalDQMTowerStatus") {
00088 
00089       EcalDQMTowerStatus* status = readEcalDQMTowerStatusFromFile(inpFileName_[i].c_str());
00090 
00091       if ( !toAppend ) {
00092         dbservice->createNewIOV<EcalDQMTowerStatus>(status, newTime, dbservice->endOfTime(), "EcalDQMTowerStatusRcd");
00093       } else {
00094         dbservice->appendSinceTime<EcalDQMTowerStatus>(status, newTime, "EcalDQMTowerStatusRcd");
00095       }
00096 
00097     } else {
00098 
00099       std::cout << "Object " << objectName_[i]  << " is not supported by this program." << std::endl;
00100 
00101     }
00102 
00103   }
00104 
00105 }
00106 
00107 EcalDQMChannelStatus* EcalDQMStatusWriter::readEcalDQMChannelStatusFromFile(const char* inputFile) {
00108 
00109   EcalDQMChannelStatus* status = new EcalDQMChannelStatus();
00110 
00111   std::vector<EcalDQMStatusDictionary::codeDef> dictionary;
00112   EcalDQMStatusDictionary::getDictionary( dictionary );
00113 
00114   // barrel
00115   for ( int ism=1; ism<=36; ism++ ) {
00116     int jsm = Numbers::iSM(ism, EcalBarrel);
00117     for ( int ic=1; ic<=1700; ic++ ) {
00118       EBDetId id(jsm, ic, EBDetId::SMCRYSTALMODE);
00119       status->setValue(id, 0);
00120     }
00121   }
00122 
00123   // endcap
00124   for ( int ix=1; ix<=100; ix++ ) {
00125     for ( int iy=1; iy<=100; iy++ ) {
00126       if ( EEDetId::validDetId(ix, iy, +1) ) {
00127         EEDetId id(ix, iy, +1);
00128         status->setValue(id, 0);
00129       }
00130       if ( EEDetId::validDetId(ix, iy, -1) ) {
00131         EEDetId id(ix, iy, -1);
00132         status->setValue(id, 0);
00133       }
00134     }
00135   }
00136 
00137   std::cout << "Reading channel status from file " << inputFile << std::endl;
00138   FILE *ifile = fopen( inputFile ,"r" );
00139 
00140   if ( !ifile ) throw cms::Exception ("Cannot open file") ;
00141 
00142   char line[256];
00143 
00144   int ii = 0;
00145   while ( fgets(line, 255, ifile) ) {
00146 
00147     std::stringstream stream;
00148 
00149     ii++;
00150     std::string key;
00151     stream << line;
00152     if ( verbose_ ) std::cout << line;
00153     stream >> key;
00154 
00155     if ( key.size() == 0 || strcmp(key.c_str(), " ") == 0 || strncmp(key.c_str(), "#", 1) == 0 ) {
00156 
00157       // skip comments
00158 
00159     } else if ( strcmp(key.c_str(), "EB") == 0 ) {
00160 
00161       int index;
00162       uint32_t code;
00163       stream >> index >> code;
00164 
00165       EBDetId id = EBDetId::unhashIndex(index);
00166       code = convert(code);
00167 
00168       EcalDQMChannelStatus::const_iterator it = status->find(id);
00169       if ( it != status->end() ) code |= it->getStatusCode();
00170       status->setValue(id, code);
00171 
00172     } else if ( strcmp(key.c_str(), "EE") == 0 ) {
00173 
00174       int ix, iy, iz;
00175       uint32_t code;
00176       stream >> ix >> iy >> iz >> code;
00177 
00178       EEDetId id(ix, iy, iz);
00179       code = convert(code);
00180 
00181       EcalDQMChannelStatus::const_iterator it = status->find(id);
00182       if ( it != status->end() ) code |= it->getStatusCode();
00183       status->setValue(id, code);
00184 
00185     } else if ( strcmp(key.c_str(), "Crystal") == 0 ) {
00186 
00187       std::string module;
00188       stream >> module;
00189 
00190       if ( strncmp(module.c_str(), "EB+", 3) == 0 || strncmp(module.c_str(), "EB-", 3) == 0 ) {
00191 
00192 #if 0
00193         int ie, ip;
00194         std::string token;
00195         stream >> ie >> ip >> token;
00196 
00197         int sm = atoi( module.substr(2, module.size()-2).c_str() );
00198 
00199         int ism = (sm>=1&&sm<=18) ? sm+18 : -sm;
00200         int jsm = Numbers::iSM(ism, EcalBarrel);
00201         int ic = 20*(ie-1)+(ip-1)+1;
00202 #else
00203         int ic;
00204         std::string token;
00205         stream >> ic >> token;
00206 
00207         int sm = atoi( module.substr(2, module.size()-2).c_str() );
00208 
00209         int ism = (sm>=1&&sm<=18) ? sm+18 : -sm;
00210         int jsm = Numbers::iSM(ism, EcalBarrel);
00211 #endif
00212 
00213         EBDetId id(jsm, ic, EBDetId::SMCRYSTALMODE);
00214         uint32_t code = 0;
00215         for ( unsigned int i=0; i<dictionary.size(); i++ ) {
00216           if ( strcmp(token.c_str(), dictionary[i].desc) == 0 ) {
00217             code = dictionary[i].code;
00218           }
00219         }
00220         if ( code == 0 ) {
00221           std::cout << " --> not found in the dictionary: " << token << std::endl;
00222           continue;
00223         }
00224 
00225         EcalDQMChannelStatus::const_iterator it = status->find(id);
00226         if ( it != status->end() ) code |= it->getStatusCode();
00227         status->setValue(id, code);
00228 
00229       } else if ( strncmp(module.c_str(), "EE+", 3) == 0 || strncmp(module.c_str(), "EE-", 3) == 0 ) {
00230 
00231 #if 0
00232         int jx, jy;
00233         std::string token;
00234         stream >> jx >> jy >> token;
00235 #else
00236         int index;
00237         std::string token;
00238         stream >> index >> token;
00239         int jx = index/1000;
00240         int jy = index%1000;
00241 #endif
00242 
00243         int sm = atoi( module.substr(2, module.size()-2).c_str() );
00244 
00245         int ism = 0;
00246         if( sm == -99 ) sm = -1;
00247         if( sm == +99 ) sm = +1;
00248         switch ( sm ) {
00249           case -7: ism =  1; break;
00250           case -8: ism =  2; break;
00251           case -9: ism =  3; break;
00252           case -1: ism =  4; break;
00253           case -2: ism =  5; break;
00254           case -3: ism =  6; break;
00255           case -4: ism =  7; break;
00256           case -5: ism =  8; break;
00257           case -6: ism =  9; break;
00258           case +7: ism = 10; break;
00259           case +8: ism = 11; break;
00260           case +9: ism = 12; break;
00261           case +1: ism = 13; break;
00262           case +2: ism = 14; break;
00263           case +3: ism = 15; break;
00264           case +4: ism = 16; break;
00265           case +5: ism = 17; break;
00266           case +6: ism = 18; break;
00267         }
00268 
00269         EEDetId id(jx, jy, (ism>=1&&ism<=9)?-1:+1);
00270         uint32_t code = 0;
00271         for ( unsigned int i=0; i<dictionary.size(); i++ ) {
00272           if ( strcmp(token.c_str(), dictionary[i].desc) == 0 ) {
00273             code = dictionary[i].code;
00274           }
00275         }
00276         if ( code == 0 ) {
00277           std::cout << " --> not found in the dictionary: " << token << std::endl;
00278           continue;
00279         }
00280 
00281         EcalDQMChannelStatus::const_iterator it = status->find(id);
00282         if ( it != status->end() ) code |= it->getStatusCode();
00283         status->setValue(id, code);
00284 
00285       } else {
00286 
00287         std:: cout << "--> unknown token at line #" << ii << " : " << line;
00288 
00289       }
00290 
00291     } else if ( strcmp(key.c_str(), "TT") == 0 ) {
00292 
00293       // see readEcalDQMTowerStatusFromFile
00294 
00295     } else if ( strcmp(key.c_str(), "PN") == 0 || strcmp(key.c_str(), "MemCh") == 0 || strcmp(key.c_str(), "MemTT") == 0 ) {
00296 
00297       std::cout << "--> unsupported key at line #" << ii << " : " << line;
00298 
00299     } else {
00300 
00301       std:: cout << "--> skipped line #" << ii << " : " << line;
00302 
00303     }
00304 
00305   }
00306 
00307   fclose(ifile);
00308 
00309   return status;
00310 
00311 }
00312 
00313 EcalDQMTowerStatus* EcalDQMStatusWriter::readEcalDQMTowerStatusFromFile(const char* inputFile) {
00314 
00315   EcalDQMTowerStatus* status = new EcalDQMTowerStatus();
00316 
00317   std::vector<EcalDQMStatusDictionary::codeDef> dictionary;
00318   EcalDQMStatusDictionary::getDictionary( dictionary );
00319 
00320   // barrel
00321   for ( int ix=1; ix<=17; ix++ ) {
00322     for ( int iy=1; iy<=72; iy++ ) {
00323       if ( EcalTrigTowerDetId::validDetId(+1, EcalBarrel, ix, iy) ) {
00324         EcalTrigTowerDetId id(+1, EcalBarrel, ix, iy);
00325         status->setValue(id, 0);
00326       }
00327       if ( EcalTrigTowerDetId::validDetId(-1, EcalBarrel, ix, iy) ) {
00328         EcalTrigTowerDetId id(-1, EcalBarrel, ix, iy);
00329         status->setValue(id, 0);
00330       }
00331     }
00332   }
00333   
00334   // endcap
00335   for ( int ix=1; ix<=20; ix++ ) {
00336     for ( int iy=1; iy<=20; iy++ ) {
00337       if ( EcalScDetId::validDetId(ix, iy, +1) ) {
00338         EcalScDetId id(ix, iy, +1);
00339         status->setValue(id, 0);
00340       }
00341       if ( EcalScDetId::validDetId(ix, iy, -1) ) {
00342         EcalScDetId id(ix, iy, -1);
00343         status->setValue(id, 0);
00344       }
00345     }
00346   }
00347 
00348   std::cout << "Reading tower status from file " << inputFile << std::endl;
00349   FILE *ifile = fopen( inputFile ,"r" );
00350 
00351   if ( !ifile ) throw cms::Exception ("Cannot open file") ;
00352 
00353   char line[256];
00354 
00355   int ii = 0;
00356   while ( fgets(line, 255, ifile) ) {
00357 
00358     std::stringstream stream;
00359 
00360     ii++;
00361     std::string key;
00362     stream << line;
00363     if ( verbose_ ) std::cout << line;
00364     stream >> key;
00365 
00366     if ( key.size() == 0 || strcmp(key.c_str(), " ") == 0 || strncmp(key.c_str(), "#", 1) == 0 ) {
00367 
00368       // skip comments
00369 
00370     } else if ( strcmp(key.c_str(), "EB") == 0 ) {
00371 
00372       // see readEcalDQMChannelStatusFromFile
00373 
00374     } else if ( strcmp(key.c_str(), "EE") == 0 ) {
00375 
00376       // see readEcalDQMChannelStatusFromFile
00377 
00378     } else if ( strcmp(key.c_str(), "Crystal") == 0 ) {
00379 
00380       // see readEcalDQMChannelStatusFromFile
00381 
00382     } else if ( strcmp(key.c_str(), "TT") == 0 ) {
00383 
00384       std::string module;
00385       stream >> module;
00386 
00387       if ( strncmp(module.c_str(), "EB+", 3) == 0 || strncmp(module.c_str(), "EB-", 3) == 0 ) {
00388 
00389         int itt;
00390         std::string token;
00391         stream >> itt >> token;
00392 
00393         if ( itt >= 1 && itt <= 68 ) {
00394 
00395           int sm = atoi( module.substr(2, module.size()-2).c_str() );
00396 
00397           int iet = (itt-1)/4+1;
00398           int ipt = (itt-1)%4+1;
00399 
00400           if ( sm<0 ) {
00401             ipt = ipt+(std::abs(sm)-1)*4-2;
00402             if ( ipt < 1 ) ipt = ipt+72;
00403             if ( ipt > 72 ) ipt = ipt-72;
00404           } else {
00405             ipt = (5-ipt)+(std::abs(sm)-1)*4-2;
00406             if ( ipt < 1 ) ipt = ipt+72;
00407             if ( ipt > 72 ) ipt = ipt-72;
00408           }
00409 
00410           EcalTrigTowerDetId id((sm<0)?-1:+1, EcalBarrel, iet, ipt);
00411           uint32_t code = 0;
00412           for ( unsigned int i=0; i<dictionary.size(); i++ ) {
00413             if ( strcmp(token.c_str(), dictionary[i].desc) == 0 ) {
00414               code = dictionary[i].code;
00415             }
00416           }
00417           if ( code == 0 ) {
00418             std::cout << " --> not found in the dictionary: " << token << std::endl;
00419             continue;
00420           }
00421 
00422           EcalDQMTowerStatus::const_iterator it = status->find(id);
00423           if ( it != status->end() ) code |= it->getStatusCode();
00424           status->setValue(id, code);
00425 
00426         } else {
00427 
00428           std::cout << "--> unsupported configuration at line #" << ii << " : " << line;
00429 
00430         }
00431 
00432       } else if ( strncmp(module.c_str(), "EE+", 3) == 0 || strncmp(module.c_str(), "EE-", 3) == 0 ) {
00433 
00434         int isc;
00435         std::string token;
00436         stream >> isc >> token;
00437 
00438         if ( isc >= 1 && isc <= 68 ) {
00439 
00440           int sm = atoi( module.substr(2, module.size()-2).c_str() );
00441 
00442           int ism = 0;
00443           switch ( sm ) {
00444             case -7: ism =  1; break;
00445             case -8: ism =  2; break;
00446             case -9: ism =  3; break;
00447             case -1: ism =  4; break;
00448             case -2: ism =  5; break;
00449             case -3: ism =  6; break;
00450             case -4: ism =  7; break;
00451             case -5: ism =  8; break;
00452             case -6: ism =  9; break;
00453             case +7: ism = 10; break;
00454             case +8: ism = 11; break;
00455             case +9: ism = 12; break;
00456             case +1: ism = 13; break;
00457             case +2: ism = 14; break;
00458             case +3: ism = 15; break;
00459             case +4: ism = 16; break;
00460             case +5: ism = 17; break;
00461             case +6: ism = 18; break;
00462           }
00463 
00464           int idcc = (ism>=1&&ism<=9) ? ism : ism-9+45;
00465 
00466           std::vector<DetId>* crystals = Numbers::crystals(idcc, isc);
00467 
00468           for ( unsigned int i=0; i<crystals->size(); i++ ) {
00469 
00470             EcalScDetId id = ((EEDetId) (*crystals)[i]).sc();
00471             uint32_t code = 0;
00472             for ( unsigned int i=0; i<dictionary.size(); i++ ) {
00473               if ( strcmp(token.c_str(), dictionary[i].desc) == 0 ) {
00474                 code = dictionary[i].code;
00475               }
00476             }
00477             if ( code == 0 ) {
00478               std::cout << " --> not found in the dictionary: " << token << std::endl;
00479               continue;
00480             }
00481 
00482             EcalDQMTowerStatus::const_iterator it = status->find(id);
00483             if ( it != status->end() ) code |= it->getStatusCode();
00484             status->setValue(id, code);
00485 
00486           }
00487 
00488         } else {
00489 
00490           std::cout << "--> unsupported configuration at line #" << ii << " : " << line;
00491 
00492         }
00493 
00494       } else {
00495 
00496         std:: cout << "--> unknown token at line #" << ii << " : " << line;
00497 
00498       }
00499 
00500     } else if ( strcmp(key.c_str(), "PN") == 0 || strcmp(key.c_str(), "MemCh") == 0 || strcmp(key.c_str(), "MemTT") == 0 ) {
00501 
00502       std::cout << "--> unsupported key at line #" << ii << " : " << line;
00503 
00504     } else {
00505 
00506       std:: cout << "--> skipped line #" << ii << " : " << line;
00507 
00508     }
00509 
00510   }
00511 
00512   fclose(ifile);
00513 
00514   return status;
00515 
00516 }
00517 
00518 uint32_t EcalDQMStatusWriter::convert(uint32_t chStatus) {
00519 
00520   if ( chStatus == 1 || (chStatus >= 8 && chStatus <= 12 )) {
00521 
00522     chStatus = 0;
00523     chStatus |= 1 << EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_MEAN_ERROR;
00524     chStatus |= 1 << EcalDQMStatusHelper::PEDESTAL_MIDDLE_GAIN_MEAN_ERROR;
00525     chStatus |= 1 << EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_MEAN_ERROR;
00526     chStatus |= 1 << EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_RMS_ERROR;
00527     chStatus |= 1 << EcalDQMStatusHelper::PEDESTAL_MIDDLE_GAIN_RMS_ERROR;
00528     chStatus |= 1 << EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_RMS_ERROR;
00529     chStatus |= 1 << EcalDQMStatusHelper::PEDESTAL_ONLINE_HIGH_GAIN_MEAN_ERROR;
00530     chStatus |= 1 << EcalDQMStatusHelper::PEDESTAL_ONLINE_HIGH_GAIN_RMS_ERROR;
00531     chStatus |= 1 << EcalDQMStatusHelper::TESTPULSE_LOW_GAIN_MEAN_ERROR;
00532     chStatus |= 1 << EcalDQMStatusHelper::TESTPULSE_MIDDLE_GAIN_MEAN_ERROR;
00533     chStatus |= 1 << EcalDQMStatusHelper::TESTPULSE_HIGH_GAIN_MEAN_ERROR;
00534     chStatus |= 1 << EcalDQMStatusHelper::TESTPULSE_LOW_GAIN_RMS_ERROR;
00535     chStatus |= 1 << EcalDQMStatusHelper::TESTPULSE_MIDDLE_GAIN_RMS_ERROR;
00536     chStatus |= 1 << EcalDQMStatusHelper::TESTPULSE_HIGH_GAIN_RMS_ERROR;
00537     chStatus |= 1 << EcalDQMStatusHelper::LASER_MEAN_ERROR;
00538     chStatus |= 1 << EcalDQMStatusHelper::LASER_RMS_ERROR;
00539     chStatus |= 1 << EcalDQMStatusHelper::LASER_TIMING_MEAN_ERROR;
00540     chStatus |= 1 << EcalDQMStatusHelper::LASER_TIMING_RMS_ERROR;
00541     chStatus |= 1 << EcalDQMStatusHelper::LED_MEAN_ERROR;
00542     chStatus |= 1 << EcalDQMStatusHelper::LED_RMS_ERROR;
00543     chStatus |= 1 << EcalDQMStatusHelper::LED_TIMING_MEAN_ERROR;
00544     chStatus |= 1 << EcalDQMStatusHelper::LED_TIMING_RMS_ERROR;
00545 
00546   } else if ( chStatus == 2 ) {
00547 
00548     chStatus = 0;
00549     chStatus |= 1 << EcalDQMStatusHelper::LASER_MEAN_ERROR;
00550     chStatus |= 1 << EcalDQMStatusHelper::LASER_RMS_ERROR;
00551     chStatus |= 1 << EcalDQMStatusHelper::LASER_TIMING_MEAN_ERROR;
00552     chStatus |= 1 << EcalDQMStatusHelper::LASER_TIMING_RMS_ERROR;
00553     chStatus |= 1 << EcalDQMStatusHelper::LED_MEAN_ERROR;
00554     chStatus |= 1 << EcalDQMStatusHelper::LED_RMS_ERROR;
00555     chStatus |= 1 << EcalDQMStatusHelper::LED_TIMING_MEAN_ERROR;
00556     chStatus |= 1 << EcalDQMStatusHelper::LED_TIMING_RMS_ERROR;
00557 
00558   } else if ( chStatus == 3 ) {
00559 
00560     chStatus = 0;
00561     chStatus |= 1 << EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_MEAN_ERROR;
00562     chStatus |= 1 << EcalDQMStatusHelper::PEDESTAL_MIDDLE_GAIN_MEAN_ERROR;
00563     chStatus |= 1 << EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_MEAN_ERROR;
00564     chStatus |= 1 << EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_RMS_ERROR;
00565     chStatus |= 1 << EcalDQMStatusHelper::PEDESTAL_MIDDLE_GAIN_RMS_ERROR;
00566     chStatus |= 1 << EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_RMS_ERROR;
00567     chStatus |= 1 << EcalDQMStatusHelper::PEDESTAL_ONLINE_HIGH_GAIN_MEAN_ERROR;
00568     chStatus |= 1 << EcalDQMStatusHelper::PEDESTAL_ONLINE_HIGH_GAIN_RMS_ERROR;
00569     chStatus |= 1 << EcalDQMStatusHelper::PHYSICS_BAD_CHANNEL_WARNING;
00570 
00571   } else if ( chStatus == 4 ) {
00572 
00573     chStatus = 0;
00574     chStatus |= 1 << EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_MEAN_ERROR;
00575     chStatus |= 1 << EcalDQMStatusHelper::PEDESTAL_MIDDLE_GAIN_MEAN_ERROR;
00576     chStatus |= 1 << EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_MEAN_ERROR;
00577     chStatus |= 1 << EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_RMS_ERROR;
00578     chStatus |= 1 << EcalDQMStatusHelper::PEDESTAL_MIDDLE_GAIN_RMS_ERROR;
00579     chStatus |= 1 << EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_RMS_ERROR;
00580     chStatus |= 1 << EcalDQMStatusHelper::PEDESTAL_ONLINE_HIGH_GAIN_MEAN_ERROR;
00581     chStatus |= 1 << EcalDQMStatusHelper::PEDESTAL_ONLINE_HIGH_GAIN_RMS_ERROR;
00582 
00583   } else if ( chStatus == 13 || chStatus == 14 ) {
00584 
00585     chStatus = 0;
00586     chStatus |= 1 << EcalDQMStatusHelper::STATUS_FLAG_ERROR;
00587 
00588   } else if ( (chStatus&0x3f) == 13 || (chStatus&0x7f) == 13 ||
00589               (chStatus&0x3f) == 14 || (chStatus&0x7f) == 14 ) {
00590 
00591     chStatus = 0;
00592     chStatus |= 1 << EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_MEAN_ERROR;
00593     chStatus |= 1 << EcalDQMStatusHelper::PEDESTAL_MIDDLE_GAIN_MEAN_ERROR;
00594     chStatus |= 1 << EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_MEAN_ERROR;
00595     chStatus |= 1 << EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_RMS_ERROR;
00596     chStatus |= 1 << EcalDQMStatusHelper::PEDESTAL_MIDDLE_GAIN_RMS_ERROR;
00597     chStatus |= 1 << EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_RMS_ERROR;
00598     chStatus |= 1 << EcalDQMStatusHelper::PEDESTAL_ONLINE_HIGH_GAIN_MEAN_ERROR;
00599     chStatus |= 1 << EcalDQMStatusHelper::PEDESTAL_ONLINE_HIGH_GAIN_RMS_ERROR;
00600     chStatus |= 1 << EcalDQMStatusHelper::TESTPULSE_LOW_GAIN_MEAN_ERROR;
00601     chStatus |= 1 << EcalDQMStatusHelper::TESTPULSE_MIDDLE_GAIN_MEAN_ERROR;
00602     chStatus |= 1 << EcalDQMStatusHelper::TESTPULSE_HIGH_GAIN_MEAN_ERROR;
00603     chStatus |= 1 << EcalDQMStatusHelper::TESTPULSE_LOW_GAIN_RMS_ERROR;
00604     chStatus |= 1 << EcalDQMStatusHelper::TESTPULSE_MIDDLE_GAIN_RMS_ERROR;
00605     chStatus |= 1 << EcalDQMStatusHelper::TESTPULSE_HIGH_GAIN_RMS_ERROR;
00606     chStatus |= 1 << EcalDQMStatusHelper::LASER_MEAN_ERROR;
00607     chStatus |= 1 << EcalDQMStatusHelper::LASER_RMS_ERROR;
00608     chStatus |= 1 << EcalDQMStatusHelper::LASER_TIMING_MEAN_ERROR;
00609     chStatus |= 1 << EcalDQMStatusHelper::LASER_TIMING_RMS_ERROR;
00610     chStatus |= 1 << EcalDQMStatusHelper::LED_MEAN_ERROR;
00611     chStatus |= 1 << EcalDQMStatusHelper::LED_RMS_ERROR;
00612     chStatus |= 1 << EcalDQMStatusHelper::LED_TIMING_MEAN_ERROR;
00613     chStatus |= 1 << EcalDQMStatusHelper::LED_TIMING_RMS_ERROR;
00614     chStatus |= 1 << EcalDQMStatusHelper::STATUS_FLAG_ERROR;
00615 
00616   }
00617 
00618   return( chStatus );
00619 
00620 }
00621