Updated histogram limits (PHOS energy)
[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
d3a9c52a 9 Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.;
10 Int_t j = 0;
11
12 // RS = local
ae079791 13 for (Int_t iLayer = AliGeomManager::kTPC1; iLayer <= AliGeomManager::kTPC2; iLayer++) {
14 for (Int_t iModule = 0; iModule < AliGeomManager::LayerSize(iLayer); iModule++) {
d3a9c52a 15
ae079791 16 UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iModule);
17 const char *symname = AliGeomManager::SymName(volid);
90dbf5fb 18 new(alobj[j]) AliAlignObjParams(symname, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
d3a9c52a 19 j++;
20 }
21 }
22
a24be56b 23 if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
d3a9c52a 24 // save on file
dfe9c69d 25 const char* filename = "TPCzeroMisalignment.root";
26 TFile f(filename,"RECREATE");
27 if(!f){
28 Error(macroname,"cannot open file for output\n");
29 return;
30 }
31 Info(macroname,"Saving alignment objects to the file %s", filename);
d3a9c52a 32 f.cd();
33 f.WriteObject(array,"TPCAlignObjs","kSingleKey");
34 f.Close();
35 }else{
36 // save in CDB storage
dfe9c69d 37 TString Storage = gSystem->Getenv("STORAGE");
38 if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
39 Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
40 return;
41 }
42 Info(macroname,"Saving alignment objects in CDB storage %s",
43 Storage.Data());
d3a9c52a 44 AliCDBManager* cdb = AliCDBManager::Instance();
dfe9c69d 45 AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
46 if(!storage){
47 Error(macroname,"Unable to open storage %s\n",Storage.Data());
48 return;
49 }
d3a9c52a 50 AliCDBMetaData* md = new AliCDBMetaData();
51 md->SetResponsible("Marian Ivanov");
52 md->SetComment("Zero misalignment for TPC");
5bd470e1 53 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
dfe9c69d 54 AliCDBId id("TPC/Align/Data",0,AliCDBRunRange::Infinity());
d3a9c52a 55 storage->Put(array,id,md);
56 }
57
58 array->Delete();
59
60}
61