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_t const &logDBEntry)
 
Ref lastPayload () const
 
cond::LogDBEntry_t const & logDBEntry () const
 
std::pair< Container const
*, std::string const > 
operator() (const cond::persistency::Session &session, cond::TagInfo_t const &tagInfo, cond::LogDBEntry_t 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 34 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 41 of file SiStripPopConHandlerUnitTest.h.

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

Definition at line 48 of file SiStripPopConHandlerUnitTest.h.

48 {};

Member Function Documentation

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

Definition at line 177 of file SiStripPopConHandlerUnitTest.h.

References KineDebug3::count(), edm::FileInPath::fullPath(), HLT_FULL_cff::noise, and matplotRender::reader.

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

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

Definition at line 99 of file SiStripPopConHandlerUnitTest.h.

References popcon::SiStripPopConHandlerUnitTest< T >::_Cabling, popcon::SiStripPopConHandlerUnitTest< T >::m_name, mergeVDriftHistosByStation::name, and popcon::SiStripPopConHandlerUnitTest< T >::UNDEFINED.

99  {
100 
101  if(typeid(T)==typeid(SiStripFedCabling)){
102  edm::LogInfo ("SiStripPopPopConConfigDbObjHandler") << "[getDataType] for PopCon application " << m_name << " " << typeid(T).name();
103  return _Cabling;
104  }
105  return UNDEFINED;
106  }
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 52 of file SiStripPopConHandlerUnitTest.h.

References cond::LogDBEntry_t::destinationDB, cond::LogDBEntry_t::execmessage, cond::LogDBEntry_t::exectime, cond::LogDBEntry_t::iovtag, cond::LogDBEntry_t::iovtimetype, popcon::SiStripPopConHandlerUnitTest< T >::isTransferNeeded(), cond::TagInfo_t::lastInterval, cond::TagInfo_t::lastPayloadToken, popcon::PopConSourceHandler< T >::logDBEntry(), cond::LogDBEntry_t::logId, popcon::SiStripPopConHandlerUnitTest< T >::m_debugMode, popcon::SiStripPopConHandlerUnitTest< T >::m_name, cond::TagInfo_t::name, cond::LogDBEntry_t::payloadIdx, cond::LogDBEntry_t::payloadToken, cond::LogDBEntry_t::provenance, popcon::SiStripPopConHandlerUnitTest< T >::setForTransfer(), cond::TagInfo_t::size, findQualityFiles::size, contentValuesCheck::ss, popcon::PopConSourceHandler< T >::tagInfo(), cond::TagInfo_t::token, cond::LogDBEntry_t::usertext, and popcon::PopConSourceHandler< T >::userTextLog().

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

Definition at line 112 of file SiStripPopConHandlerUnitTest.h.

References cond::LogDBEntry_t::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_t::usertext.

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

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

Definition at line 147 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().

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