]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Various updates for the production scripts
authorcholm <Christian.Holm.Christensen@cern.ch>
Tue, 14 Oct 2014 11:59:52 +0000 (13:59 +0200)
committercholm <Christian.Holm.Christensen@cern.ch>
Tue, 14 Oct 2014 11:59:52 +0000 (13:59 +0200)
19 files changed:
PWGLF/FORWARD/analysis2/sim/AOD.C
PWGLF/FORWARD/analysis2/sim/AODConfig.C
PWGLF/FORWARD/analysis2/sim/Check.C
PWGLF/FORWARD/analysis2/sim/Config.C
PWGLF/FORWARD/analysis2/sim/DetConfig.C [new file with mode: 0644]
PWGLF/FORWARD/analysis2/sim/Final.jdl.in
PWGLF/FORWARD/analysis2/sim/Merge.jdl.in
PWGLF/FORWARD/analysis2/sim/OCDBConfig.C [new file with mode: 0644]
PWGLF/FORWARD/analysis2/sim/PlotSysInfo.C [new file with mode: 0644]
PWGLF/FORWARD/analysis2/sim/QA.C
PWGLF/FORWARD/analysis2/sim/README.md
PWGLF/FORWARD/analysis2/sim/Reconstruct.C
PWGLF/FORWARD/analysis2/sim/Run.jdl.in
PWGLF/FORWARD/analysis2/sim/Simulate.C
PWGLF/FORWARD/analysis2/sim/Tag.C
PWGLF/FORWARD/analysis2/sim/doit.sh
PWGLF/FORWARD/analysis2/sim/simrun.sh
PWGLF/FORWARD/analysis2/sim/spyFile.sh [new file with mode: 0755]
PWGLF/FORWARD/analysis2/sim/test.sh

index 7dfd8736f81a8f5f046adbf2d3822baf7cb19d1f..108ab75069bfb7ddce817c9ec70b64acec93b3a6 100644 (file)
@@ -17,7 +17,7 @@
  */
 /** Path to CDB */
 const char *cdbPath = "raw://";
-
+Bool_t cholm = false;
 /**
  * Interface (pure virtual) that all configuration classes must
  * implement.
@@ -83,6 +83,45 @@ struct VirtualAODCfg
   /** @return Forward mult task (PWGLF) */
   virtual Bool_t UsePWGLFForward() const = 0;
   /* @} */
+  /** 
+   * Print one flag
+   * 
+   * @param title Title
+   * @param use   Use or not 
+   */
+  virtual void PrintOne(const char* title, Bool_t use) const
+  {
+    Printf("%-30s : %3s", title, use ? "yes" : "no");
+  }
+  /** 
+   * Print settings
+   * 
+   */
+  virtual void Print() const { 
+    PrintOne("Connect to CDB",                 UseCDBconnect());
+    PrintOne("Use physics selection",          UsePhysicsSelection());
+    PrintOne("Use tender wagon",               UseTender());
+    PrintOne("Use centrality",                 UseCentrality());
+    PrintOne("Use V0 correction in tender",    UseV0tender());
+    PrintOne("Activate debugging",             UseDBG());
+    PrintOne("Use MC info",                    UseMC());
+    PrintOne("Use Kinematics filter",          UseKFILTER());
+    PrintOne("Use track references",           UseTR());
+    PrintOne("Use correction framework",       UseCORRFW());
+    PrintOne("Use AOD tags",                   UseAODTAGS());
+    PrintOne("Use sys info",                   UseSysInfo());
+    PrintOne("Produces an AOD or dAOD's",      UseAODhandler());
+    PrintOne("ESD to AOD filter",              UseESDfilter());
+    PrintOne("Use Muon train ",                        UsePWGMuonTrain());
+    PrintOne("Copy muon events",               UseMUONcopyAOD());
+    PrintOne("Jet analysis (PWG4)",            UseJETAN());
+    PrintOne("Jet delta AODs",                 UseJETANdelta());
+    PrintOne("Vertexing HF task (PWG3)",       UsePWGHFvertexing());
+    PrintOne("JPSI filtering (PWG3)",          UsePWGDQJPSIfilter());
+    PrintOne("D0->2 hadrons (PWG3)",           UsePWGHFd2h());
+    PrintOne("PID response",                   UsePIDResponse());
+    PrintOne("Forward mult task (PWGLF)",      UsePWGLFForward());
+  }
 };
 
 VirtualAODCfg* aodCfg = 0;
@@ -203,11 +242,12 @@ Bool_t LoadAnalysisLibraries()
   // CDBconnect
   if ((aodCfg->UseCDBconnect() && !aodCfg->UseTender()) 
       && !LoadLibrary("PWGPP")) return false;
-  if ((aodCfg->UseESDfilter() || aodCfg->UsePWGMuonTrain()) 
-      && !LoadLibrary("PWGmuon")) return kFALSE;
+  if ((aodCfg->UseESDfilter() || 
+       (aodCfg->UsePWGMuonTrain() && detCfg->UseMUON())))
+    if (!LoadLibrary("PWGmuon")) return kFALSE;
   // JETAN
-  if ((aodCfg->UseJETAN() || aodCfg->UseJETANdelta()) 
-      && !LoadLibrary("JETAN")) return kFALSE;
+  if ((aodCfg->UseJETAN() || aodCfg->UseJETANdelta()))
+    if (!LoadLibrary("JETAN")) return kFALSE;
   if (aodCfg->UseJETANdelta()) { // CINT doesn't like long '||' chains
     if (!LoadLibrary("CGAL"))           return false;
     if (!LoadLibrary("fastjet"))        return false;
@@ -217,11 +257,11 @@ Bool_t LoadAnalysisLibraries()
   }
 
   // PWG3 Vertexing HF
-  if ((aodCfg->UsePWGHFvertexing() || aodCfg->UsePWGHFd2h())) { 
+  if (aodCfg->UsePWGHFvertexing() || aodCfg->UsePWGHFd2h())) { 
     // CINT doesn't like long '||' chains
     if (!LoadLibrary("PWGflowBase"))      return false;
     if (!LoadLibrary("PWGflowTasks"))     return false;
-    // if (!LoadLibrary("PWGTRD"))           return false;
+    if (cholm) if (!LoadLibrary("PWGTRD"))           return false;
     if (!LoadLibrary("PWGHFvertexingHF")) return false;
   }
 
@@ -295,7 +335,9 @@ void AddAnalysisTasks(const char *cdb_location)
   }
 
   // --- PWGLF - Forward (cholm@nbi.dk) -----------------------------
-  if (aodCfg->UsePWGLFForward() && aodCfg->UsePhysicsSelection()) {
+  if (aodCfg->UsePWGLFForward() && 
+      aodCfg->UsePhysicsSelection() &&
+      detCfg->UseFMD()) {
     gROOT->LoadMacro(pwglf+"/FORWARD/analysis2/AddTaskForwardMult.C");
     // Arguments are 
     //   mc         Assume MC input
@@ -306,7 +348,8 @@ void AddAnalysisTasks(const char *cdb_location)
     //   config     Configuration script 
     //   corrdir    Possible directory containing custom OADB corrections
     // HACK load custom corrections 
-    Info("", "Adding forward AOD task with mc=%d",aodCfg->UseMC() && aodCfg->UseTR());
+    Info("", "Adding forward AOD task with mc=%d",
+        aodCfg->UseMC() && aodCfg->UseTR());
     AddTaskForwardMult(aodCfg->UseMC() && aodCfg->UseTR(),0,0,0,0,
                       "ForwardAODConfig.C",".");
     gROOT->LoadMacro(pwglf+"/FORWARD/analysis2/AddTaskCentralMult.C");
@@ -321,7 +364,7 @@ void AddAnalysisTasks(const char *cdb_location)
   if (aodCfg->UseESDfilter()) {
     //  ESD filter task configuration.
     gROOT->LoadMacro(ana+"/ESDfilter/macros/AddTaskESDFilter.C");
-    if (aodCfg->UseMUONcopyAOD()) {
+    if (aodCfg->UseMUONcopyAOD() && detCfg->UseMUON()) {
       printf("Registering delta AOD file\n");
       mgr->RegisterExtraFile("AliAOD.Muons.root");
       mgr->RegisterExtraFile("AliAOD.Dimuons.root");
@@ -379,7 +422,7 @@ void AddAnalysisTasks(const char *cdb_location)
   }
 
   // --- PWG3 D2h ----------------------------------------------------
-  if (aodCfg->UsePWGHFd2h()) {
+  if (aodCfg->UsePWGHFd2h() && aodCfg->UsePWGHFvertexing()) {
     gROOT->LoadMacro(pwghf+"/vertexingHF/AddD2HTrain.C");
     TFile::Cp(gSystem->ExpandPathName(configPWGHFd2h.Data()), 
              "file:ConfigVertexingHF.C");
@@ -517,7 +560,9 @@ void AODMerge()
   outputFiles.Add(new TObjString("AliAOD.root,"));
   if (aodCfg->UsePWGHFvertexing()) 
     outputFiles.Add(new TObjString("AliAOD.VertexingHF.root,"));
-  if (aodCfg->UseESDfilter() && aodCfg->UseMUONcopyAOD())
+  if (aodCfg->UseESDfilter() && 
+      aodCfg->UseMUONcopyAOD() && 
+      detCfg->UseMUON())
     outputFiles.Add(new TObjString("AliAOD.Muons.root,"));
   if (aodCfg->UseJETAN()) 
     outputFiles.Add(new TObjString("AliAOD.Jets.root,"));
@@ -525,7 +570,7 @@ void AODMerge()
     outputFiles.Add(new TObjString("AliAOD.Dielectron.root,"));
   outputFiles.Add(new TObjString("pyxsec_hists.root"));
   TString     mergeExcludes = "";
-  TIter       iter(outputFiles);
+  TIter       iter(&outputFiles);
   TObjString* str           = 0;
   Bool_t      merged        = kTRUE;
   while ((str = static_cast<TObjString*>(iter()))) {
@@ -559,12 +604,17 @@ void AODMerge()
  */
 void AOD(UInt_t run, const char* xmlfile=0, Int_t stage=0)
 {
+  TString host(gSystem->HostName());
+  cholm = host.BeginsWith("hehi");
+  if (cholm) TGrid::Connect("alien:");
+
   // -----------------------------------------------------------------
   // 
   // Get GRP parameters.  Defines global "grp" as a pointer to GRPData
   //
   gROOT->Macro(Form("GRP.C(%d)", run));
   gROOT->Macro("AODConfig.C");
+  gROOT->Macro("DetConfig.C");
 
   // --- Some settings -----------------------------------------------
   // Set temporary merging directory to current one
@@ -577,15 +627,7 @@ void AOD(UInt_t run, const char* xmlfile=0, Int_t stage=0)
   printf("===========    RUNNING FILTERING TRAIN   ==========\n");
   printf("===================================================\n");
   printf("=  Configuring analysis train for:\n");
-  if (aodCfg->UsePhysicsSelection())   printf("=  Physics selection");
-  if (aodCfg->UseTender())             printf("=  TENDER");
-  if (aodCfg->UseESDfilter())            printf("=  ESD filter");
-  if (aodCfg->UseMUONcopyAOD())          printf("=  MUON copy AOD");
-  if (aodCfg->UseJETAN())                printf("=  Jet analysis");
-  if (aodCfg->UseJETANdelta())           printf("=     Jet delta AODs");
-  if (aodCfg->UsePWGHFvertexing())       printf("=  PWGHF vertexing");
-  if (aodCfg->UsePWGDQJPSIfilter())      printf("=  PWGDQ j/psi filter");
-  if (aodCfg->UsePWGHFd2h())             printf("=  PWGHF D0->2 hadrons QA");
+  aodCfg->Print();
 
   // Load common libraries and set include path
   if (!LoadCommonLibraries()) {
index 8afe66286acb91789280c6dd5a133d7f34f1207c..036461e4114b468bbba2c9410cce314a74037367 100644 (file)
@@ -41,21 +41,21 @@ struct AODCfg : public VirtualAODCfg
   /** @return ESD to AOD filter (barrel + muon tracks) */
   virtual Bool_t UseESDfilter() const { return true; }
   /** @return Use Muon train  */
-  virtual Bool_t UsePWGMuonTrain() const { return true; }
+  virtual Bool_t UsePWGMuonTrain() const { return false; }
   /** @return Task that copies only muon events */
-  virtual Bool_t UseMUONcopyAOD() const { return true; }
+  virtual Bool_t UseMUONcopyAOD() const { return false; }
   /** @return Jet analysis (PWG4) */
   virtual Bool_t UseJETAN() const { return false; }
   /** @return Jet delta AODs */
   virtual Bool_t UseJETANdelta() const { return false; }
   /** @return Vertexing HF task (PWG3) */
-  virtual Bool_t UsePWGHFvertexing() const { return true; }
+  virtual Bool_t UsePWGHFvertexing() const { return false; }
   /** @return JPSI filtering (PWG3) */
   virtual Bool_t UsePWGDQJPSIfilter() const { return false; }
   /** @return D0->2 hadrons (PWG3) */
-  virtual Bool_t UsePWGHFd2h() const { return true; }
+  virtual Bool_t UsePWGHFd2h() const { return false; }
   /** @return PID response */
-  virtual Bool_t UsePIDResponse() const { return true; }
+  virtual Bool_t UsePIDResponse() const { return false; }
   /** @return Forward mult task (PWGLF) */
   virtual Bool_t UsePWGLFForward() const { return true; }
   /* @} */
index baf07491a2b7957c561988c6971caa13594fc761..1c4f323d37bb2f6ad8f4586d077d57ab1921d1c7 100644 (file)
 #include "AliPID.h"
 #endif
 
-TH1F* CreateHisto(const char* name, const char* title, 
-                 Int_t nBins, Double_t xMin, Double_t xMax,
-                 const char* xLabel = NULL, const char* yLabel = NULL)
+//____________________________________________________________________
+/** 
+ * Create a histogram 
+ * 
+ * @param name   Name of histogram
+ * @param title  Title of histogram
+ * @param nBins  Number of bins 
+ * @param xMin   Lease X valuee 
+ * @param xMax   Largest X value 
+ * @param xLabel X label
+ * @param yLabel Y label 
+ * 
+ * @return newly allocated histogram 
+ */
+TH1* 
+CreateHisto(const char* name, 
+           const char* title, 
+           Int_t       nBins, 
+           Double_t    xMin, 
+           Double_t    xMax,
+           const char* xLabel = NULL, 
+           const char* yLabel = NULL)
 {
-// create a histogram
-
+  // create a histogram
   TH1F* result = new TH1F(name, title, nBins, xMin, xMax);
   result->SetOption("E");
   if (xLabel) result->GetXaxis()->SetTitle(xLabel);
@@ -38,12 +56,21 @@ TH1F* CreateHisto(const char* name, const char* title,
   return result;
 }
 
-TH1F* CreateEffHisto(TH1F* hGen, TH1F* hRec)
+//____________________________________________________________________
+/** 
+ * Create efficiency histogram 
+ * 
+ * @param hGen Generated 
+ * @param hRec Reconstructed 
+ * 
+ * @return Newly allocated histogram
+ */
+TH1* CreateEffHisto(TH1* hGen, TH1* hRec)
 {
-// create an efficiency histogram
-
+  // create an efficiency histogram
+  
   Int_t nBins = hGen->GetNbinsX();
-  TH1F* hEff = (TH1F*) hGen->Clone("hEff");
+  TH1* hEff = static_cast<TH1*>(hGen->Clone("hEff"));
   hEff->SetTitle("");
   hEff->SetStats(kFALSE);
   hEff->SetMinimum(0.);
@@ -68,35 +95,50 @@ TH1F* CreateEffHisto(TH1F* hGen, TH1F* hRec)
   return hEff;
 }
 
-Bool_t FitHisto(TH1* histo, Double_t& res, Double_t& resError)
+//____________________________________________________________________
+/** 
+ * Fit a Gaussian distribution to data in histogram 
+ * 
+ * @param histo      Histogram to fit 
+ * @param res        On return, the result 
+ * @param resError   On return, the error on the result
+ * 
+ * @return true on success, false if too few entries 
+ */
+Bool_t 
+FitHisto(TH1* histo, Double_t& res, Double_t& resError)
 {
-// fit a gaussian to a histogram
-
   static TF1* fitFunc = new TF1("fitFunc", "gaus");
   fitFunc->SetLineWidth(2);
   fitFunc->SetFillStyle(0);
   Double_t maxFitRange = 2;
 
-  if (histo->Integral() > 50) {
-    Float_t mean = histo->GetMean();
-    Float_t rms = histo->GetRMS();
-    fitFunc->SetRange(mean - maxFitRange*rms, mean + maxFitRange*rms);
-    fitFunc->SetParameters(mean, rms);
-    histo->Fit(fitFunc, "QRI0");
-    histo->GetFunction("fitFunc")->ResetBit(1<<9);
-    res = TMath::Abs(fitFunc->GetParameter(2));
-    resError = TMath::Abs(fitFunc->GetParError(2));
-    return kTRUE;
-  }
-
-  return kFALSE;
+  if (histo->Integral() <= 50) return false;
+
+  Float_t mean = histo->GetMean();
+  Float_t rms = histo->GetRMS();
+  fitFunc->SetRange(mean - maxFitRange*rms, mean + maxFitRange*rms);
+  fitFunc->SetParameters(mean, rms);
+  histo->Fit(fitFunc, "QRI0");
+  histo->GetFunction("fitFunc")->ResetBit(1<<9);
+  res = TMath::Abs(fitFunc->GetParameter(2));
+  resError = TMath::Abs(fitFunc->GetParError(2));
+  return true;
 }
 
-
+//====================================================================
+/** 
+ * Run the check.
+ * 
+ * @param gAliceFileName  MC steering file 
+ * @param esdFileName     Reconstructed data 
+ * 
+ * @return true on success 
+ */
 Bool_t Check(const char* gAliceFileName = "galice.root", 
             const char* esdFileName = "AliESDs.root")
 {
-// check the content of the ESD
+  // check the content of the ESD
  
   // check values
   Int_t    checkNGenLow = 1;
@@ -691,3 +733,6 @@ Bool_t Check(const char* gAliceFileName = "galice.root",
   Info("CheckESD", "check of ESD was successfull");
   return kTRUE;
 }
+// 
+// EOF
+//
index 28f5a48185ac226645ab3498c7924770498792b8..d3e38bf37043548fa8a0100f7e0630d596d82c2e 100644 (file)
@@ -604,10 +604,6 @@ struct Setup
   }
 };
 
-
-
-
-
 void Config()
 {
   // --- Get settings from environment variables --------------------
@@ -695,47 +691,23 @@ void Config()
   // --- Go back to galice.root --------------------------------------
   rl->CdGAFile();
   
-  // --- Switch on and off detectors ---------------------------------
-  Int_t iABSO  = 1;
-  Int_t iACORDE= 0;
-  Int_t iDIPO  = 1;
-  Int_t iEMCAL = 1;
-  Int_t iFMD   = 1;
-  Int_t iFRAME = 1;
-  Int_t iHALL  = 1;
-  Int_t iITS   = 1;
-  Int_t iMAG   = 1;
-  Int_t iMUON  = 1;
-  Int_t iPHOS  = 1;
-  Int_t iPIPE  = 1;
-  Int_t iPMD   = 1;
-  Int_t iHMPID = 1;
-  Int_t iSHIL  = 1;
-  Int_t iT0    = 1;
-  Int_t iTOF   = 1;
-  Int_t iTPC   = 1;
-  Int_t iTRD   = 1;
-  Int_t iVZERO = 1;
-  Int_t iZDC   = 1;
-  
-
   //=================== Alice BODY parameters =============================
   AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
   
   
-  if (iMAG)    new AliMAG("MAG", "Magnet");
-  if (iABSO)   new AliABSOv3("ABSO", "Muon Absorber");
-  if (iDIPO)   new AliDIPOv3("DIPO", "Dipole version 3");
-  if (iHALL)   new AliHALLv3("HALL", "Alice Hall");
-  if (iFRAME)  (new AliFRAMEv2("FRAME", "Space Frame"))->SetHoles(1);
-  if (iSHIL)   new AliSHILv3("SHIL", "Shielding Version 3");
-  if (iPIPE)   new AliPIPEv3("PIPE", "Beam Pipe");
-  if (iITS)    new AliITSv11("ITS","ITS v11");
-  // if (iITS)   new AliITSv11Hybrid("ITS","ITS v11Hybrid");
-  if (iTPC)    new AliTPCv2("TPC", "Default");
-  if (iTOF)    new AliTOFv6T0("TOF", "normal TOF");
-  if (iHMPID)  new AliHMPIDv3("HMPID", "normal HMPID");
-  if (iZDC) {
+  if (detCfg->UseMAG())   new AliMAG("MAG", "Magnet");
+  if (detCfg->UseABSO())  new AliABSOv3("ABSO", "Muon Absorber");
+  if (detCfg->UseDIPO())  new AliDIPOv3("DIPO", "Dipole version 3");
+  if (detCfg->UseHALL())  new AliHALLv3("HALL", "Alice Hall");
+  if (detCfg->UseFRAME()) (new AliFRAMEv2("FRAME", "Space Frame"))->SetHoles(1);
+  if (detCfg->UseSHIL())  new AliSHILv3("SHIL", "Shielding Version 3");
+  if (detCfg->UsePIPE())  new AliPIPEv3("PIPE", "Beam Pipe");
+  if (detCfg->UseITS())   new AliITSv11("ITS","ITS v11");
+  // if (detCfg->UseITS())   new AliITSv11Hybrid("ITS","ITS v11Hybrid");
+  if (detCfg->UseTPC())   new AliTPCv2("TPC", "Default");
+  if (detCfg->UseTOF())   new AliTOFv6T0("TOF", "normal TOF");
+  if (detCfg->UseHMPID()) new AliHMPIDv3("HMPID", "normal HMPID");
+  if (detCfg->UseZDC()) {
     AliZDC *ZDC = 0;
     if (grp->period.EqualTo("LHC10h")) {
       // Need to use older ZDC for PbPb 
@@ -763,7 +735,7 @@ void Config()
       ZDC->SetBeamEnergy(82.*grp->beamEnergy/208.);
     }
   }
-  if (iTRD) {
+  if (detCfg->UseTRD()) {
     AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
     AliTRDgeometry *geoTRD = TRD->GetGeometry();
     // Total of 18 super modules. We turn them all off by default 
@@ -799,18 +771,18 @@ void Config()
       geoTRD->SetSMstatus(13,1);
     }      
   }
-  if (iFMD)    new AliFMDv1("FMD", "normal FMD");
-  if (iMUON) {
+  if (detCfg->UseFMD())    new AliFMDv1("FMD", "normal FMD");
+  if (detCfg->UseMUON()) {
     AliMUON *MUON = new AliMUONv1("MUON", "default");
     MUON->SetTriggerEffCells(1); // not needed if raw masks
     MUON->SetTriggerResponseV1(2);
   }
-  if (iPHOS)   new AliPHOSv1("PHOS", "noCPV_Modules123");
-  if (iPMD)    new AliPMDv1("PMD", "normal PMD");
-  if (iT0)     new AliT0v1("T0", "T0 Detector");
-  if (iEMCAL)  new AliEMCALv2("EMCAL", "EMCAL_COMPLETE12SMV1");
-  if (iACORDE) new AliACORDEv1("ACORDE", "normal ACORDE");
-  if (iVZERO)  new AliVZEROv7("VZERO", "normal VZERO");
+  if (detCfg->UsePHOS())   new AliPHOSv1("PHOS", "noCPV_Modules123");
+  if (detCfg->UsePMD())    new AliPMDv1("PMD", "normal PMD");
+  if (detCfg->UseT0())     new AliT0v1("T0", "T0 Detector");
+  if (detCfg->UseEMCAL())  new AliEMCALv2("EMCAL", "EMCAL_COMPLETE12SMV1");
+  if (detCfg->UseACORDE()) new AliACORDEv1("ACORDE", "normal ACORDE");
+  if (detCfg->UseVZERO())  new AliVZEROv7("VZERO", "normal VZERO");
 }
 
 
diff --git a/PWGLF/FORWARD/analysis2/sim/DetConfig.C b/PWGLF/FORWARD/analysis2/sim/DetConfig.C
new file mode 100644 (file)
index 0000000..7ae5f81
--- /dev/null
@@ -0,0 +1,148 @@
+/** 
+ * Base class for detector configuration. By default, everything is on
+ * except ACORDE.
+ */
+struct VirtualDetCfg 
+{
+  virtual Bool_t UseABSO()   const { return true;  }
+  virtual Bool_t UseACORDE() const { return false; }
+  virtual Bool_t UseDIPO()   const { return true;  }
+  virtual Bool_t UseEMCAL()  const { return true;  }
+  virtual Bool_t UseFMD()    const { return true;  }
+  virtual Bool_t UseFRAME()  const { return true;  }
+  virtual Bool_t UseHALL()   const { return true;  }
+  virtual Bool_t UseITS()    const { return true;  }
+  virtual Bool_t UseMAG()    const { return true;  }
+  virtual Bool_t UseMUON()   const { return true;  }
+  virtual Bool_t UsePHOS()   const { return true;  }
+  virtual Bool_t UsePIPE()   const { return true;  }
+  virtual Bool_t UsePMD()    const { return true;  }
+  virtual Bool_t UseHMPID()  const { return true;  }
+  virtual Bool_t UseSHIL()   const { return true;  }
+  virtual Bool_t UseT0()     const { return true;  }
+  virtual Bool_t UseTOF()    const { return true;  }
+  virtual Bool_t UseTPC()    const { return true;  }
+  virtual Bool_t UseTRD()    const { return true;  }
+  virtual Bool_t UseVZERO()  const { return true;  }
+  virtual Bool_t UseZDC()    const { return true;  }
+  virtual void Print() 
+  {
+    Printf("ABSO:   %3s", UseABSO()    ? "yes" : "no");
+    Printf("ACORDE: %3s", UseACORDE()  ? "yes" : "no");
+    Printf("DIPO:   %3s", UseDIPO()    ? "yes" : "no");
+    Printf("EMCAL:  %3s", UseEMCAL()   ? "yes" : "no");
+    Printf("FMD:    %3s", UseFMD()     ? "yes" : "no");
+    Printf("FRAME:  %3s", UseFRAME()   ? "yes" : "no");
+    Printf("HALL:   %3s", UseHALL()    ? "yes" : "no");
+    Printf("ITS:    %3s", UseITS()     ? "yes" : "no");
+    Printf("MAG:    %3s", UseMAG()     ? "yes" : "no");
+    Printf("MUON:   %3s", UseMUON()    ? "yes" : "no");
+    Printf("PHOS:   %3s", UsePHOS()    ? "yes" : "no");
+    Printf("PIPE:   %3s", UsePIPE()    ? "yes" : "no");
+    Printf("PMD:    %3s", UsePMD()     ? "yes" : "no");
+    Printf("HMPID:  %3s", UseHMPID()   ? "yes" : "no");
+    Printf("SHIL:   %3s", UseSHIL()    ? "yes" : "no");
+    Printf("T0:     %3s", UseT0()      ? "yes" : "no");
+    Printf("TOF:    %3s", UseTOF()     ? "yes" : "no");
+    Printf("TPC:    %3s", UseTPC()     ? "yes" : "no");
+    Printf("TRD:    %3s", UseTRD()     ? "yes" : "no");
+    Printf("VZERO:  %3s", UseVZERO()   ? "yes" : "no");
+    Printf("ZDC:    %3s", UseZDC()     ? "yes" : "no");
+  }
+  /** 
+   * Get the string of enabled detectors for local reconstruction.
+   * 
+   * @param enable On return, contains string of enable detectors
+   */
+  void GetRecoString(TString& enable) const
+  {
+    if (UseITS())      Append2Str(enable, "ITS"); 
+    if (UseTPC())      Append2Str(enable, "TPC"); 
+    if (UseTRD())      Append2Str(enable, "TRD"); 
+    if (UseTOF())      Append2Str(enable, "TOF"); 
+    if (UsePHOS())     Append2Str(enable, "PHOS"); 
+    if (UseHMPID())    Append2Str(enable, "HMPID"); 
+    if (UseEMCAL())    Append2Str(enable, "EMCAL"); 
+    if (UseMUON())     Append2Str(enable, "MUON"); 
+    if (UseFMD())      Append2Str(enable, "FMD"); 
+    if (UseZDC())      Append2Str(enable, "ZDC"); 
+    if (UsePMD())      Append2Str(enable, "PMD"); 
+    if (UseT0())       Append2Str(enable, "T0"); 
+    if (UseVZERO())    Append2Str(enable, "VZERO");
+  }
+  /** 
+   * Get the string of detectors for which we should make Summable
+   * Digits
+   * 
+   * @param sDigits On returm contains the string of enable detectors
+   */
+  void GetSDigitString(TString& sDigits) const 
+  {
+    if (UseTRD())      Append2Str(sDigits, "TRD"); 
+    if (UseTOF())      Append2Str(sDigits, "TOF"); 
+    if (UsePHOS())     Append2Str(sDigits, "PHOS"); 
+    if (UseHMPID())    Append2Str(sDigits, "HMPID"); 
+    if (UseEMCAL())    Append2Str(sDigits, "EMCAL"); 
+    if (UseMUON())     Append2Str(sDigits, "MUON"); 
+    if (UseFMD())      Append2Str(sDigits, "FMD"); 
+    if (UseZDC())      Append2Str(sDigits, "ZDC"); 
+    if (UsePMD())      Append2Str(sDigits, "PMD"); 
+    if (UseT0())       Append2Str(sDigits, "T0"); 
+    if (UseVZERO())    Append2Str(sDigits, "VZERO");
+  }
+  /** 
+   * Get the sting of detectors for which we should do the hit to
+   * digit conversion directly.
+   * 
+   * @param fromHits On returm contains the string of enable detectors
+   */
+  void GetHits2DigitsString(TString& fromHits) const
+  {
+    if (UseITS())      Append2Str(fromHits, "ITS");
+    if (UseTPC())      Append2Str(fromHits, "TPC");
+  }
+  /** 
+   * Append a C style string to a string, possibly adding a space before
+   * 
+   * @param str     Where to append
+   * @param append  What to append
+   */
+  static void Append2Str(TString& str, const char* append)
+  {
+    if (!str.IsNull()) str.Append(" ");
+    str.Append(append);
+  }
+  
+};
+/** Global variable */
+VirtualDetCfg* detCfg = 0;
+
+/** 
+ * Particular set-up of detectors to use.  By default everything but
+ * ACORDE is on.  Here, we turn off a few other detectors.
+ */
+struct DetCfg : public VirtualDetCfg
+{
+  // virtual Bool_t UseEMCAL()  const { return false; }
+  // virtual Bool_t UseMUON()   const { return false; }
+  // virtual Bool_t UsePHOS()   const { return false; }
+  // virtual Bool_t UseHMPID()  const { return false; }
+  // virtual Bool_t UseTOF()    const { return false; }
+  // virtual Bool_t UseTRD()    const { return false; }
+};
+
+/** 
+ * Create the detector configuration 
+ * 
+ * @return Pointer to global @c detCfg
+ */
+void DetConfig()
+{
+  Info("DetConfig", "Creating detector configuration");
+  detCfg = new DetCfg;
+  detCfg->Print();
+}
+// 
+// EOF
+//
+
index c43694b897569f85560928b6d402ea255cabc037..02c148b094adc3bd5c47e8d1e5a7d85faf950d1a 100644 (file)
@@ -43,6 +43,7 @@ Arguments = "$4 $1 $4_Stage_$2.xml $2";
 InputFile = {
        "LF:@data@/$4.C",
        "LF:@data@/$4Config.C",
+       "LF:@data@/DetConfig.C",
        "LF:@data@/GRP.C",
        "LF:@data@/fmd_corrections.root",
        "LF:@out@/$3/$1/$4_Stage_$2.xml"
@@ -50,7 +51,7 @@ InputFile = {
 OutputDir = "@out@/$3/$1";
 OutputArchive = {
    "$4_merge_log_archive.zip:std*,fileinfo*.log@disk=1",
-   "$4_merge_archive.zip:*.root,*.stat*@disk=2"
+   "$4_merge_archive.zip:*$4*.root,*.stat*@disk=2"
 };
 TTL = "36000";
 Price = "1";
index 24bdddce6a0cb6f5759fc82badb686c3cc911dc5..e49b188f79347adf5f5caf353fcb6b393ebfd3a3 100644 (file)
@@ -45,6 +45,7 @@ InputDataCollection={
 InputFile={
        "LF:@data@/$4.C",
        "LF:@data@/$4Config.C",
+       "LF:@data@/DetConfig.C",
        "LF:@data@/GRP.C",
        "LF:@data@/fmd_corrections.root"
        
diff --git a/PWGLF/FORWARD/analysis2/sim/OCDBConfig.C b/PWGLF/FORWARD/analysis2/sim/OCDBConfig.C
new file mode 100644 (file)
index 0000000..df92b6c
--- /dev/null
@@ -0,0 +1,79 @@
+struct VirtualOCDBCfg
+{
+  /** 
+   * This member function must return the default prefix. 
+   * 
+   * @return Prefix of OCDB specific storages
+   */
+  virtual const char* Prefix() const { return ""; }
+  /** 
+   * This member function should define the real setup. 
+   * 
+   * @param forSim Whether we're setting up for simulations or not 
+   */
+  virtual void Init(Bool_t forSim) 
+  {
+    ::Fatal("VirtualOCDBConfig", "Dummy init called - redefine!");
+  }
+  /** 
+   * Set the specific storage for a given key (possibly wild-carded). 
+   * 
+   * @param key    Key 
+   * @param ideal  Whether it is residual or ideal
+   */
+  void AddStore(const char*    key, 
+               Bool_t         ideal)
+  {
+    AliCDBManager* cdb = AliCDBManager::Instance();
+    const char* prefix = Prefix();
+    TString     path   = Form("alien://Folder=/alice/simulation/%s/%s",
+                             prefix, !ideal ? "Residual" : "Ideal");
+    ::Info("AddStore", "%s -> %s", key, path.Data());
+    cdb->SetSpecificStorage(key, path);
+  }
+};
+VirtualOCDBCfg* ocdbCfg = 0;
+
+/** 
+ * Specific implementation.  Note, this requires that GRP.C has been
+ * loaded and exectuted before calling Init.
+ */
+struct OCDBCfg : public VirtualOCDBCfg
+{
+  const char* Prefix() const { return "2008/v4-15-Release"; }
+  void Init(Bool_t forSim)
+  {
+    Bool_t is10h = grp->period.EqualTo("LHC10h");
+    
+    // --- ITS  (1 Total) ----------------------------------------------
+    AddStore("ITS/Align/Data",         forSim);
+    if (!forSim) 
+      AddStore("ITS/Align/SPDSparseDead",false);
+  
+    // --- MUON (1 object) ---------------------------------------------
+    AddStore("MUON/Align/Data",                forSim); 
+
+    // ---- TPC (6 total) ----------------------------------------------
+    AddStore("TPC/Calib/TimeGain",     forSim);
+    AddStore("TPC/Calib/ClusterParam", forSim);
+    AddStore("TPC/Calib/AltroConfig",  forSim);
+    AddStore("TPC/Calib/Correction",   forSim);
+    AddStore("TPC/Align/Data",         forSim);
+    AddStore("TPC/Calib/TimeDrift",    forSim);
+    AddStore("TPC/Calib/RecoParam",    (forSim && !is10h));
+    
+    // --- ZDC for 2010 the following is needed ------------------------
+    // (https://savannah.cern.ch/task/?func=detailitem&item_id=33180#comment46)
+    if (is10h) AddStore("ZDC/Align/Data",true); 
+  }
+};
+
+
+void OCDBConfig()
+{
+  ::Info("OCDBConfig", "Creating OCDB configuration");
+  ocdbCfg = new OCDBCfg;
+}
+
+
+
diff --git a/PWGLF/FORWARD/analysis2/sim/PlotSysInfo.C b/PWGLF/FORWARD/analysis2/sim/PlotSysInfo.C
new file mode 100644 (file)
index 0000000..99ccd98
--- /dev/null
@@ -0,0 +1,182 @@
+TVirtualPad* MakeCanvas(const char* title="")
+{
+  static Int_t cId = 0;
+  TCanvas* c = new TCanvas(Form("c%02d", ++cId), title);
+  c->SetTopMargin(0.02);
+  c->SetRightMargin(0.02);
+  c->cd();
+  return c;
+}
+
+Double_t SumUsage(TTree*      tree, 
+                 const char* exp, 
+                 const char* cut, 
+                 bool        draw=false)
+{
+  //
+  // return sum of usage
+  //
+  if (draw) MakeCanvas(Form("%s [%s]", exp, cut));
+  
+  Int_t  entries = tree->Draw(exp, cut, (draw ? "" : "goff"));
+  if (entries==0) return 0;
+
+  Double_t mean = TMath::Mean(entries, tree->GetV1());
+  return entries * mean;
+}
+Double_t TopUsage(TTree*      tree, 
+                 const char* exp, 
+                 const char* cut, 
+                 Int_t       order)
+{
+  Int_t entries = tree->Draw(exp, cut, "goff");
+  if (entries <= 1 || !tree->GetV1()) return -10000;
+  
+  TArrayI index(entries);
+  TMath::Sort(entries, tree->GetV1(), index.fArray);
+
+  Int_t    oindex = TMath::Min(order, entries);
+  Double_t value  = tree->GetV1()[index[oindex-1]];
+  
+  return value;
+}
+  
+TH1* ExtractHist(TTree*      tree,
+                const char* exp, 
+                const char* cut,
+                const char* name,
+                const char* xtitle="", 
+                const char* ytitle="",
+                Bool_t      draw=false)
+{
+  tree->Draw(Form("%s>>tmpa", exp), cut, "GOFF");
+  if (!tree->GetHistogram()) return 0;
+
+  TH1* ret = static_cast<TH1*>(tree->GetHistogram()->Clone(name));
+  delete tree->GetHistogram();
+  ret->SetXTitle(xtitle);
+  ret->SetYTitle(ytitle);
+  ret->SetMarkerStyle(22);
+  ret->SetMarkerSize(1);
+  if (draw) {
+    if (draw) MakeCanvas(name);
+    ret->Draw();
+  }
+  return ret;
+}
+                
+                
+void Print(std::ostream& o,
+          const char*   name, 
+          Double_t      dT, 
+          Double_t      dVM, 
+          Double_t      alldT, 
+          Double_t      alldVM)
+{
+  o << name << "\t" 
+    << dT   << "\t" 
+    << dVM  << "\t" 
+    << 100*(alldT  > 0 ? dT  / alldT  : 0) << "\t" 
+    << 100*(alldVM > 0 ? dVM / alldVM : 0) << std::endl;
+}
+
+const char* dets[] = {"ITS", 
+                     "TPC", 
+                     "TRD", 
+                     "TOF", 
+                     "PHOS", 
+                     "HMPID", 
+                     "EMCAL", 
+                     "MUON", 
+                     "FMD", 
+                     "ZDC", 
+                     "PMD", 
+                     "T0", 
+                     "VZERO", 
+                     "ACORDE", 
+                     "HLT",
+                     0 };
+
+
+void
+Plot1SysInfo(const char* file, UShort_t draw=0x1)
+{
+  // gROOT->LoadMacro("$ALICE_ROOT/../master-src/macros/PlotSys.C+");
+
+  // --- Create output file and tree ---------------------------------
+  TString rootOut(file); 
+  rootOut.ReplaceAll(".log", ".root");
+  rootOut.ReplaceAll(".foo", ".root");
+  Info("", "Writing to ROOT file %s", rootOut.Data());
+  TFile* out  = TFile::Open(rootOut, "RECREATE");
+  TTree* tree = AliSysInfo::MakeTree(file);
+
+
+  
+  // --- Create ASCII output ------------------------------------------
+  TString sumOut(rootOut); 
+  sumOut.ReplaceAll(".root", ".sum");
+  Info("", "Writing to ASCII file %s", sumOut.Data());
+  std::ofstream ascii(sumOut.Data());
+  ascii << "Det/C:sumDt/F:sumDvm/F:fracDt/F:fracDvm/F" << std::endl;
+
+  // --- Get global stuff ---------------------------------------------
+  const char* all     = "id0>=0&&id2>=0";
+  Double_t sumdTAll   = SumUsage(tree, "deltaT",  all, draw & 0x1);
+  Double_t sumdVMAll  = SumUsage(tree, "deltaVM", all, draw & 0x1);
+  Double_t topdT      = TopUsage(tree, "deltaT",  "id2<3", 20);
+  Double_t topdVM     = TopUsage(tree, "deltaVM", "", 20);
+  TCut     cutT("cutDT", Form("deltaT > %f", topdT));
+  TCut     cutVM("cutVM", Form("deltaVM > %f", topdVM));
+  
+  ExtractHist(tree, "deltaVM:sname", "1"+cutVM,
+             "DVMvsName","","#DeltaVM [MB]", draw&0x4);
+  ExtractHist(tree, "VM:sname", "id2<3"+cutVM, 
+             "VMvsName", "", "VM [MB]", draw&0x4);
+  ExtractHist(tree, "VM:T", "deltaVM>1", 
+             "VMvsTime", "Time [sec]", "VM [MB]", draw&0x4);
+  ExtractHist(tree, "deltaT:sname","id2<3"+cutT,
+             "CPUvsName","","#DeltaT [sec]", draw&0x4);
+  
+
+
+  Print(ascii, "all", sumdTAll, sumdVMAll, sumdTAll, sumdVMAll);
+
+  
+
+  // --- Loop over detetors ------------------------------------------
+  const char** pdet = dets;
+  Int_t        idet = 0;
+  while (*pdet) { 
+    TString  cut    = Form("id0==%d && id2 >= 0", idet);
+    Double_t sumdT  = SumUsage(tree, "deltaT",  cut, draw & 0x2);
+    Double_t sumdVM = SumUsage(tree, "deltaVM", cut, draw & 0x2);
+    Print(ascii, *pdet, sumdT, sumdVM, sumdTAll, sumdVMAll);
+    
+#if 0
+    TString cut2    = Form("id0==%d",idet);
+    ExtractHist(tree, "deltaVM:sname", cut2.Data()+cutVM,
+               Form("DVMvsName_%02d", idet), "", "#DeltaVM [MB]", draw&0x8);
+    ExtractHist(tree, "VM:sname",      cut2.Data()+cutVM,
+               Form("VMvsName_%02d", idet), "", "VM [MB]", draw&0x8);
+    ExtractHist(tree, "deltaT:sname",  cut2.Data()+cutT, 
+               Form("CPUvsName_%02d", idet),"", "#DeltaT [sec]", draw&0x8);
+#endif
+
+    pdet++;
+    idet++;
+  }
+  ascii.close();
+
+  new TBrowser;
+}
+
+  
+
+PlotSysInfo(ULong_t pid=431808952)
+{
+  Plot1SysInfo(Form("%d_simwatch.log", pid));
+  Plot1SysInfo(Form("%d_recowatch.log", pid));
+}
+
+  
index c65a653cdee342a3aadb84e467a17c9621f8ad8c..e6ebbc77508e7cbb07148f7ed3f658041c15026c 100644 (file)
@@ -109,6 +109,47 @@ struct VirtualQACfg
   virtual Bool_t DoV0()          const = 0;
   /** @return Get Debug level */
   virtual Int_t DebugLevel() const = 0;
+
+  virtual void PrintOne(const char* title, Bool_t use) const 
+  {
+    Printf("%-30s : %3s", title, use ? "yes" : "no");
+  }
+  virtual void Print() const 
+  {
+    PrintOne("CDBconnect ",            DoCDBconnect());
+    PrintOne("EventStat ",             DoEventStat());
+    PrintOne("Centrality ",            DoCentrality());
+    PrintOne("QAsym ",                 DoQAsym());
+    PrintOne("VZERO",                  DoVZERO());
+    PrintOne("VZEROPbPb ",             DoVZEROPbPb());
+    PrintOne("Vertex ",                DoVertex());
+    PrintOne("SPD  needs RP   ",        DoSPD());
+    PrintOne("TPC ",                   DoTPC());
+    PrintOne("HLT ",                   DoHLT());
+    PrintOne("SDD  needs RP",          DoSDD());
+    PrintOne("SSDdEdx ",               DoSSDdEdx());
+    PrintOne("TRD ",                   DoTRD());
+    PrintOne("ITS ",                   DoITS());
+    PrintOne("ITSsaTracks ",           DoITSsaTracks());
+    PrintOne("ITSalign ",              DoITSalign());
+    PrintOne("CALO ",                  DoCALO());
+    PrintOne("MUONTrig ",              DoMUONTrig());
+    PrintOne("ImpParRes ",             DoImpParRes());
+    PrintOne("MUON ",                  DoMUON());
+    PrintOne("TOF ",                   DoTOF());
+    PrintOne("HMPID ",                 DoHMPID());
+    PrintOne("T0 ",                    DoT0());
+    PrintOne("ZDC ",                   DoZDC());
+    PrintOne("PIDResponse ",           DoPIDResponse());
+    PrintOne("PIDqa ",                 DoPIDqa());
+    PrintOne("FWD ",                   DoFWD());
+    PrintOne("PHOS ",                  DoPHOS());
+    PrintOne("PHOSTrig ",              DoPHOSTrig());
+    PrintOne("EMCAL ",                 DoEMCAL());
+    PrintOne("FBFqa ",                 DoFBFqa());
+    PrintOne("MUONEff NEEDS geometry", DoMUONEff());
+    PrintOne("V0  NEEDS MCtruth ",      DoV0());
+  }
 };
 VirtualQACfg* qaCfg = 0;
 
@@ -137,7 +178,8 @@ void LoadLibraries()
   gSystem->Load("libPWGPP.so");
   gSystem->Load("libAliHLTTrigger.so");
 
-  if (qaCfg->DoEMCAL() || qaCfg->DoPHOS() || 
+  if ((qaCfg->DoEMCAL() && detCfg->UseEMCAL()) || 
+      ((qaCfg->DoPHOS() || qaCfg->DoPHOSTrig())  && detCfg->UsePHOS()) || 
       (qaCfg->DoCALO() && !is10h)) {
     gSystem->Load("libEMCALUtils");
     gSystem->Load("libPHOSUtils");
@@ -149,12 +191,12 @@ void LoadLibraries()
     gSystem->Load("libPWGEMCAL");
     gSystem->Load("libPWGGAEMCALTasks");
   }  
-  if(qaCfg->DoMUON() || qaCfg->DoMUONTrig()) {
+  if((qaCfg->DoMUON() || qaCfg->DoMUONTrig()) && detCfg->UseMUON()) {
     gSystem->Load("libPWGmuon");
     gSystem->Load("libPWGPPMUONlite");
     gSystem->Load("libPWGmuondep");
   }
-  if (qaCfg->DoFWD()) {
+  if (qaCfg->DoFWD() && detCfg->UseFMD()) {
     gSystem->Load("libPWGLFforward2");
   }      
 }
@@ -234,11 +276,11 @@ void AddAnalysisTasks(const char *cdb_location)
                                                 kTriggerMuonBarell);
   }  
   // --- VZERO QA  (C. Cheshkov) -------------------------------------
-  if (qaCfg->DoVZERO()) {
+  if (qaCfg->DoVZERO() && detCfg->UseVZERO()) {
     gROOT->LoadMacro(pwgpp+"/PilotTrain/AddTaskVZEROQA.C");
     AliAnalysisTaskSE * taskv0qa = AddTaskVZEROQA(0);
   }
-  if (qaCfg->DoVZEROPbPb() && grp->IsAA()) {
+  if (qaCfg->DoVZEROPbPb() && detCfg->UseVZERO() && grp->IsAA()) {
     gROOT->LoadMacro(pwgpp+"/VZERO/AddTaskVZEROPbPb.C");
     AliAnaVZEROPbPb* taskV0PbPb = 
       (AliAnaVZEROPbPb*)AddTaskVZEROPbPb(Int_t(grp->run));
@@ -252,7 +294,7 @@ void AddAnalysisTasks(const char *cdb_location)
   //   the 2st argument to false
   // - Optionally highMult axis can be used by setting the 3st
   //   argument to true (for PbPb)
-  if (qaCfg->DoTPC()) {
+  if (qaCfg->DoTPC() && detCfg->UseTPC()) {
     gROOT->LoadMacro(pwgpp+"/TPC/macros/AddTaskPerformanceTPCdEdxQA.C");
     AliPerformanceTask *tpcQA = 0;
     if (grp->IsAA()) {
@@ -267,13 +309,14 @@ void AddAnalysisTasks(const char *cdb_location)
   }  
 
   // --- HLT (Alberica Toia) -----------------------------------------
-  if (qaCfg->DoHLT()) {
+  if (qaCfg->DoHLT() && detCfg->UseTPC()) {
     gROOT->LoadMacro(pwgpp+"/TPC/macros/AddTaskPerformanceTPCdEdxQA.C");
-    AliPerformanceTask *hltQA = AddTaskPerformanceTPCdEdxQA(kTRUE, kTRUE, kFALSE,0,kTRUE);
+    AliPerformanceTask *hltQA = AddTaskPerformanceTPCdEdxQA(kTRUE, kTRUE, 
+                                                           kFALSE,0,kTRUE);
     hltQA->SelectCollisionCandidates(kTriggerMask);
   }  
   // --- SPD (A. Mastroserio) ----------------------------------------
-  if (qaCfg->DoSPD()) {
+  if (qaCfg->DoSPD() && detCfg->UseITS()) {
     gROOT->LoadMacro(pwgpp+"/PilotTrain/AddTaskSPDQA.C");
     AliAnalysisTaskSPD* taskspdqa = (AliAnalysisTaskSPD*)AddTaskSPDQA();
     // Request from Annalisa
@@ -282,20 +325,20 @@ void AddAnalysisTasks(const char *cdb_location)
     taskspdqa->SetOCDBInfo(grp->run, "raw://");
   }  
   // --- SDD (F. Prino) ----------------------------------------------
-  if (qaCfg->DoSDD()) {
+  if (qaCfg->DoSDD() && detCfg->UseITS()) {
     gROOT->LoadMacro(pwgpp+"/PilotTrain/AddSDDPoints.C");
     AliAnalysisTaskSE* tasksdd = AddSDDPoints();
     tasksdd->SelectCollisionCandidates(kTriggerMask);
   }
   // --- SSD dEdx (Marek Chojnacki) ----------------------------------
-  if (qaCfg->DoSSDdEdx()) {
+  if (qaCfg->DoSSDdEdx() && detCfg->UseITS()) {
     gROOT->LoadMacro(pwgpp+"/PilotTrain/AddTaskdEdxSSDQA.C");
     AliAnalysisTaskSE* taskssddedx = AddTaskdEdxSSDQA();
     taskssddedx->SelectCollisionCandidates(kTriggerMask);
   }
 
   // --- ITS ---------------------------------------------------------
-  if (qaCfg->DoITS()) {
+  if (qaCfg->DoITS() && detCfg->UseITS()) {
     // hardcoded non-zero trigger mask
     gROOT->LoadMacro(pwgpp+"/macros/AddTaskPerformanceITS.C");
     AliAnalysisTaskITSTrackingCheck *itsQA = 0;
@@ -312,20 +355,20 @@ void AddAnalysisTasks(const char *cdb_location)
     }
   }
   // --- ITS saTracks, align (F.Prino) -------------------------------
-  if (qaCfg->DoITSsaTracks()) {
+  if (qaCfg->DoITSsaTracks() && detCfg->UseITS()) {
     // offline trigger in AddTask
     gROOT->LoadMacro(pwgpp+"/macros/AddTaskITSsaTracks.C");
     AliAnalysisTaskITSsaTracks *itssaTracks = AddTaskITSsaTracks(kTRUE,kFALSE);
     itssaTracks->SelectCollisionCandidates(kTriggerMask);
   }   
-  if (qaCfg->DoITSalign()) {
+  if (qaCfg->DoITSalign() && detCfg->UseITS()) {
     // no offline trigger selection
      gROOT->LoadMacro(pwgpp+"/macros/AddTaskITSAlign.C");
      AliAnalysisTaskITSAlignQA *itsAlign = AddTaskITSAlign(0,2011);
   }   
 
   // --- TRD (Alex Bercuci, M. Fasel) --------------------------------
-  if(qaCfg->DoTRD()) {
+  if(qaCfg->DoTRD() && detCfg->UseTRD()) {
     // no offline trigger selection
     gROOT->LoadMacro(pwgpp+"/macros/AddTrainPerformanceTRD.C");
     // steer individual TRD tasks
@@ -341,7 +384,7 @@ void AddAnalysisTasks(const char *cdb_location)
   }
 
   // --- ZDC (Chiara Oppedisano) -------------------------------------
-  if(qaCfg->DoZDC()) {
+  if(qaCfg->DoZDC() && detCfg->UseZDC()) {
     // hardcoded kMB trigger mask
      gROOT->LoadMacro(pwgpp+"/ZDC/AddTaskZDCQA.C");
      AliAnalysisTaskSE *taskZDC = AddTaskZDCQA();
@@ -366,14 +409,14 @@ void AddAnalysisTasks(const char *cdb_location)
   }
 
   // --- Muon Trigger ------------------------------------------------
-  if(qaCfg->DoMUONTrig()) {
+  if(qaCfg->DoMUONTrig() && detCfg->UseMUON()) {
     // no offline trigger selection
     gROOT->LoadMacro(pwgpp+"/macros/AddTaskMTRchamberEfficiency.C");
     AliAnalysisTaskTrigChEff *taskMuonTrig = AddTaskMTRchamberEfficiency();
   }
 
   // --- Muon Efficiency (not used) ----------------------------------
-  if(qaCfg->DoMUONEff()) {
+  if(qaCfg->DoMUONEff() && detCfg->UseMUON()) {
       gROOT->LoadMacro(ali+"/PWG3/muondep/AddTaskMUONTrackingEfficiency.C");
       AliAnalysisTaskMuonTrackingEff *taskMuonTrackEff = 
        AddTaskMUONTrackingEfficiency();
@@ -400,14 +443,14 @@ void AddAnalysisTasks(const char *cdb_location)
   }  
 
   // --- MUON QA (Philippe Pillot) -----------------------------------
-  if (qaCfg->DoMUON()) {
+  if (qaCfg->DoMUON() && detCfg->UseMUON()) {
     // trigger analysis internal
     gROOT->LoadMacro(pwgpp+"/PilotTrain/AddTaskMuonQA.C");
     AliAnalysisTaskSE* taskmuonqa= AddTaskMuonQA();
   }  
 
   // --- TOF (Francesca Bellini) -------------------------------------
-  if (qaCfg->DoTOF()) {
+  if (qaCfg->DoTOF() && detCfg->UseTOF()) {
     gROOT->LoadMacro(pwgpp+"/TOF/AddTaskTOFQA.C");
     AliAnalysisTaskTOFqa *tofQA = AddTaskTOFQA(kFALSE);
     tofQA->SelectCollisionCandidates(kTriggerMask);
@@ -422,7 +465,7 @@ void AddAnalysisTasks(const char *cdb_location)
  
   // --- HMPID QA (Giacomo Volpe) ------------------------------------
   //
-  if (qaCfg->DoHMPID()) {
+  if (qaCfg->DoHMPID() && detCfg->UseHMPID()) {
     gROOT->LoadMacro(pwgpp+"/HMPID/AddTaskHmpidQA.C");
     AliAnalysisTaskSE* taskhmpidqa= AddTaskHmpidQA(kTRUE);
     // offline mask set in AddTask to kMB
@@ -430,7 +473,7 @@ void AddAnalysisTasks(const char *cdb_location)
   }      
 
   // --- T0 QA (Alla Mayevskaya) -------------------------------------
-  if (qaCfg->DoT0()) {
+  if (qaCfg->DoT0() && detCfg->UseT0()) {
     // no offline trigger selection
     gROOT->LoadMacro(pwgpp+"/T0/AddTaskT0QA.C");
     AliT0AnalysisTaskQA* taskt0qa= AddTaskT0QA();
@@ -438,7 +481,7 @@ void AddAnalysisTasks(const char *cdb_location)
   }      
 
   // ---- FMD QA (Christian Holm Christiansen) -----------------------
-  if (qaCfg->DoFWD()) {
+  if (qaCfg->DoFWD() && detCfg->UseFMD()) {
     gROOT->LoadMacro(pwglf+"/FORWARD/analysis2/AddTaskForwardQA.C");
     // Parameters: usemc, usecentrality
     // AliAnalysisTaskSE *forwardQA = (AliAnalysisTaskSE *)
@@ -452,7 +495,7 @@ void AddAnalysisTasks(const char *cdb_location)
   }
   
   // --- PHOS QA (Boris Polishchuk) ----------------------------------
-  if (qaCfg->DoPHOS()) {
+  if (qaCfg->DoPHOS()&& detCfg->UsePHOS()) {
     gROOT->LoadMacro(pwgga+"/PHOSTasks/CaloCellQA/macros/AddTaskCaloCellsQA.C");
     AliAnalysisTaskCaloCellsQA *taskPHOSCellQA1 = 
       AddTaskCaloCellsQA(4, 1, NULL,"PHOSCellsQA_AnyInt"); 
@@ -470,14 +513,14 @@ void AddAnalysisTasks(const char *cdb_location)
       AliAnalysisTaskPHOSPbPbQA* phosPbPb = AddTaskPHOSPbPbQA(0);
     }
   }
-  if (qaCfg->DoPHOSTrig()) {
+  if (qaCfg->DoPHOSTrig() && detCfg->UsePHOS()) {
     gROOT->LoadMacro(pwgga+
                     "/PHOSTasks/PHOS_TriggerQA/macros/AddTaskPHOSTriggerQA.C");
     AliAnalysisTaskPHOSTriggerQA *taskPHOSTrig = AddTaskPHOSTriggerQA(0,0);
   }   
 
   // --- EMCAL QA (Gustavo Conesa) -----------------------------------
-  if (qaCfg->DoEMCAL()) {
+  if (qaCfg->DoEMCAL() && detCfg->UseEMCAL()) {
      gROOT->LoadMacro(pwgga+"/EMCALTasks/macros/AddTaskEMCALTriggerQA.C");
      AliAnalysisTaskEMCALTriggerQA *emctrig = AddTaskEMCALTriggerQA();
   }   
@@ -580,6 +623,8 @@ void QA(UInt_t      run,
   //
   gROOT->Macro(Form("GRP.C(%d)", run));
   gROOT->Macro("QAConfig.C");
+  gROOT->Macro("DetConfig.C");
+  qaCfg->Print();
   Int_t   debug_level = qaCfg->DebugLevel();   // Debugging
   TString cdbString(cdb);
   if (cdbString.Contains("raw://")) {
index 49c5526173e710cc0469d320361b2fc6d94ab9bf..bacf4551dd9314bf7447ead683960e4dfebb5d5b 100644 (file)
@@ -31,6 +31,66 @@ However, since all steps need to have access to the GRP data, it means
 that all steering scripts must load `GRP.C`, and hence we can at no
 point use any of previously used scripts. 
 
+## Setting up a simulation
+
+The idea of these scripts are that we only change things in one
+well-defined place, and that the scripts react to JDL parameters so
+that we can re-use the scripts (and settings) for many kinds of
+simulation passes.
+
+### Configuring which detectors to include
+
+Create a class called `DetCfg` deriving from `VirtualDetCfg` and
+have it return true/false for the detectors you want to have on/off.
+The class _must_ be declared in `DetConfig.C` and the function
+`DetConfig()` _must_ set the global object pointer `detCfg` to point
+to a new instance of the class `DetCfg`.
+
+The script `DetConfig.C` is executed by both `Simulate.C` and
+`Reconstruct.C` to get the list of enabled detectors.  The script is
+also executed by `AOD.C` and `QA.C` to ensure that we do not add tasks
+for which we have no data because the needed detectors was turned
+off. 
+
+### Configuring OCDB specific storage locations
+
+Create a class called `OCDBCfg` deriving from `VirtualOCDBCfg` and put
+it in the script `OCDBConfig.C`.  The function `OCDBConfig` _must_ set
+the global object pointer `ocdbCfg` to point to a new instance of the
+class `OCDBCfg`. 
+
+The script `OCDBConfig.C` is executed by both `Simulate.C` and
+`Reconstruct.C` to set the list of specific storage locations.
+
+One can override `VirtualOCDBCfg::Prefix()` to return the default
+prefix for specific storage locations.  The member function
+`VirtualOCDBCfg::Init(bool forSim)` _must_ declare all specific storage
+locations.  The parameter `forSim` is true when executed from
+`Simulate.C` and false when executed from `Reconstruct.C`
+
+### Configuring the QA tasks
+
+Create the class `QACfg` deriving from `VirtualQACfg`, and override
+member functions from `VirtualQACfg` to enable/disable specific QA
+tasks and options.  Put the class `QACfg` in the script `QAConfig.C`.
+The function `QAConfig` _must_ set the global object pointer
+`qaCfg` to point to a new instance of the class `QACfg`.
+
+The script `QAConfig.C` is executed by `QA.C` to set which tasks and
+features to include. 
+
+### Configuring the AOD tasks
+
+Create the class `AODCfg` deriving from `VirtualAODCfg`, and override
+member functions from `VirtualAODCfg` to enable/disable specific AOD
+tasks and options.  Put the class `AODCfg` in the script `AODConfig.C`.
+The function `AODConfig` _must_ set the global object pointer
+`aodCfg` to point to a new instance of the class `AODCfg`.
+
+The script `AODConfig.C` is executed by `AOD.C` to set which tasks and
+features to include. 
+
+
 ## The files
 
 * `run.sh`: main steering executable (same as
@@ -45,6 +105,8 @@ point use any of previously used scripts.
 * `Check.C`: Perform ESD check. Derived from `CheckESD.C`. 
 * `Config.C`: Simulation configuration script.  Uses `GRP.C` to
   automatically load the proper parameters for the Anchor run.
+* `DetConfig.C`: Configuration script that sets which detectors to
+  turn on. This is used by all passes to ensure consistency. 
 * `Final.jdl.in`: Skeleton for final merging JDL.  This is used for
   both QA and AOD filtering.
 * `GRP.C`: Script that defines the global variable `grp` which is
@@ -56,6 +118,9 @@ point use any of previously used scripts.
   tell. 
 * `Merge.jdl.in`: Skeleton for intermediate merging JDL.  This is used for
   both QA and AOD filtering.
+* `OCDBConfig.C`: Set-up specific storage locations for simulation
+  and reconstruction.  It defines the global object ocdbCfg which is
+  used in the `Simulate.C` and `Reconstruct.C` scripts. 
 * `QA.C`: QA train set-up. Derived from `QAtrainsim.C` but
   modified to automatically get GRP parameters from OCDB using the
   script `GRP.C` and set-up the train accordingly. Also, selection of
index a2a14091c201f96abda0b4f141e78b8db00c01be..af7ff711f490efb762e85dc65577add6ce2a8515 100644 (file)
@@ -1,17 +1,8 @@
-Int_t getIntEnv(const char* name)
-{
-  TString env = gSystem->Getenv(name);
-  if (env.IsNull()) return 0;
-  return env.Atoi();
-}
-void SetSpecStore(AliCDBManager& s, 
-                 const char* key, 
-                 const char* sub)
-{
-  s.SetSpecificStorage(key, Form("alien://Folder=/alice/simulation/%s",sub));
-}
-
-
+/** 
+ * Run the reconstruction 
+ * 
+ * @param run Run number 
+ */
 void Reconstruct(UInt_t run) 
 {
   // -----------------------------------------------------------------
@@ -19,24 +10,34 @@ void Reconstruct(UInt_t run)
   // Get GRP parameters.  Defines global "grp" as a pointer to GRPData
   //
   gROOT->Macro(Form("GRP.C(%d)", run));
-  
+  gROOT->Macro("DetConfig.C"); 
+  gROOT->Macro("OCDBConfig.C"); 
+
+  // --- Get GRP to deduce collision system --------------------------
+  Bool_t         isAA  = grp->IsAA();
+  Bool_t         is10h = grp->period.EqualTo("LHC10h");
   // -----------------------------------------------------------------
   // 
   // Basic setup 
   //
   AliReconstruction reco;
-  reco.SetRunReconstruction("ITS TPC TRD TOF PHOS HMPID "
-                           "EMCAL MUON FMD ZDC PMD T0 VZERO");
-
+  TString enable;  
+  detCfg->GetRecoString(enable);
+  if (is10h) enable.ReplaceAll("MUON", "");
+  reco.SetRunReconstruction(enable);
 
   // -----------------------------------------------------------------
   //
-  // switch off cleanESD, write ESDfriends and Alignment data
+  // switch off cleanESD, write ESDfriends and Alignment data, clean
+  // up rec-points
   // 
   reco.SetCleanESD(kFALSE);
   reco.SetWriteESDfriend();
   reco.SetFractionFriends(.1);
   reco.SetWriteAlignmentData();
+  TString clean(enable); clean.ReplaceAll("ITS", "");
+  reco.SetDeleteRecPoints(clean);
 
   // -----------------------------------------------------------------
   //
@@ -44,7 +45,6 @@ void Reconstruct(UInt_t run)
   // 
   reco.SetRunPlaneEff(kTRUE);
   reco.SetUseTrackingErrorsForAlignment("ITS");
-
   
   // -----------------------------------------------------------------
   //
@@ -52,41 +52,17 @@ void Reconstruct(UInt_t run)
   //
   AliCDBManager* man = AliCDBManager::Instance();
   man->SetDefaultStorageFromRun(grp->run);
+  ocdbCfg->Init(false);
 
-  // --- Get GRP to deduce collision system --------------------------
-  Bool_t         isAA  = grp->IsAA();
-  Bool_t         is10h = grp->period.EqualTo("LHC10h");
-
-  // --- ITS (2 objects) ---------------------------------------------
-  SetSpecStore(*man,"ITS/Align/Data",          "2008/v4-15-Release/Residual");
-  SetSpecStore(*man,"ITS/Calib/SPDSparseDead", "2008/v4-15-Release/Residual");
-
-
-  // --- MUON objects (1 object) -------------------------------------
-  SetSpecStore(*man,"MUON/Align/Data",         "2008/v4-15-Release/Residual");
-
-  // --- TPC (7 objects) ---------------------------------------------
-  SetSpecStore(*man,"TPC/Align/Data",          "2008/v4-15-Release/Residual");
-  SetSpecStore(*man,"TPC/Calib/ClusterParam",  "2008/v4-15-Release/Residual");
-  SetSpecStore(*man,"TPC/Calib/RecoParam",     "2008/v4-15-Release/Residual");
-  SetSpecStore(*man,"TPC/Calib/TimeGain",      "2008/v4-15-Release/Residual");
-  SetSpecStore(*man,"TPC/Calib/AltroConfig",   "2008/v4-15-Release/Residual");
-  SetSpecStore(*man,"TPC/Calib/TimeDrift",     "2008/v4-15-Release/Residual");
-  SetSpecStore(*man,"TPC/Calib/Correction",    "2008/v4-15-Release/Residual");
-
-
+  // -----------------------------------------------------------------
+  // 
+  // Specific reconstruction parameters 
+  // 
   // --- ZDC ---------------------------------------------------------
   // ZDC for 2010 the following is needed 
   // (https://savannah.cern.ch/task/?func=detailitem&item_id=33180#comment46)
-  if (is10h) {
+  if (is10h)
     reco.SetRecoParam("ZDC",AliZDCRecoParamPbPb::GetHighFluxParam(2760));
-    SetSpecStore(*man,"ZDC/Align/Data",        "2008/v4-15-Release/Ideal/"); 
-  }
-
-  // --- GRP from local OCDB -----------------------------------------
-  // man->SetSpecificStorage("GRP/GRP/Data",
-  //                         Form("local://%s",gSystem->pwd()));
-  
 
   // --- Override some settings in the ITS reco ----------------------
   if (is10h) {
index 16cc079226032515c2c6aa8774e5219f55d9e249..26caacaaf32d6474716675bbc9cf33b5a0b75f56 100644 (file)
@@ -42,6 +42,8 @@ Validationcommand="/alice/validation/validation.sh";
 InputFile={
        "LF:@data@/Check.C",
        "LF:@data@/Config.C",
+       "LF:@data@/DetConfig.C",
+       "LF:@data@/OCDBConfig.C",
        "LF:@data@/Reconstruct.C",
        "LF:@data@/Simulate.C",
        "LF:@data@/simrun.sh",
@@ -70,7 +72,7 @@ JDLVariables={
 };
 
 #
-splitarguments="--run $1 --event $3 --process $5 --qa --aod --number #alien_counter#";
+splitarguments="--run $1 --event $3 --process $5 --qa --aod --check --number #alien_counter# --bmin 0 --bmax 3";
 split="production:1-$2";
 
-Workdirectorysize={"5000MB"};
+Workdirectorysize={"10000MB"};
index 81feb1b059c9f0017014875f48dfaec61ff5ba3f..4910a07643cae51e9d692ee24b593036c9ac6c89 100644 (file)
@@ -1,30 +1,3 @@
-/** 
- * Read an integer valued environment variable 
- * 
- * @param name environment variable name 
- * 
- * @return Value or 0
- */
-Int_t getIntEnv(const char* name)
-{
-  TString env = gSystem->Getenv(name);
-  if (env.IsNull()) return 0;
-  return env.Atoi();
-}
-/** 
- * Set specific storage 
- * 
- * @param s   Simlation object
- * @param key Key to set specific storage for
- * @param sub Sub-component of storage
- */
-void SetSpecStore(AliSimulation& s, 
-                 const char* key, 
-                 const char* sub)
-{
-  s.SetSpecificStorage(key, Form("alien://Folder=/alice/simulation/%s",sub));
-}
-
 /** 
  * Run the simulation 
  * 
@@ -38,6 +11,8 @@ void Simulate(Int_t nev=1, UInt_t run=0)
   // Get GRP parameters.  Defines global "grp" as a pointer to GRPData
   //
   gROOT->Macro(Form("GRP.C(%d)", run));
+  gROOT->Macro("DetConfig.C");
+  gROOT->Macro("OCDBConfig.C");
 
   // --- Get GRP to deduce collision system --------------------------
   Bool_t         isAA  = grp->IsAA();
@@ -49,8 +24,11 @@ void Simulate(Int_t nev=1, UInt_t run=0)
   // Basic setup 
   //
   AliSimulation steer; 
-  steer.SetMakeSDigits("TRD TOF PHOS HMPID EMCAL MUON FMD ZDC PMD T0 VZERO");
-  steer.SetMakeDigitsFromHits("ITS TPC");
+  TString sDigits, fromHits;
+  detCfg->GetSDigitString(sDigits);
+  detCfg->GetHits2DigitsString(fromHits);
+  steer.SetMakeSDigits(sDigits);
+  steer.SetMakeDigitsFromHits(fromHits);
 
   // -----------------------------------------------------------------
   // 
@@ -62,44 +40,19 @@ void Simulate(Int_t nev=1, UInt_t run=0)
 
   // -----------------------------------------------------------------
   //
-  // Raw OCDB
+  // OCDB and specific storages 
   // 
   AliCDBManager* cdb = AliCDBManager::Instance();
   cdb->SetDefaultStorageFromRun(grp->run);
-  // cdb->SetRun(grp.run);
-  steer.SetDefaultStorage(cdb->GetDefaultStorage()->GetURI());
-
-  // --- ITS  (1 Total) ----------------------------------------------
-  SetSpecStore(steer,"ITS/Align/Data", "2008/v4-15-Release/Ideal");
-  
-  // --- MUON (1 object) ---------------------------------------------
-  SetSpecStore(steer,"MUON/Align/Data",        "2008/v4-15-Release/Ideal"); 
-
-  // ---- TPC (6 total) ----------------------------------------------
-  SetSpecStore(steer,"TPC/Calib/TimeGain",     "2008/v4-15-Release/Ideal/");
-  SetSpecStore(steer,"TPC/Calib/ClusterParam", "2008/v4-15-Release/Ideal/");
-  SetSpecStore(steer,"TPC/Calib/AltroConfig",  "2008/v4-15-Release/Ideal/");
-  SetSpecStore(steer,"TPC/Calib/Correction",   "2008/v4-15-Release/Ideal/");
-  SetSpecStore(steer,"TPC/Align/Data",         "2008/v4-15-Release/Ideal/");
-  SetSpecStore(steer,"TPC/Calib/RecoParam",    "2008/v4-15-Release/Residual");
-  if (is10h)
-    SetSpecStore(steer,"TPC/Calib/TimeDrift",  "2008/v4-15-Release/Residual/");
-  else 
-    SetSpecStore(steer,"TPC/Calib/TimeDrift",  "2008/v4-15-Release/Ideal/");
-    
-  // --- ZDC for 2010 the following is needed ------------------------
-  // (https://savannah.cern.ch/task/?func=detailitem&item_id=33180#comment46)
-  if (is10h)
-    SetSpecStore(steer,"ZDC/Align/Data",       "2008/v4-15-Release/Ideal/"); 
-
+  ocdbCfg->Init(true);
 
   // -----------------------------------------------------------------
   // 
-  // The rest - disable QA for PbPb
+  // The rest - disable QA and HLT (memory heavy) for PbPb
   //
   if (isAA) steer.SetRunQA(":");
-  // gInterpreter->UnloadFile("GetGRP.C");
-
+  if (is10h) steer.SetRunHLT("");
+  
   TStopwatch timer;
   timer.Start();
   steer.Run(nev);
index 6faba376ad238636c3b25ba82b369d162437f33e..f363f9c4040cd9020e097ca7fa7f5b7e988b22ce 100644 (file)
@@ -1,4 +1,6 @@
-void Tag() {
+//____________________________________________________________________
+void Tag() 
+{
   const char* turl = gSystem->Getenv("ALIEN_JDL_OUTPUTDIR");
 
   gSystem->Load("libNet.so");
@@ -12,7 +14,7 @@ void Tag() {
   TString fGUID = 0;
   GetGUID(fGUID);
 
-  gEnv->Print();
+  // gEnv->Print();
 
   TString fAliroot, fRoot, fGeant;
   GetVersions(fAliroot,fRoot,fGeant);
@@ -23,8 +25,9 @@ void Tag() {
   UpdateTag(fAliroot,fRoot,fGeant,fESDFileName,fGUID,fPeriod,fPass,fName);
 }
 
-//_____________________________________//
-GetProductionInfo(TString &fPeriod, TString &fPass, TString &fName) {
+//____________________________________________________________________
+void GetProductionInfo(TString &fPeriod, TString &fPass, TString &fName) 
+{
   const char* turl = gSystem->Getenv("ALIEN_JDL_OUTPUTDIR");
   
   TString fS = turl;
@@ -39,8 +42,9 @@ GetProductionInfo(TString &fPeriod, TString &fPass, TString &fName) {
   fName = fPeriod+"."+fPass;
 }
   
-//_____________________________________//
-GetVersions(TString &fAliroot, TString &froot, TString &fgeant) {
+//____________________________________________________________________
+void GetVersions(TString &fAliroot, TString &froot, TString &fgeant) 
+{
   const char* fver = gSystem->Getenv("ALIEN_JDL_PACKAGES");
   TString fS = fver;
   Int_t fFirst = fS.First("#");
@@ -64,40 +68,65 @@ GetVersions(TString &fAliroot, TString &froot, TString &fgeant) {
   }
 }
 
-//_____________________________________//
-GetGUID(TString &guid) {
+//____________________________________________________________________
+void GetGUID(TString &guid) 
+{
   ofstream myfile ("guid.txt");
-  if (myfile.is_open()) {
-    TFile *f = TFile::Open("AliESDs.root","read");
-    if(f && !f->IsZombie() && f->IsOpen()) {
-      guid = f->GetUUID().AsString();
-      myfile << "AliESDs.root \t"<<f->GetUUID().AsString();
-      cout<<guid.Data()<<endl;
-      myfile.close();
-    }
-    else cout<<"Input file not found"<<endl;
+  if (!myfile.is_open()) {
+    Warning("GetGUID", "Couldn't open guid.txt for writing");
+    return;
+  }
+
+  TFile *f = TFile::Open("AliESDs.root","read");
+  if (!f || f->IsZombie() || !f->IsOpen()) {
+    Warning("GetGUID", "Input file AliESDs.root not found");
+    return;
   }
-  else cout<<"Output file can't be created..."<<endl;
+
+  guid = f->GetUUID().AsString();
+  f->Close();
+  Info("", "Global Unique IDentifier: %s", guid.Data());
+
+  myfile << "AliESDs.root \t"<< guid << std::endl;
+  myfile.close();
 }
 
 
-//_____________________________________//
-Bool_t UpdateTag(TString faliroot, TString froot, TString fgeant, 
-                TString turl, TString guid,
-                TString fperiod, TString fpass, TString fname) {
-  cout<<"> Updating tags...."<<endl;
+//____________________________________________________________________
+Bool_t UpdateTag(TString faliroot, 
+                TString froot, 
+                TString fgeant, 
+                TString turl, 
+                TString guid,
+                TString fperiod, 
+                TString fpass, 
+                TString fname) 
+{
+  Info("", "Updating tags (%s,%s,%s,%s,%s,%s,%s,%s",
+       faliroot.Data(), froot.Data(), fgeant.Data(), 
+       turl.Data(), guid.Data(), fperiod.Data(), 
+       fpass.Data(),fname.Data());
 
   const TString tagPattern = "tag.root";
-  // Open the working directory
+
+  // --- Open the working directory ----------------------------------
   TSystemDirectory dir(".", gSystem->pwd());
   TIter            next(dir.GetListOfFiles());
   TSystemFile*     file = 0;
-  // Add all files matching *pattern* to the chain
+
+  // --- Add all files matching *pattern* to the chain ---------------
   while ((file = static_cast<TSystemFile*>(next()))) {
     TString name(file->GetName());
     if (!name.Contains(tagPattern)) continue;
     
+    // --- Open file matching pattern --------------------------------
     TFile*      f     = TFile::Open(name,"read") ;
+    if (!f) { 
+      continue;
+    }
+    Info("", "Updating tags in %s", name.Data());
+
+    // --- Find the tree ---------------------------------------------
     AliRunTag*  tag   = 0x0;
     AliFileTag* flTag = 0x0;
     TTree*      fTree = (TTree *)f->Get("T");
@@ -107,11 +136,13 @@ Bool_t UpdateTag(TString faliroot, TString froot, TString fgeant,
     }
     fTree->SetBranchAddress("AliTAG",&tag);
    
-    //Defining new tag objects
+    // --- Defining new tag objects ----------------------------------
     AliRunTag* newTag = 0x0;
     TTree      ttag("T","A Tree with event tags");
     TBranch*   btag = ttag.Branch("AliTAG", &newTag);
     btag->SetCompressionLevel(9);
+    // --- disassociate the tree with underlying directory -----------
+    ttag.SetDirectory(0);
       
     Printf(">>>>> Found %d entries....",fTree->GetEntries());
 
@@ -135,11 +166,16 @@ Bool_t UpdateTag(TString faliroot, TString froot, TString fgeant,
       delete tag;
       delete newTag;
     }//tag file loop 
+    
+    // --- Close the input file --------------------------------------
+    f->Close();
 
+    // --- Overwrite the file ----------------------------------------
     TFile* ftag = TFile::Open(name, "recreate");
     ftag->cd();
     ttag.Write();
     ftag->Close();
+    Info("", "Overwrote %s with new tags", name.Data());
   }//directory loop
   return kTRUE;
 }
index cbeee4f83b3f0abff3a2c9538e7cce23fa82f46c..adafb4413138be9ec0395a9ab215b8f8052224a2 100755 (executable)
@@ -247,6 +247,8 @@ push()
        GRP.C                   \
        Simulate.C              \
        Config.C                \
+       DetConfig.C             \
+       OCDBConfig.C            \
        Reconstruct.C           \
        Check.C                 \
        Tag.C                   \
index 85a5ae3db2458231d518024102fd0b2e4a1b23ab..fa390dec53d5b5db671c578e39aca612d3d7e96b 100755 (executable)
@@ -16,7 +16,10 @@ function runcommand()
 
     echo "* $type : $scr"
     echo "* $type : $scr" >&2
-    
+    date 
+    echo "Starting ${type} ${scr}" >> $log
+    date >> $log 
+
     time aliroot -b -q -x $scr 2> /dev/stdout | tee -a $log 
     local ext=$?
     local exp=${5-0}
@@ -35,6 +38,14 @@ function runcommand()
         echo "* $scr finished with the expected exit code ($exp), moving on"
         echo "* $scr finished with the expected exit code ($exp), moving on" >&2
     fi
+
+    echo "End of ${type} ${scr}" >> $log
+    date >> $log
+    echo "Disk usage in kB per file:" >> $log 
+    du -sk * | sort -n -r >> $log 
+    echo "Total disk usage: " >> $log 
+    du -sh . >> $log
+
 }
 
 #
@@ -69,6 +80,7 @@ DC_EVENT="1"
 number=0
 runAODTrain=0
 runQATrain=0
+runCheck=0
 
 while test "x$1" != "x"; do
     option="$1"
@@ -89,6 +101,10 @@ while test "x$1" != "x"; do
        --number)       number="$1";            shift ;;
        --qa)           runQATrain=1                  ;;
        --aod)          runAODTrain=1                 ;;
+       --check)        runCheck=1                    ;;
+       --no-aod)       runAODTrain=0                 ;;
+       --no-qa)        runQATrain=0                  ;;
+       --no-check)     runCheck=0                    ;;
        *) echo "Unkown option: $option" >&2
     esac
 done
@@ -148,19 +164,33 @@ ls -l
 
 echo "SIMRUN: Now read to process"
 
+# --- Run simulation (out: hits, digits, sdigits) --------------------
 runcommand "SIMULATION"     "Simulate.C($DC_EVENT,$DC_RUN)"    sim.log     5
+rm -f *.Hits.root
+
+# --- Run reconstruction (in: digits, sdigits, raw out: ESDs) --------
 runcommand "RECONSTRUCTION" "Reconstruct.C($DC_RUN)"           rec.log    10
+rm -f *.Digits.root *.SDigits.root
+cleanRecPoints 0
+
+# --- Create tags (in: ESDs) -----------------------------------------
 runcommand "TAG"            "Tag.C"                            tag.log    50
-runcommand "CHECK"         "Check.C"                           check.log  60
+
+# --- Run the check --------------------------------------------------
+if test $runCheck -gt 0 ; then 
+    runcommand "CHECK"             "Check.C"                           check.log  60
+fi
+
+# --- Possibly run QA analysis ---------------------------------------
 if test $runQATrain -gt 0 ; then 
     runcommand "QA"         "QA.C($DC_RUN)"                    qa.log    100
 fi
+
+# --- Possibly run AOD analysis --------------------------------------
 if test $runAODTrain -gt 0 ; then 
     runcommand "AOD"        "AOD.C($DC_RUN)"                   aod.log   100
 fi
 
-rm -f *.Hits.root *.Digits.root *.SDigits.root
-cleanRecPoints 0
 
 exit 0
 #
diff --git a/PWGLF/FORWARD/analysis2/sim/spyFile.sh b/PWGLF/FORWARD/analysis2/sim/spyFile.sh
new file mode 100755 (executable)
index 0000000..6aa3e17
--- /dev/null
@@ -0,0 +1,97 @@
+#!/bin/bash
+
+pid=
+file=
+out=
+tee=0
+twait=30
+
+
+# --- Call on errors -------------------------------------------------
+error()
+{
+    echo "$@" > /dev/stderr 
+    exit 1
+}
+
+# --- Help -----------------------------------------------------------
+usage() 
+{
+    cat <<EOF
+Usage: $0 -p PID -f FILE [OPTIONS]
+
+Options:
+       -p,--pid        PID             Process identifier 
+       -f,--file       FILENAME        File to monitor 
+       -o,--out        NAME            Name of stored file 
+       -w,--wait       SECONDDS        How many seconds to wait
+       -P,--pipe                       Use a tee when writing to file 
+       -h,--help                       This help
+
+Output file is PID_NAME.log.  If NAME is not specified it defaults to
+the base name of FILENAME minus possible ending .log. 
+
+EOF
+} 
+
+# --- Process command line ------------------------------------------- 
+while test $# -gt 0 ; do 
+    case $1 in 
+       -p|--pid)       pid=$2          ; shift ;;
+       -f|--file)      file=$2         ; shift ;;
+       -o|--out)       out=$2          ; shift ;; 
+       -w|--wait)      twait=$2        ; shift ;;
+       -P|--pipe)      tee=1           ;;
+       -h|--help)      usage           ; exit 0 ;; 
+       *)      error "Unknown option: $1"      ;;
+    esac
+    shift
+done
+
+# --- Check settings -------------------------------------------------
+if test "X$pid"  = "X" ; then error "No PID specified" ; fi
+if test "X$file" = "X" ; then error "No file specified" ; fi
+if test "X$out"  = "X" ; then 
+    out=`basename $file .log` 
+fi
+           
+# --- Make derived variables -----------------------------------------
+tmp=${pid}_${out}.tmp 
+log=${pid}_${out}.log
+
+# --- Check grid authenticity ----------------------------------------
+if test ! -f /tmp/gclient_env_${UID} ; then 
+    error "No AliEn environment file"
+fi
+. /tmp/gclient_env_${UID}
+alien-token-info | grep -q "Token is still valid"
+if test $? -ne 0 ; then 
+    echo "Token not valid, please re-new" > /dev/stderr 
+    exit 1
+fi
+
+
+# --- Main loop (eternal) --------------------------------------------
+while true ; do 
+    if test $tee -gt 0 ; then 
+       echo "=== Executing alien_spy $pid $file | tee $tmp ..."
+       alien_spy $pid $file | tee $tmp
+    else
+       echo "=== Executing alien_spy $pid $file > $tmp ..."
+       alien_spy $pid $file > $tmp
+    fi
+    l1=`stat -c %s $tmp`
+    l2=`stat -c %s $log` 
+    if test $l1 -ge $l2 ; then 
+       mv $tmp $log
+    else 
+       echo "New download smaller than old - exiting"
+       break 
+    fi 
+    sleep $twait
+done
+
+
+#
+# EOF
+#
index b4a151c3108fa08d5aa01333151a0d89a3c72aed..51dbd188b8129f856a268508ed62c86776ef7e68 100755 (executable)
@@ -22,6 +22,8 @@ files="AOD.C  \
        AODConfig.C     \
        Check.C         \
        Config.C        \
+        DetConfig.C    \
+       OCDBConfig.C    \
        GRP.C           \
        QA.C            \
        QAConfig.C      \
@@ -36,5 +38,9 @@ mkdir -p test
 for i in $files ; do 
     cp -v $i test/`basename $i` 
 done 
+opts=
+if test "x$run" = "x138190" ; then 
+    opts="--bmin 0 --bmax 1"
+fi
 
-(cd test && ../run.sh --run $run  --event $nev --qa --aod $@)
+(cd test && ../run.sh --run $run  --event $nev --qa --aod ${opts} $@)