CMS 3D CMS Logo

Public Member Functions | Private Attributes

HcalTB02HcalNumberingScheme Class Reference

#include <SimG4CMS/HcalTestBeam/interface/HcalTB02HcalNumberingScheme.h>

Inheritance diagram for HcalTB02HcalNumberingScheme:
HcalTB02NumberingScheme

List of all members.

Public Member Functions

int getetaID (int sID) const
int getetaScaleF () const
int getlayerID (int sID) const
int getphiID (int sID) const
int getphiScaleF () const
virtual int getUnitID (const G4Step *aStep) const
 HcalTB02HcalNumberingScheme ()
virtual ~HcalTB02HcalNumberingScheme ()

Private Attributes

int etaScale
int phiScale

Detailed Description

Description: Numbering scheme for hadron calorimeter in 2002 test beam

Usage: Sets up unique identifier for HB towers in 2002 test beam

Definition at line 25 of file HcalTB02HcalNumberingScheme.h.


Constructor & Destructor Documentation

HcalTB02HcalNumberingScheme::HcalTB02HcalNumberingScheme ( )

Definition at line 26 of file HcalTB02HcalNumberingScheme.cc.

                                                         : 
  HcalTB02NumberingScheme(), phiScale(1000000), etaScale(10000) {
  edm::LogInfo("HcalTBSim") << "Creating HcalTB02HcalNumberingScheme";
}
HcalTB02HcalNumberingScheme::~HcalTB02HcalNumberingScheme ( ) [virtual]

Definition at line 31 of file HcalTB02HcalNumberingScheme.cc.

                                                          {
  edm::LogInfo("HcalTBSim") << "Deleting HcalTB02HcalNumberingScheme";
}

Member Function Documentation

int HcalTB02HcalNumberingScheme::getetaID ( int  sID) const

Definition at line 106 of file HcalTB02HcalNumberingScheme.cc.

References abs, printConversionInfo::aux, etaScale, LogDebug, and phiScale.

Referenced by HcalTB02Analysis::update().

                                                       {

  sID = abs(sID);
  int aux = sID - int(float(sID)/float(phiScale))*phiScale;
  int etaID = int(float(aux)/float(etaScale));

  LogDebug("HcalTBSim") << "HcalTB02HcalNumberingScheme:: scintID " << sID
                        << " eta = " << etaID;
  return etaID;

}    
int HcalTB02HcalNumberingScheme::getetaScaleF ( ) const [inline]

Definition at line 33 of file HcalTB02HcalNumberingScheme.h.

References etaScale.

{ return etaScale;}
int HcalTB02HcalNumberingScheme::getlayerID ( int  sID) const

Definition at line 78 of file HcalTB02HcalNumberingScheme.cc.

References abs, etaScale, and LogDebug.

Referenced by HcalTB02Analysis::update().

                                                         {

  sID = abs(sID);
  int layerID = sID;
  if ( (layerID != 17) && (layerID != 18) )
    layerID = sID - int(float(sID)/float(etaScale))*etaScale;

  LogDebug("HcalTBSim") << "HcalTB02HcalNumberingScheme:: scintID " << sID 
                        << " layer = " << layerID;
  return layerID;
}      
int HcalTB02HcalNumberingScheme::getphiID ( int  sID) const

Definition at line 90 of file HcalTB02HcalNumberingScheme.cc.

References abs, LogDebug, and phiScale.

Referenced by HcalTB02Analysis::update().

                                                       {

  float IDsign = 1.;
  if (sID<0) IDsign = -1;
  sID = abs(sID);
  int phiID = int(float(sID)/float(phiScale));
  LogDebug("HcalTBSim") << "HcalTB02HcalNumberingScheme:: scintID " << sID 
                        << " phi = " << phiID;
  if (IDsign>0) {
    phiID += 4;
  } else {
    phiID = abs(phiID-3);
  }
  return phiID;
}      
int HcalTB02HcalNumberingScheme::getphiScaleF ( ) const [inline]

Definition at line 32 of file HcalTB02HcalNumberingScheme.h.

References phiScale.

{ return phiScale;}
int HcalTB02HcalNumberingScheme::getUnitID ( const G4Step *  aStep) const [virtual]

Implements HcalTB02NumberingScheme.

Definition at line 39 of file HcalTB02HcalNumberingScheme.cc.

References eta(), etaScale, funct::log(), LogDebug, m, max(), min, phi, phiScale, funct::pow(), funct::sin(), mathSSE::sqrt(), and funct::tan().

                                                                    {

  int scintID = 0;

  G4StepPoint* preStepPoint = aStep->GetPreStepPoint(); 
  G4ThreeVector    hitPoint = preStepPoint->GetPosition();
  float hx = hitPoint.x();
  float hy = hitPoint.y();
  float hz = hitPoint.z();
  float hr = std::sqrt( pow(hx,2)+pow(hy,2) );

  // Check if hit happened in first HO layer or second.

  if ( (hr > 3.*m) && (hr < 3.830*m) ) return scintID=17;
  if (hr > 3.830*m)                    return scintID=18;

  // Compute the scintID in the HB.

  float hR = hitPoint.mag();//sqrt( pow(hx,2)+pow(hy,2)+pow(hz,2) );
  float htheta =  (hR == 0. ? 0. : acos(max(min(hz/hR,float(1.)),float(-1.))));
  float hsintheta = sin(htheta);
  float hphi = (hR*hsintheta == 0. ? 0. :acos( max(min(hx/(hR*hsintheta),float(1.)),float(-1.)) ) );
  float heta = ( fabs(hsintheta) == 1.? 0. : -log(fabs(tan(htheta/2.))) );
  int eta = int(heta/0.087);
  int phi = int(hphi/(5.*degree));

  G4VPhysicalVolume*  thePV = preStepPoint->GetPhysicalVolume();
  int ilayer = ((thePV->GetCopyNo())/10)%100;
  LogDebug("HcalTBSim") << "HcalTB02HcalNumberingScheme:: Layer " 
                        << thePV->GetName() << " found at phi = " << phi
                        << " eta = " << eta << " lay = " << thePV->GetCopyNo()
                        << " " << ilayer;

  scintID = phiScale*phi + etaScale*eta + ilayer;
  if (hy<0.) scintID = -scintID;

  return scintID;
}

Member Data Documentation

Definition at line 42 of file HcalTB02HcalNumberingScheme.h.

Referenced by getetaID(), getetaScaleF(), getlayerID(), and getUnitID().

Definition at line 41 of file HcalTB02HcalNumberingScheme.h.

Referenced by getetaID(), getphiID(), getphiScaleF(), and getUnitID().