]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVGEN/AliGenGeVSim.cxx
Changes for Root6 (Mikolaj)
[u/mrichter/AliRoot.git] / EVGEN / AliGenGeVSim.cxx
index 8cb425ba7451ef7cb5934580d66ecf0ae240b5f4..b22b588083351cdba35f8c39ee2f4a3879bbdd75 100644 (file)
@@ -63,7 +63,7 @@
 //
 ////////////////////////////////////////////////////////////////////////////////
 
-
+#include <RVersion.h>
 #include <Riostream.h>
 #include <TCanvas.h>
 #include <TF1.h>
@@ -84,6 +84,8 @@
 #include "AliRun.h"
 
 
+using std::cout;
+using std::endl;
 ClassImp(AliGenGeVSim)
 
 //////////////////////////////////////////////////////////////////////////////////
@@ -144,7 +146,7 @@ AliGenGeVSim::AliGenGeVSim(Float_t psi, Bool_t isMultTotal)
   // checking consistancy
   
   if (psi < 0 || psi > 360 ) 
-    Error ("AliGenGeVSim", "Reaction plane angle ( %d )out of range [0..360]", psi);
+    Error ("AliGenGeVSim", "Reaction plane angle ( %13.3f )out of range [0..360]", psi);
 
   fPsi = psi * TMath::Pi() / 180. ;
   fIsMultTotal = isMultTotal;
@@ -426,8 +428,8 @@ Float_t AliGenGeVSim::FindScaler(Int_t paramId, Int_t pdg) {
       
       form = 0;
       
-      if (i == 0) sprintf(buffer, patt1, params[paramId], ending[j]);      
-      else sprintf(buffer, patt2, pdg, params[paramId], ending[j]);
+      if (i == 0) snprintf(buffer, 80, patt1, params[paramId], ending[j]);      
+      else snprintf(buffer, 80, patt2, pdg, params[paramId], ending[j]);
       
       form = (TF1 *)gROOT->GetFunction(buffer);
 
@@ -566,8 +568,13 @@ void AliGenGeVSim::SetFormula(Int_t pdg) {
 
   // standard models
 
+#if ROOT_VERSION_CODE >= ROOT_VERSION(5,99,0)
+  if (fModel == 1) fCurrentForm = fPtFormula->GetFormula();
+  if (fModel > 1 && fModel < 5) fCurrentForm = fPtYFormula[fModel-2]->GetFormula();
+#else
   if (fModel == 1) fCurrentForm = fPtFormula;
   if (fModel > 1 && fModel < 5) fCurrentForm = fPtYFormula[fModel-2];
+#endif
 
 
   // custom model defined by a formula 
@@ -575,12 +582,22 @@ void AliGenGeVSim::SetFormula(Int_t pdg) {
   if (fModel == 5) {
     
     fCurrentForm = 0;
+#if ROOT_VERSION_CODE >= ROOT_VERSION(5,99,0)
+    TF2* tmpTF2 = (TF2*)gROOT->GetFunction(pattern[0]);
+    if (tmpTF2) fCurrentForm = tmpTF2->GetFormula();
+#else
     fCurrentForm = (TF2*)gROOT->GetFunction(pattern[0]);
+#endif
     
     if (!fCurrentForm) {
 
-      sprintf(buff, pattern[1], pdg);
+      snprintf(buff, 40, pattern[1], pdg);
+#if ROOT_VERSION_CODE >= ROOT_VERSION(5,99,0)
+      tmpTF2 = (TF2*)gROOT->GetFunction(buff);
+      if (tmpTF2) fCurrentForm = tmpTF2->GetFormula();
+#else
       fCurrentForm = (TF2*)gROOT->GetFunction(buff);
+#endif
 
       if (!fCurrentForm) Error(where, msg[0], pdg);
     }
@@ -597,7 +614,7 @@ void AliGenGeVSim::SetFormula(Int_t pdg) {
       
       if (!fHist[i]) {
        
-       sprintf(buff, pattern[3+2*i], pdg);
+       snprintf(buff, 40, pattern[3+2*i], pdg);
        fHist[i] = (TH1D*)gROOT->FindObject(buff);
        
        if (!fHist[i]) Error(where, msg[1+i], pdg);
@@ -614,7 +631,7 @@ void AliGenGeVSim::SetFormula(Int_t pdg) {
     
     if (!fPtYHist) {
       
-      sprintf(buff, pattern[7], pdg);
+      snprintf(buff, 40, pattern[7], pdg);
       fPtYHist = (TH2D*)gROOT->FindObject(buff);
     }
 
@@ -756,7 +773,7 @@ void AliGenGeVSim::Generate() {
   orgin[0] = fVertex[0];
   orgin[1] = fVertex[1];
   orgin[2] = fVertex[2];
-
+  time = fTime;
 
   // Particle params database
 
@@ -881,6 +898,7 @@ void AliGenGeVSim::Generate() {
   TArrayF eventVertex(3,orgin);
 
   header->SetPrimaryVertex(eventVertex);
+  header->SetInteractionTime(time);
   header->SetEventPlane(fPsi);
   header->SetEllipticFlow(fPhiFormula->GetParameter(2));