CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
popcon::SiStripPopConHandlerUnitTest< T > Class Template Reference

#include <SiStripPopConHandlerUnitTest.h>

Inheritance diagram for popcon::SiStripPopConHandlerUnitTest< T >:
popcon::PopConSourceHandler< T >

Public Types

enum  DataType {
  UNDEFINED =0, _Cabling =1, _Pedestal =2, _Noise =3,
  _Threshold =4, _BadStrip =5
}
 
- Public Types inherited from popcon::PopConSourceHandler< T >
typedef std::vector< TripletContainer
 
typedef std::vector< std::pair
< T *, cond::Time_t > > 
OldContainer
 
typedef PopConSourceHandler< Tself
 
typedef cond::Summary Summary
 
typedef cond::Time_t Time_t
 
typedef T value_type
 

Public Member Functions

void getNewObjects ()
 
std::string id () const
 
 SiStripPopConHandlerUnitTest (const edm::ParameterSet &pset)
 
 ~SiStripPopConHandlerUnitTest ()
 
- Public Member Functions inherited from popcon::PopConSourceHandler< T >
void convertFromOld ()
 
SummarydummySummary (typename OldContainer::value_type const &) const
 
void initialize (const cond::persistency::Session &dbSession, cond::TagInfo_t const &tagInfo, cond::LogDBEntry const &logDBEntry)
 
Ref lastPayload () const
 
cond::LogDBEntry const & logDBEntry () const
 
std::pair< Container const
*, std::string const > 
operator() (const cond::persistency::Session &session, cond::TagInfo_t const &tagInfo, cond::LogDBEntry const &logDBEntry) const
 
 PopConSourceHandler ()
 
Container const & returnData ()
 
void sort ()
 
cond::TagInfo_t const & tagInfo () const
 
std::string const & userTextLog () const
 
virtual ~PopConSourceHandler ()
 

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
 

Additional Inherited Members

- Protected Member Functions inherited from popcon::PopConSourceHandler< T >
int add (value_type *payload, Summary *summary, Time_t time)
 
- Protected Attributes inherited from popcon::PopConSourceHandler< T >
OldContainer m_to_transfer
 
std::string m_userTextLog
 

Detailed Description

template<typename T>
class popcon::SiStripPopConHandlerUnitTest< T >

Definition at line 35 of file SiStripPopConHandlerUnitTest.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

template<typename T >
popcon::SiStripPopConHandlerUnitTest< T >::SiStripPopConHandlerUnitTest ( const edm::ParameterSet pset)
inline

Definition at line 42 of file SiStripPopConHandlerUnitTest.h.

42  :
43  m_name(pset.getUntrackedParameter<std::string>("name","SiStripPopPopConConfigDbObjHandler")),
44  m_since(pset.getUntrackedParameter<uint32_t>("since",5)),
45  m_debugMode(pset.getUntrackedParameter<bool>("debug",false)){};
T getUntrackedParameter(std::string const &, T const &) const

Definition at line 49 of file SiStripPopConHandlerUnitTest.h.

49 {};

Member Function Documentation

template<typename T >
void popcon::SiStripPopConHandlerUnitTest< T >::fillObject ( T *&  obj)
inlineprivate

Definition at line 178 of file SiStripPopConHandlerUnitTest.h.

References prof2calltree::count, edm::FileInPath::fullPath(), HLT_25ns14e33_v1_cff::noise, and matplotRender::reader.

Referenced by popcon::SiStripPopConHandlerUnitTest< T >::setForTransfer().

178  {
179 
180 
181  if(typeid(T)==typeid(SiStripNoises)){
182 
183 
184  obj = new SiStripNoises();
185 
186  edm::FileInPath fp_("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat");
187  SiStripDetInfoFileReader reader(fp_.fullPath());
188 
189  const std::map<uint32_t, SiStripDetInfoFileReader::DetInfo > DetInfos = reader.getAllData();
190 
191  int count=-1;
192  for(std::map<uint32_t, SiStripDetInfoFileReader::DetInfo >::const_iterator it = DetInfos.begin(); it != DetInfos.end(); it++){
193  count++;
194  //Generate Noise for det detid
195  SiStripNoises::InputVector theSiStripVector;
196  for(int strip=0; strip<128*it->second.nApvs; ++strip){
197 
198  float MeanNoise = 5;
199  float RmsNoise = 1;
200 
201  float noise = CLHEP::RandGauss::shoot(MeanNoise,RmsNoise);
202 
203  //double badStripProb = .5;
204  //bool disable = (CLHEP::RandFlat::shoot(1.) < badStripProb ? true:false);
205 
206  obj->setData(noise,theSiStripVector);
207  if (count<6)
208  edm::LogInfo("SiStripNoisesBuilder") << "detid " << it->first << " \t"
209  << " strip " << strip << " \t"
210  << noise << " \t"
211  << theSiStripVector.back()/10 << " \t"
212  << std::endl;
213  }
214 
215  if ( ! obj->put(it->first,theSiStripVector) )
216  edm::LogError("SiStripNoisesBuilder")<<"[SiStripNoisesBuilder::analyze] detid already exists"<<std::endl;
217  }
218  }
219  }
std::vector< uint16_t > InputVector
Definition: SiStripNoises.h:51
long double T
template<typename T >
DataType popcon::SiStripPopConHandlerUnitTest< T >::getDataType ( )
inlineprivate

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.

100  {
101 
102  if(typeid(T)==typeid(SiStripFedCabling)){
103  edm::LogInfo ("SiStripPopPopConConfigDbObjHandler") << "[getDataType] for PopCon application " << m_name << " " << typeid(T).name();
104  return _Cabling;
105  }
106  return UNDEFINED;
107  }
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
long double T
template<typename T >
void popcon::SiStripPopConHandlerUnitTest< T >::getNewObjects ( )
inlinevirtual

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_t::lastInterval, cond::TagInfo_t::lastPayloadToken, popcon::PopConSourceHandler< T >::logDBEntry(), cond::LogDBEntry::logId, popcon::SiStripPopConHandlerUnitTest< T >::m_debugMode, popcon::SiStripPopConHandlerUnitTest< T >::m_name, cond::TagInfo_t::name, cond::LogDBEntry::payloadIdx, cond::LogDBEntry::payloadToken, cond::LogDBEntry::provenance, popcon::SiStripPopConHandlerUnitTest< T >::setForTransfer(), cond::TagInfo_t::size, findQualityFiles::size, contentValuesCheck::ss, popcon::PopConSourceHandler< T >::tagInfo(), cond::TagInfo_t::token, cond::LogDBEntry::usertext, and popcon::PopConSourceHandler< T >::userTextLog().

53  {
54  edm::LogInfo ("SiStripPopPopConConfigDbObjHandler") << "[getNewObjects] for PopCon application " << m_name;
55 
56  if (m_debugMode){
57  std::stringstream ss;
58  ss << "\n\n------- " << m_name
59  << " - > getNewObjects\n";
60  if (this->tagInfo().size){
61  //check whats already inside of database
62  ss << "got offlineInfo"<<
63  this->tagInfo().name << ", size " << this->tagInfo().size << " " << this->tagInfo().token
64  << " , last object valid since "
65  << this->tagInfo().lastInterval.first << " token "
66  << this->tagInfo().lastPayloadToken << "\n\n UserText " << this->userTextLog()
67  << "\n LogDBEntry \n"
68  << this->logDBEntry().logId<< "\n"
69  << this->logDBEntry().destinationDB<< "\n"
70  << this->logDBEntry().provenance<< "\n"
71  << this->logDBEntry().usertext<< "\n"
72  << this->logDBEntry().iovtag<< "\n"
73  << this->logDBEntry().iovtimetype<< "\n"
74  << this->logDBEntry().payloadIdx<< "\n"
75  << this->logDBEntry().payloadName<< "\n"
76  << this->logDBEntry().payloadToken<< "\n"
77  << this->logDBEntry().payloadContainer<< "\n"
78  << this->logDBEntry().exectime<< "\n"
79  << this->logDBEntry().execmessage<< "\n"
80  << "\n\n-- user text " << this->logDBEntry().usertext.substr(this->logDBEntry().usertext.find_last_of("@")) ;
81  } else {
82  ss << " First object for this tag ";
83  }
84  edm::LogInfo ("SiStripPopPopConConfigDbObjHandler") << ss.str();
85  }
86  if (isTransferNeeded())
88 
89  edm::LogInfo ("SiStripPopPopConConfigDbObjHandler") << "[getNewObjects] for PopCon application " << m_name << " Done\n--------------\n";
90  }
std::string exectime
Definition: LogDBEntry.h:27
std::string usertext
Definition: LogDBEntry.h:20
std::string iovtimetype
Definition: LogDBEntry.h:22
std::string const & userTextLog() const
unsigned int payloadIdx
Definition: LogDBEntry.h:23
std::string payloadToken
Definition: LogDBEntry.h:26
unsigned long long logId
Definition: LogDBEntry.h:17
size_t size
Definition: Types.h:72
std::string destinationDB
Definition: LogDBEntry.h:18
std::string name
Definition: Types.h:68
cond::LogDBEntry const & logDBEntry() const
cond::ValidityInterval lastInterval
Definition: Types.h:70
std::string execmessage
Definition: LogDBEntry.h:28
std::string lastPayloadToken
Definition: Types.h:71
std::string provenance
Definition: LogDBEntry.h:19
std::string iovtag
Definition: LogDBEntry.h:21
tuple size
Write out results.
std::string token
Definition: Types.h:69
cond::TagInfo_t const & tagInfo() const
template<typename T >
std::string popcon::SiStripPopConHandlerUnitTest< T >::id ( void  ) const
inlinevirtual
template<typename T >
bool popcon::SiStripPopConHandlerUnitTest< T >::isTransferNeeded ( )
inlineprivate

Definition at line 113 of file SiStripPopConHandlerUnitTest.h.

References cond::LogDBEntry::destinationDB, cond::TagInfo_t::lastInterval, popcon::PopConSourceHandler< T >::logDBEntry(), popcon::PopConSourceHandler< T >::m_userTextLog, findQualityFiles::size, contentValuesCheck::ss, popcon::PopConSourceHandler< T >::tagInfo(), and cond::LogDBEntry::usertext.

Referenced by popcon::SiStripPopConHandlerUnitTest< T >::getNewObjects().

113  {
114 
115 
116  edm::LogInfo ("SiStripPopPopConConfigDbObjHandler") << "[isTransferNeeded] checking for transfer" << std::endl;
117  std::stringstream ss_logdb, ss;
118  std::stringstream ss1;
119 
120  //get log information from previous upload
121  if (this->tagInfo().size)
122  ss_logdb << this->logDBEntry().usertext.substr(this->logDBEntry().usertext.find_last_of("@"));
123  else
124  ss_logdb << "";
125 
126  ss << "@ " << clock() ;
127 
128  if (!strcmp(ss.str().c_str(),ss_logdb.str().c_str())){
129  //string are equal, no need to do transfer
130  edm::LogInfo ("SiStripPopPopConConfigDbObjHandler")
131  << "[isTransferNeeded] the selected conditions are already uploaded in the last iov ("
132  << this->tagInfo().lastInterval.first << ") open for the object "
133  << this->logDBEntry().payloadName << " in the db "
134  << this->logDBEntry().destinationDB << " parameters: " << ss.str() << "\n NO TRANSFER NEEDED";
135  return false;
136  }
137  this->m_userTextLog = ss.str();
138  edm::LogInfo ("SiStripPopPopConConfigDbObjHandler")
139  << "[isTransferNeeded] the selected conditions will be uploaded: " << ss.str()
140  << "\n A- "<< ss.str() << "\n B- " << ss_logdb.str() << "\n Fine";
141 
142  return true;
143  }
std::string usertext
Definition: LogDBEntry.h:20
std::string destinationDB
Definition: LogDBEntry.h:18
cond::LogDBEntry const & logDBEntry() const
cond::ValidityInterval lastInterval
Definition: Types.h:70
tuple size
Write out results.
cond::TagInfo_t const & tagInfo() const
template<typename T >
void popcon::SiStripPopConHandlerUnitTest< T >::setForTransfer ( )
inlineprivate

Definition at line 148 of file SiStripPopConHandlerUnitTest.h.

References popcon::SiStripPopConHandlerUnitTest< T >::fillObject(), cond::TagInfo_t::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().

148  {
149  edm::LogInfo ("SiStripPopPopConConfigDbObjHandler") << "[setForTransfer] " << m_name << " getting data to be transferred " << std::endl;
150 
151  T *obj=0;
152 
153  fillObject(obj);
154 
155  if(!this->tagInfo().size)
156  m_since=1;
157  else
158  if (m_debugMode)
159  m_since=this->tagInfo().lastInterval.first+1;
160 
161  if (obj!=0){
162 
163  edm::LogInfo ("SiStripPopPopConConfigDbObjHandler") <<"setting since = "<< m_since <<std::endl;
164  this->m_to_transfer.push_back(std::make_pair(obj,m_since));
165  }else{
166  edm::LogError ("SiStripPopPopConConfigDbObjHandler") <<"[setForTransfer] " << m_name << " : NULL pointer of obj " << typeid(T).name() << " reported by SiStripCondObjBuilderFromDb\n Transfer aborted"<<std::endl;
167  }
168  }
cond::ValidityInterval lastInterval
Definition: Types.h:70
long double T
tuple size
Write out results.
cond::TagInfo_t const & tagInfo() const

Member Data Documentation

template<typename T >
edm::Service<SiStripCondObjBuilderFromDb> popcon::SiStripPopConHandlerUnitTest< T >::condObjBuilder
private

Definition at line 175 of file SiStripPopConHandlerUnitTest.h.

template<typename T >
bool popcon::SiStripPopConHandlerUnitTest< T >::m_debugMode
private
template<typename T >
std::string popcon::SiStripPopConHandlerUnitTest< T >::m_name
private
template<typename T >
unsigned long long popcon::SiStripPopConHandlerUnitTest< T >::m_since
private