CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2_patch1/src/SimGeneral/GFlash/src/GflashNameSpace.cc

Go to the documentation of this file.
00001 #include "SimGeneral/GFlash/interface/GflashNameSpace.h"
00002 
00003 namespace Gflash {
00004 
00005 //beginning of the Gflash name space
00006 
00007 CalorimeterNumber getCalorimeterNumber(const Gflash3Vector position)
00008 {
00009   //return the calorimeter number of sensitive detectors (coarse)
00010 
00011   CalorimeterNumber index = kNULL;
00012   double eta = position.getEta();
00013   
00014   //central
00015   if (std::fabs(eta) < EtaMax[kESPM] ) {
00016     double rho = position.getRho();
00017     double rhoBack = rhoBackEB(position); 
00018     if(rho > Gflash::Rmin[kESPM] && rho < rhoBack ) {
00019       index = kESPM;
00020     }
00021     else if(rho > Rmin[kHB] && rho < Rmax[kHB]) {
00022       index = kHB;
00023     }
00024   }
00025   //forward
00026   else if (std::fabs(eta) < EtaMax[kENCA]) {
00027     double z = std::fabs(position.getZ());
00028     double zBack = zBackEE(position);
00029     if( z > Gflash::Zmin[kENCA] && z < zBack ) {
00030       index = kENCA;
00031     }
00032     else if( z > Zmin[kHE] && z < Zmax[kHE] ) {
00033       index = kHE;
00034     }
00035     //HF is not in the standard Gflash implementation yet
00036     //      if( z > Zmin[kHF] && z < Zmax[kHF] ) {
00037     //  index = kHF;
00038     //      }
00039   }
00040   
00041   return index;
00042 }
00043   
00044 int findShowerType(const Gflash3Vector position) 
00045 {
00046   // type of hadron showers subject to the shower starting point (ssp)
00047   // showerType = -1 : default (invalid)
00048   // showerType =  0 : ssp before EBRY (barrel crystal)
00049   // showerType =  1 : ssp inside EBRY
00050   // showerType =  2 : ssp after  EBRY before HB
00051   // showerType =  3 : ssp inside HB
00052   // showerType =  4 : ssp before EFRY (endcap crystal)
00053   // showerType =  5 : ssp inside EFRY
00054   // showerType =  6 : ssp after  EFRY before HE
00055   // showerType =  7 : ssp inside HE
00056 
00057   int showerType = -1;
00058     
00059   //central
00060   double eta = position.getEta();
00061   if (std::fabs(eta) < EtaMax[kESPM]) {
00062     double rho = position.getRho();
00063     double rhoBack = rhoBackEB(position); 
00064     if(rho < Gflash::RFrontCrystalEB) showerType = 0;
00065     else if (rho < rhoBack ) showerType = 1;
00066     else if (rho < Rmin[kHB] ) showerType = 2;
00067     else showerType = 3;
00068   }
00069   //forward
00070   else if (std::fabs(eta) < EtaMax[Gflash::kENCA] ) {
00071     double z = std::fabs(position.getZ());
00072     double zBack = zBackEE(position);
00073     if(z < Gflash::ZFrontCrystalEE ) showerType = 4;
00074     else if (z < zBack ) showerType = 5;
00075     else if (z < Zmin[kHE] ) showerType = 6;
00076     else showerType = 7;
00077   }
00078   
00079   return showerType;
00080 }
00081 
00082 double rhoBackEB(const Gflash3Vector position) 
00083 {
00084   //return (Gflash::RFrontCrystalEB + Gflash::LengthCrystalEB*std::sin(position.getTheta()));
00085   return (Gflash::RFrontCrystalEB + Gflash::LengthCrystalEB );
00086 
00087 }
00088 
00089 double zBackEE(const Gflash3Vector position) 
00090 {
00091   //return (Gflash::ZFrontCrystalEE + Gflash::LengthCrystalEE*std::fabs(std::cos(position.getTheta())));
00092   return (Gflash::ZFrontCrystalEE + Gflash::LengthCrystalEE);
00093 }
00094 
00095 //end of the Gflash name space
00096 }
00097