]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - FMD/AliFMDRing.cxx
Removing extra semicolons (FedoraCore3, gcc 3.4.2)
[u/mrichter/AliRoot.git] / FMD / AliFMDRing.cxx
index 34107fdc44a14183127d26dd1fd08f517a863b1b..3069216e3d78ea07851cae2a3da8ee649887a6c9 100644 (file)
 // Latest changes by Christian Holm Christensen
 //
 
-#include <math.h>
-
+#include <math.h>               // fmod
+#include <AliLog.h>            // ALILOG_H
 #include "AliFMDRing.h"                // ALIFMDRING_H
-#include "AliLog.h"            // ALILOG_H
-#include "TMath.h"             // ROOT_TMath
-#include "TH2.h"               // ROOT_TH2
-#include "TVirtualMC.h"                // ROOT_TVirtualMC
-#include "TVector2.h"          // ROOT_TVector2
-#include "TBrowser.h"          // ROOT_TBrowser
-#include "TString.h"           // ROOT_TString
-#include "TArc.h"              // ROOT_TArc
-#include "TObjArray.h"         // ROOT_TObjArray
-#include "TXTRU.h"             // ROOT_TXTRU
-#include "TNode.h"             // ROOT_TNode
-#include "TRotMatrix.h"                // ROOT_TRotMatrix
-#include "TList.h"             // ROOT_TList
-
-const Char_t* AliFMDRing::fgkRingFormat         = "FRG%c";
-const Char_t* AliFMDRing::fgkVirtualFormat      = "FV%c%c";
-const Char_t* AliFMDRing::fgkActiveFormat       = "FAC%c";
-const Char_t* AliFMDRing::fgkSectorFormat       = "FSE%c";
-const Char_t* AliFMDRing::fgkStripFormat        = "FST%c";
-const Char_t* AliFMDRing::fgkPrintboardFormat   = "FP%c%c";
+#include "AliFMD.h"            // ALIFMD_H
+#include <TMath.h>             // ROOT_TMath
+#include <TH2.h>               // ROOT_TH2
+#include <TVirtualMC.h>                // ROOT_TVirtualMC
+#include <TVector2.h>          // ROOT_TVector2
+#include <TBrowser.h>          // ROOT_TBrowser
+#include <TString.h>           // ROOT_TString
+#include <TArc.h>              // ROOT_TArc
+#include <TObjArray.h>         // ROOT_TObjArray
+#include <TXTRU.h>             // ROOT_TXTRU
+#include <TNode.h>             // ROOT_TNode
+#include <TRotMatrix.h>                // ROOT_TRotMatrix
+#include <TList.h>             // ROOT_TList
+
+const Char_t* AliFMDRing::fgkRingFormat         = "F%cRG";
+const Char_t* AliFMDRing::fgkVirtualFormat      = "F%cV%c";
+const Char_t* AliFMDRing::fgkActiveFormat       = "F%cAC";
+const Char_t* AliFMDRing::fgkSectorFormat       = "F%cAP";
+const Char_t* AliFMDRing::fgkStripFormat        = "F%cAR";
+const Char_t* AliFMDRing::fgkPrintboardFormat   = "F%cP%c";
 
 
 //____________________________________________________________________
-ClassImp(AliFMDRing);
+ClassImp(AliFMDRing)
 
 //____________________________________________________________________
 AliFMDRing::AliFMDRing(Char_t id, Bool_t detailed) 
@@ -178,7 +178,7 @@ AliFMDRing::Init()
 {
   // Initialize the ring object.
   // DebugGuard guard("AliFMDRing::Init");
-  AliDebug(10, "AliFMDRing::Init");
+  AliDebug(30, Form("\tInitializing ring %c", fId));
   fPolygon.Clear();
   SetupCoordinates();  
 }
@@ -187,6 +187,7 @@ AliFMDRing::Init()
 AliFMDRing::~AliFMDRing() 
 {
   // Destructor - deletes shape and rotation matricies 
+  AliDebug(30, Form("\tDestructing ring %c", fId));
   if (fShape) delete fShape;
   if (fRotMatricies) delete fRotMatricies;
 }
@@ -197,7 +198,7 @@ void
 AliFMDRing::Browse(TBrowser* /* b */)
 {
   // DebugGuard guard("AliFMDRing::Browse");
-  AliDebug(10, "AliFMDRing::Browse");
+  AliDebug(30, Form("\tBrowsing ring %c", fId));
 }
 
   
@@ -207,10 +208,11 @@ AliFMDRing::SetupCoordinates()
 {
   // Calculates the parameters of the polygon shape. 
   // 
-  // DebugGuard guard("AliFMDRing::SetupCoordinates");
-  AliDebug(10, "AliFMDRing::SetupCoordinates");
+  //
+
   // Get out immediately if we have already done all this 
   if (fPolygon.GetNVerticies() > 1) return;
+  AliDebug(10, Form("\tSetting up the coordinates for ring %c", fId));
 
   double tanTheta  = TMath::Tan(fTheta * TMath::Pi() / 180.);
   double tanTheta2 = TMath::Power(tanTheta,2);
@@ -221,7 +223,7 @@ AliFMDRing::SetupCoordinates()
   double xD        = fLowR + TMath::Sqrt(r2 - tanTheta2 * lr2);
   double xD2       = TMath::Power(xD,2);
   //double xD_2      = fLowR - TMath::Sqrt(r2 - tanTheta2 * lr2);
-  double yB        = sqrt(r2 - hr2 + 2 * fHighR * xD - xD2);
+  double yB        = TMath::Sqrt(r2 - hr2 + 2 * fHighR * xD - xD2);
   double xC        = ((xD + TMath::Sqrt(-tanTheta2 * xD2 + r2 
                                        + r2 * tanTheta2)) 
                       / (1 + tanTheta2));
@@ -242,7 +244,8 @@ AliFMDRing::IsWithin(size_t moduleNo, double x, double y) const
   // Checks if a point (x,y) is inside the module with number moduleNo 
   //
   // DebugGuard guard("AliFMDRing::IsWithin");
-  AliDebug(10, "AliFMDRing::IsWithin");
+  AliDebug(20, Form("\tChecking wether the hit at (%lf,%lf) in module %d "
+                   "is within this ring (%c)", x, y, moduleNo, fId));
   bool   ret            = false;
   double r2             = x * x + y * y;
   if (r2 < fHighR * fHighR && r2 > fLowR * fLowR) {
@@ -272,7 +275,7 @@ AliFMDRing::Draw(Option_t* option) const
   // hits in the detector. 
   // 
   // DebugGuard guard("AliFMDRing::Draw");
-  AliDebug(10, "AliFMDRing::Draw");
+  AliDebug(20, Form("\tDrawing ring %c", fId));
   // The unrotated coordinates of the polygon verticies
   if (fPolygon.GetNVerticies() < 1) return;
   
@@ -354,7 +357,7 @@ AliFMDRing::SetupGeometry(Int_t vacuumId, Int_t siId, Int_t pcbId,
   //   idRotId         Identity rotation matrix 
   //
   // DebugGuard guard("AliFMDRing::SetupGeometry");
-  AliDebug(10, "AliFMDRing::SetupGeometry");
+  AliDebug(10, Form("\tSetting up the geometry for ring %c", fId));
 
   const TVector2& bCorner   = fPolygon.GetVertex(3); // Third  corner
   const TVector2& aCorner   = fPolygon.GetVertex(5); // First  corner
@@ -382,12 +385,12 @@ AliFMDRing::SetupGeometry(Int_t vacuumId, Int_t siId, Int_t pcbId,
   pars[1]             = rmax;
   pars[3]             = -fTheta;
   pars[4]             =  fTheta;
-  name                = Form(fgkVirtualFormat, 'F', fId);
+  name                = Form(fgkVirtualFormat, fId, 'F');
   fVirtualFrontId     = gMC->Gsvolu(name.Data(), "TUBS", vacuumId, pars, 5);
 
   // Virtual volume for modules with long legs 
   pars[2]             =  (fRingDepth - fModuleSpacing) / 2;
-  name                =  Form(fgkVirtualFormat, 'B', fId);
+  name                =  Form(fgkVirtualFormat, fId, 'B');
   fVirtualBackId      =  gMC->Gsvolu(name.Data(), "TUBS", vacuumId, pars, 5);
   
   // Virtual mother volume for silicon
@@ -417,14 +420,14 @@ AliFMDRing::SetupGeometry(Int_t vacuumId, Int_t siId, Int_t pcbId,
   pars[1]             = bCorner.Y() - pars[4];
   pars[2]             = fPrintboardThickness / 2; // PCB half thickness
   pars[3]             = (bCorner.X() - cCorner.X()) / 2;
-  name                = Form(fgkPrintboardFormat, 'T', fId);
+  name                = Form(fgkPrintboardFormat, fId, 'T');
   fPrintboardTopId    = gMC->Gsvolu(name.Data(), "TRD1", pcbId, pars, 4);
 
   // Bottom of the print board
   pars[0]             = aCorner.Y() - pars[4];
   pars[1]             = cCorner.Y() - pars[4];
   pars[3]             = (cCorner.X() - aCorner.X()) / 2;
-  name                = Form(fgkPrintboardFormat, 'B', fId);
+  name                = Form(fgkPrintboardFormat, fId, 'B');
   fPrintboardBottomId = gMC->Gsvolu(name.Data(), "TRD1", pcbId, pars, 4);
 
   // Define rotation matricies
@@ -457,9 +460,10 @@ AliFMDRing::SetupGeometry(Int_t vacuumId, Int_t siId, Int_t pcbId,
     Double_t  w       = fRingDepth - (isFront ? 0 : fModuleSpacing);
 
     // Place virtual module volume 
-    name = Form(fgkVirtualFormat, (isFront ? 'F' : 'B'), fId);
+    name = Form(fgkVirtualFormat, fId, (isFront ? 'F' : 'B'));
     dz   = (w - fRingDepth) / 2;
-    gMC->Gspos(name.Data(), id, name2.Data(), 0., 0., dz,fRotations[i]);
+    gMC->Gspos(name.Data(), id, name2.Data(), 0., 0., dz,fRotations[i], 
+              "ONLY");
 
     // We only need to place the children once, they are copied when
     // we place the other virtual volumes. 
@@ -470,14 +474,14 @@ AliFMDRing::SetupGeometry(Int_t vacuumId, Int_t siId, Int_t pcbId,
     // the silicon is on the edge of the virtual volume. 
     name  = Form(fgkActiveFormat, fId);
     dz    = (w - fSiThickness) / 2;
-    gMC->Gspos(name.Data(), id, name2.Data(),0.,0.,dz,idRotId);
+    gMC->Gspos(name.Data(), id, name2.Data(),0.,0.,dz,idRotId, "ONLY");
 
     // Place print board.  This is put immediately behind the silicon
-    name = Form(fgkPrintboardFormat, 'T', fId);
+    name = Form(fgkPrintboardFormat, fId, 'T');
     dz   =  w / 2 - fSiThickness - fPrintboardThickness / 2;
     gMC->Gspos(name.Data(), id, name2.Data(), 
               fLowR + pbBotL + pbTopL / 2, 0, dz, pbRotId, "ONLY");
-    name = Form(fgkPrintboardFormat, 'B', fId);
+    name = Form(fgkPrintboardFormat, fId, 'B');
     gMC->Gspos(name.Data(), id, name2.Data(), 
               fLowR + pbBotL / 2, 0, dz, pbRotId, "ONLY");
 
@@ -485,12 +489,14 @@ AliFMDRing::SetupGeometry(Int_t vacuumId, Int_t siId, Int_t pcbId,
     // This is put immediately behind the pringboard. 
     dz     = (w / 2 - fSiThickness - fPrintboardThickness 
             - (fLegLength + (isFront ? fModuleSpacing : 0)) /2);
-    name  = (isFront ? "FLL" : "FSL");
+    name  = (isFront ? AliFMD::fgkLongLegName : AliFMD::fgkShortLegName);
     gMC->Gspos(name.Data(), id*10 + 1, name2.Data(), 
-              aCorner.X() + fLegOffset + fLegRadius, 0., dz, idRotId, "");
+              aCorner.X() + fLegOffset + fLegRadius, 0., dz, idRotId, "ONLY");
     Double_t y = cCorner.Y() - yoffset - fLegOffset - fLegRadius;
-    gMC->Gspos(name.Data(),id*10+2,name2.Data(),cCorner.X(), y,dz,idRotId,"");
-    gMC->Gspos(name.Data(),id*10+3,name2.Data(),cCorner.X(), -y,dz,idRotId,"");
+    gMC->Gspos(name.Data(),id*10+2,name2.Data(),cCorner.X(),y,dz,
+              idRotId,"ONLY");
+    gMC->Gspos(name.Data(),id*10+3,name2.Data(),cCorner.X(),-y,dz,
+              idRotId,"ONLY");
   }
 }
 //____________________________________________________________________
@@ -510,13 +516,15 @@ AliFMDRing::Geometry(const char* mother, Int_t baseId, Double_t z,
   //    idRotId   Identity rotation matrix 
   // 
   // DebugGuard guard("AliFMDRing::Geometry");
-  AliDebug(10, "AliFMDRing::Geometry");
   TString  name;
   Double_t offsetZ   = (fSiThickness 
                        + fPrintboardThickness 
                        + fLegLength + fModuleSpacing) / 2;
   name = Form(fgkRingFormat, fId);
-  gMC->Gspos(name.Data(), baseId, mother, 0., 0., z - offsetZ, idRotId, "");
+  AliDebug(10, Form("\tPlacing ring %s in %s at z=%lf-%lf=%lf (base ID: %d)", 
+                   name.Data(), mother, z, offsetZ, z-offsetZ, baseId));
+  gMC->Gspos(name.Data(), baseId, mother, 0., 0., z - offsetZ, idRotId, 
+            "ONLY");
 }
 
 //____________________________________________________________________
@@ -542,11 +550,14 @@ AliFMDRing::SimpleGeometry(TList* nodes,
   //    n         Detector number
   //
   // DebugGuard guard("AliFMDRing::SimpleGeometry");
-  AliDebug(10, "AliFMDRing::SimpleGeometry");
   SetupCoordinates();
 
+  AliDebug(10, Form("\tCreating simple geometry for "
+                   "ring %c at z=%lf cm in %s", 
+                   fId, z, mother->GetName()));
   // If the shape hasn't been defined yet, we define it here. 
   if (!fShape) {
+
     TString name(Form(fgkActiveFormat, fId));
     TString title(Form("Shape of modules in %c Rings", fId));
     Int_t n = fPolygon.GetNVerticies();
@@ -607,24 +618,30 @@ AliFMDRing::Gsatt()
   // Set drawing attributes for the RING 
   // 
   // DebugGuard guard("AliFMDRing::Gsatt");
-  AliDebug(10, "AliFMDRing::Gsatt");
+  AliDebug(10, Form("\tSetting drawing attributes for Ring %c", fId));
   TString name;
   name = Form(fgkRingFormat,fId);
   gMC->Gsatt(name.Data(), "SEEN", 0);
 
-  name = Form(fgkVirtualFormat, 'T', fId);
+  name = Form(fgkVirtualFormat, fId, 'F');
   gMC->Gsatt(name.Data(), "SEEN", 0);
 
-  name = Form(fgkVirtualFormat, 'B', fId);
+  name = Form(fgkVirtualFormat, fId, 'B');
   gMC->Gsatt(name.Data(), "SEEN", 0);
 
   name = Form(fgkActiveFormat,fId);
   gMC->Gsatt(name.Data(), "SEEN", 1);
 
-  name = Form(fgkPrintboardFormat, 'T', fId);
+  name = Form(fgkSectorFormat,fId);
+  gMC->Gsatt(name.Data(), "SEEN", 0);
+
+  name = Form(fgkStripFormat,fId);
+  gMC->Gsatt(name.Data(), "SEEN", 0);
+
+  name = Form(fgkPrintboardFormat, fId, 'T');
   gMC->Gsatt(name.Data(), "SEEN", 1);
 
-  name = Form(fgkPrintboardFormat, 'B',fId);
+  name = Form(fgkPrintboardFormat, fId, 'B');
   gMC->Gsatt(name.Data(), "SEEN", 1);
 }