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