CMS 3D CMS Logo

Classes | Public Types | Public Member Functions | Private Attributes

ClusterSummary Class Reference

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

List of all members.

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
std::vector< double > GetGenericVariable (std::string variableName) const
std::vector< double > GetGenericVariable (int variableLocation) const
double GetGenericVariable (int variableLocation, int module) const
double GetGenericVariable (std::string variableName, int module) 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 (std::string variableName, int module, double value)
void SetGenericVariable (int variableLocation, 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.

                  { TRACKER = 0,
                    TIB = 1,
                    TIB_1 = 11, TIB_2 = 12, TIB_3 = 13, TIB_4 = 14, //TIB layer 1-4
                    TOB = 2,
                    TOB_1 = 21, TOB_2 = 22, TOB_3 = 23, TOB_4 = 24, TOB_5 = 25, TOB_6 = 26,  //TOB layer 1-6
                    TID = 3,
                    TIDM = 31, TIDP = 32,  //TID minus and plus
                    TIDM_1 = 311, TIDM_2 = 312, TIDM_3 = 313, //TID minus layer 1-3
                    TIDP_1 = 321, TIDP_2 = 322, TIDP_3 = 323, //TID plus layer 1-3
                    TIDMR_1 = 3110, TIDMR_2 = 3120, TIDMR_3 = 3130, //TID minus ring 1-3
                    TIDPR_1 = 3210, TIDPR_2 = 3220, TIDPR_3 = 3230, //TID plus ring 1-3
                    TEC = 4,
                    TECM = 41, TECP = 42,  //TEC minus and plus
                    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
                    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 
                    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
                    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
                    //PIXELS
                    PIXEL = 5,
                    FPIX = 6, // Pixel endcaps
                    FPIX_1 = 61,FPIX_2 = 62,FPIX_3 = 63, // Endcaps disks 1-3
                    FPIXM = 611, FPIXP = 612,  // Pixel endcaps minus and plus side
                    FPIXM_1 = 6110, FPIXM_2 = 6120, FPIXM_3 = 6130, // Endcap minus disk 1-3  
                    FPIXP_1 = 6210, FPIXP_2 = 6220, FPIXP_3 = 6230, // Endcap plus disk 1-3  
                    BPIX = 7, //Pixel barrel
                    BPIX_1 = 71, BPIX_2 = 72, BPIX_3 = 73 //Pixel barrel layer 1-3
                
  };
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.

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

Member Function Documentation

void ClusterSummary::ClearGenericVariable ( ) [inline]

Definition at line 239 of file ClusterSummary.h.

References genericVariablesTmp_, i, and j.

Referenced by ClusterSummaryProducer::produce().

                              { 
    
    //genericVariablesTmp_.clear();

    for (unsigned int i = 0; i < genericVariablesTmp_.size(); ++i){
      for (unsigned int j = 0; j < genericVariablesTmp_[i].size(); ++j){
        genericVariablesTmp_[i][j] = 0;
      }
    }    
  } 
void ClusterSummary::ClearUserIterator ( ) [inline]

Definition at line 275 of file ClusterSummary.h.

References iterator_.

{ iterator_.clear(); }
void ClusterSummary::ClearUserModules ( ) [inline]

Definition at line 267 of file ClusterSummary.h.

References modules_.

Referenced by ClusterSummaryProducer::produce().

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

Definition at line 101 of file ClusterSummary.cc.

References i, j, and text2workspace::mod.

                                                                            {

  std::vector<std::string> v_moduleTypes;

  std::string mod = ProvInfo;
  std::string::size_type i = 0;
  std::string::size_type j = mod.find(',');

  if ( j == std::string::npos ){
    v_moduleTypes.push_back(mod);
  }
  else{

    while (j != std::string::npos) {
      v_moduleTypes.push_back(mod.substr(i, j-i));
      i = ++j;
      j = mod.find(',', j);
      if (j == std::string::npos)
        v_moduleTypes.push_back(mod.substr(i, mod.length( )));
    }

  }

  return v_moduleTypes;

}
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().

                                                                      { 
    return GetModuleLocation(module) < 0  ? 0. : genericVariables_[variableLocation][GetModuleLocation(module)]; }
double ClusterSummary::GetGenericVariable ( std::string  variableName,
int  module 
) const [inline]

Definition at line 184 of file ClusterSummary.h.

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

                                                                        { 

    int position = GetVariableLocation(variableName);
    int mposition = GetModuleLocation(module);

    return mposition < 0 ? 0. : genericVariables_[position][mposition];    
  }
std::vector<double> ClusterSummary::GetGenericVariable ( int  variableLocation) const [inline]

Definition at line 198 of file ClusterSummary.h.

References genericVariables_.

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

Definition at line 203 of file ClusterSummary.h.

References genericVariables_.

{ return genericVariables_; }  
std::vector<double> ClusterSummary::GetGenericVariable ( std::string  variableName) const [inline]

Definition at line 193 of file ClusterSummary.h.

References genericVariables_, and GetVariableLocation().

                                                                       {     
    return genericVariables_[GetVariableLocation(variableName)];
  }
int ClusterSummary::GetModuleLocation ( int  mod) const

Definition at line 4 of file ClusterSummary.cc.

References modules_.

Referenced by GetGenericVariable(), and SetGenericVariable().

                                                      {

  int placeInModsVector = -1;
    
  int cnt = 0;
  int pixelcnt = 0; 
  for(std::vector<int>::const_iterator it = modules_.begin(); it != modules_.end(); ++it) {
    /*
    if ( mod == (*it) ) { 
      placeInModsVector = cnt; 
      break;
    }
    else ++cnt;
    */
    
    int mod_tmp = *it;
    while (mod_tmp > 9 ){
      mod_tmp /= 10;
    }
     
    if ( mod_tmp < 5 ){

      if ( mod == (*it) ) { 
        placeInModsVector = cnt; 
        break;
      }
      else ++cnt;
    }
    else{      
      if ( mod == (*it) ) { 
        placeInModsVector = pixelcnt; 
        break;
      }
      else ++pixelcnt;
    }   
  }

  if (placeInModsVector == -1){

    edm::LogWarning("NoModule") << "No information for requested module "<<mod<<". Please check in the Provinence Infomation for proper modules.";
      
    return -1;

  }

  return placeInModsVector;

}
std::vector<std::string> ClusterSummary::GetUserContent ( ) [inline]

Definition at line 254 of file ClusterSummary.h.

References userContent.

{ return userContent;}
void ClusterSummary::GetUserContentInfo ( ) const [inline]

Definition at line 256 of file ClusterSummary.h.

References gather_cfg::cout, i, and userContent.

                                    { 
    std::cout << "Saving info for " ;
    for (unsigned int i = 0; i < userContent.size(); ++i){ std::cout << userContent.at(i) << " " ;}
    std::cout << std::endl;
  }
int ClusterSummary::GetUserContentSize ( ) [inline]

Definition at line 255 of file ClusterSummary.h.

References userContent.

Referenced by SetUserIterator().

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

Definition at line 274 of file ClusterSummary.h.

References iterator_.

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

Definition at line 266 of file ClusterSummary.h.

References modules_.

Referenced by ClusterSummaryProducer::produce().

{ return modules_;  }
int ClusterSummary::GetVariableLocation ( std::string  var) const

Definition at line 55 of file ClusterSummary.cc.

References Exception, and userContent.

Referenced by GetGenericVariable(), and SetGenericVariable().

                                                              {

  int placeInUserVector = -1;
    

  int cnt = 0;
  for(std::vector<std::string>::const_iterator it = userContent.begin(); it != userContent.end(); ++it) {

    if ( var == (*it) ) { 
      placeInUserVector = cnt; 
      break;
    }
    else ++cnt;
      
  }


  /*
  if ( var == "cHits" )
    placeInUserVector = NMODULES;
  else if (var == "cSize" )
    placeInUserVector = CLUSTERSIZE;
  else if (var == "cCharge" )
    placeInUserVector = CLUSTERCHARGE;
  else if (var == "pHits" )
    placeInUserVector = NMODULESPIXELS;
  else if (var == "pSize" )
    placeInUserVector = CLUSTERSIZEPIXELS;
  else if (var == "pCharge" )
    placeInUserVector = CLUSTERCHARGEPIXELS;
  else
    placeInUserVector = -1;
  */
  if (placeInUserVector == -1){
    std::ostringstream err;
    err<<"No information for requested var "<<var<<". Please check if you have chosen a proper variable.";
      
    throw cms::Exception( "Missing Variable", err.str());
  }

  return placeInUserVector;

}
void ClusterSummary::PrepairGenericVariable ( ) [inline]
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.

                                                                              { 
    
    /*
      genericVariablesTmp[ variable ][ module ]
      
      This will fill the values in the order as they are filled in the produced.
      
      1) Find where the variableName lives in userContent
      2) Find where module lives in modules_

    */

    int position = GetVariableLocation(variableName);
    int mposition = GetModuleLocation(module);

    if(mposition >=0) genericVariablesTmp_[position][mposition] += value;    
  } 
void ClusterSummary::SetGenericVariable ( int  variableLocation,
int  module,
double  value 
) [inline]
void ClusterSummary::SetUserContent ( std::vector< std::string >  Content) const [inline]

Definition at line 253 of file ClusterSummary.h.

References userContent.

Referenced by ClusterSummaryProducer::beginJob().

{ userContent = Content;}
void ClusterSummary::SetUserIterator ( ) [inline]

Definition at line 273 of file ClusterSummary.h.

References GetUserContentSize(), and iterator_.

Referenced by ClusterSummaryProducer::beginJob().

{ iterator_.push_back( GetUserContentSize()  );}
void ClusterSummary::SetUserModules ( int  value) [inline]

Definition at line 265 of file ClusterSummary.h.

References modules_.

Referenced by ClusterSummaryProducer::produce().

{ modules_.push_back( value ); }

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_ [mutable, private]
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 [mutable, private]