]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVGEN/AliGenReaderCwn.cxx
Fix for coverity (AdC)
[u/mrichter/AliRoot.git] / EVGEN / AliGenReaderCwn.cxx
index f1fbc3e3d7764cee008f6e7d04217c147368b846..08444493f7e0789384f4dea67fd403af7c8c4687 100644 (file)
  **************************************************************************/
 
 
-/*
-$Log$
-Revision 1.3  2002/10/21 09:20:51  alibrary
-Introduce Riostream.h and remove unused variables
-
-Revision 1.2  2001/11/12 14:31:00  morsch
-Memory leaks fixed. (M. Bondila)
-
-Revision 1.1  2001/11/09 09:10:46  morsch
-Realisation of AliGenReader that reads the old cwn event format.
-
-*/
+/* $Id$ */
 
 // Read the old ALICE event format based on CW-ntuples
 // http://consult.cern.ch/alice/Internal_Notes/1995/32/abstract
@@ -34,21 +23,57 @@ Realisation of AliGenReader that reads the old cwn event format.
 // Author: andreas.morsch@cern.ch
 
 #include <TFile.h>
-#include <TTree.h>
 #include <TParticle.h>
+#include <TDatabasePDG.h>
+#include <TTree.h>
+#include <TVirtualMC.h>
 
 #include "AliGenReaderCwn.h"
-#include "AliMC.h"
-ClassImp(AliGenReaderCwn);
-
 
-AliGenReaderCwn::AliGenReaderCwn() 
+ClassImp(AliGenReaderCwn)
+
+AliGenReaderCwn::AliGenReaderCwn():
+    fNcurrent(0),
+    fNparticle(0),
+    fNparticleMax(0),
+    fTreeNtuple(0),
+    fNihead(0),
+    fNrhead(0),
+    fIdpart(0),
+    fTheta(0.),
+    fPhi(0.),
+    fP(0.),
+    fE(0.)
 {
 // Default constructor
-    fNcurrent   = 0;
-    fTreeNtuple = 0;
+    Int_t i;
+    for (i = 0; i <  6; i++) fRhead[i] = 0.;
+    for (i = 0; i < 12; i++) fIhead[i] = 0;
+}
+
+
+AliGenReaderCwn::AliGenReaderCwn(const AliGenReaderCwn &reader):
+    AliGenReader(reader),
+    fNcurrent(0),
+    fNparticle(0),
+    fNparticleMax(0),
+    fTreeNtuple(0),
+    fNihead(0),
+    fNrhead(0),
+    fIdpart(0),
+    fTheta(0.),
+    fPhi(0.),
+    fP(0.),
+    fE(0.)
+{
+    // Copy constructor
+    Int_t i;
+    for (i = 0; i <  6; i++) fRhead[i] = 0.;
+    for (i = 0; i < 12; i++) fIhead[i] = 0;
+    reader.Copy(*this);
 }
 
+
 AliGenReaderCwn::~AliGenReaderCwn()
 {
     delete fTreeNtuple;
@@ -112,12 +137,12 @@ Int_t AliGenReaderCwn::NextEvent()
 
 TParticle* AliGenReaderCwn::NextParticle() 
 {
-//
+// Read next particle
 //  
     Float_t prwn;
     Float_t p[4];
 // Read the next particle
-    if (fCode == kGEANT3) fIdpart=gMC->PDGFromId(fIdpart);
+    if (fCode == kGEANT3) fIdpart=TVirtualMC::GetMC()->PDGFromId(fIdpart);
     Double_t amass = TDatabasePDG::Instance()->GetParticle(fIdpart)->Mass();
     if(fE<=amass) {
        Warning("Generate","Particle %d  E = %f mass = %f %f %f \n",
@@ -144,8 +169,18 @@ TParticle* AliGenReaderCwn::NextParticle()
 AliGenReaderCwn& AliGenReaderCwn::operator=(const  AliGenReaderCwn& rhs)
 {
 // Assignment operator
+    rhs.Copy(*this);
     return *this;
 }
 
+void AliGenReaderCwn::Copy(TObject&) const
+{
+    //
+    // Copy 
+    //
+    Fatal("Copy","Not implemented!\n");
+}
+
+