MyDetector.cxx

Go to the documentation of this file.
00001 // Author: Bertrand Bellenot   22/08/02
00002 
00003 /*************************************************************************
00004  * Copyright (C) 1995-2002, Bertrand Bellenot.                           *
00005  * All rights reserved.                                                  *
00006  *                                                                       *
00007  * For the licensing terms see the LICENSE file.                         *
00008  *************************************************************************/
00009 
00010 #include <stdlib.h>
00011 #include "TROOT.h"
00012 #include "TMath.h"
00013 
00014 #ifndef MYDETECTOR_H
00015 #include "MyDetector.h"
00016 #endif
00017 
00018 //______________________________________________________________________________
00019 //
00020 // MyDetector class implementation
00021 //______________________________________________________________________________
00022 
00023 
00024 ClassImp(MyDetector)
00025 
00026 //______________________________________________________________________________
00027 MyDetector::MyDetector() 
00028 {
00029    // Default constructor.
00030 }
00031 
00032 //______________________________________________________________________________
00033 MyDetector::~MyDetector() 
00034 {
00035    // Destructor.
00036 }
00037 
00038 //______________________________________________________________________________
00039 void MyDetector::Init()
00040 {
00041    // Initialize detector with material and dimensions
00042 
00043    Int_t           i;
00044    Double_t        x;
00045    TGeoMaterial    *material;
00046    TGeoMaterial    *iron;
00047    TGeoMaterial    *lead;
00048    TGeoMaterial    *polystyrene;
00049    TGeoMaterial    *bgo;
00050    TGeoMaterial    *csi;
00051    TGeoMaterial    *nai;
00052    TGeoMaterial    *al;
00053    TGeoMedium      *scintillator[4];
00054    TGeoMedium      *discriminator;
00055    TGeoMedium      *calorimeter;
00056    TGeoVolume      *volume[7];
00057    TGeoTranslation *trans[6];
00058 
00059    fTotalELoss = 0.0;
00060    fDimX = 40.0;
00061    fDimY = 62.0;
00062    fDimZ = 40.0;
00063    fMaxX = fDimX / 2.;
00064    fMinX = -fMaxX;
00065 
00066    fMinY = 0.0;
00067    fMaxY = fDimY+fMinY;
00068 
00069    fMaxZ = fDimZ / 2.;
00070    fMinZ = -fMaxZ;
00071 
00072    new TGeoManager("MyDetector", "MyDetector");
00073 
00074    trans[0] = new TGeoTranslation(0., 2., 0.);
00075    trans[1] = new TGeoTranslation(0., 5.0, 0.);
00076    trans[2] = new TGeoTranslation(0., 8.0, 0.);
00077    trans[3] = new TGeoTranslation(0., 12.0, 0.);
00078    trans[4] = new TGeoTranslation(0., 36.0, 0.);
00079    trans[5] = new TGeoTranslation(0., 60.0, 0.);
00080 
00081    iron = new TGeoMaterial("Iron",55.85f,26,7.87f,1.76f,16.7598f);
00082    lead = new TGeoMaterial("Lead",207.2f,82,11.35f,0.56f,17.0925f);
00083    polystyrene = new TGeoMaterial("Polystyrene",13.01f,7,1.032f,42.4f,79.36f);
00084    bgo = new TGeoMaterial("BGO",175.92f,74,7.1f,1.12f,22.11f);
00085    csi = new TGeoMaterial("CsI",129.90f,54,4.53f,1.85f,36.8653f);
00086    nai = new TGeoMaterial("NaI",117.10f,50,3.67f,2.59f,41.1444f);
00087    al = new TGeoMaterial("Al",26.981539f,13,2.7f,8.9f,39.407407f);
00088 
00089    scintillator[0] = new TGeoMedium("SCINT0",1, polystyrene);
00090    discriminator   = new TGeoMedium("DISCR", 2, lead);
00091    scintillator[1] = new TGeoMedium("SCINT1",3, polystyrene);
00092    scintillator[2] = new TGeoMedium("SCINT2",4, polystyrene);
00093    calorimeter     = new TGeoMedium("CALOR", 5, nai);
00094    scintillator[3] = new TGeoMedium("SCINT3",6, polystyrene);
00095     
00096    TGeoMaterial *mat = new TGeoMaterial("VOID");
00097    TGeoMedium *med = new TGeoMedium("MED", 0, mat);
00098    volume[0] = gGeoManager->MakeBox("TOP", med, 40, 62, 40);
00099    volume[0]->SetVisibility(kFALSE);
00100    gGeoManager->SetTopVolume(volume[0]);
00101     
00102    volume[1] = gGeoManager->MakeBox("BOX0",scintillator[0], 20.0,2.00,20.0);
00103    volume[1]->SetLineColor(7);
00104    volume[1]->SetTransparency(50);
00105    volume[1]->SetLineWidth(1);
00106    volume[0]->AddNode(volume[1],0,trans[0]);
00107 
00108    volume[2] = gGeoManager->MakeBox("BOX1",discriminator, 20.0,1.00,20.0);
00109    volume[2]->SetLineColor(15);
00110    volume[2]->SetTransparency(50);
00111    volume[2]->SetLineWidth(1);
00112    volume[0]->AddNode(volume[2],1,trans[1]);
00113 
00114    volume[3] = gGeoManager->MakeBox("BOX2",scintillator[1], 20.0,2.00,20.0);
00115    volume[3]->SetLineColor(7);
00116    volume[3]->SetTransparency(50);
00117    volume[3]->SetLineWidth(1);
00118    volume[0]->AddNode(volume[3],2,trans[2]);
00119 
00120    volume[4] = gGeoManager->MakeBox("BOX3",scintillator[2], 20.0,2.00,20.0);
00121    volume[4]->SetLineColor(7);
00122    volume[4]->SetTransparency(50);
00123    volume[4]->SetLineWidth(1);
00124    volume[0]->AddNode(volume[4],3,trans[3]);
00125 
00126    volume[5] = gGeoManager->MakeBox("BOX4",calorimeter, 20.0,22.00,20.0);
00127    volume[5]->SetLineColor(38);
00128    volume[5]->SetTransparency(50);
00129    volume[5]->SetLineWidth(1);
00130    volume[0]->AddNode(volume[5],4,trans[4]);
00131 
00132    volume[6] = gGeoManager->MakeBox("BOX5",scintillator[3], 20.0,2.00,20.0);
00133    volume[6]->SetLineColor(7);
00134    volume[6]->SetTransparency(50);
00135    volume[6]->SetLineWidth(1);
00136    volume[0]->AddNode(volume[6],5,trans[5]);
00137 
00138    gGeoManager->CloseGeometry();
00139 
00140    for (i=0;i<6;i++) {
00141       material = volume[i+1]->GetMaterial();
00142       // Ionisation constant in MeV/cm
00143       fI[i] = 16.0e-06 * (TMath::Power(material->GetZ(),0.9));
00144       fI[i] *= 1.0e-03; // in GeV/cm...
00145 
00146       // first factor in the Bethe-Bloch equation in MeV/cm
00147       fPreconst[i] = 0.3071 * material->GetDensity() * 
00148                      (material->GetZ() / material->GetA());
00149       fPreconst[i] *= 1.0e-03; // in GeV/cm...
00150     
00151       // Critical Energy in MeV
00152       fEc[i] = 800.0 / (material->GetZ() + 1.2);
00153       fEc[i] *= 1.0e-03; // in GeV...
00154 
00155       // Radiation Length in cm
00156       fX0[i] = material->GetRadLen();
00157 
00158       // Time step dT in ms about 0.015 times X_0/c
00159       fdT[i] = 0.005 * (fX0[i] / CSpeed);
00160 
00161       // Scatter angle 
00162       x = fdT[i] * CSpeed;
00163       fTheta0[i] = TMath::Sqrt(2.0) * 13.6 * TMath::Sqrt(x / fX0[i]) * 
00164                    (1.0 + 0.038 * TMath::Log(x / fX0[i]));
00165       fTheta0[i] *= 1.0e-03; 
00166    }
00167 }
00168 

Generated on Tue Jul 5 15:15:11 2011 for ROOT_528-00b_version by  doxygen 1.5.1