Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

PisaHALL.C

Go to the documentation of this file.
00001 #include "PisaHALL.h"
00002 
00003 #include <cassert>
00004 #include <string>
00005 #include <sstream>
00006 
00007 #include "TGeoManager.h"
00008 #include "TGeoMaterial.h"
00009 #include "TGeoMatrix.h"
00010 #include "TGeoMedium.h"
00011 #include "TGeoPcon.h"
00012 #include "TVirtualMC.h"
00013 
00014 #include "PHCompositeNode.h"
00015 #include "PisaPhnxPar.h"
00016 #include "PisaHelper.h"
00017 #include "PisaServer.h"
00018 
00019 //_____________________________________________________________________________
00020 PisaHALL::~PisaHALL()
00021 {
00022 }
00023 
00024 //_____________________________________________________________________________
00025 void
00026 PisaHALL::createMaterials(PHCompositeNode*)
00027 {
00028   TGeoManager* gm = PisaHelper::getGeoManager();
00029 
00030   Double_t a2[2] = { 14.01, 16.00};
00031   Double_t z2[2] = {  7.0,   8.0};
00032   Double_t w2[2] = {  0.7,   0.3};
00033   Double_t density = 1.29e-03;  
00034   int imatair = 15;
00035 
00036   gm->Mixture("Air", a2, z2, density, 2, w2, imatair);
00037 
00038   int isvol = 0; // not a sensitive volume
00039   Int_t ifield = 2;          // User defined magnetic field
00040   Double_t fieldm = 5.;     // Maximum field value (in kiloGauss)
00041   Double_t epsil  = .001;    // Tracking precision, 
00042   Double_t stemax = -0.01;   // Maximum displacement for multiple scat 
00043   Double_t tmaxfd = -20.;    // Maximum angle due to field deflection 
00044   Double_t deemax = -.3;     // Maximum fractional energy loss, DLS 
00045   Double_t stmin  = -.8;
00046 
00047   fImedAIRF = 1;
00048   fImedAIRLOWF = 2;
00049 
00050   // AIR, High Magnetic Field
00051   gm->Medium("AIRF",fImedAIRF,imatair,isvol,
00052              ifield, fieldm, tmaxfd, stemax, 
00053              deemax, epsil, stmin);
00054                                      
00055  
00056   // AIR, Low Magnetic Field
00057   fieldm = 1.0;
00058   gm->Medium("AIRLOWF",fImedAIRLOWF,imatair,isvol,
00059              ifield, fieldm, tmaxfd, stemax, 
00060              deemax, epsil, stmin);
00061 
00062 }
00063 
00064 //_____________________________________________________________________________
00065 void
00066 PisaHALL::createGeometry(PHCompositeNode* topNode)
00067 {
00068   assert(gMC->IsRootGeometrySupported()==true);
00069                                 
00070   PisaPhnxPar* parameters = PisaHelper::getClass<PisaPhnxPar>(topNode,"PHNXPAR");
00071   assert(parameters!=0);
00072 
00073   TGeoManager* gm = PisaHelper::getGeoManager();
00074 
00075   TGeoMedium* mairf = gm->GetMedium("AIRF");
00076   assert(mairf!=0);
00077   TGeoMedium* mairlowf = gm->GetMedium("AIRLOWF");
00078   assert(mairlowf!=0);
00079 
00080   const PisaPhnxSubPar* hall_par = parameters->get("hall_par");
00081   assert(hall_par!=0);
00082  
00083   double dx = hall_par->getDouble("dim",0);
00084   double dy = hall_par->getDouble("dim",1);
00085   double dz = hall_par->getDouble("dim",2);
00086 
00087   TGeoVolume* hall = gm->MakeBox("HALL",mairf,dx,dy,dz);
00088   
00089   PisaServer* ps = PisaServer::instance();
00090 
00091   if ( ps->hasSubsystem("MVD") )
00092     {
00093       const PisaPhnxSubPar* vert_par = parameters->get("vert_par");
00094       assert(vert_par!=0);
00095       TGeoVolume* vert = gm->MakeTube("VERT",mairf,
00096                                       vert_par->getDouble("dim",0),
00097                                       vert_par->getDouble("dim",1),
00098                                       vert_par->getDouble("dim",2));
00099 
00100       hall->AddNode(vert,0,new TGeoTranslation
00101                     (vert_par->getDouble("pos",0),
00102                      vert_par->getDouble("pos",1),
00103                      vert_par->getDouble("pos",2)
00104                      ));
00105     }
00106 
00107   if ( ps->hasSubsystem("DC") && hall_par->getInt("arm_shift")==0 )
00108     {
00109       const PisaPhnxSubPar* intr_par = parameters->get("intr_par");
00110       assert(intr_par!=0);
00111       TGeoVolume* intr = gm->MakeTube("INTR",mairf,
00112                                       intr_par->getDouble("dim",0),
00113                                       intr_par->getDouble("dim",1),
00114                                       intr_par->getDouble("dim",2));
00115 
00116       hall->AddNode(intr,0);
00117     }
00118   
00119   // The tracking medium, from PC2 and beyond, is AIR, Low Field
00120 
00121   if ( hall_par->getInt("arm_shift")==0 )
00122     {
00123       // Outer pseudo-volume (region beyond the RICH)
00124       // This is the mother volume for the PC2, TRD, PC3, TOF, and EMCAL
00125       
00126       const PisaPhnxSubPar* emcl_par = parameters->get("emcl_par");
00127       assert(emcl_par!=0);
00128       int nz = emcl_par->getInt("nz"); // number of PCON sections.
00129       TGeoPcon* emcl_shape = new TGeoPcon(emcl_par->getDouble("phi"),
00130                                           emcl_par->getDouble("dphi"),
00131                                           nz);
00132 
00133       for ( int isection = 0; isection < nz; ++isection )
00134         {
00135           std::ostringstream tmp;
00136 
00137           tmp << "section" << isection;
00138 
00139           std::string section = tmp.str();
00140 
00141           emcl_shape->DefineSection(isection,
00142                                      emcl_par->getDouble(section.c_str(),0),
00143                                      emcl_par->getDouble(section.c_str(),1),
00144                                      emcl_par->getDouble(section.c_str(),2));
00145         }
00146 
00147       TGeoVolume* emcl = new TGeoVolume("EMCL",emcl_shape,mairlowf);
00148 
00149       hall->AddNode(emcl,0);
00150     }
00151 }