1 enum SurveyDataType_t { kSurvey = 0, kDummy = 1};
3 void MakeEMCALFullMisAlignment(TString geoname = "EMCAL_FIRSTYEARv1",TString surveyFilename = "emcal_survey_FIRSTYEARv1.txt",SurveyDataType_t type = kSurvey){
4 // Create TClonesArray of full misalignment objects for EMCAL
6 const char* macroname = "MakeEMCALFullMisAlignment.C";
7 if(geoname=="")geoname=AliEMCALGeometry::GetDefaultGeometryName();
8 const AliEMCALGeometry *emcalGeom = AliEMCALGeometry::GetInstance(geoname,"");
10 Error("MakeEMCALFullMisAlignment","Cannot obtain AliEMCALGeometry singleton\n");
13 TClonesArray *array = new TClonesArray("AliAlignObjParams",emcalGeom->GetNumberOfSuperModules());
14 TClonesArray &alobj = *array;
16 // Activate CDB storage and load geometry from CDB
17 AliCDBManager* cdb = AliCDBManager::Instance();
18 if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
21 AliCDBStorage* storage;
23 if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){
24 TString Storage = gSystem->Getenv("STORAGE");
25 if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
26 Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
29 storage = cdb->GetStorage(Storage.Data());
31 Error(macroname,"Unable to open storage %s\n",Storage.Data());
34 AliCDBPath path("GRP","Geometry","Data");
35 AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
36 if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");
38 TGeoManager* geom = (TGeoManager*) entry->GetObject();
39 AliGeomManager::SetGeometry(geom);
41 AliGeomManager::LoadGeometry(); //load geom from default CDB
46 AliEMCALSurvey emcalSurvey(surveyFilename,type);
47 emcalSurvey.CreateAliAlignObjParams(alobj);
49 // ************************* 2nd step ***************
51 if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
53 const char* filename = "EMCALfullMisalignment.root";
54 TFile f(filename,"RECREATE");
56 Error(macroname,"cannot open file for output\n");
59 Info(macroname,"Saving alignment objects to the file %s", filename);
61 f.WriteObject(array,"EMCALAlignObjs","kSingleKey");
64 // save in CDB storage
65 AliCDBMetaData* md = new AliCDBMetaData();
66 md->SetResponsible("Jennifer Klay");
67 md->SetComment("Full misalignment for EMCAL_FIRSTYEAR based on survey information");
68 md->AddDateToComment();
69 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
70 AliCDBId id("EMCAL/Align/Data",0,AliCDBRunRange::Infinity());
71 storage->Put(array,id,md);