Changes needed for big distortions.
[u/mrichter/AliRoot.git] / TPC / MakeTPCZeroMisAlignment.C
CommitLineData
d3a9c52a 1void MakeTPCZeroMisAlignment(){
2 // Create TClonesArray of zero misalignment objects for TPC
3 //
6fce62af 4 const char* macroname = "MakeTPCZeroMisAlignment.C";
d3a9c52a 5
90dbf5fb 6 TClonesArray *array = new TClonesArray("AliAlignObjParams",100);
d3a9c52a 7 TClonesArray &alobj = *array;
8
28377a52 9 // Activate CDB storage and load geometry from CDB
10 AliCDBManager* cdb = AliCDBManager::Instance();
162637e4 11 if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
28377a52 12 cdb->SetRun(0);
13
14 AliCDBStorage* storage = NULL;
15
16 if(TString(gSystem->Getenv("TOCDB")) == TString("kTRUE")){
17 TString Storage = gSystem->Getenv("STORAGE");
18 if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
19 Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
20 return;
21 }
22 storage = cdb->GetStorage(Storage.Data());
23 if(!storage){
24 Error(macroname,"Unable to open storage %s\n",Storage.Data());
25 return;
26 }
27 AliCDBPath path("GRP","Geometry","Data");
28 AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
29 if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");
30 entry->SetOwner(0);
31 TGeoManager* geom = (TGeoManager*) entry->GetObject();
32 AliGeomManager::SetGeometry(geom);
33 }else{
34 AliGeomManager::LoadGeometry("geometry.root"); //load geom from default CDB storage
35 }
36
37 Double_t dx=-0.159, dy=-0.05, dz=0.034, dpsi=-0.00183, dtheta=0.01835, dphi=0.02865;
d3a9c52a 38 Int_t j = 0;
39
28377a52 40 new(alobj[j++]) AliAlignObjParams("ALIC_1/TPC_M_1", 0, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
41
d3a9c52a 42 // RS = local
28377a52 43 dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.;
ae079791 44 for (Int_t iLayer = AliGeomManager::kTPC1; iLayer <= AliGeomManager::kTPC2; iLayer++) {
45 for (Int_t iModule = 0; iModule < AliGeomManager::LayerSize(iLayer); iModule++) {
d3a9c52a 46
ae079791 47 UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iModule);
48 const char *symname = AliGeomManager::SymName(volid);
28377a52 49 new(alobj[j++]) AliAlignObjParams(symname, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
d3a9c52a 50 }
51 }
52
a24be56b 53 if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
d3a9c52a 54 // save on file
dfe9c69d 55 const char* filename = "TPCzeroMisalignment.root";
56 TFile f(filename,"RECREATE");
57 if(!f){
58 Error(macroname,"cannot open file for output\n");
59 return;
60 }
61 Info(macroname,"Saving alignment objects to the file %s", filename);
d3a9c52a 62 f.cd();
63 f.WriteObject(array,"TPCAlignObjs","kSingleKey");
64 f.Close();
65 }else{
66 // save in CDB storage
dfe9c69d 67 Info(macroname,"Saving alignment objects in CDB storage %s",
68 Storage.Data());
d3a9c52a 69 AliCDBMetaData* md = new AliCDBMetaData();
70 md->SetResponsible("Marian Ivanov");
71 md->SetComment("Zero misalignment for TPC");
5bd470e1 72 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
dfe9c69d 73 AliCDBId id("TPC/Align/Data",0,AliCDBRunRange::Infinity());
d3a9c52a 74 storage->Put(array,id,md);
75 }
76
77 array->Delete();
78
79}
80