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