]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TTherminator/TTherminator.cxx
add OCDB for truncated mean (Xianguo)
[u/mrichter/AliRoot.git] / TTherminator / TTherminator.cxx
index e256eb997234cdf5e3a48a4ff1f56b63609ca230..d034ddfa4fe1326f4c8bef82987f3b4368d78985 100644 (file)
@@ -35,6 +35,7 @@
 #include <TDatabasePDG.h>
 #include <TParticle.h>
 #include <TClonesArray.h>
+#include <TClass.h>
 
 ReadPar *sRPInstance;
 STR      sRPFileName;
@@ -55,13 +56,32 @@ TTherminator::TTherminator():
   fPartDB = new ParticleDB();
 }
 TTherminator::TTherminator(const TTherminator & therm) :
+  TGenerator(therm), 
   fCalka(0),
   fEvent(0),
   fPartDB(0)
 {
   // Copy constructor
+  //  fPartDB = new ParticleDB();
+  if (fCalka) delete fCalka;
+  fCalka = new Integrator(*therm.fCalka);
+  if (fEvent) delete fEvent;
+  fEvent = new Event(*therm.fEvent);
+  if (fPartDB) delete fPartDB;
   fPartDB = new ParticleDB();
 }
+TTherminator& TTherminator::operator=(const TTherminator & therm)
+{
+  if (this != &therm) {
+    fCalka = therm.fCalka;
+    fEvent = therm.fEvent;
+    delete fPartDB;
+    fPartDB = new ParticleDB();
+  }
+
+  return *this;
+}
+
 TTherminator::~TTherminator()
 {
   // Destructor
@@ -119,6 +139,7 @@ void TTherminator::ReadParameters()
       exit(0);
     }
     sIntegrateSample = atoi(sRPInstance->getPar("NumberOfIntegrateSamples").Data());
+    fInputDir = sRPInstance->getPar("InputDirSHARE");
   }
   catch (STR tError) {
     PRINT_DEBUG_1("RunBFPW::ReadParameters - Caught exception " << tError);
@@ -157,7 +178,9 @@ void        TTherminator::Initialize(){
   TParticlePDG *tParticleType;
 
   //  AliWarning(Form("Reading particle types from particles.data"));
-  ifstream in("particles.data");
+
+  ifstream in((fInputDir+"/"+"particles.data").Data());
+  //  ifstream in("particles.data");
   
   int charge;
     
@@ -199,6 +222,8 @@ void        TTherminator::Initialize(){
        }
       in.close();
     }
+
+  delete tParser;
 }
 
 void        TTherminator::GenerateEvent()
@@ -218,16 +243,18 @@ void        TTherminator::GenerateEvent()
     }  
 }
 
-Int_t       TTherminator::ImportParticles(TClonesArray *particles, Option_t *option)
+Int_t       TTherminator::ImportParticles(TClonesArray *particles, Option_t */*option*/)
 {
   // Import particles from a generated event into an external array
+  const double kFmToGev = 0.197327;
+
   if (particles == 0) return 0;
   TClonesArray &particlesR = *particles;
   particlesR.Clear();
   Int_t nump = 0;
   if (!fEvent) return 0;
   Int_t numpart = fEvent->GetParticleCount();
-  printf("\n TTherminator: Therminator stack contains %d particles.", numpart);
+  printf("\n TTherminator: Therminator stack contains %d particles.\n", numpart);
   for (Int_t iPart=0; iPart<numpart; iPart++) {
     Particle *tPart = fEvent->GetParticleOfCount(iPart);
     Int_t tFather;
@@ -242,19 +269,20 @@ Int_t       TTherminator::ImportParticles(TClonesArray *particles, Option_t *opt
     nump++;
     //    printf("Putting %d %d %lf %d\n", tPart->GetParticleType()->GetPDGCode(), iPart, tPart->px, tPart);
     new (particlesR[iPart]) TParticle(tPart->GetParticleType()->GetPDGCode(), tPart->HadDecayed(),
-                                     tFather, -1, -1, -1,
-                                     tPart->px, tPart->py, tPart->pz, tPart->GetEnergy() ,
-                                     tPart->rx*1.e-13, tPart->ry*1.e-13, tPart->rz*1.e-13, tPart->rt*1.e-13/300000000 
-                                     );
+                                     tFather, -1, -1, -1,
+                                     tPart->px, tPart->py, tPart->pz, tPart->GetEnergy() ,
+                                     tPart->rx*1.e-13*kFmToGev, tPart->ry*1.e-13*kFmToGev, tPart->rz*1.e-13*kFmToGev, tPart->rt*1.e-13*kFmToGev/3e10);
     particlesR[iPart]->SetUniqueID(iPart);
   }
   
   return nump;
 }
 
-TObjArray*  TTherminator::ImportParticles(Option_t *option)
+TObjArray*  TTherminator::ImportParticles(Option_t */*option*/)
 {
   // Import generated particles into an internal array
+  const double kFmToGev = 0.197327;
+
   Int_t nump = 0;
   fParticles->Clear();
   if (!fEvent) return 0;
@@ -275,8 +303,7 @@ TObjArray*  TTherminator::ImportParticles(Option_t *option)
     TParticle* p = new TParticle(tPart->GetParticleType()->GetPDGCode(), tPart->HadDecayed(),
                                 tFather, -1, -1, -1,
                                 tPart->px, tPart->py, tPart->pz, tPart->GetEnergy() ,
-                                tPart->rx*1.e-13, tPart->ry*1.e-13, tPart->rz*1.e-13, tPart->rt*1.e-13/300000000 
-                                );
+                                tPart->rx*1.e-13*kFmToGev, tPart->ry*1.e-13*kFmToGev, tPart->rz*1.e-13*kFmToGev, tPart->rt*1.e-13*kFmToGev/3e10);
     p->SetUniqueID(iPart);
     fParticles->Add(p);
   }