#include <CondTools/Ecal/interface/EcalTestDevDB.h>
Public Member Functions | |
virtual void | analyze (const edm::Event &evt, const edm::EventSetup &evtSetup) |
EcalTestDevDB (const edm::ParameterSet &iConfig) | |
EcalADCToGeVConstant * | generateEcalADCToGeVConstant () |
EcalGainRatios * | generateEcalGainRatios () |
EcalIntercalibConstants * | generateEcalIntercalibConstants () |
EcalLaserAlphas * | generateEcalLaserAlphas () |
EcalLaserAPDPNRatios * | generateEcalLaserAPDPNRatios (uint32_t i_run) |
EcalLaserAPDPNRatiosRef * | generateEcalLaserAPDPNRatiosRef () |
EcalPedestals * | generateEcalPedestals () |
EcalTBWeights * | generateEcalTBWeights () |
EcalWeightXtalGroups * | generateEcalWeightXtalGroups () |
~EcalTestDevDB () | |
Private Attributes | |
std::map< std::string, unsigned long long > | m_cacheIDs |
unsigned long | m_firstRun |
unsigned int | m_interval |
unsigned long | m_lastRun |
std::map< std::string, std::string > | m_records |
std::string | m_timetype |
Definition at line 43 of file EcalTestDevDB.h.
EcalTestDevDB::EcalTestDevDB | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 25 of file EcalTestDevDB.cc.
References edm::ParameterSet::getParameter(), i, int, m_cacheIDs, m_firstRun, m_interval, m_lastRun, m_records, ecalRecalibSequence_cff::record, and ecalRecalibSequence_cff::tag.
00025 : 00026 m_timetype(iConfig.getParameter<std::string>("timetype")), 00027 m_cacheIDs(), 00028 m_records() 00029 { 00030 00031 std::string container; 00032 std::string tag; 00033 std::string record; 00034 00035 m_firstRun=(unsigned long)atoi( iConfig.getParameter<std::string>("firstRun").c_str()); 00036 m_lastRun=(unsigned long)atoi( iConfig.getParameter<std::string>("lastRun").c_str()); 00037 m_interval=(unsigned int)atoi( iConfig.getParameter<std::string>("interval").c_str()); 00038 00039 typedef std::vector< edm::ParameterSet > Parameters; 00040 Parameters toCopy = iConfig.getParameter<Parameters>("toCopy"); 00041 for(Parameters::iterator i = toCopy.begin(); i != toCopy.end(); ++i) { 00042 container = i->getParameter<std::string>("container"); 00043 record = i->getParameter<std::string>("record"); 00044 m_cacheIDs.insert( std::make_pair(container, 0) ); 00045 m_records.insert( std::make_pair(container, record) ); 00046 } 00047 00048 }
EcalTestDevDB::~EcalTestDevDB | ( | ) |
void EcalTestDevDB::analyze | ( | const edm::Event & | evt, | |
const edm::EventSetup & | evtSetup | |||
) | [virtual] |
Implements edm::EDAnalyzer.
Definition at line 56 of file EcalTestDevDB.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), edm::IOVSyncValue::endOfTime(), Exception, flush(), generateEcalADCToGeVConstant(), generateEcalGainRatios(), generateEcalIntercalibConstants(), generateEcalLaserAlphas(), generateEcalLaserAPDPNRatios(), generateEcalLaserAPDPNRatiosRef(), generateEcalPedestals(), generateEcalTBWeights(), generateEcalWeightXtalGroups(), i, edm::Service< T >::isAvailable(), m_firstRun, m_interval, m_lastRun, m_records, ecalRecalibSequence_cff::record, and HLT_VtxMuL3::recordName.
00057 { 00058 00059 edm::Service<cond::service::PoolDBOutputService> dbOutput; 00060 if ( !dbOutput.isAvailable() ) { 00061 throw cms::Exception("PoolDBOutputService is not available"); 00062 } 00063 00064 00065 00066 std::string container; 00067 std::string record; 00068 typedef std::map<std::string, std::string>::const_iterator recordIter; 00069 for (recordIter i = m_records.begin(); i != m_records.end(); ++i) { 00070 container = (*i).first; 00071 record = (*i).second; 00072 00073 std::string recordName = m_records[container]; 00074 00075 00076 // Loop through each of the runs 00077 00078 unsigned long nrec=(m_lastRun-m_firstRun)/m_interval+1; 00079 unsigned long nstart=0; 00080 if (m_firstRun == 0 && m_lastRun == 0) { 00081 // it should do at least once the loop 00082 nstart=0; 00083 nrec=1; 00084 } 00085 00086 for(unsigned long i=nstart; i<nrec; i++) { 00087 unsigned long irun=m_firstRun+i*m_interval; 00088 00089 00090 // Arguments 0 0 mean infinite IOV 00091 if (m_firstRun == 0 && m_lastRun == 0) { 00092 cout << "Infinite IOV mode" << endl; 00093 irun = edm::IOVSyncValue::endOfTime().eventID().run(); 00094 } 00095 00096 cout << "Starting Transaction for run " << irun << "..." << flush; 00097 00098 if (container == "EcalPedestals") { 00099 EcalPedestals* condObject= generateEcalPedestals(); 00100 00101 if(irun==m_firstRun && dbOutput->isNewTagRequest(recordName)) { 00102 // create new 00103 std::cout<<"First One "<<std::endl; 00104 dbOutput->createNewIOV<const EcalPedestals>( condObject, dbOutput->beginOfTime(),dbOutput->endOfTime() ,recordName); 00105 } else { 00106 // append 00107 std::cout<<"Old One "<<std::endl; 00108 dbOutput->appendSinceTime<const EcalPedestals>( condObject, irun , recordName); 00109 } 00110 00111 } else if (container == "EcalADCToGeVConstant") { 00112 00113 EcalADCToGeVConstant* condObject= generateEcalADCToGeVConstant(); 00114 if(irun==m_firstRun && dbOutput->isNewTagRequest(recordName)) { 00115 // create new 00116 std::cout<<"First One "<<std::endl; 00117 dbOutput->createNewIOV<const EcalADCToGeVConstant>( condObject, dbOutput->beginOfTime(),dbOutput->endOfTime() ,recordName); 00118 } else { 00119 // append 00120 std::cout<<"Old One "<<std::endl; 00121 dbOutput->appendSinceTime<const EcalADCToGeVConstant>( condObject, irun , recordName); 00122 } 00123 00124 00125 } else if (container == "EcalIntercalibConstants") { 00126 EcalIntercalibConstants* condObject= generateEcalIntercalibConstants(); 00127 if(irun==m_firstRun && dbOutput->isNewTagRequest(recordName)) { 00128 // create new 00129 std::cout<<"First One "<<std::endl; 00130 dbOutput->createNewIOV<const EcalIntercalibConstants>( condObject, dbOutput->beginOfTime(),dbOutput->endOfTime() ,recordName); 00131 } else { 00132 // append 00133 std::cout<<"Old One "<<std::endl; 00134 dbOutput->appendSinceTime<const EcalIntercalibConstants>( condObject, irun , recordName); 00135 } 00136 00137 } else if (container == "EcalGainRatios") { 00138 EcalGainRatios* condObject= generateEcalGainRatios(); 00139 if(irun==m_firstRun && dbOutput->isNewTagRequest(recordName)) { 00140 // create new 00141 std::cout<<"First One "<<std::endl; 00142 dbOutput->createNewIOV<const EcalGainRatios>( condObject,dbOutput->beginOfTime(), dbOutput->endOfTime() ,recordName); 00143 } else { 00144 // append 00145 std::cout<<"Old One "<<std::endl; 00146 dbOutput->appendSinceTime<const EcalGainRatios>( condObject, irun , recordName); 00147 } 00148 00149 } else if (container == "EcalWeightXtalGroups") { 00150 EcalWeightXtalGroups* condObject= generateEcalWeightXtalGroups(); 00151 if(irun==m_firstRun && dbOutput->isNewTagRequest(recordName)) { 00152 // create new 00153 std::cout<<"First One "<<std::endl; 00154 dbOutput->createNewIOV<const EcalWeightXtalGroups>( condObject, dbOutput->beginOfTime(), dbOutput->endOfTime() ,recordName); 00155 } else { 00156 // append 00157 std::cout<<"Old One "<<std::endl; 00158 dbOutput->appendSinceTime<const EcalWeightXtalGroups>( condObject, irun , recordName); 00159 } 00160 00161 } else if (container == "EcalTBWeights") { 00162 EcalTBWeights* condObject= generateEcalTBWeights(); 00163 if(irun==m_firstRun && dbOutput->isNewTagRequest(recordName)) { 00164 // create new 00165 std::cout<<"First One "<<std::endl; 00166 dbOutput->createNewIOV<const EcalTBWeights>( condObject, dbOutput->beginOfTime(), dbOutput->endOfTime() ,recordName); 00167 } else { 00168 // append 00169 std::cout<<"Old One "<<std::endl; 00170 dbOutput->appendSinceTime<const EcalTBWeights>( condObject, irun , recordName); 00171 } 00172 00173 } else if (container == "EcalLaserAPDPNRatios") { 00174 EcalLaserAPDPNRatios* condObject= generateEcalLaserAPDPNRatios(irun); 00175 if(irun==m_firstRun && dbOutput->isNewTagRequest(recordName)) { 00176 // create new 00177 std::cout<<"First One "<<std::endl; 00178 dbOutput->createNewIOV<const EcalLaserAPDPNRatios>( condObject,dbOutput->beginOfTime(), dbOutput->endOfTime() ,recordName); 00179 } else { 00180 // append 00181 std::cout<<"Old One "<<std::endl; 00182 dbOutput->appendSinceTime<const EcalLaserAPDPNRatios>( condObject, irun , recordName); 00183 } 00184 } else if (container == "EcalLaserAPDPNRatiosRef") { 00185 EcalLaserAPDPNRatiosRef* condObject= generateEcalLaserAPDPNRatiosRef(); 00186 if(irun==m_firstRun && dbOutput->isNewTagRequest(recordName)) { 00187 // create new 00188 std::cout<<"First One "<<std::endl; 00189 dbOutput->createNewIOV<const EcalLaserAPDPNRatiosRef>( condObject, dbOutput->beginOfTime(), dbOutput->endOfTime() ,recordName); 00190 } else { 00191 // append 00192 std::cout<<"Old One "<<std::endl; 00193 dbOutput->appendSinceTime<const EcalLaserAPDPNRatiosRef>( condObject, irun , recordName); 00194 } 00195 } else if (container == "EcalLaserAlphas") { 00196 EcalLaserAlphas* condObject= generateEcalLaserAlphas(); 00197 if(irun==m_firstRun && dbOutput->isNewTagRequest(recordName)) { 00198 // create new 00199 std::cout<<"First One "<<std::endl; 00200 dbOutput->createNewIOV<const EcalLaserAlphas>( condObject,dbOutput->beginOfTime(), dbOutput->endOfTime() ,recordName); 00201 } else { 00202 // append 00203 std::cout<<"Old One "<<std::endl; 00204 dbOutput->appendSinceTime<const EcalLaserAlphas>( condObject, irun , recordName); 00205 } 00206 } else { 00207 cout << "it does not work yet for " << container << "..." << flush; 00208 00209 } 00210 00211 00212 } 00213 00214 00215 } 00216 00217 00218 }
EcalADCToGeVConstant * EcalTestDevDB::generateEcalADCToGeVConstant | ( | ) |
Definition at line 247 of file EcalTestDevDB.cc.
References r.
Referenced by analyze().
00247 { 00248 //------------------------------------------------------------- 00249 00250 double r = (double)std::rand()/( double(RAND_MAX)+double(1) ); 00251 EcalADCToGeVConstant* agc = new EcalADCToGeVConstant(36.+r*4., 60.+r*4); 00252 return agc; 00253 }
EcalGainRatios * EcalTestDevDB::generateEcalGainRatios | ( | ) |
Definition at line 277 of file EcalTestDevDB.cc.
References EBDetId::MAX_IETA, EBDetId::MAX_IPHI, EBDetId::MIN_IPHI, r, DetId::rawId(), EcalMGPAGainRatio::setGain12Over6(), EcalMGPAGainRatio::setGain6Over1(), and EcalCondObjectContainer< T >::setValue().
Referenced by analyze().
00277 { 00278 //------------------------------------------------------------- 00279 00280 // create gain ratios 00281 EcalGainRatios* gratio = new EcalGainRatios; 00282 00283 for(int ieta=-EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA; ++ieta) { 00284 if(ieta==0) continue; 00285 for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId:: MAX_IPHI; ++iphi) { 00286 00287 EBDetId ebid(ieta,iphi); 00288 00289 double r = (double)std::rand()/( double(RAND_MAX)+double(1) ); 00290 00291 EcalMGPAGainRatio gr; 00292 gr.setGain12Over6( 1.9 + r*0.2 ); 00293 gr.setGain6Over1( 5.9 + r*0.2 ); 00294 00295 gratio->setValue( ebid.rawId(), gr ); 00296 00297 } // loop over phi 00298 } // loop over eta 00299 return gratio; 00300 }
EcalIntercalibConstants * EcalTestDevDB::generateEcalIntercalibConstants | ( | ) |
Definition at line 257 of file EcalTestDevDB.cc.
References EBDetId::MAX_IETA, EBDetId::MAX_IPHI, EBDetId::MIN_IPHI, r, DetId::rawId(), and EcalCondObjectContainer< T >::setValue().
Referenced by analyze().
00257 { 00258 //------------------------------------------------------------- 00259 00260 EcalIntercalibConstants* ical = new EcalIntercalibConstants(); 00261 00262 for(int ieta=-EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA; ++ieta) { 00263 if(ieta==0) continue; 00264 for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId:: MAX_IPHI; ++iphi) { 00265 00266 EBDetId ebid(ieta,iphi); 00267 00268 double r = (double)std::rand()/( double(RAND_MAX)+double(1) ); 00269 ical->setValue( ebid.rawId(), 0.85 + r*0.3 ); 00270 } // loop over phi 00271 } // loop over eta 00272 return ical; 00273 }
EcalLaserAlphas * EcalTestDevDB::generateEcalLaserAlphas | ( | ) |
Definition at line 583 of file EcalTestDevDB.cc.
References lat::endl(), EcalCondObjectContainer< T >::getMap(), EEDetId::hashedIndex(), EBDetId::hashedIndex(), EEDetId::IX_MAX, EEDetId::IX_MIN, EEDetId::IY_MAX, EEDetId::IY_MIN, EBDetId::MAX_HASH, EBDetId::MAX_IETA, EBDetId::MAX_IPHI, EBDetId::MIN_IPHI, EcalCondObjectContainer< T >::setValue(), and EEDetId::validDetId().
Referenced by analyze().
00583 { 00584 //-------------------------------------------------------------- 00585 00586 EcalLaserAlphas* laser = new EcalLaserAlphas(); 00587 00588 EcalLaserAlpha Alpha; 00589 00590 for(int iEta=-EBDetId::MAX_IETA; iEta<=EBDetId::MAX_IETA ;++iEta) { 00591 if(iEta==0) continue; 00592 for(int iPhi=EBDetId::MIN_IPHI; iPhi<=EBDetId::MAX_IPHI; ++iPhi) { 00593 Alpha = double(1.55); 00594 EBDetId ebid(iEta,iPhi); 00595 00596 int hi = ebid.hashedIndex(); 00597 if (hi< (int) laser->getMap().size()) { 00598 laser->setValue(hi, Alpha); 00599 } else { 00600 edm::LogError("EcalTestDevDB") << "error with laser Map (alpha)!" << endl; 00601 } 00602 } 00603 } 00604 00605 for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) { 00606 for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) { 00607 00608 if (!EEDetId::validDetId(iX,iY,1)) 00609 continue; 00610 00611 EEDetId eedetidpos(iX,iY,1); 00612 Alpha = double(1.55); 00613 00614 int hi = eedetidpos.hashedIndex() + EBDetId::MAX_HASH + 1; 00615 if (hi< (int) laser->getMap().size()) { 00616 laser->setValue(hi, Alpha); 00617 } else { 00618 edm::LogError("EcalTestDevDB") << "error with laser Map (alpha)!" << endl; 00619 } 00620 00621 if (!EEDetId::validDetId(iX,iY,-1)) 00622 continue; 00623 EEDetId eedetidneg(iX,iY,-1); 00624 Alpha = double(1.55); 00625 00626 hi = eedetidneg.hashedIndex() + EBDetId::MAX_HASH + 1; 00627 if (hi< (int) laser->getMap().size()) { 00628 laser->setValue(hi, Alpha); 00629 } else { 00630 edm::LogError("EcalTestDevDB") << "error with laser Map (alpha)!" << endl; 00631 } 00632 } 00633 } 00634 00635 return laser; 00636 }
EcalLaserAPDPNRatios * EcalTestDevDB::generateEcalLaserAPDPNRatios | ( | uint32_t | i_run | ) |
Definition at line 370 of file EcalTestDevDB.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), funct::exp(), EcalLaserAPDPNRatios::getLaserMap(), EcalLaserAPDPNRatios::getTimeMap(), EEDetId::hashedIndex(), EBDetId::hashedIndex(), i, EEDetId::IX_MAX, EEDetId::IX_MIN, EEDetId::IY_MAX, EEDetId::IY_MIN, funct::log(), m_firstRun, m_lastRun, EBDetId::MAX_HASH, EBDetId::MAX_IETA, EBDetId::MAX_IPHI, EBDetId::MIN_IPHI, EcalLaserAPDPNRatios::EcalLaserAPDPNpair::p1, EcalLaserAPDPNRatios::EcalLaserAPDPNpair::p2, EcalLaserAPDPNRatios::setTime(), EcalLaserAPDPNRatios::setValue(), EcalLaserAPDPNRatios::EcalLaserTimeStamp::t1, EcalLaserAPDPNRatios::EcalLaserTimeStamp::t2, and EEDetId::validDetId().
Referenced by analyze().
00370 { 00371 //-------------------------------------------------------------- 00372 00373 EcalLaserAPDPNRatios* laser = new EcalLaserAPDPNRatios(); 00374 00375 EcalLaserAPDPNRatios::EcalLaserAPDPNpair APDPNpair; 00376 EcalLaserAPDPNRatios::EcalLaserTimeStamp TimeStamp; 00377 00378 // if((m_firstRun == 0 && i_run == 0) || (m_firstRun == 1 && i_run == 1)){ 00379 00380 std::cout << "First & last run: " << i_run << " " << m_firstRun << " " << m_lastRun << " " << std::endl; 00381 if (m_firstRun == i_run && (i_run == 0 || i_run == 1) ) { 00382 00383 APDPNpair.p1= (double(1)+1/double(log(exp(1)+double((i_run-m_firstRun)*10))))/double(2); 00384 APDPNpair.p2= (double(1)+1/double(log(exp(1)+double((i_run-m_firstRun)*10)+double(10))))/double(2); 00385 cout << i_run << " " << m_firstRun << " " << APDPNpair.p1 << " " << APDPNpair.p2 << std::endl; 00386 00387 for(int iEta=-EBDetId::MAX_IETA; iEta<=EBDetId::MAX_IETA ;++iEta) { 00388 if(iEta==0) continue; 00389 for(int iPhi=EBDetId::MIN_IPHI; iPhi<=EBDetId::MAX_IPHI; ++iPhi) { 00390 //APDPNpair.p1= double(1); 00391 //APDPNpair.p2= double(1); 00392 00393 EBDetId ebid(iEta,iPhi); 00394 int hi = ebid.hashedIndex(); 00395 00396 if (hi< (int) laser->getLaserMap().size()) { 00397 laser->setValue(hi, APDPNpair); 00398 } else { 00399 edm::LogError("EcalTestDevDB") << "error with laser Map (ratio)!" << endl; 00400 continue; 00401 } 00402 } 00403 } 00404 00405 for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) { 00406 for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) { 00407 // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals 00408 00409 if (!EEDetId::validDetId(iX,iY,1)) 00410 continue; 00411 00412 EEDetId eedetidpos(iX,iY,1); 00413 //APDPNpair.p1 = double(1); 00414 //APDPNpair.p2 = double(1); 00415 00416 int hi = eedetidpos.hashedIndex() + EBDetId::MAX_HASH + 1; 00417 if (hi< (int) laser->getLaserMap().size()) { 00418 laser->setValue(hi, APDPNpair); 00419 } else { 00420 edm::LogError("EcalTestDevDB") << "error with laser Map (ratio)!" << endl; 00421 continue; 00422 } 00423 00424 if (!EEDetId::validDetId(iX,iY,-1)) 00425 continue; 00426 00427 EEDetId eedetidneg(iX,iY,-1); 00428 //APDPNpair.p1 = double(1); 00429 //APDPNpair.p2 = double(1); 00430 hi = eedetidneg.hashedIndex() + EBDetId::MAX_HASH + 1; 00431 if (hi< (int) laser->getLaserMap().size()) { 00432 laser->setValue(hi, APDPNpair); 00433 } else { 00434 edm::LogError("EcalTestDevDB") << "error with laser Map (ratio)!" << endl; 00435 continue; 00436 } 00437 } 00438 } 00439 00440 std::cout << std::endl; 00441 for(int i=0; i<92; i++){ 00442 if (i< (int)laser->getTimeMap().size()) { 00443 TimeStamp.t1 = 1380*(i_run-m_firstRun) + 15*i; 00444 TimeStamp.t2 = 1380*(i_run-m_firstRun + 1) + 15*i; 00445 laser->setTime(i, TimeStamp); 00446 //std::cout << " Timestamp for " << i << " : " << TimeStamp.t1.value() << " , " << TimeStamp.t2.value() << std::endl; 00447 } else { 00448 edm::LogError("EcalTestDevDB") << "error with laser Map (time)!" << endl; 00449 continue; 00450 } 00451 } 00452 00453 }else{ 00454 00455 APDPNpair.p1= (double(1)+1/double(log(exp(1)+double((i_run-m_firstRun)*10))))/double(2); 00456 APDPNpair.p2= (double(1)+1/double(log(exp(1)+double((i_run-m_firstRun)*10)+double(10))))/double(2); 00457 cout << i_run << " " << m_firstRun << " " << APDPNpair.p1 << " " << APDPNpair.p2 << std::endl; 00458 00459 for(int iEta=-EBDetId::MAX_IETA; iEta<=EBDetId::MAX_IETA ;++iEta) { 00460 if(iEta==0) continue; 00461 for(int iPhi=EBDetId::MIN_IPHI; iPhi<=EBDetId::MAX_IPHI; ++iPhi) { 00462 EBDetId ebid(iEta,iPhi); 00463 int hi = ebid.hashedIndex(); 00464 00465 if (hi< (int) laser->getLaserMap().size()) { 00466 laser->setValue(hi, APDPNpair); 00467 } else { 00468 edm::LogError("EcalTestDevDB") << "error with laser Map (ratio)!" << endl; 00469 } 00470 } 00471 } 00472 for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) { 00473 for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) { 00474 // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals 00475 00476 if (!EEDetId::validDetId(iX,iY,1)) 00477 continue; 00478 00479 EEDetId eedetidpos(iX,iY,1); 00480 int hi = eedetidpos.hashedIndex() + EBDetId::MAX_HASH + 1; 00481 if (hi< (int) laser->getLaserMap().size()) { 00482 laser->setValue(hi, APDPNpair); 00483 } else { 00484 edm::LogError("EcalTestDevDB") << "error with laser Map (ratio)!" << endl; 00485 continue; 00486 } 00487 00488 if (!EEDetId::validDetId(iX,iY,-1)) 00489 continue; 00490 00491 EEDetId eedetidneg(iX,iY,-1); 00492 hi = eedetidneg.hashedIndex() + EBDetId::MAX_HASH + 1; 00493 if (hi< (int) laser->getLaserMap().size()) { 00494 laser->setValue(hi, APDPNpair); 00495 } else { 00496 edm::LogError("EcalTestDevDB") << "error with laser Map (ratio)!" << endl; 00497 continue; 00498 } 00499 } 00500 } 00501 00502 std::cout << std::endl; 00503 for(int i=0; i<92; i++){ 00504 if (i< (int)laser->getTimeMap().size()) { 00505 TimeStamp.t1 = 1380*(i_run-m_firstRun) + 15*i; 00506 TimeStamp.t2 = 1380*(i_run-m_firstRun + 1) + 15*i; 00507 laser->setTime(i, TimeStamp); 00508 //std::cout << " Timestamp for " << i << " : " << TimeStamp.t1.value() << " , " << TimeStamp.t2.value() << std::endl; 00509 } else { 00510 edm::LogError("EcalTestDevDB") << "error with laser Map (time)!" << endl; 00511 continue; 00512 } 00513 } 00514 00515 } 00516 00517 return laser; 00518 }
EcalLaserAPDPNRatiosRef * EcalTestDevDB::generateEcalLaserAPDPNRatiosRef | ( | ) |
Definition at line 523 of file EcalTestDevDB.cc.
References lat::endl(), EcalCondObjectContainer< T >::getMap(), EEDetId::hashedIndex(), EBDetId::hashedIndex(), EEDetId::IX_MAX, EEDetId::IX_MIN, EEDetId::IY_MAX, EEDetId::IY_MIN, EBDetId::MAX_HASH, EBDetId::MAX_IETA, EBDetId::MAX_IPHI, EBDetId::MIN_IPHI, EcalCondObjectContainer< T >::setValue(), and EEDetId::validDetId().
Referenced by analyze().
00523 { 00524 //-------------------------------------------------------------- 00525 00526 EcalLaserAPDPNRatiosRef* laser = new EcalLaserAPDPNRatiosRef(); 00527 00528 EcalLaserAPDPNref APDPNref; 00529 00530 00531 for(int iEta=-EBDetId::MAX_IETA; iEta<=EBDetId::MAX_IETA ;++iEta) { 00532 if(iEta==0) continue; 00533 for(int iPhi=EBDetId::MIN_IPHI; iPhi<=EBDetId::MAX_IPHI; ++iPhi) { 00534 APDPNref=double(1.5); 00535 EBDetId ebid(iEta,iPhi); 00536 00537 int hi = ebid.hashedIndex(); 00538 if (hi< (int) laser->getMap().size()) { 00539 laser->setValue(hi, APDPNref); 00540 } else { 00541 edm::LogError("EcalTestDevDB") << "error with laser Map (ref)!" << endl; 00542 } 00543 00544 } 00545 } 00546 00547 for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) { 00548 for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) { 00549 00550 if (!EEDetId::validDetId(iX,iY,1)) 00551 continue; 00552 00553 EEDetId eedetidpos(iX,iY,1); 00554 APDPNref=double(1.5); 00555 00556 int hi = eedetidpos.hashedIndex() + EBDetId::MAX_HASH + 1; 00557 if (hi< (int) laser->getMap().size()) { 00558 laser->setValue(hi, APDPNref); 00559 } else { 00560 edm::LogError("EcalTestDevDB") << "error with laser Map (ref)!" << endl; 00561 } 00562 00563 if (!EEDetId::validDetId(iX,iY,-1)) 00564 continue; 00565 00566 EEDetId eedetidneg(iX,iY,-1); 00567 APDPNref=double(1.5); 00568 00569 hi = eedetidneg.hashedIndex() + EBDetId::MAX_HASH + 1; 00570 if (hi< (int) laser->getMap().size()) { 00571 laser->setValue(hi, APDPNref); 00572 } else { 00573 edm::LogError("EcalTestDevDB") << "error with laser Map (ref)!" << endl; 00574 } 00575 } 00576 } 00577 00578 return laser; 00579 }
EcalPedestals * EcalTestDevDB::generateEcalPedestals | ( | ) |
Definition at line 223 of file EcalTestDevDB.cc.
References EcalCondObjectContainer< T >::insert(), EBDetId::MAX_IETA, EBDetId::MAX_IPHI, EBDetId::MIN_IPHI, and DetId::rawId().
Referenced by analyze().
00223 { 00224 //------------------------------------------------------------- 00225 00226 EcalPedestals* peds = new EcalPedestals(); 00227 EcalPedestals::Item item; 00228 for(int iEta=-EBDetId::MAX_IETA; iEta<=EBDetId::MAX_IETA ;++iEta) { 00229 if(iEta==0) continue; 00230 for(int iPhi=EBDetId::MIN_IPHI; iPhi<=EBDetId::MAX_IPHI; ++iPhi) { 00231 item.mean_x1 = 200.*( (double)std::rand()/(double(RAND_MAX)+double(1)) ); 00232 item.rms_x1 = (double)std::rand()/(double(RAND_MAX)+double(1)); 00233 item.mean_x6 = 1200.*( (double)std::rand()/(double(RAND_MAX)+double(1)) ); 00234 item.rms_x6 = 6.*( (double)std::rand()/(double(RAND_MAX)+double(1)) ); 00235 item.mean_x12 = 2400.*( (double)std::rand()/(double(RAND_MAX)+double(1)) ); 00236 item.rms_x12 = 12.*( (double)std::rand()/(double(RAND_MAX)+double(1)) ); 00237 00238 EBDetId ebdetid(iEta,iPhi); 00239 peds->insert(std::make_pair(ebdetid.rawId(),item)); 00240 } 00241 } 00242 return peds; 00243 }
EcalTBWeights * EcalTestDevDB::generateEcalTBWeights | ( | ) |
Definition at line 320 of file EcalTestDevDB.cc.
References EcalWeightSet::getChi2WeightsAfterGainSwitch(), EcalWeightSet::getChi2WeightsBeforeGainSwitch(), EcalWeightSet::getWeightsAfterGainSwitch(), EcalWeightSet::getWeightsBeforeGainSwitch(), i, j, EBDetId::MAX_IETA, r, EcalTBWeights::setValue(), tbwgt, and ww.
Referenced by analyze().
00320 { 00321 //------------------------------------------------------------- 00322 00323 EcalTBWeights* tbwgt = new EcalTBWeights(); 00324 00325 // create weights for each distinct group ID 00326 int nMaxTDC = 10; 00327 for(int igrp=-EBDetId::MAX_IETA; igrp<=EBDetId::MAX_IETA; ++igrp) { 00328 if(igrp==0) continue; 00329 for(int itdc=1; itdc<=nMaxTDC; ++itdc) { 00330 // generate random number 00331 double r = (double)std::rand()/( double(RAND_MAX)+double(1) ); 00332 00333 // make a new set of weights 00334 EcalWeightSet wgt; 00335 EcalWeightSet::EcalWeightMatrix& mat1 = wgt.getWeightsBeforeGainSwitch(); 00336 EcalWeightSet::EcalWeightMatrix& mat2 = wgt.getWeightsAfterGainSwitch(); 00337 00338 for(size_t i=0; i<3; ++i) { 00339 for(size_t j=0; j<10; ++j) { 00340 double ww = igrp*itdc*r + i*10. + j; 00341 //std::cout << "row: " << i << " col: " << j << " - val: " << ww << std::endl; 00342 mat1(i,j)=ww; 00343 mat2(i,j)=100+ww; 00344 } 00345 } 00346 00347 // fill the chi2 matrcies 00348 r = (double)std::rand()/( double(RAND_MAX)+double(1) ); 00349 EcalWeightSet::EcalChi2WeightMatrix& mat3 = wgt.getChi2WeightsBeforeGainSwitch(); 00350 EcalWeightSet::EcalChi2WeightMatrix& mat4 = wgt.getChi2WeightsAfterGainSwitch(); 00351 for(size_t i=0; i<10; ++i) { 00352 for(size_t j=0; j<10; ++j) { 00353 double ww = igrp*itdc*r + i*10. + j; 00354 mat3(i,j)=1000+ww; 00355 mat4(i,j)=1000+100+ww; 00356 } 00357 } 00358 00359 // put the weight in the container 00360 tbwgt->setValue(std::make_pair(igrp,itdc), wgt); 00361 } 00362 } 00363 return tbwgt; 00364 }
EcalWeightXtalGroups * EcalTestDevDB::generateEcalWeightXtalGroups | ( | ) |
Definition at line 304 of file EcalTestDevDB.cc.
References EBDetId::MAX_IETA, EBDetId::MAX_IPHI, EBDetId::MIN_IPHI, DetId::rawId(), and EcalCondObjectContainer< T >::setValue().
Referenced by analyze().
00304 { 00305 //------------------------------------------------------------- 00306 00307 EcalWeightXtalGroups* xtalGroups = new EcalWeightXtalGroups(); 00308 for(int ieta=-EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA; ++ieta) { 00309 if(ieta==0) continue; 00310 for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId:: MAX_IPHI; ++iphi) { 00311 EBDetId ebid(ieta,iphi); 00312 xtalGroups->setValue(ebid.rawId(), EcalXtalGroupId(ieta) ); // define rings in eta 00313 } 00314 } 00315 return xtalGroups; 00316 }
std::map<std::string, unsigned long long> EcalTestDevDB::m_cacheIDs [private] |
unsigned long EcalTestDevDB::m_firstRun [private] |
Definition at line 67 of file EcalTestDevDB.h.
Referenced by analyze(), EcalTestDevDB(), and generateEcalLaserAPDPNRatios().
unsigned int EcalTestDevDB::m_interval [private] |
unsigned long EcalTestDevDB::m_lastRun [private] |
Definition at line 68 of file EcalTestDevDB.h.
Referenced by analyze(), EcalTestDevDB(), and generateEcalLaserAPDPNRatios().
std::map<std::string, std::string> EcalTestDevDB::m_records [private] |
std::string EcalTestDevDB::m_timetype [private] |
Definition at line 64 of file EcalTestDevDB.h.