- workaround for copying and merging of ESDs: The HLTOUT contains ESDs for every...
[u/mrichter/AliRoot.git] / HLT / sim / AliHLTSimulation.cxx
index 252a890..f29b2d1 100644 (file)
 #include "TObjString.h"
 #include "AliHLTSimulation.h"
 #include "AliLog.h"
+#include "AliRun.h"
 #include "AliRunLoader.h"
+#include "AliHeader.h"
+#include "AliTracker.h"
+#include "AliCDBManager.h"
+#include "AliCDBEntry.h"
+#include "AliCDBPath.h"
+#include "AliCDBId.h"
+#include "AliCDBMetaData.h"
 #include "AliHLTSystem.h"
 #include "AliRawReaderFile.h"
 #include "AliRawReaderDate.h"
@@ -146,6 +154,32 @@ int AliHLTSimulation::Init(AliRunLoader* pRunLoader, const char* options)
     delete pTokens;
   }
 
+  // init solenoid field
+  Bool_t bUniformField=kTRUE;
+  AliTracker::SetFieldMap(pRunLoader->GetAliRun()->Field(),bUniformField);
+  Double_t solenoidBz=AliTracker::GetBz();
+  AliCDBManager* man = AliCDBManager::Instance();
+  if (man && man->IsDefaultStorageSet())
+  {
+    const char* cdbSolenoidPath="HLT/ConfigHLT/SolenoidBz";
+    int runNo=pRunLoader->GetHeader()->GetRun();
+    TString cdbSolenoidParam;
+    cdbSolenoidParam.Form("-solenoidBz %f", solenoidBz);
+
+    // check if the entry is already there
+    AliCDBEntry *pEntry = man->Get(cdbSolenoidPath, runNo);
+    TObjString* pString=NULL;
+    if (pEntry) pString=dynamic_cast<TObjString*>(pEntry->GetObject());
+
+    if (!pEntry || !pString || pString->GetString().CompareTo(cdbSolenoidParam)!=0) {
+      TObjString obj(cdbSolenoidParam);
+      AliCDBPath cdbSolenoidEntry(cdbSolenoidPath);
+      AliCDBId cdbSolenoidId(cdbSolenoidEntry, runNo, runNo);
+      AliCDBMetaData cdbMetaData;
+      man->Put(&obj, cdbSolenoidId, &cdbMetaData);
+    }
+  }
+
   // scan options
   if (fpSystem->ScanOptions(sysOp.Data())<0) {
     AliError("error setting options for HLT system");