new MultiMode for mylauncher facilitates analysis of entire productions
authorkread <kread@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 30 Sep 2009 13:16:05 +0000 (13:16 +0000)
committerkread <kread@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 30 Sep 2009 13:16:05 +0000 (13:16 +0000)
PWG4/macros/electrons/anaJete.C
PWG4/macros/electrons/anaJete.jdl
PWG4/macros/electrons/anaJetemulti.jdl [new file with mode: 0644]
PWG4/macros/electrons/mylauncher.C

index 9b45bb0..0150415 100755 (executable)
@@ -625,10 +625,10 @@ void CreateChain(const anaModes mode, TChain * chain, TChain * chainxs){
       if(kGetXSectionFromFileAndScale){\r
        //Get the number of events per file.\r
         //Do it only once, no need to open all the files.\r
-        if(i ==0 ) {\r
+        if(index == 0) {\r
           TFile * df = TFile::Open(alienURL);\r
           nEventsPerFile = ((TTree*) df->Get(kTreeName)) ->GetEntries();\r
-          dataFile->Close();\r
+          df->Close();\r
         } \r
         alienURL.ReplaceAll(datafile,kXSFileName);\r
         GetXsection(nEventsPerFile, alienURL);//chainxs->Add(alienURL) ; \r
index ca24932..d51044c 100644 (file)
@@ -2,7 +2,7 @@ Executable="root";
 Jobtag ={"Analysis: Processing collection for analysis "};
 Packages ={"VO_ALICE@ROOT::v5-24-00","VO_ALICE@APISCONFIG::V2.4","VO_ALICE@fastjet::v2.4.0"};
 
-TTL=30000;
+TTL=15000;
 
 InputFile={"LF:/alice/cern.ch/user/k/kread/work12/anaJete.C",
            "LF:/alice/cern.ch/user/k/kread/work12/run.C",
diff --git a/PWG4/macros/electrons/anaJetemulti.jdl b/PWG4/macros/electrons/anaJetemulti.jdl
new file mode 100644 (file)
index 0000000..38e62d8
--- /dev/null
@@ -0,0 +1,38 @@
+Executable="root";
+Jobtag ={"Analysis: Processing $1 collection number $2 for analysis "};
+Packages ={"VO_ALICE@ROOT::v5-24-00","VO_ALICE@APISCONFIG::V2.4","VO_ALICE@fastjet::v2.4.0"};
+
+TTL=15000;
+
+InputFile={"LF:/alice/cern.ch/user/k/kread/$1/anaJete.C",
+           "LF:/alice/cern.ch/user/k/kread/$1/run.C",
+           "LF:/alice/cern.ch/user/k/kread/$1/ConfigJetAnalysisFastJet.C",
+           "LF:/alice/cern.ch/user/k/kread/$1/ConfigAnalysisElectron.C",
+           "LF:/alice/cern.ch/user/k/kread/$1/STEERBase.par",
+           "LF:/alice/cern.ch/user/k/kread/$1/ESD.par",
+           "LF:/alice/cern.ch/user/k/kread/$1/AOD.par",
+           "LF:/alice/cern.ch/user/k/kread/$1/ANALYSIS.par",
+           "LF:/alice/cern.ch/user/k/kread/$1/ANALYSISalice.par",
+           "LF:/alice/cern.ch/user/k/kread/$1/JETAN.par",
+           "LF:/alice/cern.ch/user/k/kread/$1/FASTJETAN.par",
+           "LF:/alice/cern.ch/user/k/kread/$1/PWG4PartCorrBase.par",
+           "LF:/alice/cern.ch/user/k/kread/$1/PWG4PartCorrDep.par"};
+OutputArchive={"log_archive:stdout,stderr,*.log@ALICE::CERN::ALICEDISK",
+               "root_archive:*.root@ALICE::CERN::ALICEDISK"};
+
+OutputDir = "/alice/cern.ch/user/k/kread/$1/output/$2/#alien_counter_03i#";
+
+InputDataCollection = "LF:/alice/cern.ch/user/k/kread/$1/mycollect$2.xml,nodownload";
+
+InputDataListFormat = "xml-single";
+InputDataList = "collection.xml";
+
+Split = "se";
+SplitMaxInputFileNumber = "15";
+
+splitarguments="run.C --anaInputData AOD --mode 3 --config2 ConfigJetAnalysisFastJet.C --config3 ConfigAnalysisElectron --sevent 0";
+
+# Validation script to be run for each subjob
+Validationcommand = "/alice/cern.ch/user/k/kread/$1/validate.sh";
+
+OutputFile="histos.root";
index 6c1e91f..caee82a 100644 (file)
@@ -1,20 +1,35 @@
 
 //
-// Copy files to AliEn space and submit AliEn job
+// AliEn Multi MasterJob Coordination
 // Author: K. Read
 //
 
 void mylauncher()
 {
-  TString worksubdir = "work12";
+  TString worksubdir = "work12";  //already existing work directory
+//TString worksubdir = "LHC09b4"; //a better name for MultiMode
   // Name of JDL file to upload.  Leave blank for no upload and no submit.
-  TString jdlfilename = "anaJete.jdl";
+  TString jdlfilename = "anaJete.jdl";//ignored for MultiMode
   // Name of executable to upload.  Leave blank for no upload.
+  TString collectfilename = "mycollect.xml";//ignored for MultiMode
+  // List any other files to upload in string filenames separated by blanks.
   TString execfilename = "";
   // List any other files to upload in string filenames separated by blanks.
-  TString filelist = "run.C validate.sh anaJete.C ConfigJetAnalysisFastJet.C ConfigAnalysisElectron.C mergeout.jdl mergeoutscaled.jdl mycollect.xml ANALYSIS.par ANALYSISalice.par AOD.par ESD.par STEERBase.par JETAN.par FASTJETAN.par PWG4PartCorrBase.par PWG4PartCorrDep.par";
+  TString filelist = "run.C validate.sh anaJete.C ConfigJetAnalysisFastJet.C ConfigAnalysisElectron.C mergeout.jdl mergeoutscaled.jdl ANALYSIS.par ANALYSISalice.par AOD.par ESD.par STEERBase.par JETAN.par FASTJETAN.par PWG4PartCorrBase.par PWG4PartCorrDep.par";
   TString filename;
 
+  Bool_t kMultiMode = kFALSE;//uncomment for regular mode
+//Bool_t kMultiMode = kTRUE; //uncomment for coordinated multiple masterjobs
+//MultiMode Variables.   All ignored for regular mode.
+  TString multijdlfilename = "anaJetemulti.jdl";
+//TString datatype = "AliESDs.root";//uncomment for ESDs
+  TString datatype =  "AliAOD.root";//uncomment for AODs
+  TString findlist = "
+/alice/sim/LHC09b4/AOD/000
+/alice/sim/LHC09b4/AOD/001
+/alice/sim/LHC09b4/AOD/002"; //line-feed separated list of desired collections
+
+
   gSystem->Load("libNetx.so") ;
   gSystem->Load("libRAliEn.so");
 
@@ -26,15 +41,41 @@ void mylauncher()
 
       // Upload files listed
       if (filelist.Length()) {
-         arr = filelist.Tokenize(" ");
-         TObjString *os;
-         TIter next(arr);
-         while ((os=(TObjString*)next())) {
-           Info("Grid Upload", "Copying %s to your AliEn work directory", os->GetString().Data());
-          if (FileExists(os->GetString())) gGrid->Rm(os->GetString());
-          TFile::Cp(Form("file:%s",os->GetString().Data()), Form("alien://%s/%s", workdir.Data(), os->GetString().Data()));
-        }   
-        delete arr;   
+        arr = filelist.Tokenize(" ");
+        TObjString *os;
+        TIter next(arr);
+        while ((os=(TObjString*)next())) {
+          Info("Grid Upload", "Copying %s to your AliEn work directory", os->GetString().Data());
+         if (FileExists(os->GetString())) gGrid->Rm(os->GetString());
+         TFile::Cp(Form("file:%s",os->GetString().Data()), Form("alien://%s/%s", workdir.Data(), os->GetString().Data()));
+       }   
+       delete arr;   
+      }
+
+      // Prepare collection(s)
+      if(kMultiMode){
+        // Find collections if desired
+        if (findlist.Length()) {
+          arr = findlist.Tokenize("\n");
+          TObjString *os;
+          TIter next(arr);
+          Int_t count=0;
+          while ((os=(TObjString*)next())) {
+           TGridResult *res;
+            Info("Find", "making collection for %s", os->GetString().Data());
+            res = gGrid->Command(Form("find -x collection %s %s > mycollect%d.xml", os->GetString().Data(),datatype.Data(),count));
+            if(!res) Info("Find", "failed making collection for %s \n",os->GetString().Data());
+            delete res;
+            count++;
+          }
+        }
+      }
+      else{
+       if (collectfilename.Length()) {
+          Info("Grid Upload", "Copying %s to your AliEn work directory", collectfilename.Data());
+         if (FileExists(collectfilename)) gGrid->Rm(collectfilename);
+         TFile::Cp(Form("file:%s",collectfilename.Data()), Form("alien://%s/%s", workdir.Data(), collectfilename.Data()));
+        }
       }
 
       // Upload executable if listed
@@ -46,27 +87,37 @@ void mylauncher()
       }
 
       // Upload and submit JDL if listed
+      if (kMultiMode) jdlfilename = multijdlfilename;
       if (jdlfilename.Length()) {
         filename = Form("%s/%s", workdir.Data(), jdlfilename.Data());
         if (FileExists(filename)) gGrid->Rm(filename);
         Info("Grid Upload", "Copying JDL file %s to your AliEn work directory", jdlfilename.Data());
         TFile::Cp(Form("file:%s",jdlfilename.Data()), Form("alien://%s", filename.Data()));
 
-       TGridResult *res;
-        TString jobID = "";
-        res = gGrid->Command(Form("submit %s", jdlfilename.Data()));
-        Info("Launcher:", "Submitting %s ", jdlfilename.Data());
-        if (res) {
-          const char *cjobId = res->GetKey(0,"jobId");
-          if (!cjobId) {
-            Error("Launcher:", "Your JDL %s could not be submitted", jdlfilename.Data());
-            return;
-          } 
-          else {
-            Info("Launcher:", "Your JDL %s was successfully submitted.\n\n\t\t\t THE JOB ID IS: %s\n",
-                jdlfilename.Data(), cjobId);
-          }          
-          delete res;
+        if (!kMultiMode) Int_t count=1;
+        for (Int_t index = 0; index < count; index++) {
+         TGridResult *res;
+          TString jobID = "";
+          if(kMultiMode){
+            res = gGrid->Command(Form("submit %s %s %d", jdlfilename.Data(),worksubdir.Data(),index));
+            Info("Launcher:",     "Submitting %s %s %d", jdlfilename.Data(),worksubdir.Data(),index);
+          }
+          else{
+            res = gGrid->Command(Form("submit %s", jdlfilename.Data()));
+            Info("Launcher:",     "Submitting %s", jdlfilename.Data());
+          }
+          if (res) {
+            const char *cjobId = res->GetKey(0,"jobId");
+            if (!cjobId) {
+              Error("Launcher:", "Your JDL %s could not be submitted", jdlfilename.Data());
+              return;
+            } 
+            else {
+              Info("Launcher:", "Your JDL %s was successfully submitted.\n\n\t\t\t THE JOB ID IS: %s\n",
+                  jdlfilename.Data(), cjobId);
+            }          
+            delete res;
+          }
         }
       }