#include <SiStripPopConHandlerUnitTest.h>
Public Types | |
enum | DataType { UNDEFINED = 0, _Cabling = 1, _Pedestal = 2, _Noise = 3, _Threshold = 4, _BadStrip = 5 } |
Public Member Functions | |
void | getNewObjects () |
std::string | id () const |
SiStripPopConHandlerUnitTest (const edm::ParameterSet &pset) | |
~SiStripPopConHandlerUnitTest () | |
Private Member Functions | |
void | fillObject (T *&obj) |
DataType | getDataType () |
bool | isTransferNeeded () |
void | setForTransfer () |
Private Attributes | |
edm::Service < SiStripCondObjBuilderFromDb > | condObjBuilder |
bool | m_debugMode |
std::string | m_name |
unsigned long long | m_since |
Definition at line 35 of file SiStripPopConHandlerUnitTest.h.
enum popcon::SiStripPopConHandlerUnitTest::DataType |
Definition at line 38 of file SiStripPopConHandlerUnitTest.h.
popcon::SiStripPopConHandlerUnitTest< T >::SiStripPopConHandlerUnitTest | ( | const edm::ParameterSet & | pset | ) | [inline] |
Definition at line 42 of file SiStripPopConHandlerUnitTest.h.
: m_name(pset.getUntrackedParameter<std::string>("name","SiStripPopPopConConfigDbObjHandler")), m_since(pset.getUntrackedParameter<uint32_t>("since",5)), m_debugMode(pset.getUntrackedParameter<bool>("debug",false)){};
popcon::SiStripPopConHandlerUnitTest< T >::~SiStripPopConHandlerUnitTest | ( | ) | [inline] |
Definition at line 49 of file SiStripPopConHandlerUnitTest.h.
{};
void popcon::SiStripPopConHandlerUnitTest< T >::fillObject | ( | T *& | obj | ) | [inline, private] |
Definition at line 178 of file SiStripPopConHandlerUnitTest.h.
References prof2calltree::count, edm::FileInPath::fullPath(), matplotRender::reader, and strip().
Referenced by popcon::SiStripPopConHandlerUnitTest< T >::setForTransfer().
{ if(typeid(T)==typeid(SiStripNoises)){ obj = new SiStripNoises(); edm::FileInPath fp_("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); SiStripDetInfoFileReader reader(fp_.fullPath()); const std::map<uint32_t, SiStripDetInfoFileReader::DetInfo > DetInfos = reader.getAllData(); int count=-1; for(std::map<uint32_t, SiStripDetInfoFileReader::DetInfo >::const_iterator it = DetInfos.begin(); it != DetInfos.end(); it++){ count++; //Generate Noise for det detid SiStripNoises::InputVector theSiStripVector; for(int strip=0; strip<128*it->second.nApvs; ++strip){ float MeanNoise = 5; float RmsNoise = 1; float noise = CLHEP::RandGauss::shoot(MeanNoise,RmsNoise); //double badStripProb = .5; //bool disable = (CLHEP::RandFlat::shoot(1.) < badStripProb ? true:false); obj->setData(noise,theSiStripVector); if (count<6) edm::LogInfo("SiStripNoisesBuilder") << "detid " << it->first << " \t" << " strip " << strip << " \t" << noise << " \t" << theSiStripVector.back()/10 << " \t" << std::endl; } if ( ! obj->put(it->first,theSiStripVector) ) edm::LogError("SiStripNoisesBuilder")<<"[SiStripNoisesBuilder::analyze] detid already exists"<<std::endl; } } }
DataType popcon::SiStripPopConHandlerUnitTest< T >::getDataType | ( | ) | [inline, private] |
Definition at line 100 of file SiStripPopConHandlerUnitTest.h.
References popcon::SiStripPopConHandlerUnitTest< T >::_Cabling, popcon::SiStripPopConHandlerUnitTest< T >::m_name, mergeVDriftHistosByStation::name, and popcon::SiStripPopConHandlerUnitTest< T >::UNDEFINED.
{ if(typeid(T)==typeid(SiStripFedCabling)){ edm::LogInfo ("SiStripPopPopConConfigDbObjHandler") << "[getDataType] for PopCon application " << m_name << " " << typeid(T).name(); return _Cabling; } return UNDEFINED; }
void popcon::SiStripPopConHandlerUnitTest< T >::getNewObjects | ( | ) | [inline, virtual] |
Implements popcon::PopConSourceHandler< T >.
Definition at line 53 of file SiStripPopConHandlerUnitTest.h.
References cond::LogDBEntry::destinationDB, cond::LogDBEntry::execmessage, cond::LogDBEntry::exectime, cond::LogDBEntry::iovtag, cond::LogDBEntry::iovtimetype, popcon::SiStripPopConHandlerUnitTest< T >::isTransferNeeded(), cond::TagInfo::lastInterval, cond::TagInfo::lastPayloadToken, popcon::PopConSourceHandler< T >::logDBEntry(), cond::LogDBEntry::logId, popcon::SiStripPopConHandlerUnitTest< T >::m_debugMode, popcon::SiStripPopConHandlerUnitTest< T >::m_name, cond::TagInfo::name, cond::LogDBEntry::payloadIdx, cond::LogDBEntry::payloadToken, cond::LogDBEntry::provenance, popcon::SiStripPopConHandlerUnitTest< T >::setForTransfer(), findQualityFiles::size, cond::TagInfo::size, popcon::PopConSourceHandler< T >::tagInfo(), cond::TagInfo::token, cond::LogDBEntry::usertext, and popcon::PopConSourceHandler< T >::userTextLog().
{ edm::LogInfo ("SiStripPopPopConConfigDbObjHandler") << "[getNewObjects] for PopCon application " << m_name; if (m_debugMode){ std::stringstream ss; ss << "\n\n------- " << m_name << " - > getNewObjects\n"; if (this->tagInfo().size){ //check whats already inside of database ss << "got offlineInfo"<< this->tagInfo().name << ", size " << this->tagInfo().size << " " << this->tagInfo().token << " , last object valid since " << this->tagInfo().lastInterval.first << " token " << this->tagInfo().lastPayloadToken << "\n\n UserText " << this->userTextLog() << "\n LogDBEntry \n" << this->logDBEntry().logId<< "\n" << this->logDBEntry().destinationDB<< "\n" << this->logDBEntry().provenance<< "\n" << this->logDBEntry().usertext<< "\n" << this->logDBEntry().iovtag<< "\n" << this->logDBEntry().iovtimetype<< "\n" << this->logDBEntry().payloadIdx<< "\n" << this->logDBEntry().payloadName<< "\n" << this->logDBEntry().payloadToken<< "\n" << this->logDBEntry().payloadContainer<< "\n" << this->logDBEntry().exectime<< "\n" << this->logDBEntry().execmessage<< "\n" << "\n\n-- user text " << this->logDBEntry().usertext.substr(this->logDBEntry().usertext.find_last_of("@")) ; } else { ss << " First object for this tag "; } edm::LogInfo ("SiStripPopPopConConfigDbObjHandler") << ss.str(); } if (isTransferNeeded()) setForTransfer(); edm::LogInfo ("SiStripPopPopConConfigDbObjHandler") << "[getNewObjects] for PopCon application " << m_name << " Done\n--------------\n"; }
std::string popcon::SiStripPopConHandlerUnitTest< T >::id | ( | void | ) | const [inline, virtual] |
Implements popcon::PopConSourceHandler< T >.
Definition at line 95 of file SiStripPopConHandlerUnitTest.h.
References popcon::SiStripPopConHandlerUnitTest< T >::m_name.
{ return m_name;}
bool popcon::SiStripPopConHandlerUnitTest< T >::isTransferNeeded | ( | ) | [inline, private] |
Definition at line 113 of file SiStripPopConHandlerUnitTest.h.
References cond::LogDBEntry::destinationDB, cond::TagInfo::lastInterval, popcon::PopConSourceHandler< T >::logDBEntry(), popcon::PopConSourceHandler< T >::m_userTextLog, findQualityFiles::size, popcon::PopConSourceHandler< T >::tagInfo(), and cond::LogDBEntry::usertext.
Referenced by popcon::SiStripPopConHandlerUnitTest< T >::getNewObjects().
{ edm::LogInfo ("SiStripPopPopConConfigDbObjHandler") << "[isTransferNeeded] checking for transfer" << std::endl; std::stringstream ss_logdb, ss; std::stringstream ss1; //get log information from previous upload if (this->tagInfo().size) ss_logdb << this->logDBEntry().usertext.substr(this->logDBEntry().usertext.find_last_of("@")); else ss_logdb << ""; ss << "@ " << clock() ; if (!strcmp(ss.str().c_str(),ss_logdb.str().c_str())){ //string are equal, no need to do transfer edm::LogInfo ("SiStripPopPopConConfigDbObjHandler") << "[isTransferNeeded] the selected conditions are already uploaded in the last iov (" << this->tagInfo().lastInterval.first << ") open for the object " << this->logDBEntry().payloadName << " in the db " << this->logDBEntry().destinationDB << " parameters: " << ss.str() << "\n NO TRANSFER NEEDED"; return false; } this->m_userTextLog = ss.str(); edm::LogInfo ("SiStripPopPopConConfigDbObjHandler") << "[isTransferNeeded] the selected conditions will be uploaded: " << ss.str() << "\n A- "<< ss.str() << "\n B- " << ss_logdb.str() << "\n Fine"; return true; }
void popcon::SiStripPopConHandlerUnitTest< T >::setForTransfer | ( | ) | [inline, private] |
Definition at line 148 of file SiStripPopConHandlerUnitTest.h.
References popcon::SiStripPopConHandlerUnitTest< T >::fillObject(), cond::TagInfo::lastInterval, popcon::SiStripPopConHandlerUnitTest< T >::m_debugMode, popcon::SiStripPopConHandlerUnitTest< T >::m_name, popcon::SiStripPopConHandlerUnitTest< T >::m_since, popcon::PopConSourceHandler< T >::m_to_transfer, mergeVDriftHistosByStation::name, getGTfromDQMFile::obj, findQualityFiles::size, and popcon::PopConSourceHandler< T >::tagInfo().
Referenced by popcon::SiStripPopConHandlerUnitTest< T >::getNewObjects().
{ edm::LogInfo ("SiStripPopPopConConfigDbObjHandler") << "[setForTransfer] " << m_name << " getting data to be transferred " << std::endl; T *obj=0; fillObject(obj); if(!this->tagInfo().size) m_since=1; else if (m_debugMode) m_since=this->tagInfo().lastInterval.first+1; if (obj!=0){ edm::LogInfo ("SiStripPopPopConConfigDbObjHandler") <<"setting since = "<< m_since <<std::endl; this->m_to_transfer.push_back(std::make_pair(obj,m_since)); }else{ edm::LogError ("SiStripPopPopConConfigDbObjHandler") <<"[setForTransfer] " << m_name << " : NULL pointer of obj " << typeid(T).name() << " reported by SiStripCondObjBuilderFromDb\n Transfer aborted"<<std::endl; } }
edm::Service<SiStripCondObjBuilderFromDb> popcon::SiStripPopConHandlerUnitTest< T >::condObjBuilder [private] |
Definition at line 175 of file SiStripPopConHandlerUnitTest.h.
bool popcon::SiStripPopConHandlerUnitTest< T >::m_debugMode [private] |
Definition at line 174 of file SiStripPopConHandlerUnitTest.h.
Referenced by popcon::SiStripPopConHandlerUnitTest< T >::getNewObjects(), and popcon::SiStripPopConHandlerUnitTest< T >::setForTransfer().
std::string popcon::SiStripPopConHandlerUnitTest< T >::m_name [private] |
Definition at line 172 of file SiStripPopConHandlerUnitTest.h.
Referenced by popcon::SiStripPopConHandlerUnitTest< T >::getDataType(), popcon::SiStripPopConHandlerUnitTest< T >::getNewObjects(), popcon::SiStripPopConHandlerUnitTest< T >::id(), and popcon::SiStripPopConHandlerUnitTest< T >::setForTransfer().
unsigned long long popcon::SiStripPopConHandlerUnitTest< T >::m_since [private] |
Definition at line 173 of file SiStripPopConHandlerUnitTest.h.
Referenced by popcon::SiStripPopConHandlerUnitTest< T >::setForTransfer().