]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ZDC/AliZDCv1.cxx
Swap row and columns in Calibrate()
[u/mrichter/AliRoot.git] / ZDC / AliZDCv1.cxx
index c3900aebae65da59fcd7f317bc1a2892381f5645..4bc8b34e3da1458ea848ae07e8aead6d82606eb9 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-Revision 1.27.8.1  2002/06/10 15:29:36  hristov
-Merged with v3-08-02
-
-Revision 1.27  2001/09/26 16:06:59  coppedis
-Some function moved to AliZDC
-
-Revision 1.26  2001/06/13 11:10:55  coppedis
-Minor changes
-
-Revision 1.25  2001/06/12 13:45:05  coppedis
-TDI in correct position and minor correction
-
-Revision 1.24  2001/05/16 14:57:28  alibrary
-New files for folders and Stack
-
-Revision 1.23  2001/05/14 09:51:50  coppedis
-Change in AddHit suggested by J. Chudoba
-
-Revision 1.22  2001/05/05 13:33:19  coppedis
-Changes in StepManager to speed simulation
-
-Revision 1.21  2001/05/02 11:54:34  enrico
-Minor change
-
-Revision 1.20  2001/05/02 10:33:11  coppedis
-Modify tmaxfd in media definition
-
-Revision 1.19  2001/04/27 08:35:01  coppedis
-Remove some lines for proton acceptance studies
-
-Revision 1.18  2001/04/20 10:08:45  coppedis
-Preliminary version of optics 6.2 - Insertion of TDI
-
-Revision 1.17  2001/03/16 16:18:10  coppedis
-Correction for superposition of ZDC volumes with MUON arm one
-
-Revision 1.16  2001/03/15 16:12:04  coppedis
-Code review
-
-Revision 1.15  2001/03/12 17:47:56  hristov
-Changes needed on Sun with CC 5.0
-
-Revision 1.14  2001/02/23 16:48:28  coppedis
-Correct bug in ZEM hit definition
-
-Revision 1.13  2001/02/07 18:07:41  coppedis
-Modif for splitting
-
-Revision 1.12  2001/01/26 19:56:27  hristov
-Major upgrade of AliRoot code
-
-Revision 1.11  2001/01/16 07:43:33  hristov
-Initialisation of ZDC hits
-
-Revision 1.10  2000/12/14 15:20:02  coppedis
-Hits2Digits method for digitization
-
-Revision 1.9  2000/12/13 10:33:49  coppedis
-Prints only if fDebug==1
-
-Revision 1.8  2000/12/12 14:10:02  coppedis
-Correction suggested by M. Masera
-
-Revision 1.7  2000/11/30 17:23:47  coppedis
-Remove first corrector dipole and introduce digitization
-
-Revision 1.6  2000/11/22 11:33:10  coppedis
-Major code revision
-
-Revision 1.5  2000/10/02 21:28:20  fca
-Removal of useless dependecies via forward declarations
-
-Revision 1.3.2.1  2000/08/24 09:25:47  hristov
-Patch by P.Hristov: Bug in ZDC geometry corrected by E.Scomparin
-
-Revision 1.4  2000/08/24 09:23:59  hristov
-Bug in ZDC geometry corrected by E.Scomparin
-
-Revision 1.3  2000/07/12 06:59:16  fca
-Fixing dimension of hits array
-
-Revision 1.2  2000/07/11 11:12:34  fca
-Some syntax corrections for non standard HP aCC
-
-Revision 1.1  2000/07/10 13:58:01  fca
-New version of ZDC from E.Scomparin & C.Oppedisano
-
-Revision 1.7  2000/01/19 17:17:40  fca
-
-Revision 1.6  1999/09/29 09:24:35  fca
-Introduction of the Copyright and cvs Log
-
-*/
+/* $Id$ */
 
 ///////////////////////////////////////////////////////////////////////////////
 //                                                                           //
@@ -122,24 +28,23 @@ Introduction of the Copyright and cvs Log
 
 // --- ROOT system
 #include <TBRIK.h>
-#include <TNode.h>
+#include <TLorentzVector.h>
 #include <TMath.h>
+#include <TNode.h>
 #include <TRandom.h>
 #include <TSystem.h>
 #include <TTree.h>
-
+#include <TVirtualMC.h>
 
 // --- AliRoot classes
-#include "AliZDCv1.h"
-#include "AliZDCHit.h"
-#include "AliRun.h"
+#include "AliConst.h"
 #include "AliDetector.h"
 #include "AliMagF.h"
-#include "AliMC.h"
-//#include "AliCallf77.h"
-#include "AliConst.h"
 #include "AliPDG.h"
-#include "TLorentzVector.h"
+#include "AliRun.h"
+#include "AliZDCHit.h"
+#include "AliZDCv1.h"
+#include "AliMC.h"
  
  
 ClassImp(AliZDCv1)
@@ -159,6 +64,12 @@ AliZDCv1::AliZDCv1() : AliZDC()
   fMedSensGR  = 0;
 //  fMedSensPI  = 0;
 //  fMedSensTDI = 0;
+  Float_t kDimZEMPb  = 0.15*(TMath::Sqrt(2.));  // z-dimension of the Pb slice
+  Float_t kDimZEMAir = 0.001;                  // scotch
+  Float_t kFibRadZEM = 0.0315;                         // External fiber radius (including cladding)
+  Int_t   kDivZEM[3] = {92, 0, 20};            // Divisions for EM detector
+  Float_t kDimZEM0 = 2*kDivZEM[2]*(kDimZEMPb+kDimZEMAir+kFibRadZEM*(TMath::Sqrt(2.)));
+  fZEMLength = kDimZEM0;
 }
  
 //_____________________________________________________________________________
@@ -171,11 +82,11 @@ AliZDCv1::AliZDCv1(const char *name, const char *title)
   //
   // Check that DIPO, ABSO, DIPO and SHIL is there (otherwise tracking is wrong!!!)
   
-  AliModule *PIPE=gAlice->GetModule("PIPE");
-  AliModule *ABSO=gAlice->GetModule("ABSO");
-  AliModule *DIPO=gAlice->GetModule("DIPO");
-  AliModule *SHIL=gAlice->GetModule("SHIL");
-  if((!PIPE) || (!ABSO) || (!DIPO) || (!SHIL)) {
+  AliModule *pipe=gAlice->GetModule("PIPE");
+  AliModule *abso=gAlice->GetModule("ABSO");
+  AliModule *dipo=gAlice->GetModule("DIPO");
+  AliModule *shil=gAlice->GetModule("SHIL");
+  if((!pipe) || (!abso) || (!dipo) || (!shil)) {
     Error("Constructor","ZDC needs PIPE, ABSO, DIPO and SHIL!!!\n");
     exit(1);
   } 
@@ -234,6 +145,12 @@ AliZDCv1::AliZDCv1(const char *name, const char *title)
   fPosZEM[1] = 5.8;
   fPosZEM[2] = 11600.;
   
+  Float_t kDimZEMPb  = 0.15*(TMath::Sqrt(2.));  // z-dimension of the Pb slice
+  Float_t kDimZEMAir = 0.001;                  // scotch
+  Float_t kFibRadZEM = 0.0315;                         // External fiber radius (including cladding)
+  Int_t   kDivZEM[3] = {92, 0, 20};            // Divisions for EM detector
+  Float_t kDimZEM0 = 2*kDivZEM[2]*(kDimZEMPb+kDimZEMAir+kFibRadZEM*(TMath::Sqrt(2.)));
+  fZEMLength = kDimZEM0;
 }
  
 //_____________________________________________________________________________
@@ -251,7 +168,10 @@ void AliZDCv1::CreateGeometry()
 //_____________________________________________________________________________
 void AliZDCv1::CreateBeamLine()
 {
-  
+  //
+  // Create the beam line elements
+  //
   Float_t zq, zd1, zd2;
   Float_t conpar[9], tubpar[3], tubspar[5], boxpar[3];
   Int_t im1, im2;
@@ -671,8 +591,11 @@ void AliZDCv1::CreateBeamLine()
 //_____________________________________________________________________________
 void AliZDCv1::CreateZDC()
 {
+ //
+ // Create the various ZDCs (ZN + ZP)
+ //
   
-  Float_t DimPb[6], DimVoid[6];
+  Float_t dimPb[6], dimVoid[6];
   
   Int_t *idtmed = fIdtmed->GetArray();
 
@@ -807,15 +730,15 @@ void AliZDCv1::CreateZDC()
 
   gMC->Gsdvn("ZETR", "ZEM ", fDivZEM[2], 1);        // Tranches 
   
-  DimPb[0] = fDimZEMPb;                        // Lead slices 
-  DimPb[1] = fDimZEM[2];
-  DimPb[2] = fDimZEM[1];
-  DimPb[3] = 90.-fDimZEM[3];
-  DimPb[4] = 0.;
-  DimPb[5] = 0.;
-  gMC->Gsvolu("ZEL0", "PARA", idtmed[5], DimPb, 6);
-  gMC->Gsvolu("ZEL1", "PARA", idtmed[5], DimPb, 6);
-  gMC->Gsvolu("ZEL2", "PARA", idtmed[5], DimPb, 6);
+  dimPb[0] = fDimZEMPb;                        // Lead slices 
+  dimPb[1] = fDimZEM[2];
+  dimPb[2] = fDimZEM[1];
+  dimPb[3] = 90.-fDimZEM[3];
+  dimPb[4] = 0.;
+  dimPb[5] = 0.;
+  gMC->Gsvolu("ZEL0", "PARA", idtmed[5], dimPb, 6);
+  gMC->Gsvolu("ZEL1", "PARA", idtmed[5], dimPb, 6);
+  gMC->Gsvolu("ZEL2", "PARA", idtmed[5], dimPb, 6);
   
   // --- Position the lead slices in the tranche 
   Float_t zTran = fDimZEM[0]/fDivZEM[2]; 
@@ -824,14 +747,14 @@ void AliZDCv1::CreateZDC()
   gMC->Gspos("ZEL1", 1, "ZETR", fDimZEMPb, 0., 0., 0, "ONLY");
   
   // --- Vacuum zone (to be filled with fibres)
-  DimVoid[0] = (zTran-2*fDimZEMPb)/2.;
-  DimVoid[1] = fDimZEM[2];
-  DimVoid[2] = fDimZEM[1];
-  DimVoid[3] = 90.-fDimZEM[3];
-  DimVoid[4] = 0.;
-  DimVoid[5] = 0.;
-  gMC->Gsvolu("ZEV0", "PARA", idtmed[10], DimVoid,6);
-  gMC->Gsvolu("ZEV1", "PARA", idtmed[10], DimVoid,6);
+  dimVoid[0] = (zTran-2*fDimZEMPb)/2.;
+  dimVoid[1] = fDimZEM[2];
+  dimVoid[2] = fDimZEM[1];
+  dimVoid[3] = 90.-fDimZEM[3];
+  dimVoid[4] = 0.;
+  dimVoid[5] = 0.;
+  gMC->Gsvolu("ZEV0", "PARA", idtmed[10], dimVoid,6);
+  gMC->Gsvolu("ZEV1", "PARA", idtmed[10], dimVoid,6);
   
   // --- Divide the vacuum slice into sticks along x axis
   gMC->Gsdvn("ZES0", "ZEV0", fDivZEM[0], 3); 
@@ -842,9 +765,9 @@ void AliZDCv1::CreateZDC()
   gMC->Gspos("ZEMF", 1,"ZES1", 0., 0., 0., irot2, "ONLY");
   
   // --- Positioning the vacuum slice into the tranche
-  Float_t DisplFib = fDimZEM[1]/fDivZEM[0];
-  gMC->Gspos("ZEV0", 1,"ZETR", -DimVoid[0], 0., 0., 0, "ONLY");
-  gMC->Gspos("ZEV1", 1,"ZETR", -DimVoid[0]+zTran, 0., DisplFib, 0, "ONLY");
+  Float_t displFib = fDimZEM[1]/fDivZEM[0];
+  gMC->Gspos("ZEV0", 1,"ZETR", -dimVoid[0], 0., 0., 0, "ONLY");
+  gMC->Gspos("ZEV1", 1,"ZETR", -dimVoid[0]+zTran, 0., displFib, 0, "ONLY");
 
   // --- Positioning the ZEM into the ZDC - rotation for 90 degrees  
   gMC->Gspos("ZEM ", 1,"ZDC ", fPosZEM[0], fPosZEM[1], fPosZEM[2], irot1, "ONLY");
@@ -856,7 +779,7 @@ void AliZDCv1::CreateZDC()
 }
  
 //_____________________________________________________________________________
-void AliZDCv1::DrawModule()
+void AliZDCv1::DrawModule() const
 {
   //
   // Draw a shaded view of the Zero Degree Calorimeter version 1
@@ -1166,6 +1089,10 @@ void AliZDCv1::Init()
 //_____________________________________________________________________________
 void AliZDCv1::InitTables()
 {
+ //
+ // Read light tables for Cerenkov light production parameterization 
+ //
+
   Int_t k, j;
 
   char *lightfName1,*lightfName2,*lightfName3,*lightfName4,
@@ -1251,7 +1178,7 @@ void AliZDCv1::StepManager()
 
   Int_t j, vol[2], ibeta=0, ialfa, ibe, nphe;
   Float_t x[3], xdet[3], destep, hits[10], m, ekin, um[3], ud[3], be, radius, out;
-  Float_t xalic[3], z, GuiEff, GuiPar[4]={0.31,-0.0004,0.0197,0.7958};
+  Float_t xalic[3], z, guiEff, guiPar[4]={0.31,-0.0004,0.0197,0.7958};
   TLorentzVector s, p;
   const char *knamed;
 
@@ -1349,7 +1276,7 @@ void AliZDCv1::StepManager()
 
 //       Int_t PcID = gMC->TrackPid();
 //       printf("Pc ID -> %d\n",PcID);
-       AddHit(gAlice->CurrentTrack(), vol, hits);
+       AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
        
        if(fNoShower==1){
 //       fpDetected += 1;
@@ -1369,13 +1296,13 @@ void AliZDCv1::StepManager()
           hits[9] = ekin;
           hits[7] = 0.;
           hits[8] = 0.;
-          AddHit(gAlice->CurrentTrack(), vol, hits);
+          AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
           }
         else{
           hits[9] = destep;
           hits[7] = 0.;
           hits[8] = 0.;
-          AddHit(gAlice->CurrentTrack(), vol, hits);
+          AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
           }
 //      printf(" Dep. E = %f \n",hits[9]);
       }
@@ -1455,13 +1382,13 @@ void AliZDCv1::StepManager()
           hits[7] = nphe;      //fLightPMQ
           hits[8] = 0;
           hits[9] = 0;
-          AddHit(gAlice->CurrentTrack(), vol, hits);
+          AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
         }
         else{
           hits[7] = 0;
           hits[8] = nphe;      //fLightPMC
           hits[9] = 0;
-          AddHit(gAlice->CurrentTrack(), vol, hits);
+          AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
         }
        } 
        else if((vol[0]==2)) {  // (2) ZP fibres
@@ -1474,13 +1401,13 @@ void AliZDCv1::StepManager()
           hits[7] = nphe;      //fLightPMQ
           hits[8] = 0;
           hits[9] = 0;
-          AddHit(gAlice->CurrentTrack(), vol, hits);
+          AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
         }
         else{
           hits[7] = 0;
           hits[8] = nphe;      //fLightPMC
           hits[9] = 0;
-          AddHit(gAlice->CurrentTrack(), vol, hits);
+          AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
         }
        } 
        else if((vol[0]==3)) {  // (3) ZEM fibres
@@ -1495,18 +1422,18 @@ void AliZDCv1::StepManager()
         z = -xalic[2]+fPosZEM[2]+2*fZEMLength-xalic[1];
 //      z = xalic[2]-fPosZEM[2]-fZEMLength-xalic[1]*(TMath::Tan(45.*kDegrad));
 //         printf("\n  fPosZEM[2]+2*fZEMLength = %f", fPosZEM[2]+2*fZEMLength);
-        GuiEff = GuiPar[0]*(GuiPar[1]*z*z+GuiPar[2]*z+GuiPar[3]);
+        guiEff = guiPar[0]*(guiPar[1]*z*z+guiPar[2]*z+guiPar[3]);
 //         printf("\n  xalic[0] = %f   xalic[1] = %f   xalic[2] = %f   z = %f  \n",
 //             xalic[0],xalic[1],xalic[2],z);
-        out = out*GuiEff;
+        out = out*guiEff;
         nphe = gRandom->Poisson(out);
-//         printf("    out*GuiEff = %f nphe = %d", out, nphe);
+//         printf("    out*guiEff = %f nphe = %d", out, nphe);
 //      printf("ZEM --- ibeta = %d, ialfa = %d, ibe = %d"
 //             "       -> out = %f, nphe = %d\n", ibeta, ialfa, ibe, out, nphe);
         hits[7] = 0;   
         hits[8] = nphe;        //fLightPMC
         hits[9] = 0;
-        AddHit(gAlice->CurrentTrack(), vol, hits);
+        AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
        }
      }
    }