]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALv0.cxx
Change in the geometry: TUB replaced by PGON to avoid potential overlap when insertin...
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALv0.cxx
index c3584b008917a5eb90cdf60a2bbf6de813eda85a..edcdf213e91011f28c69d39ca62acce39ae64180 100644 (file)
@@ -50,7 +50,6 @@
 #include "AliEMCALGeometry.h"
 #include "AliConst.h"
 #include "AliRun.h"
-#include "AliMC.h"
 
 ClassImp(AliEMCALv0)
 
@@ -93,8 +92,39 @@ void AliEMCALv0::BuildGeometry()
 //______________________________________________________________________
 void AliEMCALv0::CreateGeometry()
 {
-    // Create the EMCAL geometry for Geant
-
+  // Create the EMCAL geometry for Geant
+  // Geometry of a tower
+  //|-----------------------------------------------------| XEN1
+  //| |                                                 | |
+  //| |    Al thickness = GetAlFrontThickness()         | |
+  //| |                                                 | |
+  //| |                                                 | |
+  //| |                                                 | |
+  //|  -------------------------------------------------  |
+  //| |    Air Gap = GetGap2Active()                    | |
+  //| |                                                 | |
+  //|  -------------------------------------------------  |
+  //| |    XU0 : XPST (PreShower e = GetPreSintThick() )| |
+  //|  -------------------------------------------------  |
+  //| |    XU0 : XPBX (PreShower e = GetPbRadThick() )  | |
+  //|  -------------------------------------------------  |
+  //| |    XU0 : XPST (PreShower e = GetPreSintThick() )| |
+  //|  -------------------------------------------------  |
+  //| |    XU0 : XPBX (PreShower e = GetPbRadThick() )  | |
+  //|  -------------------------------------------------  |
+  //| |    XU1 : XPST (Tower e = GetFullSintThick() )   | |
+  //|  -------------------------------------------------  |
+  //| |    XU1 : XPBX (Tower e = GetPbRadThick() )      | |
+  //|  -------------------------------------------------  |
+  //| |    XU1 : XPST (Tower e = GetFullSintThick()     | |
+  //|  -------------------------------------------------  |
+  //| |    XU1 : XPBX (Tower e = GetPbRadThick() )      | |
+  //|  -------------------------------------------------  |
+  //|    etc .....                                        |
+  //|  -------------------------------------------------  |
+  //| |    XU10 : XPST (Tower e = GetFullSintThick() )  | |
+  //|-----------------------------------------------------|
     Float_t etamin,etamax;
     Float_t *dum=0;
 
@@ -107,101 +137,149 @@ void AliEMCALv0::CreateGeometry()
     // Get pointer to the array containing media indices
     Int_t *idtmed = fIdtmed->GetArray() - 1599 ;
 
-    // Create an Envelope within which to place the Detector 
-    Float_t envelopA[5];
-    envelopA[0] = geom->GetEnvelop(0);     // rmin
-    envelopA[1] = geom->GetEnvelop(1);     // rmax
-    envelopA[2] = geom->GetEnvelop(2)/2.0; // dz
-    envelopA[3] = geom->GetArm1PhiMin();   // minimun phi angle
-    envelopA[4] = geom->GetArm1PhiMax();   // maximun phi angle
-
-    // create XEN1
-    gMC->Gsvolu("XEN1", "TUBS ", idtmed[1599], envelopA, 5) ; //filled with air
     Int_t idrotm = 1;
     AliMatrix(idrotm, 90.0, 0., 90.0, 90.0, 0.0, 0.0) ;
 
-    // Position the EMCAL Mother Volume in Alice  
-    gMC->Gspos("XEN1", 1, "ALIC", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
 
-    //  
-    TString label = "XU0";
+    // Create the EMCAL Mother Volume (a polygone) within which to place the Detector and named XEN1 
 
-    //rmin Start mini envelopes after the aluminium layer
-    envelopA[0] = geom->GetEnvelop(0) + geom->GetGap2Active() + 
-                 geom->GetAlFrontThickness();
+    Float_t envelopA[10];
+    envelopA[0] = geom->GetArm1PhiMin();                         // minimum phi angle
+    envelopA[1] = geom->GetArm1PhiMax() - geom->GetArm1PhiMin(); // angular range in phi
+    envelopA[2] = geom->GetNPhi();                               // number of sections in phi
+    envelopA[3] = 2;                                             // 2 z coordinates
+    envelopA[4] = geom->ZFromEtaR(geom->GetEnvelop(0),
+                                  geom->GetArm1EtaMin());       // z coordinate 1
+    envelopA[5] = geom->GetEnvelop(0) ;                          // rmin at z1
+    envelopA[6] = geom->GetEnvelop(1) ;                          // rmax at z1
+    envelopA[7] = geom->ZFromEtaR(geom->GetEnvelop(0),
+                                 geom->GetArm1EtaMax());        // z coordinate 2
+    envelopA[8] = envelopA[5] ;                                  // radii are the same.
+    envelopA[9] = envelopA[6] ;                                  // radii are the same.
 
-    //rmax larger for first two layers (preshower);
-    Float_t tseg = geom->GetPreSintThick()+geom->GetPbRadThick();
-    envelopA[1] = envelopA[0] + 2.0*tseg;
-    envelopA[2] = geom->GetEnvelop(2)/2.0; // dz
-    envelopA[3] = geom->GetArm1PhiMin();   // minimun phi angle
-    envelopA[4] = geom->GetArm1PhiMax();   // maximun phi angle
+    gMC->Gsvolu("XEN1", "PGON ", idtmed[1599], envelopA, 10) ;   // Polygone filled with air 
 
-    //filled with air
-    gMC->Gsvolu(label.Data(), "TUBS ", idtmed[1599], envelopA, 5);
+    // Position the EMCAL Mother Volume (XEN1) in Alice (ALIC)  
+
+    gMC->Gspos("XEN1", 1, "ALIC", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
+    
+    if (fDebug) 
+      Info("CreateGeometry","rXEN1 = %f, %f\n", envelopA[5], envelopA[6]); 
+
+    // Create mini-envelopes which will contain the PreShower scintillator-Lead-scintillator-lead (XU0) 
+   
+    TString label = "XU0";
 
-    // Place XU0 in to XEN1
+    envelopA[5] = envelopA[5] + geom->GetGap2Active() 
+      + geom->GetAlFrontThickness();                              // rmin at z1
+    envelopA[4] = geom->ZFromEtaR(envelopA[5],
+                                 geom->GetArm1EtaMin());         // z coordinate 1
+    envelopA[7] = geom->ZFromEtaR(envelopA[5],
+                                 geom->GetArm1EtaMax());         // z coordinate 2
+    envelopA[6] = envelopA[5] + 2 * (geom->GetPreSintThick()
+      + geom->GetPbRadThick() );                                  // rmax at z1
+    envelopA[8] = envelopA[5] ;                                   // radii are the same.
+    envelopA[9] = envelopA[6] ;                                   // radii are the same.
+    
+    gMC->Gsvolu(label.Data(), "PGON", idtmed[1599], envelopA, 10);// Polygone filled with air 
+
+    // Position XU0 in XEN1
+  
     gMC->Gspos(label.Data(), 1, "XEN1", 0.0, 0.0, 0.0, idrotm, "ONLY");
 
-    tseg = geom->GetFullSintThick()+geom->GetPbRadThick();
-    for (int i = 1; i < ((geom->GetNLayers()-1)/2) + 1 ; i++ ){
+    if (fDebug) 
+      Info("CreateGeometry","rXU0 = %f, %f\n", envelopA[5], envelopA[6]); 
+
+    // Create mini-envelopes which will contain the Tower scintillator-Lead-scintillator-lead (XU1 -> XU9)
+    
+    Float_t tseg = geom->GetFullSintThick()+geom->GetPbRadThick(); // thickness of scintillator+Pb
+    Int_t i ; 
+    for (i = 1; i < ((geom->GetNLayers()-2)/2) + 1 ; i++ ){
        label = "XU" ;
        label += i ;
-       envelopA[0] = envelopA[1]; //rmin
-       envelopA[1] = envelopA[0] + 2.0*tseg;  //rmax
+       envelopA[5] = envelopA[6] ;                                   // rmin at z1
+       envelopA[4] = geom->ZFromEtaR(envelopA[5],
+                                     geom->GetArm1EtaMin());         // z coordinate 1
+       envelopA[7] = geom->ZFromEtaR(envelopA[5],
+                                     geom->GetArm1EtaMax());         // z coordinate 2
+       envelopA[6] = envelopA[5] + 2 * tseg ;                        // rmax at z1
+       envelopA[8] = envelopA[5] ;                                   // radii are the same.
+       envelopA[9] = envelopA[6] ;                                   // radii are the same.
+       gMC->Gsvolu(label.Data(), "PGON", idtmed[1599], envelopA, 10);// Polygone filled with air 
 
-       //filled with air
-       gMC->Gsvolu(label.Data(), "TUBS ", idtmed[1599], envelopA, 5);
+       // Position XUi in XEN1
+       
        gMC->Gspos(label.Data(), 1, "XEN1", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
-    } // end  i
 
+       if (fDebug) 
+         Info("CreateGeometry","rXEN%d = %f, %f\n", i, envelopA[5], envelopA[6]); 
+
+    } // end  i
+  
+    // Create one mini-envelope which will contain the last Tower scintillator (XU(nlayers-1)/2)
+
+    tseg = geom->GetFullSintThick() ;
+    label = "XU" ;
+    label += i ;
+    envelopA[5] = envelopA[6] ;                                   // rmin at z1
+    envelopA[4] = geom->ZFromEtaR(envelopA[5],
+                                 geom->GetArm1EtaMin());         // z coordinate 1
+    envelopA[7] = geom->ZFromEtaR(envelopA[5],
+                                 geom->GetArm1EtaMax());         // z coordinate 2
+    envelopA[6] = envelopA[5] + tseg ;                            // rmax at z1
+    envelopA[8] = envelopA[5] ;                                   // radii are the same.
+    envelopA[9] = envelopA[6] ;                                   // radii are the same.
+
+    gMC->Gsvolu(label.Data(), "PGON", idtmed[1599], envelopA, 10); // Polygone filled with air
+
+    // Position XU10 in XEN1
+  
+    gMC->Gspos(label.Data(), 1, "XEN1", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
+  
+    Info("CreateGeometry","rXEN%d = %f, %f\n", i, envelopA[5], envelopA[6]); 
+  
     // Create the shapes of active material (LEAD/Aluminium/Scintillator)
     // to be placed
     Float_t envelopB[10]; // First Layer of Aluminium
     Float_t envelopC[10]; // Scintillator Layers
     Float_t envelopD[10]; // Lead Layers
 
-    //starting position in Phi
-    envelopC[0] = envelopD[0] =  envelopB[0] = geom->GetArm1PhiMin();
-
-    // Angular size of the Detector in Phi
-    envelopB[1] = geom->GetArm1PhiMax() - geom->GetArm1PhiMin();
-    envelopC[1] = envelopD[1] = envelopB[1];
-
-    // Number of Section in Phi
-    envelopC[2] = envelopD[2] = envelopB[2] = geom->GetNPhi();
-
-    // each section will be passed 2 z coordinates    
-    envelopD[3] = envelopC[3] = envelopB[3] = 2;
-    envelopB[4] = geom->ZFromEtaR(geom->GetEnvelop(0)+geom->GetGap2Active(),
-                                  geom->GetArm1EtaMin());// z co-ordinate 1
-    envelopB[5] = geom->GetEnvelop(0) + geom->GetGap2Active(); //rmin at z1
-    envelopB[6] = envelopB[5] + geom->GetAlFrontThickness();//rmax at z1
-    envelopD[6] = envelopB[6];
-    envelopB[7] = geom->ZFromEtaR(geom->GetEnvelop(0)+geom->GetGap2Active(),
-                                 geom->GetArm1EtaMax()); // z co-ordinate 2
-    envelopB[8] = envelopB[5] ; //
-    envelopB[9] = envelopB[6] ; // radii are the same.
-
-    // filled shapes wit hactive material 
-
-    // Define Aluminium volume completely
-    gMC->Gsvolu("XALU", "PGON", idtmed[1602], envelopB, 10);
-
-    // The polystyrene layers will be defined when placed 
-    gMC->Gsvolu("XPST", "PGON", idtmed[1601], dum, 0);
-    gMC->Gsvolu("XPBX", "PGON", idtmed[1600], dum, 0);//  as will the lead layers
+    envelopC[0] = envelopD[0] = envelopB[0] = envelopA[0] ;  // starting position in Phi
+    envelopC[1] = envelopD[1] = envelopB[1] = envelopA[1] ;  // angular range in phi          
+    envelopC[2] = envelopD[2] = envelopB[2] = envelopA[2] ;  // number of sections in Phi
+    envelopD[3] = envelopC[3] = envelopB[3] = envelopA[3] ;  // 2 z coordinates
+
+    envelopB[4] = geom->ZFromEtaR(geom->GetEnvelop(0),
+                                 geom->GetArm1EtaMin());   // z co-ordinate 1
+    envelopB[5] = geom->GetEnvelop(0) ;                     // rmin at z1
+    envelopB[6] = envelopB[5] + geom->GetAlFrontThickness();// rmax at z1
+    envelopB[7] = geom->ZFromEtaR(geom->GetEnvelop(0),
+                                 geom->GetArm1EtaMax());   // z co-ordinate 2
+    envelopB[8] = envelopB[5] ;                             // radii are the same.
+    envelopB[9] = envelopB[6] ;                             // radii are the same.
+
+    // Define active volumes completely
+    
+    gMC->Gsvolu("XALU", "PGON", idtmed[1602], envelopB, 10); // PGON filled with Al
+    
+    gMC->Gspos("XALU", 1, "XEN1", 0.0, 0.0, 0.0 , idrotm, "ONLY") ; // Position Aluminium Layer in XEN1
 
-    //  Dividind eta polystyrene divisions into phi segments.
-    gMC->Gsdvn("XPHI", "XPST", geom->GetNPhi(), 2);
+    gMC->Gsvolu("XPST", "PGON", idtmed[1601], dum, 0);      // PGON filled with Scintillator (shape to be defined by GSPOSP)
+  
+    gMC->Gsvolu("XPBX", "PGON", idtmed[1600], dum, 0);      // PGON filled with Lead (shape to be defined by GSPOSP)
+  
+    gMC->Gsdvn("XPHI", "XPST", geom->GetNPhi(), 2);         // Divide eta section of scintillators into phi segments.
+    // Position alternatively scintillator and  Lead Layers in XUi.
 
-    // Position Aluminium Layer in the Envelope 
-    gMC->Gspos("XALU", 1, "XEN1", 0.0, 0.0, 0.0 , idrotm, "ONLY") ;
+    envelopD[6] = envelopB[6] + geom->GetGap2Active() ;// gap between Al layer and XU0
 
-    // The loop below places the scintillator in Lead Layers alternately.
     for (int i = 0; i < geom->GetNLayers() ; i++ ){
        label = "XU" ;
-        label += (int) i/2  ; // we will place two layers (i = one layer) in each mini envelope)       
+        label += static_cast<Int_t> (i/2)  ; // we will place two layers (i = one layer) in each mini envelope)        
         envelopC[5] = envelopD[6] ; //rmin
        envelopC[6] = envelopD[6] + ((i > 1)  ? geom->GetFullSintThick() : 
                                     geom->GetPreSintThick());//rmax larger for first two layers (preshower)
@@ -215,11 +293,12 @@ void AliEMCALv0::CreateGeometry()
                ((j+1)*geom->GetDeltaEta());
            envelopC[4] = geom->ZFromEtaR(envelopD[6],etamin); //z begin  
            envelopC[7] = geom->ZFromEtaR(envelopD[6],etamax);// z end 
-           gMC->Gsposp("XPST",1+j+i*(geom->GetNEta()), label.Data(), // should be used but there's a weird crash above i = 18, 
+
+           gMC->Gsposp("XPST",1+j+i*(geom->GetNEta()), label.Data(), 
                        0.0, 0.0, 0.0 , idrotm, "ONLY", envelopC, 10); // Position and define layer
        } // end for j
 
-       if (i < (geom->GetNLayers()-1)){
+       if (i < (geom->GetNLayers()-1)){ // except for the last XU which contains only one scintillator layer
            envelopD[5] = envelopC[6] ; //rmin
            envelopD[6] = envelopC[6] + geom->GetPbRadThick();  //rmax
            envelopD[8] = envelopC[6] ; //rmin
@@ -233,7 +312,8 @@ void AliEMCALv0::CreateGeometry()
                envelopD[7] = geom->ZFromEtaR(envelopC[6],etamax);// z end
 
                // Position and Define Layer
-               gMC->Gsposp("XPBX",1+ j+i*(geom->GetNEta()), label.Data(), 
+
+               gMC->Gsposp("XPBX",1+j+i*(geom->GetNEta()), label.Data(), 
                            0.0, 0.0, 0.0 , idrotm, "ONLY", envelopD, 10);
            } // end for j
        } // end if i
@@ -244,31 +324,27 @@ void AliEMCALv0::CreateGeometry()
 void AliEMCALv0::Init(void)
 {
     // Just prints an information message
-
-    Int_t i;
+  
+  if(fDebug) { 
+    TString message("\n") ; 
+    message += "*****************************************" ;
     
-    if(fDebug) { 
-      cout << endl;
-      for(i=0;i<35;i++) 
-       cout <<"*";
-    cout << "INFO: " << ClassName() << "::Init ";
-    for(i=0;i<35;i++) 
-      cout << "*";
-    cout << endl;
-
     // Here the EMCAL initialisation code (if any!)
-
+    
     AliEMCALGeometry * geom = GetGeometry() ; 
-    if (geom!=0)  
-       cout << "AliEMCAL" << Version() << " : EMCAL geometry intialized for "
-            << geom->GetName() << endl ;
-    else
-       cout << "AliEMCAL" << Version() << 
-           " : EMCAL geometry initialization failed !" << endl ;
-
-    for(i=0;i<80;i++) 
-      cout << "*" ;
-    cout << endl;
+    
+    if (geom!=0) {   
+      message += "AliEMCAL " ; 
+      message += Version() ; 
+      message += "EMCAL geometry intialized for " ; 
+      message += geom->GetName()  ;
+    }
+    else {
+      message += "AliEMCAL " ; 
+      message += Version() ;  
+      message += "EMCAL geometry initialization failed !" ; 
     }
+    message += "*****************************************" ;
+    Info("Init", message.Data() ) ; 
+  }
 }