/************************************************************************** * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * * * Author: The ALICE Off-line Project. * * Contributors are mentioned in the code where appropriate. * * * * Permission to use, copy, modify and distribute this software and its * * documentation strictly for non-commercial purposes is hereby granted * * without fee, provided that the above copyright notice appears in all * * copies and that both the copyright notice and this permission notice * * appear in the supporting documentation. The authors make no claims * * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ // $Id$ // Macro for generating the zero misalignment data. // // Author: I. Hrivnacova, IPN Orsay #if !defined(__CINT__) || defined(__MAKECINT__) #include "AliMUONGeometryTransformer.h" #include "AliGeomManager.h" #include "AliCDBManager.h" #include "AliCDBStorage.h" #include "AliCDBId.h" #include #include #include #include #include #endif void MakeMUONZeroMisAlignment() { // Load geometry, if not yet loaded, if(!AliGeomManager::GetGeometry()){ if(!(AliCDBManager::Instance())->IsDefaultStorageSet()) AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT"); AliCDBManager::Instance()->SetRun(0); AliGeomManager::LoadGeometry(); } AliMUONGeometryTransformer transformer; transformer.LoadGeometryData(); TClonesArray* array = transformer.CreateZeroAlignmentData();; const char* macroname = "MakeMUONZeroMisAlignment.C"; if ( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ) { // Create a file to store the alignment data const char* filename = "MUONZeroMisalignment.root"; TFile f(filename,"RECREATE"); if(!f){ Error(macroname,"cannot open file for output\n"); return; } Info(macroname,"Saving alignment objects to the file %s", filename); f.cd(); f.WriteObject(array,"MUONAlignObjs","kSingleKey"); f.Close(); } else { // save in CDB storage TString Storage = gSystem->Getenv("STORAGE"); if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) { Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data()); return; } Info(macroname,"Saving alignment objects in CDB storage %s", Storage.Data()); AliCDBManager* cdb = AliCDBManager::Instance(); AliCDBStorage* storage = cdb->GetStorage(Storage.Data()); if(!storage){ Error(macroname,"Unable to open storage %s\n",Storage.Data()); return; } AliCDBMetaData* cdbData = new AliCDBMetaData(); cdbData->SetResponsible("Dimuon Offline project"); cdbData->SetComment("MUON alignment objects with zero misalignment"); cdbData->SetAliRootVersion(gSystem->Getenv("ARVERSION")); AliCDBId id("MUON/Align/Data", 0, AliCDBRunRange::Infinity()); storage->Put(array, id, cdbData); } }