![]() |
![]() |
#include <CondTools/Ecal/interface/EcalPedestalsHandler.h>
Public Member Functions | |
bool | checkPedestal (EcalPedestals::Item *item) |
EcalPedestalsHandler (edm::ParameterSet const &) | |
void | getNewObjects () |
void | getNewObjectsH2 () |
void | getNewObjectsP5 () |
std::string | id () const |
~EcalPedestalsHandler () | |
Public Attributes | |
EcalCondDBInterface * | econn |
Private Attributes | |
unsigned long | m_firstRun |
std::string | m_gentag |
unsigned long | m_lastRun |
std::string | m_location |
std::string | m_locationsource |
std::string | m_name |
std::string | m_pass |
std::string | m_sid |
std::string | m_user |
const EcalPedestals * | mypedestals |
Definition at line 62 of file EcalPedestalsHandler.h.
popcon::EcalPedestalsHandler::EcalPedestalsHandler | ( | edm::ParameterSet const & | ps | ) |
Definition at line 8 of file EcalPedestalsHandler.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), edm::ParameterSet::getParameter(), m_firstRun, m_gentag, m_lastRun, m_location, m_locationsource, m_pass, m_sid, and m_user.
00009 : m_name(ps.getUntrackedParameter<std::string>("name","EcalPedestalsHandler")) { 00010 00011 std::cout << "EcalPedestals Source handler constructor\n" << std::endl; 00012 m_firstRun=(unsigned long)atoi( ps.getParameter<std::string>("firstRun").c_str()); 00013 m_lastRun=(unsigned long)atoi( ps.getParameter<std::string>("lastRun").c_str()); 00014 m_sid= ps.getParameter<std::string>("OnlineDBSID"); 00015 m_user= ps.getParameter<std::string>("OnlineDBUser"); 00016 m_pass= ps.getParameter<std::string>("OnlineDBPassword"); 00017 m_locationsource= ps.getParameter<std::string>("LocationSource"); 00018 m_location=ps.getParameter<std::string>("Location"); 00019 m_gentag=ps.getParameter<std::string>("GenTag"); 00020 00021 std::cout << m_sid<<"/"<<m_user<<"/"<<m_pass<<"/"<<m_location<<"/"<<m_gentag << std::endl; 00022 00023 00024 }
popcon::EcalPedestalsHandler::~EcalPedestalsHandler | ( | ) |
bool popcon::EcalPedestalsHandler::checkPedestal | ( | EcalPedestals::Item * | item | ) |
Definition at line 44 of file EcalPedestalsHandler.cc.
References HLT_VtxMuL3::result.
Referenced by getNewObjectsP5().
00044 { 00045 // true means all is standard and OK 00046 bool result=true; 00047 if(item->rms_x12 >3 || item->rms_x12<=0) result=false; 00048 if(item->rms_x6 >3 || item->rms_x6<=0) result=false; 00049 if(item->rms_x1 >3 || item->rms_x1<=0) result=false; 00050 if(item->mean_x12>300 || item->mean_x12<=100) result=false; 00051 if(item->mean_x1>300 || item->mean_x1<=100) result=false; 00052 if(item->mean_x6>300 || item->mean_x6<=100) result=false; 00053 return result; 00054 }
void popcon::EcalPedestalsHandler::getNewObjects | ( | ) | [virtual] |
Implements popcon::PopConSourceHandler< T >.
Definition at line 31 of file EcalPedestalsHandler.cc.
References GenMuonPlsPt100GeV_cfg::cout, getNewObjectsH2(), getNewObjectsP5(), and m_locationsource.
00032 { 00033 00034 std::cout << "------- Ecal - > getNewObjects\n"; 00035 00036 if(m_locationsource=="H2") { 00037 getNewObjectsH2(); 00038 } else if (m_locationsource=="P5") { 00039 getNewObjectsP5(); 00040 } 00041 }
void popcon::EcalPedestalsHandler::getNewObjectsH2 | ( | ) |
Definition at line 378 of file EcalPedestalsHandler.cc.
References GenMuonPlsPt100GeV_cfg::cout, econn, EcalCondObjectContainer< T >::endcap(), lat::endl(), Exception, EcalCondDBInterface::fetchDataSet(), EcalCondDBInterface::fetchMonRunList(), flush(), EcalLogicID::getID1(), EcalLogicID::getID2(), MonPedestalsDat::getPedMeanG1(), MonPedestalsDat::getPedMeanG12(), MonPedestalsDat::getPedMeanG6(), MonPedestalsDat::getPedRMSG1(), MonPedestalsDat::getPedRMSG12(), MonPedestalsDat::getPedRMSG6(), MonRunList::getRuns(), EEDetId::hashedIndex(), EcalCondObjectContainer< T >::insert(), int, cond::TagInfo::lastInterval, popcon::PopConSourceHandler< T >::lastPayload(), m_lastRun, m_pass, m_sid, popcon::PopConSourceHandler< T >::m_to_transfer, m_user, p, DetId::rawId(), RunTag::setGeneralTag(), MonRunTag::setGeneralTag(), LocationDef::setLocation(), RunTag::setLocationDef(), MonVersionDef::setMonitoringVersion(), MonRunList::setMonRunTag(), MonRunTag::setMonVersionDef(), MonRunList::setRunTag(), RunTypeDef::setRunType(), RunTag::setRunTypeDef(), popcon::PopConSourceHandler< T >::tagInfo(), and EEDetId::validDetId().
Referenced by getNewObjects().
00379 { 00380 int max_since=0; 00381 max_since=(int)tagInfo().lastInterval.first; 00382 std::cout << "max_since : " << max_since << endl; 00383 Ref ped_db = lastPayload(); 00384 00385 std::cout << "retrieved last payload " << endl; 00386 00387 00388 // we copy the last valid record to a temporary object peds 00389 EcalPedestals* peds = new EcalPedestals(); 00390 00391 // get from offline DB the last valid pedestal set ped_db 00392 // edm::ESHandle<EcalPedestals> pedestals; 00393 // esetup.get<EcalPedestalsRcd>().get(pedestals); 00394 00395 00396 // only positive endcap side and 00397 // x from 86 to 95 00398 // y from 46 to 55 00399 int ixmin=86; int ixmax=95; 00400 int iymin=46; int iymax=55; 00401 for(int iX=ixmin; iX<=ixmax ;++iX) { 00402 for(int iY=iymin; iY<=iymax; ++iY) { 00403 00404 if (EEDetId::validDetId(iX,iY,1)) { 00405 EEDetId eedetidpos(iX,iY,1); 00406 unsigned int hiee = eedetidpos.hashedIndex(); 00407 EcalPedestals::Item aped= ped_db->endcap(hiee); 00408 00409 // here I copy the last valid value in the peds object 00410 EcalPedestals::Item item; 00411 item.mean_x1 = aped.mean_x1; 00412 item.rms_x1 = aped.rms_x1; 00413 item.mean_x6 = aped.mean_x6; 00414 item.rms_x6 = aped.rms_x6; 00415 item.mean_x12 = aped.mean_x12; 00416 item.rms_x12 = aped.rms_x12; 00417 peds->insert(std::make_pair(eedetidpos.rawId(),item)); 00418 if(iX==ixmin && iY==iymin) cout<<"ped12 " << item.mean_x12<< endl; 00419 00420 } 00421 } 00422 } 00423 00424 00425 cout <<"WOW: we just retrieved the last valid record from DB "<< endl; 00426 00427 00428 // here we retrieve all the runs after the last from online DB 00429 00430 cout << "Retrieving run list from ONLINE DB ... " << endl; 00431 00432 cout << "Making connection..." << flush; 00433 econn = new EcalCondDBInterface( m_sid, m_user, m_pass ); 00434 cout << "Done." << endl; 00435 00436 if (!econn) 00437 { 00438 cout << " connection parameters " <<m_sid <<"/"<<m_user<<"/"<<m_pass<<endl; 00439 throw cms::Exception("OMDS not available"); 00440 } 00441 00442 // these are the online conditions DB classes 00443 RunList my_runlist ; 00444 RunTag my_runtag; 00445 LocationDef my_locdef; 00446 RunTypeDef my_rundef; 00447 00448 my_locdef.setLocation("H2_07"); 00449 my_rundef.setRunType("PEDESTAL"); 00450 my_runtag.setLocationDef(my_locdef); 00451 my_runtag.setRunTypeDef(my_rundef); 00452 my_runtag.setGeneralTag("LOCAL"); 00453 00454 00455 // here we retrieve the Monitoring run records 00456 00457 MonVersionDef monverdef; 00458 monverdef.setMonitoringVersion("test01"); 00459 00460 MonRunTag mon_tag; 00461 mon_tag.setGeneralTag("CMSSW"); 00462 mon_tag.setMonVersionDef(monverdef); 00463 MonRunList mon_list; 00464 mon_list.setMonRunTag(mon_tag); 00465 mon_list.setRunTag(my_runtag); 00466 // mon_list=econn->fetchMonRunList(my_runtag, mon_tag); 00467 int min_run=(int)max_since+1; // we have to add 1 to the last transferred one 00468 00469 int max_run=(int)m_lastRun; 00470 mon_list=econn->fetchMonRunList(my_runtag, mon_tag,min_run,max_run ); 00471 00472 std::vector<MonRunIOV> mon_run_vec= mon_list.getRuns(); 00473 int mon_runs=mon_run_vec.size(); 00474 cout <<"number of Mon runs is : "<< mon_runs<< endl; 00475 00476 if(mon_runs>0){ 00477 00478 for(int kr=0; kr<mon_runs; kr++){ 00479 00480 unsigned long irun=(unsigned long) mon_run_vec[kr].getRunIOV().getRunNumber(); 00481 00482 cout << "here is first sub run : "<< mon_run_vec[kr].getSubRunNumber() << endl; 00483 cout << "here is the run number: "<< mon_run_vec[kr].getRunIOV().getRunNumber() << endl; 00484 00485 cout <<" retrieve the data for a given run"<< endl; 00486 00487 if (mon_run_vec[kr].getSubRunNumber() <=1){ 00488 00489 00490 // retrieve the data for a given run 00491 RunIOV runiov_prime = mon_run_vec[kr].getRunIOV(); 00492 00493 // retrieve the pedestals from OMDS for this run 00494 map<EcalLogicID, MonPedestalsDat> dataset_mon; 00495 econn->fetchDataSet(&dataset_mon, &mon_run_vec[kr]); 00496 cout <<"OMDS record for run "<<irun <<" is made of "<< dataset_mon.size() << endl; 00497 typedef map<EcalLogicID, MonPedestalsDat>::const_iterator CImon; 00498 EcalLogicID ecid_xt; 00499 MonPedestalsDat rd_ped; 00500 00501 int iEta=0; 00502 int iPhi=0; 00503 int ix=0; 00504 int iy=0; 00505 00506 for (CImon p = dataset_mon.begin(); p != dataset_mon.end(); p++) { 00507 ecid_xt = p->first; 00508 rd_ped = p->second; 00509 int sm_num=ecid_xt.getID1(); 00510 int xt_num=ecid_xt.getID2(); // careful here !!! we number the channels from 1 to 1700 00511 00512 //iEta=(xt_num/20)+1; 00513 //iPhi=20-(xt_num-(iEta-1)*20); 00514 00515 ix=95-(xt_num-1)/20; 00516 iy=46+(xt_num-1)%20; 00517 00518 00519 EcalPedestals::Item item; 00520 item.mean_x1 =rd_ped.getPedMeanG1() ; 00521 item.rms_x1 =rd_ped.getPedRMSG1(); 00522 item.mean_x6 =rd_ped.getPedMeanG6(); 00523 item.rms_x6 =rd_ped.getPedRMSG6() ; 00524 item.mean_x12 =rd_ped.getPedMeanG12(); 00525 item.rms_x12 =rd_ped.getPedRMSG12(); 00526 00527 EEDetId eedetidpos(ix,iy,1); 00528 // EBDetId ebdetid(iEta,iPhi); 00529 00530 // here we change in the peds object only the values that are available in the online DB 00531 // otherwise we keep the old value 00532 00533 peds->insert(std::make_pair(eedetidpos.rawId(),item)); 00534 if(ix==ixmin && iy==iymin) cout<<"ped12 " << item.mean_x12<< endl; 00535 } 00536 00537 cout << "Generating popcon record for run " << irun << "..." << flush; 00538 00539 00540 // now I copy peds in pedtemp and I ship pedtemp to popcon 00541 // if I use always the same peds I always overwrite 00542 // so I really have to create new objects for each new run 00543 // popcon deletes everything for me 00544 00545 EcalPedestals* pedtemp = new EcalPedestals(); 00546 00547 00548 for(int iX=ixmin; iX<=ixmax ;++iX) { 00549 for(int iY=iymin; iY<=iymax; ++iY) { 00550 00551 if (EEDetId::validDetId(iX,iY,1)) 00552 { 00553 EEDetId eedetidpos(iX,iY,1); 00554 unsigned int hiee = eedetidpos.hashedIndex(); 00555 EcalPedestals::Item aped = peds->endcap(hiee); 00556 00557 EcalPedestals::Item item; 00558 item.mean_x1 = aped.mean_x1; 00559 item.rms_x1 = aped.rms_x1; 00560 item.mean_x6 = aped.mean_x6; 00561 item.rms_x6 = aped.rms_x6; 00562 item.mean_x12 = aped.mean_x12; 00563 item.rms_x12 = aped.rms_x12; 00564 // here I copy the last valid value in the pedtemp object 00565 pedtemp->insert(std::make_pair(eedetidpos.rawId(),item)); 00566 if(iX==ixmin && iY==iymin) cout<<"ped12 " << item.mean_x12<< endl; 00567 } 00568 } 00569 } 00570 00571 00572 00573 Time_t snc= (Time_t) irun ; 00574 00575 m_to_transfer.push_back(std::make_pair((EcalPedestals*)pedtemp,snc)); 00576 00577 std::cout << "Ecal - > end of getNewObjectsH2 -----------\n"; 00578 00579 00580 00581 } 00582 } 00583 00584 } 00585 00586 00587 delete econn; 00588 delete peds; // this is the only one that popcon does not delete 00589 00590 }
void popcon::EcalPedestalsHandler::getNewObjectsP5 | ( | ) |
Definition at line 56 of file EcalPedestalsHandler.cc.
References EcalCondObjectContainer< T >::barrel(), checkPedestal(), GenMuonPlsPt100GeV_cfg::cout, econn, lat::endl(), EBDetId::ETAPHIMODE, Exception, EcalCondDBInterface::fetchDataSet(), EcalCondDBInterface::fetchMonRunList(), flush(), EcalLogicID::getID1(), EcalLogicID::getID2(), MonPedestalsDat::getPedMeanG1(), MonPedestalsDat::getPedMeanG12(), MonPedestalsDat::getPedMeanG6(), MonPedestalsDat::getPedRMSG1(), MonPedestalsDat::getPedRMSG12(), MonPedestalsDat::getPedRMSG6(), MonRunList::getRuns(), EBDetId::hashedIndex(), EcalCondObjectContainer< T >::insert(), int, it, cond::TagInfo::lastInterval, popcon::PopConSourceHandler< T >::lastPayload(), m_firstRun, m_gentag, m_lastRun, m_location, m_pass, m_sid, popcon::PopConSourceHandler< T >::m_to_transfer, m_user, popcon::PopConSourceHandler< T >::m_userTextLog, EBDetId::MAX_IETA, EBDetId::MAX_IPHI, EBDetId::MIN_IPHI, p, DetId::rawId(), RunTag::setGeneralTag(), MonRunTag::setGeneralTag(), LocationDef::setLocation(), RunTag::setLocationDef(), MonVersionDef::setMonitoringVersion(), MonRunList::setMonRunTag(), MonRunTag::setMonVersionDef(), MonRunList::setRunTag(), RunTypeDef::setRunType(), RunTag::setRunTypeDef(), EBDetId::SMCRYSTALMODE, ss, popcon::PopConSourceHandler< T >::tagInfo(), EBDetId::validDetId(), and x.
Referenced by getNewObjects().
00057 { 00058 00059 std::ostringstream ss; 00060 ss<<"ECAL "; 00061 00062 int max_since=0; 00063 max_since=(int)tagInfo().lastInterval.first; 00064 std::cout << "max_since : " << max_since << endl; 00065 Ref ped_db = lastPayload(); 00066 00067 std::cout << "retrieved last payload " << endl; 00068 00069 00070 // we copy the last valid record to a temporary object peds 00071 EcalPedestals* peds = new EcalPedestals(); 00072 00073 std::cout << "retrieved last payload " << endl; 00074 00075 // const EcalPedestalsMap & pedMap = ped_db->getMap(); // map of pedestals 00076 std::cout << "retrieved last payload " << endl; 00077 00078 for(int iEta=-EBDetId::MAX_IETA; iEta<=EBDetId::MAX_IETA ;++iEta) { 00079 if(iEta==0) continue; 00080 for(int iPhi=EBDetId::MIN_IPHI; iPhi<=EBDetId::MAX_IPHI; ++iPhi) { 00081 // make an EBDetId since we need EBDetId::rawId() to be used as the key for the pedestals 00082 if (EBDetId::validDetId(iEta,iPhi)) 00083 { 00084 00085 00086 EBDetId ebdetid(iEta,iPhi,EBDetId::ETAPHIMODE); 00087 //unsigned int hiee = ebdetid.hashedIndex(); 00088 //EcalPedestals::Item aped= ped_db->barrel(hiee); 00089 EcalPedestals::const_iterator it =ped_db->find(ebdetid.rawId()); 00090 00091 // pedIter= pedMap.find(ebdetid.rawId()); 00092 //pedIter= pedMap.find(hiee); 00093 EcalPedestals::Item aped = (*it); 00094 00095 00096 // here I copy the last valid value in the peds object 00097 EcalPedestals::Item item; 00098 item.mean_x1 = aped.mean_x1; 00099 item.rms_x1 = aped.rms_x1; 00100 item.mean_x6 = aped.mean_x6; 00101 item.rms_x6 = aped.rms_x6; 00102 item.mean_x12 = aped.mean_x12; 00103 item.rms_x12 = aped.rms_x12; 00104 00105 peds->insert(std::make_pair(ebdetid.rawId(),item)); 00106 00107 } 00108 } 00109 } 00110 00111 /* 00112 for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) { 00113 for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) { 00114 // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals 00115 if (EEDetId::validDetId(iX,iY,1)) 00116 { 00117 EEDetId eedetidpos(iX,iY,1); 00118 unsigned int hiee = eedetidpos.hashedIndex(); 00119 EcalPedestals::Item aped= ped_db->endcap(hiee); 00120 00121 // here I copy the last valid value in the peds object 00122 EcalPedestals::Item item; 00123 item.mean_x1 = aped.mean_x1; 00124 item.rms_x1 = aped.rms_x1; 00125 item.mean_x6 = aped.mean_x6; 00126 item.rms_x6 = aped.rms_x6; 00127 item.mean_x12 = aped.mean_x12; 00128 item.rms_x12 = aped.rms_x12; 00129 peds->insert(std::make_pair(eedetidpos.rawId(),item)); 00130 00131 } 00132 if(EEDetId::validDetId(iX,iY,-1)) 00133 { 00134 EEDetId eedetidneg(iX,iY,-1); 00135 00136 unsigned int hiee = eedetidneg.hashedIndex(); 00137 EcalPedestals::Item aped= ped_db->endcap(hiee); 00138 00139 // here I copy the last valid value in the peds object 00140 EcalPedestals::Item item; 00141 item.mean_x1 = aped.mean_x1; 00142 item.rms_x1 = aped.rms_x1; 00143 item.mean_x6 = aped.mean_x6; 00144 item.rms_x6 = aped.rms_x6; 00145 item.mean_x12 = aped.mean_x12; 00146 item.rms_x12 = aped.rms_x12; 00147 peds->insert(std::make_pair(eedetidneg.rawId(),item)); 00148 00149 } 00150 } 00151 } 00152 00153 */ 00154 00155 cout <<"WOW: we just retrieved the last valid record from DB "<< endl; 00156 00157 00158 // here we retrieve all the runs after the last from online DB 00159 00160 cout << "Retrieving run list from ONLINE DB ... " << endl; 00161 00162 cout << "Making connection..." << flush; 00163 econn = new EcalCondDBInterface( m_sid, m_user, m_pass ); 00164 cout << "Done." << endl; 00165 00166 if (!econn) 00167 { 00168 cout << " connection parameters " <<m_sid <<"/"<<m_user<<"/"<<m_pass<<endl; 00169 // cerr << e.what() << endl; 00170 throw cms::Exception("OMDS not available"); 00171 } 00172 00173 // these are the online conditions DB classes 00174 RunList my_runlist ; 00175 RunTag my_runtag; 00176 LocationDef my_locdef; 00177 RunTypeDef my_rundef; 00178 00179 my_locdef.setLocation(m_location); 00180 my_rundef.setRunType("PEDESTAL"); 00181 my_runtag.setLocationDef(my_locdef); 00182 my_runtag.setRunTypeDef(my_rundef); 00183 my_runtag.setGeneralTag(m_gentag); 00184 00185 00186 // here we retrieve the Monitoring run records 00187 00188 MonVersionDef monverdef; 00189 monverdef.setMonitoringVersion("test01"); 00190 00191 MonRunTag mon_tag; 00192 mon_tag.setGeneralTag("CMSSW"); 00193 mon_tag.setMonVersionDef(monverdef); 00194 MonRunList mon_list; 00195 mon_list.setMonRunTag(mon_tag); 00196 mon_list.setRunTag(my_runtag); 00197 // mon_list=econn->fetchMonRunList(my_runtag, mon_tag); 00198 int min_run=0; 00199 if(m_firstRun<max_since) { 00200 min_run= (int)max_since+1; // we have to add 1 to the last transferred one 00201 } else { 00202 min_run=(int)m_firstRun; 00203 } 00204 00205 int max_run=(int)m_lastRun; 00206 mon_list=econn->fetchMonRunList(my_runtag, mon_tag,min_run,max_run ); 00207 00208 std::vector<MonRunIOV> mon_run_vec= mon_list.getRuns(); 00209 int mon_runs=mon_run_vec.size(); 00210 cout <<"number of Mon runs is : "<< mon_runs<< endl; 00211 00212 if(mon_runs>0){ 00213 00214 for(int kr=0; kr<mon_runs; kr++){ 00215 00216 unsigned long irun=(unsigned long) mon_run_vec[kr].getRunIOV().getRunNumber(); 00217 cout << "here is the run number: "<< mon_run_vec[kr].getRunIOV().getRunNumber() << endl; 00218 00219 cout <<" retrieve the data for a given run"<< endl; 00220 00221 if (mon_run_vec[kr].getSubRunNumber() <=1){ 00222 00223 // retrieve the data for a given run 00224 RunIOV runiov_prime = mon_run_vec[kr].getRunIOV(); 00225 00226 // retrieve the pedestals from OMDS for this run 00227 map<EcalLogicID, MonPedestalsDat> dataset_mon; 00228 econn->fetchDataSet(&dataset_mon, &mon_run_vec[kr]); 00229 cout <<"OMDS record for run "<<irun <<" is made of "<< dataset_mon.size() << endl; 00230 typedef map<EcalLogicID, MonPedestalsDat>::const_iterator CImon; 00231 EcalLogicID ecid_xt; 00232 MonPedestalsDat rd_ped; 00233 00234 00235 00236 00237 00238 00239 // this to validate ... 00240 int nbad=0; 00241 for (CImon p = dataset_mon.begin(); p != dataset_mon.end(); p++) { 00242 ecid_xt = p->first; 00243 rd_ped = p->second; 00244 int sm_num=ecid_xt.getID1(); 00245 int xt_num=ecid_xt.getID2(); 00246 00247 EcalPedestals::Item item; 00248 item.mean_x1 =rd_ped.getPedMeanG1() ; 00249 item.rms_x1 =rd_ped.getPedRMSG1(); 00250 item.mean_x6 =rd_ped.getPedMeanG6(); 00251 item.rms_x6 =rd_ped.getPedRMSG6() ; 00252 item.mean_x12 =rd_ped.getPedMeanG12(); 00253 item.rms_x12 =rd_ped.getPedRMSG12(); 00254 00255 EBDetId ebdetid(sm_num,xt_num,EBDetId::SMCRYSTALMODE); 00256 // here we change in the peds object only the values that are available in the online DB 00257 // otherwise we keep the old value 00258 00259 if(!checkPedestal(&item) ){ 00260 nbad++; 00261 cout <<"BAD LIST: channel " << sm_num << "/" << xt_num << "ped/rms "<<item.mean_x12<< "/"<< item.rms_x12 << endl; 00262 } 00263 } 00264 00265 // ok or bad? 00266 // a bad run is for more than 10% bad channels 00267 00268 if(nbad<(dataset_mon.size()*0.1)){ 00269 00270 for (CImon p = dataset_mon.begin(); p != dataset_mon.end(); p++) { 00271 ecid_xt = p->first; 00272 rd_ped = p->second; 00273 int sm_num=ecid_xt.getID1(); 00274 int xt_num=ecid_xt.getID2(); 00275 00276 EcalPedestals::Item item; 00277 item.mean_x1 =rd_ped.getPedMeanG1() ; 00278 item.rms_x1 =rd_ped.getPedRMSG1(); 00279 item.mean_x6 =rd_ped.getPedMeanG6(); 00280 item.rms_x6 =rd_ped.getPedRMSG6() ; 00281 item.mean_x12 =rd_ped.getPedMeanG12(); 00282 item.rms_x12 =rd_ped.getPedRMSG12(); 00283 00284 EBDetId ebdetid(sm_num,xt_num,EBDetId::SMCRYSTALMODE); 00285 00286 // individual objects check 00287 if(item.mean_x1==-1 || item.rms_x1 ==-1 || item.mean_x6==-1 || 00288 item.rms_x6==-1 || item.mean_x12==-1 || item.rms_x12==-1 || 00289 item.mean_x1==0 || item.rms_x1 ==0 || item.mean_x6==0 || 00290 item.rms_x6==0 || item.mean_x12==0 || item.rms_x12==0 ) { 00291 // if one is bad we 00292 // retrieve the old valid value 00293 unsigned int hieb = ebdetid.hashedIndex(); 00294 EcalPedestals::Item previous_ped= peds->barrel(hieb); 00295 if(item.mean_x1==-1 || item.mean_x1==0) item.mean_x1 =previous_ped.mean_x1; 00296 if(item.rms_x1==-1 || item.rms_x1==0) item.rms_x1 =previous_ped.rms_x1; 00297 if(item.mean_x6==-1 || item.mean_x6==0) item.mean_x6 =previous_ped.mean_x6; 00298 if(item.rms_x6==-1 || item.rms_x6==0) item.rms_x6 =previous_ped.rms_x6; 00299 if(item.mean_x12==-1 || item.mean_x12==0)item.mean_x12=previous_ped.mean_x12; 00300 if(item.rms_x12==-1 || item.rms_x12==0) item.rms_x12 =previous_ped.rms_x12; 00301 } 00302 00303 // here we change in the peds object only the channels that are available in the online DB 00304 // otherwise we keep the previous value 00305 peds->insert(std::make_pair(ebdetid.rawId(),item)); 00306 } 00307 00308 cout << "Generating popcon record for run " << irun << "..." << flush; 00309 00310 // now I copy peds in pedtemp and I ship pedtemp to popcon 00311 // if I use always the same peds I always overwrite 00312 // so I really have to create new objects for each new run 00313 // popcon deletes everything for me 00314 00315 EcalPedestals* pedtemp = new EcalPedestals(); 00316 00317 for(int iEta=-EBDetId::MAX_IETA; iEta<=EBDetId::MAX_IETA ;++iEta) { 00318 if(iEta==0) continue; 00319 for(int iPhi=EBDetId::MIN_IPHI; iPhi<=EBDetId::MAX_IPHI; ++iPhi) { 00320 // make an EBDetId since we need EBDetId::rawId() to be used as the key for the pedestals 00321 if (EBDetId::validDetId(iEta,iPhi)) 00322 { 00323 EBDetId ebdetid(iEta,iPhi); 00324 unsigned int hiee = ebdetid.hashedIndex(); 00325 EcalPedestals::Item aped= peds->barrel(hiee); 00326 00327 // here I copy the last valid value in the peds object 00328 EcalPedestals::Item item; 00329 item.mean_x1 = aped.mean_x1; 00330 item.rms_x1 = aped.rms_x1; 00331 item.mean_x6 = aped.mean_x6; 00332 item.rms_x6 = aped.rms_x6; 00333 item.mean_x12 = aped.mean_x12; 00334 item.rms_x12 = aped.rms_x12; 00335 // here I copy the last valid value in the pedtemp object 00336 pedtemp->insert(std::make_pair(ebdetid.rawId(),item)); 00337 if((iEta==-1 || iEta==1) && iPhi==20){ 00338 float x=aped.mean_x12 ; 00339 cout<< "channel:" <<iEta<<"/"<<iPhi<< "/" << hiee << " ped mean 12="<< x << endl; 00340 } 00341 } 00342 } 00343 } 00344 00345 00346 Time_t snc= (Time_t) irun ; 00347 00348 m_to_transfer.push_back(std::make_pair((EcalPedestals*)pedtemp,snc)); 00349 00350 00351 ss << "Run=" << irun << "_WAS_GOOD_"<<endl; 00352 m_userTextLog = ss.str()+";"; 00353 00354 00355 00356 } else { 00357 00358 cout<< "Run was BAD !!!! not sent to the DB"<< endl; 00359 ss << "Run=" << irun << "_WAS_BAD_"<<endl; 00360 m_userTextLog = ss.str()+";"; 00361 } 00362 } 00363 } 00364 00365 } 00366 00367 00368 delete econn; 00369 00370 delete peds; // this is the only one that popcon does not delete 00371 00372 std::cout << "Ecal - > end of getNewObjects -----------\n"; 00373 00374 00375 }
std::string popcon::EcalPedestalsHandler::id | ( | void | ) | const [inline, virtual] |
Implements popcon::PopConSourceHandler< T >.
Definition at line 72 of file EcalPedestalsHandler.h.
References m_name.
00072 { return m_name;}
Definition at line 73 of file EcalPedestalsHandler.h.
Referenced by getNewObjectsH2(), and getNewObjectsP5().
unsigned long popcon::EcalPedestalsHandler::m_firstRun [private] |
Definition at line 78 of file EcalPedestalsHandler.h.
Referenced by EcalPedestalsHandler(), and getNewObjectsP5().
std::string popcon::EcalPedestalsHandler::m_gentag [private] |
Definition at line 82 of file EcalPedestalsHandler.h.
Referenced by EcalPedestalsHandler(), and getNewObjectsP5().
unsigned long popcon::EcalPedestalsHandler::m_lastRun [private] |
Definition at line 79 of file EcalPedestalsHandler.h.
Referenced by EcalPedestalsHandler(), getNewObjectsH2(), and getNewObjectsP5().
std::string popcon::EcalPedestalsHandler::m_location [private] |
Definition at line 81 of file EcalPedestalsHandler.h.
Referenced by EcalPedestalsHandler(), and getNewObjectsP5().
std::string popcon::EcalPedestalsHandler::m_locationsource [private] |
Definition at line 86 of file EcalPedestalsHandler.h.
Referenced by EcalPedestalsHandler(), and getNewObjects().
std::string popcon::EcalPedestalsHandler::m_name [private] |
std::string popcon::EcalPedestalsHandler::m_pass [private] |
Definition at line 85 of file EcalPedestalsHandler.h.
Referenced by EcalPedestalsHandler(), getNewObjectsH2(), and getNewObjectsP5().
std::string popcon::EcalPedestalsHandler::m_sid [private] |
Definition at line 83 of file EcalPedestalsHandler.h.
Referenced by EcalPedestalsHandler(), getNewObjectsH2(), and getNewObjectsP5().
std::string popcon::EcalPedestalsHandler::m_user [private] |
Definition at line 84 of file EcalPedestalsHandler.h.
Referenced by EcalPedestalsHandler(), getNewObjectsH2(), and getNewObjectsP5().
const EcalPedestals* popcon::EcalPedestalsHandler::mypedestals [private] |
Definition at line 76 of file EcalPedestalsHandler.h.