]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALShishKebabModule.cxx
updates for Effective C++ compiler flags
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALShishKebabModule.cxx
index d804819313913a2c0951965190ea87c17cb09daf..46813b0607239c64c16bd273a4dd89ef26b89cf0 100644 (file)
@@ -1,5 +1,5 @@
 /**************************************************************************
- * Copyright(c) 1998-2004, ALICE Experiment at CERN, All rights reserved. *
+ * Copyright(c) 1998-2006, ALICE Experiment at CERN, All rights reserved. *
  *                                                                        *
  * Author: The ALICE Off-line Project.                                    *
  * Contributors are mentioned in the code where appropriate.              *
 
 /* $Id$ */
 
-//*-- Author: Aleksei Pavlinov(WSU)
+//_________________________________________________________________________
+// Main class for "twist" geometry of Shish-Kebab case.
+// Author: Aleksei Pavlinov(WSU).
+// Sep 20004.
+// See web page with description of Shish-Kebab geometries:
+// http://pdsfweb01.nersc.gov/~pavlinov/ALICE/SHISHKEBAB/RES/shishkebabALICE.html
+//_________________________________________________________________________
+
 #include "AliEMCALShishKebabModule.h"
 #include "AliEMCALGeometry.h"
-#include <TMath.h>
 #include <TGraph.h>
-
-#include <assert.h>
+#include <TMath.h>
 
 ClassImp(AliEMCALShishKebabModule)
 
@@ -30,25 +35,56 @@ ClassImp(AliEMCALShishKebabModule)
   Double_t AliEMCALShishKebabModule::fgb=0.; 
   Double_t AliEMCALShishKebabModule::fgr=0.; 
 
-AliEMCALShishKebabModule::AliEMCALShishKebabModule(double theta) : TNamed()
-{ // theta in radians ; first object shold be with theta=pi/2.
-  fTheta = theta;
+//_________________________________________________________________________
+AliEMCALShishKebabModule::AliEMCALShishKebabModule() 
+  : TNamed(),
+    fOK(0),
+    fA(0.),
+    fB(0.),
+    fTheta(0.)
+{ 
+  // theta in radians ; first object shold be with theta=pi/2.
   if(fgGeometry==0) {
+    fTheta = TMath::PiOver2();
     if(GetParameters()) {
       DefineFirstModule();
+      DefineName(fTheta);
     }
-  } else Warning("AliEMCALShishKebabModule(theta)","You should call this constractor just once !!");
-  DefineName(fTheta);
+  } else {
+    Warning("AliEMCALShishKebabModule(theta)","You should call this constractor just once !!");
+  }
 }
 
-AliEMCALShishKebabModule::AliEMCALShishKebabModule(AliEMCALShishKebabModule &leftNeighbor) : TNamed()
-{ // 22-sep-04
+//_________________________________________________________________________
+AliEMCALShishKebabModule::AliEMCALShishKebabModule(AliEMCALShishKebabModule &leftNeighbor) 
+  : TNamed(),
+    fOK(0),
+    fA(0.),
+    fB(0.),
+    fTheta(0.)
+{ 
+  // 22-sep-04
   TObject::SetUniqueID(leftNeighbor.GetUniqueID()+1);
   Init(leftNeighbor.GetA(),leftNeighbor.GetB());
 }
 
-void AliEMCALShishKebabModule::Init(double A, double B)
+//_________________________________________________________________________
+AliEMCALShishKebabModule::AliEMCALShishKebabModule(const AliEMCALShishKebabModule& mod) 
+  : TNamed(mod.GetName(),mod.GetTitle()),
+    fOK(mod.fOK),
+    fA(mod.fA),
+    fB(mod.fB),
+    fTheta(mod.fTheta)
+{
+  //copy ctor
+}
+
+//_________________________________________________________________________
+void AliEMCALShishKebabModule::Init(Double_t A, Double_t B)
 { 
+  //
+  // Initialisation method
+  //
   Double_t thetaMin, thetaMax, par[4];
   Int_t npar=0;
   if(A<0){
@@ -76,8 +112,10 @@ void AliEMCALShishKebabModule::Init(double A, double B)
   DefineName(fTheta);
 }
 
+//_________________________________________________________________________
 void AliEMCALShishKebabModule::DefineFirstModule()
 {
+  // Define first module
   fOK.Set(fga/2., fgr + fgb/2.); // position the center of module vs o
 
   fB = fga/2.;    // z=fB
@@ -85,6 +123,7 @@ void AliEMCALShishKebabModule::DefineFirstModule()
   TObject::SetUniqueID(1); //
 }
 
+//_________________________________________________________________________
 void AliEMCALShishKebabModule::DefineSecondModuleFirstAssumption()
 { // Keep for testing and checking
   // cos(theta) << 1, theta ~ pi/2.; a/r = 11.4/462.54 = 0.0246465 << 1; 
@@ -101,23 +140,27 @@ void AliEMCALShishKebabModule::DefineSecondModuleFirstAssumption()
   */
 }
 
+//_________________________________________________________________________
 Double_t AliEMCALShishKebabModule::Solve(Double_t (*fcn)(Double_t*,Double_t*), 
 Double_t xmin, Double_t xmax, Int_t npar, Double_t *par, Double_t eps, Int_t maxIter)
 {
+  // Find out "zero" using TGraph method
   if(npar); // unused now
   TGraph gr;
-  double X,Y;
+  Double_t x,y;
   Int_t k = 0;
-  gr.Zero(k, xmin,xmax, eps, X,Y, maxIter); // remember initial interval
+  gr.Zero(k, xmin,xmax, eps, x,y, maxIter); // remember initial interval
   while(k!=2) {
-    Y = fcn(&X, par); 
-    gr.Zero(k, xmin,xmax, eps, X,Y, maxIter);
+    y = fcn(&x, par); 
+    gr.Zero(k, xmin,xmax, eps, x,y, maxIter);
   }
-  return X;
+  return x;
 }
 
-Double_t AliEMCALShishKebabModule::Y2(double *x, double *par)
-{ // For position calulation of second module
+//_________________________________________________________________________
+Double_t AliEMCALShishKebabModule::Y2(Double_t *x, Double_t *par)
+{ 
+  // For position calulation of second module
   if(par);
   Double_t theta = x[0];
   Double_t cos = TMath::Cos(theta);
@@ -128,32 +171,34 @@ Double_t AliEMCALShishKebabModule::Y2(double *x, double *par)
   return y;
 }
 
-Double_t AliEMCALShishKebabModule::YALL(double *x, double *par)
-{ // For position calulation of 3th, 4th to 30th modules
-  Double_t a=par[0], r=par[1], A=par[2], B=par[3]; 
+//_________________________________________________________________________
+Double_t AliEMCALShishKebabModule::YALL(Double_t *x, Double_t *par)
+{ 
+  // For position calulation of 3th, 4th to 30th modules
+  Double_t a=par[0], r=par[1], aa=par[2], bb=par[3]; 
   Double_t theta = x[0];
   Double_t cos = TMath::Cos(theta);
   Double_t sin = TMath::Sin(theta);
 
   Double_t y1  = r + a*cos;       
-  Double_t y2  = A*(r*cos/sin + a/(2.*sin) - a*sin) + B;
+  Double_t y2  = aa*(r*cos/sin + a/(2.*sin) - a*sin) + bb;
   Double_t y   = y1-y2;
   //  printf(" theta %f Y %12.5e \n", theta, y);
   return y;
 }
 
-void AliEMCALShishKebabModule::DefineName(double theta)
+//_________________________________________________________________________
+void AliEMCALShishKebabModule::DefineName(Double_t theta)
 {
-  char name[100];
-  // sprintf(name,"theta_%5.2f",theta*180./TMath::Pi());
-  sprintf(name,"%2i(%5.2f)", TObject::GetUniqueID(), theta*180./TMath::Pi());
-  SetName(name);
+  // Define name of object
+  SetName(Form("%2i(%5.2f)", TObject::GetUniqueID(), theta*TMath::RadToDeg()));
 }
 
+//_________________________________________________________________________
 Bool_t AliEMCALShishKebabModule::GetParameters()
 {
+  // Get needing module parameters from EMCAL geometry
   fgGeometry = AliEMCALGeometry::GetInstance();
-  //  if(!fgGeometry) assert(0);
   if(!fgGeometry) {
     Warning("GetParameters()"," No geometry ");
     return kFALSE; 
@@ -162,15 +207,16 @@ Bool_t AliEMCALShishKebabModule::GetParameters()
   fga = (Double_t)fgGeometry->GetPhiModuleSize();
   fgb = (Double_t)fgGeometry->GetLongModuleSize();
   fgr = (Double_t)(fgGeometry->GetIPDistance() + fgGeometry->GetSteelFrontThickness());
-  Print(0);
+  PrintShish(0);
   return kTRUE;
 }
 
-// service methods
-void AliEMCALShishKebabModule::Print(int pri) const
+//_________________________________________________________________________
+void AliEMCALShishKebabModule::PrintShish(Int_t pri) const
 {
+  // service method
   if(pri>=0) {
-    Info("Print()", " a %7.2f | b %7.2f | r %7.2f ", fga, fgb, fgr);
+    Info("PrintShish()", " a %7.2f | b %7.2f | r %7.2f ", fga, fgb, fgr);
     printf(" fTheta %f : %5.2f : cos(theta) %f\n", fTheta, GetThetaInDegree(),TMath::Cos(fTheta)); 
     if(pri>0) {
       printf("%i %s | theta %f -> %f\n", GetUniqueID(), GetName(), fTheta, fOK.Phi());
@@ -181,3 +227,8 @@ void AliEMCALShishKebabModule::Print(int pri) const
   }
 }
 
+//_________________________________________________________________________
+Double_t AliEMCALShishKebabModule::GetThetaInDegree() const 
+{
+  return fTheta*TMath::RadToDeg();
+}