// ----------------------------------------------------------------------------
// $Id: LCDCalHitUtil.cxx,v 1.3 2001/06/21 04:55:38 masako Exp $
// ----------------------------------------------------------------------------
//
// $Log: LCDCalHitUtil.cxx,v $
// Revision 1.3  2001/06/21 04:55:38  masako
// Modify bugs on CAL system numbering.
//
// Revision 1.2  2001/06/21 04:02:23  masako
// Necessary modification in GetRcyl.
//
// Revision 1.1  2001/06/21 03:51:06  masako
// File creation. This is to get the energy, Theta, Phi R information
// from digitized CalHit.
//
//
#include "LCDCalHitUtil.h"
//______________________________________________________________________
//                                                                       
// CalHitUtil
//                                                                
// CalHitUtil provides energy, theta, phi and R information 
// from digitized CalHit.

ClassImp(LCDCalHitUtil)

//_________________________________________________________________________
 LCDCalHitUtil::LCDCalHitUtil(){
  m_gp = 0;
}

//_________________________________________________________________________
 LCDCalHitUtil::LCDCalHitUtil(LCDGetParameters* gp){
  m_gp = gp;
}

 void LCDCalHitUtil::SetDetectorParameter(LCDGetParameters* gp){
  m_gp = gp;
}

//_________________________________________________________________________
 Double_t LCDCalHitUtil::GetEscale(LCDCalHit* calhit){
  LCDtowerID* tower = calhit->GetTower();
  Int_t    t_system = tower->GetSystem();
  Double_t E_scale= 0.;
  if     (t_system==10||t_system==11){E_scale = m_gp->GetEMEnergyScale(); } 
  else if(t_system==12||t_system==13){E_scale = m_gp->GetHADEnergyScale();} 
  else if(t_system==14||t_system==15){E_scale = m_gp->GetMUEnergyScale(); } 
  else if(t_system== 5)              {E_scale = m_gp->GetLUMEnergyScale();}  
  return E_scale;
}

//_________________________________________________________________________
 Double_t LCDCalHitUtil::GetThetaSeg(LCDCalHit* calhit){
  LCDtowerID* tower = calhit->GetTower();
  Int_t    t_system = tower->GetSystem();
  Double_t Theta_seg= 0.;
  if     (t_system==10||t_system==11){Theta_seg = m_gp->GetEMThetaSeg(); } 
  else if(t_system==12||t_system==13){Theta_seg = m_gp->GetHADThetaSeg();} 
  else if(t_system==14||t_system==15){Theta_seg = m_gp->GetMUThetaSeg(); } 
  else if(t_system== 5)              {Theta_seg = m_gp->GetLUMThetaSeg();}  
  return Theta_seg;
}

//_________________________________________________________________________
 Double_t LCDCalHitUtil::GetPhiSeg(LCDCalHit* calhit){
  LCDtowerID* tower = calhit->GetTower();
  Int_t    t_system = tower->GetSystem();
  Double_t Phi_seg = 0.;
  if     (t_system==10||t_system==11){Phi_seg = m_gp->GetEMphiSeg(); } 
  else if(t_system==12||t_system==13){Phi_seg = m_gp->GetHADphiSeg();} 
  else if(t_system==14||t_system==15){Phi_seg = m_gp->GetMUphiSeg(); } 
  else if(t_system== 5)              {Phi_seg = m_gp->GetLUMphiSeg();}  
  return Phi_seg;
}

//_________________________________________________________________________
 Double_t LCDCalHitUtil::GetEtot(LCDCalHit* calhit){
  Double_t E_scale  = GetEscale(calhit);
  return E_scale * calhit->GetEtotRaw();
}

//_________________________________________________________________________
 Double_t LCDCalHitUtil::GetTheta(LCDCalHit* calhit){
  LCDtowerID* tower = calhit->GetTower();
  Double_t Theta_seg = GetThetaSeg(calhit);
  return Theta_seg * (tower->GetTheta() + 0.5); 
}

//_________________________________________________________________________
 Double_t LCDCalHitUtil::GetPhi(LCDCalHit* calhit){
  LCDtowerID* tower = calhit->GetTower();
  Double_t Phi_seg = GetPhiSeg(calhit);
  return Phi_seg * (tower->GetPhi() + 0.5); 
}

//_________________________________________________________________________
 Double_t LCDCalHitUtil::GetR(LCDCalHit* calhit){
  // Get IP to Hit distance. This is not cylindrical R.
  LCDtowerID* tower = calhit->GetTower();
  Int_t endbarrel = tower->GetBarrelEndcap();
  Int_t layer     = tower->GetLayer();
  Double_t   r;  
  Double_t theta  = GetTheta(calhit);
  
  Int_t t_system = tower->GetSystem();
  
  if (endbarrel == 0 ) { // barrel
    Double_t barrelInner = 0.;
    Double_t barrelThick = 0.;
    if       (t_system == 10) { 
      barrelInner = m_gp->GetEMBarrelInnerR(); 
      barrelThick = m_gp->GetEMBarrelThick();
    }else if (t_system == 12) { 
      barrelInner = m_gp->GetHADBarrelInnerR();
      barrelThick = m_gp->GetHADBarrelThick();
    }else if (t_system == 14) { 
      barrelInner = m_gp->GetMUBarrelInnerR(); 
      barrelThick = m_gp->GetMUBarrelThick();
    }
    r = barrelInner + (layer+0.5) * barrelThick;
    return  TMath::Abs( r / TMath::Sin(theta) );

  } else if (endbarrel == 1 ) { // endcap
    Double_t endcapInner = 0.;
    Double_t endcapThick = 0.;
    if       (t_system == 11) { 
      endcapInner = m_gp->GetEMEndcapInnerZ(); 
      endcapThick = m_gp->GetEMEndcapThick();
    }else if (t_system == 13) { 
      endcapInner = m_gp->GetHADEndcapInnerZ();
      endcapThick = m_gp->GetHADEndcapThick();
    }else if (t_system == 15) { 
      endcapInner = m_gp->GetMUEndcapInnerZ(); 
      endcapThick = m_gp->GetMUEndcapThick();
    }else if (t_system == 5)  { 
      endcapInner = m_gp->GetLUMEndcapInnerZ(); 
      endcapThick = m_gp->GetLUMEndcapThick();
    }
    r = endcapInner + (layer+0.5) * endcapThick;
    return  TMath::Abs( r / TMath::Cos(theta) );

  } else {
    printf(" Strange section!! Not barrel, nor endcap. %i n" ,
	   endbarrel );   
    return 0. ;
  }
}

//_________________________________________________________________________
 Double_t LCDCalHitUtil::GetRcyl(LCDCalHit* calhit){
  // This is cylindrical R.
  LCDtowerID* tower = calhit->GetTower();
  Int_t endbarrel = tower->GetBarrelEndcap();
  Int_t layer     = tower->GetLayer();
  Double_t   r;  
  Double_t theta  = GetTheta(calhit);
  
  Int_t t_system = tower->GetSystem();
  
  if (endbarrel == 0 ) { // barrel
    Double_t barrelInner = 0.;
    Double_t barrelThick = 0.;
    if       (t_system == 10) { 
      barrelInner = m_gp->GetEMBarrelInnerR(); 
      barrelThick = m_gp->GetEMBarrelThick();
    }else if (t_system == 12) { 
      barrelInner = m_gp->GetHADBarrelInnerR();
      barrelThick = m_gp->GetHADBarrelThick();
    }else if (t_system == 14) { 
      barrelInner = m_gp->GetMUBarrelInnerR(); 
      barrelThick = m_gp->GetMUBarrelThick();
    }
    r = barrelInner + (layer+0.5) * barrelThick;
    return r;

  } else if (endbarrel == 1 ) { // endcap
    Double_t endcapInner = 0.;
    Double_t endcapThick = 0.;
    if       (t_system == 11) { 
      endcapInner = m_gp->GetEMEndcapInnerZ(); 
      endcapThick = m_gp->GetEMEndcapThick();
    }else if (t_system == 13) { 
      endcapInner = m_gp->GetHADEndcapInnerZ();
      endcapThick = m_gp->GetHADEndcapThick();
    }else if (t_system == 15) { 
      endcapInner = m_gp->GetMUEndcapInnerZ(); 
      endcapThick = m_gp->GetMUEndcapThick();
    }else if (t_system == 5) { 
      endcapInner = m_gp->GetLUMEndcapInnerZ(); 
      endcapThick = m_gp->GetLUMEndcapThick();
    }
    r = endcapInner + (layer+0.5) * endcapThick;
    return  TMath::Abs( r * TMath::Tan(theta) );

  } else {
    printf(" Strange section!! Not barrel, nor endcap. %i n" ,
	   endbarrel );   
    return 0. ;
  }
}

//_________________________________________________________________________






ROOT page - Class index - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.