Added plugin->SetProofParameter(const char *name, const char *value) to set special...
authoragheata <agheata@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 26 Apr 2011 12:46:12 +0000 (12:46 +0000)
committeragheata <agheata@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 26 Apr 2011 12:46:12 +0000 (12:46 +0000)
ANALYSIS/AliAnalysisAlien.cxx
ANALYSIS/AliAnalysisAlien.h

index 33f0ed8..1158f43 100644 (file)
@@ -111,7 +111,8 @@ AliAnalysisAlien::AliAnalysisAlien()
                   fAliRootMode(),
                   fMergeDirName(),
                   fInputFiles(0),
-                  fPackages(0)
+                  fPackages(0),
+                  fProofParam()
 {
 // Dummy ctor.
    SetDefaults();
@@ -181,7 +182,8 @@ AliAnalysisAlien::AliAnalysisAlien(const char *name)
                   fAliRootMode(),
                   fMergeDirName(),
                   fInputFiles(0),
-                  fPackages(0)
+                  fPackages(0),
+                  fProofParam()
 {
 // Default ctor.
    SetDefaults();
@@ -251,7 +253,8 @@ AliAnalysisAlien::AliAnalysisAlien(const AliAnalysisAlien& other)
                   fAliRootMode(other.fAliRootMode),
                   fMergeDirName(other.fMergeDirName),
                   fInputFiles(0),
-                  fPackages(0)
+                  fPackages(0),
+                  fProofParam()
 {
 // Copy ctor.
    fGridJDL = (TGridJDL*)gROOT->ProcessLine("new TAlienJDL()");
@@ -282,6 +285,7 @@ AliAnalysisAlien::~AliAnalysisAlien()
    if (fMergingJDL) delete fMergingJDL;
    if (fInputFiles) delete fInputFiles;
    if (fPackages) delete fPackages;
+   fProofParam.DeleteAll();
 }   
 
 //______________________________________________________________________________
@@ -2355,6 +2359,30 @@ void AliAnalysisAlien::SetPreferedSE(const char */*se*/)
 }
 
 //______________________________________________________________________________
+void AliAnalysisAlien::SetProofParameter(const char *pname, const char *value)
+{
+// Set some PROOF special parameter.
+   TPair *pair = dynamic_cast<TPair*>(fProofParam.FindObject(pname));
+   if (pair) {
+      TObject *old = pair->Key();
+      TObject *val = pair->Value();
+      fProofParam.Remove(old);
+      delete old;
+      delete val;
+   }
+   fProofParam.Add(new TObjString(pname), new TObjString(value));
+}
+
+//______________________________________________________________________________
+const char *AliAnalysisAlien::GetProofParameter(const char *pname) const
+{
+// Returns a special PROOF parameter.
+   TPair *pair = dynamic_cast<TPair*>(fProofParam.FindObject(pname));
+   if (!pair) return 0;
+   return pair->Value()->GetName();
+}      
+
+//______________________________________________________________________________
 Bool_t AliAnalysisAlien::StartAnalysis(Long64_t /*nentries*/, Long64_t /*firstEntry*/)
 {
 // Start remote grid analysis.
@@ -2427,6 +2455,13 @@ Bool_t AliAnalysisAlien::StartAnalysis(Long64_t /*nentries*/, Long64_t /*firstEn
       }   
       if (fNproofWorkersPerSlave*fNproofWorkers > 0)
          gROOT->ProcessLine(Form("gProof->SetParallel(%d);", fNproofWorkers));
+      // Set proof special parameters if any
+      TIter nextpp(&fProofParam);
+      TObject *proofparam;
+      while ((proofparam=nextpp())) {
+         TString svalue = GetProofParameter(proofparam->GetName());
+         gROOT->ProcessLine(Form("gProof->SetParameter(\"%s\",%s);", proofparam->GetName(), svalue.Data()));
+      }   
       // Is dataset existing ?
       if (!testMode) {
          TString dataset = fProofDataSet;
index c5e031d..1f78521 100644 (file)
 #include <TMath.h>
 #endif
 
+#ifndef ROOT_TMap
+#include <TMap.h>
+#endif
+
 class TGridJDL;
 
 class AliAnalysisAlien : public AliAnalysisGrid {
@@ -122,6 +126,8 @@ public:
    virtual void        SetProofCluster(const char *cluster)              {fProofCluster = cluster;}
    virtual void        SetProofDataSet(const char *dataset)              {fProofDataSet = dataset;}
    virtual const char *GetProofDataSet() const                           {return fProofDataSet.Data();}
+   virtual void        SetProofParameter(const char *pname, const char *value);
+   const char         *GetProofParameter(const char *pname) const;
    virtual void        SetProofReset(Int_t mode)                         {fProofReset = mode;}
    virtual void        SetNproofWorkers(Int_t nworkers)                  {fNproofWorkers = nworkers;}
    virtual void        SetNproofWorkersPerSlave(Int_t nworkers)          {fNproofWorkersPerSlave = nworkers;}
@@ -207,7 +213,8 @@ private:
    TString          fMergeDirName;    // Name of the directory that should be added to the output directory
    TObjArray       *fInputFiles;      // List of input files to be processed by the job
    TObjArray       *fPackages;        // List of packages to be used
+   TMap             fProofParam;      // Key-value pairs for proof mode
    
-   ClassDef(AliAnalysisAlien, 17)   // Class providing some AliEn utilities
+   ClassDef(AliAnalysisAlien, 18)   // Class providing some AliEn utilities
 };
 #endif