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

◆ DataType

Enumerator
UNDEFINED 
_Cabling 
_Pedestal 
_Noise 
_Threshold 
_BadStrip 
_Gain 

Definition at line 36 of file SiStripPopConHandlerUnitTestGain.h.

36 { UNDEFINED = 0, _Cabling = 1, _Pedestal = 2, _Noise = 3, _Threshold = 4, _BadStrip = 5, _Gain = 6 };

Constructor & Destructor Documentation

◆ SiStripPopConHandlerUnitTestGain()

Definition at line 40 of file SiStripPopConHandlerUnitTestGain.h.

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

◆ ~SiStripPopConHandlerUnitTestGain()

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

Definition at line 47 of file SiStripPopConHandlerUnitTestGain.h.

47 {};

Member Function Documentation

◆ fillObject()

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

Definition at line 167 of file SiStripPopConHandlerUnitTestGain.h.

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

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

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

◆ getDataType()

template<typename T >
DataType popcon::SiStripPopConHandlerUnitTestGain< T >::getDataType ( )
inlineprivate

Definition at line 94 of file SiStripPopConHandlerUnitTestGain.h.

94  {
95  if (typeid(T) == typeid(SiStripFedCabling)) {
96  edm::LogInfo("SiStripPopPopConConfigDbObjHandler")
97  << "[getDataType] for PopCon application " << m_name << " " << typeid(T).name();
98  return _Cabling;
99  }
100  return UNDEFINED;
101  }

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

◆ getNewObjects()

template<typename T >
void popcon::SiStripPopConHandlerUnitTestGain< T >::getNewObjects ( )
inlineoverridevirtual

Implements popcon::PopConSourceHandler< T >.

Definition at line 51 of file SiStripPopConHandlerUnitTestGain.h.

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  << " , last object valid since " << this->tagInfo().lastInterval.since << " token "
61  << this->tagInfo().lastInterval.payloadId << "\n\n UserText " << this->userTextLog() << "\n LogDBEntry \n"
62  << this->logDBEntry().logId << "\n"
63  << this->logDBEntry().destinationDB << "\n"
64  << this->logDBEntry().provenance << "\n"
65  << this->logDBEntry().usertext << "\n"
66  << this->logDBEntry().iovtag << "\n"
67  << this->logDBEntry().iovtimetype << "\n"
68  << this->logDBEntry().payloadIdx << "\n"
69  << this->logDBEntry().payloadClass << "\n"
70  << this->logDBEntry().payloadToken << "\n"
71  << this->logDBEntry().exectime << "\n"
72  << this->logDBEntry().execmessage << "\n"
73  << "\n\n-- user text "
74  << this->logDBEntry().usertext.substr(this->logDBEntry().usertext.find_last_of("@"));
75  } else {
76  ss << " First object for this tag ";
77  }
78  edm::LogInfo("SiStripPopPopConConfigDbObjHandler") << ss.str();
79  }
80  if (isTransferNeeded())
82 
83  edm::LogInfo("SiStripPopPopConConfigDbObjHandler")
84  << "[getNewObjects] for PopCon application " << m_name << " Done\n--------------\n";
85  }

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, 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::Iov_t::payloadId, cond::LogDBEntry_t::payloadIdx, cond::LogDBEntry_t::payloadToken, cond::LogDBEntry_t::provenance, popcon::SiStripPopConHandlerUnitTestGain< T >::setForTransfer(), cond::Iov_t::since, cond::TagInfo_t::size, findQualityFiles::size, contentValuesCheck::ss, popcon::PopConSourceHandler< T >::tagInfo(), cond::LogDBEntry_t::usertext, and popcon::PopConSourceHandler< T >::userTextLog().

◆ id()

template<typename T >
std::string popcon::SiStripPopConHandlerUnitTestGain< T >::id ( void  ) const
inlineoverridevirtual

◆ isTransferNeeded()

template<typename T >
bool popcon::SiStripPopConHandlerUnitTestGain< T >::isTransferNeeded ( )
inlineprivate

Definition at line 105 of file SiStripPopConHandlerUnitTestGain.h.

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

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

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

◆ setForTransfer()

template<typename T >
void popcon::SiStripPopConHandlerUnitTestGain< T >::setForTransfer ( )
inlineprivate

Definition at line 137 of file SiStripPopConHandlerUnitTestGain.h.

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

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, cond::Iov_t::since, findQualityFiles::size, and popcon::PopConSourceHandler< T >::tagInfo().

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

Member Data Documentation

◆ condObjBuilder

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

Definition at line 165 of file SiStripPopConHandlerUnitTestGain.h.

◆ m_debugMode

template<typename T >
bool popcon::SiStripPopConHandlerUnitTestGain< T >::m_debugMode
private

◆ m_name

template<typename T >
std::string popcon::SiStripPopConHandlerUnitTestGain< T >::m_name
private

◆ m_since

template<typename T >
unsigned long long popcon::SiStripPopConHandlerUnitTestGain< T >::m_since
private
popcon::PopConSourceHandler::m_to_transfer
OldContainer m_to_transfer
Definition: PopConSourceHandler.h:162
popcon::SiStripPopConHandlerUnitTestGain::fillObject
void fillObject(T *&obj)
Definition: SiStripPopConHandlerUnitTestGain.h:167
popcon::SiStripPopConHandlerUnitTestGain::_Threshold
Definition: SiStripPopConHandlerUnitTestGain.h:36
gather_cfg.cout
cout
Definition: gather_cfg.py:144
edm::LogInfo
Definition: MessageLogger.h:254
popcon::SiStripPopConHandlerUnitTestGain::m_debugMode
bool m_debugMode
Definition: SiStripPopConHandlerUnitTestGain.h:164
popcon::SiStripPopConHandlerUnitTestGain::setForTransfer
void setForTransfer()
Definition: SiStripPopConHandlerUnitTestGain.h:137
SiStripFedCabling
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses,...
Definition: SiStripFedCabling.h:25
SiStripDetInfoFileReader
Definition: SiStripDetInfoFileReader.h:30
cond::LogDBEntry_t::execmessage
std::string execmessage
Definition: Types.h:98
cond::TagInfo_t::name
std::string name
Definition: Types.h:72
popcon::SiStripPopConHandlerUnitTestGain::_Noise
Definition: SiStripPopConHandlerUnitTestGain.h:36
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
edm::FileInPath
Definition: FileInPath.h:64
DQM.reader
reader
Definition: DQM.py:105
cond::LogDBEntry_t::provenance
std::string provenance
Definition: Types.h:89
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cond::LogDBEntry_t::payloadToken
std::string payloadToken
Definition: Types.h:96
edm::LogError
Definition: MessageLogger.h:183
popcon::PopConSourceHandler::tagInfo
cond::TagInfo_t const & tagInfo() const
Definition: PopConSourceHandler.h:78
cond::Iov_t::payloadId
Hash payloadId
Definition: Types.h:55
KineDebug3::count
void count()
Definition: KinematicConstrainedVertexUpdatorT.h:21
cond::LogDBEntry_t::usertext
std::string usertext
Definition: Types.h:90
cond::Iov_t::since
Time_t since
Definition: Types.h:53
popcon::SiStripPopConHandlerUnitTestGain::UNDEFINED
Definition: SiStripPopConHandlerUnitTestGain.h:36
cond::LogDBEntry_t::iovtag
std::string iovtag
Definition: Types.h:91
popcon::SiStripPopConHandlerUnitTestGain::isTransferNeeded
bool isTransferNeeded()
Definition: SiStripPopConHandlerUnitTestGain.h:105
cond::LogDBEntry_t::destinationDB
std::string destinationDB
Definition: Types.h:88
popcon::SiStripPopConHandlerUnitTestGain::_Pedestal
Definition: SiStripPopConHandlerUnitTestGain.h:36
popcon::SiStripPopConHandlerUnitTestGain::m_since
unsigned long long m_since
Definition: SiStripPopConHandlerUnitTestGain.h:163
cond::TagInfo_t::lastInterval
Iov_t lastInterval
Definition: Types.h:73
cond::LogDBEntry_t::iovtimetype
std::string iovtimetype
Definition: Types.h:92
cond::LogDBEntry_t::payloadClass
std::string payloadClass
Definition: Types.h:95
T
long double T
Definition: Basic3DVectorLD.h:48
SiStripApvGain::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripApvGain.h:28
cond::LogDBEntry_t::logId
unsigned long long logId
Definition: Types.h:87
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
popcon::SiStripPopConHandlerUnitTestGain::_BadStrip
Definition: SiStripPopConHandlerUnitTestGain.h:36
popcon::SiStripPopConHandlerUnitTestGain::m_name
std::string m_name
Definition: SiStripPopConHandlerUnitTestGain.h:162
popcon::SiStripPopConHandlerUnitTestGain::_Cabling
Definition: SiStripPopConHandlerUnitTestGain.h:36
SiStripApvGain
Definition: SiStripApvGain.h:25
cond::LogDBEntry_t::payloadIdx
unsigned int payloadIdx
Definition: Types.h:93
popcon::PopConSourceHandler::m_userTextLog
std::string m_userTextLog
Definition: PopConSourceHandler.h:168
popcon::SiStripPopConHandlerUnitTestGain::_Gain
Definition: SiStripPopConHandlerUnitTestGain.h:36
SiStripApvGain::InputVector
std::vector< float > InputVector
Definition: SiStripApvGain.h:32
popcon::PopConSourceHandler::logDBEntry
cond::LogDBEntry_t const & logDBEntry() const
Definition: PopConSourceHandler.h:84
popcon::PopConSourceHandler::userTextLog
std::string const & userTextLog() const
Definition: PopConSourceHandler.h:111
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
cond::TagInfo_t::size
size_t size
Definition: Types.h:74
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
cond::LogDBEntry_t::exectime
std::string exectime
Definition: Types.h:97