]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Code clean-up (F.Carminati)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 29 Oct 2002 14:26:50 +0000 (14:26 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 29 Oct 2002 14:26:50 +0000 (14:26 +0000)
59 files changed:
STEER/AliConfig.cxx
STEER/AliConfig.h
STEER/AliDebugVolume.cxx
STEER/AliDebugVolume.h
STEER/AliDetector.cxx
STEER/AliDetector.h
STEER/AliDigitNew.cxx
STEER/AliDigitNew.h
STEER/AliDigitizer.cxx
STEER/AliDigitizer.h
STEER/AliDisplay.cxx
STEER/AliESD.cxx
STEER/AliESD.h
STEER/AliFieldMap.cxx
STEER/AliGausCorr.cxx
STEER/AliGenEventHeader.cxx
STEER/AliGenerator.cxx
STEER/AliGenerator.h
STEER/AliHeader.cxx
STEER/AliHeader.h
STEER/AliHit.cxx
STEER/AliKalmanTrack.cxx
STEER/AliKalmanTrack.h
STEER/AliLego.cxx
STEER/AliLego.h
STEER/AliLegoGenerator.cxx
STEER/AliMCQA.cxx
STEER/AliMCQA.h
STEER/AliMagF.cxx
STEER/AliMagF.h
STEER/AliMagFCM.cxx
STEER/AliMagFCM.h
STEER/AliMagFDM.cxx
STEER/AliMagFDM.h
STEER/AliMagFMaps.cxx
STEER/AliMagFMaps.h
STEER/AliMergeCombi.cxx
STEER/AliModule.cxx
STEER/AliModule.h
STEER/AliPoints.cxx
STEER/AliPoints.h
STEER/AliRecPoint.cxx
STEER/AliRecPoint.h
STEER/AliRndm.cxx
STEER/AliRndm.h
STEER/AliRun.cxx
STEER/AliRun.h
STEER/AliRunDigitizer.cxx
STEER/AliRunDigitizer.h
STEER/AliSegmentation.h
STEER/AliStack.cxx
STEER/AliStack.h
STEER/AliStream.cxx
STEER/AliStream.h
STEER/AliTrackMap.cxx
STEER/AliTrackMap.h
STEER/AliTrackMapper.cxx
STEER/AliTrackMapper.h
STEER/AliTrackReference.cxx

index 4df26f526a1ff4e894277b20320c0862d590ad69..252edcfae53fcdb7fe37d687e4c8e29c60810b54 100644 (file)
@@ -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<TFolder *>(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<TFolder *>(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";
index 4b1572b1de13c1e1048aad1bb9a2f57bbd913212..ad00846c6f444005222fe63ffc83cf009c1d1997 100644 (file)
@@ -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 ; 
 
index f16da06e0dd43304c3da1af2de5030e7fe8901f8..c09da92b876be97de608c54013d92c89184c1031 100644 (file)
@@ -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);
 }
index 19e22371a999b74992fb1e4d09bd94e96f7139dd..c01e9809ae6bec0d2f5b04431dbfb23af8de95d0 100644 (file)
@@ -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
index 1e2c2eec0cf00e8a3763658cd8aad69b50e5c21a..0d701ae9ecf392ae41bb1f14486d7c5d29606306 100644 (file)
@@ -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<TFolder *>(gROOT->FindObjectAny("/Folders"));
   if  (topFolder) { 
-    TFolder *folder = (TFolder *)topFolder->FindObjectAny(dir);
-    // TFolder *folder = (TFolder *)gROOT->FindObjectAny(dir);
+    TFolder *folder = dynamic_cast<TFolder *>(topFolder->FindObjectAny(dir));
+    // TFolder *folder = dynamic_cast<TFolder *>(gROOT->FindObjectAny(dir));
     if (!folder)  {
       cerr << "Cannot register: Missing folder: " << dir << endl;
     } else {
-      TFolder *subfolder = (TFolder *) folder->FindObjectAny(this->GetName()); 
+      TFolder *subfolder = dynamic_cast<TFolder *>(folder->FindObjectAny(this->GetName())); 
 
       if(!subfolder)
          subfolder = folder->AddFolder(this->GetName(),this->GetTitle());
       if (address) {
-        TObject **obj = (TObject **) address;
+        TObject **obj = static_cast<TObject **>(address);
         if ((*obj)->InheritsFrom(TCollection::Class())) {
-           TCollection *collection = (TCollection *) (*obj); 
+           TCollection *collection = dynamic_cast<TCollection *>(*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<TBranch*>(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;i<fTrackReferences->GetEntries();i++){
-    AliTrackReference * ref = (AliTrackReference*) fTrackReferences->UncheckedAt(i);
+    AliTrackReference * ref = dynamic_cast<AliTrackReference*>(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<AliHit*>(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<AliTrackReference*>(fTrackReferences->UncheckedAt(0));
   else            return 0;
 }
 
@@ -394,7 +416,7 @@ AliHit* AliDetector::NextHit()
   //
   if(sMaxIterHit) {
     if(++sCurIterHit<sMaxIterHit) 
-      return (AliHit*) fHits->UncheckedAt(sCurIterHit);
+      return dynamic_cast<AliHit*>(fHits->UncheckedAt(sCurIterHit));
     else        
       return 0;
   } else {
@@ -411,7 +433,7 @@ AliTrackReference* AliDetector::NextTrackReference()
   //
   if(fMaxIterTrackRef) {
     if(++fCurrentIterTrackRef<fMaxIterTrackRef) 
-      return (AliTrackReference*) fTrackReferences->UncheckedAt(fCurrentIterTrackRef);
+      return dynamic_cast<AliTrackReference*>(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;hit<nhits;hit++) {
-    ahit = (AliHit*)fHits->UncheckedAt(hit);
+    ahit = dynamic_cast<AliHit*>(fHits->UncheckedAt(hit));
     trk=ahit->GetTrack();
     assert(trk<=tracks);
     if(ntrk[trk]==limi[trk]) {
index e9d81d5cc18d2414819c0986bedfa80646bf3d86..8100fc11128411c916625e133793659a8614b3c5 100644 (file)
@@ -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
index 86a3b28f863be6a51d2ad1dff435fa4f0c2fdaf8..40d7a952b54911f023bd8e96dd9df3f2ee5feba6 100644 (file)
@@ -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
+  //
 }
 
         
index 593eb0136ce700126be109e9c125c0f63cb479f5..d6aba30583eb89ed20438469050c7b67d913fdc0 100644 (file)
@@ -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 ; } 
index b5fdd2932df90c35dcd6aacc451edcc210b4b411..cc8a4f2a12c80665cf25acd86e5022cdb44f0d54 100644 (file)
@@ -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() ;
index 1067ff4bd585a23245835e7fa95f5464ec2e40b3..d2ed25bba61e6a33de4a25f92dbb5c540514bcce 100644 (file)
@@ -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;
     
index a1cc12681b5ceec98deff664e981844bd31bd633..d95ddb09ed0b192c2c15790b4eccf7dc46c1750f 100644 (file)
@@ -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 <TTree.h>
+#include <TArc.h>
 #include <TButton.h>
 #include <TCanvas.h>
-#include <TView.h>
+#include <TDiamond.h>
+#include <TGaxis.h>
+#include <TMath.h>
 #include <TPaveLabel.h>
 #include <TPaveText.h>
-#include <TDiamond.h>
-#include <TArc.h>
 #include <TSlider.h>
 #include <TSliderBox.h>
-#include <TGaxis.h>
+#include <TTree.h>
+#include <TView.h>
 #include <TVirtualX.h>
-#include <TMath.h>
 
-#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
-/*
-<img src="picts/alidisplay.gif">
-*/
-//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
+  /*
+    <img src="picts/alidisplay.gif">
+  */
+  //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<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 = dynamic_cast<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();
 }
 
 
-//_____________________________________________________________________________
-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<AliDetector*>(gAlice->GetModule("TPC"));
    TObjArray *points=mTPC->Points();
    int ntracks=points->GetEntriesFast();
    for (int track=0;track<ntracks;track++) {
-      AliPoints *pm = (AliPoints*)points->UncheckedAt(track);
+      AliPoints *pm = dynamic_cast<AliPoints*>(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<AliDetector*>(gAlice->GetModule("TPC"));
    TObjArray *points=mTPC->Points();
    int ntracks=points->GetEntriesFast();
    for (int track=0;track<ntracks;track++) {
-      AliPoints *pm = (AliPoints*)points->UncheckedAt(track);
+      AliPoints *pm = dynamic_cast<AliPoints*>(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<AliModule*>(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<AliModule*>(next()))) {
       if (!module->IsActive()) continue;
       points = module->Points();
       if (!points) continue;
       ntracks = points->GetEntriesFast();
       for (track=0;track<ntracks;track++) {
-         pm = (AliPoints*)points->UncheckedAt(track);
+         pm = dynamic_cast<AliPoints*>(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<TPad*>(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<TPad*>(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<AliModule*>(gAlice->Modules()->FindObject(name));
    if (!module) return;
    module->Enable();
    Draw();
@@ -811,7 +876,7 @@ void AliDisplay::LoadPoints()
      for (Int_t track=0; track<fNTracksToDisplay;track++) {
       gAlice->ResetHits();
       gAlice->TreeH()->GetEvent(nprim-1-gAlice->GetPrimary(fTracksToDisplay[track]));
-      while((module = (AliModule*)next())) {
+      while((module = dynamic_cast<AliModule*>(next()))) {
        module->LoadPoints(nprim-1-gAlice->GetPrimary(fTracksToDisplay[track]));
       }
       next.Reset();
@@ -821,7 +886,7 @@ void AliDisplay::LoadPoints()
      for (Int_t track=0; track<ntracks;track++) {
        gAlice->ResetHits();
        gAlice->TreeH()->GetEvent(track);
-       while((module = (AliModule*)next())) {
+       while((module = dynamic_cast<AliModule*>(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<TPad*>(gPad->GetPadSave());
   pad->Range(fZoomX0[fZooms],fZoomY0[fZooms], fZoomX1[fZooms],fZoomY1[fZooms]);
   pad->Modified();
 }
index 9be1bceb66fffd3c6c6a77a520ceb32a8bc6cb13..2f5096cd438ab8ed9a17baa22eacc6ea94cf08b9 100644 (file)
 $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)
+{
+}
+
index d0fbae66e4b987ae61e019e7e86565937657b162..ea933079734ceac85304780757904492485e8855 100644 (file)
@@ -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 
index db1b606538255236e222f77ba4ef46bd3b9a9d8a..58a3ad6945cd48a45faffa320757d741a392f4c8 100644 (file)
@@ -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.
index 7cd2c06e87abd78d47dff2eb3c4f89a102c2352d..ba6c8cb39b23e05d2e64c22c515d91b3bb20c53d 100644 (file)
@@ -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 <Riostream.h>
 #include <TArrayD.h>
 #include <TMatrixD.h>
 
 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;j<fSize;j++){
     double accum = 0;
     for(Int_t k=0;k<j;k++){
@@ -59,26 +64,28 @@ AliGausCorr::AliGausCorr(const TMatrixD & vec, Int_t size)
   }
 }
 
-//________________________________________________________
-AliGausCorr::AliGausCorr(const AliGausCorr & tgcorr)
+//_______________________________________________________________________
+AliGausCorr::AliGausCorr(const AliGausCorr & tgcorr):
+  TObject(tgcorr),
+  fSize(tgcorr.fSize),
+  fCv(new TMatrixD(fSize,fSize))
 {
+  //
   // Copy contructor
-
-  fSize = tgcorr.fSize;
-  fCv = new TMatrixD(fSize,fSize);
+  //
   for(Int_t i=0;i<fSize;i++){
     for(Int_t j=0;j<fSize;j++)(*fCv)(i,j)=(*tgcorr.fCv)(i,j);
   }
 }
 
-//________________________________________________________
+//_______________________________________________________________________
 AliGausCorr::~AliGausCorr()
 {
   // Destructor
   delete fCv;
 }
 
-//________________________________________________________
+//_______________________________________________________________________
 void AliGausCorr::GetGaussN(TArrayD &vec) const
 {
   // return fSize correlated gaussian numbers
@@ -102,7 +109,7 @@ void AliGausCorr::GetGaussN(TArrayD &vec) const
 
 }
 
-//________________________________________________________
+//_______________________________________________________________________
 void AliGausCorr::PrintCv() const
 {
   // Printout of the "square root" cov. matrix 
@@ -121,7 +128,7 @@ void AliGausCorr::PrintCv() const
   printf("\n");
 }
 
-//________________________________________________________
+//_______________________________________________________________________
 AliGausCorr & AliGausCorr::operator=(const AliGausCorr & tgcorr)
 {
   if(&tgcorr != this && tgcorr.fSize!=fSize){
@@ -137,8 +144,3 @@ AliGausCorr & AliGausCorr::operator=(const AliGausCorr & tgcorr)
 
   return *this;
 }
-
-
-
-
-
index 5b0f7dac05c163fcff4e7341bb10ac6a26a360c1..b681159000ab3ab4b1b117bf524685e0448c7452 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.3  2001/10/16 07:44:38  morsch
+Initialize  fVertex in all constructors.
+
 Revision 1.2  2001/09/25 11:28:48  morsch
 Possibility to store and retrieve primary vertex position added.
 
@@ -40,25 +43,30 @@ Proposal for an event header class for generated events.
 ClassImp(AliGenEventHeader)
 
 
-//_____________________________________________________________________________
-AliGenEventHeader::AliGenEventHeader()
+//_______________________________________________________________________
+AliGenEventHeader::AliGenEventHeader():
+  fNProduced(-1),
+  fImpactParameter(-1),
+  fVertex(3)
 {
-// Constructor
-    fNProduced      = -1;      
-    fImpactParameter= -1.;
-    fVertex.Set(3);
+  //
+  // Constructor
+  //
 }
 
-
-AliGenEventHeader::AliGenEventHeader(const char * name)
-    :TNamed(name, "Event Header")
+//_______________________________________________________________________
+AliGenEventHeader::AliGenEventHeader(const char * name):
+  TNamed(name, "Event Header"),
+  fNProduced(-1),
+  fImpactParameter(-1),
+  fVertex(3)
 {
-// Constructor
-    fNProduced      = -1;      
-    fImpactParameter= -1.;
-    fVertex.Set(3);
+  //
+  // Constructor
+  //
 }
 
+//_______________________________________________________________________
 void AliGenEventHeader::SetPrimaryVertex(const TArrayF &o)
 {
     //
@@ -69,6 +77,7 @@ void AliGenEventHeader::SetPrimaryVertex(const TArrayF &o)
     fVertex[2]=o.At(2);
 }
 
+//_______________________________________________________________________
 void  AliGenEventHeader::PrimaryVertex(TArrayF &o) const
 {
     //
index 44cc80a973112159b82f0c470e1f0921ce24f342..fab254064759153420a61260d675bd4c3a6bfcb0 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.19  2002/03/12 11:06:03  morsch
+Add particle status code to argument list of SetTrack(..).
+
 Revision 1.18  2002/02/18 19:23:00  hristov
 Put protection in the destructor
 
@@ -83,20 +86,44 @@ Introduction of the Copyright and cvs Log
 //End_Html
 //                                                               //
 ///////////////////////////////////////////////////////////////////
+#include "TGenerator.h"
 
+#include "AliConfig.h"
 #include "AliGenerator.h"
-#include "TGenerator.h"
 #include "AliRun.h"
-#include "AliConfig.h"
 #include "AliStack.h"
 
-
 ClassImp(AliGenerator)
 
 TGenerator* AliGenerator::fgMCEvGen=0;
 
-//____________________________________________________________
-AliGenerator::AliGenerator()
+//_______________________________________________________________________
+AliGenerator::AliGenerator():
+  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)
 {
   //
   // Default constructor
@@ -117,24 +144,41 @@ AliGenerator::AliGenerator()
     SetCutVertexZ();
 
 
-    fOrigin.Set(3);
-    fOsigma.Set(3);
-    fVertex.Set(3);
-
     fOrigin[0]=fOrigin[1]=fOrigin[2]=0;
     fOsigma[0]=fOsigma[1]=fOsigma[2]=0;
     fVertex[0]=fVertex[1]=fVertex[2]=0;
 
-    fVMin.Set(3);
     fVMin[0]=fVMin[1]=fVMin[2]=0;
-    fVMax.Set(3);
     fVMax[0]=fVMax[1]=fVMax[2]=10000;
-    fStack = 0;
 }
 
-//____________________________________________________________
-AliGenerator::AliGenerator(Int_t npart)
-    : TNamed(" "," ")
+//_______________________________________________________________________
+AliGenerator::AliGenerator(Int_t npart):
+  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)
 {
   //
   // Standard constructor
@@ -153,27 +197,47 @@ AliGenerator::AliGenerator(Int_t npart)
     SetTrackingFlag();
     SetCutVertexZ();
 
-    fOrigin.Set(3);
-    fOsigma.Set(3);
-    fVertex.Set(3);
-
     fOrigin[0]=fOrigin[1]=fOrigin[2]=0;
     fOsigma[0]=fOsigma[1]=fOsigma[2]=0;
     fVertex[0]=fVertex[1]=fVertex[2]=0;
 
-    fVMin.Set(3);
     fVMin[0]=fVMin[1]=fVMin[2]=0;
-    fVMax.Set(3);
     fVMax[0]=fVMax[1]=fVMax[2]=10000;
 
     SetNumberParticles(npart);
 
     AliConfig::Instance()->Add(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)
index 0650e147af614bccf0beadd76f93160162746214..5de8143f8f9a5853a25ae0a8f2e84ddd08e54505 100644 (file)
@@ -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();
index cd9c0bb5e438a2f89ffca73f75b1245fc24ffc4c..e9ae2cdf0f78c1cfe691f043f876fa9078041ee8 100644 (file)
@@ -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");
+}
 
 
 
index 946a59e433334f3b6bb9b50c0d4936aa48903b24..d5edccd3baabba18ecd13c78bfbcde8be05eb4cd 100644 (file)
@@ -6,12 +6,14 @@
 /* $Id$ */
 
 #include <TObject.h>
+
 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
index af79dd879023ba8b9197e384a875b83165bbbdb3..dcb29ca29006a85f88eb48ef4458983425f4eb30 100644 (file)
@@ -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);
   }
 }
-
-        
index c82f383ea5cd6dbf33d1fe00bcfd1968fd55222f..fa554a25655b28c955b64144a348905bd56c7047 100644 (file)
@@ -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"); 
+}
+
index cd533907785d52e56d5d65b7e291b5898e5f65bd..7e8ef29e3c9451f1bc0c38324fb8ec8008ba8dcb 100644 (file)
@@ -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;}
index aceb2f5eb55a4a9711d5ba650a0689bb8b4341e3..021371e4d9b295d6edf719008d8620a72ed82521 100644 (file)
@@ -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<AliDebugVolume*>((*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<AliDebugVolume*>((*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<AliDebugVolume*>((*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<AliDebugVolume*>((*fVolumesFwd)[i]);
+      AliDebugVolume* tmp2 = dynamic_cast<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");
     }
-    printf("\n ==============================================\n");
+  printf("\n ==============================================\n");
 }
-
-
-
-
-
-
-
index 0b525f2de6cc9a52610773c65ca2052e0b98a8a6..c3cda8997b830baf51a97416ac10e3e6f48edcdf 100644 (file)
@@ -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
index e5faf63ea0e9f16ef469a2c50022bca8fa779d98..41e2d4ee717b1de086a0f8954a9aa80b68bcd0e8 100644 (file)
@@ -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;
index c3189df340f30931a441c1c2d08e0d28ddc39727..0f74c0a38429741439ab0586ce1b2dba8a89bae7 100644 (file)
@@ -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<ndets; i++) {
     hist[i] = list = new TList();
-    mod = (AliModule *) mods[i];
+    AliModule *mod = dynamic_cast<AliModule*>(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<TH1F*>(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;i<fNvolumes;++i) {
-    AliModule *mod = (AliModule*)
-      (*gAlice->Modules())[gAlice->DetFromMate(gMC->VolId2Mate(i+1))];
+    AliModule *mod = dynamic_cast<AliModule*>
+      ((*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<TH1F*>(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;i<fNdets;++i) 
     (*fModNames)[i]=
-      new TNamed(((AliModule *)(*gAlice->Modules())[i])->GetName(),"");
+      new TNamed((dynamic_cast<AliModule*>((*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<TH1*>(global())))
     b->Add(hist,hist->GetTitle());
   //
   // Module histograms now
   //
   TIter next(fQAList);
   TList *histos;
-  while((histos = (TList*)next())) {
+  while((histos = dynamic_cast<TList*>(next()))) {
     TIter next1(histos);
-    while((hist = (TH1*)next1())) 
+    while((hist = dynamic_cast<TH1*>(next1())))
       b->Add(hist,hist->GetTitle());
   }
 }
 
-//_____________________________________________________________________________
+//_______________________________________________________________________
 void AliMCQA::PreTrack()
 {
   //
@@ -228,7 +264,7 @@ void AliMCQA::PreTrack()
   for(Int_t i=0; i<fNdets; i++) fDetDone[i]=0;
 }
 
-//_____________________________________________________________________________
+//_______________________________________________________________________
 void AliMCQA::StepManager(Int_t id)
 {
   //
@@ -241,9 +277,9 @@ void AliMCQA::StepManager(Int_t id)
   //
 
 
-  static TH1F* mcvcalls = (TH1F*) fQAHist->FindObject("hMCVcalls");
+  static TH1F* mcvcalls = dynamic_cast<TH1F*>(fQAHist->FindObject("hMCVcalls"));
   mcvcalls->Fill(gMC->CurrentVolID(copy));
-  static TH1F* mcmcalls = (TH1F*) fQAHist->FindObject("hMCMcalls");
+  static TH1F* mcmcalls = dynamic_cast<TH1F*>(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<TList*>((*fQAList)[fOldId]);
+       hist = dynamic_cast<TH1F*>(histold->FindObject("hEnOut"));
        hist->Fill(TMath::Log10(energy));
-       hist = (TH1F*) histold->FindObject("hZOut");
+       hist = dynamic_cast<TH1F*>(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<TList*>((*fQAList)[id]);
+      hist = dynamic_cast<TH1F*>(histnew->FindObject("hEnIn"));
       hist->Fill(TMath::Log10(energy));
-      hist = (TH1F*) histnew->FindObject("hZIn");
+      hist = dynamic_cast<TH1F*>(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<TH1*>(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(0<binx && binx<=fNdets) {
     char lab[15];
-    strcpy(lab,((TNamed*)(*fModNames)[binx-1])->GetName());
+    strcpy(lab,dynamic_cast<TNamed*>((*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(0<binx && binx<=fNvolumes) {
     char lab[20];
-    sprintf(lab,"%s: %s",((TNamed*)(*fVolNames)[binx-1])->GetName(),
-           ((TNamed*)(*fVolNames)[binx-1])->GetTitle());
+    sprintf(lab,"%s: %s",dynamic_cast<TNamed*>((*fVolNames)[binx-1])->GetName(),
+           dynamic_cast<TNamed*>((*fVolNames)[binx-1])->GetTitle());
     fVPaveLabel->SetLabel(lab);
     
     gPad->Modified();
index 8621998f128c49e00aab1774330eef30f4118a86..b097fbf20adb13c1c1b89670dd79d1e7bdfa5d53 100644 (file)
@@ -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 
-
index 8927ae66b8ac327b314b9956603357dfe12149fd..724ca7520409391851c4aaee160d0b44de1af54d 100644 (file)
@@ -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 <stdlib.h>
-#include <stdio.h>
-
-
 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;
 }
-      
-
-
-  
-
-
-
-
index c0fd52dfbbc7e333fe5f7206e95402933537b595..adf9637ea4072a39119374eae83cc1bfc032ebde 100644 (file)
@@ -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 -------------------------------------------------------------------
 
index 33ea712b9370d46edf7a262d9ea2d996e9a420bd..6ce59b1066bffb4658f6de7fc37f04fd868d0a3c 100644 (file)
@@ -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;
-}
index b3352988c22012df692e661cda6f8b2e02de2e6b..4683d01bbdb99b17f87caaf80a0f45e2782132bf 100644 (file)
@@ -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));
index 6534cba0d1e0dcd339a40b12215f301a710f994e..50264c8fb865433534839bf68bf570e825f6ec5a 100644 (file)
@@ -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 <stdlib.h>
 
-#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<xL3[2] && xL3[2]<=zCmin && r0<=rPmax) || ((zCmin<xL3[2] && xL3[2]
   }
 }
 
-//_____________________  FZ ____________________
-
-Int_t AliMagFDM::FZ(Double_t temp, Float_t  *Ar, Float_t delu,Int_t ik,Int_t nk)
+//_______________________________________________________________________
+Int_t AliMagFDM::FZ(Double_t temp, Float_t *Ar, 
+                    Float_t delu, Int_t ik,Int_t nk)
 {
   //
   // Quest of a point position at x,y,z (Cartensian) and R,Phi,z (Polar) axises
@@ -381,9 +446,10 @@ Int_t AliMagFDM::FZ(Double_t temp, Float_t  *Ar, Float_t delu,Int_t ik,Int_t nk)
     return kf;
   }
 
-/*---------------------Ba------------------*/
-
-Double_t AliMagFDM::Ba(Int_t kaai,Double_t zaa1, Double_t zaa2, Double_t alf1, Double_t alf2, Double_t alf3, Int_t kaa, Int_t maa)
+//_______________________________________________________________________
+Double_t AliMagFDM::Ba(Int_t kaai,Double_t zaa1, Double_t zaa2, 
+                       Double_t alf1, Double_t alf2, Double_t alf3, 
+                       Int_t kaa, Int_t maa)
 {
   //
   // Calculation of field componet for case (keps <r0<= fRdel) at a given axis
@@ -429,9 +495,9 @@ Double_t AliMagFDM::Ba(Int_t kaai,Double_t zaa1, Double_t zaa2, Double_t alf1, D
 }
 
   
-/*------------------------Bb--------------------------*/
-
-Double_t AliMagFDM::Bb(Double_t z1,Double_t z2, Double_t y1,Double_t y2, Double_t x1,Double_t x2, Int_t kv, Int_t k, Int_t l, Int_t m)
+//_______________________________________________________________________
+Double_t AliMagFDM::Bb(Double_t z1,Double_t z2, Double_t y1,Double_t y2, 
+                       Double_t x1,Double_t x2, Int_t kv, Int_t k, Int_t l, Int_t m)
 {  
   //
   // Calculation of field componet at a given axis (general case)
@@ -540,8 +606,8 @@ Double_t AliMagFDM::Bb(Double_t z1,Double_t z2, Double_t y1,Double_t y2, Double_
   return bbi;
   
 }     
-//____________________________________________
 
+//_______________________________________________________________________
 void AliMagFDM::ReadField()
 {
   //
@@ -704,4 +770,3 @@ printf("fZpdl %e, fPhid %e, fRdel %e, fZpmx %e, fZpmn %e,fRmax %e,fRmin %e \n",
     exit(1);
   }
 }
-//________________________________  
index f2856d1b09dc184fdcb427a891bf2e28b752362f..755f81c3c3b6ffb237d5c7997717a67378014fad 100644 (file)
@@ -12,14 +12,14 @@ class AliMagFDM : public AliMagF
 //Alice Magnetic Field:Magnetic field map from IP to muon filter for Muon arm
 
 public:
-  AliMagFDM(){}
+  AliMagFDM();
   AliMagFDM(const char *name, const char *title, const Int_t integ,
            const Float_t factor, const Float_t fmax);
   virtual ~AliMagFDM(){} 
   virtual void Field(Float_t *x, Float_t *b);
   virtual void ReadField(); 
   virtual void SetSolenoidField(Float_t field = 2.) {fSolenoid = field;}
-  virtual Float_t SolenoidField() {return fSolenoid;}
+  virtual Float_t SolenoidField() const {return fSolenoid;}
   Int_t FZ(Double_t u, Float_t *Ar, Float_t du, Int_t ki, Int_t nu);
   Double_t Ba(Int_t kai, Double_t za1, Double_t za2, Double_t al1, Double_t al2, Double_t al3, Int_t ka, Int_t ma);
   Double_t Bb(Double_t z1, Double_t z2, Double_t y1, Double_t y2, Double_t x1, Double_t x2, Int_t kvr, Int_t k, Int_t l, Int_t m); 
index 694b5f4d87765d77fac48585ac89206c10e3fe21..1bab9b76bc0ad89f8855dada703fe058e81fb62b 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.8  2002/10/14 14:57:32  hristov
+Merging the VirtualMC branch to the main development branch (HEAD)
+
 Revision 1.5.6.2  2002/08/01 15:35:30  alibrary
 Updating VirtualMC
 
@@ -48,17 +51,33 @@ root files.
 
 #include <TFile.h>
 #include <TSystem.h>
+
 #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<AliFieldMap*>(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<AliFieldMap*>(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<AliFieldMap*>(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<AliFieldMap*>(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<AliFieldMap*>(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<AliFieldMap*>(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<AliFieldMap*>(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<AliFieldMap*>(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<AliFieldMap*>(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]<kCOREND2){
+    //This is the ZDC part
+    Float_t rad2=x[0]*x[0]+x[1]*x[1];
+    if(x[2]>kCORBEG2 && x[2]<kCOREND2){
          if(rad2<kCOR2RA2){
-             b[0] = kFCORN2;
+        b[0] = kFCORN2;
          }
-      }
-      else if(x[2]>kZ1BEG && x[2]<kZ1END){  
+    }
+    else if(x[2]>kZ1BEG && x[2]<kZ1END){  
          if(rad2<kZ1RA2){
-             b[0] = -kG1*x[1];
-             b[1] = -kG1*x[0];
+        b[0] = -kG1*x[1];
+        b[1] = -kG1*x[0];
          }
-      }
-      else if(x[2]>kZ2BEG && x[2]<kZ2END){  
+    }
+    else if(x[2]>kZ2BEG && x[2]<kZ2END){  
          if(rad2<kZ2RA2){
-             b[0] = kG1*x[1];
-             b[1] = kG1*x[0];
+        b[0] = kG1*x[1];
+        b[1] = kG1*x[0];
          }
-      }
-      else if(x[2]>kZ3BEG && x[2]<kZ3END){  
+    }
+    else if(x[2]>kZ3BEG && x[2]<kZ3END){  
          if(rad2<kZ3RA2){
-             b[0] = kG1*x[1];
-             b[1] = kG1*x[0];
+        b[0] = kG1*x[1];
+        b[1] = kG1*x[0];
          }
-      }
-      else if(x[2]>kZ4BEG && x[2]<kZ4END){  
+    }
+    else if(x[2]>kZ4BEG && x[2]<kZ4END){  
          if(rad2<kZ4RA2){
-             b[0] = -kG1*x[1];
-             b[1] = -kG1*x[0];
+        b[0] = -kG1*x[1];
+        b[1] = -kG1*x[0];
          }
-      }
-      else if(x[2]>kD1BEG && x[2]<kD1END){ 
+    }
+    else if(x[2]>kD1BEG && x[2]<kD1END){ 
          if(rad2<kD1RA2){
-             b[1] = -kFDIP;
+        b[1] = -kFDIP;
          }
-      }
-      else if(x[2]>kD2BEG && x[2]<kD2END){
+    }
+    else if(x[2]>kD2BEG && x[2]<kD2END){
          if(((x[0]-kXCEN1D2)*(x[0]-kXCEN1D2)+(x[1]-kYCEN1D2)*(x[1]-kYCEN1D2))<kD2RA2
             || ((x[0]-kXCEN2D2)*(x[0]-kXCEN2D2)+(x[1]-kYCEN2D2)*(x[1]-kYCEN2D2))<kD2RA2){
-             b[1] = kFDIP;
+        b[1] = kFDIP;
          }
-      }
+    }
   }
   if(fFactor!=1) {
-      b[0]*=fFactor;
-      b[1]*=fFactor;
-      b[2]*=fFactor;
+    b[0]*=fFactor;
+    b[1]*=fFactor;
+    b[2]*=fFactor;
   }
 }
 
-//________________________________________
+//_______________________________________________________________________
 void AliMagFMaps::Copy(AliMagFMaps & /* magf */) const
 {
   //
@@ -281,20 +303,14 @@ void AliMagFMaps::Copy(AliMagFMaps & /* magf */) const
   Fatal("Copy","Not implemented!\n");
 }
 
-//________________________________________
-AliMagFMaps & AliMagFMaps::operator =(const AliMagFMaps &magf)
-{
-  magf.Copy(*this);
-  return *this;
-}
-
+//_______________________________________________________________________
 void AliMagFMaps::Streamer(TBuffer &R__b)
 {
-   // 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);
-   }
+  // 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);
+  }
 }
index c13fe45f1566fbea8dbcd088fff3b9c955e57b30..d1cddb3a9643a99cc6659c6464d72c65406a48c3 100644 (file)
@@ -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
index be5b75b58716c131bd896fc6f984cfc5fa8f99fc..1f37271cddfba32dd9ddcd8c3f0508c42ae6e188 100644 (file)
@@ -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; i<fDim; i++) {
@@ -70,5 +77,3 @@ Bool_t AliMergeCombi::Combination(Int_t evNumber[], Int_t delta[])
   }      
   return kTRUE;
 }
-
-////////////////////////////////////////////////////////////////////////
index 03fc5069567fa3fdcaaa0380aa016e3f495ddae2..ad5c009ad5c41b1c14b72439792a3d7ccb7b2664 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.18  2001/12/19 14:46:26  morsch
+Add possibility to disable StepManager() for each module separately.
+
 Revision 1.17  2001/08/29 14:28:33  morsch
 Use visibility flags -1 and 3 instead of 0 and 1.
 
@@ -79,35 +82,45 @@ Introduction of the Copyright and cvs Log
 
 ClassImp(AliModule)
  
-//_____________________________________________________________________________
-AliModule::AliModule()
+//_______________________________________________________________________
+AliModule::AliModule():
+  fEuclidMaterial(""),
+  fEuclidGeometry(""),
+  fIdtmed(0),
+  fIdmate(0),
+  fLoMedium(0),
+  fHiMedium(0),
+  fActive(0),
+  fHistograms(0),
+  fNodes(0),
+  fDebug(0),
+  fEnable(1)
 {
   //
   // Default constructor for the AliModule class
   //
-  fHistograms = 0;
-  fNodes      = 0;
-  fIdtmed     = 0;
-  fIdmate     = 0;
-  fDebug      = 0;
-  fEnable     = 1;
 }
  
-//_____________________________________________________________________________
-AliModule::AliModule(const char* name,const char *title):TNamed(name,title)
+//_______________________________________________________________________
+AliModule::AliModule(const char* name,const char *title):
+  TNamed(name,title),
+  fEuclidMaterial(""),
+  fEuclidGeometry(""),
+  fIdtmed(new TArrayI(100)),
+  fIdmate(new TArrayI(100)),
+  fLoMedium(65536),
+  fHiMedium(0),
+  fActive(0),
+  fHistograms(new TList()),
+  fNodes(new TList()),
+  fDebug(0),
+  fEnable(1)
 {
   //
   // Normal constructor invoked by all Modules.
   // Create the list for Module specific histograms
   // Add this Module to the global list of Modules in Run.
   //
-  //
-  // Initialises the histogram list
-  fHistograms = new TList();
-  //
-  // Initialises the list of ROOT TNodes
-  fNodes      = new TList();
-  //  
   // Get the Module numeric ID
   Int_t id = gAlice->GetModuleID(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<TNode*>(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<TNode*>(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)
 {
   //                                                                     
index abc58146c7ee56ec49a8ffab002a4937cc2fb413..2829ca884978650c520e982045022fe7a8913bbb 100644 (file)
@@ -5,12 +5,14 @@
 
 /* $Id$ */
 
-#include "TNamed.h"
+#include "Riostream.h"
+
 #include "TAttLine.h"
 #include "TAttMarker.h"
+#include "TNamed.h"
+
 #include "AliRndm.h"
 
-//#include <TSystem.h>
 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)
index 54838004f615518a8af7ffcbf232a929b05daa44..51c61a6ff046cc5cbf05bc7c520270293e3d32c8 100644 (file)
@@ -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<TPolyMarker3D&>(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<AliDetector*>(next()))) {
     if (!detector->IsActive()) continue;
     points = detector->Points();
     if (!points) continue;
     ntracks = points->GetEntriesFast();
     for (track=0;track<ntracks;track++) {
-      pm = (AliPoints*)points->UncheckedAt(track);
+      pm = dynamic_cast<AliPoints*>(points->UncheckedAt(track));
       if (!pm) continue;
       if (fIndex == pm->GetIndex()) {
        pm->SetMarkerColor(GetMarkerColor());
index 0c1ff01e2b045c94a8a66acda015430c7207000b..69f1b0bd3799d812e393434ec116aa6749fd1d98 100644 (file)
@@ -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)
 };
index a94551d9455dc2dacf9af915607781f6c0ae8020..d6dd12df86bfc318e1390bc4d17c9cbcaa14c82f 100644 (file)
@@ -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<TObject&>(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
 {
index eecb226efd0ca8f21581500d0d7c707d8038fbf6..b75cd2d0f607eaa4928aba432a0019f9c91168ec 100644 (file)
@@ -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 
index 63a535f496c6c63d893631bdb5f2cf3fb0eb524a..f36663016e1a355bc3c4daca54da9d9218141570 100644 (file)
@@ -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
index f4d9396a13316e9afa8b89ae1c4c68be04e52f9c..75ad8a0713f823d8fd567a10100441e33cbc70d7 100644 (file)
@@ -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
 };
index 6d495aa69fad302931c6a4d92f27d8574c62b490..cac1d6adb5e137136f0dd13f669060066456758c 100644 (file)
@@ -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<UInt_t>(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<AliModule*>(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<AliModule*>(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<AliModule*>(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<AliModule*>(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<AliModule*>(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<Float_t>(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<AliModule*>(fModules->FindObject(name));
 }
  
-//_____________________________________________________________________________
+//_______________________________________________________________________
 AliDetector *AliRun::GetDetector(const char *name) const
 {
   //
   // Return pointer to detector from name
   //
-  return (AliDetector*)fModules->FindObject(name);
+  return dynamic_cast<AliDetector*>(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<TTree*>(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<TTree*>(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<TString>(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<TTree*>(fTreeDFile->Get(treeName));
   } else {
-    fTreeD = (TTree*)file->Get(treeName);
+    fTreeD = dynamic_cast<TTree*>(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<TTree*>(fTreeSFile->Get(treeName));
   } else {
-    fTreeS = (TTree*)gDirectory->Get(treeName);
+    fTreeS = dynamic_cast<TTree*>(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<TTree*>(fTreeRFile->Get(treeName));
   } else {
-    fTreeR = (TTree*)gDirectory->Get(treeName);
+    fTreeR = dynamic_cast<TTree*>(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<AliModule*>(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<TGeometry*>(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<AliModule*>(next()))) {
     TList *dnodes=detector->Nodes();
     Int_t j;
     TNode *node, *node1;
     for ( j=0; j<dnodes->GetSize(); j++) {
-      node = (TNode*) dnodes->At(j);
+      node = dynamic_cast<TNode*>(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<fNdets;kz++) {
     // If detector is defined
-    if((det=(AliModule*) dets[kz])) {
+    if((det=dynamic_cast<AliModule*>(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<fNdets-i*6?6:fNdets-i*6);k++) {
       ind=i*6+k;
-      det=(AliModule*)dets[ind];
+      det=dynamic_cast<AliModule*>(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<TFolder *>(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<TBranch*>(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<AliModule*>(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<AliModule*>(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<AliModule*>(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<AliModule*>(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<AliModule*>(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<AliModule*>(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<AliModule*>(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<Int_t>(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<AliDetector*>(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<AliModule*>(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<AliModule*>(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<AliModule*>(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<AliModule*>(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<AliModule*>(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<AliModule*>(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<TTree*>(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<TString>(file->GetName());
   cout<<" Current tree file name: "<<curfilname<<endl;
   cout<<"Pointer: "<<file<<endl;
   cout<<" Tree S File name: "<<fTreeSFileName<<endl;
@@ -2218,7 +2283,7 @@ void AliRun::PrintTreeFile()
   cout<<"Pointer: "<<fTreeRFile<<endl<<endl;
   cout<<"===================================================\n";
 }
-//___________________________________________________________________________
+//_______________________________________________________________________
 void AliRun::CloseTreeFile(Option_t *option)
 {
   // 
@@ -2265,7 +2330,7 @@ void AliRun::CloseTreeFile(Option_t *option)
   }
 }
 
-//___________________________________________________________________________
+//_______________________________________________________________________
 void AliRun::MakeTree(Option_t *option, TFile *file)
 {
   //
index b7ae0a7f410f641c018290f6806b06e6a74a7f5e..8dfe4c114178bacd52e8c304f5db86df2f51471b 100644 (file)
@@ -5,36 +5,35 @@
 
 /* $Id$ */
 
-class TBrowser;
-class TList;
-class TTree;
-class TBranch;
-class TGeometry;
-class TDatabasePDG;
-class TRandom;
-class TParticle;
-class TFile;
-#include <TArrayI.h>
-#include "TClonesArray.h"
+#include <TClonesArray.h>
 #include <TArrayF.h>
+#include <TArrayI.h>
 #include <TStopwatch.h>
 #include <TVirtualMCApplication.h>
+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;
index 2b28e3406be86d87ffa0ad8d2f551b63cb374188..4bc41fc50af5b3c7111a61b6409731ad22297762 100644 (file)
@@ -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;i<kMaxStreamsToMerge;i++) {
     fArrayTreeS[i]=fArrayTreeH[i]=fArrayTreeTPCS[i]=fArrayTreeTRDS[i]=NULL;
     fInputFiles[i]=0;
   }
-  fCombi = 0;
+}
 
+//_______________________________________________________________________
+AliRunDigitizer::AliRunDigitizer(const AliRunDigitizer& dig):
+  TTask(dig),
+  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)
+{
+  //
+  // Copy ctor
+  //
+  dig.Copy(*this);
 }
 
-////////////////////////////////////////////////////////////////////////
-AliRunDigitizer::AliRunDigitizer(Int_t nInputStreams, Int_t sperb) : TTask("AliRunDigitizer","The manager for Merging")
+//_______________________________________________________________________
+void AliRunDigitizer::Copy(AliRunDigitizer&) const
 {
-// ctor which should be used to create a manager for merging/digitization
+  Fatal("Copy","Not installed\n");
+}
+
+
+//_______________________________________________________________________
+AliRunDigitizer::AliRunDigitizer(Int_t nInputStreams, Int_t sperb):
+  TTask("AliRunDigitizer","The manager for Merging"),
+  fkMASKSTEP(10000000),
+  fOutputFileName(""),
+  fOutputDirName("."),
+  fOutput(0),
+  fEvent(0),
+  fNrOfEventsToWrite(-1),
+  fNrOfEventsWritten(0),
+  fCopyTreesFromInput(-1),
+  fTreeD(0),
+  fTreeDTPC(0),
+  fTreeDTRD(0),
+  fTreeR(0),
+  fNinputs(nInputStreams),
+  fNinputsGiven(0),
+  fInputStreams(new TClonesArray("AliStream",nInputStreams)),
+  fTreeDTPCBaseName("TreeD_75x40_100x60_150x60_"),
+  fTreeTPCSBaseName("TreeS_75x40_100x60_150x60_"),
+  fCombi(new AliMergeCombi(nInputStreams,sperb)),
+  fCombination(kMaxStreamsToMerge),
+  fCombinationFileName(0),
+  fDebug(0)
+{
+  //
+  // ctor which should be used to create a manager for merging/digitization
+  //
   if (nInputStreams == 0) {
     Error("AliRunDigitizer","Specify nr of input streams");
     return;
   }
-  Int_t i;
-  fNinputs = nInputStreams;
-  fOutputFileName = "";
-  fOutputDirName = ".";
-  fCombination.Set(kMaxStreamsToMerge);
-  for (i=0;i<kMaxStreamsToMerge;i++) {
+  for (Int_t i=0;i<kMaxStreamsToMerge;i++) {
     fArrayTreeS[i]=fArrayTreeH[i]=fArrayTreeTPCS[i]=fArrayTreeTRDS[i]=NULL;
     fCombination[i]=-1;
   }
-  fkMASKSTEP = 10000000;
   fkMASK[0] = 0;
-  for (i=1;i<kMaxStreamsToMerge;i++) {
+  for (Int_t i=1;i<kMaxStreamsToMerge;i++) {
     fkMASK[i] = fkMASK[i-1] + fkMASKSTEP;
   }
-  fInputStreams = new TClonesArray("AliStream",nInputStreams);
+
   TClonesArray &lInputStreams = *fInputStreams;
 // the first Input is open RW to be output as well
   new(lInputStreams[0]) AliStream("UPDATE");
-  for (i=1;i<nInputStreams;i++) {
+  for (Int_t i=1;i<nInputStreams;i++) {
     new(lInputStreams[i]) AliStream("READ");
   }
-  fOutput = 0;
-  fEvent = 0;
-  fNrOfEventsToWrite = -1;
-  fNrOfEventsWritten = 0;
-  fCopyTreesFromInput = -1;
-  fCombi = new AliMergeCombi(nInputStreams,sperb);
-  fDebug = 0;
-  fTreeD = 0;
-  fTreeR = 0;
-  fTreeDTPC = 0;
-  fTreeDTRD = 0;
-  fTreeDTPCBaseName = "TreeD_75x40_100x60_150x60_";
-  fTreeTPCSBaseName = "TreeS_75x40_100x60_150x60_";
-
-  for (i=0; i<kMaxStreamsToMerge; i++) fInputFiles[i]=0;
-}
 
-////////////////////////////////////////////////////////////////////////
+  for (Int_t i=0; i<kMaxStreamsToMerge; i++) fInputFiles[i]=0;
+}
 
+//_______________________________________________________________________
 AliRunDigitizer::~AliRunDigitizer() {
 // dtor
 
@@ -245,23 +303,18 @@ AliRunDigitizer::~AliRunDigitizer() {
   if (GetListOfTasks()) 
     GetListOfTasks()->Clear("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<AliStream*>(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;
 }
-////////////////////////////////////////////////////////////////////////
index 95e5de5a2312ce4497899e2fad33bef324a9a005..e4e562c9fbee36a9abed8cd2710d2203a4bbb445 100644 (file)
 ////////////////////////////////////////////////////////////////////////
 
 // --- 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)
index c89747c9d95c1629bb5d62c6c02357d00fda6d13..83e56f4ea0ef5b85f6f451a972d5b13cc7e1332f 100644 (file)
@@ -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;
index 3a5449b47eb4444616b64eb93940f73a1ab14d84..d2c1e8214169fedfc33636c1edb16015ce64d1e4 100644 (file)
@@ -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<TParticle*>(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<TParticle*>(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<TParticle*>(particles.At(fHgwmk+1));
   particles.At(part->GetFirstMother())->ResetBit(kDaughtersBit);
   // Second pass, build map between old and new numbering
   for(i=fHgwmk+1; i<fNtrack; i++) {
@@ -415,7 +443,7 @@ void AliStack::PurifyKine()
       map[i]=nkeep;
       // If old and new are different, have to move the pointer
       if(i!=nkeep) particles[nkeep]=particles.At(i);
-      part = (TParticle*) particles.At(nkeep);
+      part = dynamic_cast<TParticle*>(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<nkeep; i++) {
-    part = (TParticle *)particles.At(i);
+    part = dynamic_cast<TParticle*>(particles.At(i));
     parent = part->GetFirstMother();
     if(parent>=0) {
-      father = (TParticle *)particles.At(parent);
+      father = dynamic_cast<TParticle*>(particles.At(parent));
       if(father->TestBit(kDaughtersBit)) {
       
        if(i<father->GetFirstDaughter()) 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<TCollection*>(next()))) {
     TIter nexthit(hitList);
     AliHit *hit;
-    while((hit = (AliHit*)nexthit())) {
+    while((hit = dynamic_cast<AliHit*>(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<AliModule*>(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; i<nkeep; ++i) {
-     fParticleBuffer = (TParticle*) particles.At(i);
-     fParticleFileMap[i]=(Int_t) fTreeK->GetEntries();
+     fParticleBuffer = dynamic_cast<TParticle*>(particles.At(i));
+     fParticleFileMap[i]=static_cast<Int_t>(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<TParticle*>(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; i<fHgwmk+1; ++i) 
     if((part=fParticleMap->At(i))) {
-      fParticleBuffer = (TParticle*) part;
-      fParticleFileMap[i]= (Int_t) fTreeK->GetEntries();
+      fParticleBuffer = dynamic_cast<TParticle*>(part);
+      fParticleFileMap[i]= static_cast<Int_t>(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<TParticle*>(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<TParticle *>((*fParticleMap)[i]);
+  return dynamic_cast<TParticle*>(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<TParticle*>((*fParticleMap)[i])->Print();
+  dynamic_cast<TParticle*>(fParticleMap->At(i))->Print();
 }
 
 //_____________________________________________________________________________
@@ -781,7 +809,7 @@ void AliStack::DumpLoadedStack() const
         "\n\n=======================================================================\n");
   for (Int_t i=0;i<fNtrack;i++) 
     {
-      TParticle* particle = (TParticle*) particles[i];
+      TParticle* particle = dynamic_cast<TParticle*>(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<fHgwmk+1; i++) {
-    part = (TParticle *)particles.At(i);
+    part = dynamic_cast<TParticle*>(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<TParticle*>(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<TParticle*>(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<TTree*>(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<Int_t>(fTreeK->GetEntries());
     ResetArrays(size);
     return kTRUE;
 }
index 21b6c6405c4fcdb3d6c0beb8132820bd5f883759..903278b0c3686b6f2d8605c7fafdaa1fdddb2e00 100644 (file)
@@ -5,28 +5,29 @@
 
 /* $Id$ */
 
-#include <TObject.h>
 #include <TArrayI.h>
+#include <TMCProcess.h>
+#include <TObject.h>
 #include <TStopwatch.h>
 #include <TVirtualMCStack.h>
-#include <TMCProcess.h>
 
-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
index d7ca520a4c15b4e0f4dc86dd926e2bde351e1f82..3d9d8b63baa83b26baf980fc3c6813e6ba85377f 100644 (file)
@@ -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 <Riostream.h>
 
-#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<TObjString*>(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<TFile*>(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<TTree *>(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<AliRun*>(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;
 }
-////////////////////////////////////////////////////////////////////////
+
index 426e9d44fe7ce9ceee126ae338d1751b155dca5a..3969cf62c2778d6134a157659e464270154b23f3 100644 (file)
 
 // --- 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;
index 147579fba329bf25ddeb12c9adaea2163b322800..8ad47a03abb1ec32e8cf19542d52fe85ba0e02c6 100644 (file)
@@ -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 "<<label<<" out of range, fSize = "<<fSize<<endl;
     return kOutOfBounds;
   }
   return fArray[label];
 }
-////////////////////////////////////////////////////////////////////////
+
+//_______________________________________________________________________
 void AliTrackMap::SetEventNr(Int_t eventNr) 
 {
-//
-// map is identified by it's name, event number is part of it
-//
+  //
+  // map is identified by it's name, event number is part of it
+  //
   char name[20];
   sprintf(name,"AliTrackMap_%5.5d",eventNr);
   SetName(name);  
 }
-////////////////////////////////////////////////////////////////////////
-void AliTrackMap::PrintValues() 
+
+//_______________________________________________________________________
+void AliTrackMap::PrintValues() const
 {
-//
-// method for debugging
-//
+  //
+  // method for debugging
+  //
   cout<<this->GetName()<<" contains these values: "<<endl;
   for (Int_t i = 0; i < fSize; i++) {
     cout<<i<<"\t"<<fArray[i]<<"\n";
   }
 }
-////////////////////////////////////////////////////////////////////////
+
index 6f30b787b02af99b7d2d250bdb191d86822ca32f..c49052ebaae912ac07c22034770c965318e20587 100644 (file)
@@ -26,15 +26,19 @@ class AliTrackMap: public TNamed {
 public:
   AliTrackMap();
   AliTrackMap(Int_t size, Int_t *array);
+  AliTrackMap(const AliTrackMap& trm);
+  AliTrackMap& operator=(const AliTrackMap& trm)
+    {trm.Copy(*this); return(*this);}
   ~AliTrackMap();
-  Int_t At(Int_t label);
-  Int_t Size(){return fSize;}
+  Int_t At(Int_t label) const;
+  Int_t Size() const {return fSize;}
   void SetEventNr(Int_t eventNr);
-  void PrintValues();
+  void PrintValues() const;
 
 private:
-  Int_t fSize;             // size of the array
+  void Copy(AliTrackMap &trm) const;
 
+  Int_t fSize;             // size of the array
   Int_t *fArray;           //[fSize] actual map
 
   ClassDef(AliTrackMap,1)  // connection between track label and TreeH indeces
index 1ab5fa62c13c342eb999c4afa5c3e497e84264d6..ee8e4f6dc38204f58b4f97f6db27d719d85f11d7 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.4  2002/10/22 15:02:15  alibrary
+Introducing Riostream.h
+
 Revision 1.3  2002/10/14 14:57:33  hristov
 Merging the VirtualMC branch to the main development branch (HEAD)
 
@@ -55,34 +58,44 @@ Classes to create and store tracks maps - correcpondence between track label and
 
 ClassImp(AliTrackMapper)
 
-////////////////////////////////////////////////////////////////////////
+//_______________________________________________________________________
+AliTrackMapper::AliTrackMapper(): 
+  fDEBUG(0)
+{
+  //
+  // Default ctor
+  //
+}
+
+
+//_______________________________________________________________________
 void AliTrackMapper::CreateMap(Int_t nEvents, Int_t firstEventNr,
-                           const char* fnMap, const char* fnHits)
+                               const char* fnMap, const char* fnHits)
 {
-//
-// method to create a track map for a given number of events starting 
-// from event firstEventNr. This method just opens and closes files and
-// loops over events, the creation of map is delegated to 
-// CreateMap(Int_t eventNr, TFile* fileMap) method
-//
+  //
+  // method to create a track map for a given number of events starting 
+  // from event firstEventNr. This method just opens and closes files and
+  // loops over events, the creation of map is delegated to 
+  // CreateMap(Int_t eventNr, TFile* fileMap) method
+  //
   TStopwatch timer;
   timer.Start();
   
   TFile *fileMap=TFile::Open(fnMap,"new");
   if (!fileMap->IsOpen()) {cerr<<"Can't open output file "<<fnMap<<"!\n"; return;}
-
+  
   TFile *fileHits=TFile::Open(fnHits);
   if (!fileHits->IsOpen()) {cerr<<"Can't open input file "<<fnHits<<"!\n"; return;}
-  if (!(gAlice=(AliRun*)fileHits->Get("gAlice"))) {
+  if (!(gAlice=dynamic_cast<AliRun*>(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 = "<<nGenPrimPlusSecParticles<<endl;
   if (nGenPrimPlusSecParticles < 1) {
@@ -124,7 +137,6 @@ Int_t  AliTrackMapper::CreateMap(Int_t eventNr, TFile* fileMap) {
   Int_t treeHEntries = static_cast<Int_t>(treeH->GetEntries());
   if (fDEBUG > 1) cout<<"treeHEntries "<<treeHEntries<<endl;
 
-
   TObjArray *modules = gAlice->Detectors();
   if (!modules) {
     cerr<<"TObjArray with modules not found."<<endl;
@@ -138,12 +150,12 @@ Int_t  AliTrackMapper::CreateMap(Int_t eventNr, TFile* fileMap) {
     for (Int_t iModule = 0; iModule < nModules; iModule++) {
       AliDetector * detector = dynamic_cast<AliDetector*>(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<AliHit*>(detector->FirstHit(-1));
       Int_t lastLabel=-1, label;
-      for( ; hit; hit=(AliHit*)detector->NextHit() ) {
+      for( ; hit; hit=dynamic_cast<AliHit*>(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 "<<fnMap<<" with map!\n"; return 0;}
   char mapName[20];
   sprintf(mapName,"AliTrackMap_%5.5d",eventNr);
-  AliTrackMap* trackMapObject = (AliTrackMap*)fileMap->Get(mapName);
+  AliTrackMap* trackMapObject = dynamic_cast<AliTrackMap*>(fileMap->Get(mapName));
   if (!trackMapObject) {
     cerr<<"Error: map named "<<mapName<<" not found."<<endl;
     return 0;
   }
   return trackMapObject;
 }
-////////////////////////////////////////////////////////////////////////
+
+//_______________________________________________________________________
 void AliTrackMapper::CheckTrackMap(Int_t eventNr, const char* fnMap) {
-//
-// 
-//
+  //
+  // 
+  //
   TFile *fileMap;
   AliTrackMap* trackMapObject = LoadTrackMap(eventNr, fnMap, fileMap);
   if (!trackMapObject) return;
-
+  
   trackMapObject->PrintValues();
-
+  
   delete trackMapObject;
   fileMap->Close();
   delete fileMap;
 }
-////////////////////////////////////////////////////////////////////////
 
index ddec808bb00fb2d05b1fd4ae5eb1148ceb530a04..1d5fb723dd61310fbfc527ccc22b76a6411b807a 100644 (file)
@@ -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");
index b5179ea64b1640a6b02d1131e5ee2cac6a21142e..c8acc831774e845a059fd678cc6d112180fa8e49 100644 (file)
 
 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.;
 }