]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PMD/AliPMDv0.cxx
pplying cell threshold for the QA histos
[u/mrichter/AliRoot.git] / PMD / AliPMDv0.cxx
index ef3ed87e481e6d79bfd94dbd3081b8ac37da4692..b1d0c14231e29904e89a6e152b629a1ac47bc1cc 100644 (file)
 ///////////////////////////////////////////////////////////////////////////////
 ////
 
-#include "Riostream.h"
+#include <Riostream.h>
+#include <TGeoManager.h>
+#include <TGeoGlobalMagField.h>
 #include <TVirtualMC.h>
+
 #include "AliConst.h" 
 #include "AliMagF.h" 
 #include "AliPMDv0.h"
 #include "AliRun.h"
 #include "AliMC.h"
+#include "AliLog.h"
 
 const Int_t   AliPMDv0::fgkNcellHole  = 24;       // Hole dimension
 const Float_t AliPMDv0::fgkCellRadius = 0.25;     // Radius of a hexagonal cell
@@ -55,22 +59,28 @@ const Float_t AliPMDv0::fgkPi         = 3.14159;  // pi
 ClassImp(AliPMDv0)
  
 //_____________________________________________________________________________
-  AliPMDv0::AliPMDv0()
+AliPMDv0::AliPMDv0():
+  fSMthick(0.),
+  fSMLength(0.),
+  fMedSens(0),
+  fNcellSM(0)
 {
   //
   // Default constructor 
   //
-  fMedSens=0;
 }
  
 //_____________________________________________________________________________
-AliPMDv0::AliPMDv0(const char *name, const char *title)
-  : AliPMD(name,title)
+AliPMDv0::AliPMDv0(const char *name, const char *title):
+  AliPMD(name,title),
+  fSMthick(0.),
+  fSMLength(0.),
+  fMedSens(0),
+  fNcellSM(0)
 {
   //
   // Standard constructor
   //
-  fMedSens=0;
 }
 
 //_____________________________________________________________________________
@@ -191,7 +201,7 @@ void AliPMDv0::CreateSupermodule()
   // Gas replaced by vacuum for v0(insensitive) version of PMD.
 
   gMC->Gsvolu("ECAR", "PGON", idtmed[697], hexd2,10);
-  gMC->Gsatt("ECAR", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("ECAR", "SEEN", 0);
   
   // Outer hexagon made of Copper
   
@@ -203,7 +213,7 @@ void AliPMDv0::CreateSupermodule()
   hexd1[9]=   fgkCellRadius;
 
   gMC->Gsvolu("ECCU", "PGON", idtmed[614], hexd1,10);
-  gMC->Gsatt("ECCU", "SEEN", 1);
+  gGeoManager->SetVolumeAttribute("ECCU", "SEEN", 1);
 
   // --- place  inner hex inside outer hex 
 
@@ -220,10 +230,10 @@ void AliPMDv0::CreateSupermodule()
   
   //
   gMC->Gsvolu("ESMA","PARA", idtmed[607], dparasm1, 6);
-  gMC->Gsatt("ESMA", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("ESMA", "SEEN", 0);
   //
   gMC->Gsvolu("ESMB","PARA", idtmed[607], dparasm1, 6);
-  gMC->Gsatt("ESMB", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("ESMB", "SEEN", 0);
   
   // Air residing between the PCB and the base
   
@@ -233,7 +243,7 @@ void AliPMDv0::CreateSupermodule()
   dparaair[2]= fgkThAir/2.;
   
   gMC->Gsvolu("EAIR","PARA", idtmed[698], dparaair, 6);
-  gMC->Gsatt("EAIR", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("EAIR", "SEEN", 0);
   
   // volume for honeycomb chamber EHC1 
   
@@ -243,7 +253,7 @@ void AliPMDv0::CreateSupermodule()
   dpara1[2] = fgkCellDepth/2.;
 
   gMC->Gsvolu("EHC1","PARA", idtmed[698], dpara1, 6);
-  gMC->Gsatt("EHC1", "SEEN", 1);
+  gGeoManager->SetVolumeAttribute("EHC1", "SEEN", 1);
   
   // Place hexagonal cells ECCU cells  inside EHC1 (72 X 72)
 
@@ -300,10 +310,10 @@ void AliPMDv0::CreateSupermodule()
   dparasm2[2] = fSMthick/2.;
 
   gMC->Gsvolu("ESMX","PARA", idtmed[607], dparasm2, 6);
-  gMC->Gsatt("ESMX", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("ESMX", "SEEN", 0);
   //
   gMC->Gsvolu("ESMY","PARA", idtmed[607], dparasm2, 6);
-  gMC->Gsatt("ESMY", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("ESMY", "SEEN", 0);
 
   Float_t dpara2[6] = {12.5,12.5,0.4,30.,0.,0.};
   dpara2[0] = dparasm2[0];
@@ -311,7 +321,7 @@ void AliPMDv0::CreateSupermodule()
   dpara2[2] = fgkCellDepth/2.;
 
   gMC->Gsvolu("EHC2","PARA", idtmed[698], dpara2, 6);
-  gMC->Gsatt("EHC2", "SEEN", 1);
+  gGeoManager->SetVolumeAttribute("EHC2", "SEEN", 1);
 
 
   // Air residing between the PCB and the base
@@ -322,7 +332,7 @@ void AliPMDv0::CreateSupermodule()
   dpara2Air[2]= fgkThAir/2.;
 
   gMC->Gsvolu("EAIX","PARA", idtmed[698], dpara2Air, 6);
-  gMC->Gsatt("EAIX", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("EAIX", "SEEN", 0);
 
   // Place hexagonal single cells ECCU inside EHC2
   // skip cells which go into the hole in top left corner.
@@ -375,10 +385,10 @@ void AliPMDv0::CreateSupermodule()
   dparaSM3[2] = fSMthick/2.;
 
   gMC->Gsvolu("ESMP","PARA", idtmed[607], dparaSM3, 6);
-  gMC->Gsatt("ESMP", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("ESMP", "SEEN", 0);
   //
   gMC->Gsvolu("ESMQ","PARA", idtmed[607], dparaSM3, 6);
-  gMC->Gsatt("ESMQ", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("ESMQ", "SEEN", 0);
 
   Float_t dpara3[6] = {12.5,12.5,0.4,30.,0.,0.};
   dpara3[0] = dparaSM3[0];
@@ -386,7 +396,7 @@ void AliPMDv0::CreateSupermodule()
   dpara3[2] = fgkCellDepth/2.;
 
   gMC->Gsvolu("EHC3","PARA", idtmed[698], dpara3, 6);
-  gMC->Gsatt("EHC3", "SEEN", 1);
+  gGeoManager->SetVolumeAttribute("EHC3", "SEEN", 1);
 
   // Air residing between the PCB and the base
 
@@ -396,7 +406,7 @@ void AliPMDv0::CreateSupermodule()
   dpara3Air[2]= fgkThAir/2.;
 
   gMC->Gsvolu("EAIP","PARA", idtmed[698], dpara3Air, 6);
-  gMC->Gsatt("EAIP", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("EAIP", "SEEN", 0);
 
 
   // Place hexagonal single cells ECCU inside EHC3
@@ -474,7 +484,7 @@ void AliPMDv0::CreatePMD()
   gaspmd[8] = gaspmd[5];
 
   gMC->Gsvolu("EPMD", "PGON", idtmed[698], gaspmd, 10);
-  gMC->Gsatt("EPMD", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("EPMD", "SEEN", 0);
 
   AliMatrix(irotdm, 90., 0.,  90.,  90., 180., 0.);
    
@@ -495,7 +505,7 @@ void AliPMDv0::CreatePMD()
   dparaemm1[2] = dmthick/2.;
 
   gMC->Gsvolu("EMM1","PARA", idtmed[698], dparaemm1, 6);
-  gMC->Gsatt("EMM1", "SEEN", 1);
+  gGeoManager->SetVolumeAttribute("EMM1", "SEEN", 1);
 
   //
   // --- DEFINE Modules, iron, and lead volumes 
@@ -507,7 +517,7 @@ void AliPMDv0::CreatePMD()
   dparapb1[2] = fgkThLead/2.;
 
   gMC->Gsvolu("EPB1","PARA", idtmed[600], dparapb1, 6);
-  gMC->Gsatt ("EPB1", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute ("EPB1", "SEEN", 0);
 
   //   Fe Support for EMM1
   Float_t dparafe1[6] = {12.5,12.5,8.,30.,0.,0.};
@@ -516,7 +526,7 @@ void AliPMDv0::CreatePMD()
   dparafe1[2] = fgkThSteel/2.;
 
   gMC->Gsvolu("EFE1","PARA", idtmed[618], dparafe1, 6);
-  gMC->Gsatt ("EFE1", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute ("EFE1", "SEEN", 0);
 
   //  
   // position supermodule ESMA, ESMB, EPB1, EFE1 inside EMM1
@@ -541,7 +551,7 @@ void AliPMDv0::CreatePMD()
   dparaemm2[2] = dmthick/2.;
 
   gMC->Gsvolu("EMM2","PARA", idtmed[698], dparaemm2, 6);
-  gMC->Gsatt("EMM2", "SEEN", 1);
+  gGeoManager->SetVolumeAttribute("EMM2", "SEEN", 1);
 
   //   Pb Convertor for EMM2
   Float_t dparapb2[6] = {12.5,12.5,8.,30.,0.,0.};
@@ -550,7 +560,7 @@ void AliPMDv0::CreatePMD()
   dparapb2[2] = fgkThLead/2.;
 
   gMC->Gsvolu("EPB2","PARA", idtmed[600], dparapb2, 6);
-  gMC->Gsatt ("EPB2", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute ("EPB2", "SEEN", 0);
 
   //   Fe Support for EMM2
   Float_t dparafe2[6] = {12.5,12.5,8.,30.,0.,0.};
@@ -559,7 +569,7 @@ void AliPMDv0::CreatePMD()
   dparafe2[2] = fgkThSteel/2.;
 
   gMC->Gsvolu("EFE2","PARA", idtmed[618], dparafe2, 6);
-  gMC->Gsatt ("EFE2", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute ("EFE2", "SEEN", 0);
 
   // position supermodule  ESMX, ESMY inside EMM2
 
@@ -581,7 +591,7 @@ void AliPMDv0::CreatePMD()
   dparaemm3[2] = dmthick/2.;
 
   gMC->Gsvolu("EMM3","PARA", idtmed[698], dparaemm3, 6);
-  gMC->Gsatt("EMM3", "SEEN", 1);
+  gGeoManager->SetVolumeAttribute("EMM3", "SEEN", 1);
 
   //   Pb Convertor for EMM3
   Float_t dparapb3[6] = {12.5,12.5,8.,30.,0.,0.};
@@ -590,7 +600,7 @@ void AliPMDv0::CreatePMD()
   dparapb3[2] = fgkThLead/2.;
 
   gMC->Gsvolu("EPB3","PARA", idtmed[600], dparapb3, 6);
-  gMC->Gsatt ("EPB3", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute ("EPB3", "SEEN", 0);
 
   //   Fe Support for EMM3
   Float_t dparafe3[6] = {12.5,12.5,8.,30.,0.,0.};
@@ -599,7 +609,7 @@ void AliPMDv0::CreatePMD()
   dparafe3[2] = fgkThSteel/2.;
 
   gMC->Gsvolu("EFE3","PARA", idtmed[618], dparafe3, 6);
-  gMC->Gsatt ("EFE3", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute ("EFE3", "SEEN", 0);
 
   // position supermodule  ESMP, ESMQ inside EMM3
 
@@ -621,7 +631,7 @@ void AliPMDv0::CreatePMD()
   //d_hole[2] = dmthick/2.;
   //
   //gMC->Gsvolu("EHOL", "TUBE", idtmed[698], d_hole, 3);
-  //gMC->Gsatt("EHOL", "SEEN", 1);
+  //gGeoManager->SetVolumeAttribute("EHOL", "SEEN", 1);
 
   //Al-rod as boundary of the supermodules
 
@@ -631,7 +641,7 @@ void AliPMDv0::CreatePMD()
   alRod[2] = dmthick/2.;
 
   gMC->Gsvolu("EALM","BOX ", idtmed[698], alRod, 3);
-  gMC->Gsatt ("EALM", "SEEN", 1);
+  gGeoManager->SetVolumeAttribute ("EALM", "SEEN", 1);
   Float_t xalm[3];
   xalm[0]=alRod[0] + gaspmd[5] + 3.0*fgkBoundary;
   xalm[1]=-xalm[0]/2.;
@@ -698,13 +708,12 @@ void AliPMDv0::CreatePMD()
         ysup[i]*TMath::Sin(theta[j]);
        ypos[i]=ymod[j] + xsup[i]*TMath::Sin(theta[j]) +
         ysup[i]*TMath::Cos(theta[j]);
-       if(fDebug) 
-        printf("%s: %f %f \n", ClassName(), xpos[i], ypos[i]);
+        
+       AliDebugClass(1,Form("xpos: %f, ypos: %f", xpos[i], ypos[i]));
        
        nummod = nummod+1;
        
-       if(fDebug) 
-        printf("\n%s: nummod %d\n",ClassName(),nummod);
+       AliDebugClass(1,Form("nummod %d",nummod));
        
        gMC->Gspos("EMM1", nummod + 6, "EPMD", xpos[i],ypos[i], 0., irotate[j], "ONLY");
        
@@ -725,40 +734,6 @@ void AliPMDv0::CreatePMD()
 }
 
  
-//_____________________________________________________________________________
-void AliPMDv0::DrawModule() const
-{
-  //
-  // Draw a shaded view of the Photon Multiplicity Detector
-  //
-
-  gMC->Gsatt("*", "seen", -1);
-  gMC->Gsatt("alic", "seen", 0);
-  //
-  // Set the visibility of the components
-  // 
-  gMC->Gsatt("ECAR","seen",0);
-  gMC->Gsatt("ECCU","seen",1);
-  gMC->Gsatt("EHC1","seen",1);
-  gMC->Gsatt("EHC1","seen",1);
-  gMC->Gsatt("EHC2","seen",1);
-  gMC->Gsatt("EMM1","seen",1);
-  gMC->Gsatt("EHOL","seen",1);
-  gMC->Gsatt("EPMD","seen",0);
-  //
-  gMC->Gdopt("hide", "on");
-  gMC->Gdopt("shad", "on");
-  gMC->Gsatt("*", "fill", 7);
-  gMC->SetClipBox(".");
-  gMC->SetClipBox("*", 0, 3000, -3000, 3000, -6000, 6000);
-  gMC->DefaultRange();
-  gMC->Gdraw("alic", 40, 30, 0, 22, 20.5, .02, .02);
-  gMC->Gdhead(1111, "Photon Multiplicity Detector Version 1");
-
-  //gMC->Gdman(17, 5, "MAN");
-  gMC->Gdopt("hide", "off");
-}
-
 //_____________________________________________________________________________
 void AliPMDv0::CreateMaterials()
 {
@@ -770,9 +745,8 @@ void AliPMDv0::CreateMaterials()
   
   //  cout << " Inside create materials " << endl;
 
-  Int_t *idtmed = fIdtmed->GetArray()-599;
-  Int_t isxfld = gAlice->Field()->Integ();
-  Float_t sxmgmx = gAlice->Field()->Max();
+  Int_t isxfld = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Integ();
+  Float_t sxmgmx = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Max();
   
   // --- Define the various materials for GEANT --- 
 
@@ -842,55 +816,6 @@ void AliPMDv0::CreateMaterials()
   AliMedium(98, "Vacuum  $", 98, 0, 0, isxfld, sxmgmx, 1., .1, .10, 10);
   AliMedium(99, "Air gaps$", 99, 0, 0, isxfld, sxmgmx, 1., .1, .10, .1);
 
-  
-  // --- Generate explicitly delta rays in the iron, aluminium and lead --- 
-  gMC->Gstpar(idtmed[600], "LOSS", 3.);
-  gMC->Gstpar(idtmed[600], "DRAY", 1.);
-  
-  gMC->Gstpar(idtmed[603], "LOSS", 3.);
-  gMC->Gstpar(idtmed[603], "DRAY", 1.);
-  
-  gMC->Gstpar(idtmed[604], "LOSS", 3.);
-  gMC->Gstpar(idtmed[604], "DRAY", 1.);
-  
-  gMC->Gstpar(idtmed[605], "LOSS", 3.);
-  gMC->Gstpar(idtmed[605], "DRAY", 1.);
-  
-  gMC->Gstpar(idtmed[606], "LOSS", 3.);
-  gMC->Gstpar(idtmed[606], "DRAY", 1.);
-  
-  gMC->Gstpar(idtmed[607], "LOSS", 3.);
-  gMC->Gstpar(idtmed[607], "DRAY", 1.);
-  
-  // --- Energy cut-offs in the Pb and Al to gain time in tracking --- 
-  // --- without affecting the hit patterns --- 
-  gMC->Gstpar(idtmed[600], "CUTGAM", 1e-4);
-  gMC->Gstpar(idtmed[600], "CUTELE", 1e-4);
-  gMC->Gstpar(idtmed[600], "CUTNEU", 1e-4);
-  gMC->Gstpar(idtmed[600], "CUTHAD", 1e-4);
-  gMC->Gstpar(idtmed[605], "CUTGAM", 1e-4);
-  gMC->Gstpar(idtmed[605], "CUTELE", 1e-4);
-  gMC->Gstpar(idtmed[605], "CUTNEU", 1e-4);
-  gMC->Gstpar(idtmed[605], "CUTHAD", 1e-4);
-  gMC->Gstpar(idtmed[606], "CUTGAM", 1e-4);
-  gMC->Gstpar(idtmed[606], "CUTELE", 1e-4);
-  gMC->Gstpar(idtmed[606], "CUTNEU", 1e-4);
-  gMC->Gstpar(idtmed[606], "CUTHAD", 1e-4);
-  gMC->Gstpar(idtmed[603], "CUTGAM", 1e-4);
-  gMC->Gstpar(idtmed[603], "CUTELE", 1e-4);
-  gMC->Gstpar(idtmed[603], "CUTNEU", 1e-4);
-  gMC->Gstpar(idtmed[603], "CUTHAD", 1e-4);
-//   gMC->Gstpar(idtmed[609], "CUTGAM", 1e-4);
-//   gMC->Gstpar(idtmed[609], "CUTELE", 1e-4);
-//   gMC->Gstpar(idtmed[609], "CUTNEU", 1e-4);
-//   gMC->Gstpar(idtmed[609], "CUTHAD", 1e-4);
-  
-  // --- Prevent particles stopping in the gas due to energy cut-off --- 
-  gMC->Gstpar(idtmed[604], "CUTGAM", 1e-5);
-  gMC->Gstpar(idtmed[604], "CUTELE", 1e-5);
-  gMC->Gstpar(idtmed[604], "CUTNEU", 1e-5);
-  gMC->Gstpar(idtmed[604], "CUTHAD", 1e-5);
-  gMC->Gstpar(idtmed[604], "CUTMUO", 1e-5);
 }
 
 //_____________________________________________________________________________
@@ -902,7 +827,7 @@ void AliPMDv0::Init()
   Int_t i;
   //  kdet=1;
   //
-  if(fDebug) {
+  if(AliLog::GetGlobalDebugLevel()>0) {
       printf("\n%s: ",ClassName());
       for(i=0;i<35;i++) printf("*");
       printf(" PMD_INIT ");
@@ -918,6 +843,8 @@ void AliPMDv0::Init()
   }
   Int_t *idtmed = fIdtmed->GetArray()-599;
   fMedSens=idtmed[605-1];
+  // --- Generate explicitly delta rays in the iron, aluminium and lead --- 
+  // removed all Gstpar and energy cut-offs moved to galice.cuts
 }
 
 //_____________________________________________________________________________
@@ -927,50 +854,32 @@ void AliPMDv0::StepManager()
   // Called at each step in the PMD
   //
   Int_t   copy;
-  Float_t hits[4], destep;
+  Float_t hits[5], destep;
   Float_t center[3] = {0,0,0};
-  Int_t   vol[5];
+  Int_t   vol[6];
   //char *namep;
   
-  if(gMC->GetMedium() == fMedSens && (destep = gMC->Edep())) {
+  if(gMC->CurrentMedium() == fMedSens && (destep = gMC->Edep())) {
   
     gMC->CurrentVolID(copy);
-
-    //namep=gMC->CurrentVolName();
-    //printf("Current vol is %s \n",namep);
-
-    vol[0]=copy;
+    vol[0] = copy;
     gMC->CurrentVolOffID(1,copy);
-
-    //namep=gMC->CurrentVolOffName(1);
-    //printf("Current vol 11 is %s \n",namep);
-
-    vol[1]=copy;
+    vol[1] = copy;
     gMC->CurrentVolOffID(2,copy);
-
-    //namep=gMC->CurrentVolOffName(2);
-    //printf("Current vol 22 is %s \n",namep);
-
-    vol[2]=copy;
-
-    // if(strncmp(namep,"EHC1",4))vol[2]=1;
-
+    vol[2] = copy;
     gMC->CurrentVolOffID(3,copy);
-
-    //namep=gMC->CurrentVolOffName(3);
-    //printf("Current vol 33 is %s \n",namep);
-
-    vol[3]=copy;
+    vol[3] = copy;
     gMC->CurrentVolOffID(4,copy);
-
-    //namep=gMC->CurrentVolOffName(4);
-    //printf("Current vol 44 is %s \n",namep);
-
-    vol[4]=copy;
-    //printf("volume number %d,%d,%d,%d,%d,%f \n",vol[0],vol[1],vol[2],vol[3],vol[4],destep*1000000);
+    vol[4] = copy;
+    gMC->CurrentVolOffID(5,copy);
+    vol[5] = copy;
 
     gMC->Gdtom(center,hits,1);
     hits[3] = destep*1e9; //Number in eV
+
+   // this is for pile-up events
+    hits[4] = gMC->TrackTime();
+
     AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
   }
 }