Fix by Ruben
[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
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";
1895a097 16
17 Int_t iIndex=0; //let all modules have index=0 in a layer with no LUT
ae079791 18 AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
19 UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);
1895a097 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);
1895a097 25
a24be56b 26 if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
1895a097 27 // save in file
dfe9c69d 28 const char* filename = "ZDCfullMisalignment.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);
1895a097 35 f.cd();
dfe9c69d 36 f.WriteObject(array,"ZDCAlignObjs","kSingleKey");
1895a097 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());
1895a097 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 }
1895a097 53 AliCDBMetaData* md = new AliCDBMetaData();
54 md->SetResponsible("Chiara Oppedisano");
55 md->SetComment("Alignment objects for ZDC full misalignment");
5bd470e1 56 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
dfe9c69d 57 AliCDBId id("ZDC/Align/Data",0,AliCDBRunRange::Infinity());
1895a097 58 storage->Put(array,id,md);
59 }
60
61 array->Delete();
62
63}
64