AD module
[u/mrichter/AliRoot.git] / VZERO / MakeVZEROZeroMisAlignment.C
CommitLineData
d3a9c52a 1void MakeVZEROZeroMisAlignment(){
2 // Create TClonesArray of zero misalignment objects for VZERO
3 //
6fce62af 4 const char* macroname = "MakeVZEROZeroMisAlignment.C";
d3a9c52a 5
90dbf5fb 6 TClonesArray *array = new TClonesArray("AliAlignObjParams",10);
d3a9c52a 7 TClonesArray &alobj = *array;
8
d3a9c52a 9 Double_t dx, dy, dz, dpsi, dtheta, dphi;
10
11 Int_t iIndex=0;
ae079791 12 AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
13 UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);
d3a9c52a 14
15 TString V0right("VZERO/V0C");
90dbf5fb 16 new(alobj[0]) AliAlignObjParams(V0right.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
d3a9c52a 17 TString V0left("VZERO/V0A");
90dbf5fb 18 new(alobj[1]) AliAlignObjParams(V0left.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi,kTRUE);
d3a9c52a 19
a24be56b 20 if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
d3a9c52a 21 // save on file
dfe9c69d 22 const char* filename = "VZEROzeroMisalignment.root";
23 TFile f(filename,"RECREATE");
24 if(!f){
25 Error(macroname,"cannot open file for output\n");
26 return;
27 }
28 Info(macroname,"Saving alignment objects to the file %s", filename);
d3a9c52a 29 f.cd();
dfe9c69d 30 f.WriteObject(array,"VZEROAlignObjs","kSingleKey");
d3a9c52a 31 f.Close();
32 }else{
33 // save in CDB storage
dfe9c69d 34 TString Storage = gSystem->Getenv("STORAGE");
35 if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
36 Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
37 return;
38 }
39 Info(macroname,"Saving alignment objects in CDB storage %s",
40 Storage.Data());
d3a9c52a 41 AliCDBManager* cdb = AliCDBManager::Instance();
dfe9c69d 42 AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
43 if(!storage){
44 Error(macroname,"Unable to open storage %s\n",Storage.Data());
45 return;
46 }
d3a9c52a 47 AliCDBMetaData* md = new AliCDBMetaData();
48 md->SetResponsible("Brigitte Cheynis");
49 md->SetComment("Alignment objects for V0 zero-misalignment");
5bd470e1 50 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
dfe9c69d 51 AliCDBId id("VZERO/Align/Data",0,AliCDBRunRange::Infinity());
d3a9c52a 52 storage->Put(array,id,md);
53 }
54
55 array->Delete();
56
57}
58