]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TUHKMgen/TUHKMgen.cxx
Coverity fixes in TUHKMgen
[u/mrichter/AliRoot.git] / TUHKMgen / TUHKMgen.cxx
index 2796f9aba66c2e183880e6c041101315c4edbc96..bd8ff34cb7f073870eeb34fb3d8c2c67cf672b07 100755 (executable)
@@ -37,6 +37,8 @@ ClassImp(TUHKMgen)
 TUHKMgen::TUHKMgen() : 
   TGenerator("UHKM","UHKM"),
   fInitialState(0x0),
+  fAllocator(),
+  fSecondariesList(),
   fNPprim(0),
   fNPsec(0),
   fHydjetParams(),
@@ -44,8 +46,8 @@ TUHKMgen::TUHKMgen() :
 {
   // default constructor setting reasonable defaults for initial parameters (central Pb+Pb at 5.5 TeV)
 
-  ParticleAllocator fAllocator;
-  List_t fSecondariesList;
+  //  ParticleAllocator fAllocator;
+  //  List_t fSecondariesList;
 
   // Set reasonable default values for LHC
   
@@ -118,9 +120,9 @@ TUHKMgen::TUHKMgen() :
   fHydjetParams.fIenglu=0;     
   fHydjetParams.fIanglu=0;  
 */
-   
-  strcpy(fParticleFilename, Form("%s/TUHKMgen/UHKM/particles.data", gSystem->Getenv("ALICE_ROOT")));
-  strcpy(fDecayFilename, Form("%s/TUHKMgen/UHKM/tabledecay.txt", gSystem->Getenv("ALICE_ROOT")));
+
+  strncpy(fParticleFilename, Form("%s/TUHKMgen/UHKM/particles.data", gSystem->Getenv("ALICE_ROOT")), 255);
+  strncpy(fDecayFilename, Form("%s/TUHKMgen/UHKM/tabledecay.txt", gSystem->Getenv("ALICE_ROOT")), 255);
   for(Int_t i=0; i<500; i++) {
     fStableFlagPDG[i] = 0;
     fStableFlagStatus[i] = kFALSE;
@@ -259,7 +261,7 @@ Int_t TUHKMgen::ImportParticles(TClonesArray *particles, const Option_t* option)
   // Function overloading the TGenerator::ImportParticles() member function.
   // The particles from the local particle list (fSecondariesList) are
   // forwarded to the TGenerator::fParticles
-
+  option = option;   // just to avoid the warning
   
 
   if(particles==0) return 0;
@@ -282,13 +284,13 @@ Int_t TUHKMgen::ImportParticles(TClonesArray *particles, const Option_t* option)
     Int_t type = it->GetType();  
       
     if (im1> -1) {
-     // particle not a primary -> set the daughter indexes for the mother particle"<< endl;
+      // particle not a primary -> set the daughter indexes for the mother particle"<< endl;
       TParticle *mother = (TParticle*) (particlesR.UncheckedAt(im1));
       mother->SetLastDaughter(nump);
       if(mother->GetFirstDaughter()==-1)
        mother->SetFirstDaughter(nump);
-    }
-      
+    } else 
+      ++numprim;
     
     new (particlesR[nump]) TParticle(it->Encoding(), type,                                             //pdg,stat
                                     im1, im2, id1, id2,                                                //m1,m2,d1,d2
@@ -327,7 +329,12 @@ void TUHKMgen::Initialize()
 
 void TUHKMgen::Print(const Option_t*) const
 {
-  cout << "TUHKMgen::Print() method not implemented yet!!" << endl;
+  cout << "**********************************************************************************" << endl;
+  cout << "* UHKM Generator interface to ROOT::TGenerator                                   *" << endl;
+  cout << "*  Documentation:                                                                *" << endl;
+  cout << "* I.P.Lokhtin, L.V.Malinina, S.V.Petrushanko, A.M.Snigirev, I.Arsene, K.Tywoniuk *" << endl;
+  cout << "*    Comput.Phys.Commun.180:779-799, 2009                                        *" << endl;
+  cout << "**********************************************************************************" << endl;
 }
 
 void TUHKMgen::GenerateEvent()
@@ -395,4 +402,3 @@ void TUHKMgen::SetAllParameters() {
   //    fInitialState->SetPDGParticleStable(fStableFlagPDG[i], fStableFlagStatus[i]);
   //  cout << "TUHKMgen::SetAllParameters() OUT" << endl;
 }
-