]>
Commit | Line | Data |
---|---|---|
68711871 | 1 | void MakeEMCALFullMisAlignment(TString geoname = "EMCAL_FIRSTYEAR",TString surveyFilename = "emcal_survey_edms1014917.txt"){ |
1895a097 | 2 | // Create TClonesArray of full misalignment objects for EMCAL |
3 | // | |
6fce62af | 4 | const char* macroname = "MakeEMCALFullMisAlignment.C"; |
1e4f558f | 5 | if(geoname=="")geoname=AliEMCALGeometry::GetDefaultGeometryName(); |
6 | const AliEMCALGeometry *emcalGeom = AliEMCALGeometry::GetInstance(geoname,""); | |
289cc8a7 | 7 | if(!emcalGeom) { |
8 | Error("MakeEMCALFullMisAlignment","Cannot obtain AliEMCALGeometry singleton\n"); | |
9 | return; | |
10 | } | |
11 | TClonesArray *array = new TClonesArray("AliAlignObjParams",emcalGeom->GetNumberOfSuperModules()); | |
12 | TClonesArray &alobj = *array; | |
1895a097 | 13 | |
6fce62af | 14 | // Activate CDB storage and load geometry from CDB |
15 | AliCDBManager* cdb = AliCDBManager::Instance(); | |
162637e4 | 16 | if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); |
6fce62af | 17 | cdb->SetRun(0); |
18 | ||
19 | AliCDBStorage* storage; | |
20 | ||
a24be56b | 21 | if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){ |
6fce62af | 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()); | |
25 | return; | |
26 | } | |
27 | storage = cdb->GetStorage(Storage.Data()); | |
28 | if(!storage){ | |
29 | Error(macroname,"Unable to open storage %s\n",Storage.Data()); | |
30 | return; | |
31 | } | |
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!"); | |
35 | entry->SetOwner(0); | |
36 | TGeoManager* geom = (TGeoManager*) entry->GetObject(); | |
37 | AliGeomManager::SetGeometry(geom); | |
38 | }else{ | |
289cc8a7 | 39 | AliGeomManager::LoadGeometry(); //load geom from default CDB |
40 | //storage | |
6fce62af | 41 | } |
1895a097 | 42 | |
1895a097 | 43 | |
68711871 | 44 | AliEMCALSurvey emcalSurvey(surveyFilename); |
289cc8a7 | 45 | emcalSurvey.CreateAliAlignObjParams(alobj); |
1895a097 | 46 | |
289cc8a7 | 47 | // ************************* 2nd step *************** |
1895a097 | 48 | |
a24be56b | 49 | if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ |
1895a097 | 50 | // save on file |
dfe9c69d | 51 | const char* filename = "EMCALfullMisalignment.root"; |
52 | TFile f(filename,"RECREATE"); | |
53 | if(!f){ | |
54 | Error(macroname,"cannot open file for output\n"); | |
55 | return; | |
56 | } | |
57 | Info(macroname,"Saving alignment objects to the file %s", filename); | |
1895a097 | 58 | f.cd(); |
dfe9c69d | 59 | f.WriteObject(array,"EMCALAlignObjs","kSingleKey"); |
1895a097 | 60 | f.Close(); |
61 | }else{ | |
62 | // save in CDB storage | |
1895a097 | 63 | AliCDBMetaData* md = new AliCDBMetaData(); |
289cc8a7 | 64 | md->SetResponsible("Jennifer Klay"); |
1895a097 | 65 | md->SetComment("Full misalignment for EMCAL"); |
5bd470e1 | 66 | md->SetAliRootVersion(gSystem->Getenv("ARVERSION")); |
dfe9c69d | 67 | AliCDBId id("EMCAL/Align/Data",0,AliCDBRunRange::Infinity()); |
1895a097 | 68 | storage->Put(array,id,md); |
69 | } | |
70 | ||
71 | array->Delete(); | |
72 | ||
73 | } | |
74 |