From 25ab8a319368ac8fcbf7340d9551b61e31f277ea Mon Sep 17 00:00:00 2001 From: hristov Date: Tue, 11 Apr 2006 15:40:28 +0000 Subject: [PATCH] Coding conventions (A.Pavlinov) --- EMCAL/AliEMCALShishKebabModule.cxx | 80 ++++++++++++++++---------- EMCAL/AliEMCALShishKebabModule.h | 65 ++++++++++++--------- EMCAL/AliEMCALShishKebabTrd1Module.cxx | 48 +++++++++++----- EMCAL/AliEMCALShishKebabTrd1Module.h | 52 ++++++++++------- 4 files changed, 152 insertions(+), 93 deletions(-) diff --git a/EMCAL/AliEMCALShishKebabModule.cxx b/EMCAL/AliEMCALShishKebabModule.cxx index ac550088161..bb2b2ee9d8a 100644 --- a/EMCAL/AliEMCALShishKebabModule.cxx +++ b/EMCAL/AliEMCALShishKebabModule.cxx @@ -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. * @@ -15,13 +15,18 @@ /* $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 #include - -#include +#include ClassImp(AliEMCALShishKebabModule) @@ -30,25 +35,32 @@ 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() +{ + // 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 +{ + // 22-sep-04 TObject::SetUniqueID(leftNeighbor.GetUniqueID()+1); Init(leftNeighbor.GetA(),leftNeighbor.GetB()); } -void AliEMCALShishKebabModule::Init(double A, double B) +void AliEMCALShishKebabModule::Init(Double_t A, Double_t B) { + // + // Initialisation method + // Double_t thetaMin, thetaMax, par[4]; Int_t npar=0; if(A<0){ @@ -78,6 +90,7 @@ void AliEMCALShishKebabModule::Init(double A, double B) 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 @@ -104,20 +117,22 @@ 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 +143,31 @@ 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; @@ -166,9 +180,9 @@ Bool_t AliEMCALShishKebabModule::GetParameters() return kTRUE; } -// service methods -void AliEMCALShishKebabModule::PrintShish(int pri) const +void AliEMCALShishKebabModule::PrintShish(Int_t pri) const { + // service method if(pri>=0) { 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)); @@ -181,3 +195,7 @@ void AliEMCALShishKebabModule::PrintShish(int pri) const } } +Double_t AliEMCALShishKebabModule::GetThetaInDegree() const +{ + return fTheta*TMath::RadToDeg(); +} diff --git a/EMCAL/AliEMCALShishKebabModule.h b/EMCAL/AliEMCALShishKebabModule.h index 596e93a220a..f2f663c6486 100644 --- a/EMCAL/AliEMCALShishKebabModule.h +++ b/EMCAL/AliEMCALShishKebabModule.h @@ -2,59 +2,72 @@ #define ALIEMCALSHISHKEBABMODULE_H /* Copyright(c) 1998-2004, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice */ + * See cxx source for full Copyright notice * + */ /* $Id$ */ -#include "TNamed.h" -#include "TMath.h" -#include "TVector2.h" + +//_________________________________________________________________________ +// Main class for "twist" geometry of Shish-Kebab case. +// Author: Aleksei Pavlinov(WSU). +// Sep 2004. + +#include +#include class AliEMCALGeometry; class AliEMCALShishKebabModule : public TNamed { public: - AliEMCALShishKebabModule(double theta=TMath::Pi()/2.); + AliEMCALShishKebabModule(); AliEMCALShishKebabModule(AliEMCALShishKebabModule &leftNeighbor); - void Init(double A, double B); + void Init(Double_t A, Double_t B); + AliEMCALShishKebabModule(const AliEMCALShishKebabModule& mod) : TNamed(mod.GetName(),mod.GetTitle()){ + // cpy ctor: no implementation yet; requested by the Coding Convention + Fatal("cpy ctor", "not implemented") ; + } + AliEMCALShishKebabModule & operator = (const AliEMCALShishKebabModule& /*rvalue*/) { + Fatal("operator =", "not implemented") ; + return *this ; + } virtual ~AliEMCALShishKebabModule(void) {} Bool_t GetParameters(); - void DefineName(double theta); + void DefineName(Double_t theta); void DefineFirstModule(); void DefineSecondModuleFirstAssumption(); // need for testing Double_t Solve(Double_t (*fcn)(Double_t*, Double_t*), Double_t xmin=0., Double_t xmax=1., Int_t npar=0, Double_t *par=0, Double_t eps=1.0e-8, Int_t maxIter=1000); - static Double_t Y2(double *x, double *par); - static Double_t YALL(double *x, double *par); + static Double_t Y2(Double_t *x, Double_t *par); + static Double_t YALL(Double_t *x, Double_t *par); Double_t GetTheta() const {return fTheta;} - Double_t GetThetaInDegree() const {return fTheta*180./TMath::Pi();} + Double_t GetThetaInDegree() const; - Double_t GetPosX() {return fOK.Y();} - Double_t GetPosZ() {return fOK.X();} - Double_t GetPosXfromR() {return fOK.Y() - fgr;} - Double_t GetA() {return fA;} - Double_t GetB() {return fB;} + Double_t GetPosX() const {return fOK.Y();} + Double_t GetPosZ() const {return fOK.X();} + Double_t GetPosXfromR() const {return fOK.Y() - fgr;} + Double_t GetA() const {return fA;} + Double_t GetB() const {return fB;} + // service methods + void PrintShish(Int_t pri=1) const; // *MENU* + protected: // geometry info static AliEMCALGeometry *fgGeometry; //! - static Double_t fga; // default 11.2cm - static Double_t fgb; // - // radius to IP - static Double_t fgr; + static Double_t fga; // x size of module; default 11.2cm + static Double_t fgb; // y size of module; + static Double_t fgr; // radius to IP TVector2 fOK; // position the module center x->y; z->x; - Double_t fA; // parameters of line = y = A*z + B - Double_t fB; // - // service methods - void PrintShish(int pri=1) const; // *MENU* - protected: - // size of SK module + Double_t fA; // parameters of line; y = A*z + B + Double_t fB; // parameters of line; y = A*z + B Double_t fTheta; // theta for SK module - ClassDef(AliEMCALShishKebabModule,0) // Turned Shish-Kebab module + //public: + ClassDef(AliEMCALShishKebabModule,1) // Turned Shish-Kebab module }; #endif diff --git a/EMCAL/AliEMCALShishKebabTrd1Module.cxx b/EMCAL/AliEMCALShishKebabTrd1Module.cxx index 1ca7780e5c5..5091b0b6fcc 100644 --- a/EMCAL/AliEMCALShishKebabTrd1Module.cxx +++ b/EMCAL/AliEMCALShishKebabTrd1Module.cxx @@ -15,13 +15,19 @@ /* $Id$ */ -//*-- Author: Aleksei Pavlinov(WSU) +//_________________________________________________________________________ +// Main class for TRD1 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 "AliEMCALShishKebabTrd1Module.h" -#include +//#include #include "AliEMCALGeometry.h" -#include "Riostream.h" +#include #include ClassImp(AliEMCALShishKebabTrd1Module) @@ -34,29 +40,32 @@ ClassImp(AliEMCALShishKebabTrd1Module) Double_t AliEMCALShishKebabTrd1Module::fgangle=0.; // around one degree Double_t AliEMCALShishKebabTrd1Module::fgtanBetta=0; // -AliEMCALShishKebabTrd1Module::AliEMCALShishKebabTrd1Module(double theta, AliEMCALGeometry *g) : TNamed() -{ // theta in radians ; first object shold be with theta=pi/2. - cout<< " theta " << theta << " geometry " << g << endl; +AliEMCALShishKebabTrd1Module::AliEMCALShishKebabTrd1Module(Double_t theta, AliEMCALGeometry *g) : TNamed() +{ + // theta in radians ; first object shold be with theta=pi/2. fTheta = theta; if(fgGeometry==0) { + fTheta = TMath::PiOver2(); fgGeometry = g; if(GetParameters()) { DefineFirstModule(); } } else Warning("AliEMCALShishKebabTrd1Module(theta)","You should call this constractor just once !!"); DefineName(fTheta); + cout<< " theta " << fTheta << " geometry " << g << endl; } AliEMCALShishKebabTrd1Module::AliEMCALShishKebabTrd1Module(AliEMCALShishKebabTrd1Module &leftNeighbor) : TNamed() -{ // 22-sep-04 +{ // printf("** Left Neighbor : %s **\n", leftNeighbor.GetName()); TObject::SetUniqueID(leftNeighbor.GetUniqueID()+1); fTheta = leftNeighbor.GetTheta() - fgangle; Init(leftNeighbor.GetA(),leftNeighbor.GetB()); } -void AliEMCALShishKebabTrd1Module::Init(double A, double B) -{ // Define parameter module from parameters A,B from previos. +void AliEMCALShishKebabTrd1Module::Init(Double_t A, Double_t B) +{ + // Define parameter module from parameters A,B from previos. Double_t yl = (fgb/2)*TMath::Sin(fTheta) + (fga/2)*TMath::Cos(fTheta) + fgr, y = yl; Double_t xl = (yl - B) / A; // y=A*x+B @@ -94,6 +103,7 @@ void AliEMCALShishKebabTrd1Module::Init(double A, double B) void AliEMCALShishKebabTrd1Module::DefineFirstModule() { + // Define first module fOK.Set(fga2/2., fgr + fgb/2.); // position the center of module vs o // parameters of right line : y = A*z + B in system where zero point is IP. @@ -109,16 +119,15 @@ void AliEMCALShishKebabTrd1Module::DefineFirstModule() TObject::SetUniqueID(1); // } -void AliEMCALShishKebabTrd1Module::DefineName(double theta) +void AliEMCALShishKebabTrd1Module::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 AliEMCALShishKebabTrd1Module::GetParameters() { + // Get needing module parameters from EMCAL geometry if(!fgGeometry) fgGeometry = AliEMCALGeometry::GetInstance(); TString sn(fgGeometry->GetName()); // 2-Feb-05 sn.ToUpper(); @@ -141,6 +150,7 @@ Bool_t AliEMCALShishKebabTrd1Module::GetParameters() // service methods void AliEMCALShishKebabTrd1Module::PrintShish(int pri) const { + // service method if(pri>=0) { Info("\n PrintShish()", "\n a %7.3f:%7.3f | b %7.2f | r %7.2f \n TRD1 angle %7.6f(%5.2f) | tanBetta %7.6f", fga, fga2, fgb, fgr, fgangle, fgangle*TMath::RadToDeg(), fgtanBetta); @@ -157,3 +167,13 @@ void AliEMCALShishKebabTrd1Module::PrintShish(int pri) const } } } + +Double_t AliEMCALShishKebabTrd1Module::GetThetaInDegree() const +{ + return fTheta*TMath::RadToDeg(); +} + +Double_t AliEMCALShishKebabTrd1Module::GetEtaOfCenterOfModule() const +{ + return -TMath::Log(TMath::Tan(fOK.Phi()/2.)); +} diff --git a/EMCAL/AliEMCALShishKebabTrd1Module.h b/EMCAL/AliEMCALShishKebabTrd1Module.h index 7b96e7f1233..a105a346cf3 100644 --- a/EMCAL/AliEMCALShishKebabTrd1Module.h +++ b/EMCAL/AliEMCALShishKebabTrd1Module.h @@ -5,36 +5,43 @@ * See cxx source for full Copyright notice */ /* $Id$ */ -//*-- Author: Aleksei Pavlinov (WSU) -// TO DO : create class for Super module Geometry - 4-nov-04 +//_________________________________________________________________________ +// Main class for TRD1 geometry of Shish-Kebab case. +// Author: Aleksei Pavlinov(WSU). +// Nov 2004; Feb 2006 #include "TNamed.h" -#include "TMath.h" #include "TVector2.h" class AliEMCALGeometry; class AliEMCALShishKebabTrd1Module : public TNamed { public: - AliEMCALShishKebabTrd1Module(double theta=TMath::Pi()/2., AliEMCALGeometry *g=0); + AliEMCALShishKebabTrd1Module(Double_t theta=0.0, AliEMCALGeometry *g=0); AliEMCALShishKebabTrd1Module(AliEMCALShishKebabTrd1Module &leftNeighbor); - void Init(double A, double B); + void Init(Double_t A, Double_t B); + AliEMCALShishKebabTrd1Module(const AliEMCALShishKebabTrd1Module& mod) : TNamed(mod.GetName(),mod.GetTitle()){ + // cpy ctor: no implementation yet; requested by the Coding Convention + Fatal("cpy ctor", "not implemented") ; + } + AliEMCALShishKebabTrd1Module & operator = (const AliEMCALShishKebabTrd1Module& /*rvalue*/) { + Fatal("operator =", "not implemented") ; + return *this ; + } virtual ~AliEMCALShishKebabTrd1Module(void) {} Bool_t GetParameters(); - void DefineName(double theta); + void DefineName(Double_t theta); void DefineFirstModule(); - Double_t GetTheta() const{return fTheta;} - Double_t GetThetaInDegree() const {return fTheta*180./TMath::Pi();} + Double_t GetTheta() const {return fTheta;} TVector2& GetCenterOfModule() {return fOK;} - Double_t GetEtaOfCenterOfModule(){return -TMath::Log(TMath::Tan(fOK.Phi()/2.));} - Double_t GetPosX() {return fOK.Y();} - Double_t GetPosZ() {return fOK.X();} - Double_t GetPosXfromR() {return fOK.Y() - fgr;} - Double_t GetA() {return fA;} - Double_t GetB() {return fB;} + Double_t GetPosX() const {return fOK.Y();} + Double_t GetPosZ() const {return fOK.X();} + Double_t GetPosXfromR() const {return fOK.Y() - fgr;} + Double_t GetA() const {return fA;} + Double_t GetB() const {return fB;} // Additional offline staff TVector2& GetCenterOfCellInLocalCoordinateofSM(Int_t ieta) { if(ieta<=1) return fOK2; @@ -46,11 +53,14 @@ class AliEMCALShishKebabTrd1Module : public TNamed { } } // - Double_t GetTanBetta() {return fgtanBetta;} - Double_t Getb() {return fgb;} + Double_t GetTanBetta() const {return fgtanBetta;} + Double_t Getb() const {return fgb;} // service methods - void PrintShish(int pri=1) const; // *MENU* + void PrintShish(Int_t pri=1) const; // *MENU* + Double_t GetThetaInDegree() const; + Double_t GetEtaOfCenterOfModule() const; + protected: // geometry info static AliEMCALGeometry *fgGeometry; //! static Double_t fga; // 2*dx1=2*dy1 @@ -58,10 +68,8 @@ class AliEMCALShishKebabTrd1Module : public TNamed { static Double_t fgb; // 2*dz1 static Double_t fgangle; // ~1 degree static Double_t fgtanBetta; // tan(fgangle/2.) - // radius to IP - static Double_t fgr; + static Double_t fgr; // radius to IP - protected: TVector2 fOK; // position the module center x->y; z->x; Double_t fA; // parameters of right line : y = A*z + B Double_t fB; // system where zero point is IP. @@ -72,8 +80,8 @@ class AliEMCALShishKebabTrd1Module : public TNamed { TVector2 fOK1; // ieta=2 TVector2 fOK2; // ieta=1 - public: - ClassDef(AliEMCALShishKebabTrd1Module,0) // Turned Shish-Kebab module + // public: + ClassDef(AliEMCALShishKebabTrd1Module,0) // TRD1 Shish-Kebab module }; #endif -- 2.43.0