]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONv1.cxx
Cast to avoid problems on Alpha
[u/mrichter/AliRoot.git] / MUON / AliMUONv1.cxx
index 71145092225d6fc4cb4ec8eaf072069e35ddb473..eaf30d6cf6d73d9e23f0ac1109ac129e42dba226 100644 (file)
 
 /*
 $Log$
+Revision 1.28  2001/05/16 14:57:17  alibrary
+New files for folders and Stack
+
+Revision 1.27  2001/04/06 11:24:43  morsch
+Dependency on implementations of AliSegmentation and AliMUONResponse moved to AliMUONFactory class.
+Static method Build() builds the MUON system out of chambers, segmentation and response.
+
+Revision 1.26  2001/03/17 10:07:20  morsch
+Correct inconsistent variable name / method name / comments.
+
 Revision 1.25  2001/03/16 15:32:06  morsch
 Corrections of overlap with beam shield and dipole (A. de Falco)
 
@@ -149,6 +159,7 @@ Log messages included.
 #include "AliMUONPadHit.h"
 #include "AliMUONConstants.h"
 #include "AliMUONTriggerCircuit.h"
+#include "AliMUONFactory.h"
 
 ClassImp(AliMUONv1)
  
@@ -164,6 +175,7 @@ AliMUONv1::AliMUONv1(const char *name, const char *title)
        : AliMUON(name,title)
 {
 // Constructor
+    AliMUONFactory::Build(this, title);
 }
 
 //___________________________________________
@@ -656,11 +668,26 @@ void AliMUONv1::CreateGeometry()
      tpar[0] = iChamber->RInner()-dframep; 
      tpar[1] = (iChamber->ROuter()+dframep)/TMath::Cos(phi);
      tpar[2] = dstation/5;
-     gMC->Gsvolu("C05M", "TUBE", idAir, tpar, 3);
-     gMC->Gsvolu("C06M", "TUBE", idAir, tpar, 3);
-     gMC->Gspos("C05M", 1, "ALIC", 0., 0., zpos1 , 0, "MANY");
-     gMC->Gspos("C06M", 1, "ALIC", 0., 0., zpos2 , 0, "MANY");
+
+     char *slats5Mother = "C05M";
+     char *slats6Mother = "C06M";
+     Float_t zoffs5 = 0;
+     Float_t zoffs6 = 0;
+
+     if (gMC->VolId("DDIP")) {
+       slats5Mother="DDIP";
+       slats6Mother="DDIP";
+
+       zoffs5 = zpos1;
+       zoffs6 = zpos2;
+     }
+     else {
+       gMC->Gsvolu("C05M", "TUBE", idAir, tpar, 3);
+       gMC->Gsvolu("C06M", "TUBE", idAir, tpar, 3);
+       gMC->Gspos("C05M", 1, "ALIC", 0., 0., zpos1 , 0, "ONLY");
+       gMC->Gspos("C06M", 1, "ALIC", 0., 0., zpos2 , 0, "ONLY");
+     }
+
      // volumes for slat geometry (xx=5,..,10 chamber id): 
      // Sxx0 Sxx1 Sxx2 Sxx3  -->   Slat Mother volumes 
      // SxxG                          -->   Sensitive volume (gas)
@@ -721,20 +748,20 @@ void AliMUONv1::CreateGeometry()
        Float_t zSlat = (i%2 ==0)? -spar[2] : spar[2]; 
        sprintf(volNam5,"S05%d",i);
        gMC->Gsvolu(volNam5,"BOX",slatMaterial,spar2,3);
-       gMC->Gspos(volNam5, i*4+1,"C05M", xSlat32, ySlat31, zSlat+2.*dzCh3, 0, "ONLY");
-       gMC->Gspos(volNam5, i*4+2,"C05M",-xSlat32, ySlat31, zSlat-2.*dzCh3, 0, "ONLY");
+       gMC->Gspos(volNam5, i*4+1,slats5Mother, xSlat32, ySlat31, zoffs5+zSlat+2.*dzCh3, 0, "ONLY");
+       gMC->Gspos(volNam5, i*4+2,slats5Mother,-xSlat32, ySlat31, zoffs5+zSlat-2.*dzCh3, 0, "ONLY");
        
        if (i>0) { 
-        gMC->Gspos(volNam5, i*4+3,"C05M", xSlat32, ySlat32, zSlat+2.*dzCh3, 0, "ONLY");
-        gMC->Gspos(volNam5, i*4+4,"C05M",-xSlat32, ySlat32, zSlat-2.*dzCh3, 0, "ONLY");
+        gMC->Gspos(volNam5, i*4+3,slats5Mother, xSlat32, ySlat32, zoffs5+zSlat+2.*dzCh3, 0, "ONLY");
+        gMC->Gspos(volNam5, i*4+4,slats5Mother,-xSlat32, ySlat32, zoffs5+zSlat-2.*dzCh3, 0, "ONLY");
        }
        sprintf(volNam6,"S06%d",i);
        gMC->Gsvolu(volNam6,"BOX",slatMaterial,spar,3);
-       gMC->Gspos(volNam6, i*4+1,"C06M", xSlat3, ySlat31, zSlat+2.*dzCh3, 0, "ONLY");
-       gMC->Gspos(volNam6, i*4+2,"C06M",-xSlat3, ySlat31, zSlat-2.*dzCh3, 0, "ONLY");
+       gMC->Gspos(volNam6, i*4+1,slats6Mother, xSlat3, ySlat31, zoffs6+zSlat+2.*dzCh3, 0, "ONLY");
+       gMC->Gspos(volNam6, i*4+2,slats6Mother,-xSlat3, ySlat31, zoffs6+zSlat-2.*dzCh3, 0, "ONLY");
        if (i>0) { 
-        gMC->Gspos(volNam6, i*4+3,"C06M", xSlat3, ySlat32, zSlat+2.*dzCh3, 0, "ONLY");
-        gMC->Gspos(volNam6, i*4+4,"C06M",-xSlat3, ySlat32, zSlat-2.*dzCh3, 0, "ONLY");
+        gMC->Gspos(volNam6, i*4+3,slats6Mother, xSlat3, ySlat32, zoffs6+zSlat+2.*dzCh3, 0, "ONLY");
+        gMC->Gspos(volNam6, i*4+4,slats6Mother,-xSlat3, ySlat32, zoffs6+zSlat-2.*dzCh3, 0, "ONLY");
        }
      }
 
@@ -891,18 +918,17 @@ void AliMUONv1::CreateGeometry()
        Float_t xvol=(pcbLength+xdiv)/2.+1.999;
        Float_t yvol=ydiv + dydiv/2.; 
        //printf ("y ll = %f y ur = %f \n",yvol - divpar[1], yvol + divpar[1]); 
-       gMC->Gsposp("S05G",imax+4*idiv+1,"C05M", xvol, yvol, z1+z2, 0, "ONLY",divpar,3);
-       gMC->Gsposp("S06G",imax+4*idiv+1,"C06M", xvol, yvol, z1+z2, 0, "ONLY",divpar,3);
-       gMC->Gsposp("S05G",imax+4*idiv+2,"C05M", xvol,-yvol, z1+z2, 0, "ONLY",divpar,3);
-       gMC->Gsposp("S06G",imax+4*idiv+2,"C06M", xvol,-yvol, z1+z2, 0, "ONLY",divpar,3);
-       gMC->Gsposp("S05G",imax+4*idiv+3,"C05M",-xvol, yvol, z1-z2, 0, "ONLY",divpar,3);
-       gMC->Gsposp("S06G",imax+4*idiv+3,"C06M",-xvol, yvol, z1-z2, 0, "ONLY",divpar,3);
-       gMC->Gsposp("S05G",imax+4*idiv+4,"C05M",-xvol,-yvol, z1-z2, 0, "ONLY",divpar,3);
-       gMC->Gsposp("S06G",imax+4*idiv+4,"C06M",-xvol,-yvol, z1-z2, 0, "ONLY",divpar,3);
+       gMC->Gsposp("S05G",imax+4*idiv+1,slats5Mother, xvol, yvol, zoffs5+z1+z2, 0, "ONLY",divpar,3);
+       gMC->Gsposp("S06G",imax+4*idiv+1,slats6Mother, xvol, yvol, zoffs6+z1+z2, 0, "ONLY",divpar,3);
+       gMC->Gsposp("S05G",imax+4*idiv+2,slats5Mother, xvol,-yvol, zoffs5+z1+z2, 0, "ONLY",divpar,3);
+       gMC->Gsposp("S06G",imax+4*idiv+2,slats6Mother, xvol,-yvol, zoffs6+z1+z2, 0, "ONLY",divpar,3);
+       gMC->Gsposp("S05G",imax+4*idiv+3,slats5Mother,-xvol, yvol, zoffs5+z1-z2, 0, "ONLY",divpar,3);
+       gMC->Gsposp("S06G",imax+4*idiv+3,slats6Mother,-xvol, yvol, zoffs6+z1-z2, 0, "ONLY",divpar,3);
+       gMC->Gsposp("S05G",imax+4*idiv+4,slats5Mother,-xvol,-yvol, zoffs5+z1-z2, 0, "ONLY",divpar,3);
+       gMC->Gsposp("S06G",imax+4*idiv+4,slats6Mother,-xvol,-yvol, zoffs6+z1-z2, 0, "ONLY",divpar,3);
      }
      }
      
-
  if (stations[3]) {
 
 //********************************************************************
@@ -922,7 +948,7 @@ void AliMUONv1::CreateGeometry()
 //   Mother volume
      tpar[0] = iChamber->RInner()-dframep; 
      tpar[1] = (iChamber->ROuter()+dframep)/TMath::Cos(phi);
-     tpar[2] = dstation/5;
+     tpar[2] = dstation/4;
 
      gMC->Gsvolu("C07M", "TUBE", idAir, tpar, 3);
      gMC->Gsvolu("C08M", "TUBE", idAir, tpar, 3);
@@ -945,7 +971,7 @@ void AliMUONv1::CreateGeometry()
      for (i = 0; i<nSlats4; i++){
        slatLength4[i] = pcbLength * nPCB4[i] + 2. * dSlatLength; 
        xSlat4 = slatLength4[i]/2. - vFrameLength/2. + xpos4[i]; 
-       if (i==1 || i==0) slatLength4[i] -=  2. *dSlatLength; // frame out in PCB with circular border 
+       if (i==1) slatLength4[i] -=  2. *dSlatLength; // frame out in PCB with circular border 
        ySlat4 =  sensHeight * i - yOverlap *i;
        
        spar[0] = slatLength4[i]/2.; 
@@ -1966,7 +1992,7 @@ void AliMUONv1::Init()
    // Initialize Tracking Chambers
    //
 
-   printf("\n\n\n Start Init for version 1 - CPC chamber type\n\n\n");
+   if(fDebug) printf("\n%s: Start Init for version 1 - CPC chamber type\n\n",ClassName());
    Int_t i;
    for (i=0; i<AliMUONConstants::NCh(); i++) {
        ( (AliMUONChamber*) (*fChambers)[i])->Init();
@@ -1995,14 +2021,14 @@ void AliMUONv1::Init()
    ((AliMUONChamber*)(*fChambers)[12])->SetGid(gMC->VolId("CG3A"));
    ((AliMUONChamber*)(*fChambers)[13])->SetGid(gMC->VolId("CG4A"));
 
-   printf("\n\n\n Finished Init for version 0 - CPC chamber type\n\n\n");
+   if(fDebug) printf("\n%s: Finished Init for version 1 - CPC chamber type\n",ClassName());
 
    //cp 
-   printf("\n\n\n Start Init for Trigger Circuits\n\n\n");
+   if(fDebug) printf("\n%s: Start Init for Trigger Circuits\n",ClassName());
    for (i=0; i<AliMUONConstants::NTriggerCircuit(); i++) {
      ( (AliMUONTriggerCircuit*) (*fTriggerCircuits)[i])->Init(i);
    }
-   printf(" Finished Init for Trigger Circuits\n\n\n");
+   if(fDebug) printf("%s: Finished Init for Trigger Circuits\n",ClassName());
    //cp
 
 }