]> git.uio.no Git - u/mrichter/AliRoot.git/blob - T0/MakeT0ZeroMisAlignment.C
Compilation warning fixed.
[u/mrichter/AliRoot.git] / T0 / MakeT0ZeroMisAlignment.C
1 void MakeT0ZeroMisAlignment(){
2   // Create TClonesArray of zero misalignment objects for T0
3   //
4   TClonesArray *array = new TClonesArray("AliAlignObjParams",4);
5   TClonesArray &alobj = *array;
6
7   Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.;
8
9   TString symName;
10
11   Int_t iIndex=0;
12   AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
13   UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);
14
15   for (Int_t imod=0; imod<2; imod++)
16   {
17     symName="/ALIC_1/0STR_1";
18     if(imod==1) 
19     {
20       symName="/ALIC_1/0STL_1";
21     }
22     new(alobj[imod]) AliAlignObjParams(symName.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
23   }
24
25   const char* macroname = "MakeT0ZeroMisAlignment.C";
26   if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
27     // save on file
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);
35     f.cd();
36     f.WriteObject(array,"T0AlignObjs","kSingleKey");
37     f.Close();
38   }else{
39     // save in CDB storage
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());
47     AliCDBManager* cdb = AliCDBManager::Instance();
48     AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
49     if(!storage){
50       Error(macroname,"Unable to open storage %s\n",Storage.Data());
51       return;
52     }
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");
56     md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
57     AliCDBId id("T0/Align/Data",0,AliCDBRunRange::Infinity());
58     storage->Put(array,id,md);
59   }
60
61   array->Delete();
62
63 }
64