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::SiStripPopConHandlerUnitTestNoise< T > Class Template Reference

#include <SiStripPopConHandlerUnitTestNoise.h>

Inheritance diagram for popcon::SiStripPopConHandlerUnitTestNoise< 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 ()
 
std::string id () const
 
 SiStripPopConHandlerUnitTestNoise (const edm::ParameterSet &pset)
 
 ~SiStripPopConHandlerUnitTestNoise ()
 
- Public Member Functions inherited from popcon::PopConSourceHandler< T >
void convertFromOld ()
 
SummarydummySummary (typename OldContainer::value_type const &) const
 
void initialize (cond::DbSession dbSession, cond::TagInfo const &tagInfo, cond::LogDBEntry const &logDBEntry)
 
Ref lastPayload () const
 
cond::LogDBEntry const & logDBEntry () const
 
std::pair< Container const
*, std::string const > 
operator() (cond::DbSession session, cond::TagInfo const &tagInfo, cond::LogDBEntry const &logDBEntry) const
 
 PopConSourceHandler ()
 
Container const & returnData ()
 
void sort ()
 
cond::TagInfo 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::SiStripPopConHandlerUnitTestNoise< T >

Definition at line 36 of file SiStripPopConHandlerUnitTestNoise.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

Definition at line 43 of file SiStripPopConHandlerUnitTestNoise.h.

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

Definition at line 50 of file SiStripPopConHandlerUnitTestNoise.h.

50 {};

Member Function Documentation

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

Definition at line 179 of file SiStripPopConHandlerUnitTestNoise.h.

References prof2calltree::count, edm::FileInPath::fullPath(), SiStripDetInfoFileReader::getAllData(), and strip().

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

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

Definition at line 101 of file SiStripPopConHandlerUnitTestNoise.h.

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

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

Implements popcon::PopConSourceHandler< T >.

Definition at line 54 of file SiStripPopConHandlerUnitTestNoise.h.

References cond::LogDBEntry::destinationDB, cond::LogDBEntry::execmessage, cond::LogDBEntry::exectime, cond::LogDBEntry::iovtag, cond::LogDBEntry::iovtimetype, popcon::SiStripPopConHandlerUnitTestNoise< T >::isTransferNeeded(), cond::TagInfo::lastInterval, cond::TagInfo::lastPayloadToken, popcon::PopConSourceHandler< T >::logDBEntry(), cond::LogDBEntry::logId, popcon::SiStripPopConHandlerUnitTestNoise< T >::m_debugMode, popcon::SiStripPopConHandlerUnitTestNoise< T >::m_name, cond::TagInfo::name, cond::LogDBEntry::payloadContainer, cond::LogDBEntry::payloadIdx, cond::LogDBEntry::payloadName, cond::LogDBEntry::payloadToken, cond::LogDBEntry::provenance, popcon::SiStripPopConHandlerUnitTestNoise< T >::setForTransfer(), cond::TagInfo::size, findQualityFiles::size, popcon::PopConSourceHandler< T >::tagInfo(), cond::TagInfo::token, cond::LogDBEntry::usertext, and popcon::PopConSourceHandler< T >::userTextLog().

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

Definition at line 114 of file SiStripPopConHandlerUnitTestNoise.h.

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

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

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

Definition at line 149 of file SiStripPopConHandlerUnitTestNoise.h.

References popcon::SiStripPopConHandlerUnitTestNoise< T >::fillObject(), cond::TagInfo::lastInterval, popcon::SiStripPopConHandlerUnitTestNoise< T >::m_debugMode, popcon::SiStripPopConHandlerUnitTestNoise< T >::m_name, popcon::SiStripPopConHandlerUnitTestNoise< T >::m_since, popcon::PopConSourceHandler< T >::m_to_transfer, mergeVDriftHistosByStation::name, VarParsing::obj, findQualityFiles::size, and popcon::PopConSourceHandler< T >::tagInfo().

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

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

Member Data Documentation

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

Definition at line 176 of file SiStripPopConHandlerUnitTestNoise.h.

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