test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Private Member Functions | Friends
SiStripSummary Class Reference

#include <SiStripSummary.h>

Classes

struct  DetRegistry
 
class  StrictWeakOrdering
 

Public Types

typedef std::vector< float >
::const_iterator 
ContainerIterator
 
typedef std::vector< float > InputVector
 
typedef std::pair
< ContainerIterator,
ContainerIterator
Range
 
typedef std::vector< DetRegistryRegistry
 
typedef Registry::const_iterator RegistryIterator
 

Public Member Functions

ContainerIterator getDataVectorBegin () const
 
ContainerIterator getDataVectorEnd () const
 
std::vector< uint32_t > getDetIds () const
 
const Range getRange (const uint32_t &detID) const
 
RegistryIterator getRegistryVectorBegin () const
 
RegistryIterator getRegistryVectorEnd () const
 
int getRunNr () const
 
std::vector< float > getSummaryObj (uint32_t &detID, const std::vector< std::string > &list) const
 
std::vector< float > getSummaryObj (sistripsummary::TrackerRegion region, const std::vector< std::string > &list) const
 
std::vector< float > getSummaryObj (std::string elementName) const
 
std::vector< float > getSummaryObj (uint32_t &detID) const
 
std::vector< float > getSummaryObj () const
 
unsigned long long getTimeValue () const
 
std::vector< std::string > getUserDBContent () const
 
void print ()
 
bool put (const uint32_t &detID, InputVector &input, std::vector< std::string > &userContent)
 
bool put (sistripsummary::TrackerRegion region, InputVector &input, std::vector< std::string > &userContent)
 
void setObj (const uint32_t &detID, std::string elementName, float value)
 
void setRunNr (int inputRunNr)
 
void setTimeValue (unsigned long long inputTimeValue)
 
void setUserDBContent (const std::vector< std::string > &userDBContent)
 
 SiStripSummary (std::vector< std::string > &userDBContent)
 
 SiStripSummary (const SiStripSummary &input)
 
 SiStripSummary ()
 
 ~SiStripSummary ()
 

Public Attributes

std::vector< DetRegistryindexes_
 
int runNr_
 
unsigned long long timeValue_
 
std::vector< std::string > userDBContent_
 
std::vector< float > v_sum_
 

Protected Member Functions

const short getPosition (std::string elementName) const
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 

Detailed Description

Author
D. Giordano, A.-C. Le Bihan

Definition at line 37 of file SiStripSummary.h.

Member Typedef Documentation

typedef std::vector<float>::const_iterator SiStripSummary::ContainerIterator

Definition at line 56 of file SiStripSummary.h.

typedef std::vector<float> SiStripSummary::InputVector

Definition at line 60 of file SiStripSummary.h.

Definition at line 57 of file SiStripSummary.h.

typedef std::vector<DetRegistry> SiStripSummary::Registry

Definition at line 58 of file SiStripSummary.h.

typedef Registry::const_iterator SiStripSummary::RegistryIterator

Definition at line 59 of file SiStripSummary.h.

Constructor & Destructor Documentation

SiStripSummary::SiStripSummary ( std::vector< std::string > &  userDBContent)

Definition at line 6 of file SiStripSummary.cc.

References runNr_, timeValue_, and userDBContent_.

7 {
8  userDBContent_ = userDBContent;
9  runNr_ = 0;
10  timeValue_ = 0;
11 }
unsigned long long timeValue_
std::vector< std::string > userDBContent_
SiStripSummary::SiStripSummary ( const SiStripSummary input)

Definition at line 14 of file SiStripSummary.cc.

References getRunNr(), getTimeValue(), getUserDBContent(), indexes_, runNr_, timeValue_, userDBContent_, and v_sum_.

15 {
17  runNr_ = input.getTimeValue();
18  timeValue_ = input.getRunNr();
19  v_sum_.clear();
20  indexes_.clear();
21  v_sum_.insert(v_sum_.end(),input.v_sum_.begin(),input.v_sum_.end());
22  indexes_.insert(indexes_.end(),input.indexes_.begin(),input.indexes_.end());
23 }
unsigned long long getTimeValue() const
std::vector< DetRegistry > indexes_
std::vector< float > v_sum_
unsigned long long timeValue_
std::vector< std::string > getUserDBContent() const
int getRunNr() const
std::vector< std::string > userDBContent_
SiStripSummary::SiStripSummary ( )
inline

Definition at line 65 of file SiStripSummary.h.

65 {};
SiStripSummary::~SiStripSummary ( )
inline

Definition at line 66 of file SiStripSummary.h.

66 {};

Member Function Documentation

ContainerIterator SiStripSummary::getDataVectorBegin ( ) const
inline

Definition at line 69 of file SiStripSummary.h.

References v_sum_.

69 {return v_sum_.begin(); }
std::vector< float > v_sum_
ContainerIterator SiStripSummary::getDataVectorEnd ( ) const
inline

Definition at line 70 of file SiStripSummary.h.

References v_sum_.

70 {return v_sum_.end(); }
std::vector< float > v_sum_
std::vector< uint32_t > SiStripSummary::getDetIds ( ) const

Definition at line 78 of file SiStripSummary.cc.

References begin, end, indexes_, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by getSummaryObj().

79 {
80  // returns vector of DetIds in map
81  std::vector<uint32_t> DetIds_;
84  for (SiStripSummary::RegistryIterator p=begin; p != end; ++p) {
85  DetIds_.push_back(p->detid);
86  }
87  return DetIds_;
88 }
std::vector< DetRegistry > indexes_
Registry::const_iterator RegistryIterator
#define end
Definition: vmac.h:37
#define begin
Definition: vmac.h:30
const short SiStripSummary::getPosition ( std::string  elementName) const
protected

Definition at line 92 of file SiStripSummary.cc.

References spr::find(), and userDBContent_.

Referenced by getSummaryObj(), put(), and setObj().

93 {
94  // returns position of elementName in UserDBContent_
95 
96  std::vector<std::string>::const_iterator it = find(userDBContent_.begin(),userDBContent_.end(),elementName);
97  short pos = -1;
98  if (it != userDBContent_.end()) pos = it - userDBContent_.begin();
99  else edm::LogError("SiStripSummary") << "attempting to retrieve non existing historic DB object : "<< elementName <<std::endl;
100  return pos;
101 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
std::vector< std::string > userDBContent_
const SiStripSummary::Range SiStripSummary::getRange ( const uint32_t &  detID) const

Definition at line 67 of file SiStripSummary.cc.

References gather_cfg::cout, indexes_, AlCaHLTBitMon_ParallelJobs::p, userDBContent_, and v_sum_.

Referenced by getSummaryObj(), and setObj().

68 {
69 
70  RegistryIterator p = std::lower_bound(indexes_.begin(),indexes_.end(),DetId,SiStripSummary::StrictWeakOrdering());
71  if (p==indexes_.end()|| p->detid!=DetId) {
72  return SiStripSummary::Range(v_sum_.end(),v_sum_.end()); std::cout << "not in range " << std::endl;}
73  else
74  return SiStripSummary::Range(v_sum_.begin()+p->ibegin,v_sum_.begin()+p->ibegin+userDBContent_.size());
75 }
std::vector< DetRegistry > indexes_
Registry::const_iterator RegistryIterator
std::pair< ContainerIterator, ContainerIterator > Range
std::vector< float > v_sum_
Definition: DetId.h:18
tuple cout
Definition: gather_cfg.py:145
std::vector< std::string > userDBContent_
RegistryIterator SiStripSummary::getRegistryVectorBegin ( ) const
inline

Definition at line 71 of file SiStripSummary.h.

References indexes_.

71 {return indexes_.begin();}
std::vector< DetRegistry > indexes_
RegistryIterator SiStripSummary::getRegistryVectorEnd ( ) const
inline

Definition at line 72 of file SiStripSummary.h.

References indexes_.

72 {return indexes_.end(); }
std::vector< DetRegistry > indexes_
int SiStripSummary::getRunNr ( ) const
inline

Definition at line 117 of file SiStripSummary.h.

References runNr_.

Referenced by SiStripSummary().

117 { return runNr_; }
std::vector< float > SiStripSummary::getSummaryObj ( uint32_t &  detID,
const std::vector< std::string > &  list 
) const

Definition at line 126 of file SiStripSummary.cc.

References getPosition(), getRange(), and i.

127 {
128  std::vector<float> SummaryObj;
129  const SiStripSummary::Range range = getRange(detID);
130  if (range.first != range.second ) {
131  for (unsigned int i=0; i<list.size(); i++){
132  const short pos=getPosition(list.at(i));
133 
134  if (pos!=-1)
135  SummaryObj.push_back(*((range.first)+pos));
136  else
137  SummaryObj.push_back(-999.);
138  }
139  }
140  else
141  for (unsigned int i=0; i<list.size(); i++) SummaryObj.push_back(-99.); // no summary obj has ever been inserted for this detid, most likely all related histos were not available in DQM
142 
143  return SummaryObj;
144 }
int i
Definition: DBlmapReader.cc:9
const Range getRange(const uint32_t &detID) const
std::pair< ContainerIterator, ContainerIterator > Range
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
const short getPosition(std::string elementName) const
std::vector< float > SiStripSummary::getSummaryObj ( sistripsummary::TrackerRegion  region,
const std::vector< std::string > &  list 
) const

Definition at line 146 of file SiStripSummary.cc.

References getSummaryObj(), and HLT_25ns10e33_v2_cff::region.

147 {
148 
149  uint32_t fakeDet = region;
150  return getSummaryObj(fakeDet,list);
151 }
std::vector< float > getSummaryObj() const
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
std::vector< float > SiStripSummary::getSummaryObj ( std::string  elementName) const

Definition at line 172 of file SiStripSummary.cc.

References getDetIds(), getPosition(), getRange(), and i.

173 {
174  std::vector<float> vSumElement;
175  std::vector<uint32_t> DetIds_ = getDetIds();
176  const short pos = getPosition(elementName);
177 
178  if (pos !=-1)
179  {
180  for (unsigned int i=0; i<DetIds_.size(); i++){
181  const SiStripSummary::Range range = getRange(DetIds_.at(i));
182  if (range.first != range.second ) {
183  vSumElement.push_back(*((range.first)+pos));}
184  else { vSumElement.push_back(-99.);}
185  }
186  }
187 
188  return vSumElement;
189 }
std::vector< uint32_t > getDetIds() const
int i
Definition: DBlmapReader.cc:9
const Range getRange(const uint32_t &detID) const
std::pair< ContainerIterator, ContainerIterator > Range
const short getPosition(std::string elementName) const
std::vector< float > SiStripSummary::getSummaryObj ( uint32_t &  detID) const

Definition at line 153 of file SiStripSummary.cc.

References getRange(), i, and userDBContent_.

154 {
155  std::vector<float> SummaryObj;
156  const SiStripSummary::Range range = getRange(detID);
157  if (range.first != range.second ) {
158  for (unsigned int i=0; i<userDBContent_.size(); i++) SummaryObj.push_back(*((range.first)+i));}
159  else {
160  for (unsigned int i=0; i<userDBContent_.size(); i++) SummaryObj.push_back(-99.);}
161  return SummaryObj;
162 }
int i
Definition: DBlmapReader.cc:9
const Range getRange(const uint32_t &detID) const
std::pair< ContainerIterator, ContainerIterator > Range
std::vector< std::string > userDBContent_
std::vector< float > SiStripSummary::getSummaryObj ( ) const

Definition at line 166 of file SiStripSummary.cc.

References v_sum_.

Referenced by getSummaryObj().

167 {
168  return v_sum_;
169 }
std::vector< float > v_sum_
unsigned long long SiStripSummary::getTimeValue ( ) const
inline

Definition at line 115 of file SiStripSummary.h.

References timeValue_.

Referenced by SiStripSummary().

115 { return timeValue_; }
unsigned long long timeValue_
std::vector<std::string> SiStripSummary::getUserDBContent ( ) const
inline

Definition at line 116 of file SiStripSummary.h.

References userDBContent_.

Referenced by SiStripSummaryBuilder::analyze(), and SiStripSummary().

116 { return userDBContent_; }
std::vector< std::string > userDBContent_
void SiStripSummary::print ( void  )

Definition at line 192 of file SiStripSummary.cc.

References gather_cfg::cout, indexes_, runNr_, and timeValue_.

193 {
194  std::cout << "Nr. of detector elements in SiStripSummary object is " << indexes_.size()
195  << " RunNr= " << runNr_
196  << " timeValue= " << timeValue_
197  << std::endl;
198 }
std::vector< DetRegistry > indexes_
unsigned long long timeValue_
tuple cout
Definition: gather_cfg.py:145
bool SiStripSummary::put ( const uint32_t &  detID,
InputVector input,
std::vector< std::string > &  userContent 
)

Definition at line 26 of file SiStripSummary.cc.

References SiStripSummary::DetRegistry::detid, getPosition(), i, SiStripSummary::DetRegistry::ibegin, indexes_, AlCaHLTBitMon_ParallelJobs::p, tmp, userDBContent_, and v_sum_.

Referenced by SiStripSummaryBuilder::analyze(), and put().

27 {
28  Registry::iterator p = std::lower_bound(indexes_.begin(),indexes_.end(),DetId,SiStripSummary::StrictWeakOrdering());
29 
30  if(p==indexes_.end() || p->detid!=DetId){
31  //First request for the given DetID
32  //Create entries for all the declared userDBContent
33  //and fill for the provided userContent
34 
35  DetRegistry detregistry;
36  detregistry.detid = DetId;
37  detregistry.ibegin = v_sum_.size();
38  indexes_.insert(p,detregistry);
39  InputVector tmp(userDBContent_.size(),-9999);
40 
41  for(size_t i=0;i<userContent.size();++i)
42  tmp[getPosition(userContent[i])]=input[i];
43 
44  v_sum_.insert(v_sum_.end(),tmp.begin(),tmp.end());
45  } else {
46 
47  if (p->detid==DetId){
48  //I should already find the entries
49  //fill for the provided userContent
50 
51  for(size_t i=0;i<userContent.size();++i)
52  v_sum_[p->ibegin+getPosition(userContent[i])]=input[i];
53  }
54  }
55 
56  return true;
57 }
int i
Definition: DBlmapReader.cc:9
std::vector< DetRegistry > indexes_
static std::string const input
Definition: EdmProvDump.cc:44
std::vector< float > v_sum_
std::vector< float > InputVector
Definition: DetId.h:18
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
std::vector< std::string > userDBContent_
const short getPosition(std::string elementName) const
bool SiStripSummary::put ( sistripsummary::TrackerRegion  region,
InputVector input,
std::vector< std::string > &  userContent 
)

Definition at line 60 of file SiStripSummary.cc.

References put(), and HLT_25ns10e33_v2_cff::region.

60  {
61 
62  uint32_t fakeDet = region;
63  return put(fakeDet, input, userContent);
64 }
static std::string const input
Definition: EdmProvDump.cc:44
bool put(const uint32_t &detID, InputVector &input, std::vector< std::string > &userContent)
template<class Archive >
void SiStripSummary::serialize ( Archive &  ar,
const unsigned int  version 
)
private
void SiStripSummary::setObj ( const uint32_t &  detID,
std::string  elementName,
float  value 
)

Definition at line 105 of file SiStripSummary.cc.

References Exception, getPosition(), getRange(), indexes_, AlCaHLTBitMon_ParallelJobs::p, v_sum_, and relativeConstraints::value.

106 {
107  // modifies value of info "elementName" for the given detID
108  // requires that an entry has be defined beforehand for detId in DB
109  RegistryIterator p = std::lower_bound(indexes_.begin(),indexes_.end(),detID,SiStripSummary::StrictWeakOrdering());
110  if (p==indexes_.end()|| p->detid!=detID)
111  {
112  throw cms::Exception("")
113  <<"not allowed to modify "<< elementName << " in historic DB - SummaryObj needs to be available first !";
114  }
115 
116  const SiStripSummary::Range range = getRange(detID);
117 
118  std::vector<float>::const_iterator it = range.first+getPosition(elementName);
119  std::vector<float>::difference_type pos = -1;
120  if (it != v_sum_.end()){
121  pos = it - v_sum_.begin();
122  v_sum_.at(pos) = value; }
123 }
const Range getRange(const uint32_t &detID) const
std::vector< DetRegistry > indexes_
Registry::const_iterator RegistryIterator
std::pair< ContainerIterator, ContainerIterator > Range
std::vector< float > v_sum_
const short getPosition(std::string elementName) const
void SiStripSummary::setRunNr ( int  inputRunNr)
inline

Definition at line 112 of file SiStripSummary.h.

References runNr_.

Referenced by SiStripSummaryBuilder::analyze().

112 { runNr_ = inputRunNr; }
void SiStripSummary::setTimeValue ( unsigned long long  inputTimeValue)
inline

Definition at line 113 of file SiStripSummary.h.

References timeValue_.

113 { timeValue_=inputTimeValue;}
unsigned long long timeValue_
void SiStripSummary::setUserDBContent ( const std::vector< std::string > &  userDBContent)
inline

Definition at line 111 of file SiStripSummary.h.

References userDBContent_.

Referenced by SiStripSummaryBuilder::analyze().

111 { userDBContent_ = userDBContent;}
std::vector< std::string > userDBContent_

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 142 of file SiStripSummary.h.

template<typename CondSerializationT , typename Enabled >
friend struct cond::serialization::access
friend

Definition at line 142 of file SiStripSummary.h.

Member Data Documentation

std::vector<DetRegistry> SiStripSummary::indexes_
int SiStripSummary::runNr_

Definition at line 131 of file SiStripSummary.h.

Referenced by getRunNr(), print(), setRunNr(), and SiStripSummary().

unsigned long long SiStripSummary::timeValue_

Definition at line 132 of file SiStripSummary.h.

Referenced by getTimeValue(), print(), setTimeValue(), and SiStripSummary().

std::vector<std::string> SiStripSummary::userDBContent_
std::vector<float> SiStripSummary::v_sum_