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 ()
 
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
 
void PrepairGenericVariable ()
 
void SetGenericVariable (int variableLocation, int module, double value)
 
void SetGenericVariable (std::string variableName, int module, double value)
 
void SetUserContent (std::vector< std::string > Content) const
 
void SetUserIterator ()
 
void SetUserModules (int value)
 

Private Attributes

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

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 126 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 133 of file ClusterSummary.h.

133  { TRACKER = 0,
134  TIB = 1,
135  TIB_1 = 11, TIB_2 = 12, TIB_3 = 13, TIB_4 = 14, //TIB layer 1-4
136  TOB = 2,
137  TOB_1 = 21, TOB_2 = 22, TOB_3 = 23, TOB_4 = 24, TOB_5 = 25, TOB_6 = 26, //TOB layer 1-6
138  TID = 3,
139  TIDM = 31, TIDP = 32, //TID minus and plus
140  TIDM_1 = 311, TIDM_2 = 312, TIDM_3 = 313, //TID minus layer 1-3
141  TIDP_1 = 321, TIDP_2 = 322, TIDP_3 = 323, //TID plus layer 1-3
142  TIDMR_1 = 3110, TIDMR_2 = 3120, TIDMR_3 = 3130, //TID minus ring 1-3
143  TIDPR_1 = 3210, TIDPR_2 = 3220, TIDPR_3 = 3230, //TID plus ring 1-3
144  TEC = 4,
145  TECM = 41, TECP = 42, //TEC minus and plus
146  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
147  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
148  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
149  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
150  //PIXELS
151  PIXEL = 5,
152  FPIX = 6, // Pixel endcaps
153  FPIX_1 = 61,FPIX_2 = 62,FPIX_3 = 63, // Endcaps disks 1-3
154  FPIXM = 611, FPIXP = 612, // Pixel endcaps minus and plus side
155  FPIXM_1 = 6110, FPIXM_2 = 6120, FPIXM_3 = 6130, // Endcap minus disk 1-3
156  FPIXP_1 = 6210, FPIXP_2 = 6220, FPIXP_3 = 6230, // Endcap plus disk 1-3
157  BPIX = 7, //Pixel barrel
158  BPIX_1 = 71, BPIX_2 = 72, BPIX_3 = 73 //Pixel barrel layer 1-3
159 
160  };
Enumerator
NMODULES 
CLUSTERSIZE 
CLUSTERCHARGE 
NMODULESPIXELS 
CLUSTERSIZEPIXELS 
CLUSTERCHARGEPIXELS 

Definition at line 163 of file ClusterSummary.h.

Constructor & Destructor Documentation

ClusterSummary::ClusterSummary ( )
inline

Definition at line 130 of file ClusterSummary.h.

130 :genericVariablesTmp_(6, std::vector<double>(100,0) ){}
std::vector< std::vector< double > > genericVariablesTmp_

Member Function Documentation

void ClusterSummary::ClearGenericVariable ( )
inline

Definition at line 239 of file ClusterSummary.h.

References genericVariablesTmp_, i, and j.

Referenced by ClusterSummaryProducer::produce().

239  {
240 
241  //genericVariablesTmp_.clear();
242 
243  for (unsigned int i = 0; i < genericVariablesTmp_.size(); ++i){
244  for (unsigned int j = 0; j < genericVariablesTmp_[i].size(); ++j){
245  genericVariablesTmp_[i][j] = 0;
246  }
247  }
248  }
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 275 of file ClusterSummary.h.

References iterator_.

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

Definition at line 267 of file ClusterSummary.h.

References modules_.

Referenced by ClusterSummaryProducer::produce().

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

Definition at line 101 of file ClusterSummary.cc.

References i, j, and text2workspace::mod.

101  {
102 
103  std::vector<std::string> v_moduleTypes;
104 
105  std::string mod = ProvInfo;
107  std::string::size_type j = mod.find(',');
108 
109  if ( j == std::string::npos ){
110  v_moduleTypes.push_back(mod);
111  }
112  else{
113 
114  while (j != std::string::npos) {
115  v_moduleTypes.push_back(mod.substr(i, j-i));
116  i = ++j;
117  j = mod.find(',', j);
118  if (j == std::string::npos)
119  v_moduleTypes.push_back(mod.substr(i, mod.length( )));
120  }
121 
122  }
123 
124  return v_moduleTypes;
125 
126 }
int i
Definition: DBlmapReader.cc:9
uint16_t size_type
int j
Definition: DBlmapReader.cc:9
list mod
Load physics model.
double ClusterSummary::GetGenericVariable ( int  variableLocation,
int  module 
) const
inline

Definition at line 180 of file ClusterSummary.h.

References genericVariables_, and GetModuleLocation().

Referenced by ClusterSummaryProducer::produce().

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

Definition at line 184 of file ClusterSummary.h.

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

184  {
185 
186  int position = GetVariableLocation(variableName);
187  int mposition = GetModuleLocation(module);
188 
189  return mposition < 0 ? 0. : genericVariables_[position][mposition];
190  }
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:209
std::vector<double> ClusterSummary::GetGenericVariable ( std::string  variableName) const
inline

Definition at line 193 of file ClusterSummary.h.

References genericVariables_, and GetVariableLocation().

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

Definition at line 198 of file ClusterSummary.h.

References genericVariables_.

198  {
199  return genericVariables_[variableLocation];
200  }
std::vector< std::vector< double > > genericVariables_
std::vector< std::vector<double> > ClusterSummary::GetGenericVariable ( ) const
inline

Definition at line 203 of file ClusterSummary.h.

References genericVariables_.

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

Definition at line 4 of file ClusterSummary.cc.

References modules_.

Referenced by GetGenericVariable(), and SetGenericVariable().

4  {
5 
6  int placeInModsVector = -1;
7 
8  int cnt = 0;
9  int pixelcnt = 0;
10  for(std::vector<int>::const_iterator it = modules_.begin(); it != modules_.end(); ++it) {
11  /*
12  if ( mod == (*it) ) {
13  placeInModsVector = cnt;
14  break;
15  }
16  else ++cnt;
17  */
18 
19  int mod_tmp = *it;
20  while (mod_tmp > 9 ){
21  mod_tmp /= 10;
22  }
23 
24  if ( mod_tmp < 5 ){
25 
26  if ( mod == (*it) ) {
27  placeInModsVector = cnt;
28  break;
29  }
30  else ++cnt;
31  }
32  else{
33  if ( mod == (*it) ) {
34  placeInModsVector = pixelcnt;
35  break;
36  }
37  else ++pixelcnt;
38  }
39  }
40 
41  if (placeInModsVector == -1){
42 
43  edm::LogWarning("NoModule") << "No information for requested module "<<mod<<". Please check in the Provinence Infomation for proper modules.";
44 
45  return -1;
46 
47  }
48 
49  return placeInModsVector;
50 
51 }
std::vector< int > modules_
list mod
Load physics model.
std::vector<std::string> ClusterSummary::GetUserContent ( )
inline

Definition at line 254 of file ClusterSummary.h.

References userContent.

254 { return userContent;}
std::vector< std::string > userContent
void ClusterSummary::GetUserContentInfo ( ) const
inline

Definition at line 256 of file ClusterSummary.h.

References gather_cfg::cout, i, and userContent.

256  {
257  std::cout << "Saving info for " ;
258  for (unsigned int i = 0; i < userContent.size(); ++i){ std::cout << userContent.at(i) << " " ;}
259  std::cout << std::endl;
260  }
int i
Definition: DBlmapReader.cc:9
std::vector< std::string > userContent
tuple cout
Definition: gather_cfg.py:121
int ClusterSummary::GetUserContentSize ( )
inline

Definition at line 255 of file ClusterSummary.h.

References userContent.

Referenced by SetUserIterator().

255 { return userContent.size(); }
std::vector< std::string > userContent
std::vector<int> ClusterSummary::GetUserIterator ( ) const
inline

Definition at line 274 of file ClusterSummary.h.

References iterator_.

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

Definition at line 266 of file ClusterSummary.h.

References modules_.

Referenced by ClusterSummaryProducer::produce().

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

Definition at line 55 of file ClusterSummary.cc.

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

Referenced by GetGenericVariable(), and SetGenericVariable().

55  {
56 
57  int placeInUserVector = -1;
58 
59 
60  int cnt = 0;
61  for(std::vector<std::string>::const_iterator it = userContent.begin(); it != userContent.end(); ++it) {
62 
63  if ( var == (*it) ) {
64  placeInUserVector = cnt;
65  break;
66  }
67  else ++cnt;
68 
69  }
70 
71 
72  /*
73  if ( var == "cHits" )
74  placeInUserVector = NMODULES;
75  else if (var == "cSize" )
76  placeInUserVector = CLUSTERSIZE;
77  else if (var == "cCharge" )
78  placeInUserVector = CLUSTERCHARGE;
79  else if (var == "pHits" )
80  placeInUserVector = NMODULESPIXELS;
81  else if (var == "pSize" )
82  placeInUserVector = CLUSTERSIZEPIXELS;
83  else if (var == "pCharge" )
84  placeInUserVector = CLUSTERCHARGEPIXELS;
85  else
86  placeInUserVector = -1;
87  */
88  if (placeInUserVector == -1){
89  std::ostringstream err;
90  err<<"No information for requested var "<<var<<". Please check if you have chosen a proper variable.";
91 
92  throw cms::Exception( "Missing Variable", err.str());
93  }
94 
95  return placeInUserVector;
96 
97 }
std::vector< std::string > userContent
void ClusterSummary::PrepairGenericVariable ( )
inline

Definition at line 229 of file ClusterSummary.h.

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

Referenced by ClusterSummaryProducer::produce().

229  {
230 
232 
233  for (unsigned int i = 0; i < userContent.size(); ++i){
235  }
236  }
int i
Definition: DBlmapReader.cc:9
std::vector< std::string > userContent
std::vector< std::vector< double > > genericVariablesTmp_
std::vector< std::vector< double > > genericVariables_
#define end
Definition: vmac.h:38
#define begin
Definition: vmac.h:31
void ClusterSummary::SetGenericVariable ( int  variableLocation,
int  module,
double  value 
)
inline

Definition at line 206 of file ClusterSummary.h.

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

Referenced by ClusterSummaryProducer::produce().

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

Definition at line 210 of file ClusterSummary.h.

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

210  {
211 
212  /*
213  genericVariablesTmp[ variable ][ module ]
214 
215  This will fill the values in the order as they are filled in the produced.
216 
217  1) Find where the variableName lives in userContent
218  2) Find where module lives in modules_
219 
220  */
221 
222  int position = GetVariableLocation(variableName);
223  int mposition = GetModuleLocation(module);
224 
225  if(mposition >=0) genericVariablesTmp_[position][mposition] += value;
226  }
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:209
void ClusterSummary::SetUserContent ( std::vector< std::string >  Content) const
inline

Definition at line 253 of file ClusterSummary.h.

References userContent.

Referenced by ClusterSummaryProducer::beginJob().

253 { userContent = Content;}
std::vector< std::string > userContent
void ClusterSummary::SetUserIterator ( )
inline

Definition at line 273 of file ClusterSummary.h.

References GetUserContentSize(), and iterator_.

Referenced by ClusterSummaryProducer::beginJob().

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

Definition at line 265 of file ClusterSummary.h.

References modules_.

Referenced by ClusterSummaryProducer::produce().

265 { modules_.push_back( value ); }
std::vector< int > modules_

Member Data Documentation

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

Definition at line 303 of file ClusterSummary.h.

Referenced by GetGenericVariable(), and PrepairGenericVariable().

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

Definition at line 300 of file ClusterSummary.h.

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

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