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