From Christian: Patch to AliAnalysisAlien that: Stores in a TString the list of job...
authoragheata <agheata@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 28 Jan 2013 08:14:17 +0000 (08:14 +0000)
committeragheata <agheata@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 28 Jan 2013 08:14:17 +0000 (08:14 +0000)
ANALYSIS/AliAnalysisAlien.cxx
ANALYSIS/AliAnalysisAlien.h
ANALYSIS/macros/AnalysisTrainNew.C

index db94839..1e2aed5 100644 (file)
@@ -139,7 +139,9 @@ AliAnalysisAlien::AliAnalysisAlien()
                   fPackages(0),
                   fModules(0),
                   fProofParam(),
-                  fDropToShell(true)
+  fDropToShell(true),
+  fGridJobIDs(""),
+  fGridStages("")
 {
 // Dummy ctor.
    SetDefaults();
@@ -214,7 +216,9 @@ AliAnalysisAlien::AliAnalysisAlien(const char *name)
                   fPackages(0),
                   fModules(0),
                   fProofParam(),
-                  fDropToShell(true)
+                  fDropToShell(true),
+                  fGridJobIDs(""),
+                  fGridStages("")
 {
 // Default ctor.
    SetDefaults();
@@ -289,7 +293,9 @@ AliAnalysisAlien::AliAnalysisAlien(const AliAnalysisAlien& other)
                   fPackages(0),
                   fModules(0),
                   fProofParam(),
-                  fDropToShell(other.fDropToShell)
+                  fDropToShell(other.fDropToShell),
+                  fGridJobIDs(other.fGridJobIDs),
+                  fGridStages(other.fGridStages)
 {
 // Copy ctor.
    fGridJDL = (TGridJDL*)gROOT->ProcessLine("new TAlienJDL()");
@@ -403,6 +409,8 @@ AliAnalysisAlien &AliAnalysisAlien::operator=(const AliAnalysisAlien& other)
       fProofProcessOpt         = other.fProofProcessOpt;
       fMergeDirName            = other.fMergeDirName;
       fDropToShell             = other.fDropToShell;
+      fGridJobIDs              = other.fGridJobIDs;
+      fGridStages              = other.fGridStages;
       if (other.fInputFiles) {
          fInputFiles = new TObjArray();
          TIter next(other.fInputFiles);
@@ -2596,19 +2604,26 @@ Bool_t AliAnalysisAlien::CheckMergedFiles(const char *filename, const char *alie
    // Check if this is the last stage to be done.
    Bool_t laststage = (nfiles<nperchunk);
    if (fMaxMergeStages && stage>=fMaxMergeStages) laststage = kTRUE;
+   Int_t jobId = 0;
    if (laststage) {
       printf("### Submiting final merging stage %d\n", stage);
       TString finalJDL = jdl;
       finalJDL.ReplaceAll(".jdl", "_final.jdl");
       TString query = Form("submit %s %s %d", finalJDL.Data(), aliendir, stage);
-      Int_t jobId = SubmitSingleJob(query);
-      if (!jobId) return kFALSE;      
+      jobId = SubmitSingleJob(query);
    } else {
       printf("### Submiting merging stage %d\n", stage);
       TString query = Form("submit %s %s %d", jdl, aliendir, stage);
-      Int_t jobId = SubmitSingleJob(query);
-      if (!jobId) return kFALSE;           
+      jobId = SubmitSingleJob(query);
    }
+   if (!jobId) return kFALSE;           
+
+   if (!fGridJobIDs.IsNull()) fGridJobIDs.Append(" ");
+   fGridJobIDs.Append(Form("%d", jobId));
+   if (!fGridStages.IsNull()) fGridStages.Append(" ");
+   fGridStages.Append(Form("%s_merge_stage%d", 
+                          laststage ? "final" : "partial", stage));
+
    return kTRUE;   
 }        
 
@@ -2650,8 +2665,9 @@ Int_t AliAnalysisAlien::SubmitSingleJob(const char *query)
       ::Error("SubmitSingleJob", "Your query %s could not be submitted", query);
       return 0;
    }
-   printf(" Job id: %s\n", jobId.Data());
-   return atoi(jobId);
+   Int_t ijobId = jobId.Atoi();
+   printf(" Job id: '%s' (%d)\n", jobId.Data(), ijobId);
+   return ijobId; 
 }  
 
 //______________________________________________________________________________
@@ -3455,6 +3471,8 @@ Bool_t AliAnalysisAlien::StartAnalysis(Long64_t /*nentries*/, Long64_t /*firstEn
    gGrid->Cd(fGridOutputDir);
    TGridResult *res;
    TString jobID = "";
+   fGridJobIDs = "";
+   fGridStages = "";
    if (!fRunNumbers.Length() && !fRunRange[0]) {
       // Submit a given xml or a set of runs
       res = gGrid->Command(Form("submit %s", fJDLName.Data()));
@@ -3472,6 +3490,12 @@ Bool_t AliAnalysisAlien::StartAnalysis(Long64_t /*nentries*/, Long64_t /*firstEn
             \n_______________________________________________________________________",
                    fJDLName.Data(), cjobId);
             jobID = cjobId;      
+           if (jobID.Atoi()) { 
+             if (!fGridJobIDs.IsNull()) fGridJobIDs.Append(" ");
+             fGridJobIDs.Append(jobID);
+             if (!fGridStages.IsNull()) fGridStages.Append(" ");
+             fGridStages.Append("full");
+           }
          }          
          delete res;
       } else {
@@ -3481,6 +3505,7 @@ Bool_t AliAnalysisAlien::StartAnalysis(Long64_t /*nentries*/, Long64_t /*firstEn
    } else {
       // Submit for a range of enumeration of runs.
       if (!Submit()) return kFALSE;
+      jobID = fGridJobIDs;
    }   
          
    if (fDropToShell) {
@@ -3741,6 +3766,10 @@ Bool_t AliAnalysisAlien::SubmitNext()
             \n#####   Your JDL %s submitted (%d to go). \nTHE JOB ID IS: %s \
             \n_______________________________________________________________________",
                 fJDLName.Data(), nmasterjobs-fNsubmitted-1, cjobId1.Data());
+           if (!fGridJobIDs.IsNull()) fGridJobIDs.Append(" ");
+           fGridJobIDs.Append(cjobId1);
+           if (!fGridStages.IsNull()) fGridStages.Append(" ");
+           fGridStages.Append("full");
             jobID += cjobId1;
             jobID += " ";
             lastmaster = cjobId1.Atoi();
index 9152175..6f30ffa 100644 (file)
@@ -153,7 +153,8 @@ public:
    // .txt file containing the list of files to be chained in test mode
    virtual void        SetFileForTestMode(const char *filename)          {fFileForTestMode = filename;}
    virtual TChain     *GetChainForTestMode(const char *treeName) const;
-
+   virtual const TString& GetGridJobIDs() const { return fGridJobIDs; }
+   virtual const TString& GetGridStages() const { return fGridStages; }
 protected:
    void                CdWork();
    Bool_t              CheckInputData();
@@ -238,7 +239,9 @@ private:
    TObjArray       *fModules;         // List of AliAnalysisTaskCfg modules
    TMap             fProofParam;      // Key-value pairs for proof mode
    Bool_t           fDropToShell;     // If true, execute aliensh on start
-   
-   ClassDef(AliAnalysisAlien, 21)   // Class providing some AliEn utilities
+   TString          fGridJobIDs;      // List of last committed jobs
+   TString          fGridStages;      // List of last committed jobs
+
+   ClassDef(AliAnalysisAlien, 22)   // Class providing some AliEn utilities
 };
 #endif
index 351ea6d..fa49f98 100644 (file)
@@ -501,12 +501,22 @@ void AddAnalysisTasks()
       if (!taskunicor) ::Warning("AnalysisTrainNew", "AliAnalysisTaskUnicor cannot run for this train conditions - EXCLUDED");
    }   
 
-   // FMD
+   // Forward Multiplicity
    AliAnalysisManager::SetCommonFileName("forward.root");
    if (iPWG2forward) {
-      gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis/AddTaskFMD.C");
-      AliFMDAnalysisTaskSE *taskfmd = AddTaskFMD();
-      if (!taskfmd) ::Warning("AnalysisTrainNew", "AliFMDAnalysisTaskSE cannot run for this train conditions - EXCLUDED");
+      gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/AddTaskForwardMult.C");
+      gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/AddTaskCentralMult.C");
+      Bool_t   mc  = false;
+      UShort_t sys = 0; // 0: get from data, 1: pp, 2: AA 
+      UShort_t sNN = 0; // 0: get from data, otherwise center of mass
+                       // energy (per nucleon pair)
+      Short_t  fld = 0; // 0: get from data, otherwise L3 field in kG
+      AliAnalysisTask *taskForward = AddTaskForwardMult(mc, sys, sNN, fld);
+      if (!taskForward) 
+       ::Warning("AnalysisTrainNew", "AliForwardMultiplicityTask cannot run for this train conditions - EXCLUDED");
+      AliAnalysisTask *taskCentral = AddTaskCentralMult(mc, sys, sNN, fld);
+      if (!taskCentral) 
+       ::Warning("AnalysisTrainNew", "AliCentralMultiplicityTask cannot run for this train conditions - EXCLUDED");
    }   
    AliAnalysisManager::SetCommonFileName("PWG2histograms.root");
 
@@ -993,7 +1003,7 @@ Bool_t LoadAnalysisLibraries(const char *mode)
    }   
    // PWG2 FORWARD
    if (iPWG2forward) {
-      if (!LoadLibrary("PWG2forward", mode, kTRUE)) return kFALSE;
+      if (!LoadLibrary("PWG2forward2", mode, kTRUE)) return kFALSE;
    }   
    // PWG3 Vertexing HF
    if (iPWG3vertexing || iPWG3d2h) {