]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG/EMCAL/AliEmcalSetupTask.cxx
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWG / EMCAL / AliEmcalSetupTask.cxx
index 812834e7b8379a26c29201d103ff51d1e75a9f67..d4994a806c6f5c4d304ba46631a7e42c1ba6c64a 100644 (file)
@@ -29,6 +29,7 @@ AliEmcalSetupTask::AliEmcalSetupTask() :
   fOadbPath("$ALICE_ROOT/OADB/EMCAL"),
   fGeoPath("$ALICE_ROOT/OADB/EMCAL"),
   fObjs("GRP ITS TPC TRD EMCAL"),
+  fNoOCDB(kFALSE),
   fIsInit(kFALSE),
   fLocalOcdb(),
   fLocalOcdbStor()
@@ -43,6 +44,7 @@ AliEmcalSetupTask::AliEmcalSetupTask(const char *name) :
   fOadbPath("$ALICE_ROOT/OADB/EMCAL"),
   fGeoPath("$ALICE_ROOT/OADB/EMCAL"),
   fObjs("GRP ITS TPC TRD EMCAL"),
+  fNoOCDB(kFALSE),
   fIsInit(kFALSE),
   fLocalOcdb(),
   fLocalOcdbStor()
@@ -67,6 +69,10 @@ void AliEmcalSetupTask::ConnectInputData(Option_t *option)
   if (fOcdbPath.Length()==0)
     return;
 
+  AliCDBManager *man = AliCDBManager::Instance();
+  if (man->IsDefaultStorageSet()) 
+    return;
+
   if (fIsInit)
     return;
 
@@ -131,13 +137,10 @@ void AliEmcalSetupTask::Setup(Int_t runno)
 {
   // Setup everything
 
-  if (runno<=0)
-    return;
-
   // Setup AliEMCALGeometry corresponding to year
   TString geoname("EMCAL_COMPLETE12SMV1");
   Int_t year = 2013;
-  if (runno<=139517) {
+  if (runno>0 && runno<=139517) {
     year = 2010;
     geoname = "EMCAL_FIRSTYEARV1";
   } else if ((runno>139517) && (runno<=170593)) {
@@ -145,6 +148,13 @@ void AliEmcalSetupTask::Setup(Int_t runno)
     geoname = "EMCAL_COMPLETEV1";
   } else if ((runno>170593) && (runno<=193766)) {
     year = 2012;
+    geoname = "EMCAL_COMPLETE12SMV1";
+  } else if ((runno>193766) && (runno <= 199161)) {
+    geoname = "EMCAL_COMPLETE12SMV1";
+    year = 2013;
+  } else if (runno>199161) { //MV: is this the last run of run 1?
+    geoname = "EMCAL_COMPLETE12SMV1_DCAL_8SM";
+    year = 2015;
   }
   AliEMCALGeometry *geom = AliEMCALGeometry::GetInstance(geoname);
   if (!geom) {
@@ -152,56 +162,64 @@ void AliEmcalSetupTask::Setup(Int_t runno)
     return;
   }
 
+  if (runno<0)  // Run number 0 can occur for MC
+    return;
+
   // Setup CDB manager
   AliCDBManager *man = 0;
-  man = AliCDBManager::Instance();
-  if (man->IsDefaultStorageSet()) {
-    AliInfo(Form("Default OCDB storage already set"));
-  } else {
-    if (fOcdbPath.Length()==0) {
-      man = 0; // do not use OCDB
-    } else if (fOcdbPath != "uselocal") {
-      AliInfo(Form("Setting up OCDB to point to %s",fOcdbPath.Data()));
-      man->SetDefaultStorage(fOcdbPath);
-    } else { // use local copy of OCDB
-      TString tmpdir=gSystem->WorkingDirectory();
-      if (gSystem->AccessPathName(tmpdir))
-       tmpdir = "/tmp";
-      tmpdir+="/";
-      tmpdir+=gSystem->GetUid();
-      tmpdir+="-";
-      TDatime t;
-      tmpdir+=t.Get();
-      tmpdir+="-";
-      Int_t counter = 0;
-      fLocalOcdb = tmpdir;
-      fLocalOcdb += Form("%d%d%d",gRandom->Integer(999999999),gRandom->Integer(999999999),gRandom->Integer(999999999));
-      while (!gSystem->AccessPathName(fLocalOcdb)) {
+  if (!fNoOCDB) {
+    man = AliCDBManager::Instance();
+    if (!man)
+      AliFatal(Form("Did not get pointer to CDB manager"));
+
+    if (man->IsDefaultStorageSet()) {
+      AliInfo(Form("Default OCDB storage already set"));
+    } else {
+      if (fOcdbPath.Length()==0) {
+       man = 0; // do not use OCDB
+      } else if (fOcdbPath != "uselocal") {
+       AliInfo(Form("Setting up OCDB to point to %s",fOcdbPath.Data()));
+       man->SetDefaultStorage(fOcdbPath);
+      } else { // use local copy of OCDB
+       TString tmpdir=gSystem->WorkingDirectory();
+       if (gSystem->AccessPathName(tmpdir))
+         tmpdir = "/tmp";
+       tmpdir+="/";
+       tmpdir+=gSystem->GetUid();
+       tmpdir+="-";
+       TDatime t;
+       tmpdir+=t.Get();
+       tmpdir+="-";
+       Int_t counter = 0;
        fLocalOcdb = tmpdir;
        fLocalOcdb += Form("%d%d%d",gRandom->Integer(999999999),gRandom->Integer(999999999),gRandom->Integer(999999999));
-       counter++;
-       if (counter>100) {
-         AliFatal(Form("Could not create local directory for OCDB at %s",tmpdir.Data()));
+       while (!gSystem->AccessPathName(fLocalOcdb)) {
+         fLocalOcdb = tmpdir;
+         fLocalOcdb += Form("%d%d%d",gRandom->Integer(999999999),gRandom->Integer(999999999),gRandom->Integer(999999999));
+         counter++;
+         if (counter>100) {
+           AliFatal(Form("Could not create local directory for OCDB at %s",tmpdir.Data()));
+         }
+       }
+       gSystem->MakeDirectory(fLocalOcdb);
+       TString filename(Form("$ALICE_ROOT/PWG/EMCAL/data/%d.dat",year));
+       TString cmd(Form("cd %s && tar -xf %s",fLocalOcdb.Data(),filename.Data()));
+       Int_t ret = gSystem->Exec(cmd);
+       if (ret==0) {
+         TString locdb("local://");
+         locdb+=fLocalOcdb;
+         locdb+="/";
+         locdb+=year;
+         AliInfo(Form("Setting up local OCDB at %s",locdb.Data()));
+         man->SetDefaultStorage(locdb);
+         fLocalOcdbStor = locdb;
+       } else {
+         AliFatal(Form("Could not set up local OCDB at %s",fLocalOcdb.Data()));
        }
-      }
-      gSystem->MakeDirectory(fLocalOcdb);
-      TString filename(Form("$ALICE_ROOT/PWG/EMCAL/data/%d.dat",year));
-      TString cmd(Form("cd %s && tar -xf %s",fLocalOcdb.Data(),filename.Data()));
-      Int_t ret = gSystem->Exec(cmd);
-      if (ret==0) {
-       TString locdb("local://");
-       locdb+=fLocalOcdb;
-       locdb+="/";
-       locdb+=year;
-       AliInfo(Form("Setting up local OCDB at %s",locdb.Data()));
-       man->SetDefaultStorage(locdb);
-       fLocalOcdbStor = locdb;
-      } else {
-       AliFatal(Form("Could not set up local OCDB at %s",fLocalOcdb.Data()));
       }
     }
   }
-  
+
   // Load geometry from OCDB 
   if (man) {
     if (man->GetRun()!=runno)