X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=STEER%2FAliSimulation.cxx;h=3f1427952538ba8928466588d07a52e81fb65b9f;hb=90319d496fd3dcd964578266f82036b0a875e05d;hp=4688765607c78d80f920dfb2d3ec60bc94bc0029;hpb=aa04f81b8df8532b63dec6c41494f7b4cb0744d1;p=u%2Fmrichter%2FAliRoot.git diff --git a/STEER/AliSimulation.cxx b/STEER/AliSimulation.cxx index 4688765607c..3f142795253 100644 --- a/STEER/AliSimulation.cxx +++ b/STEER/AliSimulation.cxx @@ -105,32 +105,45 @@ // // /////////////////////////////////////////////////////////////////////////////// +#include #include #include #include - -#include "AliLog.h" +#include + +#include "AliCDBStorage.h" +#include "AliCDBEntry.h" +#include "AliCDBManager.h" +#include "AliAlignObj.h" +#include "AliCentralTrigger.h" +#include "AliDAQConfig.h" #include "AliDigitizer.h" #include "AliGenerator.h" +#include "AliLog.h" #include "AliModule.h" #include "AliRun.h" #include "AliRunDigitizer.h" #include "AliRunLoader.h" #include "AliSimulation.h" #include "AliVertexGenFile.h" +#include "AliCentralTrigger.h" +#include "AliCTPRawData.h" ClassImp(AliSimulation) //_____________________________________________________________________________ -AliSimulation::AliSimulation(const char* configFileName, +AliSimulation::AliSimulation(const char* configFileName, const char* cdbUri, const char* name, const char* title) : TNamed(name, title), fRunGeneration(kTRUE), fRunSimulation(kTRUE), + fLoadAlignFromCDB(kTRUE), + fLoadAlignData("ALL"), fMakeSDigits("ALL"), fMakeDigits("ALL"), + fMakeTrigger(""), fMakeDigitsFromHits(""), fWriteRawData(""), fRawDataFileName(""), @@ -142,8 +155,10 @@ AliSimulation::AliSimulation(const char* configFileName, fGAliceFileName("galice.root"), fEventsPerFile(), fBkgrdFileNames(NULL), + fAlignObjArray(NULL), fUseBkgrdVertex(kTRUE), - fRegionOfInterest(kFALSE) + fRegionOfInterest(kFALSE), + fCDBUri(cdbUri) { // create simulation object with default parameters @@ -156,8 +171,11 @@ AliSimulation::AliSimulation(const AliSimulation& sim) : fRunGeneration(sim.fRunGeneration), fRunSimulation(sim.fRunSimulation), + fLoadAlignFromCDB(sim.fLoadAlignFromCDB), + fLoadAlignData(sim.fLoadAlignData), fMakeSDigits(sim.fMakeSDigits), fMakeDigits(sim.fMakeDigits), + fMakeTrigger(sim.fMakeTrigger), fMakeDigitsFromHits(sim.fMakeDigitsFromHits), fWriteRawData(sim.fWriteRawData), fRawDataFileName(""), @@ -169,8 +187,10 @@ AliSimulation::AliSimulation(const AliSimulation& sim) : fGAliceFileName(sim.fGAliceFileName), fEventsPerFile(), fBkgrdFileNames(NULL), + fAlignObjArray(NULL), fUseBkgrdVertex(sim.fUseBkgrdVertex), - fRegionOfInterest(sim.fRegionOfInterest) + fRegionOfInterest(sim.fRegionOfInterest), + fCDBUri(sim.fCDBUri) { // copy constructor @@ -202,6 +222,8 @@ AliSimulation::~AliSimulation() // clean up fEventsPerFile.Delete(); +// if(fAlignObjArray) fAlignObjArray->Delete(); // fAlignObjArray->RemoveAll() ??? +// delete fAlignObjArray; fAlignObjArray=0; if (fBkgrdFileNames) { fBkgrdFileNames->Delete(); @@ -218,6 +240,41 @@ void AliSimulation::SetNumberOfEvents(Int_t nEvents) fNEvents = nEvents; } +//_____________________________________________________________________________ +void AliSimulation::InitCDBStorage(const char* uri) +{ +// activate a default CDB storage +// First check if we have any CDB storage set, because it is used +// to retrieve the calibration and alignment constants + + AliCDBManager* man = AliCDBManager::Instance(); + if (!man->IsDefaultStorageSet()) + { + AliWarningClass("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); + AliWarningClass("Default CDB storage not yet set"); + AliWarningClass(Form("Using default storage declared in AliSimulation: %s",uri)); + AliWarningClass("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); + SetDefaultStorage(uri); + } + +} + +//_____________________________________________________________________________ +void AliSimulation::SetDefaultStorage(const char* uri) { +// activate a default CDB storage + + AliCDBManager::Instance()->SetDefaultStorage(uri); + +} + +//_____________________________________________________________________________ +void AliSimulation::SetSpecificStorage(const char* detName, const char* uri) { +// activate a detector-specific CDB storage + + AliCDBManager::Instance()->SetSpecificStorage(detName, uri); + +} + //_____________________________________________________________________________ void AliSimulation::SetConfigFile(const char* fileName) { @@ -255,6 +312,245 @@ void AliSimulation::SetEventsPerFile(const char* detector, const char* type, fEventsPerFile.Add(obj); } +//_____________________________________________________________________________ +Bool_t AliSimulation::ApplyAlignObjsToGeom(TObjArray* alObjArray) +{ + // Read collection of alignment objects (AliAlignObj derived) saved + // in the TClonesArray ClArrayName and apply them to the geometry + // manager singleton. + // + alObjArray->Sort(); + Int_t nvols = alObjArray->GetEntriesFast(); + + Bool_t flag = kTRUE; + + for(Int_t j=0; jUncheckedAt(j); + if (alobj->ApplyToGeometry() == kFALSE) flag = kFALSE; + } + + if (AliDebugLevelClass() >= 1) { + gGeoManager->CheckOverlaps(20); + TObjArray* ovexlist = gGeoManager->GetListOfOverlaps(); + if(ovexlist->GetEntriesFast()){ + AliError("The application of alignment objects to the geometry caused huge overlaps/extrusions!"); + } + } + + return flag; + +} + +//_____________________________________________________________________________ +Bool_t AliSimulation::ApplyAlignObjsToGeom(const char* fileName, const char* clArrayName) +{ + // read collection of alignment objects (AliAlignObj derived) saved + // in the TClonesArray ClArrayName in the file fileName and apply + // them to the TGeo geometry passed as argument + // + + TFile* inFile = TFile::Open(fileName,"READ"); + if (!inFile || !inFile->IsOpen()) { + AliErrorClass(Form("Could not open file %s !",fileName)); + return kFALSE; + } + + TClonesArray* alObjArray = ((TClonesArray*) inFile->Get(clArrayName)); + inFile->Close(); + if (!alObjArray) { + AliErrorClass(Form("Could not get array (%s) from file (%s) !",clArrayName,fileName)); + return kFALSE; + } + + return ApplyAlignObjsToGeom(alObjArray); + +} + +//_____________________________________________________________________________ +Bool_t AliSimulation::ApplyAlignObjsToGeom(AliCDBParam* param, AliCDBId& Id) +{ + // read collection of alignment objects (AliAlignObj derived) saved + // in the TClonesArray ClArrayName in the AliCDBEntry identified by + // param (to get the AliCDBStorage) and Id; apply the alignment objects + // to the TGeo geometry passed as argument + // + + AliCDBStorage* storage = AliCDBManager::Instance()->GetStorage(param); + AliCDBEntry* entry = storage->Get(Id); + TClonesArray* AlObjArray = ((TClonesArray*) entry->GetObject()); + + return ApplyAlignObjsToGeom(AlObjArray); + +} + +//_____________________________________________________________________________ +Bool_t AliSimulation::ApplyAlignObjsToGeom(const char* uri, const char* path, Int_t runnum, Int_t version, Int_t sversion) +{ + // read collection of alignment objects (AliAlignObj derived) saved + // in the TClonesArray ClArrayName in the AliCDBEntry identified by + // param (to get the AliCDBStorage) and Id; apply the alignment objects + // to the TGeo geometry passed as argument + // + + AliCDBParam* param = AliCDBManager::Instance()->CreateParameter(uri); + AliCDBId id(path, runnum, runnum, version, sversion); + + return ApplyAlignObjsToGeom(param, id); + +} + +//_____________________________________________________________________________ +Bool_t AliSimulation::ApplyAlignObjsToGeom(const char* detName, Int_t runnum, Int_t version, Int_t sversion) +{ + // read collection of alignment objects (AliAlignObj derived) saved + // in the TClonesArray ClArrayName in the AliCDBEntry identified by + // param (to get the AliCDBStorage) and Id; apply the alignment objects + // to the TGeo geometry passed as argument + // + + InitCDBStorage("local://$ALICE_ROOT"); + AliCDBPath path(detName,"Align","Data"); + AliCDBEntry* entry = AliCDBManager::Instance()->Get(path.GetPath(),runnum,version,sversion); + + if(!entry) return kFALSE; + TClonesArray* AlObjArray = ((TClonesArray*) entry->GetObject()); + + return ApplyAlignObjsToGeom(AlObjArray); +} + +//_____________________________________________________________________________ +Bool_t AliSimulation::SetAlignObjArraySingleDet(const char* detName) +{ + // Fills array of single detector's alignable objects from CDB + + AliDebug(2, Form("Loading alignment data for detector: %s",detName)); + + AliCDBEntry *entry; + + AliCDBPath path(detName,"Align","Data"); + + entry=AliCDBManager::Instance()->Get(path.GetPath()); + if(!entry){ + AliDebug(2,Form("Couldn't load alignment data for detector %s",detName)); + return kFALSE; + } + entry->SetOwner(1); + TClonesArray *alignArray = (TClonesArray*) entry->GetObject(); + alignArray->SetOwner(0); + AliDebug(2,Form("Found %d alignment objects for %s", + alignArray->GetEntries(),detName)); + + AliAlignObj *alignObj=0; + TIter iter(alignArray); + + // loop over align objects in detector + while( ( alignObj=(AliAlignObj *) iter.Next() ) ){ + fAlignObjArray->Add(alignObj); + } + // delete entry --- Don't delete, it is cached! + + AliDebug(2, Form("fAlignObjArray entries: %d",fAlignObjArray->GetEntries() )); + return kTRUE; + +} + +//_____________________________________________________________________________ +Bool_t AliSimulation::MisalignGeometry(AliRunLoader *runLoader) +{ + // Read the alignment objects from CDB. + // Each detector is supposed to have the + // alignment objects in DET/Align/Data CDB path. + // All the detector objects are then collected, + // sorted by geometry level (starting from ALIC) and + // then applied to the TGeo geometry. + // Finally an overlaps check is performed. + + Bool_t delRunLoader = kFALSE; + if (!runLoader) { + runLoader = LoadRun("READ"); + if (!runLoader) return kFALSE; + delRunLoader = kTRUE; + } + + // Load alignment data from CDB and fill fAlignObjArray + if(fLoadAlignFromCDB){ + if(!fAlignObjArray) fAlignObjArray = new TObjArray(); + + //fAlignObjArray->RemoveAll(); + fAlignObjArray->Clear(); + fAlignObjArray->SetOwner(0); + + TString detStr = fLoadAlignData; + TString dataNotLoaded=""; + TString dataLoaded=""; + + TObjArray* detArray = runLoader->GetAliRun()->Detectors(); + for (Int_t iDet = 0; iDet < detArray->GetEntriesFast(); iDet++) { + AliModule* det = (AliModule*) detArray->At(iDet); + if (!det || !det->IsActive()) continue; + if (IsSelected(det->GetName(), detStr)) { + if(!SetAlignObjArraySingleDet(det->GetName())){ + dataNotLoaded += det->GetName(); + dataNotLoaded += " "; + } else { + dataLoaded += det->GetName(); + dataLoaded += " "; + } + } + } // end loop over detectors + + if ((detStr.CompareTo("ALL") == 0)) detStr = ""; + dataNotLoaded += detStr; + AliInfo(Form("Alignment data loaded for: %s", + dataLoaded.Data())); + AliInfo(Form("Didn't/couldn't load alignment data for: %s", + dataNotLoaded.Data())); + } // fLoadAlignFromCDB flag + + // Check if the array with alignment objects was + // provided by the user. If yes, apply the objects + // to the present TGeo geometry + if (fAlignObjArray) { + if (gGeoManager && gGeoManager->IsClosed()) { + if (ApplyAlignObjsToGeom(fAlignObjArray) == kFALSE) { + AliError("The misalignment of one or more volumes failed!" + "Compare the list of simulated detectors and the list of detector alignment data!"); + if (delRunLoader) delete runLoader; + return kFALSE; + } + } + else { + AliError("Can't apply the misalignment! gGeoManager doesn't exist or it is still opened!"); + if (delRunLoader) delete runLoader; + return kFALSE; + } + } + + if (delRunLoader) delete runLoader; + + return kTRUE; +} + + +//_____________________________________________________________________________ +Bool_t AliSimulation::SetRunNumber() +{ + // Set the CDB manager run number + // The run number is retrieved from gAlice + + if(AliCDBManager::Instance()->GetRun() < 0) { + AliRunLoader* runLoader = LoadRun("READ"); + if (!runLoader) return kFALSE; + else { + AliCDBManager::Instance()->SetRun(runLoader->GetAliRun()->GetRunNumber()); + AliInfo(Form("Run number: %d",AliCDBManager::Instance()->GetRun())); + delete runLoader; + } + } + return kTRUE; +} + //_____________________________________________________________________________ void AliSimulation::MergeWith(const char* fileName, Int_t nSignalPerBkgrd) { @@ -272,6 +568,8 @@ Bool_t AliSimulation::Run(Int_t nEvents) { // run the generation, simulation and digitization + InitCDBStorage(fCDBUri); + if (nEvents > 0) fNEvents = nEvents; // generation and simulation -> hits @@ -279,6 +577,16 @@ Bool_t AliSimulation::Run(Int_t nEvents) if (!RunSimulation()) if (fStopOnError) return kFALSE; } + // Set run number in CDBManager (if it is not already set in RunSimulation) + if (!SetRunNumber()) if (fStopOnError) return kFALSE; + + // Load and misalign the geometry + if (!gGeoManager) { + TGeoManager::Import("geometry.root"); + if (!gGeoManager) if (fStopOnError) return kFALSE; + if (!MisalignGeometry()) if (fStopOnError) return kFALSE; + } + // hits -> summable digits if (!fMakeSDigits.IsNull()) { if (!RunSDigitization(fMakeSDigits)) if (fStopOnError) return kFALSE; @@ -304,6 +612,11 @@ Bool_t AliSimulation::Run(Int_t nEvents) } } + // digits -> trigger + if (!RunTrigger(fMakeTrigger)) { + if (fStopOnError) return kFALSE; + } + // digits -> raw data if (!fWriteRawData.IsNull()) { if (!WriteRawData(fWriteRawData, fRawDataFileName, @@ -315,6 +628,61 @@ Bool_t AliSimulation::Run(Int_t nEvents) return kTRUE; } +//_____________________________________________________________________________ +Bool_t AliSimulation::RunTrigger(const char* descriptors) +{ + // run the trigger + + TStopwatch stopwatch; + stopwatch.Start(); + + AliRunLoader* runLoader = LoadRun("READ"); + if (!runLoader) return kFALSE; + TString des = descriptors; + + if (des.IsNull()) { + if (gAlice->GetTriggerDescriptor() != "") { + des = gAlice->GetTriggerDescriptor(); + } + else { + AliWarning("No trigger descriptor is specified. Skipping the trigger simulation..."); + return kTRUE; + } + } + + runLoader->MakeTree( "CT" ); + AliCentralTrigger* aCTP = runLoader->GetTrigger(); + // Load Descriptors + aCTP->LoadDescriptor( des ); + + // digits -> trigger + if( !aCTP->RunTrigger( runLoader ) ) { + if (fStopOnError) { + // delete aCTP; + return kFALSE; + } + } + + AliInfo(Form("Execution time: R:%.2fs C:%.2fs", + stopwatch.RealTime(),stopwatch.CpuTime())); + + delete runLoader; + + return kTRUE; +} + +//_____________________________________________________________________________ +Bool_t AliSimulation::WriteTriggerRawData() +{ + // Writes the CTP (trigger) DDL raw data + // Details of the format are given in the + // trigger TDR - pages 134 and 135. + AliCTPRawData writer; + writer.RawData(); + + return kTRUE; +} + //_____________________________________________________________________________ Bool_t AliSimulation::RunSimulation(Int_t nEvents) { @@ -337,13 +705,64 @@ Bool_t AliSimulation::RunSimulation(Int_t nEvents) StdoutToAliInfo(StderrToAliError( gAlice->Init(fConfigFileName.Data()); );); + + // Get the trigger descriptor string + // Either from AliSimulation or from + // gAlice + if (fMakeTrigger.IsNull()) { + if (gAlice->GetTriggerDescriptor() != "") + fMakeTrigger = gAlice->GetTriggerDescriptor(); + } + else + gAlice->SetTriggerDescriptor(fMakeTrigger.Data()); + + // Set run number in CDBManager + AliCDBManager::Instance()->SetRun(gAlice->GetRunNumber()); + AliInfo(Form("Run number: %d",AliCDBManager::Instance()->GetRun())); + AliRunLoader* runLoader = gAlice->GetRunLoader(); if (!runLoader) { - AliError(Form("gAlice has no run loader object. " - "Check your config file: %s", fConfigFileName.Data())); - return kFALSE; + AliError(Form("gAlice has no run loader object. " + "Check your config file: %s", fConfigFileName.Data())); + return kFALSE; } SetGAliceFile(runLoader->GetFileName()); + + // Export ideal geometry + if (gGeoManager) gGeoManager->Export("geometry.root"); + + // Misalign geometry +// if (!MisalignGeometry(runLoader)) { +// delete runLoader; +// return kFALSE; +// } + MisalignGeometry(runLoader); + + // Temporary fix by A.Gheata + // Could be removed with the next Root version (>5.11) + if (gGeoManager) { + TIter next(gGeoManager->GetListOfVolumes()); + TGeoVolume *vol; + while ((vol = (TGeoVolume *)next())) { + if (vol->GetVoxels()) { + if (vol->GetVoxels()->NeedRebuild()) { + vol->GetVoxels()->Voxelize(); + vol->FindOverlaps(); + } + } + } + } + + // Export (mis)aligned geometry + if (gGeoManager) gGeoManager->Export("misaligned_geometry.root"); + +// AliRunLoader* runLoader = gAlice->GetRunLoader(); +// if (!runLoader) { +// AliError(Form("gAlice has no run loader object. " +// "Check your config file: %s", fConfigFileName.Data())); +// return kFALSE; +// } +// SetGAliceFile(runLoader->GetFileName()); if (!gAlice->Generator()) { AliError(Form("gAlice has no generator object. " @@ -403,8 +822,8 @@ Bool_t AliSimulation::RunSimulation(Int_t nEvents) delete runLoader; - AliInfo("execution time:"); - StdoutToAliInfo(stopwatch.Print();); + AliInfo(Form("Execution time: R:%.2fs C:%.2fs", + stopwatch.RealTime(),stopwatch.CpuTime())); return kTRUE; } @@ -430,8 +849,8 @@ Bool_t AliSimulation::RunSDigitization(const char* detectors) TStopwatch stopwatchDet; stopwatchDet.Start(); det->Hits2SDigits(); - AliInfo(Form("execution time for %s:", det->GetName())); - StdoutToAliInfo(stopwatchDet.Print();); + AliInfo(Form("Execution time for %s: R:%.2fs C:%.2fs", + det->GetName(),stopwatchDet.RealTime(),stopwatchDet.CpuTime())); } } @@ -443,8 +862,8 @@ Bool_t AliSimulation::RunSDigitization(const char* detectors) delete runLoader; - AliInfo("execution time:"); - StdoutToAliInfo(stopwatch.Print();); + AliInfo(Form("Execution time: R:%.2fs C:%.2fs", + stopwatch.RealTime(),stopwatch.CpuTime())); return kTRUE; } @@ -508,9 +927,9 @@ Bool_t AliSimulation::RunDigitization(const char* detectors, delete manager; - AliInfo("execution time:"); - StdoutToAliInfo(stopwatch.Print();); - + AliInfo(Form("Execution time: R:%.2fs C:%.2fs", + stopwatch.RealTime(),stopwatch.CpuTime())); + return kTRUE; } @@ -522,7 +941,7 @@ Bool_t AliSimulation::RunHitsDigitization(const char* detectors) TStopwatch stopwatch; stopwatch.Start(); - AliRunLoader* runLoader = LoadRun(); + AliRunLoader* runLoader = LoadRun("READ"); if (!runLoader) return kFALSE; TString detStr = detectors; @@ -543,9 +962,11 @@ Bool_t AliSimulation::RunHitsDigitization(const char* detectors) } delete runLoader; + //PH Temporary fix to avoid interference with the PHOS loder/getter + //PH The problem has to be solved in more general way 09/06/05 - AliInfo("execution time:"); - StdoutToAliInfo(stopwatch.Print();); + AliInfo(Form("Execution time: R:%.2fs C:%.2fs", + stopwatch.RealTime(),stopwatch.CpuTime())); return kTRUE; } @@ -598,8 +1019,8 @@ Bool_t AliSimulation::WriteRawData(const char* detectors, } } - AliInfo("execution time:"); - StdoutToAliInfo(stopwatch.Print();); + AliInfo(Form("Execution time: R:%.2fs C:%.2fs", + stopwatch.RealTime(),stopwatch.CpuTime())); return kTRUE; } @@ -636,6 +1057,9 @@ Bool_t AliSimulation::WriteRawFiles(const char* detectors) } } + if (!WriteTriggerRawData()) + if (fStopOnError) return kFALSE; + gSystem->ChangeDirectory(baseDir); if ((detStr.CompareTo("ALL") != 0) && !detStr.IsNull()) { AliError(Form("the following detectors were not found: %s", @@ -653,24 +1077,6 @@ Bool_t AliSimulation::ConvertRawFilesToDate(const char* dateFileName) { // convert raw data DDL files to a DATE file with the program "dateStream" - // DATE setup - const Int_t kNDetectors = 17; - const char* kDetectors[kNDetectors] = {"TPC", "ITSSPD", "ITSSDD", "ITSSSD", - "TRD", "TOF", "PHOS", "RICH", - "EMCAL", "MUON", "MUTR", "ZDC", - "PMD", "START", "VZERO", "CRT", - "FMD"}; - const Int_t kDetectorDDLs[kNDetectors] = {216, 20, 12, 16, - 18, 72, 20, 20, - 22, 20, 2, 1, - 6, 1, 1, 1, - 3}; - const Float_t kDetectorLDCs[kNDetectors] = {46, 2, 2, 1, - 4, 2, 1, 2, - 1, 2, 1, 1, - 1, 0.5, 0.5, 1, - 1}; - char* path = gSystem->Which(gSystem->Getenv("PATH"), "dateStream"); if (!path) { AliError("the program dateStream was not found"); @@ -684,7 +1090,7 @@ Bool_t AliSimulation::ConvertRawFilesToDate(const char* dateFileName) AliInfo(Form("converting raw data DDL files to DATE file %s", dateFileName)); char command[256]; - sprintf(command, "dateStream -o %s -# %d -C", + sprintf(command, "dateStream -D -o %s -# %d -C", dateFileName, runLoader->GetNumberOfEvents()); FILE* pipe = gSystem->OpenPipe(command, "w"); @@ -736,6 +1142,7 @@ Bool_t AliSimulation::ConvertDateToRoot(const char* dateFileName, // ALIMDC setup const Int_t kDBSize = 1000000000; + const Int_t kTagDBSize = 1000000000; const Bool_t kFilter = kFALSE; const Int_t kCompression = 1; @@ -750,16 +1157,38 @@ Bool_t AliSimulation::ConvertDateToRoot(const char* dateFileName, AliInfo(Form("converting DATE file %s to root file %s", dateFileName, rootFileName)); - gSystem->Exec("rm -rf /tmp/mdc1"); - gSystem->Exec("rm -rf /tmp/mdc2"); - char command[256]; - sprintf(command, "alimdc %d %d %d %s", - kDBSize, kFilter, kCompression, dateFileName); - Int_t result = gSystem->Exec(command); - sprintf(command, "mv /tmp/mdc1/*.root %s", rootFileName); - gSystem->Exec(command); - gSystem->Exec("rm -rf /tmp/mdc1"); - gSystem->Exec("rm -rf /tmp/mdc2"); + const char* rawDBFS[2] = { "/tmp/mdc1", "/tmp/mdc2" }; + const char* tagDBFS = "/tmp/mdc1/tags"; + const char* runDBFS = "/tmp/mdc1/meta"; + + // User defined file system locations + if (gSystem->Getenv("ALIMDC_RAWDB1")) + rawDBFS[0] = gSystem->Getenv("ALIMDC_RAWDB1"); + if (gSystem->Getenv("ALIMDC_RAWDB2")) + rawDBFS[1] = gSystem->Getenv("ALIMDC_RAWDB2"); + if (gSystem->Getenv("ALIMDC_TAGDB")) + tagDBFS = gSystem->Getenv("ALIMDC_TAGDB"); + if (gSystem->Getenv("ALIMDC_RUNDB")) + runDBFS = gSystem->Getenv("ALIMDC_RUNDB"); + + gSystem->Exec(Form("rm -rf %s",rawDBFS[0])); + gSystem->Exec(Form("rm -rf %s",rawDBFS[1])); + gSystem->Exec(Form("rm -rf %s",tagDBFS)); + gSystem->Exec(Form("rm -rf %s",runDBFS)); + + gSystem->Exec(Form("mkdir %s",rawDBFS[0])); + gSystem->Exec(Form("mkdir %s",rawDBFS[1])); + gSystem->Exec(Form("mkdir %s",tagDBFS)); + gSystem->Exec(Form("mkdir %s",runDBFS)); + + Int_t result = gSystem->Exec(Form("alimdc %d %d %d %d %s", + kDBSize, kTagDBSize, kFilter, kCompression, dateFileName)); + gSystem->Exec(Form("mv %s/*.root %s", rawDBFS[0], rootFileName)); + + gSystem->Exec(Form("rm -rf %s",rawDBFS[0])); + gSystem->Exec(Form("rm -rf %s",rawDBFS[1])); + gSystem->Exec(Form("rm -rf %s",tagDBFS)); + gSystem->Exec(Form("rm -rf %s",runDBFS)); return (result == 0); }