ExtBesCrystalParameterisation Class Reference

#include <ExtBesCrystalParameterisation.h>

List of all members.

Public Member Functions

 ExtBesCrystalParameterisation (const G4int, const G4int, const G4int, ExtBesEmcGeometry *, const G4int)
virtual ~ExtBesCrystalParameterisation ()
void ComputeTransformation (const G4int, G4VPhysicalVolume *) const
void ComputeDimensions (G4Trap &, const G4int, const G4VPhysicalVolume *) const
G4Material * ComputeMaterial (const G4int, G4VPhysicalVolume *)
G4VSolid * ComputeSolid (const G4int, G4VPhysicalVolume *)
void ComputeIDAndSide (const G4VPhysicalVolume *) const
void SetVerboseLevel (G4int val)

Private Attributes

G4int fCrystalID
G4int fVerboseLevel
G4int fStartID
G4int fAllCrystals
G4bool fFlagLeft
ExtBesEmcGeometryfBesEmcGeometry


Detailed Description

Definition at line 23 of file ExtBesCrystalParameterisation.h.


Constructor & Destructor Documentation

ExtBesCrystalParameterisation::ExtBesCrystalParameterisation ( const   G4int,
const   G4int,
const   G4int,
ExtBesEmcGeometry ,
const   G4int 
)

Definition at line 23 of file ExtBesCrystalParameterisation.cxx.

References fAllCrystals, fBesEmcGeometry, fCrystalID, fFlagLeft, fStartID, and fVerboseLevel.

00029          :fVerboseLevel(0)
00030 {
00031   //for debug
00032   //G4Exception("ExtBesCrystalParameterisation::ExtBesCrystalParameterisation() starting........");
00033   fBesEmcGeometry   =  besEMCGeometry;
00034   fVerboseLevel     =  verboseLevel; //if need to debug this class,open it
00035   fStartID          =  startID;
00036   fAllCrystals      =  thetaAllCrystals;
00037   fCrystalID        =  0;
00038   fFlagLeft         =  true;
00039   if (startID>endID||endID>thetaAllCrystals||startID<1)
00040     {
00041       G4Exception("ExtBesCrystalParameterisation construction: ID of crystal>No avaible!");
00042     }
00043 
00044 }

ExtBesCrystalParameterisation::~ExtBesCrystalParameterisation (  )  [virtual]

Definition at line 48 of file ExtBesCrystalParameterisation.cxx.

00049 {}


Member Function Documentation

void ExtBesCrystalParameterisation::ComputeDimensions ( G4Trap &  ,
const   G4int,
const G4VPhysicalVolume *   
) const

Definition at line 111 of file ExtBesCrystalParameterisation.cxx.

00113 {
00114   //for debug
00115   //G4Exception("ExtBesCrystalParameterisation::ComputeDimensions() starting........");
00116   ComputeIDAndSide(physVol);
00117 
00118   G4double zHalfLength  = fBesEmcGeometry->GetZHalfLength(fCrystalID);
00119   G4double thetaAxis    = fBesEmcGeometry->GetThetaAxis(fCrystalID);
00120   G4double phiAxis      = fBesEmcGeometry->GetPhiAxis(fCrystalID);
00121   G4double yHalfLength1 = fBesEmcGeometry->GetYHalfLength1(fCrystalID);
00122   G4double xHalfLength1 = fBesEmcGeometry->GetXHalfLength1(fCrystalID);
00123   G4double xHalfLength2 = fBesEmcGeometry->GetXHalfLength2(fCrystalID);
00124   G4double tanAlpha1    = fBesEmcGeometry->GetTanAlpha1(fCrystalID);
00125   G4double yHalfLength2 = fBesEmcGeometry->GetYHalfLength2(fCrystalID);
00126   G4double xHalfLength3 = fBesEmcGeometry->GetXHalfLength3(fCrystalID);
00127   G4double xHalfLength4 = fBesEmcGeometry->GetXHalfLength4(fCrystalID);
00128   G4double tanAlpha2    = fBesEmcGeometry->GetTanAlpha2(fCrystalID);
00129 
00130   if(!fFlagLeft)
00131     {
00132       phiAxis=-phiAxis;
00133       tanAlpha1=-tanAlpha1;
00134       tanAlpha2=-tanAlpha2;
00135       G4double tmp;
00136       tmp=xHalfLength1;
00137       xHalfLength1=xHalfLength2;
00138       xHalfLength2=tmp;
00139       tmp=xHalfLength3;
00140       xHalfLength3=xHalfLength4;
00141       xHalfLength4=tmp;
00142     }
00143   if(fVerboseLevel>5)
00144     G4cout << "The size of No." << copyNo << " crystal(placed) are:" << G4endl
00145            << "zHalfLength =" << zHalfLength/cm  << "(cm), "     << G4endl
00146            << "thetaAxis   =" << thetaAxis/deg   << "(degree), " << G4endl
00147            << "phiAxis     =" << phiAxis/deg     << "(degree), " << G4endl
00148            << "yHalfLength1=" << yHalfLength1/cm << "(cm), "     << G4endl
00149            << "xHalfLength1=" << xHalfLength1/cm << "(cm), "     << G4endl
00150            << "xHalfLength2=" << xHalfLength2/cm << "(cm), "     << G4endl
00151            << "tanAlpha1   =" << tanAlpha1       << "(), "       << G4endl
00152            << "yHalfLength2=" << yHalfLength2/cm << "(cm), "     << G4endl
00153            << "xHalfLength3=" << xHalfLength3/cm << "(cm), "     << G4endl
00154            << "xHalfLength4=" << xHalfLength4/cm << "(cm)."      << G4endl
00155            << "tanAlpha2   =" << tanAlpha2       << "(), "       << G4endl
00156            << "(x4-x3)*y1/(x2-x1)/y2="
00157            << (xHalfLength4-xHalfLength3)*yHalfLength1/(xHalfLength2-xHalfLength1)/yHalfLength2 << G4endl
00158            << "tanAlpha2/tanAlpha1=" << tanAlpha2/tanAlpha1 <<G4endl;
00159   //G4cout << fStartID << "-->This is an output sentence for debug." << G4endl;
00160 
00161   trackerChamber.SetAllParameters(
00162                                   zHalfLength,
00163                                   thetaAxis,
00164                                   phiAxis,
00165                                   yHalfLength1,
00166                                   xHalfLength1,
00167                                   xHalfLength2,
00168                                   tanAlpha1,
00169                                   yHalfLength2,
00170                                   xHalfLength3,
00171                                   xHalfLength4,
00172                                   tanAlpha2);
00173 
00174 }

void ExtBesCrystalParameterisation::ComputeIDAndSide ( const G4VPhysicalVolume *   )  const

Definition at line 200 of file ExtBesCrystalParameterisation.cxx.

References fAllCrystals, fBesEmcGeometry, fCrystalID, fFlagLeft, fStartID, fVerboseLevel, ExtBesEmcConstruction::GetBesEmcConstruction(), ExtBesEmcGeometry::GetPhysiBSCCrystal(), ExtBesEmcConstruction::GetVerboseLevel(), and genRecEmupikp::i.

Referenced by ComputeMaterial(), and ComputeSolid().

00202 {
00203   //for debug
00204   //G4Exception("ExtBesCrystalParameterisation::ComputeIDAndSide() starting......");
00205   G4int* pCrystalID=const_cast<G4int*>(&fCrystalID);
00206   G4bool* pFlagLeft=const_cast<G4bool*>(&fFlagLeft);
00207   G4int* pVerboseLevel=const_cast<G4int*>(&fVerboseLevel);
00208   
00209   *pVerboseLevel=
00210     ExtBesEmcConstruction::GetBesEmcConstruction()->GetVerboseLevel();
00211 
00212   //*pCrystalID=pPhyVol->GetMotherPhysical()->GetCopyNo(); 
00213   *pCrystalID=-1;
00214   for(G4int i=fStartID;i<=fAllCrystals;i++)
00215     {
00216       //G4cout << fBesEmcGeometry->GetPhysiBSCCrystal(i) << ".vs."
00217       //     << pPhyVol << G4endl;
00218       if(fBesEmcGeometry->GetPhysiBSCCrystal(i)==pPhyVol)
00219         {
00220           *pCrystalID=i;
00221         }
00222     }
00223   if(*pCrystalID==-1)
00224     G4Exception("The point of PhysicCrystal error!!!!!!!!!!!");
00225  
00226   //*pCrystalID=pPhyVol->GetCopyNo();
00227   //if(fVerboseLevel>6)
00228   //G4cout<<"******ExtBesCrystalParameterisation::ComputeIDAndSide******"<<G4endl
00229   //  <<"point of pPhyVol =" << pPhyVol << G4endl
00230   //  <<"point of mother  =" << pPhyVol->GetMother() << G4endl
00231   //  <<"CopyNo of pPhyVol=" << pPhyVol->GetCopyNo() << G4endl
00232   //  <<"CopyNo of mother =" << pPhyVol->GetMother()->GetCopyNo() << G4endl
00233   //  <<"********************************************************"<<G4endl;
00234   
00235   if(fCrystalID>fAllCrystals/2)
00236     {
00237       *pFlagLeft=false;
00238       *pCrystalID=fCrystalID-fAllCrystals/2;
00239     }
00240   else
00241     {
00242       *pFlagLeft=true;
00243       *pCrystalID=fAllCrystals/2-fCrystalID+1;
00244     }
00245   *pCrystalID=*pCrystalID-1;
00246 }

G4Material * ExtBesCrystalParameterisation::ComputeMaterial ( const   G4int,
G4VPhysicalVolume *   
)

Definition at line 184 of file ExtBesCrystalParameterisation.cxx.

References ComputeIDAndSide(), fBesEmcGeometry, ExtBesEmcConstruction::GetBesEmcConstruction(), ExtBesEmcGeometry::GetBSCNbTheta(), ExtBesEmcConstruction::GetCasingMaterial(), and ExtBesEmcConstruction::GetCrystalMaterial().

00186 {
00187   ComputeIDAndSide(pPhysicalVol);
00188   G4int nBSCTheta=fBesEmcGeometry->GetBSCNbTheta();
00189   //if(fVerboseLevel>5)
00190   //G4cout <<"******ExtBesCrystalParameterisation::ComputeMaterial******"<<G4endl
00191   //   <<"Number of all crystals=" << nBSCTheta << G4endl
00192   //   <<"No of current crystal =" << pPhysicalVol->GetCopyNo() << G4endl
00193   //   <<"*******************************************************"<<G4endl;
00194   if(pPhysicalVol->GetCopyNo()>2*nBSCTheta)
00195     return ExtBesEmcConstruction::GetBesEmcConstruction()->GetCasingMaterial();
00196   else
00197     return ExtBesEmcConstruction::GetBesEmcConstruction()->GetCrystalMaterial();
00198 }

G4VSolid * ExtBesCrystalParameterisation::ComputeSolid ( const   G4int,
G4VPhysicalVolume *   
)

Definition at line 177 of file ExtBesCrystalParameterisation.cxx.

References ComputeIDAndSide().

00179 {
00180   ComputeIDAndSide(pPhysicalVol);
00181   return pPhysicalVol->GetLogicalVolume()->GetSolid();
00182 }

void ExtBesCrystalParameterisation::ComputeTransformation ( const   G4int,
G4VPhysicalVolume *   
) const

Definition at line 54 of file ExtBesCrystalParameterisation.cxx.

References origin.

00055 {
00056   //for debug
00057   //G4Exception("ExtBesCrystalParameterisation::ComputeTransformation() starting........");
00058   ComputeIDAndSide(physVol);
00059 
00060   if(fVerboseLevel>3)
00061     {
00062       G4cout<<"*ExtBesCrystalParameterisation::ComputeTransformation()*"<<G4endl;
00063       G4cout << "copyNo(transfered)=" << copyNo << G4endl
00064              << "copyNo(gotten)    =" << physVol->GetCopyNo() << G4endl
00065              << "fStartID          =" << fStartID << G4endl
00066              << "fCrystalID        =" << fCrystalID << G4endl;
00067       G4cout << "point of fBesEmcGeometry=" << fBesEmcGeometry << G4endl;
00068     }
00069   
00070   G4double xPosition= fBesEmcGeometry->GetXPosition(fCrystalID);
00071   G4double yPosition= fBesEmcGeometry->GetYPosition(fCrystalID);
00072   G4double zPosition= fBesEmcGeometry->GetZPosition(fCrystalID);
00073   //G4Exception("ExtBesCrystalParameterisation::ComputeTransformation() running........");
00074   //G4double xPosition=0,yPosition=0,zPosition=0;
00075   if(fFlagLeft) zPosition=-zPosition;
00076   G4ThreeVector origin(xPosition,yPosition,zPosition);
00077   physVol->SetTranslation(origin);
00078 
00079   //G4double thetaPosition=fBesEmcGeometry->GetThetaPosition(fCrystalID);
00080   //G4RotationMatrix *rotateMatrix;
00081   //rotateMatrix = new G4RotationMatrix();
00082   //if(fFlagLeft)
00083   //  {
00084   //    rotateMatrix->rotateZ(-90*deg);
00085   //    rotateMatrix->rotateX(-180*deg+thetaPosition);
00086   //  }
00087   //else
00088   //  {
00089   //    rotateMatrix->rotateZ(-90*deg);
00090   //    rotateMatrix->rotateX(-thetaPosition);
00091   //  }
00092   //G4double delta = 0*deg;
00093   //G4ThreeVector axis = G4ThreeVector(0,0,0);
00094   //rotateMatrix->getAngleAxis(delta, axis);
00095   if(fVerboseLevel>5)
00096     {
00097     G4cout << "The crystals are at the position:" << G4endl
00098            << origin/cm <<"(cm)" << G4endl;
00099     //G4cout << thetaPosition/deg <<"(deg)." << G4endl
00100     //<< "The axis of crystals in the world system is: " << G4endl
00101     //<< delta/deg << "(deg)(delta) " << G4endl
00102     //<< axis  << "(Z axis)" << G4endl;
00103     }
00104   //physVol->SetRotation(rotateMatrix);
00105   
00106 }

void ExtBesCrystalParameterisation::SetVerboseLevel ( G4int  val  )  [inline]

Definition at line 41 of file ExtBesCrystalParameterisation.h.

References fVerboseLevel.

00041 {fVerboseLevel=val;};


Member Data Documentation

G4int ExtBesCrystalParameterisation::fAllCrystals [private]

Definition at line 46 of file ExtBesCrystalParameterisation.h.

Referenced by ComputeIDAndSide(), and ExtBesCrystalParameterisation().

ExtBesEmcGeometry* ExtBesCrystalParameterisation::fBesEmcGeometry [private]

Definition at line 48 of file ExtBesCrystalParameterisation.h.

Referenced by ComputeIDAndSide(), ComputeMaterial(), and ExtBesCrystalParameterisation().

G4int ExtBesCrystalParameterisation::fCrystalID [private]

Definition at line 41 of file ExtBesCrystalParameterisation.h.

Referenced by ComputeIDAndSide(), and ExtBesCrystalParameterisation().

G4bool ExtBesCrystalParameterisation::fFlagLeft [private]

Definition at line 47 of file ExtBesCrystalParameterisation.h.

Referenced by ComputeIDAndSide(), and ExtBesCrystalParameterisation().

G4int ExtBesCrystalParameterisation::fStartID [private]

Definition at line 45 of file ExtBesCrystalParameterisation.h.

Referenced by ComputeIDAndSide(), and ExtBesCrystalParameterisation().

G4int ExtBesCrystalParameterisation::fVerboseLevel [private]

Definition at line 44 of file ExtBesCrystalParameterisation.h.

Referenced by ComputeIDAndSide(), ExtBesCrystalParameterisation(), and SetVerboseLevel().


Generated on Tue Nov 29 23:19:33 2016 for BOSS_7.0.2 by  doxygen 1.4.7