]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
- Implemented possibility to write the delta AOD's in a subdirectory of the folder...
authoragheata <agheata@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 2 Dec 2009 09:34:00 +0000 (09:34 +0000)
committeragheata <agheata@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 2 Dec 2009 09:34:00 +0000 (09:34 +0000)
   plugin->SetOutputSingleFolder("deltas")
If the input file is:
   /alice/sim/.../AOD/001/032/AliAODs.root
Then the outputs for each delta AOD job will go to:
   /alice/sim/.../AOD/001/032/deltas/AliAODs.root
- Added possibility to request other external packages than root, aliroot and gapi:
e.g.   plugin->AddExternalPackage("VO_ALICE@fastjet::v2.4.0")
- Included libMinuit.so to common loaded libraries

ANALYSIS/AliAnalysisAlien.cxx
ANALYSIS/AliAnalysisAlien.h

index a4191da6569bfcbcca6d3888e4f8f49cdc1c6275..13b379d8828e1867a755688c74653d109087c234 100644 (file)
@@ -65,6 +65,7 @@ AliAnalysisAlien::AliAnalysisAlien()
                   fAPIVersion(),
                   fROOTVersion(),
                   fAliROOTVersion(),
+                  fExternalPackages(),
                   fUser(),
                   fGridWorkingDir(),
                   fGridDataDir(),
@@ -80,6 +81,7 @@ AliAnalysisAlien::AliAnalysisAlien()
                   fCloseSE(),
                   fFriendChainName(),
                   fJobTag(),
+                  fOutputSingle(),
                   fInputFiles(0),
                   fPackages(0)
 {
@@ -112,6 +114,7 @@ AliAnalysisAlien::AliAnalysisAlien(const char *name)
                   fAPIVersion(),
                   fROOTVersion(),
                   fAliROOTVersion(),
+                  fExternalPackages(),
                   fUser(),
                   fGridWorkingDir(),
                   fGridDataDir(),
@@ -127,6 +130,7 @@ AliAnalysisAlien::AliAnalysisAlien(const char *name)
                   fCloseSE(),
                   fFriendChainName(),
                   fJobTag(),
+                  fOutputSingle(),
                   fInputFiles(0),
                   fPackages(0)
 {
@@ -159,6 +163,7 @@ AliAnalysisAlien::AliAnalysisAlien(const AliAnalysisAlien& other)
                   fAPIVersion(other.fAPIVersion),
                   fROOTVersion(other.fROOTVersion),
                   fAliROOTVersion(other.fAliROOTVersion),
+                  fExternalPackages(other.fExternalPackages),
                   fUser(other.fUser),
                   fGridWorkingDir(other.fGridWorkingDir),
                   fGridDataDir(other.fGridDataDir),
@@ -174,6 +179,7 @@ AliAnalysisAlien::AliAnalysisAlien(const AliAnalysisAlien& other)
                   fCloseSE(other.fCloseSE),
                   fFriendChainName(other.fFriendChainName),
                   fJobTag(other.fJobTag),
+                  fOutputSingle(other.fOutputSingle),
                   fInputFiles(0),
                   fPackages(0)
 {
@@ -234,6 +240,7 @@ AliAnalysisAlien &AliAnalysisAlien::operator=(const AliAnalysisAlien& other)
       fAPIVersion              = other.fAPIVersion;
       fROOTVersion             = other.fROOTVersion;
       fAliROOTVersion          = other.fAliROOTVersion;
+      fExternalPackages        = other.fExternalPackages;
       fUser                    = other.fUser;
       fGridWorkingDir          = other.fGridWorkingDir;
       fGridDataDir             = other.fGridDataDir;
@@ -249,6 +256,7 @@ AliAnalysisAlien &AliAnalysisAlien::operator=(const AliAnalysisAlien& other)
       fCloseSE                 = other.fCloseSE;
       fFriendChainName         = other.fFriendChainName;
       fJobTag                  = other.fJobTag;
+      fOutputSingle            = other.fOutputSingle;
       if (other.fInputFiles) {
          fInputFiles = new TObjArray();
          TIter next(other.fInputFiles);
@@ -300,7 +308,15 @@ void AliAnalysisAlien::AddDataFile(const char *lfn)
    if (!fInputFiles) fInputFiles = new TObjArray();
    fInputFiles->Add(new TObjString(lfn));
 }
-   
+
+//______________________________________________________________________________
+void AliAnalysisAlien::AddExternalPackage(const char *package)
+{
+// Adds external packages w.r.t to the default ones (root,aliroot and gapi)
+   if (fExternalPackages) fExternalPackages += " ";
+   fExternalPackages += package;
+}   
+      
 //______________________________________________________________________________
 Bool_t AliAnalysisAlien::Connect()
 {
@@ -773,6 +789,18 @@ Bool_t AliAnalysisAlien::CreateJDL()
          fGridJDL->AddToPackages("ROOT", fROOTVersion);
       if (fAPIVersion.Length()) 
          fGridJDL->AddToPackages("APISCONFIG", fAPIVersion);
+      if (!fExternalPackages.IsNull()) {
+         arr = fExternalPackages.Tokenize(" ");
+         TIter next(arr);
+         while ((os=(TObjString*)next())) {
+            TString pkgname = os->GetString();
+            Int_t index = pkgname.Index("::");
+            TString pkgversion = pkgname(index+2, pkgname.Length());
+            pkgname.Remove(index);
+            fGridJDL->AddToPackages(pkgname, pkgversion);
+         }   
+         delete arr;   
+      }   
       fGridJDL->SetInputDataListFormat(fInputFormat);
       fGridJDL->SetInputDataList("wn.xml");
       fGridJDL->AddToInputSandbox(Form("LF:%s/%s", workdir.Data(), fAnalysisMacro.Data()));
@@ -830,6 +858,14 @@ Bool_t AliAnalysisAlien::CreateJDL()
    }
    // Copy jdl to grid workspace   
    if (copy) {
+      if (TestBit(AliAnalysisGrid::kSubmit)) {
+         Info("CreateJDL", "\n#####   Copying JDL file <%s> to your AliEn output directory", fJDLName.Data());
+         TString locjdl = Form("%s/%s", fGridOutputDir.Data(),fJDLName.Data());
+         if (fProductionMode)
+            locjdl = Form("%s/%s", workdir.Data(),fJDLName.Data());
+         if (FileExists(locjdl)) gGrid->Rm(locjdl);
+         TFile::Cp(Form("file:%s",fJDLName.Data()), Form("alien://%s", locjdl.Data()));
+      }
       if (fAdditionalLibs.Length()) {
          arr = fAdditionalLibs.Tokenize(" ");
          TObjString *os;
@@ -870,10 +906,15 @@ Bool_t AliAnalysisAlien::WriteJDL(Bool_t copy)
       TIter next(fInputFiles);
       while ((os=(TObjString*)next()))
          fGridJDL->AddToInputDataCollection(Form("LF:%s,nodownload", os->GetString().Data()));
-      fGridJDL->SetOutputDirectory(Form("%s/#alien_counter_03i#", fGridOutputDir.Data()));
+      if (!fOutputSingle.IsNull())
+         fGridJDL->SetOutputDirectory(Form("#alienfulldir#/%s",fOutputSingle.Data()));
+      else                                    
+         fGridJDL->SetOutputDirectory(Form("%s/#alien_counter_03i#", fGridOutputDir.Data()));
    } else {
       // One jdl to be submitted with 2 input parameters: data collection name and output dir prefix
       fGridJDL->AddToInputDataCollection(Form("LF:%s/$1,nodownload", workdir.Data()));
+      if (!fOutputSingle.IsNull())
+         fGridJDL->SetOutputDirectory(Form("#alienfulldir#/%s",fOutputSingle.Data()));
       fGridJDL->SetOutputDirectory(Form("%s/$2/#alien_counter_03i#", fGridOutputDir.Data()));
    }
       
@@ -884,7 +925,7 @@ Bool_t AliAnalysisAlien::WriteJDL(Bool_t copy)
    index = sjdl.Index("Executable");
    if (index >= 0) sjdl.Insert(index, "\n# This is the startup script\n");
    index = sjdl.Index("Split ");
-   if (index >= 0) sjdl.Insert(index, "\n# We split per storage element\n");
+   if (index >= 0) sjdl.Insert(index, "\n# We split per SE or file\n");
    index = sjdl.Index("SplitMaxInputFileNumber");
    if (index >= 0) sjdl.Insert(index, "\n# We want each subjob to get maximum this number of input files\n");
    index = sjdl.Index("InputDataCollection");
@@ -1692,6 +1733,7 @@ void AliAnalysisAlien::WriteAnalysisMacro()
       out << "   gSystem->Load(\"libGeom\");" << endl;
       out << "   gSystem->Load(\"libVMC\");" << endl;
       out << "   gSystem->Load(\"libPhysics\");" << endl << endl;
+      out << "   gSystem->Load(\"libMinuit\");" << endl << endl;
       out << "// Load analysis framework libraries" << endl;
       if (!fPackages) {
          out << "   gSystem->Load(\"libSTEERBase\");" << endl;
index da2efce86efbfb837f349e59d38013de49b218e1..052c095735952c79203f7f282ced85e320002e91 100644 (file)
@@ -34,6 +34,7 @@ public:
    virtual void        AddRunNumber(Int_t run);
    virtual void        AddRunNumber(const char *run);
    virtual void        AddDataFile(const char *lfn);
+   virtual void        AddExternalPackage(const char *name);
    virtual void        SetExecutable(const char *name="analysis.sh")     {fExecutable = name;}
    virtual void        SetExecutableCommand(const char *command="root -b -q") {fExecutableCommand = command;}
    virtual void        SetArguments(const char *name="")                 {fArguments = name;}
@@ -68,6 +69,7 @@ public:
    virtual void        SetJDLName(const char *name="analysis.jdl")       {fJDLName = name;}
    virtual void        SetPreferedSE(const char *se)                     {fCloseSE = se;}
    virtual void        SetProductionMode(Int_t mode=1)                   {fProductionMode = mode;}
+   virtual void        SetOutputSingleFolder(const char *folder)         {fOutputSingle = folder; fSplitMode="file"; fSplitMaxInputFileNumber=1;}
 
    TGridJDL           *GetGridJDL() {return fGridJDL;}
    const char         *GetGridOutputDir() const                          {return fGridOutputDir;}
@@ -124,6 +126,7 @@ private:
    TString          fAPIVersion;      // API version
    TString          fROOTVersion;     // ROOT version
    TString          fAliROOTVersion;  // AliROOT version
+   TString          fExternalPackages; // External packages
    TString          fUser;            // AliEn user name
    TString          fGridWorkingDir;  // AliEn directory containing the input packages
    TString          fGridDataDir;     // AliEn data production directory
@@ -139,9 +142,10 @@ private:
    TString          fCloseSE;         // Preffered storage element. Taken from alien_CLOSE_SE environment.
    TString          fFriendChainName; // File name to construct friend chain (for AOD)
    TString          fJobTag;          // Job tag
+   TString          fOutputSingle;    // Directory name for the output when split is per file
    TObjArray       *fInputFiles;      // List of input files to be processed by the job
    TObjArray       *fPackages;        // List of packages to be used
    
-   ClassDef(AliAnalysisAlien, 7)   // Class providing some AliEn utilities
+   ClassDef(AliAnalysisAlien, 8)   // Class providing some AliEn utilities
 };
 #endif