CMS 3D CMS Logo

IgSoRectHist.cc File Reference

#include "Iguana/Inventor/interface/IgSoRectHist.h"
#include <Inventor/nodes/SoText2.h>
#include <Inventor/nodes/SoFont.h>
#include <Inventor/nodes/SoCoordinate3.h>
#include <Inventor/nodes/SoFaceSet.h>
#include <Inventor/nodes/SoTranslation.h>
#include <Inventor/nodes/SoRotation.h>
#include <Inventor/nodes/SoSeparator.h>
#include <Inventor/nodes/SoIndexedFaceSet.h>
#include <Inventor/nodes/SoShapeHints.h>
#include <Inventor/nodes/SoMaterial.h>
#include <Inventor/nodes/SoMaterialBinding.h>
#include <Inventor/nodes/SoIndexedLineSet.h>
#include <Inventor/nodes/SoVertexProperty.h>
#include <Inventor/nodes/SoAnnotation.h>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iostream>

Go to the source code of this file.

Enumerations

enum  n_placement {
  UPPERRIGHTENDCAP, UPPERBARREL, LEFTENDCAP, LOWERBARREL,
  LOWERRIGHTENDCAP
}

Functions

n_placement findBinPlacement (const int nr, const int nz, const int binNo)
int findMaxEnergyBin (std::vector< float > &localEnergies)
void logScaleEnergies (std::vector< float > &localEnergies, std::vector< float > &negativeEnergies)
void resizeByMaxEnergy (const float maxEt, std::vector< float > &localEnergies)
void scaleEnergies (std::vector< float > &localEnergies, std::vector< float > &negativeEnergies, const float &scaleFactor)
 SO_KIT_SOURCE (IgSoRectHist)


Enumeration Type Documentation

enum n_placement

Enumerator:
UPPERRIGHTENDCAP 
UPPERBARREL 
LEFTENDCAP 
LOWERBARREL 
LOWERRIGHTENDCAP 

Definition at line 26 of file IgSoRectHist.cc.


Function Documentation

n_placement findBinPlacement ( const int  nr,
const int  nz,
const int  binNo 
)

Definition at line 37 of file IgSoRectHist.cc.

References LEFTENDCAP, LOWERBARREL, LOWERRIGHTENDCAP, UPPERBARREL, and UPPERRIGHTENDCAP.

Referenced by IgSoRectHist::generateLabelCoords().

00040 {
00041     //WARNING!! DOESN'T WORK WITH ODD NUMBER OF BINS
00042     if (binNo  < nr/2) return UPPERRIGHTENDCAP;
00043     else if (binNo < nr/2 + nz) return UPPERBARREL;
00044     else if     (binNo < 3./2. * nr + nz) return LEFTENDCAP;
00045     else if (binNo < 3./2. * nr + 2 * nz) return LOWERBARREL;
00046     else return LOWERRIGHTENDCAP;
00047 }

int findMaxEnergyBin ( std::vector< float > &  localEnergies  ) 

Definition at line 72 of file IgSoRectHist.cc.

References i.

Referenced by IgSoRectHist::refresh().

00073 {
00074     float maxEnergy=0;
00075     unsigned int maxEnergyIndex=0;
00076         
00077     for (unsigned int i=0; i<localEnergies.size(); i++) 
00078     {
00079         if (localEnergies[i]>maxEnergy) 
00080         {
00081             maxEnergy=localEnergies[i];
00082             maxEnergyIndex=i;
00083         }
00084     }
00085         
00086     return maxEnergyIndex;
00087 }

void logScaleEnergies ( std::vector< float > &  localEnergies,
std::vector< float > &  negativeEnergies 
)

Definition at line 50 of file IgSoRectHist.cc.

References i, and funct::log().

Referenced by IgSoRectHist::refresh().

00052 {
00053     for (unsigned int i=0; i<localEnergies.size(); i++) {
00054         if (localEnergies[i]!=0) localEnergies[i]=log(localEnergies[i]+1);
00055         if (negativeEnergies[i]!=0) negativeEnergies[i]=-log(-negativeEnergies[i]+1);
00056     }
00057 }

void resizeByMaxEnergy ( const float  maxEt,
std::vector< float > &  localEnergies 
)

Definition at line 89 of file IgSoRectHist.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), i, and iter.

00091 {
00092     //getting maximum energy
00093     std::vector<float>::iterator iter;
00094     iter=max_element(localEnergies.begin(), localEnergies.end());
00095     float maxEnergy=*iter;
00096         
00097     //checking that maxEnergy is not zero - doing nothing otherwise
00098     if (maxEnergy==0) 
00099     {
00100         std::cout << "Cannot resize by maximum energy - maximum energy of this RecHit collection is zero" << std::endl;
00101         return;
00102     }
00103         
00104     for (unsigned int i=0; i<localEnergies.size() ; i++) localEnergies[i] = localEnergies[i] * maxEt / maxEnergy;
00105 
00106 }

void scaleEnergies ( std::vector< float > &  localEnergies,
std::vector< float > &  negativeEnergies,
const float &  scaleFactor 
)

Definition at line 60 of file IgSoRectHist.cc.

References i.

Referenced by IgSoRectHist::refresh().

00063 {
00064     for (unsigned int i=0; i<localEnergies.size(); i++) 
00065     {
00066         if (localEnergies[i]!=0) localEnergies[i]=localEnergies[i]*scaleFactor;
00067         if (negativeEnergies[i]!=0) negativeEnergies[i]=negativeEnergies[i]*scaleFactor;
00068     }
00069 }

SO_KIT_SOURCE ( IgSoRectHist   ) 


Generated on Tue Jun 9 17:54:15 2009 for CMSSW by  doxygen 1.5.4