1 void MakeEMCALFullMisAlignment(){
2 // Create TClonesArray of full misalignment objects for EMCAL
4 const char* macroname = "MakeEMCALFullMisAlignment.C";
5 const AliEMCALGeometry *emcalGeom = AliEMCALGeometry::GetInstance(AliEMCALGeometry::GetDefaultGeometryName(),"");
7 Error("MakeEMCALFullMisAlignment","Cannot obtain AliEMCALGeometry singleton\n");
10 TClonesArray *array = new TClonesArray("AliAlignObjParams",emcalGeom->GetNumberOfSuperModules());
11 TClonesArray &alobj = *array;
13 // Activate CDB storage and load geometry from CDB
14 AliCDBManager* cdb = AliCDBManager::Instance();
15 if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT");
18 AliCDBStorage* storage;
20 if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){
21 TString Storage = gSystem->Getenv("STORAGE");
22 if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
23 Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
26 storage = cdb->GetStorage(Storage.Data());
28 Error(macroname,"Unable to open storage %s\n",Storage.Data());
31 AliCDBPath path("GRP","Geometry","Data");
32 AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
33 if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");
35 TGeoManager* geom = (TGeoManager*) entry->GetObject();
36 AliGeomManager::SetGeometry(geom);
38 AliGeomManager::LoadGeometry(); //load geom from default CDB
43 AliEMCALSurvey emcalSurvey("emcal_survey_data.txt");
44 emcalSurvey.CreateAliAlignObjParams(alobj);
46 // ************************* 2nd step ***************
48 if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
50 const char* filename = "EMCALfullMisalignment.root";
51 TFile f(filename,"RECREATE");
53 Error(macroname,"cannot open file for output\n");
56 Info(macroname,"Saving alignment objects to the file %s", filename);
58 f.WriteObject(array,"EMCALAlignObjs","kSingleKey");
61 // save in CDB storage
62 AliCDBMetaData* md = new AliCDBMetaData();
63 md->SetResponsible("Jennifer Klay");
64 md->SetComment("Full misalignment for EMCAL");
65 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
66 AliCDBId id("EMCAL/Align/Data",0,AliCDBRunRange::Infinity());
67 storage->Put(array,id,md);