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 | Private Attributes
ClusterSummary Class Reference

#include <msegala/ClusterSummary/src/ClusterSummary.cc>

Classes

class  ModuleSelection
 

Public Types

enum  CMSTracker {
  TRACKER = 0, TIB = 1, TIB_1 = 11, TIB_2 = 12,
  TIB_3 = 13, TIB_4 = 14, TOB = 2, TOB_1 = 21,
  TOB_2 = 22, TOB_3 = 23, TOB_4 = 24, TOB_5 = 25,
  TOB_6 = 26, TID = 3, TIDM = 31, TIDP = 32,
  TIDM_1 = 311, TIDM_2 = 312, TIDM_3 = 313, TIDP_1 = 321,
  TIDP_2 = 322, TIDP_3 = 323, TIDMR_1 = 3110, TIDMR_2 = 3120,
  TIDMR_3 = 3130, TIDPR_1 = 3210, TIDPR_2 = 3220, TIDPR_3 = 3230,
  TEC = 4, TECM = 41, TECP = 42, TECM_1 = 411,
  TECM_2 = 412, TECM_3 = 413, TECM_4 = 414, TECM_5 = 415,
  TECM_6 = 416, TECM_7 = 417, TECM_8 = 418, TECM_9 = 419,
  TECP_1 = 421, TECP_2 = 422, TECP_3 = 423, TECP_4 = 424,
  TECP_5 = 425, TECP_6 = 426, TECP_7 = 427, TECP_8 = 428,
  TECP_9 = 429, TECMR_1 = 4110, TECMR_2 = 4120, TECMR_3 = 4130,
  TECMR_4 = 4140, TECMR_5 = 4150, TECMR_6 = 4160, TECMR_7 = 4170,
  TECPR_1 = 4210, TECPR_2 = 4220, TECPR_3 = 4230, TECPR_4 = 4240,
  TECPR_5 = 4250, TECPR_6 = 4260, TECPR_7 = 4270, PIXEL = 5,
  FPIX = 6, FPIX_1 = 61, FPIX_2 = 62, FPIX_3 = 63,
  FPIXM = 611, FPIXP = 612, FPIXM_1 = 6110, FPIXM_2 = 6120,
  FPIXM_3 = 6130, FPIXP_1 = 6210, FPIXP_2 = 6220, FPIXP_3 = 6230,
  BPIX = 7, BPIX_1 = 71, BPIX_2 = 72, BPIX_3 = 73
}
 
enum  VariablePlacement {
  NMODULES = 0, CLUSTERSIZE = 1, CLUSTERCHARGE = 2, NMODULESPIXELS = 3,
  CLUSTERSIZEPIXELS = 4, CLUSTERCHARGEPIXELS = 5
}
 

Public Member Functions

void ClearGenericVariable ()
 
void ClearUserIterator ()
 
void ClearUserModules ()
 
 ClusterSummary ()
 
 ClusterSummary (const ClusterSummary &src)
 
 ClusterSummary (ClusterSummary &&other)
 
std::vector< std::string > DecodeProvInfo (std::string ProvInfo) const
 
double GetGenericVariable (int variableLocation, int module) const
 
double GetGenericVariable (std::string variableName, int module) const
 
std::vector< double > GetGenericVariable (std::string variableName) const
 
std::vector< double > GetGenericVariable (int variableLocation) const
 
std::vector< std::vector
< double > > 
GetGenericVariable () const
 
int GetModuleLocation (int mod) const
 
std::vector< std::string > GetUserContent ()
 
void GetUserContentInfo () const
 
int GetUserContentSize ()
 
std::vector< int > GetUserIterator () const
 
std::vector< int > GetUserModules () const
 
int GetVariableLocation (std::string var) const
 
ClusterSummaryoperator= (const ClusterSummary &rhs)
 
void PrepairGenericVariable ()
 
void SetGenericVariable (int variableLocation, int module, double value)
 
void SetGenericVariable (std::string variableName, int module, double value)
 
void SetUserContent (const std::vector< std::string > &Content) const
 
void SetUserIterator ()
 
void SetUserModules (int value)
 
void swap (ClusterSummary &other)
 
 ~ClusterSummary ()
 

Private Attributes

std::vector< std::vector
< double > > 
genericVariables_
 
std::vector< std::vector
< double > > 
genericVariablesTmp_
 
std::vector< int > iterator_
 
std::vector< int > modules_
 
std::atomic< std::vector
< std::string > * > 
userContent
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 124 of file ClusterSummary.h.

Member Enumeration Documentation

Enumerator
TRACKER 
TIB 
TIB_1 
TIB_2 
TIB_3 
TIB_4 
TOB 
TOB_1 
TOB_2 
TOB_3 
TOB_4 
TOB_5 
TOB_6 
TID 
TIDM 
TIDP 
TIDM_1 
TIDM_2 
TIDM_3 
TIDP_1 
TIDP_2 
TIDP_3 
TIDMR_1 
TIDMR_2 
TIDMR_3 
TIDPR_1 
TIDPR_2 
TIDPR_3 
TEC 
TECM 
TECP 
TECM_1 
TECM_2 
TECM_3 
TECM_4 
TECM_5 
TECM_6 
TECM_7 
TECM_8 
TECM_9 
TECP_1 
TECP_2 
TECP_3 
TECP_4 
TECP_5 
TECP_6 
TECP_7 
TECP_8 
TECP_9 
TECMR_1 
TECMR_2 
TECMR_3 
TECMR_4 
TECMR_5 
TECMR_6 
TECMR_7 
TECPR_1 
TECPR_2 
TECPR_3 
TECPR_4 
TECPR_5 
TECPR_6 
TECPR_7 
PIXEL 
FPIX 
FPIX_1 
FPIX_2 
FPIX_3 
FPIXM 
FPIXP 
FPIXM_1 
FPIXM_2 
FPIXM_3 
FPIXP_1 
FPIXP_2 
FPIXP_3 
BPIX 
BPIX_1 
BPIX_2 
BPIX_3 

Definition at line 141 of file ClusterSummary.h.

141  { TRACKER = 0,
142  TIB = 1,
143  TIB_1 = 11, TIB_2 = 12, TIB_3 = 13, TIB_4 = 14, //TIB layer 1-4
144  TOB = 2,
145  TOB_1 = 21, TOB_2 = 22, TOB_3 = 23, TOB_4 = 24, TOB_5 = 25, TOB_6 = 26, //TOB layer 1-6
146  TID = 3,
147  TIDM = 31, TIDP = 32, //TID minus and plus
148  TIDM_1 = 311, TIDM_2 = 312, TIDM_3 = 313, //TID minus layer 1-3
149  TIDP_1 = 321, TIDP_2 = 322, TIDP_3 = 323, //TID plus layer 1-3
150  TIDMR_1 = 3110, TIDMR_2 = 3120, TIDMR_3 = 3130, //TID minus ring 1-3
151  TIDPR_1 = 3210, TIDPR_2 = 3220, TIDPR_3 = 3230, //TID plus ring 1-3
152  TEC = 4,
153  TECM = 41, TECP = 42, //TEC minus and plus
154  TECM_1 = 411, TECM_2 = 412, TECM_3 = 413, TECM_4 = 414, TECM_5 = 415, TECM_6 = 416, TECM_7 = 417, TECM_8 = 418, TECM_9 = 419, //TEC minus layer 1-9
155  TECP_1 = 421, TECP_2 = 422, TECP_3 = 423, TECP_4 = 424, TECP_5 = 425, TECP_6 = 426, TECP_7 = 427, TECP_8 = 428, TECP_9 = 429, //TEC plus layer 1-9
156  TECMR_1 = 4110, TECMR_2 = 4120, TECMR_3 = 4130, TECMR_4 = 4140, TECMR_5 = 4150, TECMR_6 = 4160, TECMR_7 = 4170, //TEC minus ring 1-9
157  TECPR_1 = 4210, TECPR_2 = 4220, TECPR_3 = 4230, TECPR_4 = 4240, TECPR_5 = 4250, TECPR_6 = 4260, TECPR_7 = 4270, //TEC plus ring 1-9
158  //PIXELS
159  PIXEL = 5,
160  FPIX = 6, // Pixel endcaps
161  FPIX_1 = 61,FPIX_2 = 62,FPIX_3 = 63, // Endcaps disks 1-3
162  FPIXM = 611, FPIXP = 612, // Pixel endcaps minus and plus side
163  FPIXM_1 = 6110, FPIXM_2 = 6120, FPIXM_3 = 6130, // Endcap minus disk 1-3
164  FPIXP_1 = 6210, FPIXP_2 = 6220, FPIXP_3 = 6230, // Endcap plus disk 1-3
165  BPIX = 7, //Pixel barrel
166  BPIX_1 = 71, BPIX_2 = 72, BPIX_3 = 73 //Pixel barrel layer 1-3
167 
168  };
Enumerator
NMODULES 
CLUSTERSIZE 
CLUSTERCHARGE 
NMODULESPIXELS 
CLUSTERSIZEPIXELS 
CLUSTERCHARGEPIXELS 

Definition at line 171 of file ClusterSummary.h.

Constructor & Destructor Documentation

ClusterSummary::ClusterSummary ( )

Definition at line 4 of file ClusterSummary.cc.

5  : userContent(nullptr), genericVariablesTmp_(6, std::vector<double>(100,0) )
6 {
7 }
std::atomic< std::vector< std::string > * > userContent
std::vector< std::vector< double > > genericVariablesTmp_
ClusterSummary::~ClusterSummary ( )

Definition at line 9 of file ClusterSummary.cc.

References userContent.

10 {
11  delete userContent.load();
12  userContent = nullptr;
13 }
std::atomic< std::vector< std::string > * > userContent
ClusterSummary::ClusterSummary ( const ClusterSummary src)

Definition at line 28 of file ClusterSummary.cc.

29  : userContent(nullptr), iterator_(src.iterator_), modules_(src.modules_),
32 {
33 }
std::atomic< std::vector< std::string > * > userContent
std::vector< int > modules_
std::vector< std::vector< double > > genericVariablesTmp_
std::vector< std::vector< double > > genericVariables_
std::vector< int > iterator_
ClusterSummary::ClusterSummary ( ClusterSummary &&  other)

Definition at line 44 of file ClusterSummary.cc.

References swap().

45  : ClusterSummary()
46 {
47  other.swap(*this);
48 }
void swap(ClusterSummary &other)

Member Function Documentation

void ClusterSummary::ClearGenericVariable ( )
inline

Definition at line 240 of file ClusterSummary.h.

References genericVariablesTmp_, i, and j.

Referenced by ClusterSummaryProducer::produce().

240  {
241 
242  //genericVariablesTmp_.clear();
243 
244  for (unsigned int i = 0; i < genericVariablesTmp_.size(); ++i){
245  for (unsigned int j = 0; j < genericVariablesTmp_[i].size(); ++j){
246  genericVariablesTmp_[i][j] = 0;
247  }
248  }
249  }
int i
Definition: DBlmapReader.cc:9
std::vector< std::vector< double > > genericVariablesTmp_
int j
Definition: DBlmapReader.cc:9
void ClusterSummary::ClearUserIterator ( )
inline

Definition at line 272 of file ClusterSummary.h.

References iterator_.

272 { iterator_.clear(); }
std::vector< int > iterator_
void ClusterSummary::ClearUserModules ( )
inline

Definition at line 264 of file ClusterSummary.h.

References modules_.

Referenced by ClusterSummaryProducer::produce().

264 { modules_.clear(); }
std::vector< int > modules_
std::vector< std::string > ClusterSummary::DecodeProvInfo ( std::string  ProvInfo) const

Definition at line 187 of file ClusterSummary.cc.

References i, j, mod(), and AlCaHLTBitMon_QueryRunRegistry::string.

187  {
188 
189  std::vector<std::string> v_moduleTypes;
190 
191  std::string mod = ProvInfo;
193  std::string::size_type j = mod.find(',');
194 
195  if ( j == std::string::npos ){
196  v_moduleTypes.push_back(mod);
197  }
198  else{
199 
200  while (j != std::string::npos) {
201  v_moduleTypes.push_back(mod.substr(i, j-i));
202  i = ++j;
203  j = mod.find(',', j);
204  if (j == std::string::npos)
205  v_moduleTypes.push_back(mod.substr(i, mod.length( )));
206  }
207 
208  }
209 
210  return v_moduleTypes;
211 
212 }
int i
Definition: DBlmapReader.cc:9
uint16_t size_type
int j
Definition: DBlmapReader.cc:9
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
double ClusterSummary::GetGenericVariable ( int  variableLocation,
int  module 
) const
inline

Definition at line 188 of file ClusterSummary.h.

References genericVariables_, and GetModuleLocation().

Referenced by ClusterSummaryProducer::produce().

188  {
189  return GetModuleLocation(module) < 0 ? 0. : genericVariables_[variableLocation][GetModuleLocation(module)]; }
std::vector< std::vector< double > > genericVariables_
int GetModuleLocation(int mod) const
Definition: vlib.h:208
double ClusterSummary::GetGenericVariable ( std::string  variableName,
int  module 
) const
inline

Definition at line 192 of file ClusterSummary.h.

References genericVariables_, GetModuleLocation(), GetVariableLocation(), and position.

192  {
193 
194  int position = GetVariableLocation(variableName);
195  int mposition = GetModuleLocation(module);
196 
197  return mposition < 0 ? 0. : genericVariables_[position][mposition];
198  }
std::vector< std::vector< double > > genericVariables_
int GetVariableLocation(std::string var) const
static int position[264][3]
Definition: ReadPGInfo.cc:509
int GetModuleLocation(int mod) const
Definition: vlib.h:208
std::vector<double> ClusterSummary::GetGenericVariable ( std::string  variableName) const
inline

Definition at line 201 of file ClusterSummary.h.

References genericVariables_, and GetVariableLocation().

201  {
202  return genericVariables_[GetVariableLocation(variableName)];
203  }
std::vector< std::vector< double > > genericVariables_
int GetVariableLocation(std::string var) const
std::vector<double> ClusterSummary::GetGenericVariable ( int  variableLocation) const
inline

Definition at line 206 of file ClusterSummary.h.

References genericVariables_.

206  {
207  return genericVariables_[variableLocation];
208  }
std::vector< std::vector< double > > genericVariables_
std::vector< std::vector<double> > ClusterSummary::GetGenericVariable ( ) const
inline

Definition at line 211 of file ClusterSummary.h.

References genericVariables_.

211 { return genericVariables_; }
std::vector< std::vector< double > > genericVariables_
int ClusterSummary::GetModuleLocation ( int  mod) const

Definition at line 50 of file ClusterSummary.cc.

References modules_.

Referenced by GetGenericVariable(), and SetGenericVariable().

50  {
51 
52  int placeInModsVector = -1;
53 
54  int cnt = 0;
55  int pixelcnt = 0;
56  for(std::vector<int>::const_iterator it = modules_.begin(); it != modules_.end(); ++it) {
57  /*
58  if ( mod == (*it) ) {
59  placeInModsVector = cnt;
60  break;
61  }
62  else ++cnt;
63  */
64 
65  int mod_tmp = *it;
66  while (mod_tmp > 9 ){
67  mod_tmp /= 10;
68  }
69 
70  if ( mod_tmp < 5 ){
71 
72  if ( mod == (*it) ) {
73  placeInModsVector = cnt;
74  break;
75  }
76  else ++cnt;
77  }
78  else{
79  if ( mod == (*it) ) {
80  placeInModsVector = pixelcnt;
81  break;
82  }
83  else ++pixelcnt;
84  }
85  }
86 
87  if (placeInModsVector == -1){
88 
89  edm::LogWarning("NoModule") << "No information for requested module "<<mod<<". Please check in the Provinence Infomation for proper modules.";
90 
91  return -1;
92 
93  }
94 
95  return placeInModsVector;
96 
97 }
std::vector< int > modules_
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
std::vector< std::string > ClusterSummary::GetUserContent ( )

Definition at line 124 of file ClusterSummary.cc.

References userContent.

125 {
126  return (*userContent.load(std::memory_order_acquire));
127 }
std::atomic< std::vector< std::string > * > userContent
void ClusterSummary::GetUserContentInfo ( ) const

Definition at line 132 of file ClusterSummary.cc.

References asciidump::at, gather_cfg::cout, i, findQualityFiles::size, and userContent.

132  {
133  std::cout << "Saving info for " ;
134  for (unsigned int i = 0; i < (*userContent.load(std::memory_order_acquire)).size(); ++i) {
135  std::cout << (*userContent.load(std::memory_order_acquire)).at(i) << " " ;
136  }
137  std::cout << std::endl;
138 }
int i
Definition: DBlmapReader.cc:9
std::atomic< std::vector< std::string > * > userContent
tuple cout
Definition: gather_cfg.py:121
tuple size
Write out results.
list at
Definition: asciidump.py:428
int ClusterSummary::GetUserContentSize ( )

Definition at line 128 of file ClusterSummary.cc.

References findQualityFiles::size, and userContent.

Referenced by SetUserIterator().

129 {
130  return (*userContent.load(std::memory_order_acquire)).size();
131 }
std::atomic< std::vector< std::string > * > userContent
tuple size
Write out results.
std::vector<int> ClusterSummary::GetUserIterator ( ) const
inline

Definition at line 271 of file ClusterSummary.h.

References iterator_.

271 { return iterator_; }
std::vector< int > iterator_
std::vector<int> ClusterSummary::GetUserModules ( ) const
inline

Definition at line 263 of file ClusterSummary.h.

References modules_.

Referenced by ClusterSummaryProducer::produce().

263 { return modules_; }
std::vector< int > modules_
int ClusterSummary::GetVariableLocation ( std::string  var) const

Definition at line 140 of file ClusterSummary.cc.

References edm::hlt::Exception, getGTfromDQMFile::obj, and userContent.

Referenced by GetGenericVariable(), and SetGenericVariable().

140  {
141 
142  int placeInUserVector = -1;
143 
144 
145  int cnt = 0;
146  auto obj = (*userContent.load(std::memory_order_acquire));
147  for(auto it=obj.begin(); it!=obj.end(); ++it) {
148 
149  if ( var == (*it) ) {
150  placeInUserVector = cnt;
151  break;
152  }
153  else ++cnt;
154 
155  }
156 
157 
158  /*
159  if ( var == "cHits" )
160  placeInUserVector = NMODULES;
161  else if (var == "cSize" )
162  placeInUserVector = CLUSTERSIZE;
163  else if (var == "cCharge" )
164  placeInUserVector = CLUSTERCHARGE;
165  else if (var == "pHits" )
166  placeInUserVector = NMODULESPIXELS;
167  else if (var == "pSize" )
168  placeInUserVector = CLUSTERSIZEPIXELS;
169  else if (var == "pCharge" )
170  placeInUserVector = CLUSTERCHARGEPIXELS;
171  else
172  placeInUserVector = -1;
173  */
174  if (placeInUserVector == -1){
175  std::ostringstream err;
176  err<<"No information for requested var "<<var<<". Please check if you have chosen a proper variable.";
177 
178  throw cms::Exception( "Missing Variable", err.str());
179  }
180 
181  return placeInUserVector;
182 
183 }
std::atomic< std::vector< std::string > * > userContent
ClusterSummary & ClusterSummary::operator= ( const ClusterSummary rhs)

Definition at line 36 of file ClusterSummary.cc.

References swap(), and groupFilesInBlocks::temp.

37 {
38  ClusterSummary temp(rhs);
39  temp.swap(*this);
40  return *this;
41 }
void ClusterSummary::PrepairGenericVariable ( )

Definition at line 99 of file ClusterSummary.cc.

References begin, end, genericVariables_, genericVariablesTmp_, i, python.multivaluedict::remove(), findQualityFiles::size, and userContent.

Referenced by ClusterSummaryProducer::produce().

99  {
100 
102 
103  for (unsigned int i = 0; i < (*userContent.load(std::memory_order_acquire)).size(); ++i){
105  }
106 }
int i
Definition: DBlmapReader.cc:9
std::atomic< std::vector< std::string > * > userContent
std::vector< std::vector< double > > genericVariablesTmp_
std::vector< std::vector< double > > genericVariables_
#define end
Definition: vmac.h:37
#define begin
Definition: vmac.h:30
tuple size
Write out results.
void ClusterSummary::SetGenericVariable ( int  variableLocation,
int  module,
double  value 
)
inline

Definition at line 214 of file ClusterSummary.h.

References genericVariablesTmp_, GetModuleLocation(), and relativeConstraints::value.

Referenced by ClusterSummaryProducer::produce().

214  {
215  if(GetModuleLocation(module) >=0) genericVariablesTmp_[variableLocation][GetModuleLocation(module)] += value; }
std::vector< std::vector< double > > genericVariablesTmp_
int GetModuleLocation(int mod) const
Definition: vlib.h:208
void ClusterSummary::SetGenericVariable ( std::string  variableName,
int  module,
double  value 
)
inline

Definition at line 218 of file ClusterSummary.h.

References genericVariablesTmp_, GetModuleLocation(), GetVariableLocation(), position, and relativeConstraints::value.

218  {
219 
220  /*
221  genericVariablesTmp[ variable ][ module ]
222 
223  This will fill the values in the order as they are filled in the produced.
224 
225  1) Find where the variableName lives in userContent
226  2) Find where module lives in modules_
227 
228  */
229 
230  int position = GetVariableLocation(variableName);
231  int mposition = GetModuleLocation(module);
232 
233  if(mposition >=0) genericVariablesTmp_[position][mposition] += value;
234  }
std::vector< std::vector< double > > genericVariablesTmp_
int GetVariableLocation(std::string var) const
static int position[264][3]
Definition: ReadPGInfo.cc:509
int GetModuleLocation(int mod) const
Definition: vlib.h:208
void ClusterSummary::SetUserContent ( const std::vector< std::string > &  Content) const

Definition at line 109 of file ClusterSummary.cc.

References i, and userContent.

Referenced by ClusterSummaryProducer::beginStream().

110 {
111  if(!userContent.load(std::memory_order_acquire)) {
112  auto ptr = new std::vector<std::string>;
113  for(auto i=Content.begin(); i!=Content.end(); ++i) {
114  ptr->push_back(*i);
115  }
116  //atomically try to swap this to become mItemsById
117  std::vector<std::string>* expect = nullptr;
118  bool exchanged = userContent.compare_exchange_strong(expect, ptr, std::memory_order_acq_rel);
119  if(!exchanged) {
120  delete ptr;
121  }
122  }
123 }
int i
Definition: DBlmapReader.cc:9
std::atomic< std::vector< std::string > * > userContent
void ClusterSummary::SetUserIterator ( )
inline

Definition at line 270 of file ClusterSummary.h.

References GetUserContentSize(), and iterator_.

Referenced by ClusterSummaryProducer::beginStream().

270 { iterator_.push_back( GetUserContentSize() );}
std::vector< int > iterator_
void ClusterSummary::SetUserModules ( int  value)
inline

Definition at line 262 of file ClusterSummary.h.

References modules_.

Referenced by ClusterSummaryProducer::produce().

262 { modules_.push_back( value ); }
std::vector< int > modules_
void ClusterSummary::swap ( ClusterSummary other)

Definition at line 16 of file ClusterSummary.cc.

References genericVariables_, genericVariablesTmp_, iterator_, modules_, std::swap(), and userContent.

Referenced by ClusterSummary(), and operator=().

17 {
18  other.userContent.exchange(
19  userContent.exchange(other.userContent.load(std::memory_order_acquire), std::memory_order_acq_rel),
20  std::memory_order_acq_rel);
22  std::swap(modules_, other.modules_);
25 }
std::atomic< std::vector< std::string > * > userContent
std::vector< int > modules_
std::vector< std::vector< double > > genericVariablesTmp_
std::vector< std::vector< double > > genericVariables_
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
std::vector< int > iterator_

Member Data Documentation

std::vector< std::vector<double> > ClusterSummary::genericVariables_
private

Definition at line 304 of file ClusterSummary.h.

Referenced by GetGenericVariable(), PrepairGenericVariable(), and swap().

std::vector< std::vector<double> > ClusterSummary::genericVariablesTmp_
mutableprivate
std::vector<int> ClusterSummary::iterator_
private

Definition at line 301 of file ClusterSummary.h.

Referenced by ClearUserIterator(), GetUserIterator(), SetUserIterator(), and swap().

std::vector<int> ClusterSummary::modules_
private
std::atomic<std::vector<std::string>*> ClusterSummary::userContent
mutableprivate