CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
popcon::SiStripPopConHandlerUnitTestGain< T > Class Template Reference

#include <SiStripPopConHandlerUnitTestGain.h>

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

Public Types

enum  DataType {
  UNDEFINED = 0, _Cabling = 1, _Pedestal = 2, _Noise = 3,
  _Threshold = 4, _BadStrip = 5, _Gain = 6
}
 
- 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 () override
 
std::string id () const override
 
 SiStripPopConHandlerUnitTestGain (const edm::ParameterSet &pset)
 
 ~SiStripPopConHandlerUnitTestGain () override
 
- 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< SiStripCondObjBuilderFromDbcondObjBuilder
 
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)
 
cond::persistency::SessiondbSession () const
 
- Protected Attributes inherited from popcon::PopConSourceHandler< T >
OldContainer m_to_transfer
 
std::string m_userTextLog
 

Detailed Description

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

Definition at line 34 of file SiStripPopConHandlerUnitTestGain.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

Definition at line 40 of file SiStripPopConHandlerUnitTestGain.h.

template<typename T >
popcon::SiStripPopConHandlerUnitTestGain< T >::~SiStripPopConHandlerUnitTestGain ( )
inlineoverride

Definition at line 47 of file SiStripPopConHandlerUnitTestGain.h.

47 {};

Member Function Documentation

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

Definition at line 168 of file SiStripPopConHandlerUnitTestGain.h.

References KineDebug3::count(), gather_cfg::cout, edm::FileInPath::fullPath(), and DQM::reader.

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

168  {
169  std::cout << __LINE__ << std::endl;
170 
171  if (typeid(T) == typeid(SiStripApvGain)) {
172  std::cout << __LINE__ << std::endl;
173 
174  obj = new SiStripApvGain();
175 
176  edm::FileInPath fp_("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat");
177  SiStripDetInfoFileReader reader(fp_.fullPath());
178 
179  const std::map<uint32_t, SiStripDetInfoFileReader::DetInfo>& DetInfos = reader.getAllData();
180 
181  int count = -1;
182  for (std::map<uint32_t, SiStripDetInfoFileReader::DetInfo>::const_iterator it = DetInfos.begin();
183  it != DetInfos.end();
184  it++) {
185  count++;
186  //Generate Gains for det detid
187  SiStripApvGain::InputVector inputApvGain;
188  for (int apv = 0; apv < it->second.nApvs; ++(++apv)) {
189  float MeanTick = 555.;
190  float RmsTick = 55.;
191 
192  float tick = CLHEP::RandGauss::shoot(MeanTick, RmsTick);
193 
194  if (count < 6)
195  edm::LogInfo("SiStripGainBuilder") << "detid " << it->first << " \t"
196  << " APV " << apv << " \t" << tick << " \t" << std::endl;
197  inputApvGain.push_back(tick); //APV0
198  inputApvGain.push_back(tick); //APV1
199  }
200 
201  SiStripApvGain::Range gain_range(inputApvGain.begin(), inputApvGain.end());
202  if (!obj->put(it->first, gain_range))
203  edm::LogError("SiStripGainBuilder") << "[SiStripGainBuilder::analyze] detid already exists" << std::endl;
204  }
205  }
206  }
reader
Definition: DQM.py:105
std::pair< ContainerIterator, ContainerIterator > Range
std::vector< float > InputVector
long double T
template<typename T >
DataType popcon::SiStripPopConHandlerUnitTestGain< T >::getDataType ( )
inlineprivate

Definition at line 95 of file SiStripPopConHandlerUnitTestGain.h.

References popcon::SiStripPopConHandlerUnitTestGain< T >::_Cabling, popcon::SiStripPopConHandlerUnitTestGain< T >::m_name, Skims_PA_cff::name, and popcon::SiStripPopConHandlerUnitTestGain< T >::UNDEFINED.

95  {
96  if (typeid(T) == typeid(SiStripFedCabling)) {
97  edm::LogInfo("SiStripPopPopConConfigDbObjHandler")
98  << "[getDataType] for PopCon application " << m_name << " " << typeid(T).name();
99  return _Cabling;
100  }
101  return UNDEFINED;
102  }
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
long double T
template<typename T >
void popcon::SiStripPopConHandlerUnitTestGain< T >::getNewObjects ( )
inlineoverridevirtual

Implements popcon::PopConSourceHandler< T >.

Definition at line 51 of file SiStripPopConHandlerUnitTestGain.h.

References cond::LogDBEntry_t::destinationDB, cond::LogDBEntry_t::execmessage, cond::LogDBEntry_t::exectime, cond::LogDBEntry_t::iovtag, cond::LogDBEntry_t::iovtimetype, popcon::SiStripPopConHandlerUnitTestGain< T >::isTransferNeeded(), cond::TagInfo_t::lastInterval, cond::TagInfo_t::lastPayloadToken, popcon::PopConSourceHandler< T >::logDBEntry(), cond::LogDBEntry_t::logId, popcon::SiStripPopConHandlerUnitTestGain< T >::m_debugMode, popcon::SiStripPopConHandlerUnitTestGain< T >::m_name, cond::TagInfo_t::name, cond::LogDBEntry_t::payloadClass, cond::LogDBEntry_t::payloadIdx, cond::LogDBEntry_t::payloadToken, cond::LogDBEntry_t::provenance, popcon::SiStripPopConHandlerUnitTestGain< 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().

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

Definition at line 106 of file SiStripPopConHandlerUnitTestGain.h.

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

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

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

Definition at line 138 of file SiStripPopConHandlerUnitTestGain.h.

References popcon::SiStripPopConHandlerUnitTestGain< T >::fillObject(), cond::TagInfo_t::lastInterval, popcon::SiStripPopConHandlerUnitTestGain< T >::m_debugMode, popcon::SiStripPopConHandlerUnitTestGain< T >::m_name, popcon::SiStripPopConHandlerUnitTestGain< T >::m_since, popcon::PopConSourceHandler< T >::m_to_transfer, Skims_PA_cff::name, getGTfromDQMFile::obj, findQualityFiles::size, and popcon::PopConSourceHandler< T >::tagInfo().

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

138  {
139  edm::LogInfo("SiStripPopPopConConfigDbObjHandler")
140  << "[setForTransfer] " << m_name << " getting data to be transferred " << std::endl;
141 
142  T* obj = nullptr;
143 
144  fillObject(obj);
145 
146  if (!this->tagInfo().size)
147  m_since = 1;
148  else if (m_debugMode)
149  m_since = this->tagInfo().lastInterval.first + 1;
150 
151  if (obj != nullptr) {
152  edm::LogInfo("SiStripPopPopConConfigDbObjHandler") << "setting since = " << m_since << std::endl;
153  this->m_to_transfer.push_back(std::make_pair(obj, m_since));
154  } else {
155  edm::LogError("SiStripPopPopConConfigDbObjHandler")
156  << "[setForTransfer] " << m_name << " : NULL pointer of obj " << typeid(T).name()
157  << " reported by SiStripCondObjBuilderFromDb\n Transfer aborted" << std::endl;
158  }
159  }
size
Write out results.
cond::ValidityInterval lastInterval
Definition: Types.h:74
long double T
cond::TagInfo_t const & tagInfo() const

Member Data Documentation

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

Definition at line 166 of file SiStripPopConHandlerUnitTestGain.h.

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