From e2afb3b68fe35ef24d08011ecde1da0fbf967d28 Mon Sep 17 00:00:00 2001 From: hristov Date: Tue, 29 Oct 2002 14:26:50 +0000 Subject: [PATCH] Code clean-up (F.Carminati) --- STEER/AliConfig.cxx | 18 +- STEER/AliConfig.h | 15 +- STEER/AliDebugVolume.cxx | 5 +- STEER/AliDebugVolume.h | 2 +- STEER/AliDetector.cxx | 54 ++-- STEER/AliDetector.h | 2 +- STEER/AliDigitNew.cxx | 12 +- STEER/AliDigitNew.h | 4 +- STEER/AliDigitizer.cxx | 64 +++-- STEER/AliDigitizer.h | 7 +- STEER/AliDisplay.cxx | 519 ++++++++++++++++++++---------------- STEER/AliESD.cxx | 163 +++++++++-- STEER/AliESD.h | 6 +- STEER/AliFieldMap.cxx | 99 +++++-- STEER/AliGausCorr.cxx | 46 ++-- STEER/AliGenEventHeader.cxx | 35 ++- STEER/AliGenerator.cxx | 127 +++++++-- STEER/AliGenerator.h | 2 +- STEER/AliHeader.cxx | 92 +++++-- STEER/AliHeader.h | 10 +- STEER/AliHit.cxx | 23 +- STEER/AliKalmanTrack.cxx | 24 ++ STEER/AliKalmanTrack.h | 30 +-- STEER/AliLego.cxx | 498 ++++++++++++++++++---------------- STEER/AliLego.h | 8 +- STEER/AliLegoGenerator.cxx | 70 +++-- STEER/AliMCQA.cxx | 130 +++++---- STEER/AliMCQA.h | 8 +- STEER/AliMagF.cxx | 57 ++-- STEER/AliMagF.h | 28 +- STEER/AliMagFCM.cxx | 84 ++++-- STEER/AliMagFCM.h | 5 +- STEER/AliMagFDM.cxx | 131 ++++++--- STEER/AliMagFDM.h | 4 +- STEER/AliMagFMaps.cxx | 258 +++++++++--------- STEER/AliMagFMaps.h | 9 +- STEER/AliMergeCombi.cxx | 41 +-- STEER/AliModule.cxx | 145 +++++----- STEER/AliModule.h | 20 +- STEER/AliPoints.cxx | 80 +++--- STEER/AliPoints.h | 12 +- STEER/AliRecPoint.cxx | 101 +++---- STEER/AliRecPoint.h | 10 +- STEER/AliRndm.cxx | 34 ++- STEER/AliRndm.h | 12 +- STEER/AliRun.cxx | 479 +++++++++++++++++++-------------- STEER/AliRun.h | 50 ++-- STEER/AliRunDigitizer.cxx | 214 +++++++++------ STEER/AliRunDigitizer.h | 31 ++- STEER/AliSegmentation.h | 2 +- STEER/AliStack.cxx | 142 ++++++---- STEER/AliStack.h | 17 +- STEER/AliStream.cxx | 97 ++++--- STEER/AliStream.h | 12 +- STEER/AliTrackMap.cxx | 95 ++++--- STEER/AliTrackMap.h | 12 +- STEER/AliTrackMapper.cxx | 84 +++--- STEER/AliTrackMapper.h | 4 +- STEER/AliTrackReference.cxx | 13 +- 59 files changed, 2692 insertions(+), 1664 deletions(-) diff --git a/STEER/AliConfig.cxx b/STEER/AliConfig.cxx index 4df26f526a1..252edcfae53 100644 --- a/STEER/AliConfig.cxx +++ b/STEER/AliConfig.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.7 2002/10/23 07:43:00 alibrary +Introducing some effective C++ suggestions + Revision 1.6 2002/10/22 15:02:15 alibrary Introducing Riostream.h @@ -88,7 +91,8 @@ AliConfig::AliConfig(): } //____________________________________________________________________________ -AliConfig::AliConfig(const AliConfig&): +AliConfig::AliConfig(const AliConfig& conf): + TNamed(conf), fTopFolder(0), fTasks(0), fPDGFolder(0), @@ -244,7 +248,7 @@ AliConfig::~AliConfig() } //____________________________________________________________________________ -void AliConfig::AddInFolder (char *dir, TObject *obj) +void AliConfig::AddInFolder (const char *dir, TObject *obj) { TFolder *folder = dynamic_cast(fTopFolder->FindObject(dir)); @@ -287,7 +291,7 @@ void AliConfig::AddSubTask(char * dir[], TObject *obj) } //____________________________________________________________________________ -TObject* AliConfig::FindInFolder (char *dir, const char *name) +TObject* AliConfig::FindInFolder (const char *dir, const char *name) { if(!name) return(fTopFolder->FindObject(name)); TFolder * folder = dynamic_cast(fTopFolder->FindObject(dir)); @@ -370,8 +374,8 @@ void AliConfig::Add (char *list) while ((obj = next ())) { TString dir(obj->GetName()); - TString path = dir + "/" + token; - TString macro = path + ".C"; + TString tpath = dir + "/" + token; + TString macro = tpath + ".C"; if (!gSystem->AccessPathName (macro.Data())) { gInterpreter->ExecuteMacro (macro.Data()); found = "(" + macro + ")"; @@ -385,11 +389,11 @@ void AliConfig::Add (char *list) } break; } else { - TString macroDefault = path + "/Default.C"; + TString macroDefault = tpath + "/Default.C"; if (!gSystem->AccessPathName (macroDefault.Data())) { gInterpreter->ExecuteMacro (macroDefault.Data()); found = "(" + macro + ")"; - TString macroConfigure = path + "/Configure.C"; + TString macroConfigure = tpath + "/Configure.C"; if (!gSystem->AccessPathName (macroConfigure.Data())) { gInterpreter->ExecuteMacro (macroConfigure.Data()); found += " => Configured"; diff --git a/STEER/AliConfig.h b/STEER/AliConfig.h index 4b1572b1de1..ad00846c6f4 100644 --- a/STEER/AliConfig.h +++ b/STEER/AliConfig.h @@ -6,6 +6,9 @@ /* $Id$ */ /* * $Log$ + * Revision 1.6 2002/10/22 15:02:15 alibrary + * Introducing Riostream.h + * * Revision 1.5 2002/10/14 14:57:32 hristov * Merging the VirtualMC branch to the main development branch (HEAD) * @@ -60,19 +63,19 @@ private: enum {kFolders=8, kTasks=5}; AliConfig(const char * name, const char * title); AliConfig(const AliConfig&); - void AddInFolder (char * dir, TObject *obj); + void AddInFolder (const char * dir, TObject *obj); void AddSubFolder(char * dir[], TObject *obj); void AddSubTask(char * dir[], TObject *obj); - TObject* FindInFolder (char *dir, const char *name); + TObject* FindInFolder (const char *dir, const char *name); AliConfig& operator = (const AliConfig&) {return *this;} TFolder *fTopFolder; AliTasks *fTasks; // folders - char* fPDGFolder ; - char* fGeneratorFolder ; - char* fMCFolder ; - char* fModuleFolder ; + const char* fPDGFolder ; + const char* fGeneratorFolder ; + const char* fMCFolder ; + const char* fModuleFolder ; char** fDetectorFolder ; char** fDetectorTask ; diff --git a/STEER/AliDebugVolume.cxx b/STEER/AliDebugVolume.cxx index f16da06e0dd..c09da92b876 100644 --- a/STEER/AliDebugVolume.cxx +++ b/STEER/AliDebugVolume.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.2 2002/10/23 07:43:00 alibrary +Introducing some effective C++ suggestions + Revision 1.1 2001/05/11 13:21:16 morsch Geom. volume data class. Can be used during lego run for debugging. @@ -57,7 +60,7 @@ AliDebugVolume::AliDebugVolume(const char *name, Int_t copy, Float_t step, //_______________________________________________________________________ -Bool_t AliDebugVolume::IsEqual(const char* name, const Int_t copy) const +Bool_t AliDebugVolume::IsVEqual(const char* name, const Int_t copy) const { return (copy == fCopy && strcmp(name, fName) == 0); } diff --git a/STEER/AliDebugVolume.h b/STEER/AliDebugVolume.h index 19e22371a99..c01e9809ae6 100644 --- a/STEER/AliDebugVolume.h +++ b/STEER/AliDebugVolume.h @@ -22,7 +22,7 @@ public: char* Status() const; - Bool_t IsEqual(const char* name, const Int_t copy) const; + Bool_t IsVEqual(const char* name, const Int_t copy) const; private: Int_t fCopy; //!Volume copy number Float_t fStep; //!Stepsize to volume boundary diff --git a/STEER/AliDetector.cxx b/STEER/AliDetector.cxx index 1e2c2eec0cf..0d701ae9ecf 100644 --- a/STEER/AliDetector.cxx +++ b/STEER/AliDetector.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.22 2002/10/23 07:43:00 alibrary +Introducing some effective C++ suggestions + Revision 1.21 2002/10/22 15:02:15 alibrary Introducing Riostream.h @@ -133,6 +136,25 @@ AliDetector::AliDetector(): // } +//_______________________________________________________________________ +AliDetector::AliDetector(const AliDetector &det): + AliModule(det), + fTimeGate(200.e-9), + fIshunt(0), + fNhits(0), + fNdigits(0), + fBufferSize(1600), + fHits(0), + fDigits(0), + fDigitsFile(0), + fPoints(0), + fTrackReferences(0), + fMaxIterTrackRef(0), + fCurrentIterTrackRef(0) +{ + det.Copy(*this); +} + //_____________________________________________________________________________ AliDetector::AliDetector(const char* name,const char *title): AliModule(name,title), @@ -188,21 +210,21 @@ void AliDetector::Publish(const char *dir, void *address, const char *name) // // Register pointer to detector objects. // - TFolder *topFolder = (TFolder *)gROOT->FindObjectAny("/Folders"); + TFolder *topFolder = dynamic_cast(gROOT->FindObjectAny("/Folders")); if (topFolder) { - TFolder *folder = (TFolder *)topFolder->FindObjectAny(dir); - // TFolder *folder = (TFolder *)gROOT->FindObjectAny(dir); + TFolder *folder = dynamic_cast(topFolder->FindObjectAny(dir)); + // TFolder *folder = dynamic_cast(gROOT->FindObjectAny(dir)); if (!folder) { cerr << "Cannot register: Missing folder: " << dir << endl; } else { - TFolder *subfolder = (TFolder *) folder->FindObjectAny(this->GetName()); + TFolder *subfolder = dynamic_cast(folder->FindObjectAny(this->GetName())); if(!subfolder) subfolder = folder->AddFolder(this->GetName(),this->GetTitle()); if (address) { - TObject **obj = (TObject **) address; + TObject **obj = static_cast(address); if ((*obj)->InheritsFrom(TCollection::Class())) { - TCollection *collection = (TCollection *) (*obj); + TCollection *collection = dynamic_cast(*obj); if (name) collection->SetName(name); } @@ -246,7 +268,7 @@ TBranch* AliDetector::MakeBranchInTree(TTree *tree, const char* name, sprintf(outFile,"%s/%s",gAlice->GetBaseFile(),file); branch->SetFile(outFile); TIter next( branch->GetListOfBranches()); - while ((branch=(TBranch*)next())) { + while ((branch=dynamic_cast(next()))) { branch->SetFile(outFile); } delete outFile; @@ -256,7 +278,7 @@ TBranch* AliDetector::MakeBranchInTree(TTree *tree, const char* name, if (GetDebug()>1) printf("* MakeBranch * Diverting Branch %s to file %s\n",name,file); } - char *folder = 0; + const char *folder = 0; TString folderName(name); if (!strncmp(tree->GetName(),"TreeE",5)) folder = "RunMC/Event/Data"; @@ -308,12 +330,12 @@ void AliDetector::Browse(TBrowser *b) } //_______________________________________________________________________ -void AliDetector::Copy(AliDetector &det) const +void AliDetector::Copy(AliDetector &) const { // // Copy *this onto det -- not implemented // - Fatal("Copy","Not implemented~\n"); + Fatal("Copy","Not implemented\n"); } //_______________________________________________________________________ @@ -333,7 +355,7 @@ void AliDetector::RemapTrackReferencesIDs(Int_t *map) // if (!fTrackReferences) return; for (Int_t i=0;iGetEntries();i++){ - AliTrackReference * ref = (AliTrackReference*) fTrackReferences->UncheckedAt(i); + AliTrackReference * ref = dynamic_cast(fTrackReferences->UncheckedAt(i)); if (ref) { Int_t newID = map[ref->GetTrack()]; if (newID>=0) ref->SetTrack(newID); @@ -360,7 +382,7 @@ AliHit* AliDetector::FirstHit(Int_t track) // sMaxIterHit=fHits->GetEntriesFast(); sCurIterHit=0; - if(sMaxIterHit) return (AliHit*) fHits->UncheckedAt(0); + if(sMaxIterHit) return dynamic_cast(fHits->UncheckedAt(0)); else return 0; } @@ -382,7 +404,7 @@ AliTrackReference* AliDetector::FirstTrackReference(Int_t track) // fMaxIterTrackRef = fTrackReferences->GetEntriesFast(); fCurrentIterTrackRef = 0; - if(fMaxIterTrackRef) return (AliTrackReference*) fTrackReferences->UncheckedAt(0); + if(fMaxIterTrackRef) return dynamic_cast(fTrackReferences->UncheckedAt(0)); else return 0; } @@ -394,7 +416,7 @@ AliHit* AliDetector::NextHit() // if(sMaxIterHit) { if(++sCurIterHitUncheckedAt(sCurIterHit); + return dynamic_cast(fHits->UncheckedAt(sCurIterHit)); else return 0; } else { @@ -411,7 +433,7 @@ AliTrackReference* AliDetector::NextTrackReference() // if(fMaxIterTrackRef) { if(++fCurrentIterTrackRefUncheckedAt(fCurrentIterTrackRef); + return dynamic_cast(fTrackReferences->UncheckedAt(fCurrentIterTrackRef)); else return 0; } else { @@ -450,7 +472,7 @@ void AliDetector::LoadPoints(Int_t) // // Loop over all the hits and store their position for (Int_t hit=0;hitUncheckedAt(hit); + ahit = dynamic_cast(fHits->UncheckedAt(hit)); trk=ahit->GetTrack(); assert(trk<=tracks); if(ntrk[trk]==limi[trk]) { diff --git a/STEER/AliDetector.h b/STEER/AliDetector.h index e9d81d5cc18..8100fc11128 100644 --- a/STEER/AliDetector.h +++ b/STEER/AliDetector.h @@ -18,7 +18,7 @@ public: // Creators - distructors AliDetector(const char* name, const char *title); AliDetector(); - AliDetector(const AliDetector &det) {det.Copy(*this);} + AliDetector(const AliDetector &det); virtual ~AliDetector(); // Inline functions diff --git a/STEER/AliDigitNew.cxx b/STEER/AliDigitNew.cxx index 86a3b28f863..40d7a952b54 100644 --- a/STEER/AliDigitNew.cxx +++ b/STEER/AliDigitNew.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.2 2000/02/14 11:44:29 fca +New version from Y.Schutz + Revision 1.1 1999/12/17 09:01:14 fca Y.Schutz new classes for reconstruction @@ -24,8 +27,15 @@ Y.Schutz new classes for reconstruction ClassImp(AliDigitNew) -AliDigitNew::AliDigitNew() +//_______________________________________________________________________ +AliDigitNew::AliDigitNew(): + fAmp(0), + fId(0), + fIndexInList(0) { + // + // Default constructor + // } diff --git a/STEER/AliDigitNew.h b/STEER/AliDigitNew.h index 593eb0136ce..d6aba30583e 100644 --- a/STEER/AliDigitNew.h +++ b/STEER/AliDigitNew.h @@ -17,8 +17,8 @@ typedef TClonesArray DigitsList ; class AliDigitNew : public TObject { public: - AliDigitNew() ; - ~AliDigitNew() {;} + AliDigitNew(); + ~AliDigitNew() {} Int_t GetAmp() const { return fAmp ; } Int_t GetId() const { return fId ; } Int_t GetIndexInList() const { return fIndexInList ; } diff --git a/STEER/AliDigitizer.cxx b/STEER/AliDigitizer.cxx index b5fdd2932df..cc8a4f2a12c 100644 --- a/STEER/AliDigitizer.cxx +++ b/STEER/AliDigitizer.cxx @@ -23,6 +23,9 @@ /* $Log$ +Revision 1.6 2002/10/22 15:02:15 alibrary +Introducing Riostream.h + Revision 1.5 2002/10/14 14:57:32 hristov Merging the VirtualMC branch to the main development branch (HEAD) @@ -54,35 +57,58 @@ ABC for detector digits merging/digitization ClassImp(AliDigitizer) -AliDigitizer::AliDigitizer(const Text_t* name, const Text_t* title) - :TTask(name,title) +//_______________________________________________________________________ +AliDigitizer::AliDigitizer(const Text_t* name, const Text_t* title): + TTask(name,title), + fManager(0) + { -// -// dummy default ctor with name and title -// - fManager = 0; + // + // Default ctor with name and title + // } -AliDigitizer::AliDigitizer(AliRunDigitizer *manager, - const Text_t* name, const Text_t* title) - :TTask(name,title) +//_______________________________________________________________________ +AliDigitizer::AliDigitizer(const AliDigitizer &dig): + TTask(dig.GetName(),dig.GetTitle()), + fManager(0) { -// -// ctor with name and title -// - fManager = manager; - manager->AddDigitizer(this); + // + // Copy ctor with + // + dig.Copy(*this); +} + +//_______________________________________________________________________ +void AliDigitizer::Copy(AliDigitizer &) const +{ + Fatal("Copy","Not yet implemented\n"); } +//_______________________________________________________________________ +AliDigitizer::AliDigitizer(AliRunDigitizer *manager, + const Text_t* name, const Text_t* title): + TTask(name,title), + fManager(manager) +{ + // + // ctor with name and title + // + fManager->AddDigitizer(this); +} +//_______________________________________________________________________ +AliDigitizer::~AliDigitizer() +{ + delete fManager; +} -AliDigitizer::~AliDigitizer() {;} -//////////////////////////////////////////////////////////////////////// +//_______________________________________________________________________ Int_t AliDigitizer::GetNInputStreams() const { -// -// return number of input streams -// + // + // return number of input streams + // Int_t nInputStreams = 0 ; if (fManager) nInputStreams = fManager->GetNinputs() ; diff --git a/STEER/AliDigitizer.h b/STEER/AliDigitizer.h index 1067ff4bd58..d2ed25bba61 100644 --- a/STEER/AliDigitizer.h +++ b/STEER/AliDigitizer.h @@ -27,13 +27,18 @@ class AliDigitizer: public TTask { AliDigitizer(AliRunDigitizer *manager, const Text_t* name="AliDigitizer", const Text_t* title="AliDigitizer"); +// Copy ctor needed because there is a pointer + AliDigitizer(const AliDigitizer &dig); + AliDigitizer& operator=(AliDigitizer &dig) + {dig.Copy(*this);return *this;} virtual ~AliDigitizer(); virtual Bool_t Init() {return kTRUE;} // virtual void Digitize() = 0; - protected: +protected: Int_t GetNInputStreams() const; + void Copy(AliDigitizer &dig) const; AliRunDigitizer *fManager; diff --git a/STEER/AliDisplay.cxx b/STEER/AliDisplay.cxx index a1cc12681b5..d95ddb09ed0 100644 --- a/STEER/AliDisplay.cxx +++ b/STEER/AliDisplay.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.19 2002/10/14 14:57:32 hristov +Merging the VirtualMC branch to the main development branch (HEAD) + Revision 1.17.6.1 2002/06/10 14:43:06 hristov Merged with v3-08-02 @@ -71,28 +74,28 @@ Introduction of the Copyright and cvs Log // // ////////////////////////////////////////////////////////////////////////// -#include +#include #include #include -#include +#include +#include +#include #include #include -#include -#include #include #include -#include +#include +#include #include -#include -#include "AliRun.h" -#include "AliStack.h" #include "AliDetector.h" #include "AliDisplay.h" +#include "AliHeader.h" #include "AliPoints.h" -#include "TParticle.h" +#include "AliRun.h" +#include "AliStack.h" #include "TGeometry.h" -#include "AliHeader.h" +#include "TParticle.h" static const Float_t kptcutmax = 2; static const Float_t ketacutmax = 1.5; @@ -100,220 +103,282 @@ static const Float_t ketacutmax = 1.5; ClassImp(AliDisplay) -//_____________________________________________________________________________ -AliDisplay::AliDisplay() +//_______________________________________________________________________ +AliDisplay::AliDisplay(): + fZoomMode(0), + fDrawAllViews(0), + fDrawParticles(0), + fDrawHits(0), + fPTcut(0), + fTheta(0), + fPhi(0), + fPsi(0), + fRrange(0), + fZrange(0), + fZooms(0), + fHitsCuts(0), + fCanvas(0), + fTrigPad(0), + fCutPad(0), + fEtaPad(0), + fButtons(0), + fPad(0), + fCutSlider(0), + fEtaSlider(0), + fRangeSlider(0), + fPickButton(0), + fZoomButton(0), + fArcButton(0), + fFruits(0), + fTracksToDisplay(0), + fNTracksToDisplay(0) { // // Default constructor // - fCanvas = 0; - fTrigPad = 0; - fCutPad = 0; - fEtaPad = 0; - fButtons = 0; - fPad = 0; - fCutSlider = 0; - fEtaSlider = 0; - fRangeSlider = 0; - fPickButton = 0; - fZoomButton = 0; - fArcButton = 0; - fFruits = 0; - fTracksToDisplay =0; - fNTracksToDisplay =0; } -//_____________________________________________________________________________ -AliDisplay::AliDisplay(Int_t size) +//_______________________________________________________________________ +AliDisplay::AliDisplay(Int_t size): + fZoomMode(1), + fDrawAllViews(kFALSE), + fDrawParticles(kTRUE), + fDrawHits(kTRUE), + fPTcut(0), + fTheta(0), + fPhi(-90), + fPsi(0), + fRrange(0), + fZrange(0), + fZooms(1), + fHitsCuts(0), + fCanvas(0), + fTrigPad(0), + fCutPad(0), + fEtaPad(0), + fButtons(0), + fPad(0), + fCutSlider(0), + fEtaSlider(0), + fRangeSlider(0), + fPickButton(0), + fZoomButton(0), + fArcButton(0), + fFruits(0), + fTracksToDisplay(0), + fNTracksToDisplay(0) { -// Create an event display object. -// A canvas named "edisplay" is created with a vertical size in pixels -// -// A QUICK Overview of the Event Display functions -// =============================================== -// -// The event display can ve invoked by executing the macro "display.C" -// A canvas like in the picture below will appear. -// -// On the left side of the canvas, the following buttons appear: -// *Next* to move to the next event -// *Previous* to move to the previous event -// *Top View* to display a top view of the current event -// *Side View* to display a side view of the current event -// *Front View* to display a front view of the current event -// *All Views* to display front/side/top/30-30 views of the current event -// *OpenGL* to use OpenGl to view the current event. -// Note that OpenGL cannot be used across the network. -// Before using OpenGL, load the GL libraries -// by executing the macro GL.C (in $ROOTSYS/macros/GL.C. -// Once in GL, click the HELP button of the GL canvas. -// *X3D* to use X3D to view the current event (Unix only). -// Once in X3D, type M to see the list of all possible options. -// for example type J to zoom, K to unzoom -// use the mouse to rotate. -// *Pick* Select this option to be able to point on a track with the -// mouse. Once on the track, use the right button to select -// an action. For example, select SetMarkerAttributes to -// change the marker type/color/size for the track. -// *Zoom* Select this option (default) if you want to zoom. -// To zoom, simply select the selected area with the left button. -// *UnZoom* To revert to the previous picture size. -// -// slider R On the left side, the vertical slider can be used to -// set the default picture size. -// slider pcut At the top of the canvas, a slider can be used to change -// the momentum cut (or range) to display tracks. -// slider eta On the right side of the canvas, a vertical slider can be used -// to specify a rapidity range for the tracks. -// -// When you are in Zoom mode, you can click on the black part of the canvas -// to select special options with the right mouse button. -// This will display a pop-up menu with items like: -// *Disable detector* -// *Enable detector*, etc. -// For example select "Disable detector". You get a dialog box. -// Diable detector TRD for example. -// -// When you are in pick mode, you can "Inspect" the object pointed by the mouse. -// When you are on a track, select the menu item "InspectParticle" -// to display the current particle attributes. -// -// You can activate the Root browser by selecting the Inspect menu -// in the canvas tool bar menu. Then select "Start Browser" -// This will open a new canvas with the browser. At this point, you may want -// to display some histograms (from the Trees). Go to the "File" menu -// of the browser and click on "New canvas". -// In the browser, click on item "ROOT files" in the left pane. -// Click on galice.root. -// Click on TH -// Click on TPC for example -// Click on any variable (eg TPC.fX) to histogram the variable. -// -// If you are lost, you can click on HELP in any Root canvas or browser. -//Begin_Html -/* - -*/ -//End_Html - - fPad = 0; - gAlice->SetDisplay(this); - - // Initialize display default parameters - SetRange(); - SetPTcut(); - - // Set front view by default - fTheta = 0; - fPhi = -90; - fPsi = 0; - fDrawAllViews = kFALSE; - fDrawHits = kTRUE; - fDrawParticles = kTRUE; - fZoomMode = 1; - fZooms = 0; - fHitsCuts = 0; - - // Create display canvas - Int_t ysize = size; - if (ysize < 100) ysize = 750; - Int_t xsize = Int_t(size*830./ysize); - fCanvas = new TCanvas("Canvas", "ALICE Event Display",14,47,xsize,ysize); - fCanvas->ToggleEventStatus(); + // Create an event display object. + // A canvas named "edisplay" is created with a vertical size in pixels + // + // A QUICK Overview of the Event Display functions + // =============================================== + // + // The event display can ve invoked by executing the macro "display.C" + // A canvas like in the picture below will appear. + // + // On the left side of the canvas, the following buttons appear: + // *Next* to move to the next event + // *Previous* to move to the previous event + // *Top View* to display a top view of the current event + // *Side View* to display a side view of the current event + // *Front View* to display a front view of the current event + // *All Views* to display front/side/top/30-30 views of the current event + // *OpenGL* to use OpenGl to view the current event. + // Note that OpenGL cannot be used across the network. + // Before using OpenGL, load the GL libraries + // by executing the macro GL.C (in $ROOTSYS/macros/GL.C. + // Once in GL, click the HELP button of the GL canvas. + // *X3D* to use X3D to view the current event (Unix only). + // Once in X3D, type M to see the list of all possible options. + // for example type J to zoom, K to unzoom + // use the mouse to rotate. + // *Pick* Select this option to be able to point on a track with the + // mouse. Once on the track, use the right button to select + // an action. For example, select SetMarkerAttributes to + // change the marker type/color/size for the track. + // *Zoom* Select this option (default) if you want to zoom. + // To zoom, simply select the selected area with the left button. + // *UnZoom* To revert to the previous picture size. + // + // slider R On the left side, the vertical slider can be used to + // set the default picture size. + // slider pcut At the top of the canvas, a slider can be used to change + // the momentum cut (or range) to display tracks. + // slider eta On the right side of the canvas, a vertical slider can be used + // to specify a rapidity range for the tracks. + // + // When you are in Zoom mode, you can click on the black part of the canvas + // to select special options with the right mouse button. + // This will display a pop-up menu with items like: + // *Disable detector* + // *Enable detector*, etc. + // For example select "Disable detector". You get a dialog box. + // Diable detector TRD for example. + // + // When you are in pick mode, you can "Inspect" the object pointed by the mouse. + // When you are on a track, select the menu item "InspectParticle" + // to display the current particle attributes. + // + // You can activate the Root browser by selecting the Inspect menu + // in the canvas tool bar menu. Then select "Start Browser" + // This will open a new canvas with the browser. At this point, you may want + // to display some histograms (from the Trees). Go to the "File" menu + // of the browser and click on "New canvas". + // In the browser, click on item "ROOT files" in the left pane. + // Click on galice.root. + // Click on TH + // Click on TPC for example + // Click on any variable (eg TPC.fX) to histogram the variable. + // + // If you are lost, you can click on HELP in any Root canvas or browser. + //Begin_Html + /* + + */ + //End_Html + + gAlice->SetDisplay(this); - // Create main display pad - fPad = new TPad("viewpad", "Alice display",0.15,0,0.97,0.96); - fPad->Draw(); - fPad->Modified(); - fPad->SetFillColor(1); - fPad->SetBorderSize(2); - - // Create user interface control pad - DisplayButtons(); - fCanvas->cd(); - - // Create Range and mode pad - Float_t dxtr = 0.15; - Float_t dytr = 0.45; - fTrigPad = new TPad("trigger", "range and mode pad",0,0,dxtr,dytr); - fTrigPad->Draw(); - fTrigPad->cd(); - fTrigPad->SetFillColor(22); - fTrigPad->SetBorderSize(2); - fRangeSlider = new TSlider("range","range",0.7,0.42,0.9,0.98); - fRangeSlider->SetObject(this); - char pickmode[] = "gAlice->Display()->SetPickMode()"; - Float_t db = 0.09; - fPickButton = new TButton("Pick",pickmode,0.05,0.32,0.65,0.32+db); - fPickButton->SetFillColor(38); - fPickButton->Draw(); - char zoommode[] = "gAlice->Display()->SetZoomMode()"; - fZoomButton = new TButton("Zoom",zoommode,0.05,0.21,0.65,0.21+db); - fZoomButton->SetFillColor(38); - fZoomButton->Draw(); - fArcButton = new TArc(.8,fZoomButton->GetYlowNDC()+0.5*db,0.33*db); - fArcButton->SetFillColor(kGreen); - fArcButton->Draw(); - char butUnzoom[] = "gAlice->Display()->UnZoom()"; - TButton *button = new TButton("UnZoom",butUnzoom,0.05,0.05,0.95,0.15); - button->SetFillColor(38); - button->Draw(); - AppendPad(); // append display object as last object to force selection - - // Create momentum cut slider pad - fCanvas->cd(); - fCutPad = new TPad("cutSlider", "pcut slider pad",dxtr,.96,1,1); - fCutPad->Draw(); - fCutPad->cd(); - fCutPad->SetFillColor(22); - fCutPad->SetBorderSize(2); - fCutSlider = new TSlider("pcut","Momentum cut",0,0,1,1); - fCutSlider->SetRange(fPTcut/kptcutmax,1); - fCutSlider->SetObject(this); - fCutSlider->SetFillColor(45); - TSliderBox *sbox = (TSliderBox*)fCutSlider->GetListOfPrimitives()->First(); - sbox->SetFillColor(46); - fCutSlider->cd(); - TGaxis *cutaxis = new TGaxis(0.02,0.8,0.98,0.8,0,kptcutmax,510,""); - cutaxis->SetLabelSize(0.5); - cutaxis->SetTitleSize(0.6); - cutaxis->SetTitleOffset(0.5); - cutaxis->SetTitle("pcut . "); - fCutSlider->GetListOfPrimitives()->AddFirst(cutaxis); - - // Create rapidity cut slider pad - fCanvas->cd(); - fEtaPad = new TPad("EtaSlider", "Eta slider pad",0.97,0,1,0.96); - fEtaPad->Draw(); - fEtaPad->cd(); - fEtaPad->SetFillColor(22); - fEtaPad->SetBorderSize(2); - fEtaSlider = new TSlider("etacut","Rapidity cut",0,0,1,1); - fEtaSlider->SetObject(this); - fEtaSlider->SetFillColor(45); - TSliderBox *sbox2 = (TSliderBox*)fEtaSlider->GetListOfPrimitives()->First(); - sbox2->SetFillColor(46); - fEtaSlider->cd(); - TGaxis *etaaxis = new TGaxis(0.9,0.02,0.9,0.98,-ketacutmax,ketacutmax,510,""); - etaaxis->SetLabelSize(0.5); - etaaxis->SetTitleSize(0.6); - etaaxis->SetTitleOffset(0.2); - cutaxis->SetTitle("Etacut . "); - fEtaSlider->GetListOfPrimitives()->AddFirst(etaaxis); - fCanvas->cd(); - - fTrigPad->SetEditable(kFALSE); - fButtons->SetEditable(kFALSE); - fTracksToDisplay =0; - fNTracksToDisplay =0; - - fCanvas->cd(); - fCanvas->Update(); + // Initialize display default parameters + SetRange(); + SetPTcut(); + + // Set front view by default + + // Create display canvas + Int_t ysize = size; + if (ysize < 100) ysize = 750; + Int_t xsize = Int_t(size*830./ysize); + fCanvas = new TCanvas("Canvas", "ALICE Event Display",14,47,xsize,ysize); + fCanvas->ToggleEventStatus(); + + // Create main display pad + fPad = new TPad("viewpad", "Alice display",0.15,0,0.97,0.96); + fPad->Draw(); + fPad->Modified(); + fPad->SetFillColor(1); + fPad->SetBorderSize(2); + + // Create user interface control pad + DisplayButtons(); + fCanvas->cd(); + + // Create Range and mode pad + Float_t dxtr = 0.15; + Float_t dytr = 0.45; + fTrigPad = new TPad("trigger", "range and mode pad",0,0,dxtr,dytr); + fTrigPad->Draw(); + fTrigPad->cd(); + fTrigPad->SetFillColor(22); + fTrigPad->SetBorderSize(2); + + fRangeSlider = new TSlider("range","range",0.7,0.42,0.9,0.98); + fRangeSlider->SetObject(this); + char pickmode[] = "gAlice->Display()->SetPickMode()"; + Float_t db = 0.09; + + fPickButton = new TButton("Pick",pickmode,0.05,0.32,0.65,0.32+db); + fPickButton->SetFillColor(38); + fPickButton->Draw(); + char zoommode[] = "gAlice->Display()->SetZoomMode()"; + fZoomButton = new TButton("Zoom",zoommode,0.05,0.21,0.65,0.21+db); + fZoomButton->SetFillColor(38); + fZoomButton->Draw(); + fArcButton = new TArc(.8,fZoomButton->GetYlowNDC()+0.5*db,0.33*db); + fArcButton->SetFillColor(kGreen); + fArcButton->Draw(); + char butUnzoom[] = "gAlice->Display()->UnZoom()"; + TButton *button = new TButton("UnZoom",butUnzoom,0.05,0.05,0.95,0.15); + button->SetFillColor(38); + button->Draw(); + AppendPad(); // append display object as last object to force selection + + // Create momentum cut slider pad + fCanvas->cd(); + fCutPad = new TPad("cutSlider", "pcut slider pad",dxtr,.96,1,1); + fCutPad->Draw(); + fCutPad->cd(); + fCutPad->SetFillColor(22); + fCutPad->SetBorderSize(2); + + fCutSlider = new TSlider("pcut","Momentum cut",0,0,1,1); + fCutSlider->SetRange(fPTcut/kptcutmax,1); + fCutSlider->SetObject(this); + fCutSlider->SetFillColor(45); + TSliderBox *sbox = dynamic_cast(fCutSlider->GetListOfPrimitives()->First()); + sbox->SetFillColor(46); + fCutSlider->cd(); + TGaxis *cutaxis = new TGaxis(0.02,0.8,0.98,0.8,0,kptcutmax,510,""); + cutaxis->SetLabelSize(0.5); + cutaxis->SetTitleSize(0.6); + cutaxis->SetTitleOffset(0.5); + cutaxis->SetTitle("pcut . "); + fCutSlider->GetListOfPrimitives()->AddFirst(cutaxis); + + // Create rapidity cut slider pad + fCanvas->cd(); + + fEtaPad = new TPad("EtaSlider", "Eta slider pad",0.97,0,1,0.96); + fEtaPad->Draw(); + fEtaPad->cd(); + fEtaPad->SetFillColor(22); + fEtaPad->SetBorderSize(2); + + fEtaSlider = new TSlider("etacut","Rapidity cut",0,0,1,1); + fEtaSlider->SetObject(this); + fEtaSlider->SetFillColor(45); + TSliderBox *sbox2 = dynamic_cast(fEtaSlider->GetListOfPrimitives()->First()); + sbox2->SetFillColor(46); + fEtaSlider->cd(); + TGaxis *etaaxis = new TGaxis(0.9,0.02,0.9,0.98,-ketacutmax,ketacutmax,510,""); + etaaxis->SetLabelSize(0.5); + etaaxis->SetTitleSize(0.6); + etaaxis->SetTitleOffset(0.2); + cutaxis->SetTitle("Etacut . "); + fEtaSlider->GetListOfPrimitives()->AddFirst(etaaxis); + fCanvas->cd(); + + fTrigPad->SetEditable(kFALSE); + fButtons->SetEditable(kFALSE); + fTracksToDisplay =0; + fNTracksToDisplay =0; + + fCanvas->cd(); + fCanvas->Update(); } -//_____________________________________________________________________________ -AliDisplay::AliDisplay(const AliDisplay &disp) +//_______________________________________________________________________ +AliDisplay::AliDisplay(const AliDisplay &disp): + TObject(disp), + fZoomMode(0), + fDrawAllViews(0), + fDrawParticles(0), + fDrawHits(0), + fPTcut(0), + fTheta(0), + fPhi(0), + fPsi(0), + fRrange(0), + fZrange(0), + fZooms(0), + fHitsCuts(0), + fCanvas(0), + fTrigPad(0), + fCutPad(0), + fEtaPad(0), + fButtons(0), + fPad(0), + fCutSlider(0), + fEtaSlider(0), + fRangeSlider(0), + fPickButton(0), + fZoomButton(0), + fArcButton(0), + fFruits(0), + fTracksToDisplay(0), + fNTracksToDisplay(0) { // // Copy constructor @@ -336,7 +401,7 @@ void AliDisplay::Clear(Option_t *) } //_____________________________________________________________________________ -void AliDisplay::Copy(AliDisplay &disp) const +void AliDisplay::Copy(AliDisplay &) const { // // Copy *this onto disp -- not implemented @@ -350,11 +415,11 @@ void AliDisplay::ShowTrack(Int_t idx) // // Display track idx // - AliDetector *mTPC=(AliDetector*)gAlice->GetModule("TPC"); + AliDetector *mTPC=dynamic_cast(gAlice->GetModule("TPC")); TObjArray *points=mTPC->Points(); int ntracks=points->GetEntriesFast(); for (int track=0;trackUncheckedAt(track); + AliPoints *pm = dynamic_cast(points->UncheckedAt(track)); if (!pm) continue; if (idx == pm->GetIndex()) { pm->SetMarkerColor(2); @@ -380,11 +445,11 @@ void AliDisplay::HideTrack(Int_t idx) { // // Hide track on display // - AliDetector *mTPC=(AliDetector*)gAlice->GetModule("TPC"); + AliDetector *mTPC=dynamic_cast(gAlice->GetModule("TPC")); TObjArray *points=mTPC->Points(); int ntracks=points->GetEntriesFast(); for (int track=0;trackUncheckedAt(track); + AliPoints *pm = dynamic_cast(points->UncheckedAt(track)); if (!pm) continue; if (idx == pm->GetIndex()) { pm->SetMarkerColor(5); @@ -402,7 +467,7 @@ void AliDisplay::DisableDetector(const char *name) { // Disable detector name from graphics views - AliModule *module = (AliModule*)gAlice->Modules()->FindObject(name); + AliModule *module = dynamic_cast(gAlice->Modules()->FindObject(name)); if (!module) return; module->Disable(); Draw(); @@ -594,13 +659,13 @@ void AliDisplay::DrawHits() TIter next(gAlice->Modules()); AliModule *module; fHitsCuts = 0; - while((module = (AliModule*)next())) { + while((module = dynamic_cast(next()))) { if (!module->IsActive()) continue; points = module->Points(); if (!points) continue; ntracks = points->GetEntriesFast(); for (track=0;trackUncheckedAt(track); + pm = dynamic_cast(points->UncheckedAt(track)); if (!pm) continue; particle = pm->GetParticle(); if (!particle) continue; @@ -687,7 +752,7 @@ void AliDisplay::DrawViewGL() { // Draw current view using OPENGL - TPad *pad = (TPad*)gPad->GetPadSave(); + TPad *pad = dynamic_cast(gPad->GetPadSave()); pad->cd(); TView *view = pad->GetView(); if (!view) return; @@ -699,7 +764,7 @@ void AliDisplay::DrawViewX3D() { // Draw current view using X3D - TPad *pad = (TPad*)gPad->GetPadSave(); + TPad *pad = dynamic_cast(gPad->GetPadSave()); pad->cd(); TView *view = pad->GetView(); if (!view) return; @@ -711,7 +776,7 @@ void AliDisplay::EnableDetector(const char *name) { // Enable detector name in graphics views - AliModule *module = (AliModule*)gAlice->Modules()->FindObject(name); + AliModule *module = dynamic_cast(gAlice->Modules()->FindObject(name)); if (!module) return; module->Enable(); Draw(); @@ -811,7 +876,7 @@ void AliDisplay::LoadPoints() for (Int_t track=0; trackResetHits(); gAlice->TreeH()->GetEvent(nprim-1-gAlice->GetPrimary(fTracksToDisplay[track])); - while((module = (AliModule*)next())) { + while((module = dynamic_cast(next()))) { module->LoadPoints(nprim-1-gAlice->GetPrimary(fTracksToDisplay[track])); } next.Reset(); @@ -821,7 +886,7 @@ void AliDisplay::LoadPoints() for (Int_t track=0; trackResetHits(); gAlice->TreeH()->GetEvent(track); - while((module = (AliModule*)next())) { + while((module = dynamic_cast(next()))) { module->LoadPoints(track); } next.Reset(); @@ -930,7 +995,7 @@ void AliDisplay::UnZoom() // if (fZooms <= 0) return; fZooms--; - TPad *pad = (TPad*)gPad->GetPadSave(); + TPad *pad = dynamic_cast(gPad->GetPadSave()); pad->Range(fZoomX0[fZooms],fZoomY0[fZooms], fZoomX1[fZooms],fZoomY1[fZooms]); pad->Modified(); } diff --git a/STEER/AliESD.cxx b/STEER/AliESD.cxx index 9be1bceb66f..2f5096cd438 100644 --- a/STEER/AliESD.cxx +++ b/STEER/AliESD.cxx @@ -17,10 +17,10 @@ $Log: */ -/////////////////////////////////////////////////////////////////////////////// -// // -// // -/////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////// +// // +// // +///////////////////////////////////////////////////////////////////////// #include "Riostream.h" @@ -28,32 +28,157 @@ $Log: ClassImp(AliESD) -//__________________________________________________________________________ -AliESD::AliESD() +//_______________________________________________________________________ +AliESD::AliESD(): + fEventNumber(0), + fRunNumber(0), + fTrigger(0), + fRecoVersion(0), + fBitDDL(0), + fNSecVertex(0), + fNParticipants(0), + fNPartError(0), + fNElectron(0), + fNMuons(0), + fNPions(0), + fNKaons(0), + fNProtons(0), + fNPHOSPhotons(0), + fNPHOSNeutrons(0), + fNPHOSCCluster(0), + fNEMCALCluster(0), + fNPMDCluster(0), + fTMaxClusterEnergy(0), + fTMaxPCharged(0), + fNCharged(0), + fTotTranEnergy(0), + fESDVertex(), + fSecVertex(0), + fNonAssTrack(0), + fPhoton(0), + fNeutron(0), + fEMCALCluster(0), + fPMDCluster(0) +{ + Info("def ctor","Has been called\n"); +} + +//_______________________________________________________________________ +AliESD::AliESD(const AliESD &esd): + TObject(esd), + fEventNumber(0), + fRunNumber(0), + fTrigger(0), + fRecoVersion(0), + fBitDDL(0), + fNSecVertex(0), + fNParticipants(0), + fNPartError(0), + fNElectron(0), + fNMuons(0), + fNPions(0), + fNKaons(0), + fNProtons(0), + fNPHOSPhotons(0), + fNPHOSNeutrons(0), + fNPHOSCCluster(0), + fNEMCALCluster(0), + fNPMDCluster(0), + fTMaxClusterEnergy(0), + fTMaxPCharged(0), + fNCharged(0), + fTotTranEnergy(0), + fESDVertex(), + fSecVertex(0), + fNonAssTrack(0), + fPhoton(0), + fNeutron(0), + fEMCALCluster(0), + fPMDCluster(0) { - cout << "ESD def ctor" << endl; } ClassImp(AliESDVertex) -//__________________________________________________________________________ -AliESDVertex::AliESDVertex() +//_______________________________________________________________________ +AliESDVertex::AliESDVertex(): + fNPrimary(0), + fCoordinates(3), + fErrorMatrix(6), + fPrimaryTracks(0), + fEffectiveMass(0), + fEffectiveMassError(0) { cout << "ESDVertex def ctor" << endl; - fCoordinates.Set(3); - fErrorMatrix.Set(6); +} + +//_______________________________________________________________________ +AliESDVertex::AliESDVertex(const AliESDVertex &esdv): + TObject(esdv), + fNPrimary(0), + fCoordinates(0), + fErrorMatrix(0), + fPrimaryTracks(0), + fEffectiveMass(0), + fEffectiveMassError(0) +{ } ClassImp(AliESDTrack) -//__________________________________________________________________________ -AliESDTrack::AliESDTrack() +//_______________________________________________________________________ +AliESDTrack::AliESDTrack() : + fTrackID(0), + fPVertex(5), + fPEVertex(15), + fPFMeasPoint(6), + fPFMeasPointErr(15), + fPLMeasPoint(6), + fPLMeasPointErr(15), + fTrackLength(0), + fTrackLengthErr(0), + fStopVertex(0), + fNPointsITS(0), + fNPointsTPC(0), + fNPointsTRD(0), + fMeanResITS(0), + fMeanResTPC(0), + fMeanResTRD(0), + fGlobalChi2(0), + fParticleType(0), + fPIDprobPi(0), + fPIDprobK(0), + fPIDprobP(0), + fPIDprobE(0) { cout << "ESDTrack def ctor" << endl; - fPVertex.Set(5); - fPEVertex.Set(15); - fPFMeasPoint.Set(6); - fPFMeasPointErr.Set(15); - fPLMeasPoint.Set(6); - fPLMeasPointErr.Set(15); } + +//_______________________________________________________________________ +AliESDTrack::AliESDTrack(const AliESDTrack &esdt): + TObject(esdt), + fTrackID(0), + fPVertex(0), + fPEVertex(0), + fPFMeasPoint(0), + fPFMeasPointErr(0), + fPLMeasPoint(0), + fPLMeasPointErr(0), + fTrackLength(0), + fTrackLengthErr(0), + fStopVertex(0), + fNPointsITS(0), + fNPointsTPC(0), + fNPointsTRD(0), + fMeanResITS(0), + fMeanResTPC(0), + fMeanResTRD(0), + fGlobalChi2(0), + fParticleType(0), + fPIDprobPi(0), + fPIDprobK(0), + fPIDprobP(0), + fPIDprobE(0) +{ +} + diff --git a/STEER/AliESD.h b/STEER/AliESD.h index d0fbae66e4b..ea933079734 100644 --- a/STEER/AliESD.h +++ b/STEER/AliESD.h @@ -57,7 +57,7 @@ protected: Float_t fPIDprobE; // PID probability for e private: - AliESDTrack(const AliESDTrack &) {} + AliESDTrack(const AliESDTrack &); AliESDTrack & operator=(const AliESDTrack &) {return (*this);} ClassDef(AliESDTrack,1) //ESDTrack @@ -78,7 +78,7 @@ protected: Float_t fEffectiveMass; // Effective Mass Float_t fEffectiveMassError; // Effective Mass Error private: - AliESDVertex(const AliESDVertex &) {} + AliESDVertex(const AliESDVertex &); AliESDVertex & operator=(const AliESDVertex &) {return (*this);} ClassDef(AliESDVertex,1) //ESDVertex @@ -137,7 +137,7 @@ protected: TObjArray fPMDCluster; // List of PMD clusters private: - AliESD(const AliESD &) {} + AliESD(const AliESD &); AliESD & operator=(const AliESD &) {return (*this);} ClassDef(AliESD,1) //ESD diff --git a/STEER/AliFieldMap.cxx b/STEER/AliFieldMap.cxx index db1b6065382..58a3ad6945c 100644 --- a/STEER/AliFieldMap.cxx +++ b/STEER/AliFieldMap.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.5 2002/10/14 14:57:32 hristov +Merging the VirtualMC branch to the main development branch (HEAD) + Revision 1.3.6.1 2002/07/24 10:08:13 alibrary Updating VirtualMC @@ -43,37 +46,89 @@ root files. ClassImp(AliFieldMap) -//________________________________________ -AliFieldMap::AliFieldMap() +//_______________________________________________________________________ +AliFieldMap::AliFieldMap(): + fXbeg(0), + fYbeg(0), + fZbeg(0), + fXend(0), + fYend(0), + fZend(0), + fXdel(0), + fYdel(0), + fZdel(0), + fXdeli(0), + fYdeli(0), + fZdeli(0), + fXn(0), + fYn(0), + fZn(0), + fWriteEnable(0), + fB(0) { // // Standard constructor // - fB = 0; SetWriteEnable(); } -AliFieldMap::AliFieldMap(const char *name, const char *title) - : TNamed(name,title) +//_______________________________________________________________________ +AliFieldMap::AliFieldMap(const char *name, const char *title): + TNamed(name,title), + fXbeg(0), + fYbeg(0), + fZbeg(0), + fXend(0), + fYend(0), + fZend(0), + fXdel(0), + fYdel(0), + fZdel(0), + fXdeli(0), + fYdeli(0), + fZdeli(0), + fXn(0), + fYn(0), + fZn(0), + fWriteEnable(0), + fB(0) { // // Standard constructor // - fB = 0; ReadField(); SetWriteEnable(); } +//_______________________________________________________________________ AliFieldMap::~AliFieldMap() { -// -// Destructor -// + // + // Destructor + // delete fB; } -//________________________________________ -AliFieldMap::AliFieldMap(const AliFieldMap &map) +//_______________________________________________________________________ +AliFieldMap::AliFieldMap(const AliFieldMap &map): + TNamed(map), + fXbeg(0), + fYbeg(0), + fZbeg(0), + fXend(0), + fYend(0), + fZend(0), + fXdel(0), + fYdel(0), + fZdel(0), + fXdeli(0), + fYdeli(0), + fZdeli(0), + fXn(0), + fYn(0), + fZn(0), + fWriteEnable(0), + fB(0) { // // Copy constructor @@ -81,15 +136,15 @@ AliFieldMap::AliFieldMap(const AliFieldMap &map) map.Copy(*this); } -//________________________________________ +//_______________________________________________________________________ void AliFieldMap::ReadField() { // // Method to read the magnetic field map from file // FILE* magfile; -// FILE* endf = fopen("end.table", "r"); -// FILE* out = fopen("out", "w"); + // FILE* endf = fopen("end.table", "r"); + // FILE* out = fopen("out", "w"); Int_t ix, iy, iz, ipx, ipy, ipz; Float_t bx, by, bz; @@ -113,7 +168,7 @@ void AliFieldMap::ReadField() Int_t nDim = fXn*fYn*fZn; -// Float_t x,y,z,b; + // Float_t x,y,z,b; fB = new TVector(3*nDim); if (magfile) { @@ -167,17 +222,18 @@ void AliFieldMap::ReadField() } // if mafile } +//_______________________________________________________________________ void AliFieldMap::Field(Float_t *x, Float_t *b) { -// -// Use simple interpolation to obtain field at point x -// + // + // Use simple interpolation to obtain field at point x + // Double_t ratx, raty, ratz, hix, hiy, hiz, ratx1, raty1, ratz1, bhyhz, bhylz, blyhz, blylz, bhz, blz, xl[3]; const Double_t kone=1; Int_t ix, iy, iz; b[0]=b[1]=b[2]=0; -// + // xl[0]=TMath::Abs(x[0])-fXbeg; xl[1]=TMath::Abs(x[1])-fYbeg; @@ -224,7 +280,7 @@ void AliFieldMap::Field(Float_t *x, Float_t *b) b[2] = blz *ratz1+bhz *ratz; } -//________________________________________ +//_______________________________________________________________________ void AliFieldMap::Copy(AliFieldMap & /* magf */) const { // @@ -233,13 +289,14 @@ void AliFieldMap::Copy(AliFieldMap & /* magf */) const Fatal("Copy","Not implemented!\n"); } -//________________________________________ +//_______________________________________________________________________ AliFieldMap & AliFieldMap::operator =(const AliFieldMap &magf) { magf.Copy(*this); return *this; } +//_______________________________________________________________________ void AliFieldMap::Streamer(TBuffer &R__b) { // Stream an object of class AliFieldMap. diff --git a/STEER/AliGausCorr.cxx b/STEER/AliGausCorr.cxx index 7cd2c06e87a..ba6c8cb39b2 100644 --- a/STEER/AliGausCorr.cxx +++ b/STEER/AliGausCorr.cxx @@ -21,6 +21,7 @@ // Rep. Prog. Phys. 43 (1980) 1145-1189. // M.Masera 15.03.2001 9:30 - modified on 26.02.2002 17:40 //////////////////////////////////////////////////////////////////////// + #include #include #include @@ -29,20 +30,24 @@ ClassImp(AliGausCorr) -//________________________________________________________ -AliGausCorr::AliGausCorr() +//_______________________________________________________________________ +AliGausCorr::AliGausCorr(): + fSize(0), + fCv(0) { + // // Default constructor - fSize = 0; - fCv = 0; + // } -//________________________________________________________ -AliGausCorr::AliGausCorr(const TMatrixD & vec, Int_t size) +//_______________________________________________________________________ +AliGausCorr::AliGausCorr(const TMatrixD & vec, Int_t size): + fSize(size), + fCv(new TMatrixD(fSize,fSize)) { + // // Standard constructor - fSize = size; - fCv = new TMatrixD(fSize,fSize); + // for(Int_t j=0;jAdd(this); - fStack = 0; } -//____________________________________________________________ -AliGenerator::AliGenerator(const AliGenerator &gen) : TNamed(" "," ") +//_______________________________________________________________________ +AliGenerator::AliGenerator(const AliGenerator &gen): + TNamed(gen), + AliRndm(gen), + fThetaMin(0), + fThetaMax(0), + fPhiMin(0), + fPhiMax(0), + fPMin(0), + fPMax(0), + fPtMin(0), + fPtMax(0), + fYMin(0), + fYMax(0), + fVMin(3), + fVMax(3), + fNpart(0), + fParentWeight(0), + fChildWeight(0), + fAnalog(0), + fVertexSmear(kNoSmear), + fVertexSource(kExternal), + fCutVertexZ(0), + fTrackIt(0), + fOrigin(3), + fOsigma(3), + fVertex(3), + fEventVertex(0), + fStack(0) { // // Copy constructor @@ -181,7 +245,7 @@ AliGenerator::AliGenerator(const AliGenerator &gen) : TNamed(" "," ") gen.Copy(*this); } -//____________________________________________________________ +//_______________________________________________________________________ AliGenerator & AliGenerator::operator=(const AliGenerator &gen) { // @@ -191,7 +255,7 @@ AliGenerator & AliGenerator::operator=(const AliGenerator &gen) return (*this); } -//____________________________________________________________ +//_______________________________________________________________________ void AliGenerator::Copy(AliGenerator &/* gen */) const { // @@ -200,7 +264,7 @@ void AliGenerator::Copy(AliGenerator &/* gen */) const Fatal("Copy","Not implemented!\n"); } -//____________________________________________________________ +//_______________________________________________________________________ AliGenerator::~AliGenerator() { // @@ -214,6 +278,7 @@ AliGenerator::~AliGenerator() } } +//_______________________________________________________________________ void AliGenerator::Init() { // @@ -334,7 +399,7 @@ void AliGenerator::Vertex() } } - +//_______________________________________________________________________ void AliGenerator::VertexExternal() { // Dummy !!!!!! @@ -345,6 +410,7 @@ void AliGenerator::VertexExternal() fVertex[0]=fVertex[1]=fVertex[2]=0; } +//_______________________________________________________________________ void AliGenerator::VertexInternal() { // @@ -359,6 +425,7 @@ void AliGenerator::VertexInternal() } } +//_______________________________________________________________________ void AliGenerator::SetTrack(Int_t done, Int_t parent, Int_t pdg, Float_t *pmom, Float_t *vpos, Float_t *polar, Float_t tof, AliMCProcess mech, Int_t &ntr, @@ -372,6 +439,8 @@ void AliGenerator::SetTrack(Int_t done, Int_t parent, Int_t pdg, gAlice->SetTrack(done, parent, pdg, pmom, vpos, polar, tof, mech, ntr, weight, is); } + +//_______________________________________________________________________ void AliGenerator::SetTrack(Int_t done, Int_t parent, Int_t pdg, Double_t px, Double_t py, Double_t pz, Double_t e, Double_t vx, Double_t vy, Double_t vz, Double_t tof, @@ -388,6 +457,7 @@ void AliGenerator::SetTrack(Int_t done, Int_t parent, Int_t pdg, } +//_______________________________________________________________________ void AliGenerator:: KeepTrack(Int_t itrack) { if (fStack) @@ -397,6 +467,7 @@ void AliGenerator:: KeepTrack(Int_t itrack) } +//_______________________________________________________________________ void AliGenerator:: SetHighWaterMark(Int_t nt) { if (fStack) diff --git a/STEER/AliGenerator.h b/STEER/AliGenerator.h index 0650e147af6..5de8143f8f9 100644 --- a/STEER/AliGenerator.h +++ b/STEER/AliGenerator.h @@ -53,7 +53,7 @@ class AliGenerator : public TNamed, public AliRndm virtual void SetAnalog(Int_t flag=1) {fAnalog=flag;} virtual void SetVertexSmear(VertexSmear_t smear) {fVertexSmear = smear;} virtual void SetCutVertexZ(Float_t cut=999999.) {fCutVertexZ = cut;} - virtual void SetVertexSource(VertexSource_t smear) {fVertexSource = kInternal;} + virtual void SetVertexSource(VertexSource_t) {fVertexSource = kInternal;} virtual void SetTrackingFlag(Int_t flag=1) {fTrackIt=flag;} void Vertex(); void VertexExternal(); diff --git a/STEER/AliHeader.cxx b/STEER/AliHeader.cxx index cd9c0bb5e43..e9ae2cdf0f7 100644 --- a/STEER/AliHeader.cxx +++ b/STEER/AliHeader.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.10 2001/10/09 18:00:35 hristov +Temporary fix to provide unique event number in the simulation (J.Chudoba) + Revision 1.9 2001/05/23 08:54:53 hristov Typo corrected @@ -40,51 +43,73 @@ Introduction of the Copyright and cvs Log ClassImp(AliHeader) -AliHeader::AliHeader() +//_______________________________________________________________________ +AliHeader::AliHeader(): + fRun(0), + fNvertex(0), + fNprimary(0), + fNtrack(0), + fEvent(0), + fEventNrInRun(0), + fStack(0), + fGenHeader(0) { // // Default constructor // - fRun=0; - fNvertex=0; - fNprimary=0; - fNtrack=0; - fEvent=0; - fStack=0; - fGenHeader = 0; - fEventNrInRun=0; } -AliHeader::AliHeader(Int_t run, Int_t event) +//_______________________________________________________________________ +AliHeader::AliHeader(const AliHeader& head): + TObject(head), + fRun(0), + fNvertex(0), + fNprimary(0), + fNtrack(0), + fEvent(0), + fEventNrInRun(0), + fStack(0), + fGenHeader(0) { // - // Standard constructor + // Copy constructor // - fRun=run; - fNvertex=0; - fNprimary=0; - fNtrack=0; - fEvent=event; - fStack=0; - fGenHeader = 0; + head.Copy(*this); } -AliHeader::AliHeader(Int_t run, Int_t event, Int_t evNumber) +//_______________________________________________________________________ +AliHeader::AliHeader(Int_t run, Int_t event): + fRun(run), + fNvertex(0), + fNprimary(0), + fNtrack(0), + fEvent(event), + fEventNrInRun(0), + fStack(0), + fGenHeader(0) { // // Standard constructor // - fRun=run; - fNvertex=0; - fNprimary=0; - fNtrack=0; - fEvent=event; - fEventNrInRun=evNumber; - fStack=0; - fGenHeader = 0; } +//_______________________________________________________________________ +AliHeader::AliHeader(Int_t run, Int_t event, Int_t evNumber): + fRun(run), + fNvertex(0), + fNprimary(0), + fNtrack(0), + fEvent(event), + fEventNrInRun(evNumber), + fStack(0), + fGenHeader(0) +{ + // + // Standard constructor + // +} +//_______________________________________________________________________ void AliHeader::Reset(Int_t run, Int_t event) { // @@ -97,6 +122,7 @@ void AliHeader::Reset(Int_t run, Int_t event) fEvent=event; } +//_______________________________________________________________________ void AliHeader::Reset(Int_t run, Int_t event, Int_t evNumber) { // @@ -110,7 +136,8 @@ void AliHeader::Reset(Int_t run, Int_t event, Int_t evNumber) fEventNrInRun=evNumber; } -void AliHeader::Print(const char* option) +//_______________________________________________________________________ +void AliHeader::Print(const char*) const { // // Dumps header content @@ -127,30 +154,39 @@ void AliHeader::Print(const char* option) } +//_______________________________________________________________________ AliStack* AliHeader::Stack() const { // Return pointer to stack return fStack; } +//_______________________________________________________________________ void AliHeader::SetStack(AliStack* stack) { // Set pointer to stack fStack = stack; } +//_______________________________________________________________________ void AliHeader::SetGenEventHeader(AliGenEventHeader* header) { // Set pointer to header for generated event fGenHeader = header; } +//_______________________________________________________________________ AliGenEventHeader* AliHeader::GenEventHeader() const { // Get pointer to header for generated event return fGenHeader; } +//_______________________________________________________________________ +void AliHeader::Copy(AliHeader&) const +{ + Fatal("Copy","Not implemented\n"); +} diff --git a/STEER/AliHeader.h b/STEER/AliHeader.h index 946a59e4333..d5edccd3baa 100644 --- a/STEER/AliHeader.h +++ b/STEER/AliHeader.h @@ -6,12 +6,14 @@ /* $Id$ */ #include + class AliStack; class AliGenEventHeader; class AliHeader : public TObject { public: AliHeader(); + AliHeader(const AliHeader& head); AliHeader(Int_t run, Int_t event); AliHeader(Int_t run, Int_t eventSerialNr, Int_t evNrInRun); virtual ~AliHeader() {} @@ -44,9 +46,15 @@ public: virtual void SetGenEventHeader(AliGenEventHeader* header); virtual AliGenEventHeader* GenEventHeader() const; - virtual void Print(const char *opt=0); + virtual void Print(const char *opt=0) const; + + AliHeader& operator=(AliHeader& head) + {head.Copy(*this); return *this;} protected: + + void Copy(AliHeader& head) const; + Int_t fRun; //Run number Int_t fNvertex; //Number of vertices Int_t fNprimary; //Number of primary tracks diff --git a/STEER/AliHit.cxx b/STEER/AliHit.cxx index af79dd87902..dcb29ca2900 100644 --- a/STEER/AliHit.cxx +++ b/STEER/AliHit.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.7 2002/01/10 09:32:06 hristov +New fIshunt=2 option that allows to associate to a hit the particle that first entered in the cell where the hit occurred (Y.Schutz) + Revision 1.6 2001/01/26 19:58:48 hristov Major upgrade of AliRoot code @@ -29,21 +32,31 @@ Introduction of the Copyright and cvs Log */ -#include "AliHit.h" #include "TParticle.h" + +#include "AliHit.h" #include "AliRun.h" ClassImp(AliHit) -AliHit::AliHit() +//_______________________________________________________________________ +AliHit::AliHit(): + fTrack(0), + fX(0), + fY(0), + fZ(0) { // // Default constructor // - fTrack=0; } -AliHit::AliHit(Int_t shunt, Int_t track) +//_______________________________________________________________________ +AliHit::AliHit(Int_t shunt, Int_t track): + fTrack(0), + fX(0), + fY(0), + fZ(0) { // // Standard constructor @@ -77,5 +90,3 @@ AliHit::AliHit(Int_t shunt, Int_t track) gAlice->FlagTrack(fTrack); } } - - diff --git a/STEER/AliKalmanTrack.cxx b/STEER/AliKalmanTrack.cxx index c82f383ea5c..fa554a25655 100644 --- a/STEER/AliKalmanTrack.cxx +++ b/STEER/AliKalmanTrack.cxx @@ -25,3 +25,27 @@ ClassImp(AliKalmanTrack) Double_t AliKalmanTrack::fConvConst; +//_______________________________________________________________________ +AliKalmanTrack::AliKalmanTrack(): + fLab(-3141593), + fChi2(0), + fMass(0.13957), + fN(0) +{ + if (fConvConst==0) + Fatal("AliKalmanTrack()","The magnetic field has not been set !\n"); +} + +//_______________________________________________________________________ +AliKalmanTrack::AliKalmanTrack(const AliKalmanTrack &t): + TObject(t), + fLab(t.fLab), + fChi2(t.fChi2), + fMass(t.fMass), + fN(t.fN) +{ + if (fConvConst==0) + Fatal("AliKalmanTrack(const AliKalmanTrack&)", + "The magnetic field has not been set !\n"); +} + diff --git a/STEER/AliKalmanTrack.h b/STEER/AliKalmanTrack.h index cd533907785..7e8ef29e3c9 100644 --- a/STEER/AliKalmanTrack.h +++ b/STEER/AliKalmanTrack.h @@ -16,17 +16,9 @@ class AliCluster; class AliKalmanTrack : public TObject { public: - AliKalmanTrack() { - if (fConvConst==0) - Fatal("AliKalmanTrack()","The magnetic field has not been set !\n"); - fLab=-3141593; fChi2=0; fN=0; fMass=0.13957; - } - AliKalmanTrack(const AliKalmanTrack &t) { - if (fConvConst==0) - Fatal("AliKalmanTrack(const AliKalmanTrack&)", - "The magnetic field has not been set !\n"); - fLab=t.fLab; fChi2=t.fChi2; fN=t.fN; fMass=t.fMass; - } + AliKalmanTrack(); + AliKalmanTrack(const AliKalmanTrack &t); + virtual ~AliKalmanTrack(){}; void SetLabel(Int_t lab) {fLab=lab;} @@ -35,20 +27,20 @@ public: Double_t GetChi2() const {return fChi2;} Double_t GetMass() const {return fMass;} Int_t GetNumberOfClusters() const {return fN;} - virtual Int_t GetClusterIndex(Int_t i) const { //reserved for AliTracker - printf("AliKalmanTrack::GetClusterIndex(Int_t i) must be overloaded !\n"); + virtual Int_t GetClusterIndex(Int_t) const { //reserved for AliTracker + Warning("GetClusterIndex(Int_t)","Method must be overloaded !\n"); return 0; } - virtual Int_t Compare(const TObject *o) const {return 0;} + virtual Int_t Compare(const TObject *) const {return 0;} - virtual void GetExternalParameters(Double_t &xr, Double_t x[5]) const {;} - virtual void GetExternalCovariance(Double_t cov[15]) const {;} + virtual void GetExternalParameters(Double_t &/*xr*/, Double_t /*x*/[5]) const {} + virtual void GetExternalCovariance(Double_t /*cov*/[15]) const {} - virtual Double_t GetPredictedChi2(const AliCluster *cluster) const {return 0.;} + virtual Double_t GetPredictedChi2(const AliCluster *) const {return 0.;} virtual - Int_t PropagateTo(Double_t xr,Double_t x0,Double_t rho) {return 0;} - virtual Int_t Update(const AliCluster* c, Double_t chi2, UInt_t i) {return 0;} + Int_t PropagateTo(Double_t /*xr*/, Double_t /*x0*/, Double_t /*rho*/) {return 0;} + virtual Int_t Update(const AliCluster*, Double_t /*chi2*/, UInt_t) {return 0;} static void SetConvConst(Double_t cc) {fConvConst=cc;} Double_t GetConvConst() const {return fConvConst;} diff --git a/STEER/AliLego.cxx b/STEER/AliLego.cxx index aceb2f5eb55..021371e4d9b 100644 --- a/STEER/AliLego.cxx +++ b/STEER/AliLego.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.29 2002/10/14 14:57:32 hristov +Merging the VirtualMC branch to the main development branch (HEAD) + Revision 1.28.6.2 2002/07/24 10:08:13 alibrary Updating VirtualMC @@ -123,51 +126,95 @@ Introduction of the Copyright and cvs Log // ////////////////////////////////////////////////////////////// +#include "TClonesArray.h" +#include "TH2.h" #include "TMath.h" +#include "TString.h" -#include "AliLego.h" - +#include "AliConst.h" #include "AliDebugVolume.h" -#include "AliRun.h" +#include "AliLego.h" #include "AliLegoGenerator.h" -#include "AliConst.h" #include "AliMC.h" -#include "TH2.h" -#include "TString.h" -#include "TClonesArray.h" +#include "AliRun.h" ClassImp(AliLego) - -//___________________________________________ -AliLego::AliLego() +//_______________________________________________________________________ +AliLego::AliLego(): + fGener(0), + fTotRadl(0), + fTotAbso(0), + fTotGcm2(0), + fHistRadl(0), + fHistAbso(0), + fHistGcm2(0), + fHistReta(0), + fVolumesFwd(0), + fVolumesBwd(0), + fStepBack(0), + fStepsBackward(0), + fStepsForward(0), + fErrorCondition(0), + fDebug(0) { // // Default constructor // - fGener = 0; - fHistRadl = 0; - fHistAbso = 0; - fHistGcm2 = 0; - fHistReta = 0; - fVolumesFwd = 0; - fVolumesBwd = 0; } -//___________________________________________ +//_______________________________________________________________________ +AliLego::AliLego(const AliLego &lego): + TNamed(lego), + fGener(0), + fTotRadl(0), + fTotAbso(0), + fTotGcm2(0), + fHistRadl(0), + fHistAbso(0), + fHistGcm2(0), + fHistReta(0), + fVolumesFwd(0), + fVolumesBwd(0), + fStepBack(0), + fStepsBackward(0), + fStepsForward(0), + fErrorCondition(0), + fDebug(0) +{ + // + // Copy constructor + // + lego.Copy(*this); +} + + +//_______________________________________________________________________ AliLego::AliLego(const char *title, Int_t ntheta, Float_t thetamin, - Float_t thetamax, Int_t nphi, Float_t phimin, Float_t phimax, - Float_t rmin, Float_t rmax, Float_t zmax) - : TNamed("Lego Generator",title) + Float_t thetamax, Int_t nphi, Float_t phimin, Float_t phimax, + Float_t rmin, Float_t rmax, Float_t zmax): + TNamed("Lego Generator",title), + fGener(0), + fTotRadl(0), + fTotAbso(0), + fTotGcm2(0), + fHistRadl(0), + fHistAbso(0), + fHistGcm2(0), + fHistReta(0), + fVolumesFwd(0), + fVolumesBwd(0), + fStepBack(0), + fStepsBackward(0), + fStepsForward(0), + fErrorCondition(0), + fDebug(0) { // // specify the angular limits and the size of the rectangular box // fGener = new AliLegoGenerator(ntheta, thetamin, thetamax, nphi, phimin, phimax, rmin, rmax, zmax); - - - fHistRadl = new TH2F("hradl","Radiation length map", ntheta,thetamin,thetamax,nphi,phimin,phimax); fHistAbso = new TH2F("habso","Interaction length map", @@ -175,49 +222,56 @@ AliLego::AliLego(const char *title, Int_t ntheta, Float_t thetamin, fHistGcm2 = new TH2F("hgcm2","g/cm2 length map", ntheta,thetamin,thetamax,nphi,phimin,phimax); // - fStepBack = 0; - fStepsBackward = 0; - fStepsForward = 0; - fStepBack = 0; fVolumesFwd = new TClonesArray("AliDebugVolume",1000); fVolumesBwd = new TClonesArray("AliDebugVolume",1000); fDebug = gAlice->GetDebug(); - fErrorCondition = 0; } -AliLego::AliLego(const char *title, AliLegoGenerator* generator) - : TNamed("Lego Generator",title) +//_______________________________________________________________________ +AliLego::AliLego(const char *title, AliLegoGenerator* generator): + TNamed("Lego Generator",title), + fGener(0), + fTotRadl(0), + fTotAbso(0), + fTotGcm2(0), + fHistRadl(0), + fHistAbso(0), + fHistGcm2(0), + fHistReta(0), + fVolumesFwd(0), + fVolumesBwd(0), + fStepBack(0), + fStepsBackward(0), + fStepsForward(0), + fErrorCondition(0), + fDebug(0) { // // specify the angular limits and the size of the rectangular box // - fGener = generator; - Float_t c1min, c1max, c2min, c2max; - Int_t n1 = fGener->NCoor1(); - Int_t n2 = fGener->NCoor2(); - - fGener->Coor1Range(c1min, c1max); - fGener->Coor2Range(c2min, c2max); + fGener = generator; + Float_t c1min, c1max, c2min, c2max; + Int_t n1 = fGener->NCoor1(); + Int_t n2 = fGener->NCoor2(); + + fGener->Coor1Range(c1min, c1max); + fGener->Coor2Range(c2min, c2max); + + fHistRadl = new TH2F("hradl","Radiation length map", + n2, c2min, c2max, n1, c1min, c1max); + fHistAbso = new TH2F("habso","Interaction length map", + n2, c2min, c2max, n1, c1min, c1max); + fHistGcm2 = new TH2F("hgcm2","g/cm2 length map", + n2, c2min, c2max, n1, c1min, c1max); + // + // - fHistRadl = new TH2F("hradl","Radiation length map", - n2, c2min, c2max, n1, c1min, c1max); - fHistAbso = new TH2F("habso","Interaction length map", - n2, c2min, c2max, n1, c1min, c1max); - fHistGcm2 = new TH2F("hgcm2","g/cm2 length map", - n2, c2min, c2max, n1, c1min, c1max); -// -// - fStepBack = 0; - fStepsBackward = 0; - fStepsForward = 0; - fStepBack = 0; - fVolumesFwd = new TClonesArray("AliDebugVolume",1000); - fVolumesBwd = new TClonesArray("AliDebugVolume",1000); - fDebug = gAlice->GetDebug(); - fErrorCondition =0; + fVolumesFwd = new TClonesArray("AliDebugVolume",1000); + fVolumesBwd = new TClonesArray("AliDebugVolume",1000); + fDebug = gAlice->GetDebug(); } -//___________________________________________ +//_______________________________________________________________________ AliLego::~AliLego() { // @@ -227,11 +281,11 @@ AliLego::~AliLego() delete fHistAbso; delete fHistGcm2; delete fGener; - if (fVolumesFwd) delete fVolumesFwd; - if (fVolumesBwd) delete fVolumesBwd; + delete fVolumesFwd; + delete fVolumesBwd; } -//___________________________________________ +//_______________________________________________________________________ void AliLego::BeginEvent() { // @@ -242,17 +296,17 @@ void AliLego::BeginEvent() fTotGcm2 = 0; if (fDebug) { - if (fErrorCondition) DumpVolumes(); - fVolumesFwd->Delete(); - fVolumesBwd->Delete(); - fStepsForward = 0; - fStepsBackward = 0; - fErrorCondition = 0; - if (gAlice->CurrentTrack() == 0) fStepBack = 0; + if (fErrorCondition) DumpVolumes(); + fVolumesFwd->Delete(); + fVolumesBwd->Delete(); + fStepsForward = 0; + fStepsBackward = 0; + fErrorCondition = 0; + if (gAlice->CurrentTrack() == 0) fStepBack = 0; } } -//___________________________________________ +//_______________________________________________________________________ void AliLego::FinishEvent() { // @@ -266,7 +320,7 @@ void AliLego::FinishEvent() fHistGcm2->Fill(c2,c1,fTotGcm2); } -//___________________________________________ +//_______________________________________________________________________ void AliLego::FinishRun() { // @@ -284,8 +338,8 @@ void AliLego::FinishRun() if (fErrorCondition) DumpVolumes(); } -//___________________________________________ -void AliLego::Copy(AliLego &lego) const +//_______________________________________________________________________ +void AliLego::Copy(AliLego&) const { // // Copy *this onto lego -- not implemented @@ -293,186 +347,178 @@ void AliLego::Copy(AliLego &lego) const Fatal("Copy","Not implemented!\n"); } -//___________________________________________ -void AliLego::StepManager() { -// called from AliRun::Stepmanager from gustep. -// Accumulate the 3 parameters step by step - - static Float_t t; - Float_t a,z,dens,radl,absl; - Int_t i, id, copy; - const char* vol; - static Float_t vect[3], dir[3]; - - TString tmp1, tmp2; - copy = 1; - id = gMC->CurrentVolID(copy); - vol = gMC->VolName(id); - Float_t step = gMC->TrackStep(); - - TLorentzVector pos, mom; - gMC->TrackPosition(pos); - gMC->TrackMomentum(mom); - - Int_t status = 0; - if (gMC->IsTrackEntering()) status = 1; - if (gMC->IsTrackExiting()) status = 2; - - - - +//_______________________________________________________________________ +void AliLego::StepManager() +{ + // + // called from AliRun::Stepmanager from gustep. + // Accumulate the 3 parameters step by step + // + static Float_t t; + Float_t a,z,dens,radl,absl; + Int_t i, id, copy; + const char* vol; + static Float_t vect[3], dir[3]; + + TString tmp1, tmp2; + copy = 1; + id = gMC->CurrentVolID(copy); + vol = gMC->VolName(id); + Float_t step = gMC->TrackStep(); + + TLorentzVector pos, mom; + gMC->TrackPosition(pos); + gMC->TrackMomentum(mom); + + Int_t status = 0; + if (gMC->IsTrackEntering()) status = 1; + if (gMC->IsTrackExiting()) status = 2; + if (! fStepBack) { -// printf("\n volume %s %d", vol, status); -// -// Normal Forward stepping -// - if (fDebug) { -// printf("\n steps fwd %d %s %d %f", fStepsForward, vol, fErrorCondition, step); - -// -// store volume if different from previous -// + // printf("\n volume %s %d", vol, status); + // + // Normal Forward stepping + // + if (fDebug) { + // printf("\n steps fwd %d %s %d %f", fStepsForward, vol, fErrorCondition, step); + + // + // store volume if different from previous + // TClonesArray &lvols = *fVolumesFwd; if (fStepsForward > 0) { - AliDebugVolume* tmp = (AliDebugVolume*) (*fVolumesFwd)[fStepsForward-1]; - if (tmp->IsEqual(vol, copy) && gMC->IsTrackEntering()) { + AliDebugVolume* tmp = dynamic_cast((*fVolumesFwd)[fStepsForward-1]); + if (tmp->IsVEqual(vol, copy) && gMC->IsTrackEntering()) { fStepsForward -= 2; fVolumesFwd->RemoveAt(fStepsForward); fVolumesFwd->RemoveAt(fStepsForward+1); - } + } } - + new(lvols[fStepsForward++]) - AliDebugVolume(vol,copy,step,pos[0], pos[1], pos[2], status); - - } // Debug -// -// Get current material properties - - gMC->CurrentMaterial(a,z,dens,radl,absl); + AliDebugVolume(vol,copy,step,pos[0], pos[1], pos[2], status); - if (z < 1) return; + } // Debug + // + // Get current material properties + + gMC->CurrentMaterial(a,z,dens,radl,absl); + + if (z < 1) return; + + // --- See if we have to stop now + if (TMath::Abs(pos[2]) > fGener->ZMax() || + pos[0]*pos[0] +pos[1]*pos[1] > fGener->RadMax()*fGener->RadMax()) { + if (!gMC->IsNewTrack()) { + // Not the first step, add past contribution + fTotAbso += t/absl; + fTotRadl += t/radl; + fTotGcm2 += t*dens; + if (fDebug) { + // + // generate "mirror" particle flying back + // + fStepsBackward = fStepsForward; + + Float_t pmom[3], orig[3]; + Float_t polar[3] = {0.,0.,0.}; + Int_t ntr; + pmom[0] = -dir[0]; + pmom[1] = -dir[1]; + pmom[2] = -dir[2]; + orig[0] = vect[0]; + orig[1] = vect[1]; + orig[2] = vect[2]; + + gAlice->SetTrack(1, gAlice->CurrentTrack(), + 0, pmom, orig, polar, 0., kPNoProcess, ntr); + } // debug + + } // not a new track ! -// --- See if we have to stop now - if (TMath::Abs(pos[2]) > fGener->ZMax() || - pos[0]*pos[0] +pos[1]*pos[1] > fGener->RadMax()*fGener->RadMax()) { - if (!gMC->IsNewTrack()) { - // Not the first step, add past contribution - fTotAbso += t/absl; - fTotRadl += t/radl; - fTotGcm2 += t*dens; - if (fDebug) { -// -// generate "mirror" particle flying back -// - fStepsBackward = fStepsForward; - - Float_t pmom[3], orig[3]; - Float_t polar[3] = {0.,0.,0.}; - Int_t ntr; - pmom[0] = -dir[0]; - pmom[1] = -dir[1]; - pmom[2] = -dir[2]; - orig[0] = vect[0]; - orig[1] = vect[1]; - orig[2] = vect[2]; - - gAlice->SetTrack(1, gAlice->CurrentTrack(), - 0, pmom, orig, polar, 0., kPNoProcess, ntr); - } // debug - - } // not a new track ! - - if (fDebug) fStepBack = 1; - gMC->StopTrack(); - return; - } // outside scoring region ? - -// --- See how long we have to go - for(i=0;i<3;++i) { - vect[i]=pos[i]; - dir[i]=mom[i]; - } - - t = fGener->PropagateCylinder(vect,dir,fGener->RadMax(),fGener->ZMax()); - - if(step) { - - fTotAbso += step/absl; - fTotRadl += step/radl; - fTotGcm2 += step*dens; - } - - + if (fDebug) fStepBack = 1; + gMC->StopTrack(); + return; + } // outside scoring region ? + + // --- See how long we have to go + for(i=0;i<3;++i) { + vect[i]=pos[i]; + dir[i]=mom[i]; + } + + t = fGener->PropagateCylinder(vect,dir,fGener->RadMax(),fGener->ZMax()); + + if(step) { + + fTotAbso += step/absl; + fTotRadl += step/radl; + fTotGcm2 += step*dens; + } + } else { if (fDebug) { -// -// Geometry debugging -// Fly back and compare volume sequence -// - TClonesArray &lvols = *fVolumesBwd; - if (fStepsBackward < fStepsForward) { - AliDebugVolume* tmp = (AliDebugVolume*) (*fVolumesBwd)[fStepsBackward]; - if (tmp->IsEqual(vol, copy) && gMC->IsTrackEntering()) { - fStepsBackward += 2; - fVolumesBwd->RemoveAt(fStepsBackward-1); - fVolumesBwd->RemoveAt(fStepsBackward-2); + // + // Geometry debugging + // Fly back and compare volume sequence + // + TClonesArray &lvols = *fVolumesBwd; + if (fStepsBackward < fStepsForward) { + AliDebugVolume* tmp = dynamic_cast((*fVolumesBwd)[fStepsBackward]); + if (tmp->IsVEqual(vol, copy) && gMC->IsTrackEntering()) { + fStepsBackward += 2; + fVolumesBwd->RemoveAt(fStepsBackward-1); + fVolumesBwd->RemoveAt(fStepsBackward-2); } - } - - fStepsBackward--; -// printf("\n steps %d %s %d", fStepsBackward, vol, fErrorCondition); - if (fStepsBackward < 0) { + } + + fStepsBackward--; + // printf("\n steps %d %s %d", fStepsBackward, vol, fErrorCondition); + if (fStepsBackward < 0) { gMC->StopTrack(); fStepBack = 0; return; - } - - new(lvols[fStepsBackward]) AliDebugVolume(vol,copy,step,pos[0], pos[1], pos[2], status); - - AliDebugVolume* tmp = (AliDebugVolume*) (*fVolumesFwd)[fStepsBackward]; - if (! (tmp->IsEqual(vol, copy)) && (!fErrorCondition)) - { - printf("\n Problem at (x,y,z): %d %f %f %f, volumes: %s %s step: %f\n", - fStepsBackward, pos[0], pos[1], pos[2], tmp->GetName(), vol, step); - fErrorCondition = 1; - } + } + + new(lvols[fStepsBackward]) AliDebugVolume(vol,copy,step,pos[0], pos[1], pos[2], status); + + AliDebugVolume* tmp = dynamic_cast((*fVolumesFwd)[fStepsBackward]); + if (! (tmp->IsVEqual(vol, copy)) && (!fErrorCondition)) + { + printf("\n Problem at (x,y,z): %d %f %f %f, volumes: %s %s step: %f\n", + fStepsBackward, pos[0], pos[1], pos[2], tmp->GetName(), vol, step); + fErrorCondition = 1; + } } // Debug } // bwd/fwd } +//_______________________________________________________________________ void AliLego::DumpVolumes() { -// -// Dump volume sequence in case of error -// - printf("\n Dumping Volume Sequence:"); - printf("\n =============================================="); - - for (Int_t i = fStepsForward-1; i>=0; i--) + // + // Dump volume sequence in case of error + // + printf("\n Dumping Volume Sequence:"); + printf("\n =============================================="); + + for (Int_t i = fStepsForward-1; i>=0; i--) { - AliDebugVolume* tmp1 = (AliDebugVolume*) (*fVolumesFwd)[i]; - AliDebugVolume* tmp2 = (AliDebugVolume*) (*fVolumesBwd)[i]; - if (tmp1) - printf("\n Volume Fwd: %3d: %5s (%3d) step: %12.5e (x,y,z) (%12.5e %12.5e %12.5e) status: %9s \n" - , i, - tmp1->GetName(), tmp1->CopyNumber(), tmp1->Step(), - tmp1->X(), tmp1->Y(), tmp1->Z(), tmp1->Status()); - if (tmp2 && i>= fStepsBackward) - printf("\n Volume Bwd: %3d: %5s (%3d) step: %12.5e (x,y,z) (%12.5e %12.5e %12.5e) status: %9s \n" - , i, - tmp2->GetName(), tmp2->CopyNumber(), tmp2->Step(), - tmp2->X(), tmp2->Y(), tmp2->Z(), tmp2->Status()); - - printf("\n ............................................................................\n"); + AliDebugVolume* tmp1 = dynamic_cast((*fVolumesFwd)[i]); + AliDebugVolume* tmp2 = dynamic_cast((*fVolumesBwd)[i]); + if (tmp1) + printf("\n Volume Fwd: %3d: %5s (%3d) step: %12.5e (x,y,z) (%12.5e %12.5e %12.5e) status: %9s \n" + , i, + tmp1->GetName(), tmp1->CopyNumber(), tmp1->Step(), + tmp1->X(), tmp1->Y(), tmp1->Z(), tmp1->Status()); + if (tmp2 && i>= fStepsBackward) + printf("\n Volume Bwd: %3d: %5s (%3d) step: %12.5e (x,y,z) (%12.5e %12.5e %12.5e) status: %9s \n" + , i, + tmp2->GetName(), tmp2->CopyNumber(), tmp2->Step(), + tmp2->X(), tmp2->Y(), tmp2->Z(), tmp2->Status()); + + printf("\n ............................................................................\n"); } - printf("\n ==============================================\n"); + printf("\n ==============================================\n"); } - - - - - - - diff --git a/STEER/AliLego.h b/STEER/AliLego.h index 0b525f2de6c..c3cda8997b8 100644 --- a/STEER/AliLego.h +++ b/STEER/AliLego.h @@ -26,19 +26,19 @@ public: Float_t themax, Int_t nphi, Float_t phimin, Float_t phimax,Float_t rmin,Float_t rmax,Float_t zmax); AliLego(const char *title, AliLegoGenerator* generator); - AliLego(const AliLego &lego) {lego.Copy(*this);} + AliLego(const AliLego &lego); virtual ~AliLego(); - 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: + +private: + void Copy(AliLego &lego) const; void DumpVolumes(); - private: AliLegoGenerator *fGener; //Lego generator Float_t fTotRadl; //!Total Radiation length diff --git a/STEER/AliLegoGenerator.cxx b/STEER/AliLegoGenerator.cxx index e5faf63ea0e..41e2d4ee717 100644 --- a/STEER/AliLegoGenerator.cxx +++ b/STEER/AliLegoGenerator.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.5 2001/05/16 14:57:22 alibrary +New files for folders and Stack + Revision 1.4 2000/11/30 07:12:49 alibrary Introducing new Rndm and QA classes @@ -66,42 +69,63 @@ Introduction of the Copyright and cvs Log ClassImp(AliLegoGenerator) -//___________________________________________ - -AliLegoGenerator::AliLegoGenerator() +//_______________________________________________________________________ +AliLegoGenerator::AliLegoGenerator(): + fRadMin(0), + fRadMax(0), + fZMax(0), + fNCoor1(0), + fNCoor2(0), + fCoor1Min(0), + fCoor1Max(0), + fCoor2Min(0), + fCoor2Max(0), + fCoor1Bin(-1), + fCoor2Bin(-1), + fCurCoor1(0), + fCurCoor2(0) { // // Default Constructor // SetName("Lego"); - - fCoor1Bin = fCoor2Bin = -1; - fCurCoor1 = fCurCoor2 = 0; } +//_______________________________________________________________________ AliLegoGenerator::AliLegoGenerator(Int_t nc1, Float_t c1min, - Float_t c1max, Int_t nc2, - Float_t c2min, Float_t c2max, - Float_t rmin, Float_t rmax, Float_t zmax) : - AliGenerator(0), fRadMin(rmin), fRadMax(rmax), fZMax(zmax), fNCoor1(nc1), - fNCoor2(nc2), fCoor1Bin(nc1), fCoor2Bin(-1), fCurCoor1(0), fCurCoor2(0) - + Float_t c1max, Int_t nc2, + Float_t c2min, Float_t c2max, + Float_t rmin, Float_t rmax, Float_t zmax): + AliGenerator(0), + fRadMin(rmin), + fRadMax(rmax), + fZMax(zmax), + fNCoor1(nc1), + fNCoor2(nc2), + fCoor1Min(0), + fCoor1Max(0), + fCoor2Min(0), + fCoor2Max(0), + fCoor1Bin(nc1), + fCoor2Bin(-1), + fCurCoor1(0), + fCurCoor2(0) { // // Standard generator for Lego rays // + SetName("Lego"); SetCoor1Range(nc1, c1min, c1max); SetCoor2Range(nc2, c2min, c2max); - SetName("Lego"); } -//___________________________________________ +//_______________________________________________________________________ void AliLegoGenerator::Generate() { -// Create a geantino with kinematics corresponding to the current bins -// Here: Coor1 = theta -// Coor2 = phi. - + // Create a geantino with kinematics corresponding to the current bins + // Here: Coor1 = theta + // Coor2 = phi. + // // Rootinos are 0 const Int_t kMpart = 0; @@ -147,11 +171,13 @@ void AliLegoGenerator::Generate() } -//___________________________________________ -Float_t AliLegoGenerator::PropagateCylinder(Float_t *x, Float_t *v, Float_t r, Float_t z) +//_______________________________________________________________________ +Float_t AliLegoGenerator::PropagateCylinder(Float_t *x, Float_t *v, Float_t r, + Float_t z) { -// Propagate to cylinder from inside - + // + // Propagate to cylinder from inside + // Double_t hnorm, sz, t, t1, t2, t3, sr; Double_t d[3]; const Float_t kSmall = 1e-8; diff --git a/STEER/AliMCQA.cxx b/STEER/AliMCQA.cxx index c3189df340f..0f74c0a3842 100644 --- a/STEER/AliMCQA.cxx +++ b/STEER/AliMCQA.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.7 2002/10/14 14:57:32 hristov +Merging the VirtualMC branch to the main development branch (HEAD) + Revision 1.6.6.1 2002/10/12 21:41:00 hristov Remove the object from the list of browsables @@ -67,18 +70,56 @@ Introducing new Rndm and QA classes ClassImp(AliMCQA) - -//_____________________________________________________________________________ -AliMCQA::AliMCQA() : fQAList(0), fDetDone(0), fQAHist(0), fVolNames(0), - fModNames(0),fMPaveLabel(0),fVPaveLabel(0) +//_______________________________________________________________________ +AliMCQA::AliMCQA(): + fNdets(0), + fNvolumes(0), + fQAList(0), + fOldId(0), + fDetDone(0), + fQAHist(0), + fVolNames(0), + fModNames(0), + fMPaveLabel(0), + fVPaveLabel(0) { // // Default constructor // } -//_____________________________________________________________________________ -AliMCQA::AliMCQA(Int_t ndets) : fMPaveLabel(0),fVPaveLabel(0) +//_______________________________________________________________________ +AliMCQA::AliMCQA(const AliMCQA &qa): + TObject(qa), + fNdets(0), + fNvolumes(0), + fQAList(0), + fOldId(0), + fDetDone(0), + fQAHist(0), + fVolNames(0), + fModNames(0), + fMPaveLabel(0), + fVPaveLabel(0) +{ + // + // Copy constructor + // + qa.Copy(*this); +} + +//_______________________________________________________________________ +AliMCQA::AliMCQA(Int_t ndets): + fNdets(ndets), + fNvolumes(gMC->NofVolumes()), + fQAList(new TObjArray(ndets)), + fOldId(0), + fDetDone(new Int_t[ndets]), + fQAHist(new TObjArray(2)), + fVolNames(new TObjArray(fNvolumes)), + fModNames(new TObjArray(fNdets)), + fMPaveLabel(0), + fVPaveLabel(0) { // // Constructor, creates the list of lists of histograms @@ -87,19 +128,15 @@ AliMCQA::AliMCQA(Int_t ndets) : fMPaveLabel(0),fVPaveLabel(0) TH1F* h; Int_t i; - fNdets=ndets; - - fQAList = new TObjArray(ndets); TObjArray &hist = *fQAList; char title[100]; // TObjArray &mods = *(gAlice->Modules()); - AliModule *mod; TList *dir = gDirectory->GetList(); for (i=0; i(mods[i]); // Energy Spectrum sprintf(title,"Spectrum entering: %s ",mod->GetName()); @@ -124,46 +161,45 @@ AliMCQA::AliMCQA(Int_t ndets) : fMPaveLabel(0),fVPaveLabel(0) // gROOT->GetListOfBrowsables()->Add(this,"AliMCQA"); - fDetDone = new Int_t[fNdets]; - // // Global QA histograms // - fQAHist = new TObjArray(2); - fNvolumes=gMC->NofVolumes(); fQAHist->Add(new TH1F("hMCVcalls","Monte Carlo calls per volume", fNvolumes, 0.5, fNvolumes+0.5)); - h = (TH1F*) dir->FindObject("hMCVcalls"); + h = dynamic_cast(dir->FindObject("hMCVcalls")); h->GetListOfFunctions()->Add(new TExec("ex","gAlice->GetMCQA()->AddVolumeName()")); dir->Remove(dir->FindObject("hMCVcalls")); // // Build list of volume names // - fVolNames=new TObjArray(fNvolumes); for(i=0;iModules())[gAlice->DetFromMate(gMC->VolId2Mate(i+1))]; + AliModule *mod = dynamic_cast + ((*gAlice->Modules())[gAlice->DetFromMate(gMC->VolId2Mate(i+1))]); (*fVolNames)[i]=new TNamed(gMC->VolName(i+1),mod->GetName()); } fQAHist->Add(new TH1F("hMCMcalls","Monte Carlo calls per module", fNdets, -0.5, fNdets-0.5)); - h = (TH1F*) dir->FindObject("hMCMcalls"); + h = dynamic_cast(dir->FindObject("hMCMcalls")); h->GetListOfFunctions()->Add(new TExec("ex","gAlice->GetMCQA()->AddModuleName()")); dir->Remove(dir->FindObject("hMCMcalls")); // // Build list of module names // - fModNames=new TObjArray(fNdets); for(i=0;iModules())[i])->GetName(),""); + new TNamed((dynamic_cast((*gAlice->Modules())[i]))->GetName(),""); } -//_____________________________________________________________________________ +//_______________________________________________________________________ +void AliMCQA::Copy(AliMCQA &) const +{ + Fatal("Copy ctor","Not implemented!\n"); +} +//_______________________________________________________________________ AliMCQA::~AliMCQA() { gROOT->GetListOfBrowsables()->Remove(this); if (fQAList) { @@ -191,7 +227,7 @@ AliMCQA::~AliMCQA() { delete fVPaveLabel; } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliMCQA::Browse(TBrowser *b) { // @@ -204,21 +240,21 @@ void AliMCQA::Browse(TBrowser *b) // Global histos first // TIter global(fQAHist); - while((hist = (TH1*)global())) + while((hist = dynamic_cast(global()))) b->Add(hist,hist->GetTitle()); // // Module histograms now // TIter next(fQAList); TList *histos; - while((histos = (TList*)next())) { + while((histos = dynamic_cast(next()))) { TIter next1(histos); - while((hist = (TH1*)next1())) + while((hist = dynamic_cast(next1()))) b->Add(hist,hist->GetTitle()); } } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliMCQA::PreTrack() { // @@ -228,7 +264,7 @@ void AliMCQA::PreTrack() for(Int_t i=0; iFindObject("hMCVcalls"); + static TH1F* mcvcalls = dynamic_cast(fQAHist->FindObject("hMCVcalls")); mcvcalls->Fill(gMC->CurrentVolID(copy)); - static TH1F* mcmcalls = (TH1F*) fQAHist->FindObject("hMCMcalls"); + static TH1F* mcmcalls = dynamic_cast(fQAHist->FindObject("hMCMcalls")); mcmcalls->Fill(id); // @@ -290,26 +326,26 @@ void AliMCQA::StepManager(Int_t id) Double_t energy = TMath::Max(p[3]-mass,1.e-12); if(fOldId > -1) { if(!fDetDone[fOldId] && !gMC->IsNewTrack()) { - TList *histold = (TList*) (*fQAList)[fOldId]; - hist = (TH1F*) histold->FindObject("hEnOut"); + TList *histold = dynamic_cast((*fQAList)[fOldId]); + hist = dynamic_cast(histold->FindObject("hEnOut")); hist->Fill(TMath::Log10(energy)); - hist = (TH1F*) histold->FindObject("hZOut"); + hist = dynamic_cast(histold->FindObject("hZOut")); hist->Fill(x[2]); fDetDone[fOldId]=1; } } if(!fDetDone[id] && !gMC->IsNewTrack()) { - TList *histnew = (TList*) (*fQAList)[id]; - hist = (TH1F*) histnew->FindObject("hEnIn"); + TList *histnew = dynamic_cast((*fQAList)[id]); + hist = dynamic_cast(histnew->FindObject("hEnIn")); hist->Fill(TMath::Log10(energy)); - hist = (TH1F*) histnew->FindObject("hZIn"); + hist = dynamic_cast(histnew->FindObject("hZIn")); hist->Fill(x[2]); } fOldId=id; } } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliMCQA::AddModuleName() { // @@ -324,7 +360,7 @@ void AliMCQA::AddModuleName() } } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliMCQA::AddVolumeName() { // @@ -339,7 +375,7 @@ void AliMCQA::AddVolumeName() } } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliMCQA::DrawPaveLabel(TPaveLabel *&pv) { // @@ -360,14 +396,14 @@ void AliMCQA::DrawPaveLabel(TPaveLabel *&pv) pv->Draw(); } -//_____________________________________________________________________________ +//_______________________________________________________________________ Int_t AliMCQA::GetHBin(const char* hname) { // // Get the bin where the cursor is // TList *dir = gDirectory->GetList(); - TH1 *h=(TH1*)dir->FindObject(hname); + TH1 *h=dynamic_cast(dir->FindObject(hname)); int px = gPad->GetEventX(); @@ -377,7 +413,7 @@ Int_t AliMCQA::GetHBin(const char* hname) return h->GetXaxis()->FindBin(x); } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliMCQA::DrawModuleName() { // @@ -389,7 +425,7 @@ void AliMCQA::DrawModuleName() Int_t binx = GetHBin("hMCMcalls"); if(0GetName()); + strcpy(lab,dynamic_cast((*fModNames)[binx-1])->GetName()); fMPaveLabel->SetLabel(lab); gPad->Modified(); @@ -397,7 +433,7 @@ void AliMCQA::DrawModuleName() } } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliMCQA::DrawVolumeName() { // @@ -409,8 +445,8 @@ void AliMCQA::DrawVolumeName() Int_t binx = GetHBin("hMCVcalls"); if(0GetName(), - ((TNamed*)(*fVolNames)[binx-1])->GetTitle()); + sprintf(lab,"%s: %s",dynamic_cast((*fVolNames)[binx-1])->GetName(), + dynamic_cast((*fVolNames)[binx-1])->GetTitle()); fVPaveLabel->SetLabel(lab); gPad->Modified(); diff --git a/STEER/AliMCQA.h b/STEER/AliMCQA.h index 8621998f128..b097fbf20ad 100644 --- a/STEER/AliMCQA.h +++ b/STEER/AliMCQA.h @@ -21,6 +21,7 @@ class AliMCQA : public TObject public: AliMCQA(); AliMCQA(Int_t ndets); + AliMCQA(const AliMCQA &); virtual ~AliMCQA(); Bool_t IsFolder() const {return kTRUE;} virtual void Browse(TBrowser *b); @@ -30,7 +31,8 @@ public: void AddModuleName(); void DrawVolumeName(); void AddVolumeName(); - + AliMCQA & operator=(const AliMCQA &qa) + {qa.Copy(*this); return (*this);} // QA step manager virtual void StepManager(Int_t id); @@ -48,13 +50,11 @@ protected: TPaveLabel *fVPaveLabel; //! PaveLabel for the Volumes private: - AliMCQA(const AliMCQA &) {} - AliMCQA & operator=(const AliMCQA &) {return (*this);} void DrawPaveLabel(TPaveLabel *&pv); Int_t GetHBin(const char* hname); + void Copy(AliMCQA& qa) const; ClassDef(AliMCQA,1) //Quality Assurance class for the MC }; #endif - diff --git a/STEER/AliMagF.cxx b/STEER/AliMagF.cxx index 8927ae66b8a..724ca752040 100644 --- a/STEER/AliMagF.cxx +++ b/STEER/AliMagF.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.9 2001/05/16 14:57:22 alibrary +New files for folders and Stack + Revision 1.8 2000/12/18 10:44:01 morsch Possibility to set field map by passing pointer to objet of type AliMagF via SetField(). @@ -43,49 +46,55 @@ Introduction of the Copyright and cvs Log #include "AliMagF.h" -#include -#include - - ClassImp(AliMagF) -//________________________________________ +//_______________________________________________________________________ +AliMagF::AliMagF(): + fMap(0), + fType(0), + fInteg(0), + fFactor(0), + fMax(0), + fDebug(0) +{ + // + // Default constructor + // +} + +//_______________________________________________________________________ AliMagF::AliMagF(const char *name, const char *title, const Int_t integ, - const Float_t factor, const Float_t fmax) - : TNamed(name,title) + const Float_t factor, const Float_t fmax): + TNamed(name,title), + fMap(0), + fType(0), + fInteg(0), + fFactor(factor), + fMax(fmax), + fDebug(0) { // // Standard constructor // if(integ<0 || integ > 2) { - Warning("SetField", - "Invalid magnetic field flag: %5d; Helix tracking chosen instead\n" - ,integ); - fInteg = 2; + Warning("SetField", + "Invalid magnetic field flag: %5d; Helix tracking chosen instead\n" + ,integ); + fInteg = 2; } else { - fInteg = integ; + fInteg = integ; } fType = kUndef; - fFactor = factor; - fMax = fmax; // fDebug = 0; } -//________________________________________ +//_______________________________________________________________________ void AliMagF::Field(Float_t*, Float_t *b) { // // Method to return the field in one point -- dummy in this case // - printf("Undefined MagF Field called, returning 0\n"); + Warning("Field","Undefined MagF Field called, returning 0\n"); b[0]=b[1]=b[2]=0; } - - - - - - - - diff --git a/STEER/AliMagF.h b/STEER/AliMagF.h index c0fd52dfbbc..adf9637ea40 100644 --- a/STEER/AliMagF.h +++ b/STEER/AliMagF.h @@ -12,7 +12,7 @@ enum Field_t {kUndef=1, kConst=1, kConMesh=2, kDipoMap=3}; class AliMagF : public TNamed { public: - AliMagF(){} + AliMagF(); AliMagF(const char *name, const char *title, const Int_t integ, const Float_t factor = 1., const Float_t fmax = 10.); virtual ~AliMagF() {} @@ -41,27 +41,27 @@ protected: //ZDC part ------------------------------------------------------------------- - const Float_t kG1=20.443; - const Float_t kFDIP=-37.96; - const Float_t kFCORN2=-9.14; +static const Float_t kG1=20.443; +static const Float_t kFDIP=-37.96; +static const Float_t kFCORN2=-9.14; // // ZBEG Beginning of the inner triplet // D1BEG Beginning of separator dipole 1 // D2BEG Beginning of separator dipole 2 // CORBEG Corrector dipole beginning (because of dimuon arm) // - const Float_t kCORBEG2=19216.,kCOREND2=kCORBEG2+170., kCOR2RA2=4.5*4.5; +static const Float_t kCORBEG2=19216.,kCOREND2=kCORBEG2+170., kCOR2RA2=4.5*4.5; // - const Float_t kZBEG=2300.; - const Float_t kZ1BEG=kZBEG+ 0.,kZ1END=kZ1BEG+630.,kZ1RA2=3.5*3.5; - const Float_t kZ2BEG=kZBEG+ 880.,kZ2END=kZ2BEG+550.,kZ2RA2=3.5*3.5; - const Float_t kZ3BEG=kZBEG+1530.,kZ3END=kZ3BEG+550.,kZ3RA2=3.5*3.5; - const Float_t kZ4BEG=kZBEG+2430.,kZ4END=kZ4BEG+630.,kZ4RA2=3.5*3.5; - const Float_t kD1BEG=5838.3 ,kD1END=kD1BEG+945.,kD1RA2=4.5*4.5; - const Float_t kD2BEG=12147.6 ,kD2END=kD2BEG+945.,kD2RA2=4.5*4.5; +static const Float_t kZBEG=2300.; +static const Float_t kZ1BEG=kZBEG+ 0.,kZ1END=kZ1BEG+630.,kZ1RA2=3.5*3.5; +static const Float_t kZ2BEG=kZBEG+ 880.,kZ2END=kZ2BEG+550.,kZ2RA2=3.5*3.5; +static const Float_t kZ3BEG=kZBEG+1530.,kZ3END=kZ3BEG+550.,kZ3RA2=3.5*3.5; +static const Float_t kZ4BEG=kZBEG+2430.,kZ4END=kZ4BEG+630.,kZ4RA2=3.5*3.5; +static const Float_t kD1BEG=5838.3 ,kD1END=kD1BEG+945.,kD1RA2=4.5*4.5; +static const Float_t kD2BEG=12147.6 ,kD2END=kD2BEG+945.,kD2RA2=4.5*4.5; // - const Float_t kXCEN1D2=-9.7 ,kYCEN1D2=0.; - const Float_t kXCEN2D2=9.7 ,kYCEN2D2=0.; +static const Float_t kXCEN1D2=-9.7 ,kYCEN1D2=0.; +static const Float_t kXCEN2D2=9.7 ,kYCEN2D2=0.; //ZDC part ------------------------------------------------------------------- diff --git a/STEER/AliMagFCM.cxx b/STEER/AliMagFCM.cxx index 33ea712b937..6ce59b1066b 100644 --- a/STEER/AliMagFCM.cxx +++ b/STEER/AliMagFCM.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.9 2001/09/04 15:05:13 hristov +Pointer fB is initialised to 0 in the default constructor + Revision 1.8 2001/05/28 14:10:35 morsch SetSolenoidField method to set the L3 field strength. 2 kG is default. @@ -50,26 +53,79 @@ Coding convention corrections + few minor bug fixes ClassImp(AliMagFCM) -//________________________________________ +//_______________________________________________________________________ +AliMagFCM::AliMagFCM(): + fXbeg(0), + fYbeg(0), + fZbeg(0), + fXdel(0), + fYdel(0), + fZdel(0), + fSolenoid(0), + fXdeli(0), + fYdeli(0), + fZdeli(0), + fXn(0), + fYn(0), + fZn(0), + fB(0) +{ + // + // Standard constructor + // + fType = kConMesh; + fMap = 2; + SetSolenoidField(); +} + +//_______________________________________________________________________ AliMagFCM::AliMagFCM(const char *name, const char *title, const Int_t integ, - const Float_t factor, const Float_t fmax) - : AliMagF(name,title,integ,factor,fmax) + const Float_t factor, const Float_t fmax): + AliMagF(name,title,integ,factor,fmax), + fXbeg(0), + fYbeg(0), + fZbeg(0), + fXdel(0), + fYdel(0), + fZdel(0), + fSolenoid(0), + fXdeli(0), + fYdeli(0), + fZdeli(0), + fXn(0), + fYn(0), + fZn(0), + fB(0) { // // Standard constructor // - fB=0; fType = kConMesh; fMap = 2; SetSolenoidField(); - if(fDebug>-1) printf("%s: Constant Mesh Field %s created: map= %d, factor= %f, file= %s\n", + if(fDebug>-1) Info("ctor", + "%s: Constant Mesh Field %s created: map= %d, factor= %f, file= %s\n", ClassName(),fName.Data(), fMap, factor,fTitle.Data()); - } -//________________________________________ -AliMagFCM::AliMagFCM(const AliMagFCM &magf) +//_______________________________________________________________________ +AliMagFCM::AliMagFCM(const AliMagFCM &magf): + AliMagF(magf), + fXbeg(0), + fYbeg(0), + fZbeg(0), + fXdel(0), + fYdel(0), + fZdel(0), + fSolenoid(0), + fXdeli(0), + fYdeli(0), + fZdeli(0), + fXn(0), + fYn(0), + fZn(0), + fB(0) { // // Copy constructor @@ -77,7 +133,7 @@ AliMagFCM::AliMagFCM(const AliMagFCM &magf) magf.Copy(*this); } -//________________________________________ +//_______________________________________________________________________ void AliMagFCM::Field(Float_t *x, Float_t *b) { // @@ -206,7 +262,7 @@ void AliMagFCM::Field(Float_t *x, Float_t *b) } } -//________________________________________ +//_______________________________________________________________________ void AliMagFCM::ReadField() { // @@ -248,7 +304,7 @@ void AliMagFCM::ReadField() } } -//________________________________________ +//_______________________________________________________________________ void AliMagFCM::Copy(AliMagFCM & /* magf */) const { // @@ -257,9 +313,3 @@ void AliMagFCM::Copy(AliMagFCM & /* magf */) const Fatal("Copy","Not implemented!\n"); } -//________________________________________ -AliMagFCM & AliMagFCM::operator =(const AliMagFCM &magf) -{ - magf.Copy(*this); - return *this; -} diff --git a/STEER/AliMagFCM.h b/STEER/AliMagFCM.h index b3352988c22..4683d01bbdb 100644 --- a/STEER/AliMagFCM.h +++ b/STEER/AliMagFCM.h @@ -13,7 +13,7 @@ class AliMagFCM : public AliMagF //Alice Magnetic Field with constan mesh public: - AliMagFCM(){fB=0;} + AliMagFCM(); AliMagFCM(const char *name, const char *title, const Int_t integ, const Float_t factor, const Float_t fmax); AliMagFCM(const AliMagFCM &mag); @@ -24,7 +24,8 @@ public: virtual Float_t SolenoidField() const {return fSolenoid;} void Copy(AliMagFCM &magf) const; - virtual AliMagFCM & operator=(const AliMagFCM &magf); + virtual AliMagFCM & operator=(const AliMagFCM &magf) + {magf.Copy(*this); return *this;} Float_t Bx(const Int_t ix, const Int_t iy, const Int_t iz) { return (*fB)(3*(iz*(fXn*fYn)+iy*fXn+ix)); diff --git a/STEER/AliMagFDM.cxx b/STEER/AliMagFDM.cxx index 6534cba0d1e..50264c8fb86 100644 --- a/STEER/AliMagFDM.cxx +++ b/STEER/AliMagFDM.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.12 2001/05/28 14:10:35 morsch +SetSolenoidField method to set the L3 field strength. 2 kG is default. + Revision 1.11 2001/02/08 13:18:00 hristov Print removed (J.Gosset) @@ -60,16 +63,77 @@ Coding convention corrections + few minor bug fixes #include -#include "AliMagFDM.h" #include "TSystem.h" + +#include "AliMagFDM.h" ClassImp(AliMagFDM) -//________________________________________ +//_______________________________________________________________________ +AliMagFDM::AliMagFDM(): + fSolenoid(0), + fInd(0), + fZmin(0), + fZmax(0), + fYmax(0), + fYmin(0), + fZpmx(0), + fZpmn(0), + fRmax(0), + fRmin(0), + fXdel(0), + fYdel(0), + fZdel(0), + fRdel(0), + fPhid(0), + fZpdl(0), + fCx1(0), + fCx2(0), + fAx1(0), + fAx2(0), + fXl(0), + fYl(0), + fZl(0), + fRn(0), + fPhin(0), + fZpl(0) +{ + // + // Default constructor for the Dipole field + // +} + +//_______________________________________________________________________ AliMagFDM::AliMagFDM(const char *name, const char *title, const Int_t integ, - const Float_t factor, const Float_t fmax) - : AliMagF(name,title,integ,factor,fmax) + const Float_t factor, const Float_t fmax): + AliMagF(name,title,integ,factor,fmax), + fSolenoid(0), + fInd(0), + fZmin(0), + fZmax(0), + fYmax(0), + fYmin(0), + fZpmx(0), + fZpmn(0), + fRmax(0), + fRmin(0), + fXdel(0), + fYdel(0), + fZdel(0), + fRdel(0), + fPhid(0), + fZpdl(0), + fCx1(0), + fCx2(0), + fAx1(0), + fAx2(0), + fXl(0), + fYl(0), + fZl(0), + fRn(0), + fPhin(0), + fZpl(0) { // // Standard constructor for the Dipole field @@ -78,38 +142,39 @@ AliMagFDM::AliMagFDM(const char *name, const char *title, const Int_t integ, fMap = 3; SetSolenoidField(); - printf("Field Map for Muon Arm from IP till muon filter %s created: map= %d, integ= %d, factor= %f, file=%s\n",fName.Data(), fMap ,integ,factor,fTitle.Data()); + Info("ctor", + "Field Map for Muon Arm from IP till muon filter %s created: map= %d, integ= %d, factor= %f, file=%s\n", + fName.Data(), fMap ,integ,factor,fTitle.Data()); } -//________________________________________ - +//_______________________________________________________________________ void AliMagFDM::Field(Float_t *xfi, Float_t *b) { // // Main routine to compute the field in a point // - static const Double_t keps=0.1E-06; - static const Double_t PI2=2.*TMath::Pi(); - static const Double_t kone=1; - - static const Int_t kiip=33; - static const Int_t kmiip=0; - static const Int_t kliip=0; - - static const Int_t kiic=0; - static const Int_t kmiic=0; - static const Int_t kliic=0; - - static const Double_t kfZbg=502.92; // Start of Map using in z - static const Double_t kfZL3=600; // Beginning of L3 door in z + const Double_t keps=0.1E-06; + const Double_t PI2=2.*TMath::Pi(); + const Double_t kone=1; + + const Int_t kiip=33; + const Int_t kmiip=0; + const Int_t kliip=0; + + const Int_t kiic=0; + const Int_t kmiic=0; + const Int_t kliic=0; + + const Double_t kfZbg=502.92; // Start of Map using in z + const Double_t kfZL3=600; // Beginning of L3 door in z Double_t x[3]; Double_t xL3[3]; Double_t bint[3]; Double_t r0; - Int_t iKvar,jb; + Int_t iKvar,jb; Double_t zp1, zp2,xp1,xp2,yp1,yp2; Double_t zz1, zz2,yy1,yy2,x2,x1; @@ -349,9 +414,9 @@ if ((kfZbg/100 #include + #include "AliFieldMap.h" #include "AliMagFMaps.h" ClassImp(AliMagFMaps) -//________________________________________ +//_______________________________________________________________________ +AliMagFMaps::AliMagFMaps(): + fSolenoid(0), + fL3Option(0), + fFieldRead(0) +{ + // + // Default constructor + // + fFieldMap[0] = fFieldMap[1] = fFieldMap[2] = 0; +} + +//_______________________________________________________________________ AliMagFMaps::AliMagFMaps(const char *name, const char *title, const Int_t integ, - const Float_t factor, const Float_t fmax, const Int_t map, - const Int_t l3) - : AliMagF(name,title,integ,factor,fmax) + const Float_t factor, const Float_t fmax, const Int_t map, + const Int_t l3): + AliMagF(name,title,integ,factor,fmax), + fSolenoid(0), + fL3Option(l3), + fFieldRead(0) { // // Standard constructor @@ -70,15 +89,18 @@ AliMagFMaps::AliMagFMaps(const char *name, const char *title, const Int_t integ, ReadField(); fFieldRead = 1; -// -// Don't replicate field information in gAlice + // + // Don't replicate field information in gAlice for (Int_t i = 0; i < 3; i++) fFieldMap[i]->SetWriteEnable(0); -// - + // } -//________________________________________ -AliMagFMaps::AliMagFMaps(const AliMagFMaps &magf) +//_______________________________________________________________________ +AliMagFMaps::AliMagFMaps(const AliMagFMaps &magf): + AliMagF(magf), + fSolenoid(0), + fL3Option(0), + fFieldRead(0) { // // Copy constructor @@ -86,113 +108,113 @@ AliMagFMaps::AliMagFMaps(const AliMagFMaps &magf) magf.Copy(*this); } +//_______________________________________________________________________ AliMagFMaps::~AliMagFMaps() { -// -// Destructor -// - delete fFieldMap[0]; - delete fFieldMap[1]; - delete fFieldMap[2]; + // + // Destructor + // + delete fFieldMap[0]; + delete fFieldMap[1]; + delete fFieldMap[2]; } +//_______________________________________________________________________ void AliMagFMaps::ReadField() { -// Read Field Map from file -// -// don't read twice -// - if (fFieldRead) return; - fFieldRead = 1; -// - char* fname; - TFile* file = 0; - if (fMap == k2kG) { + // Read Field Map from file + // + // don't read twice + // + if (fFieldRead) return; + fFieldRead = 1; + // + char* fname; + TFile* file = 0; + if (fMap == k2kG) { if (fL3Option) { - fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B02.root"); - file = new TFile(fname); - fFieldMap[0] = (AliFieldMap*) file->Get("L3B02"); - file->Close(); - delete file; + fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B02.root"); + file = new TFile(fname); + fFieldMap[0] = dynamic_cast(file->Get("L3B02")); + file->Close(); + delete file; } fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/DipB02.root"); file = new TFile(fname); - fFieldMap[1] = (AliFieldMap*) file->Get("DipB02"); + fFieldMap[1] = dynamic_cast(file->Get("DipB02")); file->Close(); delete file;; fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/ExtB02.root"); file = new TFile(fname); - fFieldMap[2] = (AliFieldMap*) file->Get("ExtB02"); + fFieldMap[2] = dynamic_cast(file->Get("ExtB02")); file->Close(); delete file; fSolenoid = 2.; - } else if (fMap == k4kG) { + } else if (fMap == k4kG) { if (fL3Option) { - fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B04.root"); - file = new TFile(fname); - fFieldMap[0] = (AliFieldMap*) file->Get("L3B04"); - file->Close(); - delete file; + fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B04.root"); + file = new TFile(fname); + fFieldMap[0] = dynamic_cast(file->Get("L3B04")); + file->Close(); + delete file; } fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/DipB04.root"); file = new TFile(fname); - fFieldMap[1] = (AliFieldMap*) file->Get("DipB04"); + fFieldMap[1] = dynamic_cast(file->Get("DipB04")); file->Close(); - delete file;; + delete file; fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/ExtB04.root"); file = new TFile(fname); - fFieldMap[2] = (AliFieldMap*) file->Get("ExtB04"); + fFieldMap[2] = dynamic_cast(file->Get("ExtB04")); file->Close(); delete file; fSolenoid = 4.; - } else if (fMap == k5kG) { + } else if (fMap == k5kG) { if (fL3Option) { - fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B05.root"); - file = new TFile(fname); - fFieldMap[0] = (AliFieldMap*) file->Get("L3B05"); - file->Close(); - delete file; + fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B05.root"); + file = new TFile(fname); + fFieldMap[0] = dynamic_cast(file->Get("L3B05")); + file->Close(); + delete file; } fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/DipB05.root"); file = new TFile(fname); - fFieldMap[1] = (AliFieldMap*) file->Get("DipB05"); + fFieldMap[1] = dynamic_cast(file->Get("DipB05")); file->Close(); - delete file;; + delete file; fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/ExtB05.root"); file = new TFile(fname); - fFieldMap[2] = (AliFieldMap*) file->Get("ExtB05"); + fFieldMap[2] = dynamic_cast(file->Get("ExtB05")); file->Close(); delete file; fSolenoid = 5.; - } - - if (!fL3Option) { -// -// Dummy L3 map + } + + if (!fL3Option) { + // + // Dummy L3 map fFieldMap[0] = new AliFieldMap(); fFieldMap[0] -> SetLimits(-800., 800., -800., 800., -700., 700.); - } + } } - +//_______________________________________________________________________ Float_t AliMagFMaps::SolenoidField() const { -// -// Returns max. L3 (solenoid) field strength -// according to field map setting - - return fSolenoid; + // + // Returns max. L3 (solenoid) field strength + // according to field map setting + // + return fSolenoid; } - - -//________________________________________ +//_______________________________________________________________________ void AliMagFMaps::Field(Float_t *x, Float_t *b) { // @@ -201,78 +223,78 @@ void AliMagFMaps::Field(Float_t *x, Float_t *b) // --- find the position in the grid --- if (!fFieldRead) ReadField(); - + b[0]=b[1]=b[2]=0; AliFieldMap* map = 0; if (fFieldMap[0]->Inside(x[0], x[1], x[2])) { - map = fFieldMap[0]; - if (!fL3Option) { -// -// Constant L3 field, if this option was selected -// + map = fFieldMap[0]; + if (!fL3Option) { + // + // Constant L3 field, if this option was selected + // b[2] = fSolenoid; return; - } + } } else if (fFieldMap[1]->Inside(x[0], x[1], x[2])) { - map = fFieldMap[1]; + map = fFieldMap[1]; } else if (fFieldMap[2]->Inside(x[0], x[1], x[2])) { - map = fFieldMap[2]; + map = fFieldMap[2]; } if(map){ - map->Field(x,b); + map->Field(x,b); } else { -//This is the ZDC part - Float_t rad2=x[0]*x[0]+x[1]*x[1]; - if(x[2]>kCORBEG2 && x[2]kCORBEG2 && x[2]kZ1BEG && x[2]kZ1BEG && x[2]kZ2BEG && x[2]kZ2BEG && x[2]kZ3BEG && x[2]kZ3BEG && x[2]kZ4BEG && x[2]kZ4BEG && x[2]kD1BEG && x[2]kD1BEG && x[2]kD2BEG && x[2]kD2BEG && x[2]ReadBuffer(R__b, this); - fFieldRead = 0; - } else { - AliMagFMaps::Class()->WriteBuffer(R__b, this); - } + // Stream an object of class AliMagFMaps. + if (R__b.IsReading()) { + AliMagFMaps::Class()->ReadBuffer(R__b, this); + fFieldRead = 0; + } else { + AliMagFMaps::Class()->WriteBuffer(R__b, this); + } } diff --git a/STEER/AliMagFMaps.h b/STEER/AliMagFMaps.h index c13fe45f156..d1cddb3a964 100644 --- a/STEER/AliMagFMaps.h +++ b/STEER/AliMagFMaps.h @@ -18,7 +18,7 @@ class AliMagFMaps : public AliMagF public: enum constants {k2kG, k4kG, k5kG}; - AliMagFMaps(){fFieldMap[0] = fFieldMap[1] = fFieldMap[2] = 0; fFieldRead = 0;} + AliMagFMaps(); AliMagFMaps(const char *name, const char *title, const Int_t integ, const Float_t factor, const Float_t fmax, const Int_t map = k2kG, const Int_t l3 = 1); @@ -30,9 +30,12 @@ public: virtual Float_t SolenoidField() const; virtual void SetL3ConstField(Int_t flag = 0) {fL3Option = flag;} - void Copy(AliMagFMaps &magf) const; - virtual AliMagFMaps & operator=(const AliMagFMaps &magf); + virtual AliMagFMaps & operator=(const AliMagFMaps &magf) + {magf.Copy(*this); return *this;} + protected: + void Copy(AliMagFMaps &magf) const; + AliFieldMap* fFieldMap[3]; // Field maps Float_t fSolenoid; // Solenoid field setting Int_t fL3Option; // Option for field inside L3 diff --git a/STEER/AliMergeCombi.cxx b/STEER/AliMergeCombi.cxx index be5b75b5871..1f37271cddf 100644 --- a/STEER/AliMergeCombi.cxx +++ b/STEER/AliMergeCombi.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.2 2001/10/04 15:50:23 jchudoba +Implement non default combination + Revision 1.1 2001/09/19 06:22:13 jchudoba Class to generate combinations for merging @@ -32,32 +35,36 @@ Class to generate combinations for merging ClassImp(AliMergeCombi) -AliMergeCombi::AliMergeCombi() +//_______________________________________________________________________ +AliMergeCombi::AliMergeCombi(): + fDim(1), + fSperb(1), + fCounter(0) { -// default ctor - fDim = 1; - fSperb = 1; - fCounter = 0; + // + // default ctor + // } -//////////////////////////////////////////////////////////////////////// -AliMergeCombi::AliMergeCombi(Int_t dim, Int_t sperb) +//_______________________________________________________________________ +AliMergeCombi::AliMergeCombi(Int_t dim, Int_t sperb): + fDim(dim), + fSperb(sperb), + fCounter(0) { -// default ctor - fDim = dim; - fSperb = sperb; - fCounter = 0; + // + // Standard ctor + // } -//////////////////////////////////////////////////////////////////////// +//_______________________________________________________________________ AliMergeCombi::~AliMergeCombi() { -// default dtor - ; + // default dtor } -//////////////////////////////////////////////////////////////////////// -Bool_t AliMergeCombi::Combination(Int_t evNumber[], Int_t delta[]) +//_______________________________________________________________________ +Bool_t AliMergeCombi::Combination(Int_t /* evNumber */ [], Int_t delta[]) { delta[0] = 1; for (Int_t i=1; iGetModuleID(name); if (id>=0) { @@ -122,24 +135,32 @@ AliModule::AliModule(const char* name,const char *title):TNamed(name,title) // SetMarkerColor(3); // - // Allocate space for tracking media and material indexes - fIdtmed = new TArrayI(100); - fIdmate = new TArrayI(100); + // Clear space for tracking media and material indexes + for(Int_t i=0;i<100;i++) (*fIdmate)[i]=(*fIdtmed)[i]=0; - // - // Prepare to find the tracking media range - fLoMedium = 65536; - fHiMedium = 0; AliConfig::Instance()->Add(this); SetDebug(gAlice->GetDebug()); - - fEnable = 1; } -//_____________________________________________________________________________ -AliModule::AliModule(const AliModule &mod) +//_______________________________________________________________________ +AliModule::AliModule(const AliModule &mod): + TNamed(mod), + TAttLine(mod), + TAttMarker(mod), + AliRndm(mod), + fEuclidMaterial(""), + fEuclidGeometry(""), + fIdtmed(0), + fIdmate(0), + fLoMedium(0), + fHiMedium(0), + fActive(0), + fHistograms(0), + fNodes(0), + fDebug(0), + fEnable(0) { // // Copy constructor @@ -147,14 +168,13 @@ AliModule::AliModule(const AliModule &mod) mod.Copy(*this); } -//_____________________________________________________________________________ +//_______________________________________________________________________ AliModule::~AliModule() { // // Destructor // - fHistograms = 0; - // + // Delete ROOT geometry if(fNodes) { fNodes->Clear(); @@ -166,7 +186,7 @@ AliModule::~AliModule() delete fIdmate; } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliModule::Copy(AliModule & /* mod */) const { // @@ -175,7 +195,7 @@ void AliModule::Copy(AliModule & /* mod */) const Fatal("Copy","Not implemented!\n"); } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliModule::Disable() { // @@ -187,12 +207,12 @@ void AliModule::Disable() // // Loop through geometry to disable all // nodes for this Module - while((node = (TNode*)next())) { + while((node = dynamic_cast(next()))) { node->SetVisibility(-1); } } -//_____________________________________________________________________________ +//_______________________________________________________________________ Int_t AliModule::DistancetoPrimitive(Int_t, Int_t) { // @@ -202,7 +222,7 @@ Int_t AliModule::DistancetoPrimitive(Int_t, Int_t) return 9999; } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliModule::Enable() { // @@ -214,15 +234,15 @@ void AliModule::Enable() // // Loop through geometry to enable all // nodes for this Module - while((node = (TNode*)next())) { + while((node = dynamic_cast(next()))) { node->SetVisibility(3); } } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliModule::AliMaterial(Int_t imat, const char* name, Float_t a, - Float_t z, Float_t dens, Float_t radl, - Float_t absl, Float_t *buf, Int_t nwbuf) const + Float_t z, Float_t dens, Float_t radl, + Float_t absl, Float_t *buf, Int_t nwbuf) const { // // Store the parameters for a material @@ -242,10 +262,10 @@ void AliModule::AliMaterial(Int_t imat, const char* name, Float_t a, (*fIdmate)[imat]=kmat; } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliModule::AliGetMaterial(Int_t imat, char* name, Float_t &a, - Float_t &z, Float_t &dens, Float_t &radl, - Float_t &absl) + Float_t &z, Float_t &dens, Float_t &radl, + Float_t &absl) { // // Store the parameters for a material @@ -268,10 +288,10 @@ void AliModule::AliGetMaterial(Int_t imat, char* name, Float_t &a, } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliModule::AliMixture(Int_t imat, const char *name, Float_t *a, - Float_t *z, Float_t dens, Int_t nlmat, - Float_t *wmat) const + Float_t *z, Float_t dens, Int_t nlmat, + Float_t *wmat) const { // // Defines mixture or compound imat as composed by @@ -297,12 +317,12 @@ void AliModule::AliMixture(Int_t imat, const char *name, Float_t *a, (*fIdmate)[imat]=kmat; } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliModule::AliMedium(Int_t numed, const char *name, Int_t nmat, - Int_t isvol, Int_t ifield, Float_t fieldm, - Float_t tmaxfd, Float_t stemax, Float_t deemax, - Float_t epsil, Float_t stmin, Float_t *ubuf, - Int_t nbuf) const + Int_t isvol, Int_t ifield, Float_t fieldm, + Float_t tmaxfd, Float_t stemax, Float_t deemax, + Float_t epsil, Float_t stmin, Float_t *ubuf, + Int_t nbuf) const { // // Store the parameters of a tracking medium @@ -331,10 +351,10 @@ void AliModule::AliMedium(Int_t numed, const char *name, Int_t nmat, (*fIdtmed)[numed]=kmed; } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliModule::AliMatrix(Int_t &nmat, Float_t theta1, Float_t phi1, - Float_t theta2, Float_t phi2, Float_t theta3, - Float_t phi3) const + Float_t theta2, Float_t phi2, Float_t theta3, + Float_t phi3) const { // // Define a rotation matrix. Angles are in degrees. @@ -350,26 +370,19 @@ void AliModule::AliMatrix(Int_t &nmat, Float_t theta1, Float_t phi1, gMC->Matrix(nmat, theta1, phi1, theta2, phi2, theta3, phi3); } -//_____________________________________________________________________________ -AliModule& AliModule::operator=(const AliModule &mod) -{ - mod.Copy(*this); - return (*this); -} - -//_____________________________________________________________________________ +//_______________________________________________________________________ Float_t AliModule::ZMin() const { return -500; } -//_____________________________________________________________________________ +//_______________________________________________________________________ Float_t AliModule::ZMax() const { return 500; } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliModule::SetEuclidFile(char* material, char* geometry) { // @@ -387,7 +400,7 @@ void AliModule::SetEuclidFile(char* material, char* geometry) } } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliModule::ReadEuclid(const char* filnam, char* topvol) { // @@ -560,7 +573,7 @@ void AliModule::ReadEuclid(const char* filnam, char* topvol) Error("ReadEuclid","reading error or premature end of file\n"); } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliModule::ReadEuclidMedia(const char* filnam) { // diff --git a/STEER/AliModule.h b/STEER/AliModule.h index abc58146c7e..2829ca88497 100644 --- a/STEER/AliModule.h +++ b/STEER/AliModule.h @@ -5,12 +5,14 @@ /* $Id$ */ -#include "TNamed.h" +#include "Riostream.h" + #include "TAttLine.h" #include "TAttMarker.h" +#include "TNamed.h" + #include "AliRndm.h" -//#include class TClonesArray; class TBrowser; class TArrayI; @@ -88,14 +90,14 @@ public: virtual void FinishEvent() {} virtual void FinishRun() {} virtual void FinishPrimary() {} - virtual void RemapTrackHitIDs(Int_t *map) {} - virtual void RemapTrackReferencesIDs(Int_t *map) {} //remaping track references MI + virtual void RemapTrackHitIDs(Int_t *) {} + virtual void RemapTrackReferencesIDs(Int_t *) {} //remaping track references MI //virtual void Hits2Digits() {} virtual void Init() {} virtual void LoadPoints(Int_t ) {} - virtual void MakeBranch(Option_t *, const char *file=0 ) {} - virtual void MakeBranchTR(Option_t *opt=" ", const char *file=0 ){} + virtual void MakeBranch(Option_t *, const char* =0 ) {} + virtual void MakeBranchTR(Option_t * =" ", const char * =0 ){} virtual void Paint(Option_t *) {} virtual void ResetDigits() {} virtual void ResetSDigits() {} @@ -114,10 +116,12 @@ public: virtual void SetEuclidFile(char *material,char *geometry=0); virtual void ReadEuclid(const char *filnam, char *topvol); virtual void ReadEuclidMedia(const char *filnam); - AliModule& operator=(const AliModule &mod); - void Copy(AliModule &mod) const; + AliModule& operator=(const AliModule &mod) + {mod.Copy(*this); return (*this);} protected: + void Copy(AliModule &mod) const; + // Data members TString fEuclidMaterial; //!Name of the Euclid file for materials (if any) diff --git a/STEER/AliPoints.cxx b/STEER/AliPoints.cxx index 54838004f61..51c61a6ff04 100644 --- a/STEER/AliPoints.cxx +++ b/STEER/AliPoints.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.7 2001/01/26 19:58:48 hristov +Major upgrade of AliRoot code + Revision 1.6 2000/10/02 21:28:14 fca Removal of useless dependecies via forward declarations @@ -39,27 +42,31 @@ Introduction of the Copyright and cvs Log // // /////////////////////////////////////////////////////////////////////////////// -#include "AliPoints.h" -#include "AliRun.h" -#include "AliDetector.h" #include "TPad.h" -#include "TView.h" #include "TParticle.h" +#include "TView.h" + +#include "AliDetector.h" +#include "AliPoints.h" +#include "AliRun.h" ClassImp(AliPoints) -//_____________________________________________________________________________ -AliPoints::AliPoints() +//_______________________________________________________________________ +AliPoints::AliPoints(): + fDetector(0), + fIndex(0) { // // Default constructor // - fDetector = 0; - fIndex = 0; } -//_____________________________________________________________________________ -AliPoints::AliPoints(const AliPoints &pts) +//_______________________________________________________________________ +AliPoints::AliPoints(const AliPoints &pts): + TPolyMarker3D(pts), + fDetector(0), + fIndex(0) { // // Copy constructor @@ -67,36 +74,34 @@ AliPoints::AliPoints(const AliPoints &pts) pts.Copy(*this); } -//_____________________________________________________________________________ -AliPoints::AliPoints(Int_t nhits) - :TPolyMarker3D(nhits) +//_______________________________________________________________________ +AliPoints::AliPoints(Int_t nhits): + TPolyMarker3D(nhits), + fDetector(0), + fIndex(0) { // // Standard constructor // - fDetector = 0; - fIndex = 0; ResetBit(kCanDelete); } -//_____________________________________________________________________________ +//_______________________________________________________________________ AliPoints::~AliPoints() { // - // Default constructor + // Default destructor // - fDetector = 0; - fIndex = 0; } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliPoints::Copy(AliPoints &pts) const { // // Copy *this onto pts // if(this != &pts) { - ((TPolyMarker3D*)this)->Copy((TPolyMarker3D&)pts); + ((TPolyMarker3D*)this)->Copy(dynamic_cast(pts)); pts.fGLList = fGLList; pts.fLastPoint = fLastPoint; pts.fDetector = fDetector; @@ -104,8 +109,7 @@ void AliPoints::Copy(AliPoints &pts) const } } - -//_____________________________________________________________________________ +//_______________________________________________________________________ Int_t AliPoints::DistancetoPrimitive(Int_t px, Int_t py) { // @@ -125,7 +129,7 @@ Int_t AliPoints::DistancetoPrimitive(Int_t px, Int_t py) return TPolyMarker3D::DistancetoPrimitive(px,py); } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliPoints::DumpParticle() { // @@ -135,7 +139,7 @@ void AliPoints::DumpParticle() if (particle) particle->Dump(); } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliPoints::ExecuteEvent(Int_t event, Int_t px, Int_t py) { // @@ -154,7 +158,7 @@ void AliPoints::ExecuteEvent(Int_t event, Int_t px, Int_t py) } -//_____________________________________________________________________________ +//_______________________________________________________________________ const Text_t *AliPoints::GetName() const { // @@ -165,8 +169,8 @@ const Text_t *AliPoints::GetName() const return particle->GetName(); } -//_____________________________________________________________________________ -Text_t *AliPoints::GetObjectInfo(Int_t, Int_t) +//_______________________________________________________________________ +Text_t *AliPoints::GetObjectInfo(Int_t, Int_t) const { // // Redefines TObject::GetObjectInfo. @@ -178,7 +182,7 @@ Text_t *AliPoints::GetObjectInfo(Int_t, Int_t) return info; } -//_____________________________________________________________________________ +//_______________________________________________________________________ TParticle *AliPoints::GetParticle() const { // @@ -188,7 +192,7 @@ TParticle *AliPoints::GetParticle() const else return gAlice->Particle(fIndex); } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliPoints::InspectParticle() { // @@ -198,17 +202,7 @@ void AliPoints::InspectParticle() if (particle) particle->Inspect(); } -//_____________________________________________________________________________ -AliPoints & AliPoints::operator=(const AliPoints &pts) -{ - // - // Assignment operator - // - pts.Copy(*this); - return (*this); -} - -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliPoints::Propagate() { // @@ -220,13 +214,13 @@ void AliPoints::Propagate() // TIter next(gAlice->Detectors()); AliDetector *detector; - while((detector = (AliDetector*)next())) { + while((detector = dynamic_cast(next()))) { if (!detector->IsActive()) continue; points = detector->Points(); if (!points) continue; ntracks = points->GetEntriesFast(); for (track=0;trackUncheckedAt(track); + pm = dynamic_cast(points->UncheckedAt(track)); if (!pm) continue; if (fIndex == pm->GetIndex()) { pm->SetMarkerColor(GetMarkerColor()); diff --git a/STEER/AliPoints.h b/STEER/AliPoints.h index 0c1ff01e2b0..69f1b0bd379 100644 --- a/STEER/AliPoints.h +++ b/STEER/AliPoints.h @@ -15,7 +15,6 @@ public: AliPoints(const AliPoints& pts); AliPoints(Int_t nhits); virtual ~AliPoints(); - void Copy(AliPoints &pts) const; virtual Int_t DistancetoPrimitive(Int_t px, Int_t py); virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py); AliDetector *GetDetector() const {return fDetector;} @@ -24,15 +23,18 @@ public: virtual const Text_t *GetName() const; virtual void InspectParticle(); // *MENU* virtual void DumpParticle(); // *MENU* - virtual Text_t *GetObjectInfo(Int_t px, Int_t py); - AliPoints & operator=(const AliPoints &pts); + virtual Text_t *GetObjectInfo(Int_t px, Int_t py) const; + AliPoints & operator=(const AliPoints &pts) + {pts.Copy(*this); return (*this);} virtual void Propagate(); // *MENU* virtual void SetDetector(AliDetector *det) {fDetector = det;} virtual void SetParticle(Int_t index) {fIndex = index;} protected: - AliDetector *fDetector; //Pointer to AliDetector object - Int_t fIndex; //Particle number in AliRun::fParticles + void Copy(AliPoints &pts) const; + + AliDetector *fDetector; //Pointer to AliDetector object + Int_t fIndex; //Particle number in AliRun::fParticles ClassDef(AliPoints,1) //Class to draw detector hits (is PolyMarker3D) }; diff --git a/STEER/AliRecPoint.cxx b/STEER/AliRecPoint.cxx index a94551d9455..d6dd12df86b 100644 --- a/STEER/AliRecPoint.cxx +++ b/STEER/AliRecPoint.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.9 2001/12/05 14:36:47 hristov +The default constructor now creates no objects; destructor corrected (thanks to R.Brun). + Revision 1.8 2001/10/21 18:38:43 hristov Several pointers were set to zero in the default constructors to avoid memory management problems @@ -66,44 +69,58 @@ Y.Schutz new classes for reconstruction ClassImp(AliRecPoint) -//____________________________________________________________________________ -AliRecPoint::AliRecPoint() +//_______________________________________________________________________ +AliRecPoint::AliRecPoint(): + fAmp(0), + fGeom(0), + fIndexInList(-1), // to be set when the point is already stored + fLocPos(0,0,0), + fLocPosM(0), + fMaxDigit(100), + fMulDigit(0), + fMaxTrack(5), + fMulTrack(0), + fDigitsList(0), + fTracksList(0) { + // // default ctor - fGeom = 0; - fAmp = 0.0 ; - - fLocPos.SetXYZ(0., 0., 0.) ; - fLocPosM = 0 ; - fMaxDigit = 100 ; - fMulDigit = 0 ; - fDigitsList = 0 ; - fMaxTrack = 5 ; - fMulTrack = 0 ; - fTracksList = 0 ; - fIndexInList = -1 ; // to be set when the point is already stored + // } -//____________________________________________________________________________ -AliRecPoint::AliRecPoint(const char * opt) +//_______________________________________________________________________ +AliRecPoint::AliRecPoint(const char * ): + fAmp(0), + fGeom(0), + fIndexInList(-1), // to be set when the point is already stored + fLocPos(0,0,0), + fLocPosM(new TMatrix(3,3)), + fMaxDigit(100), + fMulDigit(0), + fMaxTrack(5), + fMulTrack(0), + fDigitsList(new int[fMaxDigit]), + fTracksList(new int[fMaxTrack]) { - // ctor - fGeom = 0; - fAmp = 0.0 ; - - fLocPos.SetXYZ(0., 0., 0.) ; - fLocPosM = new TMatrix(3,3) ; - fMaxDigit = 100 ; - fMulDigit = 0 ; - fDigitsList = new int[fMaxDigit]; - fMaxTrack = 5 ; - fMulTrack = 0 ; - fTracksList = new int[fMaxTrack]; ; - fIndexInList = -1 ; // to be set when the point is already stored + // + // Standard ctor + // } -//____________________________________________________________________________ -AliRecPoint::AliRecPoint(const AliRecPoint& recp) +//_______________________________________________________________________ +AliRecPoint::AliRecPoint(const AliRecPoint& recp): + TObject(recp), + fAmp(0), + fGeom(0), + fIndexInList(-1), // to be set when the point is already stored + fLocPos(0,0,0), + fLocPosM(0), + fMaxDigit(100), + fMulDigit(0), + fMaxTrack(5), + fMulTrack(0), + fDigitsList(0), + fTracksList(0) { // // Copy constructor @@ -111,7 +128,7 @@ AliRecPoint::AliRecPoint(const AliRecPoint& recp) recp.Copy(*this); } -//____________________________________________________________________________ +//_______________________________________________________________________ AliRecPoint::~AliRecPoint() { // dtor @@ -122,7 +139,7 @@ AliRecPoint::~AliRecPoint() } -//____________________________________________________________________________ +//_______________________________________________________________________ void AliRecPoint::AddDigit(AliDigitNew & digit) { // adds a digit to the digits list @@ -146,7 +163,7 @@ void AliRecPoint::AddDigit(AliDigitNew & digit) fAmp += digit.GetAmp() ; } -//____________________________________________________________________________ +//_______________________________________________________________________ // void AliRecPoint::AddTrack(AliTrack & track) // { // // adds a digit to the digits list @@ -165,7 +182,7 @@ void AliRecPoint::AddDigit(AliDigitNew & digit) // fTracksList[fMulTrack++]= (int) &Track ; // } -//____________________________________________________________________________ +//_______________________________________________________________________ void AliRecPoint::Copy(AliRecPoint& recp) const { // @@ -173,7 +190,7 @@ void AliRecPoint::Copy(AliRecPoint& recp) const // // Copy all first if(this != &recp) { - ((TObject*) this)->Copy((TObject&)recp); + ((TObject*) this)->Copy(dynamic_cast(recp)); recp.fAmp = fAmp; recp.fGeom = fGeom; recp.fIndexInList = fIndexInList; @@ -192,8 +209,8 @@ void AliRecPoint::Copy(AliRecPoint& recp) const } } -//____________________________________________________________________________ -void AliRecPoint::GetCovarianceMatrix(TMatrix & mat) +//_______________________________________________________________________ +void AliRecPoint::GetCovarianceMatrix(TMatrix & mat) const { // returns the covariant matrix for the local position @@ -211,14 +228,6 @@ void AliRecPoint::GetLocalPosition(TVector3 & pos) const } -//____________________________________________________________________________ -AliRecPoint & AliRecPoint::operator= (const AliRecPoint &recp) -{ - recp.Copy(*this); - return (*this); -} - - //____________________________________________________________________________ void AliRecPoint::GetGlobalPosition(TVector3 & gpos, TMatrix & gmat) const { diff --git a/STEER/AliRecPoint.h b/STEER/AliRecPoint.h index eecb226efd0..b75cd2d0f60 100644 --- a/STEER/AliRecPoint.h +++ b/STEER/AliRecPoint.h @@ -38,8 +38,7 @@ public: virtual void AddDigit(AliDigitNew & digit) ; // add a digit to the digit's indexes list // virtual void AddTrack(AliTrack & track) ; // add a track to the tracks list - void Copy(AliRecPoint &recp) const; - virtual void GetCovarianceMatrix(TMatrix & mat) ; + virtual void GetCovarianceMatrix(TMatrix & mat) const; virtual AliGeometry * GetGeom() const { return fGeom; } virtual void GetGlobalPosition(TVector3 & gpos, TMatrix & gmat) const ; // return global position in ALICE virtual int * GetDigitsList(void) const { return fDigitsList ; } @@ -51,13 +50,14 @@ public: virtual Int_t GetMaximumDigitMultiplicity() const { return fMaxDigit; } virtual Int_t GetMaximumTrackMultiplicity() const { return fMaxTrack; } virtual Int_t GetTracksMultiplicity(void) const { return fMulTrack ; } - //PH virtual void Print(Option_t * opt = "void") = 0 ; - virtual void Print(Option_t * opt = "void") {;} - AliRecPoint & operator= (const AliRecPoint &recp); + AliRecPoint & operator= (const AliRecPoint &recp) + {recp.Copy(*this); return (*this);} + void SetIndexInList(Int_t val) { fIndexInList = val ; } protected: + void Copy(AliRecPoint &recp) const; Float_t fAmp ; // summed amplitude of digits AliGeometry * fGeom ; //! pointer to the geometry class diff --git a/STEER/AliRndm.cxx b/STEER/AliRndm.cxx index 63a535f496c..f36663016e1 100644 --- a/STEER/AliRndm.cxx +++ b/STEER/AliRndm.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.3 2000/12/21 15:30:18 fca +Correcting coding convention violations + Revision 1.2 2000/12/01 08:40:48 alibrary Correction of a small bug - sRandom can be used now @@ -28,14 +31,41 @@ Introducing new Rndm and QA classes // // /////////////////////////////////////////////////////////////////////////////// -#include "TSystem.h" #include "TFile.h" +#include "TError.h" +#include "TRandom3.h" +#include "TSystem.h" #include "AliRndm.h" -#include "TRandom3.h" ClassImp(AliRndm) +//_______________________________________________________________________ +AliRndm::AliRndm(): + fRandom(0) +{ + // + // Default ctor + // + SetRandom(); +} + +//_______________________________________________________________________ +AliRndm::AliRndm(const AliRndm& rn): + fRandom(0) +{ + // + // Copy constructor + // + rn.Copy(*this); +} + +//_______________________________________________________________________ +void AliRndm::Copy(AliRndm&) const +{ + ::Fatal("Copy","Not implemented\n"); +} + //_____________________________________________________________________________ void AliRndm::Rndm(Float_t* array, const Int_t size) const diff --git a/STEER/AliRndm.h b/STEER/AliRndm.h index f4d9396a133..75ad8a0713f 100644 --- a/STEER/AliRndm.h +++ b/STEER/AliRndm.h @@ -18,8 +18,11 @@ static TRandom *sRandom; class AliRndm { public: - AliRndm() {SetRandom();} + AliRndm(); + AliRndm(const AliRndm &); virtual ~AliRndm() {fRandom=sRandom=0;} + AliRndm & operator=(const AliRndm& rn) + {rn.Copy(*this); return (*this);} // Random number generator bit virtual void SetRandom(TRandom *ran=0) @@ -38,12 +41,11 @@ public: virtual void WriteRandom(const char *filename) const; virtual void ReadRandom(const char *filename); - protected: +protected: TRandom *fRandom; // Pointer to the random number generator - private: - AliRndm(const AliRndm &) {} - AliRndm & operator=(const AliRndm &) {return (*this);} +private: + void Copy(AliRndm &rn) const; ClassDef(AliRndm,1) //Random Number generator wrapper }; diff --git a/STEER/AliRun.cxx b/STEER/AliRun.cxx index 6d495aa69fa..cac1d6adb5e 100644 --- a/STEER/AliRun.cxx +++ b/STEER/AliRun.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.90 2002/10/22 15:02:15 alibrary +Introducing Riostream.h + Revision 1.89 2002/10/17 16:26:39 hristov Definition of additional particles moved to VMC (I.Hrivnacova) @@ -301,55 +304,153 @@ AliRun *gAlice; ClassImp(AliRun) -//_____________________________________________________________________________ -AliRun::AliRun() - : TVirtualMCApplication() +//_______________________________________________________________________ +AliRun::AliRun(): + fRun(0), + fEvent(0), + fEventNrInRun(0), + fEventsPerRun(0), + fDebug(0), + fHeader(0), + fTreeD(0), + fTreeS(0), + fTreeH(0), + fTreeTR(0), + fTreeE(0), + fTreeR(0), + fModules(0), + fGeometry(0), + fDisplay(0), + fTimer(), + fField(0), + fMC(0), + fImedia(0), + fNdets(0), + fTrRmax(1.e10), + fTrZmax(1.e10), + fGenerator(0), + fInitDone(kFALSE), + fLego(0), + fPDGDB(0), //Particle factory object + fHitLists(0), + fEventEnergy(0), + fSummEnergy(0), + fSum2Energy(0), + fConfigFunction("\0"), + fRandom(0), + fMCQA(0), + fTransParName("\0"), + fBaseFileName("\0"), + fStack(0), + fTreeDFileName(""), + fTreeDFile(0), + fTreeSFileName(""), + fTreeSFile(0), + fTreeRFileName(""), + fTreeRFile(0) { // // Default constructor for AliRun // - fHeader = 0; - fRun = 0; - fEvent = 0; - fEventNrInRun = 0; - fStack = 0; - fModules = 0; - fGenerator = 0; - fTreeD = 0; - fTreeH = 0; - fTreeTR = 0; - fTreeE = 0; - fTreeR = 0; - fTreeS = 0; - fGeometry = 0; - fDisplay = 0; - fField = 0; - fMC = 0; - fNdets = 0; - fImedia = 0; - fTrRmax = 1.e10; - fTrZmax = 1.e10; - fInitDone = kFALSE; - fLego = 0; - fPDGDB = 0; //Particle factory object! - fHitLists = 0; - fConfigFunction = "\0"; - fRandom = 0; - fMCQA = 0; - fTransParName = "\0"; - fBaseFileName = ".\0"; - fDebug = 0; - fTreeDFile = 0; - fTreeSFileName = ""; - fTreeSFile = 0; - fTreeSFileName = ""; - fTreeRFile = 0; - fTreeRFileName = ""; +} + +//_______________________________________________________________________ +AliRun::AliRun(const AliRun& arun): + TVirtualMCApplication(arun), + fRun(0), + fEvent(0), + fEventNrInRun(0), + fEventsPerRun(0), + fDebug(0), + fHeader(0), + fTreeD(0), + fTreeS(0), + fTreeH(0), + fTreeTR(0), + fTreeE(0), + fTreeR(0), + fModules(0), + fGeometry(0), + fDisplay(0), + fTimer(), + fField(0), + fMC(0), + fImedia(0), + fNdets(0), + fTrRmax(1.e10), + fTrZmax(1.e10), + fGenerator(0), + fInitDone(kFALSE), + fLego(0), + fPDGDB(0), //Particle factory object + fHitLists(0), + fEventEnergy(0), + fSummEnergy(0), + fSum2Energy(0), + fConfigFunction("\0"), + fRandom(0), + fMCQA(0), + fTransParName("\0"), + fBaseFileName("\0"), + fStack(0), + fTreeDFileName(""), + fTreeDFile(0), + fTreeSFileName(""), + fTreeSFile(0), + fTreeRFileName(""), + fTreeRFile(0) +{ + // + // Copy constructor for AliRun + // + arun.Copy(*this); } //_____________________________________________________________________________ -AliRun::AliRun(const char *name, const char *title) - : TVirtualMCApplication(name,title) +AliRun::AliRun(const char *name, const char *title): + TVirtualMCApplication(name,title), + fRun(0), + fEvent(0), + fEventNrInRun(0), + fEventsPerRun(0), + fDebug(0), + fHeader(new AliHeader()), + fTreeD(0), + fTreeS(0), + fTreeH(0), + fTreeTR(0), + fTreeE(0), + fTreeR(0), + fModules(new TObjArray(77)), // Support list for the Detectors + fGeometry(0), + fDisplay(0), + fTimer(), + fField(0), + fMC(gMC), + fImedia(new TArrayI(1000)), + fNdets(0), + fTrRmax(1.e10), + fTrZmax(1.e10), + fGenerator(0), + fInitDone(kFALSE), + fLego(0), + fPDGDB(TDatabasePDG::Instance()), //Particle factory object! + fHitLists(new TList()), // Create HitLists list + fEventEnergy(0), + fSummEnergy(0), + fSum2Energy(0), + fConfigFunction("Config();"), + fRandom(new TRandom3()), + fMCQA(0), + fTransParName("\0"), + fBaseFileName("\0"), + fStack(new AliStack(10000)), //Particle stack + fTreeDFileName(""), + fTreeDFile(0), + fTreeSFileName(""), + fTreeSFile(0), + fTreeRFileName(""), + fTreeRFile(0) { // // Constructor for the main processor. @@ -357,79 +458,37 @@ AliRun::AliRun(const char *name, const char *title) // Creates the list of Detectors. // Creates the list of particles. // - Int_t i; - + gAlice = this; - fTreeD = 0; - fTreeH = 0; - fTreeTR = 0; - fTreeE = 0; - fTreeR = 0; - fTreeS = 0; - fTrRmax = 1.e10; - fTrZmax = 1.e10; - fGenerator = 0; - fInitDone = kFALSE; - fLego = 0; - fField = 0; - fConfigFunction = "Config();"; - fTreeDFile = 0; - fTreeSFileName = ""; - fTreeSFile = 0; - fTreeSFileName = ""; - fTreeRFile = 0; - fTreeRFileName = ""; // Set random number generator - gRandom = fRandom = new TRandom3(); + gRandom = fRandom; if (gSystem->Getenv("CONFIG_SEED")) { - gRandom->SetSeed((UInt_t)atoi(gSystem->Getenv("CONFIG_SEED"))); + gRandom->SetSeed(static_cast(atoi(gSystem->Getenv("CONFIG_SEED")))); } - + + // Add to list of browsable gROOT->GetListOfBrowsables()->Add(this,name); - // - // Particle stack - fStack = new AliStack(10000); - // create the support list for the various Detectors - fModules = new TObjArray(77); - // + // Create the TNode geometry for the event display - BuildSimpleGeometry(); - fHeader = new AliHeader(); - fRun = 0; - fEvent = 0; - fEventNrInRun = 0; - // - fDisplay = 0; - // // Create default mag field SetField(); - // - fMC = gMC; - // + // Prepare the tracking medium lists - fImedia = new TArrayI(1000); - for(i=0;i<1000;i++) (*fImedia)[i]=-99; - // - // Make particles - fPDGDB = TDatabasePDG::Instance(); //Particle factory object! + for(Int_t i=0;i<1000;i++) (*fImedia)[i]=-99; + // Add particle list to configuration AliConfig::Instance()->Add(fPDGDB); - // - // Create HitLists list - fHitLists = new TList(); - // + + // Set transport parameters SetTransPar(); - fBaseFileName = ".\0"; - // - fDebug = 0; } -//_____________________________________________________________________________ +//_______________________________________________________________________ AliRun::~AliRun() { // @@ -485,27 +544,33 @@ AliRun::~AliRun() gAlice=0; } -//_____________________________________________________________________________ +//_______________________________________________________________________ +void AliRun::Copy(AliRun &) const +{ + Fatal("Copy","Not implemented!\n"); +} + +//_______________________________________________________________________ void AliRun::AddHit(Int_t id, Int_t track, Int_t *vol, Float_t *hits) const { // // Add a hit to detector id // TObjArray &dets = *fModules; - if(dets[id]) ((AliModule*) dets[id])->AddHit(track,vol,hits); + if(dets[id]) dynamic_cast(dets[id])->AddHit(track,vol,hits); } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::AddDigit(Int_t id, Int_t *tracks, Int_t *digits) const { // // Add digit to detector id // TObjArray &dets = *fModules; - if(dets[id]) ((AliModule*) dets[id])->AddDigit(tracks,digits); + if(dets[id]) dynamic_cast(dets[id])->AddDigit(tracks,digits); } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::Browse(TBrowser *b) { // @@ -526,13 +591,13 @@ void AliRun::Browse(TBrowser *b) TIter next(fModules); AliModule *detector; - while((detector = (AliModule*)next())) { + while((detector = dynamic_cast(next()))) { b->Add(detector,detector->GetName()); } b->Add(fMCQA,"AliMCQA"); } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::Build() { // @@ -541,7 +606,7 @@ void AliRun::Build() // } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::BuildSimpleGeometry() { // @@ -556,7 +621,7 @@ void AliRun::BuildSimpleGeometry() new TNode("alice","alice","S_alice"); } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::CleanDetectors() { // @@ -564,12 +629,12 @@ void AliRun::CleanDetectors() // TIter next(fModules); AliModule *detector; - while((detector = (AliModule*)next())) { + while((detector = dynamic_cast(next()))) { detector->FinishEvent(); } } -//_____________________________________________________________________________ +//_______________________________________________________________________ Int_t AliRun::DistancetoPrimitive(Int_t, Int_t) { // @@ -579,7 +644,7 @@ Int_t AliRun::DistancetoPrimitive(Int_t, Int_t) return 9999; } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::DumpPart (Int_t i) const { // @@ -588,7 +653,7 @@ void AliRun::DumpPart (Int_t i) const fStack->DumpPart(i); } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::DumpPStack () const { // @@ -597,7 +662,7 @@ void AliRun::DumpPStack () const fStack->DumpPStack(); } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::SetField(AliMagF* magField) { // Set Magnetic Field Map @@ -605,7 +670,7 @@ void AliRun::SetField(AliMagF* magField) fField->ReadField(); } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::SetField(Int_t type, Int_t version, Float_t scale, Float_t maxField, char* filename) { @@ -632,7 +697,7 @@ void AliRun::SetField(Int_t type, Int_t version, Float_t scale, } } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::FinishRun() { // @@ -645,7 +710,7 @@ void AliRun::FinishRun() // Clean detector information TIter next(fModules); AliModule *detector; - while((detector = (AliModule*)next())) { + while((detector = dynamic_cast(next()))) { detector->FinishRun(); } @@ -689,7 +754,7 @@ void AliRun::FinishRun() file->Write(); } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::FlagTrack(Int_t track) { // Delegate to stack @@ -697,7 +762,7 @@ void AliRun::FlagTrack(Int_t track) fStack->FlagTrack(track); } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::EnergySummary() { // @@ -726,7 +791,7 @@ void AliRun::EnergySummary() } else ed2=99; fSummEnergy[ndep]=ed; - fSum2Energy[ndep]=TMath::Min((Float_t) 99.,TMath::Max(ed2,kzero)); + fSum2Energy[ndep]=TMath::Min(static_cast(99.),TMath::Max(ed2,kzero)); edtot+=ed; ndep++; } @@ -763,25 +828,25 @@ void AliRun::EnergySummary() // fSum2Energy.Set(0); } -//_____________________________________________________________________________ +//_______________________________________________________________________ AliModule *AliRun::GetModule(const char *name) const { // // Return pointer to detector from name // - return (AliModule*)fModules->FindObject(name); + return dynamic_cast(fModules->FindObject(name)); } -//_____________________________________________________________________________ +//_______________________________________________________________________ AliDetector *AliRun::GetDetector(const char *name) const { // // Return pointer to detector from name // - return (AliDetector*)fModules->FindObject(name); + return dynamic_cast(fModules->FindObject(name)); } -//_____________________________________________________________________________ +//_______________________________________________________________________ Int_t AliRun::GetModuleID(const char *name) const { // @@ -793,7 +858,7 @@ Int_t AliRun::GetModuleID(const char *name) const return i; } -//_____________________________________________________________________________ +//_______________________________________________________________________ Int_t AliRun::GetEvent(Int_t event) { // @@ -848,20 +913,20 @@ Int_t AliRun::GetEvent(Int_t event) // Get Hits Tree header from file sprintf(treeName,"TreeH%d",event); - fTreeH = (TTree*)gDirectory->Get(treeName); + fTreeH = dynamic_cast(gDirectory->Get(treeName)); if (!fTreeH) { Warning("GetEvent","cannot find Hits Tree for event:%d\n",event); } // Get TracReferences Tree header from file sprintf(treeName,"TreeTR%d",event); - fTreeTR = (TTree*)gDirectory->Get(treeName); + fTreeTR = dynamic_cast(gDirectory->Get(treeName)); if (!fTreeTR) { Warning("GetEvent","cannot find TrackReferences Tree for event:%d\n",event); } // get current file name and compare with names containing trees S,D,R - TString curfilname=(TString)fTreeE->GetCurrentFile()->GetName(); + TString curfilname=static_cast(fTreeE->GetCurrentFile()->GetName()); if(fTreeDFileName==curfilname)fTreeDFileName=""; if(fTreeSFileName==curfilname)fTreeSFileName=""; if(fTreeRFileName==curfilname)fTreeRFileName=""; @@ -873,9 +938,9 @@ Int_t AliRun::GetEvent(Int_t event) InitTreeFile("D",fTreeDFileName); } if (fTreeDFile) { - fTreeD = (TTree*)fTreeDFile->Get(treeName); + fTreeD = dynamic_cast(fTreeDFile->Get(treeName)); } else { - fTreeD = (TTree*)file->Get(treeName); + fTreeD = dynamic_cast(file->Get(treeName)); } if (!fTreeD) { // Warning("GetEvent","cannot find Digits Tree for event:%d\n",event); @@ -899,9 +964,9 @@ Int_t AliRun::GetEvent(Int_t event) InitTreeFile("S",fTreeSFileName); } if (fTreeSFile) { - fTreeS = (TTree*)fTreeSFile->Get(treeName); + fTreeS = dynamic_cast(fTreeSFile->Get(treeName)); } else { - fTreeS = (TTree*)gDirectory->Get(treeName); + fTreeS = dynamic_cast(gDirectory->Get(treeName)); } if (!fTreeS) { // Warning("GetEvent","cannot find SDigits Tree for event:%d\n",event); @@ -922,9 +987,9 @@ Int_t AliRun::GetEvent(Int_t event) InitTreeFile("R",fTreeRFileName); } if(fTreeRFile) { - fTreeR = (TTree*)fTreeRFile->Get(treeName); + fTreeR = dynamic_cast(fTreeRFile->Get(treeName)); } else { - fTreeR = (TTree*)gDirectory->Get(treeName); + fTreeR = dynamic_cast(gDirectory->Get(treeName)); } if (!fTreeR) { // printf("WARNING: cannot find Reconstructed Tree for event:%d\n",event); @@ -935,7 +1000,7 @@ Int_t AliRun::GetEvent(Int_t event) // Set Trees branch addresses TIter next(fModules); AliModule *detector; - while((detector = (AliModule*)next())) { + while((detector = dynamic_cast(next()))) { detector->SetTreeAddress(); } @@ -944,14 +1009,14 @@ Int_t AliRun::GetEvent(Int_t event) return fHeader->GetNtrack(); } -//_____________________________________________________________________________ +//_______________________________________________________________________ TGeometry *AliRun::GetGeometry() { // // Import Alice geometry from current file // Return pointer to geometry object // - if (!fGeometry) fGeometry = (TGeometry*)gDirectory->Get("AliceGeom"); + if (!fGeometry) fGeometry = dynamic_cast(gDirectory->Get("AliceGeom")); // // Unlink and relink nodes in detectors // This is bad and there must be a better way... @@ -959,12 +1024,12 @@ TGeometry *AliRun::GetGeometry() TIter next(fModules); AliModule *detector; - while((detector = (AliModule*)next())) { + while((detector = dynamic_cast(next()))) { TList *dnodes=detector->Nodes(); Int_t j; TNode *node, *node1; for ( j=0; jGetSize(); j++) { - node = (TNode*) dnodes->At(j); + node = dynamic_cast(dnodes->At(j)); node1 = fGeometry->GetNode(node->GetName()); dnodes->Remove(node); dnodes->AddAt(node1,j); @@ -973,7 +1038,7 @@ TGeometry *AliRun::GetGeometry() return fGeometry; } -//_____________________________________________________________________________ +//_______________________________________________________________________ Int_t AliRun::GetPrimary(Int_t track) const { // @@ -982,7 +1047,7 @@ Int_t AliRun::GetPrimary(Int_t track) const return fStack->GetPrimary(track); } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::MediaTable() { // @@ -997,7 +1062,7 @@ void AliRun::MediaTable() // For all detectors for (kz=0;kz(dets[kz]))) { TArrayI &idtmed = *(det->GetIdtmed()); for(nz=0;nz<100;nz++) { // Find max and min material number @@ -1028,7 +1093,7 @@ void AliRun::MediaTable() for(i=0;i<(fNdets-1)/6+1;i++) { for(k=0;k< (6(dets[ind]); if(det) printf(" %6s: %3d -> %3d;",det->GetName(),det->LoMedium(), det->HiMedium()); @@ -1039,7 +1104,7 @@ void AliRun::MediaTable() } } -//____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::SetGenerator(AliGenerator *generator) { // @@ -1048,7 +1113,7 @@ void AliRun::SetGenerator(AliGenerator *generator) if(!fGenerator) fGenerator = generator; } -//____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::ResetGenerator(AliGenerator *generator) { // @@ -1064,19 +1129,19 @@ void AliRun::ResetGenerator(AliGenerator *generator) fGenerator = generator; } -//____________________________________________________________________________ -void AliRun::SetTransPar(char *filename) +//_______________________________________________________________________ +void AliRun::SetTransPar(const char *filename) { fTransParName = filename; } -//____________________________________________________________________________ -void AliRun::SetBaseFile(char *filename) +//_______________________________________________________________________ +void AliRun::SetBaseFile(const char *filename) { fBaseFileName = filename; } -//____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::ReadTransPar() { // @@ -1187,7 +1252,7 @@ void AliRun::ReadTransPar() } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::MakeTree(Option_t *option, const char *file) { // @@ -1218,7 +1283,7 @@ void AliRun::MakeTree(Option_t *option, const char *file) // branch = fTreeE->Branch("Header", "AliHeader", &fHeader, 4000, 0); branch = fTreeE->Branch("Header", "AliHeader", &fHeader, 4000, 0); branch->SetAutoDelete(kFALSE); - TFolder *folder = (TFolder *)gROOT->FindObjectAny("/Folders/RunMC/Event/Header"); + TFolder *folder = dynamic_cast(gROOT->FindObjectAny("/Folders/RunMC/Event/Header")); if (folder) folder->Add(fHeader); // branch = fTreeE->Branch("Stack","AliStack", &fStack, 4000, 0); // branch->SetAutoDelete(kFALSE); @@ -1231,7 +1296,7 @@ void AliRun::MakeTree(Option_t *option, const char *file) sprintf(outFile,"%s/%s",GetBaseFile(),file); branch->SetFile(outFile); TIter next( branch->GetListOfBranches()); - while ((branch=(TBranch*)next())) { + while ((branch=dynamic_cast(next()))) { branch->SetFile(outFile); } if (GetDebug()>1) @@ -1276,19 +1341,19 @@ void AliRun::MakeTree(Option_t *option, const char *file) // will be in turn a subbranch of the detector master branch TIter next(fModules); AliModule *detector; - while((detector = (AliModule*)next())) { + while((detector = dynamic_cast(next()))) { if (oH) detector->MakeBranch(option,file); if (oTR) detector->MakeBranchTR(option,file); } } -//_____________________________________________________________________________ +//_______________________________________________________________________ TParticle* AliRun::Particle(Int_t i) { return fStack->Particle(i); } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::ResetDigits() { // @@ -1296,12 +1361,12 @@ void AliRun::ResetDigits() // TIter next(fModules); AliModule *detector; - while((detector = (AliModule*)next())) { + while((detector = dynamic_cast(next()))) { detector->ResetDigits(); } } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::ResetSDigits() { // @@ -1309,12 +1374,12 @@ void AliRun::ResetSDigits() // TIter next(fModules); AliModule *detector; - while((detector = (AliModule*)next())) { + while((detector = dynamic_cast(next()))) { detector->ResetSDigits(); } } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::ResetHits() { // @@ -1322,12 +1387,12 @@ void AliRun::ResetHits() // TIter next(fModules); AliModule *detector; - while((detector = (AliModule*)next())) { + while((detector = dynamic_cast(next()))) { detector->ResetHits(); } } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::ResetTrackReferences() { // @@ -1335,12 +1400,12 @@ void AliRun::ResetTrackReferences() // TIter next(fModules); AliModule *detector; - while((detector = (AliModule*)next())) { + while((detector = dynamic_cast(next()))) { detector->ResetTrackReferences(); } } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::ResetPoints() { // @@ -1348,12 +1413,12 @@ void AliRun::ResetPoints() // TIter next(fModules); AliModule *detector; - while((detector = (AliModule*)next())) { + while((detector = dynamic_cast(next()))) { detector->ResetPoints(); } } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::InitMC(const char *setup) { // @@ -1388,7 +1453,7 @@ void AliRun::InitMC(const char *setup) TIter next(fModules); AliModule *detector; - while((detector = (AliModule*)next())) { + while((detector = dynamic_cast(next()))) { detector->SetTreeAddress(); objlast = gDirectory->GetList()->Last(); @@ -1425,7 +1490,7 @@ void AliRun::InitMC(const char *setup) Write(); } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::RunMC(Int_t nevent, const char *setup) { // @@ -1456,7 +1521,7 @@ void AliRun::RunMC(Int_t nevent, const char *setup) if(nevent>0) FinishRun(); } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::RunReco(const char *selected, Int_t first, Int_t last) { // @@ -1464,7 +1529,7 @@ void AliRun::RunReco(const char *selected, Int_t first, Int_t last) // cout << "Found "<< gAlice->TreeE()->GetEntries() << "events" << endl; Int_t nFirst = first; - Int_t nLast = (last < 0)? (Int_t) gAlice->TreeE()->GetEntries() : last; + Int_t nLast = (last < 0)? static_cast(gAlice->TreeE()->GetEntries()) : last; for (Int_t nevent = nFirst; nevent <= nLast; nevent++) { cout << "Processing event "<< nevent << endl; @@ -1474,7 +1539,7 @@ void AliRun::RunReco(const char *selected, Int_t first, Int_t last) } } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::Hits2Digits(const char *selected) { @@ -1490,7 +1555,7 @@ void AliRun::Hits2Digits(const char *selected) } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::Tree2Tree(Option_t *option, const char *selected) { @@ -1520,7 +1585,7 @@ void AliRun::Tree2Tree(Option_t *option, const char *selected) char outFile[32]; - while((detector = (AliDetector*)next())) { + while((detector = dynamic_cast(next()))) { if (selected) if (strcmp(detector->GetName(),selected)) continue; if (detector->IsActive()){ @@ -1562,7 +1627,7 @@ void AliRun::Tree2Tree(Option_t *option, const char *selected) } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::RunLego(const char *setup, Int_t nc1, Float_t c1min, Float_t c1max,Int_t nc2,Float_t c2min,Float_t c2max, Float_t rmin,Float_t rmax,Float_t zmax, AliLegoGenerator* gener) @@ -1643,7 +1708,7 @@ void AliRun::RunLego(const char *setup, Int_t nc1, Float_t c1min, delete fLego; fLego=0; } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::SetConfigFunction(const char * config) { // @@ -1653,7 +1718,7 @@ void AliRun::SetConfigFunction(const char * config) fConfigFunction=config; } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::SetCurrentTrack(Int_t track) { // @@ -1662,7 +1727,7 @@ void AliRun::SetCurrentTrack(Int_t track) fStack->SetCurrentTrack(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, AliMCProcess mech, Int_t &ntr, Float_t weight, Int_t is) @@ -1674,7 +1739,7 @@ void AliRun::SetTrack(Int_t done, Int_t parent, Int_t pdg, Float_t *pmom, mech, ntr, weight, is); } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::SetTrack(Int_t done, Int_t parent, Int_t pdg, Double_t px, Double_t py, Double_t pz, Double_t e, Double_t vx, Double_t vy, Double_t vz, Double_t tof, @@ -1688,7 +1753,7 @@ void AliRun::SetTrack(Int_t done, Int_t parent, Int_t pdg, } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::SetHighWaterMark(const Int_t nt) { // @@ -1696,7 +1761,7 @@ void AliRun::SetHighWaterMark(const Int_t nt) fStack->SetHighWaterMark(nt); } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::KeepTrack(const Int_t track) { // @@ -1709,7 +1774,7 @@ void AliRun::KeepTrack(const Int_t track) // MC Application // -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::ConstructGeometry() { // @@ -1720,7 +1785,7 @@ void AliRun::ConstructGeometry() TIter next(fModules); AliModule *detector; printf("Geometry creation:\n"); - while((detector = (AliModule*)next())) { + while((detector = dynamic_cast(next()))) { stw.Start(); // Initialise detector materials and geometry detector->CreateMaterials(); @@ -1730,7 +1795,7 @@ void AliRun::ConstructGeometry() } } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::InitGeometry() { // @@ -1741,7 +1806,7 @@ void AliRun::InitGeometry() TStopwatch stw; TIter next(fModules); AliModule *detector; - while((detector = (AliModule*)next())) { + while((detector = dynamic_cast(next()))) { stw.Start(); // Initialise detector and display geometry detector->Init(); @@ -1752,7 +1817,7 @@ void AliRun::InitGeometry() } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::GeneratePrimaries() { // @@ -1762,7 +1827,7 @@ void AliRun::GeneratePrimaries() Generator()->Generate(); } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::BeginEvent() { // Clean-up previous event @@ -1830,7 +1895,7 @@ void AliRun::BeginEvent() } } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::BeginPrimary() { // @@ -1843,20 +1908,20 @@ void AliRun::BeginPrimary() } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::PreTrack() { TObjArray &dets = *fModules; AliModule *module; for(Int_t i=0; i<=fNdets; i++) - if((module = (AliModule*)dets[i])) + if((module = dynamic_cast(dets[i]))) module->PreTrack(); fMCQA->PreTrack(); } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::Stepping() { // @@ -1876,7 +1941,7 @@ void AliRun::Stepping() AddEnergyDeposit(gMC->CurrentVolID(copy),gMC->Edep()); //Call the appropriate stepping routine; - AliModule *det = (AliModule*)fModules->At(id); + AliModule *det = dynamic_cast(fModules->At(id)); if(det && det->StepManagerIsEnabled()) { fMCQA->StepManager(id); det->StepManager(); @@ -1884,18 +1949,18 @@ void AliRun::Stepping() } } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::PostTrack() { TObjArray &dets = *fModules; AliModule *module; for(Int_t i=0; i<=fNdets; i++) - if((module = (AliModule*)dets[i])) + if((module = dynamic_cast(dets[i]))) module->PostTrack(); } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::FinishPrimary() { // @@ -1909,7 +1974,7 @@ void AliRun::FinishPrimary() TIter next(fModules); AliModule *detector; - while((detector = (AliModule*)next())) { + while((detector = dynamic_cast(next()))) { detector->FinishPrimary(); } @@ -1927,7 +1992,7 @@ void AliRun::FinishPrimary() // if(++count%times==1) gObjectTable->Print(); } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::FinishEvent() { // @@ -1972,7 +2037,7 @@ void AliRun::FinishEvent() ++fEventNrInRun; } -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::Field(const Double_t* x, Double_t *b) const { Float_t xfloat[3]; @@ -1994,7 +2059,7 @@ void AliRun::Field(const Double_t* x, Double_t *b) const // End of MC Application // -//_____________________________________________________________________________ +//_______________________________________________________________________ void AliRun::Streamer(TBuffer &R__b) { // Stream an object of class AliRun. @@ -2006,7 +2071,7 @@ void AliRun::Streamer(TBuffer &R__b) // gROOT->GetListOfBrowsables()->Add(this,"Run"); - fTreeE = (TTree*)gDirectory->Get("TE"); + fTreeE = dynamic_cast(gDirectory->Get("TE")); if (fTreeE) { fTreeE->SetBranchAddress("Header", &fHeader); } @@ -2020,7 +2085,7 @@ void AliRun::Streamer(TBuffer &R__b) } -//___________________________________________________________________________ +//_______________________________________________________________________ Int_t AliRun::CurrentTrack() const { // // Returns current track @@ -2028,7 +2093,7 @@ Int_t AliRun::CurrentTrack() const { return fStack->CurrentTrack(); } -//___________________________________________________________________________ +//_______________________________________________________________________ Int_t AliRun::GetNtrack() const { // // Returns number of tracks in stack @@ -2036,7 +2101,7 @@ Int_t AliRun::GetNtrack() const { return fStack->GetNtrack(); } -//___________________________________________________________________________ +//_______________________________________________________________________ TObjArray* AliRun::Particles() { // // Returns pointer to Particles array @@ -2044,7 +2109,7 @@ TObjArray* AliRun::Particles() { return fStack->Particles(); } -//___________________________________________________________________________ +//_______________________________________________________________________ TTree* AliRun::TreeK() { // // Returns pointer to the TreeK array @@ -2053,13 +2118,13 @@ TTree* AliRun::TreeK() { } -//___________________________________________________________________________ +//_______________________________________________________________________ void AliRun::SetGenEventHeader(AliGenEventHeader* header) { fHeader->SetGenEventHeader(header); } -//___________________________________________________________________________ +//_______________________________________________________________________ TFile* AliRun::InitFile(TString fileName) { // @@ -2075,7 +2140,7 @@ TFile* AliRun::InitFile(TString fileName) return file; } -//___________________________________________________________________________ +//_______________________________________________________________________ TFile* AliRun::InitTreeFile(Option_t *option, TString fileName) { // @@ -2198,7 +2263,7 @@ TFile* AliRun::InitTreeFile(Option_t *option, TString fileName) return 0; } -//___________________________________________________________________________ +//_______________________________________________________________________ void AliRun::PrintTreeFile() { // @@ -2207,7 +2272,7 @@ void AliRun::PrintTreeFile() cout<<"===================================================\n"; TFile *file = fTreeE->GetCurrentFile(); TString curfilname=""; - if(file)curfilname=(TString)file->GetName(); + if(file)curfilname=static_cast(file->GetName()); cout<<" Current tree file name: "< -#include "TClonesArray.h" +#include #include +#include #include #include +class TBranch; +class TBrowser; +class TDatabasePDG; +class TFile; +class TGeometry; +class TList; +class TParticle; +class TRandom; +class TTree; #include "AliMC.h" +#include "AliMCProcess.h" class AliDetector; -class AliModule; -class AliMagF; -//class AliMC; -class AliLego; class AliDisplay; -class AliLegoGenerator; -class AliHeader; +class AliGenEventHeader; class AliGenerator; +class AliHeader; +class AliLego; +class AliLegoGenerator; class AliLegoGenerator; -#include "AliMCProcess.h" class AliMCQA; +class AliMagF; +class AliModule; class AliStack; -class AliGenEventHeader; enum {kKeepBit=1, kDaughtersBit=2, kDoneBit=4}; @@ -45,8 +44,11 @@ public: // Creators - distructors AliRun(); AliRun(const char *name, const char *title); + AliRun(const AliRun &arun); virtual ~AliRun(); + AliRun& operator = (const AliRun &arun) + {arun.Copy(*this); return (*this);} virtual void AddHit(Int_t id, Int_t track, Int_t *vol, Float_t *hits) const; virtual void AddDigit(Int_t id, Int_t *tracks, Int_t *digits) const; virtual void AddHitList(TCollection *hitList) {fHitLists->Add(hitList);} @@ -108,8 +110,8 @@ public: virtual void ResetHits(); virtual void ResetTrackReferences(); virtual void ResetPoints(); - virtual void SetTransPar(char *filename="$(ALICE_ROOT)/data/galice.cuts"); - virtual void SetBaseFile(char *filename="galice.root"); + virtual void SetTransPar(const char *filename="$(ALICE_ROOT)/data/galice.cuts"); + virtual void SetBaseFile(const char *filename="galice.root"); virtual void ReadTransPar(); virtual void RunMC(Int_t nevent=1, const char *setup="Config.C"); virtual void Run(Int_t nevent=1, const char *setup="Config.C") @@ -236,11 +238,9 @@ protected: TFile* fTreeRFile; //! file with TreeR private: + void Copy(AliRun &arun) const; - AliRun(const AliRun &right) - {} - AliRun& operator = (const AliRun &) {return *this;} - ClassDef(AliRun,7) //Supervisor class for all Alice detectors + ClassDef(AliRun,7) //Supervisor class for all Alice detectors }; R__EXTERN AliRun *gAlice; diff --git a/STEER/AliRunDigitizer.cxx b/STEER/AliRunDigitizer.cxx index 2b28e3406be..4bc41fc50af 100644 --- a/STEER/AliRunDigitizer.cxx +++ b/STEER/AliRunDigitizer.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.21 2002/10/22 15:02:15 alibrary +Introducing Riostream.h + Revision 1.20 2002/10/14 14:57:32 hristov Merging the VirtualMC branch to the main development branch (HEAD) @@ -154,90 +157,145 @@ Manager class for merging/digitization // ROOT includes #include "TFile.h" -#include "TTree.h" #include "TList.h" +#include "TParticle.h" +#include "TTree.h" // AliROOT includes -#include "AliRunDigitizer.h" #include "AliDigitizer.h" -#include "AliRun.h" #include "AliHeader.h" -#include "TParticle.h" -#include "AliStream.h" #include "AliMergeCombi.h" +#include "AliRun.h" +#include "AliRunDigitizer.h" +#include "AliStream.h" ClassImp(AliRunDigitizer) -//////////////////////////////////////////////////////////////////////// -AliRunDigitizer::AliRunDigitizer() +//_______________________________________________________________________ +AliRunDigitizer::AliRunDigitizer(): + fkMASKSTEP(0), + fOutputFileName(0), + fOutputDirName(0), + fOutput(0), + fEvent(0), + fNrOfEventsToWrite(0), + fNrOfEventsWritten(0), + fCopyTreesFromInput(0), + fTreeD(0), + fTreeDTPC(0), + fTreeDTRD(0), + fTreeR(0), + fNinputs(0), + fNinputsGiven(0), + fInputStreams(0), + fTreeDTPCBaseName(0), + fTreeTPCSBaseName(0), + fCombi(0), + fCombination(0), + fCombinationFileName(0), + fDebug(0) { -// root requires default ctor, where no new objects can be created -// do not use this ctor, it is supplied only for root needs - -// just set all pointers - data members to 0 - fOutput = 0; - fTreeD = 0; - fTreeR = 0; - fTreeDTPC = 0; - fTreeDTRD = 0; - fInputStreams = 0; + // + // default ctor, where no new objects can be created + // do not use this ctor, it is supplied only for root needs + // for (Int_t i=0;iClear("nodelete"); - if (fInputStreams) { delete fInputStreams; - fInputStreams = 0; - } - if (fCombi) { delete fCombi; - fCombi = 0; - } - } -//////////////////////////////////////////////////////////////////////// + +//_______________________________________________________________________ void AliRunDigitizer::AddDigitizer(AliDigitizer *digitizer) { // add digitizer to the list of active digitizers this->Add(digitizer); } -//////////////////////////////////////////////////////////////////////// + +//_______________________________________________________________________ void AliRunDigitizer::SetInputStream(Int_t i, const char *inputFile) { if (i > fInputStreams->GetLast()) { @@ -271,7 +324,7 @@ void AliRunDigitizer::SetInputStream(Int_t i, const char *inputFile) static_cast(fInputStreams->At(i))->AddFile(inputFile); } -//////////////////////////////////////////////////////////////////////// +//_______________________________________________________________________ void AliRunDigitizer::Digitize(Option_t* option) { // get a new combination of inputs, connect input trees and loop @@ -304,7 +357,7 @@ void AliRunDigitizer::Digitize(Option_t* option) FinishGlobal(); } -//////////////////////////////////////////////////////////////////////// +//_______________________________________________________________________ Bool_t AliRunDigitizer::ConnectInputTrees() { // fill arrays fArrayTreeS, fArrayTreeH and fArrayTreeTPCS with @@ -357,20 +410,19 @@ Bool_t AliRunDigitizer::ConnectInputTrees() return kTRUE; } -//////////////////////////////////////////////////////////////////////// +//_______________________________________________________________________ Bool_t AliRunDigitizer::InitGlobal() { // called once before Digitize() is called, initialize digitizers and output - TList* subTasks = this->GetListOfTasks(); + TList* subTasks = GetListOfTasks(); if (subTasks) { subTasks->ForEach(AliDigitizer,Init)(); } return kTRUE; } -//////////////////////////////////////////////////////////////////////// - +//_______________________________________________________________________ void AliRunDigitizer::SetOutputFile(TString fn) // the output will be to separate file, not to the signal file { @@ -379,7 +431,7 @@ void AliRunDigitizer::SetOutputFile(TString fn) InitOutputGlobal(); } -//////////////////////////////////////////////////////////////////////// +//_______________________________________________________________________ Bool_t AliRunDigitizer::InitOutputGlobal() { // Creates the output file, called by InitEvent() @@ -396,7 +448,7 @@ Bool_t AliRunDigitizer::InitOutputGlobal() } -//////////////////////////////////////////////////////////////////////// +//_______________________________________________________________________ void AliRunDigitizer::InitEvent() { // Creates TreeDxx in the output file, called from Digitize() once for @@ -444,7 +496,7 @@ void AliRunDigitizer::InitEvent() } -//////////////////////////////////////////////////////////////////////// +//_______________________________________________________________________ void AliRunDigitizer::FinishEvent() { // called at the end of loop over digitizers @@ -478,7 +530,8 @@ void AliRunDigitizer::FinishEvent() fTreeDTRD = 0; } } -//////////////////////////////////////////////////////////////////////// + +//_______________________________________________________________________ void AliRunDigitizer::FinishGlobal() { // called at the end of Exec @@ -494,7 +547,7 @@ void AliRunDigitizer::FinishGlobal() } -//////////////////////////////////////////////////////////////////////// +//_______________________________________________________________________ Int_t AliRunDigitizer::GetNParticles(Int_t event) const { // return number of particles in all input files for a given @@ -511,8 +564,8 @@ Int_t AliRunDigitizer::GetNParticles(Int_t event) const return sum; } -//////////////////////////////////////////////////////////////////////// -Int_t AliRunDigitizer::GetNParticles(Int_t event, Int_t input) const +//_______________________________________________________________________ +Int_t AliRunDigitizer::GetNParticles(Int_t /* event */, Int_t /* input */) const { // return number of particles in input file input for a given // event (as numbered in this input file) @@ -550,7 +603,7 @@ Int_t AliRunDigitizer::GetNParticles(Int_t event, Int_t input) const */ } -//////////////////////////////////////////////////////////////////////// +//_______________________________________________________________________ Int_t* AliRunDigitizer::GetInputEventNumbers(Int_t event) const { // return pointer to an int array with input event numbers which were @@ -563,8 +616,9 @@ Int_t* AliRunDigitizer::GetInputEventNumbers(Int_t event) const } return a; } -//////////////////////////////////////////////////////////////////////// -Int_t AliRunDigitizer::GetInputEventNumber(Int_t event, Int_t input) const + +//_______________________________________________________________________ +Int_t AliRunDigitizer::GetInputEventNumber(Int_t event, Int_t /* input */) const { // return an event number of an eventInput from input file input // which was merged to create output event event @@ -572,7 +626,8 @@ Int_t AliRunDigitizer::GetInputEventNumber(Int_t event, Int_t input) const // simplified for now, implement later return event; } -//////////////////////////////////////////////////////////////////////// + +//_______________________________________________________________________ TParticle* AliRunDigitizer::GetParticle(Int_t i, Int_t event) const { // return pointer to particle with index i (index with mask) @@ -582,8 +637,9 @@ TParticle* AliRunDigitizer::GetParticle(Int_t i, Int_t event) const return GetParticle(i,input,GetInputEventNumber(event,input)); } -//////////////////////////////////////////////////////////////////////// -TParticle* AliRunDigitizer::GetParticle(Int_t i, Int_t input, Int_t event) const +//_______________________________________________________________________ +TParticle* AliRunDigitizer::GetParticle(Int_t /* i */, Int_t /* input */, + Int_t /* event */) const { // return pointer to particle with index i in the input file input // (index without mask) @@ -642,7 +698,7 @@ TParticle* AliRunDigitizer::GetParticle(Int_t i, Int_t input, Int_t event) const */ } -//////////////////////////////////////////////////////////////////////// +//_______________________________________________________________________ void AliRunDigitizer::ExecuteTask(Option_t* option) { // overwrite ExecuteTask to do Digitize only @@ -652,7 +708,8 @@ void AliRunDigitizer::ExecuteTask(Option_t* option) fHasExecuted = kTRUE; return; } -//////////////////////////////////////////////////////////////////////// + +//_______________________________________________________________________ TString AliRunDigitizer::GetInputFileName(const Int_t input, const Int_t order) const { // returns file name of the order-th file in the input stream input @@ -666,4 +723,3 @@ TString AliRunDigitizer::GetInputFileName(const Int_t input, const Int_t order) fileName = stream->GetFileName(order); return fileName; } -//////////////////////////////////////////////////////////////////////// diff --git a/STEER/AliRunDigitizer.h b/STEER/AliRunDigitizer.h index 95e5de5a231..e4e562c9fbe 100644 --- a/STEER/AliRunDigitizer.h +++ b/STEER/AliRunDigitizer.h @@ -14,26 +14,29 @@ //////////////////////////////////////////////////////////////////////// // --- ROOT system --- -#include "TNamed.h" -#include "TObjString.h" + #include "TArrayI.h" -#include "TClonesArray.h" -#include "TTree.h" -#include "TParticle.h" #include "TTask.h" - -const Int_t kMaxStreamsToMerge = 4; +class TClonesArray; +class TFile; +class TParticle; +class TTree; // --- AliRoot header files --- class AliDigitizer; class AliMergeCombi; +const Int_t kMaxStreamsToMerge = 4; + class AliRunDigitizer: public TTask { public: AliRunDigitizer(); AliRunDigitizer(Int_t nInputStreams, Int_t sperb=1); + AliRunDigitizer(const AliRunDigitizer& dig); + AliRunDigitizer& operator=(const AliRunDigitizer& dig) + {dig.Copy(*this); return (*this);} virtual ~AliRunDigitizer(); void AddDigitizer(AliDigitizer *digitizer); void SetOutputFile(TString fn); @@ -97,6 +100,14 @@ public: void SetDebug(Int_t level) {fDebug = level;} private: + void Copy(AliRunDigitizer& dig) const; + Bool_t ConnectInputTrees(); + Bool_t InitGlobal(); + Bool_t InitOutputGlobal(); + void InitEvent(); + void FinishEvent(); + void FinishGlobal(); + Int_t fkMASK[kMaxStreamsToMerge]; //! masks for track ids from // different source files Int_t fkMASKSTEP; // step to increase MASK for @@ -127,12 +138,6 @@ private: TArrayI fCombination; //! combination of events from TString fCombinationFileName; // fn with combinations (used // with type 2 of comb.) - Bool_t ConnectInputTrees(); - Bool_t InitGlobal(); - Bool_t InitOutputGlobal(); - void InitEvent(); - void FinishEvent(); - void FinishGlobal(); Int_t fDebug; //! specifies debug level, 0 is min ClassDef(AliRunDigitizer,4) diff --git a/STEER/AliSegmentation.h b/STEER/AliSegmentation.h index c89747c9d95..83e56f4ea0e 100644 --- a/STEER/AliSegmentation.h +++ b/STEER/AliSegmentation.h @@ -93,7 +93,7 @@ public TObject { // Test points for auto calibration virtual void GiveTestPoints(Int_t &n, Float_t *x, Float_t *y) const = 0; // Draw the segmentation zones - virtual void Draw(const char *opt = "") const = 0; + virtual void Draw(const char *opt = "") const = 0; // Function for systematic corrections // Set the correction function virtual void SetCorrFunc(Int_t, TF1*) = 0; diff --git a/STEER/AliStack.cxx b/STEER/AliStack.cxx index 3a5449b47eb..d2c1e821416 100644 --- a/STEER/AliStack.cxx +++ b/STEER/AliStack.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.25 2002/10/22 15:21:39 hristov +New methods for more effective access of particles from TreeK (J.Chudoba) + Revision 1.24 2002/10/22 15:02:15 alibrary Introducing Riostream.h @@ -108,47 +111,72 @@ New files for folders and Stack ClassImp(AliStack) -//_____________________________________________________________________________ -AliStack::AliStack(Int_t size) - : TVirtualMCStack() +//_______________________________________________________________________ +AliStack::AliStack(): + fParticles(0), + fParticleMap(0), + fParticleFileMap(0), + fParticleBuffer(0), + fTreeK(0), + fNtrack(0), + fNprimary(0), + fCurrent(-1), + fCurrentPrimary(-1), + fHgwmk(0), + fLoadPoint(0) { // - // Constructor + // Default constructor // - - // Create the particles arrays - fParticles = new TClonesArray("TParticle",1000); - fParticleMap = new TObjArray(size); - fParticleBuffer = 0; - fNtrack = 0; - fNprimary = 0; - fCurrent = -1; - fCurrentPrimary = -1; - fTreeK = 0; } +//_______________________________________________________________________ +AliStack::AliStack(Int_t size): + fParticles(new TClonesArray("TParticle",1000)), + fParticleMap(new TObjArray(size)), + fParticleFileMap(0), + fParticleBuffer(0), + fTreeK(0), + fNtrack(0), + fNprimary(0), + fCurrent(-1), + fCurrentPrimary(-1), + fHgwmk(0), + fLoadPoint(0) +{ + // + // Constructor + // +} -//_____________________________________________________________________________ -AliStack::AliStack() - : TVirtualMCStack() +//_______________________________________________________________________ +AliStack::AliStack(const AliStack& st): + TVirtualMCStack(st), + fParticles(0), + fParticleMap(0), + fParticleFileMap(0), + fParticleBuffer(0), + fTreeK(0), + fNtrack(0), + fNprimary(0), + fCurrent(-1), + fCurrentPrimary(-1), + fHgwmk(0), + fLoadPoint(0) { // - // Default constructor + // Copy constructor // - - // Create the particles arrays - fParticles = 0; - fParticleMap = 0; - fParticleBuffer = 0; - fNtrack = 0; - fCurrent = -1; - fNprimary = 0; - fCurrentPrimary = -1; - fTreeK = 0; + st.Copy(*this); } +//_______________________________________________________________________ +void AliStack::Copy(AliStack&) const +{ + Fatal("Copy","Not implemented!\n"); +} -//_____________________________________________________________________________ +//_______________________________________________________________________ AliStack::~AliStack() { // @@ -160,7 +188,7 @@ AliStack::~AliStack() delete fParticles; } delete fParticleMap; - if (fTreeK) delete fTreeK; + delete fTreeK; } // @@ -259,7 +287,7 @@ void AliStack::SetTrack(Int_t done, Int_t parent, Int_t pdg, fParticleMap->AddAtAndExpand(particle, fNtrack);//CHECK!! if(parent>=0) { - particle = (TParticle*) fParticleMap->At(parent); + particle = dynamic_cast(fParticleMap->At(parent)); if (particle) { particle->SetLastDaughter(fNtrack); if(particle->GetFirstDaughter()<0) particle->SetFirstDaughter(fNtrack); @@ -391,7 +419,7 @@ void AliStack::PurifyKine() if(i<=fHgwmk) map[i]=i ; else { map[i] = -99; - if((part=(TParticle*) particles.At(i))) { + if((part=dynamic_cast(particles.At(i)))) { // // Check of this track should be kept for physics reasons if (KeepPhysics(part)) KeepTrack(i); @@ -405,7 +433,7 @@ void AliStack::PurifyKine() // Invalid daughter information for the parent of the first particle // generated. This may or may not be the current primary according to // whether decays have been recorded among the primaries - part = (TParticle *)particles.At(fHgwmk+1); + part = dynamic_cast(particles.At(fHgwmk+1)); particles.At(part->GetFirstMother())->ResetBit(kDaughtersBit); // Second pass, build map between old and new numbering for(i=fHgwmk+1; i(particles.At(nkeep)); // as the parent is always *before*, it must be already // in place. This is what we are checking anyway! @@ -429,10 +457,10 @@ void AliStack::PurifyKine() // Fix daughters information for (i=fHgwmk+1; i(particles.At(i)); parent = part->GetFirstMother(); if(parent>=0) { - father = (TParticle *)particles.At(parent); + father = dynamic_cast(particles.At(parent)); if(father->TestBit(kDaughtersBit)) { if(iGetFirstDaughter()) father->SetFirstDaughter(i); @@ -450,10 +478,10 @@ void AliStack::PurifyKine() TList* hitLists = gAlice->GetHitLists(); TIter next(hitLists); TCollection *hitList; - while((hitList = (TCollection*)next())) { + while((hitList = dynamic_cast(next()))) { TIter nexthit(hitList); AliHit *hit; - while((hit = (AliHit*)nexthit())) { + while((hit = dynamic_cast(nexthit()))) { hit->SetTrack(map[hit->GetTrack()]); } } @@ -466,7 +494,7 @@ void AliStack::PurifyKine() TObjArray* modules = gAlice->Modules(); TIter nextmod(modules); AliModule *detector; - while((detector = (AliModule*)nextmod())) { + while((detector = dynamic_cast(nextmod()))) { detector->RemapTrackHitIDs(map.GetArray()); detector->RemapTrackReferencesIDs(map.GetArray()); } @@ -475,8 +503,8 @@ void AliStack::PurifyKine() if(nkeep>fParticleFileMap.GetSize()) fParticleFileMap.Set(Int_t (nkeep*1.5)); for (i=fHgwmk+1; iGetEntries(); + fParticleBuffer = dynamic_cast(particles.At(i)); + fParticleFileMap[i]=static_cast(fTreeK->GetEntries()); fTreeK->Fill(); particles[i]=fParticleBuffer=0; } @@ -504,7 +532,7 @@ Bool_t AliStack::KeepPhysics(TParticle* part) // Int_t parent = part->GetFirstMother(); if (parent >= 0 && parent <= fHgwmk) { - TParticle* father = (TParticle*) Particles()->At(parent); + TParticle* father = dynamic_cast(Particles()->At(parent)); Int_t kf = father->GetPdgCode(); kf = TMath::Abs(kf); Int_t kfl = kf; @@ -547,8 +575,8 @@ void AliStack::FinishEvent() TObject *part; for(Int_t i=0; iAt(i))) { - fParticleBuffer = (TParticle*) part; - fParticleFileMap[i]= (Int_t) fTreeK->GetEntries(); + fParticleBuffer = dynamic_cast(part); + fParticleFileMap[i]= static_cast(fTreeK->GetEntries()); fTreeK->Fill(); //PH (*fParticleMap)[i]=fParticleBuffer=0; fParticleBuffer=0; @@ -581,7 +609,7 @@ void AliStack::FlagTrack(Int_t track) Int_t curr=track; while(1) { - particle=(TParticle*)fParticleMap->At(curr); + particle=dynamic_cast(fParticleMap->At(curr)); // If the particle is flagged the three from here upward is saved already if(particle->TestBit(kKeepBit)) return; @@ -638,7 +666,7 @@ void AliStack::ResetArrays(Int_t size) } //_____________________________________________________________________________ -void AliStack::SetHighWaterMark(Int_t nt) +void AliStack::SetHighWaterMark(Int_t) { // // Set high water mark for last track in event @@ -677,8 +705,8 @@ TParticle* AliStack::Particle(Int_t i) new ((*fParticles)[nentries]) TParticle(*fParticleBuffer); fParticleMap->AddAt((*fParticles)[nentries],i); } - //PH return (TParticle *) (*fParticleMap)[i]; - return (TParticle *) fParticleMap->At(i); + //PH return dynamic_cast((*fParticleMap)[i]); + return dynamic_cast(fParticleMap->At(i)); } //_____________________________________________________________________________ @@ -732,8 +760,8 @@ void AliStack::DumpPart (Int_t i) const // Dumps particle i in the stack // - //PH ((TParticle*) (*fParticleMap)[i])->Print(); - ((TParticle*) fParticleMap->At(i))->Print(); + //PH dynamic_cast((*fParticleMap)[i])->Print(); + dynamic_cast(fParticleMap->At(i))->Print(); } //_____________________________________________________________________________ @@ -781,7 +809,7 @@ void AliStack::DumpLoadedStack() const "\n\n=======================================================================\n"); for (Int_t i=0;i(particles[i]); if (particle) { printf("-> %d ",i); particle->Print(); printf("--------------------------------------------------------------\n"); @@ -811,7 +839,7 @@ void AliStack::CleanParents() TParticle *part; int i; for(i=0; i(particles.At(i)); if(part) if(!part->TestBit(kDaughtersBit)) { part->SetFirstDaughter(-1); part->SetLastDaughter(-1); @@ -831,7 +859,7 @@ TParticle* AliStack::GetNextParticle() // search secondaries //for(Int_t i=fNtrack-1; i>=0; i--) { for(Int_t i=fNtrack-1; i>fHgwmk; i--) { - particle = (TParticle*) fParticleMap->At(i); + particle = dynamic_cast(fParticleMap->At(i)); if ((particle) && (!particle->TestBit(kDoneBit))) { fCurrent=i; //cout << "GetNextParticle() - secondary " @@ -843,7 +871,7 @@ TParticle* AliStack::GetNextParticle() // take next primary if all secondaries were done while (fCurrentPrimary>=0) { fCurrent = fCurrentPrimary; - particle = (TParticle*) fParticleMap->At(fCurrentPrimary--); + particle = dynamic_cast(fParticleMap->At(fCurrentPrimary--)); if ((particle) && (!particle->TestBit(kDoneBit))) { //cout << "GetNextParticle() - primary " // << fNtrack << " " << fHgwmk << " " << fCurrent << endl; @@ -859,7 +887,7 @@ TParticle* AliStack::GetNextParticle() } //__________________________________________________________________________________________ -void AliStack::MakeTree(Int_t event, const char *file) +void AliStack::MakeTree(Int_t event, const char * /*file*/) { // // Make Kine tree and creates branch for writing particles @@ -913,7 +941,7 @@ Bool_t AliStack::GetEvent(Int_t event) // Get Kine Tree from file char treeName[20]; sprintf(treeName,"TreeK%d",event); - fTreeK = (TTree*)gDirectory->Get(treeName); + fTreeK = dynamic_cast(gDirectory->Get(treeName)); if (fTreeK) fTreeK->SetBranchAddress("Particles", &fParticleBuffer); @@ -925,7 +953,7 @@ Bool_t AliStack::GetEvent(Int_t event) // printf("\n primaries %d", fNprimary); // printf("\n tracks %d", fNtrack); - Int_t size = (Int_t)fTreeK->GetEntries(); + Int_t size = static_cast(fTreeK->GetEntries()); ResetArrays(size); return kTRUE; } diff --git a/STEER/AliStack.h b/STEER/AliStack.h index 21b6c6405c4..903278b0c36 100644 --- a/STEER/AliStack.h +++ b/STEER/AliStack.h @@ -5,28 +5,29 @@ /* $Id$ */ -#include #include +#include +#include #include #include -#include -class TObjArray; -class TClonesArray; -class TParticle; class AliHeader; +class TClonesArray; class TFile; +class TObjArray; +class TParticle; class TTree; - - class AliStack : public TVirtualMCStack { public: // creators, destructors AliStack(Int_t size); AliStack(); + AliStack(const AliStack& st); virtual ~AliStack(); + AliStack& operator=(const AliStack& st) + {st.Copy(*this); return(*this);} // methods virtual void SetTrack(Int_t done, Int_t parent, Int_t pdg, @@ -78,6 +79,8 @@ class AliStack : public TVirtualMCStack Bool_t KeepPhysics(TParticle* part); private: + void Copy(AliStack &st) const; + // data members TClonesArray *fParticles; //! Pointer to list of particles TObjArray *fParticleMap; //! Map of particles in the supporting TClonesArray diff --git a/STEER/AliStream.cxx b/STEER/AliStream.cxx index d7ca520a4c1..3d9d8b63baa 100644 --- a/STEER/AliStream.cxx +++ b/STEER/AliStream.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.8 2002/10/22 15:02:15 alibrary +Introducing Riostream.h + Revision 1.7 2002/10/14 14:57:33 hristov Merging the VirtualMC branch to the main development branch (HEAD) @@ -54,38 +57,71 @@ Class to manage input filenames, used by AliRunDigitizer #include -#include "TTree.h" +#include "TFile.h" +#include "TObjString.h" #include "TROOT.h" - -#include "AliStream.h" +#include "TTree.h" #include "AliRun.h" +#include "AliStream.h" ClassImp(AliStream) -AliStream::AliStream() +//_______________________________________________________________________ +AliStream::AliStream(): + fLastEventSerialNr(0), + fLastEventNr(0), + fCurrentFileIndex(0), + fEvents(0), + fMode(0), + fCurrentFile(0), + fFileNames(0) { -// root requires default ctor, where no new objects can be created -// do not use this ctor, it is supplied only for root needs - fCurrentFile = 0; - fEvents = 0; - fFileNames = 0; + // + // root requires default ctor, where no new objects can be created + // do not use this ctor, it is supplied only for root needs + // } -//////////////////////////////////////////////////////////////////////// -AliStream::AliStream(Option_t *option) +//_______________________________________________________________________ +AliStream::AliStream(Option_t *option): + fLastEventSerialNr(-1), + fLastEventNr(0), + fCurrentFileIndex(-1), + fEvents(0), + fMode(option), + fCurrentFile(0), + fFileNames(new TObjArray(1)) { -// ctor - fLastEventSerialNr = -1; - fLastEventNr = 0; - fCurrentFileIndex = -1; - fCurrentFile = 0; - fEvents = 0; - fFileNames = new TObjArray(1); - fMode = option; + // + // Default ctor + // } -//////////////////////////////////////////////////////////////////////// +//_______________________________________________________________________ +AliStream::AliStream(const AliStream& str): + TNamed(str), + fLastEventSerialNr(0), + fLastEventNr(0), + fCurrentFileIndex(0), + fEvents(0), + fMode(0), + fCurrentFile(0), + fFileNames(0) +{ + // + // Copy ctor + // + str.Copy(*this); +} + +//_______________________________________________________________________ +void AliStream::Copy(AliStream& ) const +{ + Fatal("Copy","Not implemented\n"); +} + +//_______________________________________________________________________ AliStream::~AliStream() { // default dtor @@ -95,7 +131,7 @@ AliStream::~AliStream() } } -//////////////////////////////////////////////////////////////////////// +//_______________________________________________________________________ void AliStream::AddFile(const char *fileName) { // stores the name of the file @@ -103,7 +139,7 @@ void AliStream::AddFile(const char *fileName) fFileNames->Add(name); } -//////////////////////////////////////////////////////////////////////// +//_______________________________________________________________________ Bool_t AliStream::NextEventInStream(Int_t &serialNr) { // returns kFALSE if no more events @@ -124,7 +160,7 @@ Bool_t AliStream::NextEventInStream(Int_t &serialNr) return kTRUE; } -//////////////////////////////////////////////////////////////////////// +//_______________________________________________________________________ void AliStream::ChangeMode(Option_t* option) // set the mode to READ or UPDATE, reopen file with the new mode // only change from UPDATE to READ have sense in the current scheme, @@ -138,7 +174,7 @@ void AliStream::ChangeMode(Option_t* option) } } -//////////////////////////////////////////////////////////////////////// +//_______________________________________________________________________ Bool_t AliStream::OpenNextFile() { if (++fCurrentFileIndex > fFileNames->GetLast()) { @@ -150,7 +186,7 @@ Bool_t AliStream::OpenNextFile() static_cast(fFileNames->At(fCurrentFileIndex))->GetName(); // check if the file was already opened by some other code - TFile *f = (TFile *)(gROOT->GetListOfFiles()->FindObject(filename)); + TFile *f = dynamic_cast(gROOT->GetListOfFiles()->FindObject(filename)); if (f) f->Close(); if (fCurrentFile) { @@ -166,7 +202,7 @@ Bool_t AliStream::OpenNextFile() return kFALSE; } // find nr of events in the given file - TTree * te = (TTree *) fCurrentFile->Get("TE") ; + TTree * te = dynamic_cast(fCurrentFile->Get("TE")); if (!te) { Error("OpenNextFile", "input file does not contain TE"); return kFALSE; @@ -176,18 +212,19 @@ Bool_t AliStream::OpenNextFile() return kTRUE; } -//////////////////////////////////////////////////////////////////////// +//_______________________________________________________________________ Bool_t AliStream::ImportgAlice() { if (fFileNames->GetLast() < 0) return kFALSE; if (!fCurrentFile) { if (!OpenNextFile()) return kFALSE; } - gAlice = (AliRun*)fCurrentFile->Get("gAlice"); + gAlice = dynamic_cast(fCurrentFile->Get("gAlice")); if (!gAlice) return kFALSE; return kTRUE; } -//////////////////////////////////////////////////////////////////////// + +//_______________________________________________________________________ TString AliStream::GetFileName(const Int_t order) const // returns name of the order-th file // returns empty string if such file does not exist @@ -199,4 +236,4 @@ TString AliStream::GetFileName(const Int_t order) const if (fileNameStored) fileName = fileNameStored->GetString(); return fileName; } -//////////////////////////////////////////////////////////////////////// + diff --git a/STEER/AliStream.h b/STEER/AliStream.h index 426e9d44fe7..3969cf62c27 100644 --- a/STEER/AliStream.h +++ b/STEER/AliStream.h @@ -15,11 +15,10 @@ // --- ROOT system --- #include "TNamed.h" -#include "TObjString.h" #include "TString.h" -#include "TArrayI.h" -#include "TClonesArray.h" -#include "TFile.h" + +class TFile; +class TObjArray; // --- AliRoot header files --- @@ -28,6 +27,9 @@ class AliStream: public TNamed { public: AliStream(); AliStream(Option_t *option); + AliStream(const AliStream&); + AliStream & operator=(const AliStream& str) + {str.Copy(*this); return (*this);} virtual ~AliStream(); void AddFile(const char *fileName); Bool_t NextEventInStream(Int_t &eventNr); @@ -39,6 +41,8 @@ public: TString GetFileName(const Int_t order) const; private: + void Copy(AliStream& str) const; + Int_t fLastEventSerialNr; Int_t fLastEventNr; Int_t fCurrentFileIndex; diff --git a/STEER/AliTrackMap.cxx b/STEER/AliTrackMap.cxx index 147579fba32..8ad47a03abb 100644 --- a/STEER/AliTrackMap.cxx +++ b/STEER/AliTrackMap.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.3 2002/10/22 15:02:15 alibrary +Introducing Riostream.h + Revision 1.2 2002/10/14 14:57:33 hristov Merging the VirtualMC branch to the main development branch (HEAD) @@ -54,69 +57,89 @@ Classes to create and store tracks maps - correcpondence between track label and ClassImp(AliTrackMap) -//////////////////////////////////////////////////////////////////////// -AliTrackMap::AliTrackMap() +//_______________________________________________________________________ +AliTrackMap::AliTrackMap(): + fSize(0), + fArray(0) { -// -// default ctor -// - fArray=0; - fSize = 0; + // + // default ctor + // } -//////////////////////////////////////////////////////////////////////// -AliTrackMap::AliTrackMap(Int_t size, Int_t *array) : - TNamed("AliTrackMap", "AliTrackMap") + +//_______________________________________________________________________ +AliTrackMap::AliTrackMap(const AliTrackMap& trm): + TNamed(trm), + fSize(0), + fArray(0) { -// -// ctor -// + // + // default ctor + // + trm.Copy(*this); +} - fSize = size; - fArray = new Int_t[fSize]; +//_______________________________________________________________________ +AliTrackMap::AliTrackMap(Int_t size, Int_t *array): + TNamed("AliTrackMap", "AliTrackMap"), + fSize(size), + fArray(new Int_t[fSize]) +{ + // + // ctor + // for (Int_t i = 0; i < fSize; i++) fArray[i] = array[i]; } -//////////////////////////////////////////////////////////////////////// -AliTrackMap::~AliTrackMap() + +//_______________________________________________________________________ +void AliTrackMap::Copy(AliTrackMap& ) const { -// -// dtor -// + Fatal("Copy","Not implemented\n"); +} +//_______________________________________________________________________ +AliTrackMap::~AliTrackMap() +{ + // + // dtor + // delete [] fArray; } -//////////////////////////////////////////////////////////////////////// -Int_t AliTrackMap::At(Int_t label) +//_______________________________________________________________________ +Int_t AliTrackMap::At(Int_t label) const { -// -// returns entry number in the TreeH corresponding to particle with -// label label -// + // + // returns entry number in the TreeH corresponding to particle with + // label label + // if (label < 0 || label >= fSize) { cerr<<"AliTrackMap::At: label "<GetName()<<" contains these values: "<IsOpen()) {cerr<<"Can't open output file "<IsOpen()) {cerr<<"Can't open input file "<Get("gAlice"))) { + if (!(gAlice=dynamic_cast(fileHits->Get("gAlice")))) { cerr<<"gAlice have not been found on galice.root !\n"; return; } - + for (Int_t eventNr = firstEventNr; eventNr < firstEventNr+nEvents; eventNr++) { CreateMap(eventNr,fileMap); } // end loop over events - + delete gAlice; gAlice = 0; fileHits->Close(); @@ -93,13 +106,13 @@ void AliTrackMapper::CreateMap(Int_t nEvents, Int_t firstEventNr, if (fDEBUG > 0) timer.Print(); } -//////////////////////////////////////////////////////////////////////// -Int_t AliTrackMapper::CreateMap(Int_t eventNr, TFile* fileMap) { -// -// create an AliTrackMap for a given event -// correct gAlice must be already present in memory -// - +//_______________________________________________________________________ +Int_t AliTrackMapper::CreateMap(Int_t eventNr, TFile* fileMap) +{ + // + // create an AliTrackMap for a given event + // correct gAlice must be already present in memory + // Int_t nGenPrimPlusSecParticles = gAlice->GetEvent(eventNr); if (fDEBUG > 1) cout<<"nGenPrimPlusSecParticles = "<(treeH->GetEntries()); if (fDEBUG > 1) cout<<"treeHEntries "<Detectors(); if (!modules) { cerr<<"TObjArray with modules not found."<(modules->At(iModule)); if (!detector) continue; -// process only detectors with shunt = 0 + // process only detectors with shunt = 0 if (detector->GetIshunt()) continue; - hit=(AliHit*)detector->FirstHit(-1); + hit=dynamic_cast(detector->FirstHit(-1)); Int_t lastLabel=-1, label; - for( ; hit; hit=(AliHit*)detector->NextHit() ) { + for( ; hit; hit=dynamic_cast(detector->NextHit()) ) { label=hit->Track(); if (lastLabel != label) { if (label < 0 || label >= nAllParticles) { @@ -180,37 +192,37 @@ Int_t AliTrackMapper::CreateMap(Int_t eventNr, TFile* fileMap) { return 0; } -//////////////////////////////////////////////////////////////////////// +//_______________________________________________________________________ AliTrackMap* AliTrackMapper::LoadTrackMap(Int_t eventNr, const char* fnMap, TFile* &fileMap) { -// -// read an AliTrackMap object for the given event eventNr from -// the file fileMap -// + // + // read an AliTrackMap object for the given event eventNr from + // the file fileMap + // fileMap=TFile::Open(fnMap); if (!fileMap->IsOpen()) {cerr<<"Can't open file "<Get(mapName); + AliTrackMap* trackMapObject = dynamic_cast(fileMap->Get(mapName)); if (!trackMapObject) { cerr<<"Error: map named "<PrintValues(); - + delete trackMapObject; fileMap->Close(); delete fileMap; } -//////////////////////////////////////////////////////////////////////// diff --git a/STEER/AliTrackMapper.h b/STEER/AliTrackMapper.h index ddec808bb00..1d5fb723dd6 100644 --- a/STEER/AliTrackMapper.h +++ b/STEER/AliTrackMapper.h @@ -29,8 +29,8 @@ class AliTrackMap; class AliTrackMapper { public: - AliTrackMapper(){fDEBUG=0;} - virtual ~AliTrackMapper(){;} + AliTrackMapper(); + virtual ~AliTrackMapper(){} void CreateMap(Int_t nEvents, Int_t firstEventNr, const char* fnMap = "trackMap.root", const char* fnHits ="rfio:galice.root"); diff --git a/STEER/AliTrackReference.cxx b/STEER/AliTrackReference.cxx index b5179ea64b1..c8acc831774 100644 --- a/STEER/AliTrackReference.cxx +++ b/STEER/AliTrackReference.cxx @@ -20,11 +20,18 @@ ClassImp(AliTrackReference) -AliTrackReference::AliTrackReference() +//_______________________________________________________________________ + AliTrackReference::AliTrackReference(): + fTrack(0), + fX(0), + fY(0), + fZ(0), + fPx(0), + fPy(0), + fPz(0), + fLength(0) { // // Default constructor // - fTrack = 0; - fX = fY = fZ = fPx = fPy = fPz = fLength = 0.; } -- 2.39.3