]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALv0.cxx
Update the Print methods (Laurent)
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALv0.cxx
index 1a4cbff865f0ebcd800b3f3897242ae03df80519..55aabb782990642d20c09e5bcd280206b8222aa9 100644 (file)
@@ -24,6 +24,7 @@
 //          : Aleksei Pavlinov (WSU)     SHASHLYK
 
 // --- ROOT system ---
+#include <cassert>
 
 #include <TNode.h>
 #include <TBRIK.h>
@@ -81,7 +82,8 @@ AliEMCALv0::AliEMCALv0(const char *name, const char *title)
     fSampleWidth(0),fSmodPar0(0),fSmodPar1(0),fSmodPar2(0)
 {
   // ctor : title is used to identify the layout
-    // Apr 25, 2006
+  // Apr 25, 2006
+  // Nov 22, 2006 - case of 1X1  
   TString ntmp(GetTitle());
   ntmp.ToUpper();
   if(ntmp == "TRD1") { // TRD1 is alias for SHISH_77_TRD1_2X2_FINAL_110DEG NL=69
@@ -94,22 +96,6 @@ AliEMCALv0::AliEMCALv0(const char *name, const char *title)
   fShishKebabModules = geom->GetShishKebabTrd1Modules(); 
 }
 
-//______________________________________________________________________
-AliEMCALv0::AliEMCALv0(const AliEMCALv0 & emcal)
-  : AliEMCAL(emcal),
-    fShishKebabModules(emcal.fShishKebabModules),
-    fEnvelop1(emcal.fEnvelop1),
-    fIdRotm(emcal.fIdRotm),
-    fIdTmedArr(emcal.fIdTmedArr),
-    fSampleWidth(emcal.fSampleWidth),
-    fSmodPar0(emcal.fSmodPar0),
-    fSmodPar1(emcal.fSmodPar1),
-    fSmodPar2(emcal.fSmodPar2)
-{
-  //copy ctor
-  for(Int_t i = 0; i < 5; i++) fParEMOD[i] = emcal.fParEMOD[i];
-
-}
 //______________________________________________________________________
 void AliEMCALv0::BuildGeometry()
 {
@@ -144,6 +130,22 @@ void AliEMCALv0::BuildGeometry()
         TPGON *pgon = new TPGON(envn, "PGON that contains arm 1", "void", 
         geom->GetArm1PhiMin(),geom->GetArm1PhiMax()-geom->GetArm1PhiMin(),geom->GetNPhiSuperModule(), 2);
       // define section
+       if (fEnvelop1.GetSize()<8) {
+         fEnvelop1.Set(10);
+         fEnvelop1[0] = geom->GetArm1PhiMin(); // minimum phi angle
+         fEnvelop1[1] = geom->GetArm1PhiMax() - geom->GetArm1PhiMin(); // angular range in phi
+         fEnvelop1[2] = geom->GetNPhi(); // number of sections in phi
+         fEnvelop1[3] = 2; // 2 z coordinates
+         fEnvelop1[4] = -350.;
+         fEnvelop1[5] = geom->GetEnvelop(0) ; // rmin at z1
+         fEnvelop1[6] = geom->GetEnvelop(1) ; // rmax at z1
+         fEnvelop1[7] = 350.;
+         fEnvelop1[8] = fEnvelop1[5] ;        // radii are the same.
+         fEnvelop1[9] = fEnvelop1[6] ;        // radii are the same.
+         
+         if(gn.Contains("SHISH"))
+           fEnvelop1[2] = geom->GetNPhiSuperModule();
+       }
         pgon->DefineSection(0, fEnvelop1[4],  fEnvelop1[5], fEnvelop1[6]);
         pgon->DefineSection(1, fEnvelop1[7],  fEnvelop1[5], fEnvelop1[6]);
         top->cd();
@@ -369,7 +371,7 @@ void AliEMCALv0::CreateGeometry()
 
     if(gn.Contains("SHISH")){
       // COMPACT, TWIST, TRD2 or TRD1
-      AliInfo(Form("Shish-Kebab geometry : %s", GetTitle())); 
+      AliDebug(2,Form("Shish-Kebab geometry : %s", GetTitle())); 
       CreateShishKebabGeometry();
     }
 }
@@ -378,7 +380,7 @@ void AliEMCALv0::CreateGeometry()
 void AliEMCALv0::Init(void)
 {
     // Just prints an information message
-  
+  AliEMCAL::Init();
   if(AliLog::GetGlobalDebugLevel()>0) { 
     TString message("\n") ; 
     message += "*****************************************\n" ;
@@ -419,10 +421,10 @@ void AliEMCALv0::CreateShishKebabGeometry()
 
   CreateEmod("SMOD","EMOD"); // 18-may-05
 
-  if(gn.Contains("110DEG")) CreateEmod("SM10","EMOD"); // 12-oct-05
+  if(g->GetKey110DEG()) CreateEmod("SM10","EMOD"); // Nov 1,2006 
 
   // Sensitive SC  (2x2 tiles)
-  double parSCM0[5], *dummy = 0, parTRAP[11];
+  double parSCM0[5]={0,0,0,0}, *dummy = 0, parTRAP[11];
   Double_t trd1Angle = g->GetTrd1Angle()*TMath::DegToRad(), tanTmp = TMath::Tan(trd1Angle/2.);
    if(!gn.Contains("TRD")) { // standard module
     par[0] = (g->GetECPbRadThick()+g->GetECScintThick())*g->GetNECLayers()/2.;
@@ -459,7 +461,8 @@ void AliEMCALv0::CreateShishKebabGeometry()
       gMC->Gsvolu("SCM0", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
       gMC->Gspos("SCM0", 1, "EMOD", 0., 0., dzTmp/2., 0, "ONLY") ;
     } else { // before MAY 2005
-      double wallThickness = g->GetPhiModuleSize()/2. -  g->GetPhiTileSize(); // Need check
+      //      double wallThickness = g->GetPhiModuleSize()/2. -  g->GetPhiTileSize(); // Need check
+      double wallThickness = g->GetPhiModuleSize()/g->GetNPHIdiv() -  g->GetPhiTileSize();
       for(int i=0; i<3; i++) parSCM0[i] = fParEMOD[i] - wallThickness;
       parSCM0[3] = fParEMOD[3];
       gMC->Gsvolu("SCM0", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
@@ -518,13 +521,19 @@ void AliEMCALv0::CreateShishKebabGeometry()
         AliDebug(2,Form(" Number of Pb tiles in SCMX %i \n", nr));
       }
     } else if(g->GetNPHIdiv()==3 && g->GetNETAdiv()==3) {
+      printf(" before AliEMCALv0::Trd1Tower3X3() : parSCM0");
+      for(int i=0; i<4; i++) printf(" %7.4f ", parSCM0[i]);
+      printf("\n"); 
       Trd1Tower3X3(parSCM0);
+    } else if(g->GetNPHIdiv()==1 && g->GetNETAdiv()==1) {
+      // no division in SCM0
+      Trd1Tower1X1(parSCM0);
     } else if(g->GetNPHIdiv()==4 && g->GetNETAdiv()==4) {
       Trd1Tower4X4();
     }
   } else if(gn.Contains("TRD2")) {    // TRD2 - 14-jan-05
     //    Scm0InTrd2(g, fParEMOD, parSCM0); // First dessin 
-    PbmoInTrd2(g, fParEMOD, parSCM0); // Second dessi
+    PbmoInTrd2(g, fParEMOD, parSCM0); // Second desig
   }
 }
 
@@ -548,7 +557,7 @@ void AliEMCALv0::CreateSmod(const char* mother)
   int nphism = g->GetNumberOfSuperModules()/2; // 20-may-05
   if(nphism>0) {
     dphi = (g->GetArm1PhiMax() - g->GetArm1PhiMin())/nphism;
-    //    if(gn.Contains("110DEG")) dphi = (g->GetArm1PhiMax() - g->GetArm1PhiMin())/(nphism-1);
+    //    if(g->GetKey110DEG()) dphi = (g->GetArm1PhiMax() - g->GetArm1PhiMin())/(nphism-1);
     rpos = (g->GetEnvelop(0) + g->GetEnvelop(1))/2.;
     AliDebug(2,Form(" rpos %8.2f : dphi %6.1f degree \n", rpos, dphi));
   }
@@ -596,7 +605,7 @@ void AliEMCALv0::CreateSmod(const char* mother)
                    fIdTmedArr[kIdAIR], par[0],par[1],par[2]));
     fSmodPar0 = par[0]; 
     fSmodPar2 = par[2];
-    if(gn.Contains("110DEG")) { // 12-oct-05
+    if(g->GetKey110DEG()) { // 12-oct-05
       par1C = par[1];
       par[1] /= 2.;
       gMC->Gsvolu("SM10", "BOX", fIdTmedArr[kIdAIR], par, 3);
@@ -669,7 +678,7 @@ void AliEMCALv0::CreateSmod(const char* mother)
       nr++;
     } else { // TRD1 
       TString smName("SMOD"); // 12-oct-05
-      if(i==5 && gn.Contains("110DEG")) {
+      if(i==5 && g->GetKey110DEG()) {
         smName = "SM10";
         nrsmod = nr;
         nr     = 0;
@@ -682,7 +691,7 @@ void AliEMCALv0::CreateSmod(const char* mother)
       xpos = rpos * TMath::Cos(phiRad);
       ypos = rpos * TMath::Sin(phiRad);
       zpos = fSmodPar2; // 21-sep-04
-      if(i==5 && gn.Contains("110DEG")) {
+      if(i==5 && g->GetKey110DEG()) {
         xpos += (par1C/2. * TMath::Sin(phiRad)); 
         ypos -= (par1C/2. * TMath::Cos(phiRad)); 
       }
@@ -796,7 +805,7 @@ void AliEMCALv0::CreateEmod(const char* mother, const char* child)
           zpos = mod->GetPosZ() - fSmodPar2;
 
           int iyMax = g->GetNPhi();
-          if(strcmp(mother,"SMOD") && gn.Contains("110DEG")) {
+          if(strcmp(mother,"SMOD") && g->GetKey110DEG()) {
             iyMax /= 2;
           }
           for(int iy=0; iy<iyMax; iy++) { // flat in phi
@@ -878,13 +887,17 @@ void AliEMCALv0::CreateEmod(const char* mother, const char* child)
       }
     }
   }
-  AliDebug(2,Form(" Number of modules in Super Module %i \n", nr));
+  AliDebug(2,Form(" Number of modules in Super Module(%s) %i \n", mother, nr));
 }
 
-// 8-dec-04 by PAI
-void AliEMCALv0::Trd1Tower3X3(const double parSCM0[4])
+void AliEMCALv0::Trd1Tower3X3(const double *parSCM0)
 {
-  // PB should be for whole SCM0 - ?
+  // Started Dec 8,2004 by PAI
+  // Fixed Nov 13,2006
+  printf(" AliEMCALv0::Trd1Tower3X3() : parSCM0");
+  for(int i=0; i<4; i++) printf(" %7.4f ", parSCM0[i]);
+  printf("\n"); 
+  // Nov 10, 2006 - different name of SCMX
   double parTRAP[11], *dummy=0;
   AliEMCALGeometry * g = GetGeometry(); 
   TString gn(g->GetName()), scmx; 
@@ -896,16 +909,13 @@ void AliEMCALv0::Trd1Tower3X3(const double parSCM0[4])
   double ndiv=3., xpos=0.0;
   // should be defined once
   gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
-  if(gn.Contains("TEST")==0) { // one name for all trapesoid
-    scmx = "SCMX"; 
-    gMC->Gsvolu(scmx.Data(), "TRAP", fIdTmedArr[kIdSC], dummy, 0);
-  }
-
-  
   for(int ix=1; ix<=3; ix++) { // 3X3
+    scmx = "SCX"; // Nov 10,2006 
     // ix=1
     parTRAP[0] = dz;
-    parTRAP[1] = TMath::ATan2((dx2-dx1)/2.,2.*dz)*TMath::RadToDeg(); // theta
+    double xCentBot = 2.*dx1/3.;
+    double xCentTop = 2.*(dx2/4. + dx1/12.);
+    parTRAP[1] = TMath::ATan2((xCentTop-xCentBot),2.*dz)*TMath::RadToDeg(); // theta
     parTRAP[2] = 0.;           // phi
     // bottom
     parTRAP[3] = dy/ndiv;      // H1
@@ -914,10 +924,10 @@ void AliEMCALv0::Trd1Tower3X3(const double parSCM0[4])
     parTRAP[6] = 0.0;          // ALP1
     // top
     parTRAP[7] = dy/ndiv;      // H2
-    parTRAP[8] = dx2/ndiv;     // BL2
+    parTRAP[8] = dx2/2 - dx1/6.;// BL2
     parTRAP[9] = parTRAP[8];   // TL2
     parTRAP[10]= 0.0;          // ALP2
-    xpos = +(dx1+dx2)/3.;      // 6 or 3
+    xpos = (xCentBot+xCentTop)/2.;
 
     if      (ix==3) {
       parTRAP[1] = -parTRAP[1];
@@ -930,13 +940,11 @@ void AliEMCALv0::Trd1Tower3X3(const double parSCM0[4])
     }
     AliDebug(2,Form(" ** TRAP ** xpos %9.3f\n", xpos));
     for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
-    if(gn.Contains("TEST")){
-      scmx = "SCX"; scmx += ix;
-      gMC->Gsvolu(scmx.Data(), "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
-      gMC->Gspos(scmx.Data(), 1, "SCMY", xpos, 0.0, 0.0, 0, "ONLY") ;
-    } else {
-      gMC->Gsposp(scmx.Data(), ix, "SCMY", xpos, 0.0, 0.0, 0, "ONLY", parTRAP, 11) ;
-    }
+
+    scmx += ix;
+    gMC->Gsvolu(scmx.Data(), "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
+    gMC->Gspos(scmx.Data(), 1, "SCMY", xpos, 0.0, 0.0, 0, "ONLY") ;
+
     PbInTrap(parTRAP, scmx);
   }
   AliDebug(2,Form("Trd1Tower3X3()", "Ver. 1.0 : was tested."));
@@ -980,6 +988,59 @@ void AliEMCALv0::Trd1Tower4X4()
 {
  // Not ready yet
 }
+
+void AliEMCALv0::Trd1Tower1X1(double *parSCM0)
+{
+  // Started Nov 22,2006 by PAI
+  AliDebug(1," AliEMCALv0::Trd1Tower1X1() : parSCM0");
+  for(int i=0; i<4; i++) printf(" %7.4f ", parSCM0[i]);
+  printf("\n"); 
+
+  // No division - keeping the same volume logic 
+  // and as consequence the same abs is scheme
+  AliDebug(2,"Trd1Tower1X1() : Create SCMX(SCMY) as SCM0");
+
+  gMC->Gsvolu("SCMY", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
+  gMC->Gspos("SCMY", 1, "SCM0", 0.0, 0.0, 0.0, 0, "ONLY");
+  gMC->Gsvolu("SCMX", "TRD1", fIdTmedArr[kIdSC], parSCM0, 4);
+  gMC->Gspos("SCMX", 1, "SCMY", 0.0, 0.0, 0.0, 0, "ONLY");
+
+  // should be defined once
+  double *dummy=0;
+  gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
+
+  PbInTrd1(parSCM0, "SCMX");
+
+  AliDebug(1,"Trd1Tower1X1() : Ver. 0.1 : was tested.");
+}
+
+void AliEMCALv0::PbInTrd1(double *parTrd1, TString n)
+{
+ // see PbInTrap(const double parTrd1[11], TString n)
+  static int nr=0, ndeb=2;
+  AliDebug(ndeb,Form(" Pb tiles : nrstart %i\n", nr));
+  AliEMCALGeometry * g = GetGeometry(); 
+
+  double par[3];
+  //  double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
+  double xpos = 0.0, ypos = 0.0;
+  double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
+  double coef = (parTrd1[1] -  parTrd1[0]) / (2.*parTrd1[3]);
+
+  par[1] = parTrd1[2];              // y 
+  par[2] = g->GetECPbRadThick()/2.; // z
+
+  for(int iz=0; iz<g->GetNECLayers(); iz++){
+    par[0] = parTrd1[0] + coef*fSampleWidth*iz;
+    gMC->Gsposp("PBTI", ++nr, n.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ;
+    AliDebug(2,Form(" %i xpos %9.3f zpos %9.3f par[0] %9.3f |", iz+1, xpos, zpos, par[0]));
+    zpos += fSampleWidth;
+    if(iz%2>0) printf("\n");
+  } 
+  AliDebug(ndeb,Form(" Number of Pb tiles in SCMX %i coef %9.7f ", nr, coef));
+  AliDebug(ndeb,Form(" PbInTrd1 Ver. 0.1 : was tested."));
+}
+
 // 3-feb-05
 void AliEMCALv0::Scm0InTrd2(const AliEMCALGeometry * g, const Double_t emodPar[5], Double_t parSCM0[5])
 {
@@ -1250,34 +1311,26 @@ void AliEMCALv0::AddAlignableVolumes() const
 
   //Int_t nSMod = ((AliEMCALGeometry*)GetGeometry())->GetNumberOfSuperModules();
   //could use this, but what happens if it is > 10?
-
-  try{
-    for (Int_t smodnum=0; smodnum < 10; smodnum++) {
-      symname = snstr1;
-      symname += (smodnum+1);
-      volpath = vpstr1;
-      volpath += (smodnum+1);
-      gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data());
-    }
-  } catch (TString) {
-    AliFatal("Trying to set alignable entry with open geometry");
+  for (Int_t smodnum=0; smodnum < 10; smodnum++) {
+    symname = snstr1;
+    symname += (smodnum+1);
+    volpath = vpstr1;
+    volpath += (smodnum+1);
+    if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data()))
+      AliFatal("Unable to set alignable entry!!");
   }
 
-  TString gn( ((AliEMCALGeometry*)GetGeometry())->GetName() );
-  gn.ToUpper();
-  if(gn.Contains("110DEG")) {
+  if(GetGeometry()->GetKey110DEG()) {
     TString vpstr2 = "ALIC_1/XEN1_1/SM10_";
     TString snstr2 = "EMCAL/HalfSupermodule";    
-    try{
-      for (Int_t smodnum=0; smodnum < 2; smodnum++) {
-       symname = snstr2;
-       symname += (smodnum+1);
-       volpath = vpstr2;
-       volpath += (smodnum+1);
-       gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data());
-      }
-    } catch (TString) {
-      AliFatal("Trying to set alignable entry with open geometry");
+    for (Int_t smodnum=0; smodnum < 2; smodnum++) {
+      symname = snstr2;
+      symname += (smodnum+1);
+      volpath = vpstr2;
+      volpath += (smodnum+1);
+      if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data()))
+       AliFatal("Unable to set alignable entry!!");
     }
   }