Use simrun.sh and AODtrainsim.C in job submission
authordstocco <diego.stocco@cern.ch>
Mon, 15 Dec 2014 11:16:17 +0000 (12:16 +0100)
committerlaphecet <laurent.aphecetche@subatech.in2p3.fr>
Mon, 12 Jan 2015 14:58:04 +0000 (15:58 +0100)
PWG/muondep/AccEffTemplates/AOD_merge.sh
PWG/muondep/AccEffTemplates/AODtrainsim.C [moved from PWG/muondep/AccEffTemplates/AODtrain.C with 90% similarity]
PWG/muondep/AccEffTemplates/simrun.C [deleted file]
PWG/muondep/AccEffTemplates/simrun.sh [new file with mode: 0644]
PWG/muondep/AccEffTemplates/validation.sh [deleted file]
PWG/muondep/AliMuonAccEffSubmitter.cxx

index a7e09fd..865c879 100644 (file)
@@ -19,7 +19,7 @@ echo "############## memory : ##############"
 free -m
 echo "========================================="
 
-aliroot -b -q AODtrain.C\($1\)
+aliroot -b -q AODtrainsim.C\($1\)
 echo "======== AODtrain_merge.C finished with exit code: $? ========"
 echo "############## memory after: ##############"
 free -m
similarity index 90%
rename from PWG/muondep/AccEffTemplates/AODtrain.C
rename to PWG/muondep/AccEffTemplates/AODtrainsim.C
index 3d3f4b6..f23585e 100644 (file)
@@ -1,7 +1,7 @@
 // ### Settings that make sense when using the Alien plugin
 //==============================================================================
-Int_t       runOnData          = 1;       // Set to 1 if processing real data
-Int_t       iCollision         = 1;       // 0=pp, 1=Pb-Pb
+Int_t       runOnData          = 0;       // Set to 1 if processing real data
+Int_t       iCollision         = 0;       // 0=pp, 1=Pb-Pb
 //==============================================================================
 Bool_t      usePhysicsSelection = kFALSE; // use physics selection
 Bool_t      useTender           = kFALSE; // use tender wagon
@@ -36,7 +36,7 @@ TString configPWG3d2h = (iCollision==0)?"$ALICE_ROOT/PWG3/vertexingHF/ConfigVert
 :"$ALICE_ROOT/PWG3/vertexingHF/ConfigVertexingHF_highmult.C";
 
 // Temporaries.
-class AliOADBPhysicsSelection;                                                                                                                  
+class AliOADBPhysicsSelection;
 AliOADBPhysicsSelection *CreateOADBphysicsSelection();
 void AODmerge();
 void AddAnalysisTasks(Int_t);
@@ -46,13 +46,13 @@ Bool_t LoadLibrary(const char *);
 TChain *CreateChain();
 
 //______________________________________________________________________________
-void AODtrain(Int_t merge=0)
+void AODtrainsim(Int_t merge=0)
 {
   // Main analysis train macro.
   // merge = 0: production
   // merge = 1: intermediate merging
   // merge = 2: final merging + terminate
-  
+
   if (merge) {
     TGrid::Connect("alien://");
     if (!gGrid || !gGrid->IsConnected()) {
@@ -77,13 +77,13 @@ void AODtrain(Int_t merge=0)
   if (iPWG3vertexing) printf("=  PWG3 vertexing                                                =\n");
   if (iPWG3JPSIfilter) printf("=  PWG3 j/psi filter                                             =\n");
   if (iPWG3d2h) printf("=  PWG3 D0->2 hadrons QA                                     =\n");
-  
+
   // Load common libraries and set include path
   if (!LoadCommonLibraries()) {
     ::Error("AnalysisTrain", "Could not load common libraries");
     return;
   }
-  
+
   // Make the analysis manager and connect event handlers
   AliAnalysisManager *mgr  = new AliAnalysisManager("Analysis Train", "Production train");
   if (useSysInfo) mgr->SetNSysInfo(100);
@@ -91,18 +91,18 @@ void AODtrain(Int_t merge=0)
   if (!LoadAnalysisLibraries()) {
     ::Error("AnalysisTrain", "Could not load analysis libraries");
     return;
-  }   
-  
+  }
+
   // Create input handler (input container created automatically)
   // ESD input handler
   AliESDInputHandler *esdHandler = new AliESDInputHandler();
-  mgr->SetInputEventHandler(esdHandler);       
+  mgr->SetInputEventHandler(esdHandler);
   // Monte Carlo handler
   if (useMC) {
     AliMCEventHandler* mcHandler = new AliMCEventHandler();
     mgr->SetMCtruthEventHandler(mcHandler);
-    mcHandler->SetReadTR(useTR); 
-  }   
+    mcHandler->SetReadTR(useTR);
+  }
   // AOD output container, created automatically when setting an AOD handler
   if (iAODhandler) {
     // AOD output handler
@@ -112,7 +112,7 @@ void AODtrain(Int_t merge=0)
   }
   // Debugging if needed
   if (useDBG) mgr->SetDebugLevel(3);
-  
+
   AddAnalysisTasks(merge);
   if (merge) {
     AODmerge();
@@ -122,12 +122,12 @@ void AODtrain(Int_t merge=0)
       mgr->StartAnalysis("grid terminate",0);
     }
     return;
-  }   
-  // Run the analysis                                                                                                                     
+  }
+  // Run the analysis
   //
   TChain *chain = CreateChain();
   if (!chain) return;
-  
+
   TStopwatch timer;
   timer.Start();
   mgr->SetSkipTerminate(kTRUE);
@@ -136,13 +136,13 @@ void AODtrain(Int_t merge=0)
     mgr->StartAnalysis("local", chain);
   }
   timer.Print();
-}                                                                                                                                          
+}
+
+//______________________________________________________________________________
+void AddAnalysisTasks(Int_t merge){
+  // Add all analysis task wagons to the train
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
 
-//______________________________________________________________________________                                                           
-void AddAnalysisTasks(Int_t merge){                                                                                                                                          
-  // Add all analysis task wagons to the train                                                                                               
-  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();                                                                     
-  
   //
   // Tender and supplies. Needs to be called for every event.
   //
@@ -153,13 +153,13 @@ void AddAnalysisTasks(Int_t merge){
     AliAnalysisTaskSE *tender = AddTaskTender(useV0tender);
     //      tender->SetDebugLevel(2);
   }
-  
+
   if (usePhysicsSelection) {
     // Physics selection task
     gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
     mgr->RegisterExtraFile("event_stat.root");
     AliPhysicsSelectionTask *physSelTask = AddTaskPhysicsSelection(kFALSE);
-    //      AliOADBPhysicsSelection * oadbDefaultPbPb = CreateOADBphysicsSelection();      
+    //      AliOADBPhysicsSelection * oadbDefaultPbPb = CreateOADBphysicsSelection();
     //      physSelTask->GetPhysicsSelection()->SetCustomOADBObjects(oadbDefaultPbPb,0,0);
     //      if (!merge) mgr->AddStatisticsTask(AliVEvent::kAny);
   }
@@ -169,18 +169,18 @@ void AddAnalysisTasks(Int_t merge){
     AliCentralitySelectionTask *taskCentrality = AddTaskCentrality();
     taskCentrality->SelectCollisionCandidates(AliVEvent::kAny);
   }
-  
+
   if (iMUONRefit) {
     gROOT->LoadMacro("$ALICE_ROOT/PWG/muondep/AddTaskMuonRefit.C");
     AliAnalysisTaskMuonRefit* refit = AddTaskMuonRefit(-1., -1., kTRUE, -1., -1.);
     refit->RemoveMonoCathodClusters(kTRUE, kFALSE);
   }
-  
+
   if(iESDMCLabelAddition) {
     gROOT->LoadMacro("$ALICE_ROOT/PWG/muondep/AddTaskESDMCLabelAddition.C");
     AliAnalysisTaskESDMCLabelAddition *esdmclabel = AddTaskESDMCLabelAddition();
   }
-  
+
   if (useMC && useTR && iMUONPerformance) {
     gROOT->LoadMacro("$ALICE_ROOT/PWGPP/MUON/dep/AddTaskMuonPerformance.C");
     AliAnalysisTaskMuonPerformance* muonPerformance = AddTaskMuonPerformance();
@@ -188,14 +188,14 @@ void AddAnalysisTasks(Int_t merge){
     muonPerformance->UseMCKinematics(kTRUE);
     muonPerformance->SetMCTrigLevelFromMatchTrk(kTRUE);
   }
-  
+
   if (iMUONEfficiency) {
     gROOT->LoadMacro("$ALICE_ROOT/PWGPP/MUON/dep/AddTaskMUONTrackingEfficiency.C");
     AliAnalysisTaskMuonTrackingEff* muonEfficiency = AddTaskMUONTrackingEfficiency(kTRUE, kTRUE);
     if (usePhysicsSelection) muonEfficiency->SelectCollisionCandidates(AliVEvent::kAny);
     muonEfficiency->UseMCLabel(kTRUE);
   }
-  
+
   if (iESDfilter) {
     //  ESD filter task configuration.
     gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/ESDfilter/macros/AddTaskESDFilter.C");
@@ -208,8 +208,8 @@ void AddAnalysisTasks(Int_t merge){
     } else {
       AliAnalysisTaskESDfilter *taskesdfilter = AddTaskESDFilter(useKFILTER, kFALSE, kFALSE, kFALSE /*usePhysicsSelection*/,kFALSE,kTRUE,kTRUE,kTRUE,1100,muonMCMode); // others
     }
-    
-    if ( 0 && VAR_USE_ITS_RECO ) /* 0 for the moment to get this macro running also with AliRoot <= .... */      
+
+    if ( 0 && VAR_USE_ITS_RECO ) /* 0 for the moment to get this macro running also with AliRoot <= .... */
     {
       AliAnalysisTaskESDMuonFilter* muFilter = mgr->GetTask("ESD Muon Filter");
       if ( !muFilter )
@@ -221,9 +221,9 @@ void AddAnalysisTasks(Int_t merge){
         muFilter->SetWithSPDtracklets(kTRUE);
       }
     }
-  }   
-  
-  // ********** PWG3 wagons ******************************************************           
+  }
+
+  // ********** PWG3 wagons ******************************************************
   // PWG3 vertexing
   if (iPWG3vertexing) {
     gROOT->LoadMacro("$ALICE_ROOT/PWG3/vertexingHF/macros/AddTaskVertexingHF.C");
@@ -232,8 +232,8 @@ void AddAnalysisTasks(Int_t merge){
     if (!taskvertexingHF) ::Warning("AnalysisTrainNew", "AliAnalysisTaskSEVertexingHF cannot run for this train conditions - EXCLUDED");
     else mgr->RegisterExtraFile("AliAOD.VertexingHF.root");
     taskvertexingHF->SelectCollisionCandidates(0);
-  }   
-  
+  }
+
   // PWG3 JPSI filtering (only pp)
   if (iPWG3JPSIfilter && (iCollision==0)) {
     gROOT->LoadMacro("$ALICE_ROOT/PWG3/dielectron/macros/AddTaskJPSIFilter.C");
@@ -241,18 +241,18 @@ void AddAnalysisTasks(Int_t merge){
     if (!taskJPSIfilter) ::Warning("AnalysisTrainNew", "AliAnalysisTaskDielectronFilter cannot run for this train conditions - EXCLUDED");
     else mgr->RegisterExtraFile("AliAOD.Dielectron.root");
     taskJPSIfilter->SelectCollisionCandidates(0);
-  }   
-  
+  }
+
   // PWG3 D2h
-  if (iPWG3d2h) {   
+  if (iPWG3d2h) {
     gROOT->LoadMacro("$ALICE_ROOT/PWG3/vertexingHF/AddD2HTrain.C");
     TFile::Cp(gSystem->ExpandPathName(configPWG3d2h.Data()), "file:ConfigVertexingHF.C");
-    AddD2HTrain(kFALSE, 1,0,0,0,0,0,0,0,0,0,0);                                 
+    AddD2HTrain(kFALSE, 1,0,0,0,0,0,0,0,0,0,0);
   }
-  
+
   // ********** PWG4 wagons ******************************************************
   // Jet analysis
-  
+
   // Configurations flags, move up?
   TString kDeltaAODJetName = "AliAOD.Jets.root"; //
   Bool_t  kIsPbPb = (iCollision==0)?false:true; // can be more intlligent checking the name of the data set
@@ -263,7 +263,7 @@ void AddAnalysisTasks(Int_t merge){
   if (iJETAN) {
     gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskJets.C");
     // Default jet reconstructor running on ESD's
-    AliAnalysisTaskJets *taskjets = AddTaskJets("AOD","UA1",0.4,kHighPtFilterMask,1.,0); // no background subtraction     
+    AliAnalysisTaskJets *taskjets = AddTaskJets("AOD","UA1",0.4,kHighPtFilterMask,1.,0); // no background subtraction
     if (!taskjets) ::Fatal("AnalysisTrainNew", "AliAnalysisTaskJets cannot run for this train conditions - EXCLUDED");
     if(kDeltaAODJetName.Length()>0) taskjets->SetNonStdOutputFile(kDeltaAODJetName.Data());
     if (iJETANdelta) {
@@ -275,36 +275,36 @@ void AddAnalysisTasks(Int_t merge){
        taskjets = AddTaskJets("AOD","UA1",0.4,kHighPtFilterMask,1.,2); // background subtraction
        if(kDeltaAODJetName.Length()>0)taskjets->SetNonStdOutputFile(kDeltaAODJetName.Data());
       }
-      // SICONE 
-      taskjets = AddTaskJets("AOD","SISCONE",0.4,kHighPtFilterMask,0.15,0); //no background subtration to be done later....                                                                                  
+      // SICONE
+      taskjets = AddTaskJets("AOD","SISCONE",0.4,kHighPtFilterMask,0.15,0); //no background subtration to be done later....
       if(kDeltaAODJetName.Length()>0)taskjets->SetNonStdOutputFile(kDeltaAODJetName.Data());
       cTmp = taskjets->GetNonStdBranch();
       if(cTmp.Length()>0)kJetSubtractBranches += Form("%s ",cTmp.Data());
-      
+
       // Add the clusters..
       gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskJetCluster.C");
       AliAnalysisTaskJetCluster *taskCl = 0;
       Float_t fCenUp = 0;
       Float_t fCenLo = 0;
       Float_t fTrackEtaWindow = 0.9;
-      taskCl = AddTaskJetCluster("AOD","",kHighPtFilterMask,iPhysicsSelectionFlag,"KT",0.4,0,1, kDeltaAODJetName.Data(),0.15,fTrackEtaWindow,0); // this one is for the background and random jets, random cones with no skip                                                                                 
+      taskCl = AddTaskJetCluster("AOD","",kHighPtFilterMask,iPhysicsSelectionFlag,"KT",0.4,0,1, kDeltaAODJetName.Data(),0.15,fTrackEtaWindow,0); // this one is for the background and random jets, random cones with no skip
       taskCl->SetBackgroundCalc(kTRUE);
       taskCl->SetNRandomCones(10);
       taskCl->SetCentralityCut(fCenLo,fCenUp);
       taskCl->SetGhostEtamax(fTrackEtaWindow);
       kDefaultJetBackgroundBranch = Form("%s_%s",AliAODJetEventBackground::StdBranchName(),taskCl->GetJetOutputBranch());
-      
+
       taskCl = AddTaskJetCluster("AOD","",kHighPtFilterMask,iPhysicsSelectionFlag,"ANTIKT",0.4,2,1,kDeltaAODJetName.Data(),0.15);
       taskCl->SetCentralityCut(fCenLo,fCenUp);
       if(kIsPbPb)taskCl->SetBackgroundBranch(kDefaultJetBackgroundBranch.Data());
       taskCl->SetNRandomCones(10);
       kJetSubtractBranches += Form("%s ",taskCl->GetJetOutputBranch());
-      
+
       taskCl = AddTaskJetCluster("AOD","",kHighPtFilterMask,iPhysicsSelectionFlag,"ANTIKT",0.2,0,1,kDeltaAODJetName.Data(),0.15);
       taskCl->SetCentralityCut(fCenLo,fCenUp);
       if(kIsPbPb)taskCl->SetBackgroundBranch(kDefaultJetBackgroundBranch.Data());
       kJetSubtractBranches += Form("%s ",taskCl->GetJetOutputBranch());
-      
+
       // DO THE BACKGROUND SUBTRACTION
       if(kIsPbPb&&kJetSubtractBranches.Length()){
        gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskJetBackgroundSubtract.C");
@@ -313,7 +313,7 @@ void AddAnalysisTasks(Int_t merge){
        taskSubtract->SetBackgroundBranch(kDefaultJetBackgroundBranch.Data());
        if(kDeltaAODJetName.Length()>0)taskSubtract->SetNonStdOutputFile(kDeltaAODJetName.Data());
       }
-    } 
+    }
   }
 }
 
@@ -322,9 +322,9 @@ Bool_t LoadCommonLibraries()
 {
   // Load common analysis libraries.
   if (!gSystem->Getenv("ALICE_ROOT")) {
-    ::Error("AnalysisTrainNew.C::LoadCommonLibraries", "Analysis train requires that analysis libraries are compiled with a local AliRoot"); 
+    ::Error("AnalysisTrainNew.C::LoadCommonLibraries", "Analysis train requires that analysis libraries are compiled with a local AliRoot");
     return kFALSE;
-  }   
+  }
   Bool_t success = kTRUE;
   // Load framework classes. Par option ignored here.
   success &= LoadLibrary("libSTEERBase.so");
@@ -340,9 +340,9 @@ Bool_t LoadCommonLibraries()
     ::Info("AnalysisTrainNew.C::LoadCommodLibraries", "Load common libraries:    SUCCESS");
     ::Info("AnalysisTrainNew.C::LoadCommodLibraries", "Include path for Aclic compilation:\n%s",
           gSystem->GetIncludePath());
-  } else {           
+  } else {
     ::Info("AnalysisTrainNew.C::LoadCommodLibraries", "Load common libraries:    FAILED");
-  }   
+  }
   return success;
 }
 
@@ -353,12 +353,12 @@ Bool_t LoadAnalysisLibraries()
   if (useTender) {
     if (!LoadLibrary("TENDER") ||
        !LoadLibrary("TENDERSupplies")) return kFALSE;
-  }       
+  }
   if (iESDfilter || iPWG3MuonTrain) {
     if (!LoadLibrary("PWGmuon")) return kFALSE;
     //      if (!LoadLibrary("PWG3base")) return kFALSE;
     //      if (!LoadLibrary("PWG3muon")) return kFALSE;
-  }   
+  }
   if (iMUONRefit || iESDMCLabelAddition) {
     if (!LoadLibrary("PWGmuondep")) return kFALSE;
   }
@@ -376,17 +376,17 @@ Bool_t LoadAnalysisLibraries()
        !LoadLibrary("siscone") ||
        !LoadLibrary("SISConePlugin") ||
        !LoadLibrary("FASTJETAN")) return kFALSE;
-  }     
+  }
   // PWG3 Vertexing HF
   if (iPWG3vertexing || iPWG3d2h) {
     if (!LoadLibrary("PWG3base") ||
        !LoadLibrary("PWG3vertexingHF")) return kFALSE;
-  }   
+  }
   // PWG3 dielectron
   if (iPWG3JPSIfilter) {
     if (!LoadLibrary("PWG3dielectron")) return kFALSE;
-  }   
-  
+  }
+
   ::Info("AnalysisTrainNew.C::LoadAnalysisLibraries", "Load other libraries:   SUCCESS");
   return kTRUE;
 }
@@ -400,7 +400,7 @@ Bool_t LoadLibrary(const char *module)
   if (!mod.Length()) {
     ::Error("AnalysisTrainNew.C::LoadLibrary", "Empty module name");
     return kFALSE;
-  }   
+  }
   // If a library is specified, just load it
   if (mod.EndsWith(".so")) {
     mod.Remove(mod.Index(".so"));
@@ -410,16 +410,16 @@ Bool_t LoadLibrary(const char *module)
       return kFALSE;
     }
     return kTRUE;
-  } 
+  }
   // Check if the library is already loaded
-  if (strlen(gSystem->GetLibraries(module, "", kFALSE)) > 0) return kTRUE;    
+  if (strlen(gSystem->GetLibraries(module, "", kFALSE)) > 0) return kTRUE;
   result = gSystem->Load(Form("lib%s", module));
   if (result < 0) {
     ::Error("AnalysisTrainNew.C::LoadLibrary", "Could not load module %s", module);
     return kFALSE;
   }
   return kTRUE;
-}           
+}
 
 
 //______________________________________________________________________________
@@ -427,13 +427,13 @@ TChain *CreateChain()
 {
   // Create the input chain
   chain = new TChain("esdTree");
-  if (gSystem->AccessPathName("AliESDs.root")) 
+  if (gSystem->AccessPathName("AliESDs.root"))
     ::Error("AnalysisTrainNew.C::CreateChain", "File: AliESDs.root not in ./data dir");
-  else 
+  else
     chain->Add("AliESDs.root");
   if (chain->GetNtrees()) return chain;
   return NULL;
-}   
+}
 
 //______________________________________________________________________________
 void AODmerge()
diff --git a/PWG/muondep/AccEffTemplates/simrun.C b/PWG/muondep/AccEffTemplates/simrun.C
deleted file mode 100644 (file)
index 360ddc8..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-// #define VERBOSEARGS
-// simrun.C
-{
-// set job and simulation variables as :
-// root.exe -b -q simrun.C  --run <x> --chunk <y> --event <n> 
-
-  int nrun = 0;
-  int nchunk = 0;
-  int nevent = 0;
-  int seed = 0;
-  Bool_t snapshot(kFALSE);
-  
-  char sseed[1024];
-  char srun[1024];
-  char schunk[1024];
-
-  sprintf(srun,"");
-  sprintf(schunk,"");
-
-  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),"--chunk")))
-      nchunk = atoi(gApplication->Argv(i+1));
-    sprintf(schunk,"%d",nchunk);
-
-    if (!(strcmp(gApplication->Argv(i),"--event")))
-      nevent = atoi(gApplication->Argv(i+1));
-
-    if (!(strcmp(gApplication->Argv(i),"--snapshot")))
-      snapshot = kTRUE;
-  }
-
-  seed = nrun * 10000 + nchunk;
-  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("DC_RUN",srun); // used in AliSimulation.cxx
-  gSystem->Setenv("DC_EVENT",schunk); // Not used in Config.C (used for setting seed)
-  
-// Needed to produce simulated RAW data
-  gSystem->Setenv("ALIMDC_RAWDB1","./mdc1");
-  gSystem->Setenv("ALIMDC_RAWDB2","./mdc2");
-  gSystem->Setenv("ALIMDC_TAGDB","./mdc1/tag");
-  gSystem->Setenv("ALIMDC_RUNDB","./mdc1/meta");
-  cout<< "SIMRUN:: Run " << gSystem->Getenv("DC_RUN")
-          << " Chunk " << gSystem->Getenv("DC_EVENT")
-         << endl;
-
-  cout<<">>>>> SIMULATION <<<<<"<<endl;
-  if ( snapshot )
-  {
-    gSystem->Setenv("OCDB_SNAPSHOT_CREATE","kTRUE");
-    gSystem->Setenv("OCDB_SNAPSHOT_FILENAME","OCDB_sim.root");
-  }
-  
-  gSystem->Exec(Form("aliroot -b -q sim.C\\(%d\\) > sim.log 2>&1",nevent));
-  gSystem->Exec("mv syswatch.log simwatch.log");
-
-  if ( snapshot )
-  {
-    gSystem->Setenv("OCDB_SNAPSHOT_FILENAME","OCDB_rec.root");
-  }
-  
-  cout<<">>>>> RECONSTRUCTION <<<<<"<<endl;
-  
-  gSystem->Exec("aliroot -b -q rec.C > rec.log 2>&1");
-  
-  gSystem->Exec("mv syswatch.log recwatch.log");
-
-  if ( snapshot )
-  {
-    gSystem->Exec(Form("mkdir -p OCDB/%s",srun));
-    gSystem->Exec(Form("mv OCDB_*.root OCDB/%s/",srun));
-  }
-  else
-  {
-    //  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 > checkesd.log 2>&1");
-    cout<<">>>>> MAKE AOD <<<<<"<<endl;
-    gSystem->Exec("aliroot -b -q AODtrain.C > aod.log 2>&1");
-    cout<<">>>>> CHECK AOD <<<<<"<<endl;
-    gSystem->Exec("aliroot -b -q CheckAOD.C > checkaod.log 2>&1");
-  }
-  
-  return 0;
-}
diff --git a/PWG/muondep/AccEffTemplates/simrun.sh b/PWG/muondep/AccEffTemplates/simrun.sh
new file mode 100644 (file)
index 0000000..786ef8a
--- /dev/null
@@ -0,0 +1,181 @@
+#!/bin/bash
+
+# set job and simulation variables as :
+# ./simrun.sh  --run <x> --event <y> --process <kPythia6/kPhojet/kPythia6ATLAS_Flat/kPythia6D6T> --field <kNoField/k5kG> --energy <900/2360/10000>
+
+function runcommand(){
+    echo -e "\n"
+    echo -e "\n" >&2
+
+    echo "* $1 : $2"
+    echo "* $1 : $2" >&2
+
+    time aliroot -b -q -x $2 >>$3 2>&1
+    exitcode=$?
+
+    expectedCode=${5-0}
+
+    if [ "$exitcode" -ne "$expectedCode" ]; then
+        echo "*! $2 failed with exitcode $exitcode, expecting $expectedCode"
+        echo "*! $2 failed with exitcode $exitcode, expecting $expectedCode" >&2
+        echo "$2 failed with exitcode $exitcode, expecting $expectedCode" > validation_error.message
+        exit ${4-$exitcode}
+    else
+        echo "* $2 finished with the expected exit code ($expectedCode), moving on"
+        echo "* $2 finished with the expected exit code ($expectedCode), moving on" >&2
+    fi
+}
+
+# Define the pt hard bin arrays
+pthardbin_loweredges=( 0 5 11 21 36 57 84 117 152 191 234 )
+pthardbin_higheredges=( 5 11 21 36 57 84 117 152 191 234 -1)
+
+CONFIG_SEED=""
+CONFIG_RUN_TYPE=""
+CONFIG_FIELD=""
+CONFIG_ENERGY=""
+CONFIG_PHYSICSLIST=""
+CONFIG_BMIN=""
+CONFIG_BMAX=""
+CONFIG_PTHARDBIN=""
+CONFIG_PTHARDMIN=""
+CONFIG_PTHARDMAX=""
+CONFIG_QUENCHING=""
+DC_RUN=""
+DC_EVENT=""
+
+RUNMODE=""
+
+while [ ! -z "$1" ]; do
+    option="$1"
+    shift
+
+    if [ "$option" = "--run" ]; then
+            DC_RUN="$1"
+            shift
+    elif [ "$option" = "--event" ]; then
+            DC_EVENT="$1"
+            shift
+    elif [ "$option" = "--process" ]; then
+            CONFIG_RUN_TYPE="$1"
+            shift
+    elif [ "$option" = "--field" ]; then
+            CONFIG_FIELD="$1"
+            shift
+    elif [ "$option" = "--energy" ]; then
+            CONFIG_ENERGY="$1"
+            shift
+    elif [ "$option" = "--physicslist" ]; then
+            CONFIG_PHYSICSLIST="$1"
+            shift
+    elif [ "$option" = "--bmin" ]; then
+            CONFIG_BMIN="$1"
+            shift
+    elif [ "$option" = "--bmax" ]; then
+            CONFIG_BMAX="$1"
+            shift
+    elif [ "$option" = "--pthardbin" ]; then
+            CONFIG_PTHARDBIN="$1"
+            shift
+    elif [ "$option" = "--quench" ]; then
+            CONFIG_QUENCHING="$1"
+            shift
+    elif [ "$option" = "--sdd" ]; then
+            RUNMODE="SDD"
+    fi
+done
+
+CONFIG_SEED=$((ALIEN_PROC_ID%1000000000))
+
+if [ "$CONFIG_SEED" -eq 0 ]; then
+    CONFIG_SEED=$(((DC_RUN*100000+DC_EVENT)%1000000000))
+    echo "* MC Seed is $CONFIG_SEED (based on run / counter : $DC_RUN / $DC_EVENT)"
+else
+    echo "* MC Seed is $CONFIG_SEED (based on AliEn job ID)"
+fi
+
+if [ "$CONFIG_SEED" -eq 0 ]; then
+    echo "*!  WARNING! Seeding variable for MC is 0 !" >&2
+fi
+
+echo "* b min is $CONFIG_BMIN"
+echo "* b max is $CONFIG_BMAX"
+echo "* pt hard bin is $CONFIG_PTHARDBIN"
+
+if [ ! -z "$CONFIG_PTHARDBIN" ]; then
+    # Define environmental vars for pt binning
+    CONFIG_PTHARDMIN=${pthardbin_loweredges[$CONFIG_PTHARDBIN]}
+    CONFIG_PTHARDMAX=${pthardbin_higheredges[$CONFIG_PTHARDBIN]}
+
+    echo "* pt hard from $CONFIG_PTHARDMIN to $CONFIG_PTHARDMAX"
+fi
+
+mkdir input
+mv galice.root ./input/galice.root
+mv Kinematics.root ./input/Kinematics.root
+ls input
+
+export CONFIG_SEED CONFIG_RUN_TYPE CONFIG_FIELD CONFIG_ENERGY CONFIG_PHYSICSLIST CONFIG_BMIN CONFIG_BMAX CONFIG_PTHARDBIN CONFIG_PTHARDMIN CONFIG_PTHARDMAX DC_RUN DC_EVENT
+
+export ALIMDC_RAWDB1="./mdc1"
+export ALIMDC_RAWDB2="./mdc2"
+export ALIMDC_TAGDB="./mdc1/tag"
+export ALIMDC_RUNDB="./mdc1/meta"
+
+if [ -f "$G4INSTALL/bin/geant4.sh" ]; then
+    echo "* Sourcing G4 environment from $G4INSTALL/bin/geant4.sh"
+    source $G4INSTALL/bin/geant4.sh
+fi
+
+echo "SIMRUN:: Run $DC_RUN Event $DC_EVENT Generator $CONFIG_RUN_TYPE Field $CONFIG_FIELD Energy $CONFIG_ENERGY Physicslist $CONFIG_PHYSICSLIST"
+
+runcommand "SIMULATION" "sim.C" sim.log 5
+mv syswatch.log simwatch.log
+
+runcommand "RECONSTRUCTION" "rec.C" rec.log 10
+mv syswatch.log recwatch.log
+
+runcommand "TAG" "tag.C" tag.log 50
+
+runcommand "CHECK ESD" "CheckESD.C" check.log 60 1
+
+rm -f *.RecPoints.root
+
+if [ "$RUNMODE" = "SDD" ]; then
+    if [ -f QAtrainsim_SDD.C ]; then
+            runcommand "Running the QA train" "QAtrainsim_SDD.C(\"_wSDD\",$DC_RUN)" qa.log 100
+
+            for file in *.stat; do
+                mv $file ../$file.qa_wSDD
+            done
+    fi
+
+    mv AliESDs.root AliESDs_wSDD.root
+    mv AliESDfriends.root AliESDfriends_wSDD.root
+
+    # Without SDD
+
+    for logfile in rec.log qa.log tag.log check.log recwatch.log; do
+            echo -e "\n\n* ------------ Without SDD ------------" >> $logfile
+    done
+
+    runcommand "RECONSTRUCTION without SDD" "recNoSDD.C" rec.log 11
+    cat syswatch.log >> recwatch.log
+    rm syswatch.log
+
+    runcommand "TAG without SDD" "tag.C" tag.log 51
+
+    runcommand "CHECK ESD without SDD" "CheckESD.C" check.log 61 1
+
+    if [ -f QAtrainsim_SDD.C ]; then
+            runcommand "Running the QA train without SDD" "QAtrainsim_SDD.C(\"\",$DC_RUN)" qa.log 101
+
+            for file in *.stat; do
+                mv $file ../$file.qa
+            done
+    fi
+fi
+
+rm -f *.RecPoints.root *.Hits.root *.Digits.root *.SDigits.root
+
+exit 0
diff --git a/PWG/muondep/AccEffTemplates/validation.sh b/PWG/muondep/AccEffTemplates/validation.sh
deleted file mode 100644 (file)
index 39f40b0..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-#!/bin/sh
-##################################################
-validateout=`dirname $0`
-validatetime=`date`
-validated="0";
-error=1
-if [ -z $validateout ]
-then
-    validateout="."
-fi
-
-cd $validateout;
-validateworkdir=`pwd`;
-
-echo "*******************************************************" >> stdout;
-echo "* AliRoot Validation Script V1.0                      *" >> stdout;
-echo "* Time:    $validatetime " >> stdout;
-echo "* Dir:     $validateout" >> stdout;
-echo "* Workdir: $validateworkdir" >> stdout;
-echo "* ----------------------------------------------------*" >> stdout;
-echo "* Library path: $LD_LIBRARY_PATH" >> stdout;
-echo "* ----------------------------------------------------*" >> stdout;
-echo "* Path: $PATH" >> stdout;
-echo "* ----------------------------------------------------*" >> stdout;
-ls -la ./ >> stdout;
-echo "* ----------------------------------------------------*" >> stdout;
-
-##################################################
-#if [ -f rec.log ] && [ -f sim.log ] && [ -f check.log ] && [ -f tag.log ] && [ -f aod.log ] && [ -f *ESD.tag.root ]
-#if [ -f rec.log ] && [ -f sim.log ] && [ -f check.log ] && [ -f tag.log ] && [ -f aod.log ] && [ -f *ESD.tag.root ] && [ -f AnalysisResults.root ]
-if [ -f rec.log ] && [ -f sim.log ] && [ -f checkesd.log ] && [ -f checkaod.log ] && [ -f aod.log ]
-then
-sv=`grep -i  "Segmentation violation" *.log`
-if [ "$sv" = "" ]
-    then
-    sf=`grep -i  "Segmentation fault" *.log`
-    if [ "$sf" = "" ]
-        then
-        be=`grep -i  "Bus error" *.log`
-        if [ "$be" = "" ]
-            then
-            ab=`grep -i -w "Abort" *.log`
-            if [ "$ab" = "" ]
-                then
-                fp=`grep -i  "Floating point exception" *.log`
-                if [ "$fp" = "" ]
-                    then
-                    kl=`grep -i  "Killed" *.log`
-                    if [ "$kl" = "" ]
-                        then
-                        bf=`grep -i "busy flag cleared" *.log`
-                        if [ "$bf" = "" ]
-                            then
-                            ch=`grep -i "check of ESD was successfull" checkesd.log`
-                            if [ "$ch" = "" ]
-                            then
-                                echo "* #  The ESD was not successfully checked   *"  >>stdout;
-                            else
-                                ao=`grep -i "check of AOD was successfull" checkaod.log`
-                                if [ "$ao" = "" ]
-                                then
-                                    echo "* #  The AOD was not successfully checked   *"  >>stdout;
-                                else
-                                    echo "* ----------------   Job Validated  ------------------*" >> stdout;
-                                    echo "Removing log files which will not be needed then" >> stdout;
-                                    rm -f *.log
-                                    touch ok.log
-                                    error="0";
-                               fi
-                            fi
-                        fi
-                    fi
-                fi
-            fi
-        fi
-    fi
-fi
-else
-    echo "* ########## Job not validated - no rec.log or sim.log or checkaod.log or checkesd.log ###" >> stdout;
-    echo "* ########## Removing all ROOT files from the local directory, leaving only the logs ###" >> stdout;
-    rm -rf *.root
-fi
-if [ "$error" = "1" ]
-    then
-    echo "* ################   Job not validated ################" >> stdout;
-fi
-echo "* ----------------------------------------------------*" >> stdout;
-echo "*******************************************************" >> stdout;
-sleep 15;
-cd -
-exit $error
-
index 164ffb4..91ad049 100644 (file)
@@ -297,13 +297,13 @@ fUseAODMerging(kFALSE)
   
   AddToTemplateFileList("CheckESD.C");
   AddToTemplateFileList("CheckAOD.C");
-  AddToTemplateFileList("AODtrain.C");
-  AddToTemplateFileList("validation.sh");
+  AddToTemplateFileList("AODtrainsim.C");
+//  AddToTemplateFileList("validation.sh");
   
   AddToTemplateFileList("Config.C");
   AddToTemplateFileList("rec.C");
   AddToTemplateFileList("sim.C");
-  AddToTemplateFileList("simrun.C");
+  AddToTemplateFileList("simrun.sh");
   AddToTemplateFileList(RunJDLName().Data());
   
   UseExternalConfig(fExternalConfig);
@@ -384,7 +384,7 @@ Bool_t AliMuonAccEffSubmitter::GenerateMergeJDL(const char* name) const
   
   if ( !final )
   {
-    OutputToJDL(*os,"InputFile",Form("LF:%s/AODtrain.C",RemoteDir().Data()));
+    OutputToJDL(*os,"InputFile",Form("LF:%s/AODtrainsim.C",RemoteDir().Data()));
     OutputToJDL(*os,"OutputDir",Form("%s/$1/Stage_$2/#alien_counter_03i#",RemoteDir().Data()));
     OutputToJDL(*os,"InputDataCollection",Form("%s/$1/Stage_$2.xml,nodownload",RemoteDir().Data()));
     OutputToJDL(*os,"split","se");
@@ -394,7 +394,7 @@ Bool_t AliMuonAccEffSubmitter::GenerateMergeJDL(const char* name) const
   }
   else
   {
-    OutputToJDL(*os,"InputFile",Form("LF:%s/AODtrain.C",RemoteDir().Data()),
+    OutputToJDL(*os,"InputFile",Form("LF:%s/AODtrainsim.C",RemoteDir().Data()),
            Form("LF:%s/$1/wn.xml",RemoteDir().Data()));
     OutputToJDL(*os,"OutputDir",Form("%s/$1",RemoteDir().Data()));
   }
@@ -480,13 +480,13 @@ Bool_t AliMuonAccEffSubmitter::GenerateRunJDL(const char* name) const
     return kFALSE;
   }
   
-  OutputToJDL(*os,"splitarguments","simrun.C --run $1 --chunk #alien_counter# --event $3");
+  OutputToJDL(*os,"splitarguments","--run $1 --chunk #alien_counter# --event $3");
   
   OutputToJDL(*os,"Workdirectorysize","5000MB");
   
   OutputToJDL(*os,"JDLVariables","Packages","OutputDir");
 
-  OutputToJDL(*os,"Validationcommand",Form("%s/validation.sh",RemoteDir().Data()));
+  OutputToJDL(*os,"Validationcommand","/alice/validation/validation.sh");
 
   if ( GetVar("VAR_GENERATOR").Contains("pythia",TString::kIgnoreCase) )
   {
@@ -533,7 +533,7 @@ Bool_t AliMuonAccEffSubmitter::MakeOCDBSnapshots()
     }
     else
     {
-      gSystem->Exec(Form("aliroot -b -q -x simrun.C --run %d --snapshot",runNumber));
+      gSystem->Exec(Form("simrun.sh --run %d --snapshot",runNumber));
     
       if ( gSystem->AccessPathName(ocdbSim.Data()) )
       {
@@ -942,15 +942,15 @@ Int_t AliMuonAccEffSubmitter::LocalTest()
     return 0;
   }
   
-  std::cout << "Generating script to execute : ./simrun.sh" << std::endl;
-  
-  std::ofstream out("simrun.sh");
-  
-  out << "#!/bin/bash" << std::endl;
-//  root.exe -b -q simrun.C  --run <x> --chunk <y> --event <n>
-  out << "root.exe -b -q simrun.C --run "<< runs[0] <<" --event " << fFixedNofEvents << std::endl;
-
-  out.close();
+//  std::cout << "Generating script to execute : ./simrun.sh" << std::endl;
+//
+//  std::ofstream out("simrun.sh");
+//
+//  out << "#!/bin/bash" << std::endl;
+////  root.exe -b -q simrun.C  --run <x> --chunk <y> --event <n>
+//  out << "root.exe -b -q simrun.C --run "<< runs[0] <<" --event " << fFixedNofEvents << std::endl;
+//
+//  out.close();
 
   gSystem->Exec("chmod +x simrun.sh");
 
@@ -958,10 +958,12 @@ Int_t AliMuonAccEffSubmitter::LocalTest()
   
   gSystem->Exec("rm -rf TrackRefs.root *.SDigits*.root Kinematics.root *.Hits.root geometry.root gphysi.dat Run*.tag.root HLT*.root *.ps *.Digits.root *.RecPoints.root galice.root *QA*.root Trigger.root *.log AliESD* AliAOD* *.d *.so *.stat");
 
-  std::cout << "Executing the script : ./simrun.sh" << std::endl;
+  TString command = Form("./simrun.sh --run %i --event %i", runs[0], fFixedNofEvents);
+
+  std::cout << "Executing the script : " << command.Data() << std::endl;
 
 
-  gSystem->Exec("./simrun.sh");
+  gSystem->Exec(command.Data());
   
   return 1;
 }