]> git.uio.no Git - u/mrichter/AliRoot.git/blob - T0/MakeT0ZeroMisAlignment.C
AliAlignObjAngles becomes AliAlignObjParams (Raffaele)
[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",10);
5   TClonesArray &alobj = *array;
6
7   AliAlignObjParams a;
8
9   Double_t dx=0, dy=0, dz=0, dpsi=0, dtheta=0, dphi=0;
10
11   TString symName, sn;
12
13   Int_t iIndex=0;
14   AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
15   UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);
16
17   Int_t j=0;
18   for (Int_t imod=0; imod<24; imod++)
19     {
20       if (imod < 12){
21         sn="T0/C/PMT";
22       }else{
23         sn="T0/A/PMT";
24       }
25       symName = sn;
26       symName += imod+1;
27
28       new(alobj[j++]) AliAlignObjParams(symName.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
29     }
30
31   const char* macroname = "MakeT0ZeroMisAlignment.C";
32   if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
33     // save on file
34     const char* filename = "T0zeroMisalignment.root";
35     TFile f(filename,"RECREATE");
36     if(!f){
37       Error(macroname,"cannot open file for output\n");
38       return;
39     }
40     Info(macroname,"Saving alignment objects to the file %s", filename);
41     f.cd();
42     f.WriteObject(array,"T0AlignObjs","kSingleKey");
43     f.Close();
44   }else{
45     // save in CDB storage
46     TString Storage = gSystem->Getenv("STORAGE");
47     if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
48       Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
49       return;
50     }
51     Info(macroname,"Saving alignment objects in CDB storage %s",
52          Storage.Data());
53     AliCDBManager* cdb = AliCDBManager::Instance();
54     AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
55     if(!storage){
56       Error(macroname,"Unable to open storage %s\n",Storage.Data());
57       return;
58     }
59     AliCDBMetaData* md = new AliCDBMetaData();
60     md->SetResponsible("Tomasz Malkiewicz");
61     md->SetComment("Zero misalignment for T0, produced with sigmatr=0.05 and sigmarot=0.3 in the local RS");
62     md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
63     AliCDBId id("T0/Align/Data",0,AliCDBRunRange::Infinity());
64     storage->Put(array,id,md);
65   }
66
67   array->Delete();
68
69 }
70