Handle friend chain name in GetChainForTestMode
[u/mrichter/AliRoot.git] / T0 / MakeT0ZeroMisAlignment.C
CommitLineData
d3a9c52a 1void MakeT0ZeroMisAlignment(){
2 // Create TClonesArray of zero misalignment objects for T0
3 //
68ad88ad 4 TClonesArray *array = new TClonesArray("AliAlignObjParams",4);
d3a9c52a 5 TClonesArray &alobj = *array;
6
68ad88ad 7 Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.;
d3a9c52a 8
68ad88ad 9 TString symName;
d3a9c52a 10
11 Int_t iIndex=0;
ae079791 12 AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
13 UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);
d3a9c52a 14
68ad88ad 15 for (Int_t imod=0; imod<2; imod++)
16 {
17 symName="/ALIC_1/0STR_1";
18 if(imod==1)
d3a9c52a 19 {
68ad88ad 20 symName="/ALIC_1/0STL_1";
d3a9c52a 21 }
68ad88ad 22 new(alobj[imod]) AliAlignObjParams(symName.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
23 }
d3a9c52a 24
dfe9c69d 25 const char* macroname = "MakeT0ZeroMisAlignment.C";
26 if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
d3a9c52a 27 // save on file
dfe9c69d 28 const char* filename = "T0zeroMisalignment.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,"T0AlignObjs","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("Tomasz Malkiewicz");
55 md->SetComment("Zero misalignment for T0, produced with sigmatr=0.05 and sigmarot=0.3 in the local RS");
8d0a15a4 56 md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
dfe9c69d 57 AliCDBId id("T0/Align/Data",0,AliCDBRunRange::Infinity());
d3a9c52a 58 storage->Put(array,id,md);
59 }
60
61 array->Delete();
62
63}
64