CMS 3D CMS Logo

Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes

EcalShowerContainmentCorrections Class Reference

#include <src/CondFormats/interface/EcalShowerContainmentCorrections.h>

List of all members.

Classes

struct  Coefficients
 Structure defining the container for correction coefficients. More...

Public Member Functions

const double correction3x3 (const EBDetId &xtal, const math::XYZPoint &pos) const
 The correction factor for 3x3 matrix.
const double correction5x5 (const EBDetId &xtal, const math::XYZPoint &pos) const
 The correction factor for 5x5 matrix.
const Coefficients correctionCoefficients (const EBDetId &centerxtal) const
 Get the correction coefficients for the given xtal.
void fillCorrectionCoefficients (const int supermodule, const int module, const Coefficients &coefficients)
 Fill the correction coefficients for a given Ecal module.
void fillCorrectionCoefficients (const EBDetId &xtal, int group, const Coefficients &coefficients)
 Fill the correction coefficients for a given xtal, part of group .

Private Types

enum  Direction { eX, eY }
typedef std::map< EBDetId, int > GroupMap
enum  Type { e3x3, e5x5 }

Private Member Functions

const double correctionXY (const EBDetId &xtal, double position, Direction dir, Type type) const

Private Attributes

std::vector< Coefficientscoefficients_
 Holds the coeffiecients. The index corresponds to the group.
GroupMap groupmap_
 Maps in which group a particular xtal has been placed.

Detailed Description

Description: Holds the coefficients of a polynomial that describes the shower containment.

Usage example(for real code see CalibCalorimetry/EcalCorrectionModules/test) :

 ESHandle<EcalShowerContainmentCorrections> pGapCorr;
 iESetup.get<EcalShowerContainmentCorrectionsRcd>().get(pGapCorr);
  
 PositionCalc pos(...);
 
 Hep3Vector clusterPos= pos.CalculatePos(...);        
 math::XYZPoint mathpoint(clusterPos.x(),clusterPos.y(),clusterPos.z());
 
 double correction3x3 = pGapCorr->correction3x3(centerXtal,mathpoint);
 double correction5x5 = pGapCorr->correction5x5(centerXtal,mathpoint);
Author:
Stefano Argiro'
Date:
Fri Mar 2 16:50:49 CET 2007
Id:
EcalShowerContainmentCorrections.h,v 1.2 2007/07/16 17:30:53 meridian Exp

Definition at line 44 of file EcalShowerContainmentCorrections.h.


Member Typedef Documentation

typedef std::map<EBDetId,int> EcalShowerContainmentCorrections::GroupMap [private]

Definition at line 136 of file EcalShowerContainmentCorrections.h.


Member Enumeration Documentation

Enumerator:
eX 
eY 

Definition at line 126 of file EcalShowerContainmentCorrections.h.

{eX,eY};
Enumerator:
e3x3 
e5x5 

Definition at line 127 of file EcalShowerContainmentCorrections.h.


Member Function Documentation

const double EcalShowerContainmentCorrections::correction3x3 ( const EBDetId xtal,
const math::XYZPoint pos 
) const

The correction factor for 3x3 matrix.

Parameters:
posis the distance in cm from the center of the xtal as calculated in RecoEcal/EgammaCoreTools/interface/PositionCalc.h The valid return value is in the range (0,1] (divide by this value to apply the correction) Returns -1 if correction is not avaiable for that xtal

Definition at line 100 of file EcalShowerContainmentCorrections.cc.

References correctionXY(), e3x3, eX, eY, x, and detailsBasic3DVector::y.

                                                                             {
    
  double x= pos.X()*10; // correction functions use mm
  double y= pos.Y()*10;

  double corrx = correctionXY(xtal,x,eX,e3x3);
  double corry = correctionXY(xtal,y,eY,e3x3);
  
  return corrx*corry;
}
const double EcalShowerContainmentCorrections::correction5x5 ( const EBDetId xtal,
const math::XYZPoint pos 
) const

The correction factor for 5x5 matrix.

Parameters:
posis the distance in cm from the center of the xtal as calculated in RecoEcal/EgammaCoreTools/interface/PositionCalc.h The return value is in the range (0,1] (divide by this value to apply the correction) Returns -1 if correction is not avaiable for that xtal

Definition at line 116 of file EcalShowerContainmentCorrections.cc.

References correctionXY(), e5x5, eX, eY, x, and detailsBasic3DVector::y.

                                                                             {
    
  double x= pos.X()*10; // correction functions use mm
  double y= pos.Y()*10;

  double corrx = correctionXY(xtal,x,eX,e5x5);
  double corry = correctionXY(xtal,y,eY,e5x5);
  
  return corrx*corry;
}
const EcalShowerContainmentCorrections::Coefficients EcalShowerContainmentCorrections::correctionCoefficients ( const EBDetId centerxtal) const

Get the correction coefficients for the given xtal.

Return zero coefficients in case the correction is not available for that xtal

Definition at line 12 of file EcalShowerContainmentCorrections.cc.

References coefficients_, groupmap_, and DetId::rawId().

{
  GroupMap::const_iterator iter = groupmap_.find(centerxtal.rawId());

  if (iter!=groupmap_.end()) {
    int group =iter->second;
    return coefficients_[group-1];
  }

  edm::LogError("ShowerContaiment Correction not found");
  return Coefficients();

}
const double EcalShowerContainmentCorrections::correctionXY ( const EBDetId xtal,
double  position,
EcalShowerContainmentCorrections::Direction  dir,
EcalShowerContainmentCorrections::Type  type 
) const [private]

Calculate the correction for the given direction and type

Definition at line 70 of file EcalShowerContainmentCorrections.cc.

References coefficients_, corr, EcalShowerContainmentCorrections::Coefficients::data, e5x5, eY, groupmap_, i, EcalShowerContainmentCorrections::Coefficients::kPolynomialDegree, evf::evtn::offset(), and funct::pow().

Referenced by correction3x3(), and correction5x5().

                                       {
  
  GroupMap::const_iterator iter=groupmap_.find(xtal);
  if (iter==groupmap_.end()) return -1;

  int group=iter->second;
  EcalShowerContainmentCorrections::Coefficients coeff=coefficients_[group-1];

  int offset=0;
  
  if (dir==eY)    offset+=  2* Coefficients::kPolynomialDegree;
  if (position<0) offset+=     Coefficients::kPolynomialDegree;
  if (type==e5x5) offset+=  4* Coefficients::kPolynomialDegree;

  double corr=0;

  for (  int i=offset; 
         i<offset+Coefficients::kPolynomialDegree; 
         ++i){  
    corr+= coeff.data[i] * pow( position ,i-offset) ;    
  }

  return corr;  
}
void EcalShowerContainmentCorrections::fillCorrectionCoefficients ( const EBDetId xtal,
int  group,
const Coefficients coefficients 
)

Fill the correction coefficients for a given xtal, part of group .

Do not replace if xtal is already there

Definition at line 28 of file EcalShowerContainmentCorrections.cc.

References coefficients_, and groupmap_.

Referenced by fillCorrectionCoefficients().

                                                                                                                            {

  // do not replace if we already have the xtal
  if (groupmap_.find(xtal)!=groupmap_.end()) return;
  groupmap_[xtal]=group;


  if (coefficients_.size()<(unsigned int)(group)) {
    coefficients_.resize(group);
    coefficients_[group-1]=coefficients;
  }

  // we don't need to fill coefficients if the group has already been inserted


}
void EcalShowerContainmentCorrections::fillCorrectionCoefficients ( const int  supermodule,
const int  module,
const Coefficients coefficients 
)

Fill the correction coefficients for a given Ecal module.

Assume that corresponding modules in different supermodules use the same coefficients

Definition at line 47 of file EcalShowerContainmentCorrections.cc.

References cond::rpcobgas::detid, fillCorrectionCoefficients(), EBDetId::kModulesPerSM, and EBDetId::SMCRYSTALMODE.

                                                                              {


  if (module>EBDetId::kModulesPerSM) {
    edm::LogError("Invalid Module Number");
    return;
  }


  // what is EBDetID::kModuleBoundaries ? we better redefine them here ...
  const int kModuleLow[]={1,501,901,1301};
  const int kModuleHigh[]={500,900,1300,1700};

  for (int xtal =kModuleLow[module-1] ; xtal <= kModuleHigh[module-1];++xtal){
    EBDetId detid(supermodule,xtal,EBDetId::SMCRYSTALMODE);
    fillCorrectionCoefficients(detid,module,coefficients);
  }
  
}

Member Data Documentation

Holds the coeffiecients. The index corresponds to the group.

Definition at line 143 of file EcalShowerContainmentCorrections.h.

Referenced by correctionCoefficients(), correctionXY(), and fillCorrectionCoefficients().

Maps in which group a particular xtal has been placed.

Definition at line 139 of file EcalShowerContainmentCorrections.h.

Referenced by correctionCoefficients(), correctionXY(), and fillCorrectionCoefficients().