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