LCOV - code coverage report
Current view: top level - FIT/FITsim - AliFITv0.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 116 0.9 %
Date: 2016-06-14 17:26:59 Functions: 1 13 7.7 %

          Line data    Source code
       1             : /**************************************************************************
       2             :  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
       3             :  *                                                                        *
       4             :  * Author: The ALICE Off-line Project.                                    *
       5             :  * Contributors are mentioned in the code where appropriate.              *
       6             :  *                                                                        *
       7             :  * Permission to use, copy, modify and distribute this software and its   *
       8             :  * documentation strictly for non-commercial purposes is hereby granted   *
       9             :  * without fee, provided that the above copyright notice appears in all   *
      10             :  * copies and that both the copyright notice and this permission notice   *
      11             :  * appear in the supporting documentation. The authors make no claims     *
      12             :  * about the suitability of this software for any purpose. It is          *
      13             :  * provided "as is" without express or implied warranty.                  *
      14             :  **************************************************************************/
      15             : 
      16             : /* $Id: AliT0v1.cxx 50646 2011-07-18 14:40:16Z alla $ */
      17             : 
      18             : /////////////////////////////////////////////////////////////////////
      19             : //                                                                 //
      20             : // T0 ( T-zero) detector  version 1                             //
      21             : //
      22             : //Begin Html       
      23             : /*
      24             : <img src="gif/AliT0v1Class.gif">
      25             : */
      26             : //End Html
      27             : //                                                                  //
      28             : //                                                                  //
      29             : //////////////////////////////////////////////////////////////////////
      30             : 
      31             : #include <Riostream.h>
      32             : #include <stdlib.h>
      33             : 
      34             : #include "TGeoCompositeShape.h"
      35             : #include "TGeoManager.h"
      36             : #include "TGeoMatrix.h"
      37             : #include "TGeoVolume.h"
      38             : #include "TGeoTube.h"
      39             : #include "TGeoBBox.h"
      40             : #include "TGeoNode.h"
      41             : 
      42             : 
      43             : #include <TGeoGlobalMagField.h>
      44             : #include <TGraph.h>
      45             : #include <TLorentzVector.h>
      46             : #include <TMath.h>
      47             : #include <TVirtualMC.h>
      48             : #include <TString.h>
      49             : 
      50             : #include "AliLog.h"
      51             : #include "AliMagF.h"
      52             : #include "AliRun.h"
      53             : 
      54             : #include "AliFITHits.h"
      55             : #include "AliFITv0.h"
      56             : 
      57             : #include "AliMC.h"
      58             : #include "AliCDBLocal.h"
      59             : #include "AliCDBStorage.h"
      60             : #include "AliCDBManager.h"
      61             : #include "AliCDBEntry.h"
      62             : #include "AliTrackReference.h"
      63             : 
      64           2 : ClassImp(AliFITv0)
      65             : 
      66             : 
      67             : //--------------------------------------------------------------------
      68           0 : AliFITv0::AliFITv0():  AliFIT(),
      69           0 :                      fIdSens1(0)
      70             : 
      71           0 : {
      72             :   //
      73             :   // Standart constructor for T0 Detector version 0
      74           0 : }
      75             : //--------------------------------------------------------------------
      76             : AliFITv0::AliFITv0(const char *name, const char *title):
      77           0 :   AliFIT(name,title),
      78           0 :   fIdSens1(0)
      79           0 : {
      80             :   //
      81             :   // Standart constructor for T0 Detector version 0
      82             :   //
      83           0 :   printf("@@@@@@@@@@@@@@@ AliFITv0::AliFITv0 \n");
      84           0 :   fIshunt = 2; 
      85           0 : }
      86             : //_____________________________________________________________________________
      87             : 
      88             : AliFITv0::~AliFITv0() 
      89           0 : {
      90             :   // desctructor  
      91           0 : }
      92             : 
      93             : //-------------------------------------------------------------------------
      94             : void AliFITv0::CreateGeometry()
      95             : {
      96             :   //
      97             :   // Create the geometry of FIT Detector version 1 full geometry
      98             :   //
      99             :   // begin Html
     100             :   //
     101             : 
     102           0 :   printf("@@@@@@@@@@@ AliFITv0::CreateGeometry\n");
     103           0 :   Int_t *idtmed = fIdtmed->GetArray();
     104             :   /*
     105             :   TGeoMedium* kMedAir = gGeoManager->GetMedium("T0_AIR");
     106             :   TGeoMedium* kMedMCPGlass = gGeoManager->GetMedium("T0_glass");
     107             :   TGeoMedium* kMedOptGlass = gGeoManager->GetMedium("T0_OpticalGlass");
     108             :   TGeoMedium* kMedOptGlassCathode = gGeoManager->GetMedium("T0_OpticalGlassCathode");
     109             :   */
     110             :   Float_t zdetC = 80;
     111             :   Float_t zdetA = 373.;
     112           0 :   Int_t idrotm[999];
     113             :   Double_t x,y,z;
     114           0 :   Float_t pstart[3] = {6, 20 ,2.6};
     115           0 :   Float_t pinstart[3] = {3,3,2.55};
     116           0 :   Float_t  pmcp[3] = {2.95, 2.95, 1.5}; //MCP
     117           0 :   Float_t ptop[3] = {1.324, 1.324, 1.};//cherenkov radiator
     118           0 :   Float_t preg[3] = {1.324, 1.324, 0.05};//photcathode 
     119             :  
     120           0 :   AliMatrix(idrotm[901], 90., 0., 90., 90., 180., 0.);
     121             :   
     122             :   //-------------------------------------------------------------------
     123             :   //  T0 volume 
     124             :   //-------------------------------------------------------------------
     125             :   
     126           0 :   Float_t x1[20] = {9,  9, 15 ,15 , 9,  
     127             :                     3, -3,  3, -3, -9, 
     128             :                     -9, -9, -15, -15, -9, 
     129             :                     -3, 3, -3, 3, 9}; 
     130             :   
     131           0 :   Float_t y1[20] = {3.2, -3.2, 3.2, -3.2, -9.2, 
     132             :                     -9, -9, -15, -15, -9.2,
     133             :                     -3.2, 3.2, -3.2, 3.2, 9.2,
     134             :                     9, 9, 15, 15, 9.2};
     135             :   
     136             :   
     137             :   //mother tube
     138           0 :    TVirtualMC::GetMC()->Gsvolu("0STR","TUBE",idtmed[kAir],pstart,18);
     139           0 :    TVirtualMC::GetMC()->Gspos("0STR",1,"ALIC",0.,0.,-zdetC-pstart[2],idrotm[901],"ONLY");
     140           0 :    TVirtualMC::GetMC()->Gspos("0STR",2,"ALIC",0.,0.,zdetA+pstart[2],0,"ONLY");
     141             :    
     142             :    //T0 interior
     143           0 :    TVirtualMC::GetMC()->Gsvolu("0INS","BOX",idtmed[kAir],pinstart,3);
     144           0 :     z=-pstart[2]+pinstart[2];
     145           0 :    for (Int_t is=0; is<20; is++) {
     146           0 :      TVirtualMC::GetMC()->Gspos ("0INS", is + 1, "0STR", x1[is], y1[is], z, 0, "ONLY");
     147           0 :      TVirtualMC::GetMC()->Gspos ("0INS", is + 21, "0STR", x1[is], y1[is], z, 0, "ONLY");
     148           0 :      printf(" 0INS is %i x %f y %f z %f \n",is, x1[is],y1[is], z);
     149             :    }
     150             :    // 
     151             :   x=y=0;
     152             :   // Entry window (glass)
     153           0 :   TVirtualMC::GetMC()->Gsvolu("0TOP","BOX",idtmed[kAir],ptop,3); //glass
     154           0 :   TVirtualMC::GetMC()->Gsvolu ("0REG", "BOX", idtmed[kSensAir], preg, 3); 
     155           0 :   TVirtualMC::GetMC()->Gsvolu("0MCP","BOX",idtmed[kGlass],pmcp,3); //glass
     156             :   Int_t ntops=0;
     157             :   Float_t xin=0, yin=0;
     158           0 :   for (Int_t ix=0; ix<4; ix++) {
     159           0 :     xin = - pinstart[0] + 0.35 + (ix+0.5)*2*ptop[0] ;
     160           0 :     for (Int_t iy=0; iy<4; iy++) {
     161           0 :       z = - pinstart[2]+ptop[2];
     162           0 :       yin = - pinstart[1] + 0.35 + (iy+0.5)*2*ptop[1];
     163           0 :       ntops++;
     164           0 :       TVirtualMC::GetMC()->Gspos("0TOP",ntops,"0INS",xin,yin,z,0,"ONLY");
     165             :      //   printf(" 0TOP  full x %f y %f z %f \n", xin, yin, z);
     166           0 :       z = -pinstart[2] + 2 * ptop[2] + preg[2];
     167           0 :       TVirtualMC::GetMC()->Gspos ("0REG",ntops, "0INS", xin, yin, z, 0, "ONLY");
     168           0 :       printf(" GEOGEO  %i %i %i %f %f %f %f %f %f", ntops, ix, iy,
     169           0 :              xin,yin,x1[ntops],y1[ntops],x1[ntops]+xin,y1[ntops]+yin);
     170             :     }
     171             :   }
     172             :   
     173             :  // MCP
     174             :  //  TGeoVolume* mcp =  gGeoManager->MakeBox("0MCP",kMedMCPGlass, 2.95, 2.95, 1.5);  
     175           0 :    z=-pinstart[2] + 2*ptop[2] + 2*preg[2] + pmcp[2];
     176           0 :    TVirtualMC::GetMC()->Gspos("0MCP",1,"0INS",0,0,z,0,"ONLY");
     177             :     
     178           0 : }    
     179             : //------------------------------------------------------------------------
     180             : void AliFITv0::AddAlignableVolumes() const
     181             : {
     182             :   //
     183             :   // Create entries for alignable volumes associating the symbolic volume
     184             :   // name with the corresponding volume path. Needs to be syncronized with
     185             :   // eventual changes in the geometry.
     186             :   //
     187           0 :   printf("@@@@@@@@@@@@@@@AliFITv0::AddAlignableVolumes()\n");
     188           0 :   TString volPath;
     189           0 :   TString symName, sn;
     190           0 :   TString vpAalign = "/ALIC_1/0STR_1";
     191           0 :   TString vpCalign = "/ALIC_1/0STR_2";
     192           0 :   for (Int_t imod=0; imod<2; imod++)  {
     193           0 :     if (imod==0) {volPath  = vpCalign; symName="/ALIC_1/0STR_1"; }
     194           0 :     if (imod==1) {volPath  = vpAalign; symName="/ALIC_1/0STR_2"; }
     195             :     
     196           0 :     AliDebug(2,"--------------------------------------------");
     197           0 :     AliDebug(2,Form("volPath=%s\n",volPath.Data()));
     198           0 :     AliDebug(2,Form("symName=%s\n",symName.Data()));
     199           0 :     AliDebug(2,"--------------------------------------------");
     200           0 :     if(!gGeoManager->SetAlignableEntry(symName.Data(),volPath.Data()))
     201           0 :       AliFatal(Form("Alignable entry %s not created. Volume path %s not valid",
     202             : symName.Data(),volPath.Data()));
     203             :   }
     204           0 : }   
     205             : //------------------------------------------------------------------------
     206             : void AliFITv0::CreateMaterials()
     207             : {
     208             : 
     209           0 :   printf("@@@@@@@@@@@@AliFITv0::CreateMaterials\n"); 
     210           0 :    Int_t isxfld   = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Integ();
     211           0 :    Float_t sxmgmx = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Max();
     212             :    //   Float_t a,z,d,radl,absl,buf[1];
     213             :    // Int_t nbuf;
     214             : // AIR
     215             :                                                                                 
     216           0 :    Float_t aAir[4]={12.0107,14.0067,15.9994,39.948};
     217           0 :    Float_t zAir[4]={6.,7.,8.,18.};
     218           0 :    Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827};
     219             :    Float_t dAir = 1.20479E-3;
     220             :    Float_t dAir1 = 1.20479E-11;
     221             :                                                                                
     222             :  // PMT glass SiO2
     223           0 :    Float_t aglass[2]={28.0855,15.9994};
     224           0 :    Float_t zglass[2]={14.,8.};
     225           0 :    Float_t wglass[2]={1.,2.};
     226             :    Float_t dglass=2.65;
     227             : 
     228             :     
     229             : //*** Definition Of avaible T0 materials ***
     230           0 :    AliMixture(1, "Vacuum$", aAir, zAir, dAir1,4,wAir);
     231           0 :    AliMixture(2, "Air$", aAir, zAir, dAir,4,wAir);
     232           0 :    AliMixture( 4, "PMT glass   $",aglass,zglass,dglass,-2,wglass);
     233             :    
     234           0 :    AliMedium(1, "FIT_Air$", 2, 0, isxfld, sxmgmx, 10., .1, 1., .003, .003);
     235           0 :    AliMedium(22, "FIT_AirSens$", 2, 1, isxfld, sxmgmx, 10., .1, 1., .003, .003);
     236           0 :    AliMedium(3, "FIT_Vacuum$", 1, 0, isxfld, sxmgmx, 10., .01, .1, .003, .003);
     237           0 :    AliMedium(6, "Glass$", 4, 1, isxfld, sxmgmx, 10., .01, .1, .003, .003);
     238             :     
     239           0 :    AliDebugClass(1,": ++++++++++++++Medium set++++++++++");
     240             :    
     241             :    
     242           0 : }
     243             : 
     244             : 
     245             : //-------------------------------------------------------------------
     246             : void AliFITv0::Init()
     247             : {
     248             :   // Initialises version 0 of the Forward Multiplicity Detector
     249             :   //
     250           0 :   AliFIT::Init();
     251           0 :   fIdSens1=TVirtualMC::GetMC()->VolId("0REG");
     252             :   
     253           0 :   AliDebug(1,Form("%s: *** FIT version 0 initialized ***\n",ClassName()));
     254           0 : }
     255             : 
     256             : //-------------------------------------------------------------------
     257             : 
     258             : void AliFITv0::StepManager()
     259             : {
     260             :   //
     261             :   // Called for every step in the T0 Detector
     262             :   //
     263           0 :   Int_t id,copy,copy1;
     264             :   static Float_t hits[6];
     265             :   static Int_t vol[3];
     266           0 :   TLorentzVector pos;
     267           0 :   TLorentzVector mom;
     268             :   
     269             :   //   TClonesArray &lhits = *fHits;
     270             :   
     271           0 :   if(!TVirtualMC::GetMC()->IsTrackAlive()) return; // particle has disappeared
     272             :   
     273           0 :   id=TVirtualMC::GetMC()->CurrentVolID(copy);  
     274             :   // Check the sensetive volume
     275           0 :   if(id==fIdSens1 ) { 
     276           0 :     if(TVirtualMC::GetMC()->IsTrackEntering()) {
     277           0 :       TVirtualMC::GetMC()->CurrentVolOffID(1,copy1);
     278           0 :       vol[1] = copy1;
     279           0 :       vol[0]=copy;
     280           0 :       TVirtualMC::GetMC()->TrackPosition(pos);
     281           0 :       hits[0] = pos[0];
     282           0 :       hits[1] = pos[1];
     283           0 :       hits[2] = pos[2];
     284           0 :       if(pos[2]<0) vol[2] = 0;
     285           0 :       else vol[2] = 1 ;
     286           0 :       printf(" volumes pmt %i mcp %i side %i x %f y %f z %f\n",  vol[0], vol[1],  vol[2], hits[0], hits[1], hits[2] );
     287             :       
     288           0 :       Float_t etot=TVirtualMC::GetMC()->Etot();
     289           0 :       hits[3]=etot;
     290           0 :       Int_t iPart= TVirtualMC::GetMC()->TrackPid();
     291           0 :       Int_t partID=TVirtualMC::GetMC()->IdFromPDG(iPart);
     292           0 :       hits[4]=partID;
     293           0 :       Float_t ttime=TVirtualMC::GetMC()->TrackTime();
     294           0 :       hits[5]=ttime*1e12;
     295           0 :       AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,hits);
     296             :       // Create a track reference at the exit of photocatode
     297           0 :     }
     298             :     
     299             :     //charge particle 
     300           0 :     if ( TVirtualMC::GetMC()->TrackCharge() )
     301           0 :       AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kFIT);
     302             :   } //sensitive
     303             : 
     304           0 : }
     305             : 

Generated by: LCOV version 1.11