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