new production request
authorschutz <schutz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 2 Jul 2009 13:48:13 +0000 (13:48 +0000)
committerschutz <schutz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 2 Jul 2009 13:48:13 +0000 (13:48 +0000)
prod/LHC09a14/CheckESD.C [new file with mode: 0644]
prod/LHC09a14/Config.C [new file with mode: 0644]
prod/LHC09a14/JDL [new file with mode: 0644]
prod/LHC09a14/JDLPbPbGammaJet [new file with mode: 0644]
prod/LHC09a14/rec.C [new file with mode: 0644]
prod/LHC09a14/sim.C [new file with mode: 0644]
prod/LHC09a14/simrun.C [new file with mode: 0644]
prod/LHC09a14/tag.C [new file with mode: 0644]

diff --git a/prod/LHC09a14/CheckESD.C b/prod/LHC09a14/CheckESD.C
new file mode 100644 (file)
index 0000000..4bf5317
--- /dev/null
@@ -0,0 +1,694 @@
+#if !defined( __CINT__) || defined(__MAKECINT__)\r
+#include <TROOT.h>\r
+#include <TFile.h>\r
+#include <TError.h>\r
+#include <TH1.h>\r
+#include <TH2.h>\r
+#include <TF1.h>\r
+#include <TCanvas.h>\r
+#include <TVector3.h>\r
+#include <TPDGCode.h>\r
+#include <TParticle.h>\r
+\r
+#include "AliRunLoader.h"\r
+#include "AliLoader.h"\r
+#include "AliESDEvent.h"\r
+#include "AliESDv0.h"\r
+#include "AliESDcascade.h"\r
+#include "AliESDMuonTrack.h"\r
+#include "AliESDCaloCluster.h"\r
+#include "AliRun.h"\r
+#include "AliStack.h"\r
+#include "AliHeader.h"\r
+#include "AliGenEventHeader.h"\r
+#include "AliPID.h"\r
+#endif\r
+\r
+\r
+TH1F* CreateHisto(const char* name, const char* title, \r
+                 Int_t nBins, Double_t xMin, Double_t xMax,\r
+                 const char* xLabel = NULL, const char* yLabel = NULL)\r
+{\r
+// create a histogram\r
+\r
+  TH1F* result = new TH1F(name, title, nBins, xMin, xMax);\r
+  result->SetOption("E");\r
+  if (xLabel) result->GetXaxis()->SetTitle(xLabel);\r
+  if (yLabel) result->GetYaxis()->SetTitle(yLabel);\r
+  result->SetMarkerStyle(kFullCircle);\r
+  return result;\r
+}\r
+\r
+TH1F* CreateEffHisto(TH1F* hGen, TH1F* hRec)\r
+{\r
+// create an efficiency histogram\r
+\r
+  Int_t nBins = hGen->GetNbinsX();\r
+  TH1F* hEff = (TH1F*) hGen->Clone("hEff");\r
+  hEff->SetTitle("");\r
+  hEff->SetStats(kFALSE);\r
+  hEff->SetMinimum(0.);\r
+  hEff->SetMaximum(110.);\r
+  hEff->GetYaxis()->SetTitle("#epsilon [%]");\r
+\r
+  for (Int_t iBin = 0; iBin <= nBins; iBin++) {\r
+    Double_t nGen = hGen->GetBinContent(iBin);\r
+    Double_t nRec = hRec->GetBinContent(iBin);\r
+    if (nGen > 0) {\r
+      Double_t eff = nRec/nGen;\r
+      hEff->SetBinContent(iBin, 100. * eff);\r
+      Double_t error = sqrt(eff*(1.-eff) / nGen);\r
+      if (error == 0) error = 0.0001;\r
+      hEff->SetBinError(iBin, 100. * error);\r
+    } else {\r
+      hEff->SetBinContent(iBin, -100.);\r
+      hEff->SetBinError(iBin, 0);\r
+    }\r
+  }\r
+\r
+  return hEff;\r
+}\r
+\r
+Bool_t FitHisto(TH1* histo, Double_t& res, Double_t& resError)\r
+{\r
+// fit a gaussian to a histogram\r
+\r
+  static TF1* fitFunc = new TF1("fitFunc", "gaus");\r
+  fitFunc->SetLineWidth(2);\r
+  fitFunc->SetFillStyle(0);\r
+  Double_t maxFitRange = 2;\r
+\r
+  if (histo->Integral() > 50) {\r
+    Float_t mean = histo->GetMean();\r
+    Float_t rms = histo->GetRMS();\r
+    fitFunc->SetRange(mean - maxFitRange*rms, mean + maxFitRange*rms);\r
+    fitFunc->SetParameters(mean, rms);\r
+    histo->Fit(fitFunc, "QRI0");\r
+    histo->GetFunction("fitFunc")->ResetBit(1<<9);\r
+    res = TMath::Abs(fitFunc->GetParameter(2));\r
+    resError = TMath::Abs(fitFunc->GetParError(2));\r
+    return kTRUE;\r
+  }\r
+\r
+  return kFALSE;\r
+}\r
+\r
+\r
+Bool_t CheckESD(const char* gAliceFileName = "galice.root", \r
+               const char* esdFileName = "AliESDs.root")\r
+{\r
+// check the content of the ESD\r
\r
+  // check values\r
+  Int_t    checkNGenLow = 1;\r
+\r
+  Double_t checkEffLow = 0.5;\r
+  Double_t checkEffSigma = 3;\r
+  Double_t checkFakeHigh = 0.5;\r
+  Double_t checkFakeSigma = 3;\r
+\r
+  Double_t checkResPtInvHigh = 5;\r
+  Double_t checkResPtInvSigma = 3;\r
+  Double_t checkResPhiHigh = 10;\r
+  Double_t checkResPhiSigma = 3;\r
+  Double_t checkResThetaHigh = 10;\r
+  Double_t checkResThetaSigma = 3;\r
+\r
+  Double_t checkPIDEffLow = 0.5;\r
+  Double_t checkPIDEffSigma = 3;\r
+  Double_t checkResTOFHigh = 500;\r
+  Double_t checkResTOFSigma = 3;\r
+\r
+  Double_t checkPHOSNLow = 5;\r
+  Double_t checkPHOSEnergyLow = 0.3;\r
+  Double_t checkPHOSEnergyHigh = 1.0;\r
+  Double_t checkEMCALNLow = 50;\r
+  Double_t checkEMCALEnergyLow = 0.05;\r
+  Double_t checkEMCALEnergyHigh = 1.0;\r
+\r
+  Double_t checkMUONNLow = 1;\r
+  Double_t checkMUONPtLow = 0.5;\r
+  Double_t checkMUONPtHigh = 10.;\r
+\r
+  Double_t cutPtV0 = 0.3;\r
+  Double_t checkV0EffLow = 0.02;\r
+  Double_t checkV0EffSigma = 3;\r
+  Double_t cutPtCascade = 0.5;\r
+  Double_t checkCascadeEffLow = 0.01;\r
+  Double_t checkCascadeEffSigma = 3;\r
+\r
+  // open run loader and load gAlice, kinematics and header\r
+  AliRunLoader* runLoader = AliRunLoader::Open(gAliceFileName);\r
+  if (!runLoader) {\r
+    Error("CheckESD", "getting run loader from file %s failed", \r
+           gAliceFileName);\r
+    return kFALSE;\r
+  }\r
+  runLoader->LoadgAlice();\r
+  gAlice = runLoader->GetAliRun();\r
+  if (!gAlice) {\r
+    Error("CheckESD", "no galice object found");\r
+    return kFALSE;\r
+  }\r
+  runLoader->LoadKinematics();\r
+  runLoader->LoadHeader();\r
+\r
+  // open the ESD file\r
+  TFile* esdFile = TFile::Open(esdFileName);\r
+  if (!esdFile || !esdFile->IsOpen()) {\r
+    Error("CheckESD", "opening ESD file %s failed", esdFileName);\r
+    return kFALSE;\r
+  }\r
+  AliESDEvent * esd = new AliESDEvent;\r
+  TTree* tree = (TTree*) esdFile->Get("esdTree");\r
+  if (!tree) {\r
+    Error("CheckESD", "no ESD tree found");\r
+    return kFALSE;\r
+  }\r
+  esd->ReadFromTree(tree);\r
+\r
+  // efficiency and resolution histograms\r
+  Int_t nBinsPt = 15;\r
+  Float_t minPt = 0.1;\r
+  Float_t maxPt = 3.1;\r
+  TH1F* hGen = CreateHisto("hGen", "generated tracks", \r
+                          nBinsPt, minPt, maxPt, "p_{t} [GeV/c]", "N");\r
+  TH1F* hRec = CreateHisto("hRec", "reconstructed tracks", \r
+                          nBinsPt, minPt, maxPt, "p_{t} [GeV/c]", "N");\r
+  Int_t nGen = 0;\r
+  Int_t nRec = 0;\r
+  Int_t nFake = 0;\r
+\r
+  TH1F* hResPtInv = CreateHisto("hResPtInv", "", 100, -10, 10, \r
+           "(p_{t,rec}^{-1}-p_{t,sim}^{-1}) / p_{t,sim}^{-1} [%]", "N");\r
+  TH1F* hResPhi = CreateHisto("hResPhi", "", 100, -20, 20, \r
+                             "#phi_{rec}-#phi_{sim} [mrad]", "N");\r
+  TH1F* hResTheta = CreateHisto("hResTheta", "", 100, -20, 20, \r
+                               "#theta_{rec}-#theta_{sim} [mrad]", "N");\r
+\r
+  // PID\r
+  Int_t partCode[AliPID::kSPECIES] = \r
+    {kElectron, kMuonMinus, kPiPlus, kKPlus, kProton};\r
+  const char* partName[AliPID::kSPECIES+1] = \r
+    {"electron", "muon", "pion", "kaon", "proton", "other"};\r
+  Double_t partFrac[AliPID::kSPECIES] = \r
+    {0.01, 0.01, 0.85, 0.10, 0.05};\r
+  Int_t identified[AliPID::kSPECIES+1][AliPID::kSPECIES];\r
+  for (Int_t iGen = 0; iGen < AliPID::kSPECIES+1; iGen++) {\r
+    for (Int_t iRec = 0; iRec < AliPID::kSPECIES; iRec++) {\r
+      identified[iGen][iRec] = 0;\r
+    }\r
+  }\r
+  Int_t nIdentified = 0;\r
+\r
+  // dE/dx and TOF\r
+  TH2F* hDEdxRight = new TH2F("hDEdxRight", "", 300, 0, 3, 100, 0, 400);\r
+  hDEdxRight->SetStats(kFALSE);\r
+  hDEdxRight->GetXaxis()->SetTitle("p [GeV/c]");\r
+  hDEdxRight->GetYaxis()->SetTitle("dE/dx_{TPC}");\r
+  hDEdxRight->SetMarkerStyle(kFullCircle);\r
+  hDEdxRight->SetMarkerSize(0.4);\r
+  TH2F* hDEdxWrong = new TH2F("hDEdxWrong", "", 300, 0, 3, 100, 0, 400);\r
+  hDEdxWrong->SetStats(kFALSE);\r
+  hDEdxWrong->GetXaxis()->SetTitle("p [GeV/c]");\r
+  hDEdxWrong->GetYaxis()->SetTitle("dE/dx_{TPC}");\r
+  hDEdxWrong->SetMarkerStyle(kFullCircle);\r
+  hDEdxWrong->SetMarkerSize(0.4);\r
+  hDEdxWrong->SetMarkerColor(kRed);\r
+  TH1F* hResTOFRight = CreateHisto("hResTOFRight", "", 100, -1000, 1000, \r
+                                  "t_{TOF}-t_{track} [ps]", "N");\r
+  TH1F* hResTOFWrong = CreateHisto("hResTOFWrong", "", 100, -1000, 1000, \r
+                                  "t_{TOF}-t_{track} [ps]", "N");\r
+  hResTOFWrong->SetLineColor(kRed);\r
+\r
+  // calorimeters\r
+  TH1F* hEPHOS = CreateHisto("hEPHOS", "PHOS", 100, 0, 50, "E [GeV]", "N");\r
+  TH1F* hEEMCAL = CreateHisto("hEEMCAL", "EMCAL", 100, 0, 50, "E [GeV]", "N");\r
+\r
+  // muons\r
+  TH1F* hPtMUON = CreateHisto("hPtMUON", "MUON", 100, 0, 20, \r
+                             "p_{t} [GeV/c]", "N");\r
+\r
+  // V0s and cascades\r
+  TH1F* hMassK0 = CreateHisto("hMassK0", "K^{0}", 100, 0.4, 0.6, \r
+                             "M(#pi^{+}#pi^{-}) [GeV/c^{2}]", "N");\r
+  TH1F* hMassLambda = CreateHisto("hMassLambda", "#Lambda", 100, 1.0, 1.2, \r
+                                 "M(p#pi^{-}) [GeV/c^{2}]", "N");\r
+  TH1F* hMassLambdaBar = CreateHisto("hMassLambdaBar", "#bar{#Lambda}", \r
+                                    100, 1.0, 1.2, \r
+                                    "M(#bar{p}#pi^{+}) [GeV/c^{2}]", "N");\r
+  Int_t nGenV0s = 0;\r
+  Int_t nRecV0s = 0;\r
+  TH1F* hMassXi = CreateHisto("hMassXi", "#Xi", 100, 1.2, 1.5, \r
+                             "M(#Lambda#pi) [GeV/c^{2}]", "N");\r
+  TH1F* hMassOmega = CreateHisto("hMassOmega", "#Omega", 100, 1.5, 1.8, \r
+                                "M(#LambdaK) [GeV/c^{2}]", "N");\r
+  Int_t nGenCascades = 0;\r
+  Int_t nRecCascades = 0;\r
+\r
+  // loop over events\r
+  for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++) {\r
+    runLoader->GetEvent(iEvent);\r
+\r
+    // select simulated primary particles, V0s and cascades\r
+    AliStack* stack = gAlice->Stack();\r
+    Int_t nParticles = stack->GetNtrack();\r
+    TArrayF vertex(3);\r
+    runLoader->GetHeader()->GenEventHeader()->PrimaryVertex(vertex);\r
+    TObjArray selParticles;\r
+    TObjArray selV0s;\r
+    TObjArray selCascades;\r
+    for (Int_t iParticle = 0; iParticle < nParticles; iParticle++) {\r
+      TParticle* particle = stack->Particle(iParticle);\r
+      if (!particle) continue;\r
+      if (particle->Pt() < 0.001) continue;\r
+      if (TMath::Abs(particle->Eta()) > 0.9) continue;\r
+      TVector3 dVertex(particle->Vx() - vertex[0], \r
+                      particle->Vy() - vertex[1],\r
+                      particle->Vz() - vertex[2]);\r
+      if (dVertex.Mag() > 0.0001) continue;\r
+\r
+      switch (TMath::Abs(particle->GetPdgCode())) {\r
+      case kElectron:\r
+      case kMuonMinus:\r
+      case kPiPlus:\r
+      case kKPlus:\r
+      case kProton: {\r
+       if (particle->Pt() > minPt) {\r
+         selParticles.Add(particle);\r
+         nGen++;\r
+         hGen->Fill(particle->Pt());\r
+       }\r
+       break;\r
+      }\r
+      case kK0Short:\r
+      case kLambda0: {\r
+       if (particle->Pt() > cutPtV0) {\r
+         nGenV0s++;\r
+         selV0s.Add(particle);\r
+       }\r
+       break;\r
+      }\r
+      case kXiMinus:\r
+      case kOmegaMinus: {\r
+       if (particle->Pt() > cutPtCascade) {\r
+         nGenCascades++;\r
+         selCascades.Add(particle);\r
+       }\r
+       break;\r
+      }\r
+      default: break;\r
+      }\r
+    }\r
+\r
+    // get the event summary data\r
+    tree->GetEvent(iEvent);\r
+    if (!esd) {\r
+      Error("CheckESD", "no ESD object found for event %d", iEvent);\r
+      return kFALSE;\r
+    }\r
+\r
+    // loop over tracks\r
+    for (Int_t iTrack = 0; iTrack < esd->GetNumberOfTracks(); iTrack++) {\r
+      AliESDtrack* track = esd->GetTrack(iTrack);\r
+\r
+      // select tracks of selected particles\r
+      Int_t label = TMath::Abs(track->GetLabel());\r
+      if (label > stack->GetNtrack()) continue;     // background\r
+      TParticle* particle = stack->Particle(label);\r
+      if (!selParticles.Contains(particle)) continue;\r
+      if ((track->GetStatus() & AliESDtrack::kITSrefit) == 0) continue;\r
+      if (track->GetConstrainedChi2() > 1e9) continue;\r
+      selParticles.Remove(particle);   // don't count multiple tracks\r
+\r
+      nRec++;\r
+      hRec->Fill(particle->Pt());\r
+      if (track->GetLabel() < 0) nFake++;\r
+\r
+      // resolutions\r
+      hResPtInv->Fill(100. * (TMath::Abs(track->GetSigned1Pt()) - 1./particle->Pt()) * \r
+                     particle->Pt());\r
+      hResPhi->Fill(1000. * (track->Phi() - particle->Phi()));\r
+      hResTheta->Fill(1000. * (track->Theta() - particle->Theta()));\r
+\r
+      // PID\r
+      if ((track->GetStatus() & AliESDtrack::kESDpid) == 0) continue;\r
+      Int_t iGen = 5;\r
+      for (Int_t i = 0; i < AliPID::kSPECIES; i++) {\r
+       if (TMath::Abs(particle->GetPdgCode()) == partCode[i]) iGen = i;\r
+      }\r
+      Double_t probability[AliPID::kSPECIES];\r
+      track->GetESDpid(probability);\r
+      Double_t pMax = 0;\r
+      Int_t iRec = 0;\r
+      for (Int_t i = 0; i < AliPID::kSPECIES; i++) {\r
+       probability[i] *= partFrac[i];\r
+       if (probability[i] > pMax) {\r
+         pMax = probability[i];\r
+         iRec = i;\r
+       }\r
+      }\r
+      identified[iGen][iRec]++;\r
+      if (iGen == iRec) nIdentified++;\r
+\r
+      // dE/dx and TOF\r
+      Double_t time[AliPID::kSPECIES];\r
+      track->GetIntegratedTimes(time);\r
+      if (iGen == iRec) {\r
+       hDEdxRight->Fill(particle->P(), track->GetTPCsignal());\r
+        if ((track->GetStatus() & AliESDtrack::kTOFpid) != 0) {\r
+         hResTOFRight->Fill(track->GetTOFsignal() - time[iRec]);\r
+       }\r
+      } else {\r
+       hDEdxWrong->Fill(particle->P(), track->GetTPCsignal());\r
+        if ((track->GetStatus() & AliESDtrack::kTOFpid) != 0) {\r
+         hResTOFWrong->Fill(track->GetTOFsignal() - time[iRec]);\r
+       }\r
+      }\r
+    }\r
+\r
+    // loop over muon tracks\r
+    {\r
+    for (Int_t iTrack = 0; iTrack < esd->GetNumberOfMuonTracks(); iTrack++) {\r
+      AliESDMuonTrack* muonTrack = esd->GetMuonTrack(iTrack);\r
+      Double_t ptInv = TMath::Abs(muonTrack->GetInverseBendingMomentum());\r
+      if (ptInv > 0.001) {\r
+       hPtMUON->Fill(1./ptInv);\r
+      }\r
+    }\r
+    }\r
+\r
+    // loop over V0s\r
+    for (Int_t iV0 = 0; iV0 < esd->GetNumberOfV0s(); iV0++) {\r
+      AliESDv0* v0 = esd->GetV0(iV0);\r
+      if (v0->GetOnFlyStatus()) continue;\r
+      v0->ChangeMassHypothesis(kK0Short);\r
+      hMassK0->Fill(v0->GetEffMass());\r
+      v0->ChangeMassHypothesis(kLambda0);\r
+      hMassLambda->Fill(v0->GetEffMass());\r
+      v0->ChangeMassHypothesis(kLambda0Bar);\r
+      hMassLambdaBar->Fill(v0->GetEffMass());\r
+\r
+      Int_t negLabel = TMath::Abs(esd->GetTrack(v0->GetNindex())->GetLabel());\r
+      if (negLabel > stack->GetNtrack()) continue;     // background\r
+      Int_t negMother = stack->Particle(negLabel)->GetMother(0);\r
+      if (negMother < 0) continue;\r
+      Int_t posLabel = TMath::Abs(esd->GetTrack(v0->GetPindex())->GetLabel());\r
+      if (posLabel > stack->GetNtrack()) continue;     // background\r
+      Int_t posMother = stack->Particle(posLabel)->GetMother(0);\r
+      if (negMother != posMother) continue;\r
+      TParticle* particle = stack->Particle(negMother);\r
+      if (!selV0s.Contains(particle)) continue;\r
+      selV0s.Remove(particle);\r
+      nRecV0s++;\r
+    }\r
+\r
+    // loop over Cascades\r
+    for (Int_t iCascade = 0; iCascade < esd->GetNumberOfCascades(); \r
+        iCascade++) {\r
+      AliESDcascade* cascade = esd->GetCascade(iCascade);\r
+      Double_t v0q;\r
+      cascade->ChangeMassHypothesis(v0q,kXiMinus);\r
+      hMassXi->Fill(cascade->GetEffMass());\r
+      cascade->ChangeMassHypothesis(v0q,kOmegaMinus);\r
+      hMassOmega->Fill(cascade->GetEffMass());\r
+\r
+      Int_t negLabel = TMath::Abs(esd->GetTrack(cascade->GetNindex())\r
+                                 ->GetLabel());\r
+      if (negLabel > stack->GetNtrack()) continue;     // background\r
+      Int_t negMother = stack->Particle(negLabel)->GetMother(0);\r
+      if (negMother < 0) continue;\r
+      Int_t posLabel = TMath::Abs(esd->GetTrack(cascade->GetPindex())\r
+                                 ->GetLabel());\r
+      if (posLabel > stack->GetNtrack()) continue;     // background\r
+      Int_t posMother = stack->Particle(posLabel)->GetMother(0);\r
+      if (negMother != posMother) continue;\r
+      Int_t v0Mother = stack->Particle(negMother)->GetMother(0);\r
+      if (v0Mother < 0) continue;\r
+      Int_t bacLabel = TMath::Abs(esd->GetTrack(cascade->GetBindex())\r
+                                 ->GetLabel());\r
+      if (bacLabel > stack->GetNtrack()) continue;     // background\r
+      Int_t bacMother = stack->Particle(bacLabel)->GetMother(0);\r
+      if (v0Mother != bacMother) continue;\r
+      TParticle* particle = stack->Particle(v0Mother);\r
+      if (!selCascades.Contains(particle)) continue;\r
+      selCascades.Remove(particle);\r
+      nRecCascades++;\r
+    }\r
+\r
+    // loop over the clusters\r
+    {\r
+      for (Int_t iCluster=0; iCluster<esd->GetNumberOfCaloClusters(); iCluster++) {\r
+       AliESDCaloCluster * clust = esd->GetCaloCluster(iCluster);\r
+       if (clust->IsPHOS()) hEPHOS->Fill(clust->E());\r
+       if (clust->IsEMCAL()) hEEMCAL->Fill(clust->E());\r
+      }\r
+    }\r
+\r
+  }\r
+\r
+  // perform checks\r
+  if (nGen < checkNGenLow) {\r
+    Warning("CheckESD", "low number of generated particles: %d", Int_t(nGen));\r
+  }\r
+\r
+  TH1F* hEff = CreateEffHisto(hGen, hRec);\r
+\r
+  Info("CheckESD", "%d out of %d tracks reconstructed including %d "\r
+        "fake tracks", nRec, nGen, nFake);\r
+  if (nGen > 0) {\r
+    // efficiency\r
+    Double_t eff = nRec*1./nGen;\r
+    Double_t effError = TMath::Sqrt(eff*(1.-eff) / nGen);\r
+    Double_t fake = nFake*1./nGen;\r
+    Double_t fakeError = TMath::Sqrt(fake*(1.-fake) / nGen);\r
+    Info("CheckESD", "eff = (%.1f +- %.1f) %%  fake = (%.1f +- %.1f) %%",\r
+        100.*eff, 100.*effError, 100.*fake, 100.*fakeError);\r
+\r
+    if (eff < checkEffLow - checkEffSigma*effError) {\r
+      Warning("CheckESD", "low efficiency: (%.1f +- %.1f) %%", \r
+             100.*eff, 100.*effError);\r
+    }\r
+    if (fake > checkFakeHigh + checkFakeSigma*fakeError) {\r
+      Warning("CheckESD", "high fake: (%.1f +- %.1f) %%", \r
+             100.*fake, 100.*fakeError);\r
+    }\r
+\r
+    // resolutions\r
+    Double_t res, resError;\r
+    if (FitHisto(hResPtInv, res, resError)) {\r
+      Info("CheckESD", "relative inverse pt resolution = (%.1f +- %.1f) %%",\r
+          res, resError);\r
+      if (res > checkResPtInvHigh + checkResPtInvSigma*resError) {\r
+       Warning("CheckESD", "bad pt resolution: (%.1f +- %.1f) %%", \r
+               res, resError);\r
+      }\r
+    }\r
+\r
+    if (FitHisto(hResPhi, res, resError)) {\r
+      Info("CheckESD", "phi resolution = (%.1f +- %.1f) mrad", res, resError);\r
+      if (res > checkResPhiHigh + checkResPhiSigma*resError) {\r
+       Warning("CheckESD", "bad phi resolution: (%.1f +- %.1f) mrad", \r
+               res, resError);\r
+      }\r
+    }\r
+\r
+    if (FitHisto(hResTheta, res, resError)) {\r
+      Info("CheckESD", "theta resolution = (%.1f +- %.1f) mrad", \r
+          res, resError);\r
+      if (res > checkResThetaHigh + checkResThetaSigma*resError) {\r
+       Warning("CheckESD", "bad theta resolution: (%.1f +- %.1f) mrad", \r
+               res, resError);\r
+      }\r
+    }\r
+\r
+    // PID\r
+    if (nRec > 0) {\r
+      Double_t eff = nIdentified*1./nRec;\r
+      Double_t effError = TMath::Sqrt(eff*(1.-eff) / nRec);\r
+      Info("CheckESD", "PID eff = (%.1f +- %.1f) %%", \r
+          100.*eff, 100.*effError);\r
+      if (eff < checkPIDEffLow - checkPIDEffSigma*effError) {\r
+       Warning("CheckESD", "low PID efficiency: (%.1f +- %.1f) %%", \r
+               100.*eff, 100.*effError);\r
+      }\r
+    }\r
+\r
+    printf("%9s:", "gen\\rec");\r
+    for (Int_t iRec = 0; iRec < AliPID::kSPECIES; iRec++) {\r
+      printf("%9s", partName[iRec]);\r
+    }\r
+    printf("\n");\r
+    for (Int_t iGen = 0; iGen < AliPID::kSPECIES+1; iGen++) {\r
+      printf("%9s:", partName[iGen]);\r
+      for (Int_t iRec = 0; iRec < AliPID::kSPECIES; iRec++) {\r
+       printf("%9d", identified[iGen][iRec]);\r
+      }\r
+      printf("\n");\r
+    }\r
+\r
+    if (FitHisto(hResTOFRight, res, resError)) {\r
+      Info("CheckESD", "TOF resolution = (%.1f +- %.1f) ps", res, resError);\r
+      if (res > checkResTOFHigh + checkResTOFSigma*resError) {\r
+       Warning("CheckESD", "bad TOF resolution: (%.1f +- %.1f) ps", \r
+               res, resError);\r
+      }\r
+    }\r
+\r
+    // calorimeters\r
+    if (hEPHOS->Integral() < checkPHOSNLow) {\r
+      Warning("CheckESD", "low number of PHOS particles: %d", \r
+             Int_t(hEPHOS->Integral()));\r
+    } else {\r
+      Double_t mean = hEPHOS->GetMean();\r
+      if (mean < checkPHOSEnergyLow) {\r
+       Warning("CheckESD", "low mean PHOS energy: %.1f GeV", mean);\r
+      } else if (mean > checkPHOSEnergyHigh) {\r
+       Warning("CheckESD", "high mean PHOS energy: %.1f GeV", mean);\r
+      }\r
+    }\r
+\r
+    if (hEEMCAL->Integral() < checkEMCALNLow) {\r
+      Warning("CheckESD", "low number of EMCAL particles: %d", \r
+             Int_t(hEEMCAL->Integral()));\r
+    } else {\r
+      Double_t mean = hEEMCAL->GetMean();\r
+      if (mean < checkEMCALEnergyLow) {\r
+       Warning("CheckESD", "low mean EMCAL energy: %.1f GeV", mean);\r
+      } else if (mean > checkEMCALEnergyHigh) {\r
+       Warning("CheckESD", "high mean EMCAL energy: %.1f GeV", mean);\r
+      }\r
+    }\r
+\r
+    // muons\r
+    if (hPtMUON->Integral() < checkMUONNLow) {\r
+      Warning("CheckESD", "low number of MUON particles: %d", \r
+             Int_t(hPtMUON->Integral()));\r
+    } else {\r
+      Double_t mean = hPtMUON->GetMean();\r
+      if (mean < checkMUONPtLow) {\r
+       Warning("CheckESD", "low mean MUON pt: %.1f GeV/c", mean);\r
+      } else if (mean > checkMUONPtHigh) {\r
+       Warning("CheckESD", "high mean MUON pt: %.1f GeV/c", mean);\r
+      }\r
+    }\r
+\r
+    // V0s\r
+    if (nGenV0s > 0) {\r
+      Double_t eff = nRecV0s*1./nGenV0s;\r
+      Double_t effError = TMath::Sqrt(eff*(1.-eff) / nGenV0s);\r
+      if (effError == 0) effError = checkV0EffLow / TMath::Sqrt(1.*nGenV0s);\r
+      Info("CheckESD", "V0 eff = (%.1f +- %.1f) %%", \r
+          100.*eff, 100.*effError);\r
+      if (eff < checkV0EffLow - checkV0EffSigma*effError) {\r
+       Warning("CheckESD", "low V0 efficiency: (%.1f +- %.1f) %%", \r
+               100.*eff, 100.*effError);\r
+      }\r
+    }\r
+\r
+    // Cascades\r
+    if (nGenCascades > 0) {\r
+      Double_t eff = nRecCascades*1./nGenCascades;\r
+      Double_t effError = TMath::Sqrt(eff*(1.-eff) / nGenCascades);\r
+      if (effError == 0) effError = checkV0EffLow / \r
+                          TMath::Sqrt(1.*nGenCascades);\r
+      Info("CheckESD", "Cascade eff = (%.1f +- %.1f) %%", \r
+          100.*eff, 100.*effError);\r
+      if (eff < checkCascadeEffLow - checkCascadeEffSigma*effError) {\r
+       Warning("CheckESD", "low Cascade efficiency: (%.1f +- %.1f) %%", \r
+               100.*eff, 100.*effError);\r
+      }\r
+    }\r
+  }\r
+\r
+  // draw the histograms if not in batch mode\r
+  if (!gROOT->IsBatch()) {\r
+    new TCanvas;\r
+    hEff->DrawCopy();\r
+    new TCanvas;\r
+    hResPtInv->DrawCopy("E");\r
+    new TCanvas;\r
+    hResPhi->DrawCopy("E");\r
+    new TCanvas;\r
+    hResTheta->DrawCopy("E");\r
+    new TCanvas;\r
+    hDEdxRight->DrawCopy();\r
+    hDEdxWrong->DrawCopy("SAME");\r
+    new TCanvas;\r
+    hResTOFRight->DrawCopy("E");\r
+    hResTOFWrong->DrawCopy("SAME");\r
+    new TCanvas;\r
+    hEPHOS->DrawCopy("E");\r
+    new TCanvas;\r
+    hEEMCAL->DrawCopy("E");\r
+    new TCanvas;\r
+    hPtMUON->DrawCopy("E");\r
+    new TCanvas;\r
+    hMassK0->DrawCopy("E");\r
+    new TCanvas;\r
+    hMassLambda->DrawCopy("E");\r
+    new TCanvas;\r
+    hMassLambdaBar->DrawCopy("E");\r
+    new TCanvas;\r
+    hMassXi->DrawCopy("E");\r
+    new TCanvas;\r
+    hMassOmega->DrawCopy("E");\r
+  }\r
+\r
+  // write the output histograms to a file\r
+  TFile* outputFile = TFile::Open("check.root", "recreate");\r
+  if (!outputFile || !outputFile->IsOpen()) {\r
+    Error("CheckESD", "opening output file check.root failed");\r
+    return kFALSE;\r
+  }\r
+  hEff->Write();\r
+  hResPtInv->Write();\r
+  hResPhi->Write();\r
+  hResTheta->Write();\r
+  hDEdxRight->Write();\r
+  hDEdxWrong->Write();\r
+  hResTOFRight->Write();\r
+  hResTOFWrong->Write();\r
+  hEPHOS->Write();\r
+  hEEMCAL->Write();\r
+  hPtMUON->Write();\r
+  hMassK0->Write();\r
+  hMassLambda->Write();\r
+  hMassLambdaBar->Write();\r
+  hMassXi->Write();\r
+  hMassOmega->Write();\r
+  outputFile->Close();\r
+  delete outputFile;\r
+\r
+  // clean up\r
+  delete hGen;\r
+  delete hRec;\r
+  delete hEff;\r
+  delete hResPtInv;\r
+  delete hResPhi;\r
+  delete hResTheta;\r
+  delete hDEdxRight;\r
+  delete hDEdxWrong;\r
+  delete hResTOFRight;\r
+  delete hResTOFWrong;\r
+  delete hEPHOS;\r
+  delete hEEMCAL;\r
+  delete hPtMUON;\r
+  delete hMassK0;\r
+  delete hMassLambda;\r
+  delete hMassLambdaBar;\r
+  delete hMassXi;\r
+  delete hMassOmega;\r
+\r
+  delete esd;\r
+  esdFile->Close();\r
+  delete esdFile;\r
+\r
+  runLoader->UnloadHeader();\r
+  runLoader->UnloadKinematics();\r
+  delete runLoader;\r
+\r
+  // result of check\r
+  Info("CheckESD", "check of ESD was successfull");\r
+  return kTRUE;\r
+}\r
diff --git a/prod/LHC09a14/Config.C b/prod/LHC09a14/Config.C
new file mode 100644 (file)
index 0000000..a49246d
--- /dev/null
@@ -0,0 +1,1050 @@
+// One can use the configuration macro in compiled mode by
+// root [0] gSystem->Load("libgeant321");
+// root [0] gSystem->SetIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include\
+//                   -I$ALICE_ROOT -I$ALICE/geant3/TGeant3");
+// root [0] .x grun.C(1,"Config_PDC07.C++")
+
+#if !defined(__CINT__) || defined(__MAKECINT__)
+#include <Riostream.h>
+#include <TRandom.h>
+#include <TDatime.h>
+#include <TSystem.h>
+#include <TVirtualMC.h>
+#include <TGeant3TGeo.h>
+#include "EVGEN/AliGenCocktail.h"
+#include "EVGEN/AliGenParam.h"
+#include "EVGEN/AliGenMUONlib.h"
+#include "STEER/AliRunLoader.h"
+#include "STEER/AliRun.h"
+#include "STEER/AliConfig.h"
+#include "PYTHIA6/AliDecayerPythia.h"
+#include "PYTHIA6/AliGenPythia.h"
+#include "STEER/AliMagWrapCheb.h"
+#include "STRUCT/AliBODY.h"
+#include "STRUCT/AliMAG.h"
+#include "STRUCT/AliABSOv3.h"
+#include "STRUCT/AliDIPOv3.h"
+#include "STRUCT/AliHALLv3.h"
+#include "STRUCT/AliFRAMEv2.h"
+#include "STRUCT/AliSHILv3.h"
+#include "STRUCT/AliPIPEv3.h"
+#include "ITS/AliITSv11Hybrid.h"
+#include "TPC/AliTPCv2.h"
+#include "TOF/AliTOFv6T0.h"
+#include "HMPID/AliHMPIDv3.h"
+#include "ZDC/AliZDCv3.h"
+#include "TRD/AliTRDv1.h"
+#include "TRD/AliTRDgeometry.h"
+#include "FMD/AliFMDv1.h"
+#include "MUON/AliMUONv1.h"
+#include "PHOS/AliPHOSv1.h"
+#include "PHOS/AliPHOSSimParam.h"
+#include "PMD/AliPMDv1.h"
+#include "T0/AliT0v1.h"
+#include "EMCAL/AliEMCALv2.h"
+#include "ACORDE/AliACORDEv1.h"
+#include "VZERO/AliVZEROv7.h"
+#endif
+
+
+enum PDC07Proc_t
+{
+//--- Heavy Flavour Production ---
+  kCharmPbPb5500,  kCharmpPb8800,  kCharmpp14000,  kCharmpp14000wmi,
+  kD0PbPb5500,     kD0pPb8800,     kD0pp14000,
+  kDPlusPbPb5500,  kDPluspPb8800,  kDPluspp14000,
+  kBeautyPbPb5500, kBeautypPb8800, kBeautypp14000, kBeautypp14000wmi,
+  // -- Pythia Mb
+  kPyMbNoHvq, kPyOmegaPlus, kPyOmegaMinus, kPyJetJet, kBeautyppwmiJet,kPyBJetEMCAL,
+  kPyGammaJetPHOS, kPyJetJetPHOS, kPyJetJetPHOSv2, kPyGammaBremsPHOS,
+  kPyGammaJetEMCAL, kPyJetJetEMCAL, kPyGammaBremsEMCAL, kRunMax
+};
+
+const char * pprRunName[] = {
+  "kCharmPbPb5500",  "kCharmpPb8800",  "kCharmpp14000",  "kCharmpp14000wmi",
+  "kD0PbPb5500",     "kD0pPb8800",     "kD0pp14000",
+  "kDPlusPbPb5500",  "kDPluspPb8800",  "kDPluspp14000",
+  "kBeautyPbPb5500", "kBeautypPb8800", "kBeautypp14000", "kBeautypp14000wmi",
+  "kPyMbNoHvq", "kPyOmegaPlus", "kPyOmegaMinus", "kPyJetJet", "kBeautyppwmiJet", "kPyBJetEMCAL",
+  "kPyGammaJetPHOS", "kPyJetJetPHOS",  "kPyJetJetPHOSv2", "kPyGammaBremsPHOS",
+  "kPyGammaJetEMCAL", "kPyJetJetEMCAL", "kPyGammaBremsEMCAL"
+};
+
+
+//--- Decay Mode ---
+enum DecayHvFl_t
+{
+  kNature,  kHadr, kSemiEl, kSemiMu
+};
+//--- Magnetic Field ---
+enum Mag_t
+{
+  kNoField, k5kG, kFieldMax
+};
+//--- Trigger config ---
+enum TrigConf_t
+{
+    kDefaultPPTrig, kDefaultPbPbTrig
+};
+
+const char * TrigConfName[] = {
+    "p-p","Pb-Pb"
+};
+
+//--- Functions ---
+class AliGenPythia ;
+AliGenPythia *PythiaHVQ(PDC07Proc_t proc);
+AliGenPythia *PythiaHard(PDC07Proc_t proc);
+AliGenerator *MbCocktail();
+AliGenerator *PyMbTriggered(Int_t pdg);
+void ProcessEnvironmentVars();
+
+// This part for configuration
+static DecayHvFl_t   decHvFl     = kNature;
+static Mag_t         mag         = k5kG;
+static TrigConf_t    trig        = kDefaultPPTrig; // default pp trigger configuration
+static Int_t         runNumber   = 0;
+static Int_t         eventNumber = 0;
+//========================//
+// Set Random Number seed //
+//========================//
+TDatime dt;
+static UInt_t seed    = dt.Get();
+
+// nEvts = -1  : you get 1 QQbar pair and all the fragmentation and
+//               decay chain
+// nEvts = N>0 : you get N charm / beauty Hadrons
+Int_t nEvts = -1;
+// stars = kTRUE : all heavy resonances and their decay stored
+//       = kFALSE: only final heavy hadrons and their decays stored
+Bool_t stars = kTRUE;
+
+// To be used only with kCharmpp14000wmi and kBeautypp14000wmi
+// To get a "reasonable" agreement with MNR results, events have to be
+// generated with the minimum ptHard set to 2.76 GeV.
+// To get a "perfect" agreement with MNR results, events have to be
+// generated in four ptHard bins with the following relative
+// normalizations:
+//  CHARM
+// 2.76-3 GeV: 25%
+//    3-4 GeV: 40%
+//    4-8 GeV: 29%
+//     >8 GeV:  6%
+//  BEAUTY
+// 2.76-4 GeV:  5%
+//    4-6 GeV: 31%
+//    6-8 GeV: 28%
+//     >8 GeV: 36%
+
+
+Float_t eCMS=14000;
+//PDC07Proc_t proc = kPyJetJet;
+//PDC07Proc_t proc = kPyGammaJetEMCAL;
+PDC07Proc_t proc = kPyBJetEMCAL;
+Int_t nPtHardGJBins = 11;
+Int_t ptHardGJLo[] = {5 ,10,20,30,40,50,60,70,80,90 ,100};
+Int_t ptHardGJHi[] = {10,20,30,40,50,60,70,80,90,100,-1};
+Int_t nPtHardJJBins = 17;
+Int_t ptHardJJLo[] = {2 ,12,16,20,24,29,35,41,50,60,72,86 ,104,124,149,179,215};
+Int_t ptHardJJHi[] = {12,16,20,24,29,35,41,50,60,72,86,104,124,149,179,215,258};
+Float_t ptHardMin =  10.;
+Float_t ptHardMax =  20.;
+Float_t ptGammaPi0Min = 0.;
+Int_t iquenching = 0;
+Float_t qhat = 20.; //for  iquenching equal 1 and 4
+//Float_t medlength = 6.; // for iquenching equal to 4
+Int_t year = 0; //ALICE geometry configuration
+Bool_t pi0FragPhotonInDet = kFALSE ;
+
+// Comment line
+static TString comment;
+
+void Config()
+{
+
+       // Get settings from environment variables
+       ProcessEnvironmentVars();
+       
+       gSystem->Load("liblhapdf.so");      // Parton density functions
+       gSystem->Load("libEGPythia6.so");   // TGenerator interface
+       if(iquenching !=4) gSystem->Load("libpythia6.so"); // Pythia   
+       else               gSystem->Load("libqpythia.so"); // qpythia
+       gSystem->Load("libAliPythia6.so");  // ALICE specific implementations
+       
+       // libraries required by geant321
+#if defined(__CINT__)
+       gSystem->Load("liblhapdf");
+       gSystem->Load("libEGPythia6");
+       if(iquenching !=4) gSystem->Load("libpythia6.so"); // Pythia   
+       else               gSystem->Load("libqpythia.so"); // qpythia
+       gSystem->Load("libAliPythia6");
+       gSystem->Load("libgeant321");
+#endif
+       
+       new TGeant3TGeo("C++ Interface to Geant3");
+       
+       // Output every 100 tracks
+       ((TGeant3*)gMC)->SetSWIT(4,100);
+       
+       //=======================================================================
+       
+       // Run loader
+       AliRunLoader* rl=0x0;
+       rl = AliRunLoader::Open("galice.root",
+                                                       AliConfig::GetDefaultEventFolderName(),
+                                                       "recreate");
+       if (rl == 0x0)
+    {
+               gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
+               return;
+    }
+       rl->SetCompressionLevel(2);
+       rl->SetNumberOfEventsPerFile(1000);
+       gAlice->SetRunLoader(rl);
+       
+       // Set the trigger configuration
+       gAlice->SetTriggerDescriptor(TrigConfName[trig]);
+       cout<<"Trigger configuration is set to  "<<TrigConfName[trig]<<endl;
+       
+       //
+       //=======================================================================
+       // ************* STEERING parameters FOR ALICE SIMULATION **************
+       // --- Specify event type to be tracked through the ALICE setup
+       // --- All positions are in cm, angles in degrees, and P and E in GeV
+       
+       
+    gMC->SetProcess("DCAY",1);
+    gMC->SetProcess("PAIR",1);
+    gMC->SetProcess("COMP",1);
+    gMC->SetProcess("PHOT",1);
+    gMC->SetProcess("PFIS",0);
+    gMC->SetProcess("DRAY",0);
+    gMC->SetProcess("ANNI",1);
+    gMC->SetProcess("BREM",1);
+    gMC->SetProcess("MUNU",1);
+    gMC->SetProcess("CKOV",1);
+    gMC->SetProcess("HADR",1);
+    gMC->SetProcess("LOSS",2);
+    gMC->SetProcess("MULS",1);
+    gMC->SetProcess("RAYL",1);
+       
+    Float_t cut = 1.e-3;        // 1MeV cut by default
+    Float_t tofmax = 1.e10;
+       
+    gMC->SetCut("CUTGAM", cut);
+    gMC->SetCut("CUTELE", cut);
+    gMC->SetCut("CUTNEU", cut);
+    gMC->SetCut("CUTHAD", cut);
+    gMC->SetCut("CUTMUO", cut);
+    gMC->SetCut("BCUTE",  cut);
+    gMC->SetCut("BCUTM",  cut);
+    gMC->SetCut("DCUTE",  cut);
+    gMC->SetCut("DCUTM",  cut);
+    gMC->SetCut("PPCUTM", cut);
+    gMC->SetCut("TOFMAX", tofmax);
+       
+       //======================//
+       // Set External decayer //
+       //======================//
+       TVirtualMCDecayer* decayer = new AliDecayerPythia();
+       // DECAYS
+       //
+       switch(decHvFl) {
+               case kNature:
+                       decayer->SetForceDecay(kNeutralPion);
+                       break;
+               case kHadr:
+                       decayer->SetForceDecay(kHadronicD);
+                       break;
+               case kSemiEl:
+                       decayer->SetForceDecay(kSemiElectronic);
+                       break;
+               case kSemiMu:
+                       decayer->SetForceDecay(kSemiMuonic);
+                       break;
+       }
+       decayer->Init();
+       gMC->SetExternalDecayer(decayer);
+       //if(proc == kPyJetJetPHOSv2) // in this case we decay the pi0
+       //      decayer->SetForceDecay(kNeutralPion);
+       
+       //=========================//
+       // Generator Configuration //
+       //=========================//
+       AliGenPythia* gener = 0x0;
+       
+       if (proc <=   kBeautypp14000wmi) {
+               AliGenPythia *pythia = PythiaHVQ(proc);
+               // FeedDown option
+               pythia->SetFeedDownHigherFamily(kFALSE);
+               // Stack filling option
+               if(!stars) pythia->SetStackFillOpt(AliGenPythia::kParentSelection);
+               // Set Count mode
+               if(nEvts>0) pythia->SetCountMode(AliGenPythia::kCountParents);
+               //
+               // DECAYS
+               //
+               switch(decHvFl) {
+                       case kNature:
+                               pythia->SetForceDecay(kNeutralPion);
+                               break;
+                       case kHadr:
+                               pythia->SetForceDecay(kHadronicD);
+                               break;
+                       case kSemiEl:
+                               pythia->SetForceDecay(kSemiElectronic);
+                               break;
+                       case kSemiMu:
+                               pythia->SetForceDecay(kSemiMuonic);
+                               break;
+               }
+               //
+               // GEOM & KINE CUTS
+               //
+               pythia->SetMomentumRange(0,99999999);
+               pythia->SetPhiRange(0., 360.);
+               pythia->SetThetaRange(0,180);
+               switch(ycut) {
+                       case kFull:
+                               pythia->SetYRange(-12,12);
+                               break;
+                       case kBarrel:
+                               pythia->SetYRange(-2,2);
+                               break;
+                       case kMuonArm:
+                               pythia->SetYRange(1,6);
+                               break;
+               }
+               gener = pythia;
+       } else if (proc == kPyMbNoHvq) {
+               gener = MbCocktail();
+       } else if (proc == kPyOmegaMinus) {
+               gener = PyMbTriggered(3334);
+       } else if (proc == kPyOmegaPlus) {
+               gener = PyMbTriggered(-3334);
+       } else if (proc <= kPyGammaBremsEMCAL) {
+               AliGenPythia *pythia = PythiaHard(proc);
+               // FeedDown option
+               pythia->SetFeedDownHigherFamily(kFALSE);
+               // Set Count mode
+               if(nEvts>0) pythia->SetCountMode(AliGenPythia::kCountParents);
+               
+               //
+               // GEOM & KINE CUTS
+               //
+               pythia->SetMomentumRange(0,99999999);
+//             if(proc == kPyJetJetPHOSv2)
+//                     pythia->SetForceDecay(kNeutralPion);
+//             else
+//                     pythia->SetForceDecay(kAll);
+
+               pythia->SetForceDecay(kNeutralPion);
+               pythia->SetPycellParameters(2., 274, 432, 0., 4., 5., 1.0);
+               pythia->SetGluonRadiation(1,1); //ISR and FRS effects on.
+               pythia->SetPtKick(3.); // set the intrinsic kt to about 5.3 GeV/c
+               gener = pythia;
+               }
+       
+       //gener->SetTrackingFlag(1);
+
+       //Quenching
+       gener->SetQuench(iquenching);
+       Float_t k = 6e5*(qhat/1.7) ; //qhat=1.7, k = 6e5, default  value
+       if(iquenching == 1)//quenching weights
+         AliPythia::Instance()->InitQuenching(0.,0.1,k,0,0.95,6);
+       else if(iquenching == 4)//q-pythia
+         gener->SetQhat(k); //   !transport coefficient (GeV2/fm)
+
+       
+       // PRIMARY VERTEX
+       
+       gener->SetOrigin(0., 0., 0.);    // vertex position
+       
+       // Size of the interaction diamond
+       // Longitudinal
+       Float_t           sigmaz  = 7.55 / TMath::Sqrt(2.); // [cm] 14  TeV (p-p), 5.5 TeV (Pb-Pb)
+       if(eCMS == 10000) sigmaz  = 5.4  / TMath::Sqrt(2.); // [cm] 10  TeV
+       if(eCMS == 900)   sigmaz  = 10.5 / TMath::Sqrt(2.); // [cm] 0.9 TeV
+       cout<<">>> SigmaZ x srqt(2.) "<< sigmaz * TMath::Sqrt(2.) << endl;
+       
+    // Transverse
+       Float_t betast  = 10;                 // beta* [m]
+       Float_t eps     = 3.75e-6;            // emittance [m]
+       Float_t gamma   = eCMS / 2.0 / 0.938272;   // relativistic gamma [1]
+       Float_t sigmaxy = TMath::Sqrt(eps * betast / gamma) / TMath::Sqrt(2.) * 100.;  // [cm]
+       printf("\n \n Diamond size x-y: %10.3e z: %10.3e\n \n", sigmaxy, sigmaz);
+       
+       gener->SetSigma(sigmaxy, sigmaxy, sigmaz);      // Sigma in (X,Y,Z) (cm) on IP position
+       gener->SetCutVertexZ(3.);        // Truncate at 3 sigma
+       gener->SetVertexSmear(kPerEvent);
+       
+       gener->Init();
+
+
+  // FIELD
+  //
+  AliMagWrapCheb* field = 0x0;
+  if (mag == kNoField) {
+    comment = comment.Append(" | L3 field 0.0 T");
+    field = new AliMagWrapCheb("Maps","Maps", 2, 0., 10., AliMagWrapCheb::k2kG);
+  } else if (mag == k5kG) {
+    comment = comment.Append(" | L3 field 0.5 T");
+    field = new AliMagWrapCheb("Maps","Maps", 2, 1., 10., AliMagWrapCheb::k5kG,
+                              kTRUE,"$(ALICE_ROOT)/data/maps/mfchebKGI_sym.root");
+  }
+  printf("\n \n Comment: %s \n \n", comment.Data());
+
+   rl->CdGAFile();
+   gAlice->SetField(field);
+
+       
+       Int_t iABSO   = 1;
+       Int_t iACORDE = 0;
+       Int_t iDIPO   = 1;
+       Int_t iEMCAL  = 1;
+       Int_t iFMD    = 1;
+       Int_t iFRAME  = 1;
+       Int_t iHALL   = 1;
+       Int_t iITS    = 1;
+       Int_t iMAG    = 1;
+       Int_t iMUON   = 1;
+       Int_t iPHOS   = 1;
+       Int_t iPIPE   = 1;
+       Int_t iPMD    = 1;
+       Int_t iHMPID  = 1;
+       Int_t iSHIL   = 1;
+       Int_t iT0     = 1;
+       Int_t iTOF    = 1;
+       Int_t iTPC    = 1;
+       Int_t iTRD    = 1;
+       Int_t iVZERO  = 1;
+       Int_t iZDC    = 1;
+       
+       
+   //=================== Alice BODY parameters =============================
+   AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
+       
+       
+    if (iMAG)
+    {
+   //=================== MAG parameters ============================
+   // --- Start with Magnet since detector layouts may be depending ---
+   // --- on the selected Magnet dimensions ---
+         AliMAG *MAG = new AliMAG("MAG", "Magnet");
+     }
+       
+       
+    if (iABSO)
+    {
+        //=================== ABSO parameters ============================
+        AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
+    }
+       
+    if (iDIPO)
+    {
+        //=================== DIPO parameters ============================
+               
+        AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
+    }
+       
+    if (iHALL)
+    {
+        //=================== HALL parameters ============================
+               
+        AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
+    }
+       
+       
+    if (iFRAME)
+    {
+        //=================== FRAME parameters ============================
+               
+        AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
+           FRAME->SetHoles(1);
+    }
+       
+    if (iSHIL)
+    {
+        //=================== SHIL parameters ============================
+               
+        AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
+    }
+       
+       
+    if (iPIPE)
+    {
+        //=================== PIPE parameters ============================
+               
+        AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
+    }
+       
+    if (iITS)
+       {
+               //=================== ITS parameters ============================
+               
+               AliITS *ITS  = new AliITSv11Hybrid("ITS","ITS v11Hybrid");
+    }
+       
+    if (iTPC)
+    {
+               //============================ TPC parameters =====================
+
+        AliTPC *TPC = new AliTPCv2("TPC", "Default");
+    }
+       
+       
+    if (iTOF) {
+        //=================== TOF parameters ============================
+
+               AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
+       }
+       
+       
+    if (iHMPID)
+    {
+        //=================== HMPID parameters ===========================
+               AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");  
+       }
+       
+       
+    if (iZDC)
+    {
+        //=================== ZDC parameters ============================
+               
+        AliZDC *ZDC = new AliZDCv3("ZDC", "normal ZDC");
+    }
+       
+    if (iTRD)
+    {
+        //=================== TRD parameters ============================
+               
+        AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
+        AliTRDgeometry *geoTRD = TRD->GetGeometry();
+               if(year == 2009){
+                       // Partial geometry: modules at 0,8,9,17
+                       // Partial geometry: modules at 1,7,10,16 expected for 2009
+                       // starting at 3h in positive direction
+                       
+                       //geoTRD->SetSMstatus(1,0);
+                       //geoTRD->SetSMstatus(2,0);
+                       //geoTRD->SetSMstatus(3,0);
+                       //geoTRD->SetSMstatus(4,0);
+                       //geoTRD->SetSMstatus(5,0);
+                       //geoTRD->SetSMstatus(6,0);
+                       //geoTRD->SetSMstatus(7,0);
+                       
+                       
+                       //geoTRD->SetSMstatus(10,0);
+                       //geoTRD->SetSMstatus(11,0);
+                       //geoTRD->SetSMstatus(12,0);
+                       //geoTRD->SetSMstatus(13,0);
+                       //geoTRD->SetSMstatus(14,0);
+                       //geoTRD->SetSMstatus(15,0);
+                       //geoTRD->SetSMstatus(16,0);
+       
+                       geoTRD->SetSMstatus(2,0);
+                       geoTRD->SetSMstatus(3,0);
+                       geoTRD->SetSMstatus(4,0);
+                       geoTRD->SetSMstatus(5,0);
+                       geoTRD->SetSMstatus(6,0);
+
+                              geoTRD->SetSMstatus(11,0);
+                              geoTRD->SetSMstatus(12,0);
+                                      geoTRD->SetSMstatus(13,0);
+                                      geoTRD->SetSMstatus(14,0);
+                                      geoTRD->SetSMstatus(15,0);
+       }
+    }
+       
+    if (iFMD)
+    {
+        //=================== FMD parameters ============================
+               AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
+       }
+       
+    if (iMUON)
+    {
+        //=================== MUON parameters ===========================
+        // New MUONv1 version (geometry defined via builders)
+        AliMUON *MUON = new AliMUONv1("MUON", "default");
+    }
+    //=================== PHOS parameters ===========================
+       
+    if (iPHOS)
+    {
+        AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
+    }
+       
+       
+    if (iPMD)
+    {
+        //=================== PMD parameters ============================
+        AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
+    }
+       
+    if (iT0)
+    {
+        //=================== T0 parameters ============================
+        AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
+    }
+       
+    if (iEMCAL)
+    {
+        //=================== EMCAL parameters ============================
+        AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETE");
+    }
+       
+       if (iACORDE)
+    {
+        //=================== ACORDE parameters ============================
+        AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
+    }
+       
+       if (iVZERO)
+    {
+        //=================== VZERO parameters ============================
+        AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
+    }
+       
+       AliLog::Message(AliLog::kInfo, "End of Config", "Config.C", "Config.C", "Config()"," Config.C", __LINE__);
+}
+
+//           PYTHIA
+
+AliGenPythia *PythiaHVQ(PDC07Proc_t proc) {
+//*******************************************************************//
+// Configuration file for charm / beauty generation with PYTHIA      //
+//                                                                   //
+// The parameters have been tuned in order to reproduce the inclusive//
+// heavy quark pt distribution given by the NLO pQCD calculation by  //
+// Mangano, Nason and Ridolfi.                                       //
+//                                                                   //
+// For details and for the NORMALIZATION of the yields see:          //
+//   N.Carrer and A.Dainese,                                         //
+//   "Charm and beauty production at the LHC",                       //
+//   ALICE-INT-2003-019, [arXiv:hep-ph/0311225];                     //
+//   PPR Chapter 6.6, CERN/LHCC 2005-030 (2005).                     //
+//*******************************************************************//
+  AliGenPythia * gener = 0x0;
+
+  switch(proc) {
+  case kCharmPbPb5500:
+      comment = comment.Append(" Charm in Pb-Pb at 5.5 TeV");
+      gener = new AliGenPythia(nEvts);
+      gener->SetProcess(kPyCharmPbPbMNR);
+      gener->SetStrucFunc(kCTEQ4L);
+      gener->SetPtHard(2.1,-1.0);
+      gener->SetEnergyCMS(5500.);
+      gener->SetNuclei(208,208);
+      break;
+  case kCharmpPb8800:
+      comment = comment.Append(" Charm in p-Pb at 8.8 TeV");
+      gener = new AliGenPythia(nEvts);
+      gener->SetProcess(kPyCharmpPbMNR);
+      gener->SetStrucFunc(kCTEQ4L);
+      gener->SetPtHard(2.1,-1.0);
+      gener->SetEnergyCMS(8800.);
+      gener->SetProjectile("P",1,1);
+      gener->SetTarget("Pb",208,82);
+      break;
+  case kCharmpp14000:
+      comment = comment.Append(" Charm in pp at 14 TeV");
+      gener = new AliGenPythia(nEvts);
+      gener->SetProcess(kPyCharmppMNR);
+      gener->SetStrucFunc(kCTEQ4L);
+      gener->SetPtHard(2.1,-1.0);
+      gener->SetEnergyCMS(14000.);
+      break;
+  case kCharmpp14000wmi:
+      comment = comment.Append(" Charm in pp at 14 TeV with mult. interactions");
+      gener = new AliGenPythia(-1);
+      gener->SetProcess(kPyCharmppMNRwmi);
+      gener->SetStrucFunc(kCTEQ5L);
+      gener->SetPtHard(ptHardMin,ptHardMax);
+      gener->SetEnergyCMS(14000.);
+      break;
+  case kD0PbPb5500:
+      comment = comment.Append(" D0 in Pb-Pb at 5.5 TeV");
+      gener = new AliGenPythia(nEvts);
+      gener->SetProcess(kPyD0PbPbMNR);
+      gener->SetStrucFunc(kCTEQ4L);
+      gener->SetPtHard(2.1,-1.0);
+      gener->SetEnergyCMS(5500.);
+      gener->SetNuclei(208,208);
+      break;
+  case kD0pPb8800:
+      comment = comment.Append(" D0 in p-Pb at 8.8 TeV");
+      gener = new AliGenPythia(nEvts);
+      gener->SetProcess(kPyD0pPbMNR);
+      gener->SetStrucFunc(kCTEQ4L);
+      gener->SetPtHard(2.1,-1.0);
+      gener->SetEnergyCMS(8800.);
+      gener->SetProjectile("P",1,1);
+      gener->SetTarget("Pb",208,82);
+      break;
+  case kD0pp14000:
+      comment = comment.Append(" D0 in pp at 14 TeV");
+      gener = new AliGenPythia(nEvts);
+      gener->SetProcess(kPyD0ppMNR);
+      gener->SetStrucFunc(kCTEQ4L);
+      gener->SetPtHard(2.1,-1.0);
+      gener->SetEnergyCMS(14000.);
+      break;
+  case kDPlusPbPb5500:
+      comment = comment.Append(" DPlus in Pb-Pb at 5.5 TeV");
+      gener = new AliGenPythia(nEvts);
+      gener->SetProcess(kPyDPlusPbPbMNR);
+      gener->SetStrucFunc(kCTEQ4L);
+      gener->SetPtHard(2.1,-1.0);
+      gener->SetEnergyCMS(5500.);
+      gener->SetNuclei(208,208);
+      break;
+  case kDPluspPb8800:
+      comment = comment.Append(" DPlus in p-Pb at 8.8 TeV");
+      gener = new AliGenPythia(nEvts);
+      gener->SetProcess(kPyDPluspPbMNR);
+      gener->SetStrucFunc(kCTEQ4L);
+      gener->SetPtHard(2.1,-1.0);
+      gener->SetEnergyCMS(8800.);
+      gener->SetProjectile("P",1,1);
+      gener->SetTarget("Pb",208,82);
+      break;
+  case kDPluspp14000:
+      comment = comment.Append(" DPlus in pp at 14 TeV");
+      gener = new AliGenPythia(nEvts);
+      gener->SetProcess(kPyDPlusppMNR);
+      gener->SetStrucFunc(kCTEQ4L);
+      gener->SetPtHard(2.1,-1.0);
+      gener->SetEnergyCMS(14000.);
+      break;
+  case kBeautyPbPb5500:
+      comment = comment.Append(" Beauty in Pb-Pb at 5.5 TeV");
+      gener = new AliGenPythia(nEvts);
+      gener->SetProcess(kPyBeautyPbPbMNR);
+      gener->SetStrucFunc(kCTEQ4L);
+      gener->SetPtHard(2.75,-1.0);
+      gener->SetEnergyCMS(5500.);
+      gener->SetNuclei(208,208);
+      break;
+  case kBeautypPb8800:
+      comment = comment.Append(" Beauty in p-Pb at 8.8 TeV");
+      gener = new AliGenPythia(nEvts);
+      gener->SetProcess(kPyBeautypPbMNR);
+      gener->SetStrucFunc(kCTEQ4L);
+      gener->SetPtHard(2.75,-1.0);
+      gener->SetEnergyCMS(8800.);
+      gener->SetProjectile("P",1,1);
+      gener->SetTarget("Pb",208,82);
+      break;
+  case kBeautypp14000:
+      comment = comment.Append(" Beauty in pp at 14 TeV");
+      gener = new AliGenPythia(nEvts);
+      gener->SetProcess(kPyBeautyppMNR);
+      gener->SetStrucFunc(kCTEQ4L);
+      gener->SetPtHard(2.75,-1.0);
+      gener->SetEnergyCMS(14000.);
+      break;
+  case kBeautypp14000wmi:
+      comment = comment.Append(" Beauty in pp at 14 TeV with mult. interactions");
+      gener = new AliGenPythia(-1);
+      gener->SetProcess(kPyBeautyppMNRwmi);
+      gener->SetStrucFunc(kCTEQ5L);
+      gener->SetPtHard(ptHardMin,ptHardMax);
+      gener->SetEnergyCMS(14000.);
+      break;
+   }
+
+  return gener;
+}
+
+AliGenPythia *PythiaHard(PDC07Proc_t proc) {
+//*******************************************************************//
+// Configuration file for hard QCD processes generation with PYTHIA  //
+//                                                                   //
+//*******************************************************************//
+  AliGenPythia * gener = 0x0;
+
+  switch(proc) {
+
+  case kPyJetJet:
+    comment = comment.Append(" pp->jet + jet over at 14 TeV, no restriction");
+    AliGenPythia * gener = new AliGenPythia(nEvts);
+    gener->SetEnergyCMS(eCMS);//        Centre of mass energy
+    gener->SetProcess(kPyJets);//        Process type
+    gener->SetJetEtaRange(-1.5, 1.5);//  Final state kinematic cuts
+    gener->SetJetPhiRange(0., 360.);
+    gener->SetJetEtRange(10., 1000.);
+    gener->SetPtHard(ptHardMin, ptHardMax);// Pt transfer of the hard scattering
+    gener->SetStrucFunc(kCTEQ4L);
+       break;
+  case kBeautyppwmiJet:
+       comment = comment.Append(" Beauty Jets, no acceptance cuts");
+       AliGenPythia *gener = new AliGenPythia(-1);
+       gener->SetProcess(kPyBeautyppMNRwmi);
+       gener->SetStrucFunc(kCTEQ4L);
+       //Jet specific stuff below
+       gener->SetPtHard(ptHardMin,ptHardMax);
+       gener->SetJetEtaRange(-1,1); //used like that in LHC08d10, does nothing?
+       gener->SetJetPhiRange(60.,210.);//used like that in LHC08d10, does nothing?
+       gener->SetJetEtRange(10.,1000.);//used like that in LHC08d10,does nothing
+       //jet specific stuff above
+       gener->SetEnergyCMS(eCMS);
+       gener->SetForceDecay(kSemiElectronic);
+       gener->SetYRange(-2,2);
+       gener->SetFeedDownHigherFamily(kFALSE);
+       gener->SetCountMode(AliGenPythia::kCountParents);               
+       break;
+  case kPyBJetEMCAL:
+       comment = comment.Append(" Beauty Jets over EMCAL");
+       AliGenPythia *gener = new AliGenPythia(-1);
+       gener->SetProcess(kPyBeautyJets); 
+       gener->SetStrucFunc(kCTEQ4L); 
+       //Jet specific stuff below 
+       gener->SetPtHard(ptHardMin,ptHardMax); 
+       gener->SetJetEtaRange(-1,1); 
+       gener->SetJetPhiRange(60.,210.); 
+       gener->SetJetEtRange(10.,1000.); 
+       //jet specific stuff above 
+       gener->SetEnergyCMS(eCMS); 
+       gener->SetForceDecay(kSemiElectronic); 
+       gener->SetYRange(-2,2); 
+       gener->SetFeedDownHigherFamily(kFALSE); 
+       gener->SetCountMode(AliGenPythia::kCountParents);       
+       gener->SetElectronMinPt(1.); 
+       gener->SetElectronInEMCAL(kTRUE);               
+       break;            
+  case kPyGammaJetPHOS:
+      comment = comment.Append(" pp->jet + gamma over PHOS");
+      gener = new AliGenPythia(nEvts);
+      gener->SetEnergyCMS(eCMS);
+      gener->SetProcess(kPyDirectGamma);
+      gener->SetStrucFunc(kCTEQ4L);
+      gener->SetPtHard(ptHardMin,ptHardMax);
+      //gener->SetYHard(-1.0,1.0);
+      gener->SetGammaEtaRange(-0.13,0.13);
+      gener->SetGammaPhiRange(219.,321.);//Over 5 modules +-2 deg
+      break;
+  case kPyJetJetPHOS:
+      comment = comment.Append(" pp->jet + jet over PHOS");
+      gener = new AliGenPythia(nEvts);
+      gener->SetEnergyCMS(eCMS);
+      gener->SetProcess(kPyJets);
+      gener->SetStrucFunc(kCTEQ4L);
+      gener->SetPtHard(ptHardMin,ptHardMax);
+      //gener->SetYHard(-1.0,1.0);
+      gener->SetJetEtaRange(-1.,1.);
+      gener->SetJetPhiRange(200.,340.);
+      gener->SetJetEtRange(10., 1000.);
+      gener->SetPi0InPHOS(pi0FragPhotonInDet);
+      gener->SetFragPhotonOrPi0MinPt(ptGammaPi0Min);
+
+      printf("\n \n Event generator: Minimum pT of particle in calorimeter %f \n \n", ptGammaPi0Min);
+      break;
+  case kPyGammaBremsPHOS:
+      comment = comment.Append(" pp->jet + jet+bremsphoton over PHOS at 14 TeV");
+      gener = new AliGenPythia(nEvts);
+      gener->SetEnergyCMS(eCMS);
+      gener->SetProcess(kPyJets);
+      gener->SetStrucFunc(kCTEQ4L);
+      gener->SetPtHard(ptHardMin,ptHardMax);
+      //gener->SetYHard(-1.0,1.0);
+      gener->SetJetEtaRange(-1.,1.);
+      gener->SetJetPhiRange(200.,340.);
+      gener->SetFragPhotonInPHOS(pi0FragPhotonInDet);
+      gener->SetFragPhotonOrPi0MinPt(ptGammaPi0Min);
+         printf("\n \n Event generator: Minimum pT of particle in calorimeter %f \n \n", ptGammaPi0Min);
+         break;
+   case kPyJetJetPHOSv2:
+        comment = comment.Append(" pp->jet + jet over PHOS version2 ");
+        gener = new AliGenPythia(nEvts);
+       gener->SetEnergyCMS(eCMS);
+       gener->SetProcess(kPyJets);
+       gener->SetStrucFunc(kCTEQ4L);
+       gener->SetPtHard(ptHardMin,ptHardMax);
+       //gener->SetYHard(-1.0,1.0);
+       gener->SetJetEtaRange(-1.,1.);
+       gener->SetJetPhiRange(200.,340.);
+       //gener->SetPi0InPHOS(kTRUE);
+       gener->SetPhotonInPHOSeta(pi0FragPhotonInDet);
+       gener->SetPhotonMinPt(ptGammaPi0Min);
+       gener->SetForceDecay(kAll);
+       break;
+  case kPyGammaJetEMCAL:
+    comment = comment.Append(" pp->jet + gamma over EMCAL at 14 TeV");
+    gener = new AliGenPythia(nEvts);
+    gener->SetEnergyCMS(eCMS);
+    gener->SetProcess(kPyDirectGamma);
+    gener->SetStrucFunc(kCTEQ4L);
+    gener->SetPtHard(ptHardMin,ptHardMax);
+    //gener->SetYHard(-1.0,1.0);
+    gener->SetGammaEtaRange(-0.701,0.701);
+    gener->SetGammaPhiRange(79.,191.);//Over 6 supermodules +-2 deg
+    break;
+  case kPyJetJetEMCAL:
+    comment = comment.Append(" pp->jet + jet over EMCAL at 14 TeV");
+    gener = new AliGenPythia(nEvts);
+    gener->SetEnergyCMS(eCMS);
+    gener->SetProcess(kPyJets);
+    gener->SetStrucFunc(kCTEQ4L);
+    gener->SetPtHard(ptHardMin,ptHardMax);
+    //gener->SetYHard(-1.0,1.0);
+    gener->SetJetEtaRange(-1,1);
+    gener->SetJetPhiRange(60.,210.);
+       gener->SetJetEtRange(10., 1000.);
+    gener->SetPi0InEMCAL(pi0FragPhotonInDet);
+    gener->SetFragPhotonOrPi0MinPt(ptGammaPi0Min);
+    printf("\n \n Event generator: Minimum pT of particle in calorimeter %f \n \n", ptGammaPi0Min);
+    break;
+  case kPyGammaBremsEMCAL:
+      comment = comment.Append(" pp->jet + jet+bremsphoton over EMCAL at 14 TeV");
+      gener = new AliGenPythia(nEvts);
+      gener->SetEnergyCMS(eCMS);
+      gener->SetProcess(kPyJets);
+      gener->SetStrucFunc(kCTEQ4L);
+      gener->SetPtHard(ptHardMin,ptHardMax);
+      //gener->SetYHard(-1.0,1.0);
+      gener->SetJetEtaRange(-1,1);
+      gener->SetJetPhiRange(60.,210.); 
+         gener->SetJetEtRange(10., 1000.);
+      gener->SetFragPhotonInEMCAL(pi0FragPhotonInDet);
+      gener->SetFragPhotonOrPi0MinPt(ptGammaPi0Min);
+
+      printf("\n \n Event generator: Minimum pT of particle in calorimeter %f \n \n", ptGammaPi0Min);
+      break;
+
+  }
+
+  return gener;
+}
+
+AliGenerator* MbCocktail()
+{
+      comment = comment.Append(" pp at 14 TeV: Pythia low-pt, no heavy quarks + J/Psi from parameterisation");
+      AliGenCocktail * gener = new AliGenCocktail();
+      gener->UsePerEventRates();
+
+//    Pythia
+
+      AliGenPythia* pythia = new AliGenPythia(-1);
+      pythia->SetMomentumRange(0, 999999.);
+      pythia->SetThetaRange(0., 180.);
+      pythia->SetYRange(-12.,12.);
+      pythia->SetPtRange(0,1000.);
+      pythia->SetProcess(kPyMb);
+      pythia->SetEnergyCMS(14000.);
+      pythia->SwitchHFOff();
+
+//   J/Psi parameterisation
+
+      AliGenParam* jpsi = new AliGenParam(1, AliGenMUONlib::kJpsi, "CDF scaled", "Jpsi");
+      jpsi->SetPtRange(0.,100.);
+      jpsi->SetYRange(-8., 8.);
+      jpsi->SetPhiRange(0., 360.);
+      jpsi->SetForceDecay(kAll);
+
+      gener->AddGenerator(pythia, "Pythia", 1.);
+      gener->AddGenerator(jpsi,   "J/Psi", 8.e-4);
+
+      return gener;
+}
+
+AliGenerator* PyMbTriggered(Int_t pdg)
+{
+    AliGenPythia* pythia = new AliGenPythia(-1);
+    pythia->SetMomentumRange(0, 999999.);
+    pythia->SetThetaRange(0., 180.);
+    pythia->SetYRange(-12.,12.);
+    pythia->SetPtRange(0,1000.);
+    pythia->SetProcess(kPyMb);
+    pythia->SetEnergyCMS(14000.);
+    pythia->SetTriggerParticle(pdg, 0.9);
+    return pythia;
+}
+
+void ProcessEnvironmentVars()
+{
+       cout << "######################################" << endl;
+       cout << "## Processing environment variables ##" << endl;
+       cout << "######################################" << endl;
+       
+    // Run Number
+    if (gSystem->Getenv("RUN")) {
+               runNumber = atoi(gSystem->Getenv("RUN"));
+    }
+    //cout<<"Run number "<<runNumber<<endl;
+       
+    // Event Number
+    if (gSystem->Getenv("EVENT")) {
+               eventNumber = atoi(gSystem->Getenv("EVENT"));
+    }
+    //cout<<"Event number "<<eventNumber<<endl;
+       
+       // Random Number seed
+    if (gSystem->Getenv("CONFIG_SEED")) {
+               seed = atoi(gSystem->Getenv("CONFIG_SEED"));
+    }
+    else if(gSystem->Getenv("EVENT") && gSystem->Getenv("RUN")){
+               seed = runNumber * 100000 + eventNumber;
+    }
+       
+    gRandom->SetSeed(seed);
+       
+    cout<<"////////////////////////////////////////////////////////////////////////////////////"<<endl;
+    cout<<"Seed for random number generation= "<< seed<<"  "<< gRandom->GetSeed()<<endl;
+    cout<<"////////////////////////////////////////////////////////////////////////////////////"<<endl;
+       
+    // Run type
+    if (gSystem->Getenv("DC_RUN_TYPE")) {
+               cout<<"run type "<<gSystem->Getenv("DC_RUN_TYPE")<<endl;
+               for (Int_t iRun = 0; iRun < kRunMax; iRun++) {
+                       if (strcmp(gSystem->Getenv("DC_RUN_TYPE"), pprRunName[iRun])==0) {
+                               proc = (PDC07Proc_t)iRun;
+                       }
+               }
+    }
+    else
+               cout << "Environment variable DC_RUN_TYPE is not defined" << endl;
+    if (gSystem->Getenv("YEAR"))
+               year = atoi(gSystem->Getenv("YEAR"));
+       if (gSystem->Getenv("ECMS"))
+               eCMS = atof(gSystem->Getenv("ECMS"));
+       if (gSystem->Getenv("TRIGGER"))
+               trig = atoi(gSystem->Getenv("TRIGGER"));
+       if ( gSystem->Getenv("PI0GAMMAINDET") )
+               pi0FragPhotonInDet      = atoi(gSystem->Getenv("PI0GAMMAINDET"));
+    if (gSystem->Getenv("PTGAMMAPI0MIN"))
+               ptGammaPi0Min = atof(gSystem->Getenv("PTGAMMAPI0MIN"));
+       if (gSystem->Getenv("QUENCHING"))
+               iquenching = atof(gSystem->Getenv("QUENCHING"));
+       if (gSystem->Getenv("QHAT"))
+               qhat = atof(gSystem->Getenv("QHAT"));
+       //if (gSystem->Getenv("MEDLENGHT"))
+       //      medlength = atof(gSystem->Getenv("MEDLENGHT"));
+       if (gSystem->Getenv("PTHARDMIN"))
+               ptHardMin = atof(gSystem->Getenv("PTHARDMIN"));
+       if (gSystem->Getenv("PTHARDMAX"))
+               ptHardMax = atof(gSystem->Getenv("PTHARDMAX"));
+                                       
+    if(gSystem->Getenv("PTHARDMIN") && gSystem->Getenv("PTHARDMAX")){
+       if( strncmp(pprRunName[proc],"kPyJetJet",9)==0 || strncmp(pprRunName[proc],"kPyBJetEMCAL",11)==0 ){
+                       ptHardMin = ptHardJJLo[runNumber%nPtHardJJBins];
+                       ptHardMax = ptHardJJHi[runNumber%nPtHardJJBins];
+               }
+               else if( strncmp(pprRunName[proc],"kPyGammaJet",11)==0){
+                       ptHardMin = ptHardGJLo[runNumber%nPtHardGJBins];
+                       ptHardMax = ptHardGJHi[runNumber%nPtHardGJBins];        
+               }       
+       }
+       
+    cout<<">> Run type set to "<<pprRunName[proc]<<endl;
+    cout<<">> Collision energy set to "<<eCMS <<endl;
+       cout<<">> Collisions trigger type "<<trig<<" "<<TrigConfName[trig]<<endl;
+    cout<<">> ptHard limits: "<<ptHardMin<<" to " <<ptHardMax<<" GeV"<<endl;
+       if(pi0FragPhotonInDet) cout<<">> pt gamma/pi0 threshold "<< ptGammaPi0Min<<" GeV "<<endl;
+    if(iquenching) cout<<">> quenching on? "<< iquenching<<" qhat "<<qhat//<<" medlength "<<medlength
+       <<endl;
+       cout<<">> Year geometry : "<<year<<endl;        
+    cout << "######################################" << endl;
+    cout << "######################################" << endl;
+}
diff --git a/prod/LHC09a14/JDL b/prod/LHC09a14/JDL
new file mode 100644 (file)
index 0000000..3e0d59f
--- /dev/null
@@ -0,0 +1,23 @@
+Executable = "aliroot_new";
+Jobtag={"comment:jet-jet pp, PYTHIA, no quenching"};
+
+Packages={"VO_ALICE@AliRoot::v4-16-Rev-13","VO_ALICE@GEANT3::v1-10-1","VO_ALICE@ROOT::v5-23-04","VO_ALICE@APISCONFIG::V2.4"};
+
+TTL = "72000";
+Price = 1;
+
+Validationcommand ="/alice/cern.ch/user/a/aliprod/prod2007/configs_pbpb_hijing/validation.sh";
+
+InputFile= {"LF:/alice/cern.ch/user/c/conesa/production/configs_pp_new/CheckESD.C","LF:/alice/cern.ch/user/c/conesa/production/configs_pp_new/Config.C","LF:/alice/cern.ch/user/c/conesa/production/configs_pp_new/rec.C","LF:/alice/cern.ch/user/c/conesa/production/configs_pp_new/sim.C","LF:/alice/cern.ch/user/c/conesa/production/configs_pp_new/simrun.C","LF:/alice/cern.ch/user/c/conesa/production/configs_pp_new/tag.C"};
+
+OutputArchive={"log_archive:*.log,stdout,stderr,*.log@Alice::NIHAM::File","root_archive.zip:*.tag.root,galice.root,geometry.root,Kinematics.root,TrackRefs.root,AliESDs.root,AliESDfriends.root,pyxsec.root,*QA*root@Alice::Subatech::DPM"};
+
+OutputDir="/alice/cern.ch/user/c/conesa/production/output_pp_new/BJ/$1/#alien_counter_03i#";
+
+JDLVariables={"Packages", "OutputDir"};
+GUIDFILE="guid.txt";
+
+splitarguments="simrun.C --run $1 --event #alien_counter# --process kPyBJetEMCAL --ecms 14000 --trigger 0";
+split="production:1-100";
+
+Workdirectorysize={"4000MB"};
diff --git a/prod/LHC09a14/JDLPbPbGammaJet b/prod/LHC09a14/JDLPbPbGammaJet
new file mode 100644 (file)
index 0000000..8f01a9c
--- /dev/null
@@ -0,0 +1,29 @@
+Executable = "aliroot_new";\r
+Jobtag={"comment:gamma-jet, PbPb, PYTHIA+HIJING, no quenching"};\r
+\r
+Packages={"VO_ALICE@AliRoot::v4-16-Rev-13","VO_ALICE@GEANT3::v1-10-1","VO_ALICE@ROOT::v5-23-04","VO_ALICE@APISCONFIG::V2.4"};\r
+\r
+TTL = "72000";\r
+Price = 1;\r
+\r
+Validationcommand ="/alice/cern.ch/user/a/aliprod/prod2007/configs_pbpb_hijing/validation.sh";\r
+\r
+InputFile= {"LF:/alice/cern.ch/user/c/conesa/production/configs_pp_PbPb_new/CheckESD.C","LF:/alice/cern.ch/user/c/conesa/production/configs_pp_PbPb_new/Config.C","LF:/alice/cern.ch/user/c/conesa/production/configs_pp_PbPb_new/rec.C","LF:/alice/cern.ch/user/c/conesa/production/configs_pp_PbPb_new/sim.C","LF:/alice/cern.ch/user/c/conesa/production/configs_pp_PbPb_new/simrun.C","LF:/alice/cern.ch/user/c/conesa/production/configs_pp_PbPb_new/tag.C"};\r
+\r
+OutputArchive={"log_archive:*.log,stdout,stderr,*.log@Alice::NIHAM::File","root_archive.zip:*.tag.root,galice.root,geometry.root,Kinematics.root,TrackRefs.root,AliESDs.root,AliESDfriends.root,pyxsec.root@Alice::NIHAM::File"};\r
+\r
+InputDataCollection="LF:/alice/cern.ch/user/c/conesa/production/collection/PbPb/test2.xml";
+InputDataListFormat = "xml-single";\r
+InputDataList = "collection.xml";\r
+\r
+OutputDir="/alice/cern.ch/user/c/conesa/production/outPbPb/GJ/noq/$1/#alien_counter_03i#";\r
+\r
+JDLVariables={"Packages", "OutputDir"};\r
+GUIDFILE="guid.txt";\r
+\r
+splitarguments="simrun.C --run $1 --event #alien_counter# --process kPyGammaJetEMCAL  --ecms 5500 --quench 0 --trigger 1" ;\r
+\r
+Split="se"; \r
+SplitMaxInputFileNumber="1"; \r
+\r
+Workdirectorysize={"6000MB"};\r
diff --git a/prod/LHC09a14/rec.C b/prod/LHC09a14/rec.C
new file mode 100644 (file)
index 0000000..a7b30f1
--- /dev/null
@@ -0,0 +1,69 @@
+void rec() {\r
+  //AliLog::SetGlobalLogLevel(AliLog::kError);\r
+\r
+  AliReconstruction reco;\r
+\r
+  reco.SetWriteESDfriend();\r
+  reco.SetWriteAlignmentData();\r
+\r
+\r
+  AliITSRecoParam * itspar = AliITSRecoParam::GetLowFluxParam();\r
+  itspar->SetStoreLikeSignV0s(kTRUE);\r
+  reco.SetRecoParam("ITS",itspar);\r
+  reco.SetRecoParam("TPC",AliTPCRecoParam::GetLowFluxParam());\r
+  reco.SetRecoParam("TRD",AliTRDrecoParam::GetLowFluxParam());\r
+  reco.SetRecoParam("PHOS",AliPHOSRecoParam::GetDefaultParameters());\r
+  reco.SetRecoParam("MUON",AliMUONRecoParam::GetLowFluxParam());\r
+  reco.SetRecoParam("EMCAL",AliEMCALRecParam::GetLowFluxParam());\r
+  reco.SetRecoParam("GRP",AliGRPRecoParam::GetLowFluxParam());\r
+\r
+  reco.SetOption("TRD","sl_tr_1");            // Stream Level for the tracker equal to 1\r
+\r
+  // Only in case of Full misalignment\r
+//   AliGRPRecoParam *grpRecoParam = AliGRPRecoParam::GetLowFluxParam();\r
+//   grpRecoParam->SetVertexerTracksConstraintITS(kFALSE);\r
+//   grpRecoParam->SetVertexerTracksConstraintTPC(kFALSE);\r
+//   reco.SetRecoParam("GRP",grpRecoParam);\r
+\r
+  reco.SetDefaultStorage("alien://Folder=/alice/simulation/2008/v4-15-Release/Residual/");\r
+  //reco.SetSpecificStorage("GRP/GRP/Data/","alien://Folder=/alice/simulation/2008/v4-15-Release/Ideal/");
+  reco.SetSpecificStorage("GRP/GRP/Data",Form("local://%s",gSystem->pwd()));
+  // No write access to the OCDB => local specific storage\r
+//   reco.SetSpecificStorage("GRP/GRP/Data",\r
+//                        Form("local://%s",gSystem->pwd()));\r
+\r
+  //-------------------------------------------------------------------------\r
+  // Setting the cuts for the V0 and cascade finding\r
+  // The values of the cuts below are "reasonable" for pp events\r
+  //-------------------------------------------------------------------------\r
+\r
+  Double_t v0sels[]={33,    // max allowed chi2\r
+                     0.05,  // min allowed impact parameter for the 1st daughter\r
+                     0.05,  // min allowed impact parameter for the 2nd daughter\r
+                     0.5,   // max allowed DCA between the daughter tracks\r
+                     0.99,  // max allowed cosine of V0's pointing angle\r
+                     0.2,   // min radius of the fiducial volume\r
+                     100    // max radius of the fiducial volume\r
+  };\r
+  AliV0vertexer::SetDefaultCuts(v0sels);\r
+\r
+  Double_t xisels[]={33.,   // max allowed chi2 (same as PDC07)\r
+                     0.025, // min allowed V0 impact parameter (PDC07 was 0.05)\r
+                     0.010, // "window" around the Lambda mass (PDC07 was 0.008)\r
+                     0.025, // min allowed bachelor's impact parameter (PDC07 was 0.035)\r
+                     0.2,   // max allowed DCA between the V0 and the bachelor (PDC07 was 0.1)\r
+                     0.998, // max allowed cosine of the cascade pointing angle (PDC07 was 0.9985)\r
+                     0.2,   // min radius of the fiducial volume (PDC07 was 0.9)\r
+                     100    // max radius of the fiducial volume (same as PDC07)\r
+  };\r
+  AliCascadeVertexer::SetDefaultCuts(xisels);\r
+\r
+  reco.SetRunQA("ALL:ALL");\r
+\r
+  TStopwatch timer;\r
+  timer.Start();\r
+  reco.Run();\r
+  timer.Stop();\r
+  timer.Print();\r
+}\r
+\r
diff --git a/prod/LHC09a14/sim.C b/prod/LHC09a14/sim.C
new file mode 100644 (file)
index 0000000..c4f3d35
--- /dev/null
@@ -0,0 +1,39 @@
+void sim(Int_t nev=100) {\r
+//  AliLog::SetGlobalLogLevel(AliLog::kError);\r
+\r
+  AliSimulation simu;\r
+  simu.SetMakeSDigits("TRD TOF PHOS HMPID EMCAL MUON FMD ZDC PMD T0 VZERO");\r
+  simu.SetMakeDigitsFromHits("ITS TPC");\r
+\r
+  simu.SetDefaultStorage("alien://Folder=/alice/simulation/2008/v4-15-Release/Ideal");\r
+\r
+
+  simu.SetSpecificStorage("GRP/GRP/Data",Form("local://%s",gSystem->pwd()));
+
+  TStopwatch timer;\r
+  timer.Start();\r
+  simu.Run(nev);\r
+  WriteXsection();
+  timer.Stop();\r
+  timer.Print();\r
+}\r
+
+WriteXsection()
+{
+  TPythia6 *pythia = TPythia6::Instance();
+  pythia->Pystat(1);
+  Double_t xsection = pythia->GetPARI(1);
+  Int_t    ntrials  = pythia->GetMSTI(5);
+
+  TFile *file = new TFile("pyxsec.root","recreate");
+  TTree   *tree   = new TTree("Xsection","Pythia cross section");
+  TBranch *branch = tree->Branch("xsection", &xsection, "X/D");
+  TBranch *branch = tree->Branch("ntrials" , &ntrials , "X/i");
+  tree->Fill();
+
+  tree->Write();
+  file->Close();
+
+  cout << "Pythia cross section: " << xsection 
+       << ", number of trials: " << ntrials << endl;
+}
diff --git a/prod/LHC09a14/simrun.C b/prod/LHC09a14/simrun.C
new file mode 100644 (file)
index 0000000..5a8ee67
--- /dev/null
@@ -0,0 +1,146 @@
+//#define VERBOSEARGS
+
+{
+       // set job and simulation variables as :
+       // root run.C  --run <x> --event <y> --process <proc> --minhard <min> --maxhard <max> --minpt <minpt> ...
+       
+       int nrun = 0;
+       int nevent = 0;
+       int seed = 0;
+       
+       char sseed[1024];
+       char srun[1024];
+       char sevent[1024];
+       char secms[1024];
+       char sprocess[1024];
+       char sminpthard[1024];
+       char smaxpthard[1024];
+       char sminptgammapi0[1024];
+       char spi0gammafrag[1024];
+       char squench[1024];
+       char sqhat[1024];
+       char smedlength[1024];
+       char strig[1024];
+       char syear[1024];
+       
+       sprintf(srun,"");
+       sprintf(sevent,"");
+       sprintf(secms,"");
+       sprintf(sprocess,"");
+       sprintf(sminpthard,"");
+       sprintf(smaxpthard,"");
+       sprintf(sminptgammapi0,"");
+       sprintf(spi0gammafrag,"");
+       sprintf(squench,"");
+       sprintf(sqhat,"");
+       //sprintf(smedlength,"");
+       sprintf(strig,"");
+       sprintf(syear,"");
+       
+       for (int i=0; i< gApplication->Argc();i++){
+#ifdef VERBOSEARGS
+               printf("Arg  %d:  %s\n",i,gApplication->Argv(i));
+#endif
+               if (!(strcmp(gApplication->Argv(i),"--run")))
+                       nrun = atoi(gApplication->Argv(i+1));
+               sprintf(srun,"%d",nrun);
+       
+               if (!(strcmp(gApplication->Argv(i),"--event")))
+                       nevent = atoi(gApplication->Argv(i+1));
+               sprintf(sevent,"%d",nevent);
+                               
+               if (!(strcmp(gApplication->Argv(i),"--process")))
+                       sprintf(sprocess, gApplication->Argv(i+1));
+                               
+               if (!(strcmp(gApplication->Argv(i),"--year")))
+                       sprintf(syear, gApplication->Argv(i+1));
+
+               if (!(strcmp(gApplication->Argv(i),"--ecms")))
+                       sprintf(secms,gApplication->Argv(i+1));
+                                               
+               if (!(strcmp(gApplication->Argv(i),"--minhard")))
+                       sprintf(sminpthard,gApplication->Argv(i+1));
+                                                       
+               if (!(strcmp(gApplication->Argv(i),"--maxhard")))
+                       sprintf(smaxpthard,gApplication->Argv(i+1));
+       
+               if (!(strcmp(gApplication->Argv(i),"--pi0gammafrag")))
+                       sprintf(spi0gammafrag,gApplication->Argv(i+1));
+                                                                                                                                                                               
+               if (!(strcmp(gApplication->Argv(i),"--minpt")))
+                       sprintf(sminptgammapi0,gApplication->Argv(i+1));
+                                                                                                                                       
+               if (!(strcmp(gApplication->Argv(i),"--quench")))
+                       sprintf(squench,gApplication->Argv(i+1));
+                                                                               
+               if (!(strcmp(gApplication->Argv(i),"--qhat")))
+                       sprintf(sqhat,gApplication->Argv(i+1));
+                                                                                       
+               //if (!(strcmp(gApplication->Argv(i),"--medlength")))
+               //      sprintf(smedlength,gApplication->Argv(i+1));
+                                                                                       
+               if (!(strcmp(gApplication->Argv(i),"--trigger")))
+                       sprintf(strig,gApplication->Argv(i+1));
+                                                                                                       
+       }
+       
+       //rec params for reconstruction
+       //only for release < 16
+       //char cmd[200] ; 
+       //sprintf(cmd, ".! tar zxvf DBpp.tgz") ; 
+       //gROOT->ProcessLine(cmd) ; 
+       
+       seed = nrun * 100000 + nevent;
+       sprintf(sseed,"%d",seed);
+       
+       if (seed==0) {
+               fprintf(stderr,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
+               fprintf(stderr,"!!!!  WARNING! Seeding variable for MC is 0          !!!!\n");
+               fprintf(stderr,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
+       } else {
+               fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
+               fprintf(stdout,"!!!  MC Seed is %d \n",seed);
+               fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
+       }
+       
+       // set the seed environment variable
+       gSystem->Setenv("CONFIG_SEED",sseed);
+       gSystem->Setenv("RUN",srun);
+       gSystem->Setenv("EVENT",sevent);
+       gSystem->Setenv("DC_RUN_TYPE",sprocess);//"kPyGammaJetPHOS");
+       gSystem->Setenv("YEAR",syear);//"14000");       
+       gSystem->Setenv("ECMS",secms);//"14000");
+       gSystem->Setenv("PTHARDMIN",sminpthard);//"20");
+       gSystem->Setenv("PTHARDMAX",smaxpthard);//"30");
+       gSystem->Setenv("PI0GAMMAINDET",spi0gammafrag);//"1");
+       gSystem->Setenv("PTGAMMAPI0MIN",sminptgammapi0);//"1");
+       gSystem->Setenv("QUENCHING",squench);
+       gSystem->Setenv("QHAT",sqhat);
+       //gSystem->Setenv("MEDLENGTH",smedlength);
+       gSystem->Setenv("TRIGGER",strig);
+       
+       cout<< "SIMRUN:: Run = " << gSystem->Getenv("RUN") << "; Event = " << gSystem->Getenv("EVENT") 
+       << "; Process = "    << gSystem->Getenv("DC_RUN_TYPE")
+       << "; E cms = " << gSystem->Getenv("ECMS") 
+       << "; Trigger configuration = "<< gSystem->Getenv("TRIGGER")
+       << "; Year = "<<gSystem->Getenv("YEAR") << endl;
+       
+       cout<< "         minpthard = " << gSystem->Getenv("PTHARDMIN") 
+       << "; maxpthard =" << gSystem->Getenv("PTHARDMAX") 
+       << "; force pi0/gamma frag in detector = "     << gSystem->Getenv("PI0GAMMAINDET") 
+       << "; minpt = "     << gSystem->Getenv("PTGAMMAPI0MIN") 
+       << "; quenching option ="<<gSystem->Getenv("QUENCHING") 
+       << "; qhat = "<<gSystem->Getenv("QHAT") 
+       //<< "; medium length = "<<gSystem->Getenv("MEDIUMLENGTH")
+       << endl;
+       
+       cout<<">>>>> SIMULATION <<<<<"<<endl;
+       gSystem->Exec("aliroot -b -q sim.C > sim.log 2>&1");
+       cout<<">>>>> RECONSTRUCTION <<<<<"<<endl;
+       gSystem->Exec("aliroot -b -q rec.C > rec.log 2>&1");
+       cout<<">>>>> TAG <<<<<"<<endl;
+       gSystem->Exec("aliroot -b -q tag.C > tag.log 2>&1");
+       cout<<">>>>> CHECK ESD <<<<<"<<endl;
+       gSystem->Exec("aliroot -b -q CheckESD.C > check.log 2>&1");
+       
+}
diff --git a/prod/LHC09a14/tag.C b/prod/LHC09a14/tag.C
new file mode 100644 (file)
index 0000000..f8e55f8
--- /dev/null
@@ -0,0 +1,110 @@
+void tag() {\r
+  const char* turl = gSystem->Getenv("ALIEN_JDL_OUTPUTDIR");\r
+  TString fESDFileName = "alien://";\r
+  fESDFileName += turl;\r
+  fESDFileName += "/AliESDs.root";  \r
+\r
+  TString fGUID = 0;\r
+  GetGUID(fGUID);\r
+\r
+  TString fAliroot, fRoot, fGeant;\r
+  GetVersions(fAliroot,fRoot,fGeant);\r
+\r
+  UpdateTag(fAliroot,fRoot,fGeant,fESDFileName,fGUID);\r
+}\r
+  \r
+//_____________________________________//\r
+GetVersions(TString &fAliroot, TString &froot, TString &fgeant) {\r
+  const char* fver = gSystem->Getenv("ALIEN_JDL_PACKAGES");\r
+  TString fS = fver;\r
+  Int_t fFirst = fS.First("#");\r
+\r
+  while(fFirst != -1) {\r
+    Int_t fTotalLength = fS.Length();\r
+    TString tmp = fS;\r
+    TString fS1 = fS(0,fFirst);\r
+    tmp = fS(fFirst+2,fTotalLength);\r
+    fS = tmp;\r
+\r
+    if(fS1.Contains("Root")) fAliroot = fS1;\r
+    if(fS1.Contains("ROOT")) froot = fS1;\r
+    if(fS1.Contains("GEANT")) fgeant = fS1;\r
+\r
+    if(tmp.Contains("Root")) fAliroot = tmp;\r
+    if(tmp.Contains("ROOT")) froot = tmp;\r
+    if(tmp.Contains("GEANT")) fgeant = tmp;\r
+    \r
+    fFirst = tmp.First("#");\r
+  }\r
+}\r
+\r
+//_____________________________________//\r
+GetGUID(TString &guid) {\r
+  ofstream myfile ("guid.txt");\r
+  if (myfile.is_open()) {\r
+    TFile *f = TFile::Open("AliESDs.root","read");\r
+    if(f->IsOpen()) {\r
+      guid = f->GetUUID().AsString();\r
+      myfile << "AliESDs.root \t"<<f->GetUUID().AsString();\r
+      cout<<guid.Data()<<endl;\r
+      myfile.close();\r
+    }\r
+    else cout<<"Input file not found"<<endl;\r
+  }\r
+  else cout<<"Output file can't be created..."<<endl;\r
+}\r
+\r
+\r
+//_____________________________________//\r
+Bool_t UpdateTag(TString faliroot, TString froot, TString fgeant, TString turl, TString guid) {\r
+  cout<<"Updating tags....."<<endl;\r
+\r
+  const char * tagPattern = "tag.root";\r
+  // Open the working directory\r
+  void * dirp = gSystem->OpenDirectory(gSystem->pwd());\r
+  const char * name = 0x0;\r
+  // Add all files matching *pattern* to the chain\r
+  while((name = gSystem->GetDirEntry(dirp))) {\r
+    if (strstr(name,tagPattern)) {\r
+      TFile *f = TFile::Open(name,"read") ;\r
\r
+      AliRunTag *tag = new AliRunTag;\r
+      AliEventTag *evTag = new AliEventTag;\r
+      TTree *fTree = (TTree *)f->Get("T");\r
+      fTree->SetBranchAddress("AliTAG",&tag);\r
+   \r
+      //Defining new tag objects\r
+      AliRunTag *newTag = new AliRunTag();\r
+      TTree ttag("T","A Tree with event tags");\r
+      TBranch * btag = ttag.Branch("AliTAG", &newTag);\r
+      btag->SetCompressionLevel(9);\r
+      for(Int_t iTagFiles = 0; iTagFiles < fTree->GetEntries(); iTagFiles++) {\r
+       fTree->GetEntry(iTagFiles);\r
+       newTag->SetRunId(tag->GetRunId());\r
+       newTag->SetAlirootVersion(faliroot);\r
+       newTag->SetRootVersion(froot);\r
+       newTag->SetGeant3Version(fgeant);\r
+       const TClonesArray *tagList = tag->GetEventTags();\r
+       for(Int_t j = 0; j < tagList->GetEntries(); j++) {\r
+         evTag = (AliEventTag *) tagList->At(j);\r
+         evTag->SetTURL(turl);\r
+         evTag->SetGUID(guid);\r
+         newTag->AddEventTag(*evTag);\r
+       }\r
+       ttag.Fill();\r
+       newTag->Clear();\r
+      }//tag file loop \r
+  \r
+      TFile* ftag = TFile::Open(name, "recreate");\r
+      ftag->cd();\r
+      ttag.Write();\r
+      ftag->Close();\r
+      \r
+      delete tag;\r
+      delete newTag;\r
+    }//pattern check\r
+  }//directory loop\r
+  return kTRUE;\r
+}\r
+\r
+\r