From 8918e70084c0bd41164dfeb3795567b013b2693e Mon Sep 17 00:00:00 2001 From: fca Date: Wed, 12 Jul 2000 08:56:32 +0000 Subject: [PATCH] Coding convention correction and warning removal --- STEER/AliDetector.cxx | 16 +++- STEER/AliDetector.h | 50 ++++++----- STEER/AliDigit.cxx | 9 ++ STEER/AliDigit.h | 11 ++- STEER/AliGenerator.cxx | 5 +- STEER/AliGeometry.cxx | 5 ++ STEER/AliGeometry.h | 2 - STEER/AliHeader.cxx | 15 ++++ STEER/AliHeader.h | 20 ++--- STEER/AliHit.cxx | 11 ++- STEER/AliHit.h | 21 +++-- STEER/AliHitMap.h | 2 + STEER/AliLego.cxx | 173 +++++++++---------------------------- STEER/AliLego.h | 57 +++--------- STEER/AliLegoGenerator.cxx | 168 +++++++++++++++++++++++++++++++++++ STEER/AliLegoGenerator.h | 51 +++++++++++ STEER/AliMC.cxx | 11 +++ STEER/AliMC.h | 3 + STEER/AliMagFC.cxx | 4 + STEER/AliMagFCM.cxx | 7 +- STEER/AliMagFDM.cxx | 56 ++++++++---- STEER/AliModule.cxx | 7 +- STEER/AliModule.h | 2 +- STEER/AliRun.cxx | 7 +- STEER/Makefile | 2 +- TGeant3/TGeant3.cxx | 45 +++++----- TGeant3/TGeant3Dummy.cxx | 11 ++- TGeant3/TGeant3GUI.cxx | 43 +++++---- TGeant3/THIGZ.cxx | 93 ++++++++++---------- TGeant3/THIGZ.h | 2 +- 30 files changed, 568 insertions(+), 341 deletions(-) create mode 100644 STEER/AliLegoGenerator.cxx create mode 100644 STEER/AliLegoGenerator.h diff --git a/STEER/AliDetector.cxx b/STEER/AliDetector.cxx index 08355af3b8d..1af996719c0 100644 --- a/STEER/AliDetector.cxx +++ b/STEER/AliDetector.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.5 1999/09/29 09:24:29 fca +Introduction of the Copyright and cvs Log + */ /////////////////////////////////////////////////////////////////////////////// @@ -116,6 +119,15 @@ void AliDetector::Browse(TBrowser *b) } } +//_____________________________________________________________________________ +void AliDetector::Copy(AliDetector &det) const +{ + // + // Copy *this onto det -- not implemented + // + Fatal("Copy","Not implemented~\n"); +} + //_____________________________________________________________________________ void AliDetector::FinishRun() { @@ -242,9 +254,9 @@ void AliDetector::MakeBranch(Option_t *option) sprintf(branchname,"%s",GetName()); // // Get the pointer to the header - char *H = strstr(option,"H"); + char *cH = strstr(option,"H"); // - if (fHits && gAlice->TreeH() && H) { + if (fHits && gAlice->TreeH() && cH) { gAlice->TreeH()->Branch(branchname,&fHits, fBufferSize); printf("* AliDetector::MakeBranch * Making Branch %s for hits\n",branchname); } diff --git a/STEER/AliDetector.h b/STEER/AliDetector.h index 12720315500..f8246ffadc9 100644 --- a/STEER/AliDetector.h +++ b/STEER/AliDetector.h @@ -1,5 +1,5 @@ -#ifndef AliDetector_H -#define AliDetector_H +#ifndef ALIDETECTOR_H +#define ALIDETECTOR_H /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ @@ -10,34 +10,25 @@ class AliDetector : public AliModule { - // Data members -protected: - - Float_t fTimeGate; //Time gate in seconds - - Int_t fIshunt; //1 if the hit is attached to the primary - Int_t fNhits; //Number of hits - Int_t fNdigits; //Number of digits - Int_t fBufferSize; //buffer size for Tree detector branches - TClonesArray *fHits; //List of hits for one track only - TClonesArray *fDigits; //List of digits for this detector - TObjArray *fPoints; //Array of points for each track (all tracks in memory) - public: // Creators - distructors AliDetector(const char* name, const char *title); AliDetector(); + AliDetector(const AliDetector &det) {det.Copy(*this);} virtual ~AliDetector(); // Inline functions - inline virtual int GetNdigits() {return fNdigits;} - inline virtual int GetNhits() {return fNhits;} - inline TClonesArray *Digits() {return fDigits;} - inline TClonesArray *Hits() {return fHits;} - inline TObjArray *Points() {return fPoints;} - inline Int_t GetIshunt() {return fIshunt;} - inline void SetIshunt(Int_t ishunt) {fIshunt=ishunt;} + virtual void Copy(AliDetector &det) const; + virtual int GetNdigits() {return fNdigits;} + virtual int GetNhits() {return fNhits;} + TClonesArray *Digits() {return fDigits;} + TClonesArray *Hits() {return fHits;} + TObjArray *Points() {return fPoints;} + Int_t GetIshunt() {return fIshunt;} + void SetIshunt(Int_t ishunt) {fIshunt=ishunt;} + virtual AliDetector &operator=(const AliDetector &det) + {det.Copy(*this); return (*this);} // Other methods virtual void Browse(TBrowser *b); @@ -52,10 +43,23 @@ public: virtual Float_t GetTimeGate() {return fTimeGate;} virtual void StepManager() {} virtual void DrawModule() {} - virtual AliHit* FirstHit(Int_t); + virtual AliHit* FirstHit(Int_t track); virtual AliHit* NextHit(); virtual void SetBufferSize(Int_t bufsize=8000) {fBufferSize = bufsize;} + // Data members +protected: + + Float_t fTimeGate; //Time gate in seconds + + Int_t fIshunt; //1 if the hit is attached to the primary + Int_t fNhits; //Number of hits + Int_t fNdigits; //Number of digits + Int_t fBufferSize; //buffer size for Tree detector branches + TClonesArray *fHits; //List of hits for one track only + TClonesArray *fDigits; //List of digits for this detector + TObjArray *fPoints; //Array of points for each track (all tracks in memory) + ClassDef(AliDetector,1) //Base class for ALICE detectors }; #endif diff --git a/STEER/AliDigit.cxx b/STEER/AliDigit.cxx index aef21fc7292..f22c1d0740f 100644 --- a/STEER/AliDigit.cxx +++ b/STEER/AliDigit.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.3 1999/09/29 09:24:29 fca +Introduction of the Copyright and cvs Log + */ #include "AliDigit.h" @@ -23,10 +26,16 @@ ClassImp(AliDigit) AliDigit::AliDigit() { + // + // Default constructor + // } AliDigit::AliDigit(Int_t *tracks) { + // + // Standard constructor + // fTracks[0] = tracks[0]; fTracks[1] = tracks[1]; fTracks[2] = tracks[2]; diff --git a/STEER/AliDigit.h b/STEER/AliDigit.h index ff4bf5661f5..3365e30de67 100644 --- a/STEER/AliDigit.h +++ b/STEER/AliDigit.h @@ -1,5 +1,5 @@ -#ifndef AliDigit_H -#define AliDigit_H +#ifndef ALIDIGIT_H +#define ALIDIGIT_H /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ @@ -9,6 +9,7 @@ // Base class for Alice Digits // //////////////////////////////////////////////// +#include #include "TObject.h" class AliDigit : public TObject { @@ -18,8 +19,10 @@ public: public: AliDigit(); AliDigit(Int_t *track); - ~AliDigit() {;} - inline virtual int *GetTracks() {return &fTracks[0];} + virtual ~AliDigit() {} + virtual Int_t *GetTracks() {return &fTracks[0];} + virtual Int_t GetTrack(Int_t i) const + {assert(0<=i&&i<=2); return fTracks[i];} ClassDef(AliDigit,1) //Base class for all Alice digits }; diff --git a/STEER/AliGenerator.cxx b/STEER/AliGenerator.cxx index 1c39842d22c..981e5583185 100644 --- a/STEER/AliGenerator.cxx +++ b/STEER/AliGenerator.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.6 2000/07/11 18:24:59 fca +Coding convention corrections + few minor bug fixes + Revision 1.5 2000/06/08 13:34:50 fca Better control of momentum range in GenBox @@ -125,7 +128,7 @@ AliGenerator & AliGenerator::operator=(const AliGenerator &gen) } //____________________________________________________________ -void AliGenerator::Copy(AliGenerator &gen) const +void AliGenerator::Copy(AliGenerator &/* gen */) const { // // Copy *this onto gen diff --git a/STEER/AliGeometry.cxx b/STEER/AliGeometry.cxx index 0aa25bd7a7e..8dcf38fb498 100644 --- a/STEER/AliGeometry.cxx +++ b/STEER/AliGeometry.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.1 1999/12/17 09:01:14 fca +Y.Schutz new classes for reconstruction + */ //-*-C++-*- @@ -36,7 +39,9 @@ ClassImp(AliGeometry) //____________________________________________________________________________ AliGeometry::AliGeometry() { + // // ctor + // } //____________________________________________________________________________ diff --git a/STEER/AliGeometry.h b/STEER/AliGeometry.h index 8ffcc3b1f31..943f53a414d 100644 --- a/STEER/AliGeometry.h +++ b/STEER/AliGeometry.h @@ -40,8 +40,6 @@ protected: AliGeometry(const Text_t* name, const Text_t* title) : TNamed (name,title) {} -public: - ClassDef(AliGeometry,1) // description , version 1 }; diff --git a/STEER/AliHeader.cxx b/STEER/AliHeader.cxx index 861231b38dc..7119f6194d7 100644 --- a/STEER/AliHeader.cxx +++ b/STEER/AliHeader.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.2 1999/09/29 09:24:29 fca +Introduction of the Copyright and cvs Log + */ #include "AliHeader.h" @@ -24,6 +27,9 @@ ClassImp(AliHeader) AliHeader::AliHeader() { + // + // Default constructor + // fRun=0; fNvertex=0; fNprimary=0; @@ -33,6 +39,9 @@ AliHeader::AliHeader() AliHeader::AliHeader(Int_t run, Int_t event) { + // + // Standard constructor + // fRun=run; fNvertex=0; fNprimary=0; @@ -42,6 +51,9 @@ AliHeader::AliHeader(Int_t run, Int_t event) void AliHeader::Reset(Int_t run, Int_t event) { + // + // Resets the header with new run and event number + // fRun=run; fNvertex=0; fNprimary=0; @@ -51,6 +63,9 @@ void AliHeader::Reset(Int_t run, Int_t event) void AliHeader::Dump() { + // + // Dumps header content + // printf( "\n=========== Header for run %d Event %d = beginning ======================================\n", fRun,fEvent); diff --git a/STEER/AliHeader.h b/STEER/AliHeader.h index 67a04cf7b2e..69ce3af32d0 100644 --- a/STEER/AliHeader.h +++ b/STEER/AliHeader.h @@ -1,5 +1,5 @@ -#ifndef AliHeader_H -#define AliHeader_H +#ifndef ALIHEADER_H +#define ALIHEADER_H /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ @@ -8,17 +8,10 @@ #include "TObject.h" class AliHeader : public TObject { -protected: - Int_t fRun; //Run number - Int_t fNvertex; //Number of vertices - Int_t fNprimary; //Number of primary tracks - Int_t fNtrack; //Number of tracks - Int_t fEvent; //Event number - public: AliHeader(); AliHeader(Int_t run, Int_t event); - ~AliHeader() {;} + virtual ~AliHeader() {} virtual void Reset(Int_t run, Int_t event); @@ -39,6 +32,13 @@ public: virtual void Dump(); +protected: + Int_t fRun; //Run number + Int_t fNvertex; //Number of vertices + Int_t fNprimary; //Number of primary tracks + Int_t fNtrack; //Number of tracks + Int_t fEvent; //Event number + ClassDef(AliHeader,1) //Alice event header }; diff --git a/STEER/AliHit.cxx b/STEER/AliHit.cxx index 93ad6b50497..d3db3b9cb63 100644 --- a/STEER/AliHit.cxx +++ b/STEER/AliHit.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.4 2000/07/11 18:24:59 fca +Coding convention corrections + few minor bug fixes + Revision 1.3 1999/09/29 09:24:29 fca Introduction of the Copyright and cvs Log @@ -28,11 +31,17 @@ ClassImp(AliHit) AliHit::AliHit() { - fTrack=0; + // + // Default constructor + // + fTrack=0; } AliHit::AliHit(Int_t shunt, Int_t track) { + // + // Standard constructor + // TClonesArray &particles = *(gAlice->Particles()); if(shunt) { int primary = gAlice->GetPrimary(track); diff --git a/STEER/AliHit.h b/STEER/AliHit.h index da6babdc98e..9413cea319f 100644 --- a/STEER/AliHit.h +++ b/STEER/AliHit.h @@ -1,5 +1,5 @@ -#ifndef AliHit_H -#define AliHit_H +#ifndef ALIHIT_H +#define ALIHIT_H /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ @@ -9,18 +9,21 @@ class AliHit : public TObject { public: - Int_t fTrack; //track number - //Position of the hit - Float_t fX; - Float_t fY; - Float_t fZ; + Int_t fTrack; // Track number + Float_t fX; // X position of the hit + Float_t fY; // Y position of the hit + Float_t fZ; // Z position of the hit public: AliHit(); AliHit(Int_t shunt, Int_t track); virtual ~AliHit() {} - virtual int GetTrack() const {return fTrack;} - inline virtual void SetTrack(int track) {fTrack=track;} + virtual Int_t GetTrack() const {return fTrack;} + virtual void SetTrack(Int_t track) {fTrack=track;} + virtual Float_t X() const {return fX;} + virtual Float_t Y() const {return fY;} + virtual Float_t Z() const {return fZ;} + virtual Float_t Track() const {return fTrack;} ClassDef(AliHit,1) //Base class for all Alice hits }; diff --git a/STEER/AliHitMap.h b/STEER/AliHitMap.h index 3ed331763d6..74f777af4b3 100644 --- a/STEER/AliHitMap.h +++ b/STEER/AliHitMap.h @@ -13,6 +13,8 @@ typedef enum {kEmpty, kUsed, kUnused} FlagType; class AliHitMap : public TObject { public: + // Virtual destructor -- it is necessary + virtual ~AliHitMap() {} // Fill hits from list of digits into hit map virtual void FillHits() =0; // Clear the hit map diff --git a/STEER/AliLego.cxx b/STEER/AliLego.cxx index b0f76b3bca4..254a74c2a13 100644 --- a/STEER/AliLego.cxx +++ b/STEER/AliLego.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.16 2000/05/26 08:35:03 fca +Move the check on z after z has been retrieved + Revision 1.15 2000/05/16 13:10:40 fca New method IsNewTrack and fix for a problem in Father-Daughter relations @@ -77,6 +80,7 @@ Introduction of the Copyright and cvs Log #include "TMath.h" #include "AliLego.h" +#include "AliLegoGenerator.h" #include "AliRun.h" #include "AliConst.h" #include "AliMC.h" @@ -87,20 +91,24 @@ ClassImp(AliLego) //___________________________________________ AliLego::AliLego() { - fHistRadl = 0; - fHistAbso = 0; - fHistGcm2 = 0; - fHistReta = 0; + // + // Default constructor + // + fHistRadl = 0; + fHistAbso = 0; + fHistGcm2 = 0; + fHistReta = 0; } //___________________________________________ -AliLego::AliLego(const char *title, Int_t ntheta, Float_t themin, Float_t themax, - Int_t nphi, Float_t phimin, Float_t phimax, +AliLego::AliLego(const char *title, Int_t ntheta, Float_t themin, + Float_t themax, Int_t nphi, Float_t phimin, Float_t phimax, Float_t rmin, Float_t rmax, Float_t zmax) : TNamed("Lego Generator",title) { -// specify the angular limits and the size of the rectangular box - + // + // specify the angular limits and the size of the rectangular box + // fGener = new AliLegoGenerator(ntheta, themin, themax, nphi, phimin, phimax, rmin, rmax, zmax); @@ -123,18 +131,23 @@ AliLego::AliLego(const char *title, Int_t ntheta, Float_t themin, Float_t themax //___________________________________________ AliLego::~AliLego() { - delete fHistRadl; - delete fHistAbso; - delete fHistGcm2; - delete fHistReta; - gAlice->ResetGenerator(0); - delete fGener; + // + // Destructor + // + delete fHistRadl; + delete fHistAbso; + delete fHistGcm2; + delete fHistReta; + gAlice->ResetGenerator(0); + delete fGener; } //___________________________________________ void AliLego::BeginEvent() { -// --- Set to 0 radiation length, absorption length and g/cm2 --- + // + // --- Set to 0 radiation length, absorption length and g/cm2 --- + // fTotRadl = 0; fTotAbso = 0; fTotGcm2 = 0; @@ -143,6 +156,9 @@ void AliLego::BeginEvent() //___________________________________________ void AliLego::FinishEvent() { + // + // Finish the event and update the histos + // Double_t thed, phid, eta; thed = fGener->CurTheta()*kRaddeg; phid = fGener->CurPhi()*kRaddeg; @@ -159,7 +175,9 @@ void AliLego::FinishEvent() //___________________________________________ void AliLego::FinishRun() { - // Store histograms in current Root file + // + // Store histograms in current Root file + // fHistRadl->Write(); fHistAbso->Write(); fHistGcm2->Write(); @@ -173,6 +191,14 @@ void AliLego::FinishRun() } +//___________________________________________ +void AliLego::Copy(AliLego &lego) const +{ + // + // Copy *this onto lego -- not implemented + // + Fatal("Copy","Not implemented!\n"); +} //___________________________________________ void AliLego::StepManager() @@ -223,118 +249,3 @@ void AliLego::StepManager() } } -ClassImp(AliLegoGenerator) - -//___________________________________________ -AliLegoGenerator::AliLegoGenerator(Int_t ntheta, Float_t themin, - Float_t themax, Int_t nphi, - Float_t phimin, Float_t phimax, - Float_t rmin, Float_t rmax, Float_t zmax) : - AliGenerator(0), fRadMin(rmin), fRadMax(rmax), fZMax(zmax), fNtheta(ntheta), - fNphi(nphi), fThetaBin(ntheta), fPhiBin(-1), fCurTheta(0), fCurPhi(0) - -{ - SetPhiRange(phimin,phimax); - SetThetaRange(themin,themax); - SetName("Lego"); -} - - -//___________________________________________ -void AliLegoGenerator::Generate() -{ -// Create a geantino with kinematics corresponding to the current -// bins in theta and phi. - - // - // Rootinos are 0 - const Int_t mpart = 0; - Float_t orig[3], pmom[3]; - Float_t t, cost, sint, cosp, sinp; - - // Prepare for next step - if(fThetaBin>=fNtheta-1) - if(fPhiBin>=fNphi-1) { - Warning("Generate","End of Lego Generation"); - return; - } else { - fPhiBin++; - printf("Generating rays in phi bin:%d\n",fPhiBin); - fThetaBin=0; - } else fThetaBin++; - - fCurTheta = (fThetaMin+(fThetaBin+0.5)*(fThetaMax-fThetaMin)/fNtheta); - fCurPhi = (fPhiMin+(fPhiBin+0.5)*(fPhiMax-fPhiMin)/fNphi); - cost = TMath::Cos(fCurTheta); - sint = TMath::Sin(fCurTheta); - cosp = TMath::Cos(fCurPhi); - sinp = TMath::Sin(fCurPhi); - - pmom[0] = cosp*sint; - pmom[1] = sinp*sint; - pmom[2] = cost; - - // --- Where to start - orig[0] = orig[1] = orig[2] = 0; - Float_t dalicz = 3000; - if (fRadMin > 0) { - t = PropagateCylinder(orig,pmom,fRadMin,dalicz); - orig[0] = pmom[0]*t; - orig[1] = pmom[1]*t; - orig[2] = pmom[2]*t; - if (TMath::Abs(orig[2]) > fZMax) return; - } - - Float_t polar[3]={0.,0.,0.}; - Int_t ntr; - gAlice->SetTrack(1, 0, mpart, pmom, orig, polar, 0, "LEGO ray", ntr); - -} - -//___________________________________________ -Float_t AliLegoGenerator::PropagateCylinder(Float_t *x, Float_t *v, Float_t r, Float_t z) -{ -// Propagate to cylinder from inside - - Double_t hnorm, sz, t, t1, t2, t3, sr; - Double_t d[3]; - const Float_t kSmall = 1e-8; - const Float_t kSmall2 = kSmall*kSmall; - -// ---> Find intesection with Z planes - d[0] = v[0]; - d[1] = v[1]; - d[2] = v[2]; - hnorm = TMath::Sqrt(1/(d[0]*d[0]+d[1]*d[1]+d[2]*d[2])); - d[0] *= hnorm; - d[1] *= hnorm; - d[2] *= hnorm; - if (d[2] > kSmall) sz = (z-x[2])/d[2]; - else if (d[2] < -kSmall) sz = -(z+x[2])/d[2]; - else sz = 1.e10; // ---> Direction parallel to X-Y, no intersection - -// ---> Intersection with cylinders -// Intersection point (x,y,z) -// (x,y,z) is on track : x=X(1)+t*D(1) -// y=X(2)+t*D(2) -// z=X(3)+t*D(3) -// (x,y,z) is on cylinder : x**2 + y**2 = R**2 -// -// (D(1)**2+D(2)**2)*t**2 -// +2.*(X(1)*D(1)+X(2)*D(2))*t -// +X(1)**2+X(2)**2-R**2=0 -// ---> Solve second degree equation - t1 = d[0]*d[0] + d[1]*d[1]; - if (t1 <= kSmall2) { - t = sz; // ---> Track parallel to the z-axis, take distance to planes - } else { - t2 = x[0]*d[0] + x[1]*d[1]; - t3 = x[0]*x[0] + x[1]*x[1]; - // ---> It should be positive, but there may be numerical problems - sr = (t2 +TMath::Sqrt(TMath::Max(t2*t2-(t3-r*r)*t1,0.)))/t1; - // ---> Find minimum distance between planes and cylinder - t = TMath::Min(sz,sr); - } - return t; -} - diff --git a/STEER/AliLego.h b/STEER/AliLego.h index 4fc7c6399d3..e2ed9ed02f0 100644 --- a/STEER/AliLego.h +++ b/STEER/AliLego.h @@ -15,67 +15,38 @@ #include -#include "AliGenerator.h" - class AliLegoGenerator; class AliLego : public TNamed { -private: - AliLegoGenerator *fGener; //Lego generator - Float_t fTotRadl; //Total Radiation length - Float_t fTotAbso; //Total absorption length - Float_t fTotGcm2; //Total G/CM2 traversed - TH2F *fHistRadl; //Radiation length map - TH2F *fHistAbso; //Interaction length map - TH2F *fHistGcm2; //g/cm2 length map - TH2F *fHistReta; //Radiation length map as a function of eta - public: AliLego(); AliLego(const char *title, Int_t ntheta,Float_t themin, Float_t themax, Int_t nphi, Float_t phimin, Float_t phimax,Float_t rmin,Float_t rmax,Float_t zmax); + AliLego(const AliLego &lego) {lego.Copy(*this);} virtual ~AliLego(); + virtual void Copy(AliLego &lego) const; virtual void StepManager(); virtual void BeginEvent(); virtual void FinishEvent(); virtual void FinishRun(); + virtual AliLego &operator=(const AliLego &lego) + {lego.Copy(*this);return(*this);} +private: + AliLegoGenerator *fGener; //Lego generator + Float_t fTotRadl; //Total Radiation length + Float_t fTotAbso; //Total absorption length + Float_t fTotGcm2; //Total G/CM2 traversed + TH2F *fHistRadl; //Radiation length map + TH2F *fHistAbso; //Interaction length map + TH2F *fHistGcm2; //g/cm2 length map + TH2F *fHistReta; //Radiation length map as a function of eta + ClassDef(AliLego,1) //Utility class to compute and draw Radiation Length Map }; -class AliLegoGenerator : public AliGenerator -{ -public: - AliLegoGenerator() {} - AliLegoGenerator(Int_t ntheta, Float_t themin, Float_t themax, - Int_t nphi, Float_t phimin, Float_t phimax, - Float_t rmin, Float_t rmax, Float_t zmax); - void Generate(); - Float_t CurTheta() const {return fCurTheta;} - Int_t ThetaBin() const {return fThetaBin;} - Float_t CurPhi() const {return fCurPhi;} - Float_t ZMax() const {return fZMax;} - Float_t RadMax() const {return fRadMax;} - Int_t PhiBin() const {return fPhiBin;} - Int_t Nphi() const {return fNphi;} - Int_t Ntheta() const {return fNtheta;} - Float_t PropagateCylinder(Float_t *x, Float_t *v, Float_t r, Float_t z); -private: - Float_t fRadMin; //Generation radius - Float_t fRadMax; //Maximum tracking radius - Float_t fZMax; //Maximum tracking Z - Int_t fNtheta; //Number of bins in Theta - Int_t fNphi; //Number of bins in Phi - Int_t fThetaBin; //Current theta bin - Int_t fPhiBin; //Current phi bin - Float_t fCurTheta; //Current theta of track - Float_t fCurPhi; //Current phi of track - - ClassDef(AliLegoGenerator,1) //Lego generator -}; #endif - diff --git a/STEER/AliLegoGenerator.cxx b/STEER/AliLegoGenerator.cxx new file mode 100644 index 00000000000..b4c9d2fba3c --- /dev/null +++ b/STEER/AliLegoGenerator.cxx @@ -0,0 +1,168 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* +$Log$ +Revision 1.16 2000/05/26 08:35:03 fca +Move the check on z after z has been retrieved + +Revision 1.15 2000/05/16 13:10:40 fca +New method IsNewTrack and fix for a problem in Father-Daughter relations + +Revision 1.14 2000/04/27 10:38:21 fca +Correct termination of Lego Run and introduce Lego getter in AliRun + +Revision 1.13 2000/04/26 10:17:31 fca +Changes in Lego for G4 compatibility + +Revision 1.12 2000/04/07 11:12:33 fca +G4 compatibility changes + +Revision 1.11 2000/03/22 13:42:26 fca +SetGenerator does not replace an existing generator, ResetGenerator does + +Revision 1.10 2000/02/23 16:25:22 fca +AliVMC and AliGeant3 classes introduced +ReadEuclid moved from AliRun to AliModule + +Revision 1.9 1999/12/03 10:54:01 fca +Fix lego summary + +Revision 1.8 1999/10/01 09:54:33 fca +Correct logics for Lego StepManager + +Revision 1.7 1999/09/29 09:24:29 fca +Introduction of the Copyright and cvs Log + +*/ + +#include "AliLegoGenerator.h" +#include "AliRun.h" + +ClassImp(AliLegoGenerator) + +//___________________________________________ +AliLegoGenerator::AliLegoGenerator(Int_t ntheta, Float_t themin, + Float_t themax, Int_t nphi, + Float_t phimin, Float_t phimax, + Float_t rmin, Float_t rmax, Float_t zmax) : + AliGenerator(0), fRadMin(rmin), fRadMax(rmax), fZMax(zmax), fNtheta(ntheta), + fNphi(nphi), fThetaBin(ntheta), fPhiBin(-1), fCurTheta(0), fCurPhi(0) + +{ + SetPhiRange(phimin,phimax); + SetThetaRange(themin,themax); + SetName("Lego"); +} + + +//___________________________________________ +void AliLegoGenerator::Generate() +{ +// Create a geantino with kinematics corresponding to the current +// bins in theta and phi. + + // + // Rootinos are 0 + const Int_t kMpart = 0; + Float_t orig[3], pmom[3]; + Float_t t, cost, sint, cosp, sinp; + + // Prepare for next step + if(fThetaBin>=fNtheta-1) + if(fPhiBin>=fNphi-1) { + Warning("Generate","End of Lego Generation"); + return; + } else { + fPhiBin++; + printf("Generating rays in phi bin:%d\n",fPhiBin); + fThetaBin=0; + } else fThetaBin++; + + fCurTheta = (fThetaMin+(fThetaBin+0.5)*(fThetaMax-fThetaMin)/fNtheta); + fCurPhi = (fPhiMin+(fPhiBin+0.5)*(fPhiMax-fPhiMin)/fNphi); + cost = TMath::Cos(fCurTheta); + sint = TMath::Sin(fCurTheta); + cosp = TMath::Cos(fCurPhi); + sinp = TMath::Sin(fCurPhi); + + pmom[0] = cosp*sint; + pmom[1] = sinp*sint; + pmom[2] = cost; + + // --- Where to start + orig[0] = orig[1] = orig[2] = 0; + Float_t dalicz = 3000; + if (fRadMin > 0) { + t = PropagateCylinder(orig,pmom,fRadMin,dalicz); + orig[0] = pmom[0]*t; + orig[1] = pmom[1]*t; + orig[2] = pmom[2]*t; + if (TMath::Abs(orig[2]) > fZMax) return; + } + + Float_t polar[3]={0.,0.,0.}; + Int_t ntr; + gAlice->SetTrack(1, 0, kMpart, pmom, orig, polar, 0, "LEGO ray", ntr); + +} + +//___________________________________________ +Float_t AliLegoGenerator::PropagateCylinder(Float_t *x, Float_t *v, Float_t r, Float_t z) +{ +// Propagate to cylinder from inside + + Double_t hnorm, sz, t, t1, t2, t3, sr; + Double_t d[3]; + const Float_t kSmall = 1e-8; + const Float_t kSmall2 = kSmall*kSmall; + +// ---> Find intesection with Z planes + d[0] = v[0]; + d[1] = v[1]; + d[2] = v[2]; + hnorm = TMath::Sqrt(1/(d[0]*d[0]+d[1]*d[1]+d[2]*d[2])); + d[0] *= hnorm; + d[1] *= hnorm; + d[2] *= hnorm; + if (d[2] > kSmall) sz = (z-x[2])/d[2]; + else if (d[2] < -kSmall) sz = -(z+x[2])/d[2]; + else sz = 1.e10; // ---> Direction parallel to X-Y, no intersection + +// ---> Intersection with cylinders +// Intersection point (x,y,z) +// (x,y,z) is on track : x=X(1)+t*D(1) +// y=X(2)+t*D(2) +// z=X(3)+t*D(3) +// (x,y,z) is on cylinder : x**2 + y**2 = R**2 +// +// (D(1)**2+D(2)**2)*t**2 +// +2.*(X(1)*D(1)+X(2)*D(2))*t +// +X(1)**2+X(2)**2-R**2=0 +// ---> Solve second degree equation + t1 = d[0]*d[0] + d[1]*d[1]; + if (t1 <= kSmall2) { + t = sz; // ---> Track parallel to the z-axis, take distance to planes + } else { + t2 = x[0]*d[0] + x[1]*d[1]; + t3 = x[0]*x[0] + x[1]*x[1]; + // ---> It should be positive, but there may be numerical problems + sr = (t2 +TMath::Sqrt(TMath::Max(t2*t2-(t3-r*r)*t1,0.)))/t1; + // ---> Find minimum distance between planes and cylinder + t = TMath::Min(sz,sr); + } + return t; +} + diff --git a/STEER/AliLegoGenerator.h b/STEER/AliLegoGenerator.h new file mode 100644 index 00000000000..76fa714789b --- /dev/null +++ b/STEER/AliLegoGenerator.h @@ -0,0 +1,51 @@ +#ifndef ALILEGOGENERATOR_H +#define ALILEGOGENERATOR_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +/////////////////////////////////////////////////////////////////////////////// +// // +// // +// Utility class to compute and draw Radiation Length Map // +// // +// // +/////////////////////////////////////////////////////////////////////////////// + +#include "AliGenerator.h" + +class AliLegoGenerator : public AliGenerator +{ + +public: + AliLegoGenerator() {} + AliLegoGenerator(Int_t ntheta, Float_t themin, Float_t themax, + Int_t nphi, Float_t phimin, Float_t phimax, + Float_t rmin, Float_t rmax, Float_t zmax); + void Generate(); + Float_t CurTheta() const {return fCurTheta;} + Int_t ThetaBin() const {return fThetaBin;} + Float_t CurPhi() const {return fCurPhi;} + Float_t ZMax() const {return fZMax;} + Float_t RadMax() const {return fRadMax;} + Int_t PhiBin() const {return fPhiBin;} + Int_t Nphi() const {return fNphi;} + Int_t Ntheta() const {return fNtheta;} + Float_t PropagateCylinder(Float_t *x, Float_t *v, Float_t r, Float_t z); +private: + Float_t fRadMin; //Generation radius + Float_t fRadMax; //Maximum tracking radius + Float_t fZMax; //Maximum tracking Z + Int_t fNtheta; //Number of bins in Theta + Int_t fNphi; //Number of bins in Phi + Int_t fThetaBin; //Current theta bin + Int_t fPhiBin; //Current phi bin + Float_t fCurTheta; //Current theta of track + Float_t fCurPhi; //Current phi of track + + ClassDef(AliLegoGenerator,1) //Lego generator +}; + +#endif + diff --git a/STEER/AliMC.cxx b/STEER/AliMC.cxx index dd5fa9ac7d9..203c367106d 100644 --- a/STEER/AliMC.cxx +++ b/STEER/AliMC.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.4 2000/07/11 18:24:59 fca +Coding convention corrections + few minor bug fixes + Revision 1.3 2000/03/22 18:08:07 fca Rationalisation of the virtual MC interfaces @@ -46,3 +49,11 @@ AliMC::AliMC(const char *name, const char *title) : TNamed(name,title) } } +void AliMC::Copy(AliMC &mc) const +{ + // + // Copy *this onto mc -- not implemented + // + Fatal("Copy","Not implemented~\n"); +} + diff --git a/STEER/AliMC.h b/STEER/AliMC.h index 261e9afb10c..2ee132c00ba 100644 --- a/STEER/AliMC.h +++ b/STEER/AliMC.h @@ -25,6 +25,9 @@ class AliMC : public TNamed public: AliMC(const char *name, const char *title); AliMC() {} + AliMC(const AliMC &mc) {mc.Copy(*this);} + virtual void Copy(AliMC &mc) const; + virtual AliMC & operator=(const AliMC &mc) {mc.Copy(*this);return (*this);} virtual ~AliMC() {fgMC=gMC=0;} // static access method diff --git a/STEER/AliMagFC.cxx b/STEER/AliMagFC.cxx index 802977010cf..215bd671eee 100644 --- a/STEER/AliMagFC.cxx +++ b/STEER/AliMagFC.cxx @@ -15,9 +15,13 @@ /* $Log$ +Revision 1.1 2000/07/11 18:24:59 fca +Coding convention corrections + few minor bug fixes + */ #include "AliMagFC.h" +#include ClassImp(AliMagFC) diff --git a/STEER/AliMagFCM.cxx b/STEER/AliMagFCM.cxx index 2de1a2d1661..26af5e449c5 100644 --- a/STEER/AliMagFCM.cxx +++ b/STEER/AliMagFCM.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.1 2000/07/11 18:24:59 fca +Coding convention corrections + few minor bug fixes + */ #include "AliMagFCM.h" @@ -225,10 +228,10 @@ void AliMagFCM::ReadField() } //________________________________________ -void AliMagFCM::Copy(AliMagFCM &magf) const +void AliMagFCM::Copy(AliMagFCM & /* magf */) const { // - // Copy *this onto magf + // Copy *this onto magf -- Not implemented // Fatal("Copy","Not implemented!\n"); } diff --git a/STEER/AliMagFDM.cxx b/STEER/AliMagFDM.cxx index 42e50002eab..af924b0023d 100644 --- a/STEER/AliMagFDM.cxx +++ b/STEER/AliMagFDM.cxx @@ -15,8 +15,13 @@ /* $Log$ +Revision 1.1 2000/07/11 18:24:59 fca +Coding convention corrections + few minor bug fixes + */ +#include + #include "AliMagFDM.h" #include "TSystem.h" @@ -360,29 +365,34 @@ void AliMagFDM::FRfuncBi(Int_t *kai,Double_t *za1, Double_t *za2, Double_t *al1, alf2=*al2; alf3=*al3; - if (kaai==0 ) { + switch (kaai) { + case 0: fa11 = fdBpx[kaa][0][0]; fa12 = fdBpx[kaa][0][maa]; fa13 = fdBpx[kaa][0][maa+1]; fa21 = fdBpx[kaa+1][0][0]; fa22 = fdBpx[kaa+1][0][maa]; fa23 = fdBpx[kaa+1][0][maa+1]; - } - if (kaai==1 ) { + break; + case 1: fa11 = fdBpy[kaa][0][0]; fa12 = fdBpy[kaa][0][maa]; fa13 = fdBpy[kaa][0][maa+1]; fa21 = fdBpy[kaa+1][0][0]; fa22 = fdBpy[kaa+1][0][maa]; fa23 = fdBpy[kaa+1][0][maa+1]; - } - if (kaai==2 ) { + break; + case 2: fa11 = fdBpz[kaa][0][0]; fa12 = fdBpz[kaa][0][maa]; fa13 = fdBpz[kaa][0][maa+1]; fa21 = fdBpz[kaa+1][0][0]; fa22 = fdBpz[kaa+1][0][maa]; fa23 = fdBpz[kaa+1][0][maa+1]; + break; + default: + Fatal("FRfuncBi","Invalid value of kaai %d\n",kaai); + exit(1); } faY1=alf1*fa11+alf2*fa12+alf3*fa13; faY2=alf1*fa21+alf2*fa22+alf3*fa23; @@ -423,7 +433,8 @@ void AliMagFDM::FGfuncBi(Double_t *zz1,Double_t *zz2, Double_t *yy1,Double_t *yy /*-----------------Polar part ------------------*/ - if(kv==0) { + switch (kv) { + case 0: bf11=fdBpx[k][l][m]; bf12=fdBpx[k+1][l][m]; bf21=fdBpx[k+1][l+1][m]; @@ -433,8 +444,9 @@ void AliMagFDM::FGfuncBi(Double_t *zz1,Double_t *zz2, Double_t *yy1,Double_t *yy bg12=fdBpx[k+1][l][m+1]; bg21=fdBpx[k+1][l+1][m+1]; bg22=fdBpx[k][l+1][m+1]; - } - if(kv==1) { + break; + + case 1: bf11=fdBpy[k][l][m]; bf12=fdBpy[k+1][l][m]; bf21=fdBpy[k+1][l+1][m]; @@ -444,9 +456,9 @@ void AliMagFDM::FGfuncBi(Double_t *zz1,Double_t *zz2, Double_t *yy1,Double_t *yy bg12=fdBpy[k+1][l][m+1]; bg21=fdBpy[k+1][l+1][m+1]; bg22=fdBpy[k][l+1][m+1]; - } - - if(kv==2) { + break; + + case 2: bf11=fdBpz[k][l][m]; bf12=fdBpz[k+1][l][m]; bf21=fdBpz[k+1][l+1][m]; @@ -455,11 +467,11 @@ void AliMagFDM::FGfuncBi(Double_t *zz1,Double_t *zz2, Double_t *yy1,Double_t *yy bg11=fdBpz[k][l][m+1]; bg12=fdBpz[k+1][l][m+1]; bg21=fdBpz[k+1][l+1][m+1]; - bg22=fdBpz[k][l+1][m+1]; - } + bg22=fdBpz[k][l+1][m+1]; + break; /*-----------------Cartensian part ---------------*/ - if(kv==3) { + case 3: bf11=fdBcx[k][l][m]; bf12=fdBcx[k+1][l][m]; bf21=fdBcx[k+1][l+1][m]; @@ -469,9 +481,9 @@ void AliMagFDM::FGfuncBi(Double_t *zz1,Double_t *zz2, Double_t *yy1,Double_t *yy bg12=fdBcx[k+1][l][m+1]; bg21=fdBcx[k+1][l+1][m+1]; bg22=fdBcx[k][l+1][m+1]; - } - - if(kv==4) { + break; + + case 4: bf11=fdBcy[k][l][m]; bf12=fdBcy[k+1][l][m]; bf21=fdBcy[k+1][l+1][m]; @@ -481,8 +493,9 @@ void AliMagFDM::FGfuncBi(Double_t *zz1,Double_t *zz2, Double_t *yy1,Double_t *yy bg12=fdBcy[k+1][l][m+1]; bg21=fdBcy[k+1][l+1][m+1]; bg22=fdBcy[k][l+1][m+1]; - } - if(kv==5) { + break; + + case 5: bf11=fdBcz[k][l][m]; bf12=fdBcz[k+1][l][m]; bf21=fdBcz[k+1][l+1][m]; @@ -492,6 +505,11 @@ void AliMagFDM::FGfuncBi(Double_t *zz1,Double_t *zz2, Double_t *yy1,Double_t *yy bg12=fdBcz[k+1][l][m+1]; bg21=fdBcz[k+1][l+1][m+1]; bg22=fdBcz[k][l+1][m+1]; + break; + + default: + Fatal("FGfuncBi","Invalid value of kv %d\n",kv); + exit(1); } diff --git a/STEER/AliModule.cxx b/STEER/AliModule.cxx index 8028594ea1e..8ab0ff42c69 100644 --- a/STEER/AliModule.cxx +++ b/STEER/AliModule.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.10 2000/07/11 18:24:59 fca +Coding convention corrections + few minor bug fixes + Revision 1.9 2000/05/16 08:45:08 fca Correct dtor, thanks to J.Belikov @@ -111,7 +114,7 @@ AliModule::AliModule(const AliModule &mod) // // Copy constructor // - Copy(*this); + mod.Copy(*this); } //_____________________________________________________________________________ @@ -134,7 +137,7 @@ AliModule::~AliModule() } //_____________________________________________________________________________ -void AliModule::Copy(AliModule &mod) const +void AliModule::Copy(AliModule & /* mod */) const { // // Copy *this onto mod, not implemented for AliModule diff --git a/STEER/AliModule.h b/STEER/AliModule.h index 03d4ac1f19d..0797945f410 100644 --- a/STEER/AliModule.h +++ b/STEER/AliModule.h @@ -91,7 +91,7 @@ public: virtual void StepManager() {} //virtual AliHit* FirstHit(Int_t) {return 0;} //virtual AliHit* NextHit() {return 0;} - virtual void SetBufferSize(Int_t bufsiz) {} + virtual void SetBufferSize(Int_t) {} virtual void SetEuclidFile(char *material,char *geometry=0); virtual void ReadEuclid(const char *filnam, char *topvol); virtual void ReadEuclidMedia(const char *filnam); diff --git a/STEER/AliRun.cxx b/STEER/AliRun.cxx index 07b95fb1f09..0e14eb7bc39 100644 --- a/STEER/AliRun.cxx +++ b/STEER/AliRun.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.39 2000/07/11 18:24:59 fca +Coding convention corrections + few minor bug fixes + Revision 1.38 2000/06/20 13:05:45 fca Writing down the TREE headers before job starts @@ -1473,7 +1476,7 @@ void AliRun::SetCurrentTrack(Int_t track) //_____________________________________________________________________________ void AliRun::SetTrack(Int_t done, Int_t parent, Int_t pdg, Float_t *pmom, Float_t *vpos, Float_t *polar, Float_t tof, - const char *mecha, Int_t &ntr, Float_t weight) + const char* /* mecha */, Int_t &ntr, Float_t weight) { // // Load a track on the stack @@ -1582,7 +1585,7 @@ AliRun& AliRun::operator = (const AliRun &run) //_____________________________________________________________________________ -void AliRun::Copy(AliRun &run) const +void AliRun::Copy(AliRun &/* run */) const { // // Copy *this onto run, not implemented for AliRun diff --git a/STEER/Makefile b/STEER/Makefile index c2ba22d9d00..5188e92d593 100644 --- a/STEER/Makefile +++ b/STEER/Makefile @@ -15,7 +15,7 @@ SRCS = AliDetector.cxx AliHeader.cxx AliMagF.cxx \ AliLego.cxx AliModule.cxx AliDigitNew.cxx \ AliGeometry.cxx AliRecPoint.cxx AliSegmentation.cxx \ AliHitMap.cxx AliMagFC.cxx AliMagFCM.cxx \ - AliMagFDM.cxx + AliMagFDM.cxx AliLegoGenerator.cxx # C++ Headers diff --git a/TGeant3/TGeant3.cxx b/TGeant3/TGeant3.cxx index 43a75efd891..502dd5c796a 100644 --- a/TGeant3/TGeant3.cxx +++ b/TGeant3/TGeant3.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.29 2000/07/11 18:24:59 fca +Coding convention corrections + few minor bug fixes + Revision 1.28 2000/06/29 10:51:55 morsch Add some charmed and bottom baryons to the particle list (TDatabasePDG). This is needed by Hijing. Should be part of a future review of TDatabasePDG. @@ -563,11 +566,11 @@ void TGeant3::DefaultRange() // // Set range of current drawing pad to 20x20 cm // - if (!higz) { + if (!gHigz) { new THIGZ(defSize); gdinit(); } - higz->Range(0,0,20,20); + gHigz->Range(0,0,20,20); } //____________________________________________________________________________ @@ -576,7 +579,7 @@ void TGeant3::InitHIGZ() // // Initialise HIGZ // - if (!higz) { + if (!gHigz) { new THIGZ(defSize); gdinit(); } @@ -1124,9 +1127,8 @@ const char* TGeant3::VolName(Int_t id) const // // Return the volume name given the volume identifier // - const char name[5]="NULL"; if(id<1 || id > fGcnum->nvolum || fGclink->jvolum<=0) - return name; + return fVolNames[fGcnum->nvolum]; else return fVolNames[id-1]; } @@ -1196,9 +1198,9 @@ void TGeant3::SetProcess(const char* flagName, Int_t flagValue) } //_____________________________________________________________________________ -Float_t TGeant3::Xsec(char* reac, Float_t energy, Int_t part, Int_t mate) +Float_t TGeant3::Xsec(char* reac, Float_t /* energy */, + Int_t part, Int_t /* mate */) { - Int_t gpart = IdFromPDG(part); if(!strcmp(reac,"PHOT")) { if(part!=22) { @@ -1746,12 +1748,13 @@ void TGeant3::Ggclos() // ggclos(); // Create internal list of volumes - fVolNames = new char[fGcnum->nvolum][5]; + fVolNames = new char[fGcnum->nvolum+1][5]; Int_t i; for(i=0; involum; ++i) { strncpy(fVolNames[i], (char *) &fZiq[fGclink->jvolum+i+1], 4); fVolNames[i][4]='\0'; } + strcpy(fVolNames[fGcnum->nvolum],"NULL"); } //_____________________________________________________________________________ @@ -2830,7 +2833,7 @@ void TGeant3::Gdopen(Int_t iview) // with solid colours can now be stored in a view bank or in 'PICTURE FILES' // InitHIGZ(); - higz->Clear(); + gHigz->Clear(); gdopen(iview); } @@ -2935,7 +2938,7 @@ void TGeant3::Gdraw(const char *name,Float_t theta, Float_t phi, Float_t psi, // string for the NAME of the volume can be found using the command DTREE). // InitHIGZ(); - higz->Clear(); + gHigz->Clear(); char vname[5]; Vname(name,vname); if (fGcvdma->raytra != 1) { @@ -2966,7 +2969,7 @@ void TGeant3::Gdrawc(const char *name,Int_t axis, Float_t cut,Float_t u0, // the CVOL/BOX function. // InitHIGZ(); - higz->Clear(); + gHigz->Clear(); char vname[5]; Vname(name,vname); gdrawc(PASSCHARD(vname), axis,cut,u0,v0,ul,vl PASSCHARL(vname)); @@ -2995,7 +2998,7 @@ void TGeant3::Gdrawx(const char *name,Float_t cutthe, Float_t cutphi, // The resulting picture is seen from the viewing angles theta,phi. // InitHIGZ(); - higz->Clear(); + gHigz->Clear(); char vname[5]; Vname(name,vname); gdrawx(PASSCHARD(vname), cutthe,cutphi,cutval,theta,phi,u0,v0,ul,vl @@ -3066,7 +3069,7 @@ void TGeant3::Gdspec(const char *name) // volume. // InitHIGZ(); - higz->Clear(); + gHigz->Clear(); char vname[5]; Vname(name,vname); gdspec(PASSCHARD(vname) PASSCHARL(vname)); @@ -3079,11 +3082,11 @@ void TGeant3::DrawOneSpec(const char *name) // Function called when one double-clicks on a volume name // in a TPavelabel drawn by Gdtree. // - THIGZ *higzSave = higz; + THIGZ *higzSave = gHigz; higzSave->SetName("higzSave"); THIGZ *higzSpec = (THIGZ*)gROOT->FindObject("higzSpec"); - //printf("DrawOneSpec, higz=%x, higzSpec=%x\n",higz,higzSpec); - if (higzSpec) higz = higzSpec; + //printf("DrawOneSpec, gHigz=%x, higzSpec=%x\n",gHigz,higzSpec); + if (higzSpec) gHigz = higzSpec; else higzSpec = new THIGZ(defSize); higzSpec->SetName("higzSpec"); higzSpec->cd(); @@ -3094,7 +3097,7 @@ void TGeant3::DrawOneSpec(const char *name) higzSpec->Update(); higzSave->cd(); higzSave->SetName("higz"); - higz = higzSave; + gHigz = higzSave; } //_____________________________________________________________________________ @@ -3114,11 +3117,11 @@ void TGeant3::Gdtree(const char *name,Int_t levmax, Int_t isel) // - drawing tree of parent // InitHIGZ(); - higz->Clear(); + gHigz->Clear(); char vname[5]; Vname(name,vname); gdtree(PASSCHARD(vname), levmax, isel PASSCHARL(vname)); - higz->fPname = ""; + gHigz->fPname = ""; } //_____________________________________________________________________________ @@ -3132,7 +3135,7 @@ void TGeant3::GdtreeParent(const char *name,Int_t levmax, Int_t isel) // This function draws the logical tree of the parent of name. // InitHIGZ(); - higz->Clear(); + gHigz->Clear(); // Scan list of volumes in JVOLUM char vname[5]; Int_t gname, i, jvo, in, nin, jin, num; @@ -3148,7 +3151,7 @@ void TGeant3::GdtreeParent(const char *name,Int_t levmax, Int_t isel) strncpy(vname,(char*)&fZiq[fGclink->jvolum+i],4); vname[4] = 0; gdtree(PASSCHARD(vname), levmax, isel PASSCHARL(vname)); - higz->fPname = ""; + gHigz->fPname = ""; return; } } diff --git a/TGeant3/TGeant3Dummy.cxx b/TGeant3/TGeant3Dummy.cxx index 7a47bbe6bb6..b20350e2c46 100644 --- a/TGeant3/TGeant3Dummy.cxx +++ b/TGeant3/TGeant3Dummy.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.22 2000/07/11 18:25:00 fca +Coding convention corrections + few minor bug fixes + Revision 1.21 2000/06/27 09:26:18 fca Adding dummy SetSTRA @@ -158,10 +161,10 @@ void TGeant3::Gfpart(Int_t, char*, Int_t&, Float_t&, Float_t&, Float_t&){} //___________________________________________ void TGeant3::Gftmed(Int_t, char*, Int_t&, Int_t&, Int_t&, Float_t&, Float_t&, Float_t&, Float_t&, Float_t&, Float_t&, Float_t*, Int_t*){} -void TGeant3::Gftmat(Int_t imate, Int_t ipart, char *chmeca, Int_t kdim, - Float_t* tkin, Float_t* value, Float_t* pcut, Int_t &ixst){} -Float_t TGeant3::Gbrelm(Float_t z, Float_t t, Float_t cut){return (Float_t) 0;} -Float_t TGeant3::Gprelm(Float_t z, Float_t t, Float_t cut){return (Float_t) 0;} +void TGeant3::Gftmat(Int_t, Int_t, char*, Int_t, Float_t*, Float_t*, + Float_t*, Int_t&){} +Float_t TGeant3::Gbrelm(Float_t, Float_t, Float_t){return (Float_t) 0;} +Float_t TGeant3::Gprelm(Float_t, Float_t, Float_t){return (Float_t) 0;} //___________________________________________ diff --git a/TGeant3/TGeant3GUI.cxx b/TGeant3/TGeant3GUI.cxx index f71e56de24e..12f7d9af1f2 100644 --- a/TGeant3/TGeant3GUI.cxx +++ b/TGeant3/TGeant3GUI.cxx @@ -15,6 +15,11 @@ /* $Log$ +Revision 1.7 2000/06/28 21:27:45 morsch +Most coding rule violations corrected. +Still to do: Split the file (on file per class) ? Avoid the global variables. +Copy constructors and assignment operators (dummy ?) + Revision 1.6 2000/04/14 11:07:46 morsch Correct volume to medium assignment in case several media are asigned to the same material. @@ -807,9 +812,9 @@ AliGuiGeomMain::AliGuiGeomMain(const TGWindow *p, UInt_t w, UInt_t h) // fTab = new TGTab(this, 400, 400); TGCompositeFrame *tf = fTab->AddTab("Volumes"); - TGLayoutHints *fLTab = new TGLayoutHints(kLHintsBottom | kLHintsExpandX | + TGLayoutHints *lTab = new TGLayoutHints(kLHintsBottom | kLHintsExpandX | kLHintsExpandY, 2, 2, 5, 1); - AddFrame(fTab, fLTab); + AddFrame(fTab, lTab); // Create TGCanvas and a canvas container which uses a tile layout manager fCanvasWindow = new TGCanvas(tf, 400, 240); @@ -848,7 +853,8 @@ AliGuiGeomMain::AliGuiGeomMain(const TGWindow *p, UInt_t w, UInt_t h) new TGLayoutHints(kLHintsLeft | kLHintsExpandX ); fF21 = new TGCompositeFrame(fF2, 60, 20, kVerticalFrame); fF2->AddFrame(fF21,fL2); - for (Int_t i=0; i<6; i++) { + { //Begin local scope for i + for (Int_t i=0; i<6; i++) { Int_t idT=i+1; fHframe[i] = new TGHorizontalFrame(fF21, 400, 100, kFixedWidth); fF21->AddFrame(fHframe[i], bly); @@ -858,11 +864,12 @@ AliGuiGeomMain::AliGuiGeomMain(const TGWindow *p, UInt_t w, UInt_t h) fLabel[i] = new TGLabel(fHframe[i], labelText[i]); fHframe[i]->AddFrame(fLabel[i], bFly1); fHframe[i]->AddFrame(fTeh[i], bFly1); - } - tf->AddFrame(fF2, fL2); - fMaterialCombo->Resize(200, 20); - fMaterialCombo->Associate(this); - + } + } //End local scope for i + tf->AddFrame(fF2, fL2); + fMaterialCombo->Resize(200, 20); + fMaterialCombo->Associate(this); + // Media Combo // @@ -899,9 +906,9 @@ AliGuiGeomMain::AliGuiGeomMain(const TGWindow *p, UInt_t w, UInt_t h) fHframeM[i]->AddFrame(fTehM[i], bFly1); } } //End local scope for i - tf->AddFrame(fF3, fL2); - fMediaCombo->Resize(200, 20); - fMediaCombo->Associate(this); + tf->AddFrame(fF3, fL2); + fMediaCombo->Resize(200, 20); + fMediaCombo->Associate(this); // // Processes tf = fTab->AddTab("Processes"); @@ -1046,10 +1053,12 @@ void AliGuiGeomMain::Plot() tmp[4]='\0'; Int_t kdim=fNbins; Float_t de=(fEmax-fEmin)/fNbins; - for (Int_t i=0; iGftmat(imate, ipart, tmp, kdim, tkin, value, pcut, ixst); } else { @@ -1276,14 +1285,14 @@ Bool_t AliGuiGeomMain::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2) // // Handle mouse click case kCT_ITEMCLICK: - TGListTreeItem *item; // // Button 1: Select volume if (parm1 == kButton1) { - if ((item = fLt->GetSelected())) + TGListTreeItem *item; + if ((item = fLt->GetSelected())) { - gCurrentVolume=((AliDrawVolume *) item->GetUserData()); - Update(); + gCurrentVolume=((AliDrawVolume *) item->GetUserData()); + Update(); } } // diff --git a/TGeant3/THIGZ.cxx b/TGeant3/THIGZ.cxx index 669c4d6db68..199262c4979 100644 --- a/TGeant3/THIGZ.cxx +++ b/TGeant3/THIGZ.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.4 1999/09/29 09:24:31 fca +Introduction of the Copyright and cvs Log + */ /////////////////////////////////////////////////////////////////////////////// @@ -123,7 +126,7 @@ static Int_t npid = 0; static char cpar[1200]; static TGeant3 *geant3=(TGeant3*)gMC; -THIGZ *higz = 0; +THIGZ *gHigz = 0; ClassImp(THIGZ) @@ -137,7 +140,7 @@ THIGZ::THIGZ() THIGZ::THIGZ(Int_t size) :TCanvas("higz","higz",size,size) { - higz = this; + gHigz = this; Reset(); SetFillColor(10); } @@ -369,7 +372,7 @@ extern "C" void type_of_call iacwk(Int_t &) extern "C" void type_of_call iclrwk(Int_t &,Int_t &) { // printf("iclrwk called\n"); - higz->Clear(); + gHigz->Clear(); } //_______________________________________________________________ @@ -388,9 +391,9 @@ extern "C" void type_of_call idawk(Int_t &) //_______________________________________________________________ extern "C" void type_of_call ifa(Int_t &n,Float_t *x, Float_t *y) { -// printf("ifa called, n=%d, pname=%s, pid=%d, x1=%f, y1=%f,x2=%f, y2=%f, x3=%f, y3=%f\n",n,higz->fPname.Data(),higz->fPID,x[0],y[0],x[1],y[1],x[2],y[2]); +// printf("ifa called, n=%d, pname=%s, pid=%d, x1=%f, y1=%f,x2=%f, y2=%f, x3=%f, y3=%f\n",n,gHigz->fPname.Data(),gHigz->fPID,x[0],y[0],x[1],y[1],x[2],y[2]); TGraph *gr = new TGraph(n,x,y); - gr->SetFillColor(higz->fFACI); + gr->SetFillColor(gHigz->fFACI); gr->Draw("f"); } @@ -399,9 +402,9 @@ extern "C" void type_of_call igbox(Float_t &x1,Float_t &x2,Float_t &y1,Float_t & { printf("igbox called, x1=%f, y1=%f, x2=%f, y2=%f\n",x1,y1,x2,y2); TBox *box = new TBox(x1,y1,x2,y2); - box->SetLineColor(higz->fPLCI); - box->SetFillColor(higz->fFACI); - box->SetFillStyle(higz->fFASI); + box->SetLineColor(gHigz->fPLCI); + box->SetFillColor(gHigz->fFACI); + box->SetFillStyle(gHigz->fFASI); box->Draw(); } @@ -417,14 +420,14 @@ extern "C" void type_of_call ightor(Float_t &h,Float_t &l,Float_t &s,Float_t &r, extern "C" void type_of_call igpave(Float_t &x1,Float_t &x2,Float_t &yy1,Float_t &yy2,Float_t &,Int_t &isbox,Int_t &isfram,const char *, const Int_t) { char text[5]; - strncpy(text,(char*)&higz->fPID,4); + strncpy(text,(char*)&gHigz->fPID,4); text[4] = 0; Float_t y1 = yy1; Float_t y2 = yy2; if (y1 > y2) { y1 = yy2; y2 = yy1;} Float_t y = 0.5*(y1+y2); - Float_t dymax = 0.06*(higz->GetY2()-higz->GetY1()); - Float_t dymin = -higz->PixeltoY(12); + Float_t dymax = 0.06*(gHigz->GetY2()-gHigz->GetY1()); + Float_t dymin = -gHigz->PixeltoY(12); if (y2-y1 > dymax) { y1 = y - 0.5*dymax; y2 = y + 0.5*dymax; @@ -438,7 +441,7 @@ extern "C" void type_of_call igpave(Float_t &x1,Float_t &x2,Float_t &yy1,Float_t pt->SetFillColor(isbox%1000); pt->SetLineColor(isfram%1000); pt->Draw(); -// printf("igpave called, text=%s, Pname=%s, x1=%f, y1=%f, x2=%f, y2=%f, isbox=%d, isfram=%d\n",text,higz->fPname.Data(),x1,y1,x2,y2,isbox,isfram); +// printf("igpave called, text=%s, Pname=%s, x1=%f, y1=%f, x2=%f, y2=%f, isbox=%d, isfram=%d\n",text,gHigz->fPname.Data(),x1,y1,x2,y2,isbox,isfram); } //_______________________________________________________________ @@ -451,11 +454,11 @@ extern "C" void type_of_call igpid(Int_t &,const char *name,const Int_t l1, Int_ npid++; // if(npid&100 == 0) printf("igpid called, npid=%d\n",npid); strncpy(cpar,name,l1); cpar[l1] = 0; - higz->fPname = cpar; - higz->fPID = pid; + gHigz->fPname = cpar; + gHigz->fPID = pid; // char text[5]; -// strncpy(text,(char*)&higz->fPID,4); +// strncpy(text,(char*)&gHigz->fPID,4); // text[4] = 0; // printf("igpid called, level=%d, name=%s, pid=%d, cpid=%s\n",level,cpar,pid,text); } @@ -469,14 +472,14 @@ extern "C" void type_of_call igq(const char *name,const Int_t l1, Float_t &rval) { strncpy(cpar,name,l1); cpar[l1] = 0; // printf("igq called, name=%s\n",cpar); - rval = higz->Get(cpar); + rval = gHigz->Get(cpar); } //_______________________________________________________________ extern "C" void type_of_call igrng(Float_t &xsize,Float_t &ysize) { // printf("igrng called, xsize=%f, ysize=%f\n",xsize,ysize); - higz->Range(0,0,xsize,ysize); + gHigz->Range(0,0,xsize,ysize); } //_______________________________________________________________ @@ -494,7 +497,7 @@ extern "C" void type_of_call igset(const char *name, const Int_t l1,Float_t &rva { strncpy(cpar,name,l1); cpar[l1] = 0; // printf("igset called, name=%s, rval=%f\n",cpar,rval); - higz->Set(cpar,rval); + gHigz->Set(cpar,rval); } //_______________________________________________________________ @@ -515,15 +518,15 @@ extern "C" void type_of_call ipl(Int_t &n,Float_t *x,Float_t *y) // printf("ipl called, n=%d, x[0]=%f,y[0]=%f, x[1]=%f, y[1]=%f\n",n,x[0],y[0],x[1],y[1]); if (n <= 2) { TLine *l = new TLine(x[0],y[0],x[1],y[1]); - l->SetLineColor(higz->fPLCI); - l->SetLineStyle(higz->fLTYP); - l->SetLineWidth(Short_t(higz->fLWID)); + l->SetLineColor(gHigz->fPLCI); + l->SetLineStyle(gHigz->fLTYP); + l->SetLineWidth(Short_t(gHigz->fLWID)); l->Draw(); } else { TPolyLine *pl = new TPolyLine(n,x,y); - pl->SetLineColor(higz->fPLCI); - pl->SetLineStyle(higz->fLTYP); - pl->SetLineWidth(Short_t(higz->fLWID)); + pl->SetLineColor(gHigz->fPLCI); + pl->SetLineStyle(gHigz->fLTYP); + pl->SetLineWidth(Short_t(gHigz->fLWID)); pl->Draw(); } } @@ -533,9 +536,9 @@ extern "C" void type_of_call ipm(Int_t &n,Float_t *x,Float_t *y) { printf("ipm called, n=%d\n",n); TPolyMarker *pm = new TPolyMarker(n,x,y); - pm->SetMarkerColor(higz->fPMCI); - pm->SetMarkerStyle(higz->fMTYP); - pm->SetMarkerSize(higz->fMSCF); + pm->SetMarkerColor(gHigz->fPMCI); + pm->SetMarkerStyle(gHigz->fMTYP); + pm->SetMarkerSize(gHigz->fMSCF); pm->Draw(); } @@ -567,35 +570,35 @@ extern "C" void type_of_call isfaci(Int_t &col) // printf("isfaci called, col=%d\n",col); Int_t color = col%1000; // if (color > 10) color += 35; - higz->fFACI = color; + gHigz->fFACI = color; } //_______________________________________________________________ extern "C" void type_of_call isfais(Int_t &is) { // printf("isfais called, is=%d\n",is); - higz->fFAIS = is; + gHigz->fFAIS = is; } //_______________________________________________________________ extern "C" void type_of_call isln(Int_t &ln) { // printf("isln called, ln=%d\n",ln); - higz->fLTYP = ln; + gHigz->fLTYP = ln; } //_______________________________________________________________ extern "C" void type_of_call ismk(Int_t &mk) { // printf("ismk called, mk=%d\n",mk); - higz->fMTYP = mk; + gHigz->fMTYP = mk; } //_______________________________________________________________ extern "C" void type_of_call islwsc(Float_t &wl) { // printf("islwsc called, wl=%f\n",wl); - higz->fLWID = wl; + gHigz->fLWID = wl; } //_______________________________________________________________ @@ -604,7 +607,7 @@ extern "C" void type_of_call isplci(Int_t &col) // printf("isplci called, col=%d\n",col); Int_t color = col%1000; // if (color > 10) color += 35; - higz->fPLCI = color; + gHigz->fPLCI = color; } //_______________________________________________________________ @@ -613,7 +616,7 @@ extern "C" void type_of_call ispmci(Int_t &col) // printf("ispmci called, col=%d\n",col); Int_t color = col%1000; // if (color > 10) color += 35; - higz->fPMCI = color; + gHigz->fPMCI = color; } //_______________________________________________________________ @@ -622,7 +625,7 @@ extern "C" void type_of_call istxci(Int_t &col) // printf("istxci called, col=%d\n",col); Int_t color = col%1000; // if (color > 10) color += 35; - higz->fTXCI = color; + gHigz->fTXCI = color; } //_______________________________________________________________ @@ -636,13 +639,13 @@ extern "C" void type_of_call iswn(Int_t &,Float_t &x1,Float_t &x2,Float_t &y1,Fl { // printf("iswn called, nt=%d, x1=%f, y1=%f, x2=%f, y2=%f\n",nt,x1,y1,x2,y2); - higz->Range(x1,y1,x2,y2); + gHigz->Range(x1,y1,x2,y2); } //_______________________________________________________________ extern "C" void type_of_call itx(Float_t &x,Float_t &y,const char *ptext, const Int_t l1p) { - if (higz->fPname == "Tree") return; + if (gHigz->fPname == "Tree") return; Int_t l1=l1p; strncpy(cpar,ptext,l1); cpar[l1] = 0; //printf("itx called, x=%f, y=%f, text=%s, l1=%d\n",x,y,cpar,l1); @@ -657,11 +660,11 @@ extern "C" void type_of_call itx(Float_t &x,Float_t &y,const char *ptext, const small++; } TText *text = new TText(x,y,cpar); - text->SetTextColor(higz->fTXCI); - text->SetTextSize(higz->fCHHE); - text->SetTextFont(higz->fTXFP); - text->SetTextAlign(higz->fTXAL); - text->SetTextAngle(higz->fTANG); + text->SetTextColor(gHigz->fTXCI); + text->SetTextSize(gHigz->fCHHE); + text->SetTextFont(gHigz->fTXFP); + text->SetTextAlign(gHigz->fTXAL); + text->SetTextAngle(gHigz->fTANG); text->Draw(); } @@ -682,8 +685,8 @@ extern "C" void type_of_call hplend() extern "C" void type_of_call hplfra(Float_t &x1,Float_t &x2,Float_t &y1, Float_t &y2,const char *, const Int_t) { // printf("hplfra called, x1=%f, y1=%f, x2=%f, y2=%f\n",x1,y1,x2,y2); - higz->Clear(); - higz->Range(x1,y1,x2,y2); + gHigz->Clear(); + gHigz->Range(x1,y1,x2,y2); } //_______________________________________________________________ @@ -710,6 +713,6 @@ extern "C" void type_of_call igqwk(Int_t &, const char *name, Float_t &rval, con { strncpy(cpar,name,l1); cpar[l1] = 0; // printf("igqwk called, wid=%d, pname=%s\n",wid,cpar); - rval = higz->Get(cpar); + rval = gHigz->Get(cpar); } diff --git a/TGeant3/THIGZ.h b/TGeant3/THIGZ.h index 87e579d4971..cb709d36da2 100644 --- a/TGeant3/THIGZ.h +++ b/TGeant3/THIGZ.h @@ -69,7 +69,7 @@ public: ClassDef(THIGZ,1) //Emulation of HIGZ for Root }; - R__EXTERN THIGZ *higz; + R__EXTERN THIGZ *gHigz; inline void THIGZ::Divide(Int_t, Int_t, Float_t, Float_t, Int_t) { } inline void THIGZ::SetGrid(Int_t, Int_t) { } -- 2.39.3