]> git.uio.no Git - u/mrichter/AliRoot.git/blob - T0/MakeT0ResMisAlignment.C
New version of SPD raw-data reconstruction. The format now correponds to the actual...
[u/mrichter/AliRoot.git] / T0 / MakeT0ResMisAlignment.C
1 void MakeT0ResMisAlignment(){
2   // Create TClonesArray of residual misalignment objects for T0
3   //
4   TClonesArray *array = new TClonesArray("AliAlignObjAngles",10);
5   TClonesArray &alobj = *array;
6
7   if(!gGeoManager) TGeoManager::Import("geometry.root");
8   // needed for the constructors with local coordinates not to fail
9
10   AliAlignObjAngles a;
11
12   Double_t dx, dy, dz, dpsi, dtheta, dphi;
13   TRandom *rnd   = new TRandom(4321);
14   Double_t sigmatr = 0.05; // max shift in cm
15   Double_t sigmarot = 0.3; // max rot in degrees
16
17   const char *T0right="/ALIC_1/0STR_1";
18   const char *T0left="/ALIC_1/0STL_1";
19
20   Int_t iIndex=0;
21   AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer;
22   UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iIndex);
23
24   dx = rnd->Gaus(0.,sigmatr);
25   dy = rnd->Gaus(0.,sigmatr);
26   dz = rnd->Gaus(0.,sigmatr);
27   dpsi = rnd->Gaus(0.,sigmarot);
28   dtheta = rnd->Gaus(0.,sigmarot);
29   dphi = rnd->Gaus(0.,sigmarot);
30   cout<<dx<<"  "<<dy<<"  "<<dz<<"  "<<dpsi<<"  "<<dtheta<<"  "<<dphi<<"\n";
31   new(alobj[0]) AliAlignObjAngles(T0right, volid, dx, dy, dz, dpsi, dtheta, dphi, kFALSE);
32   dx = rnd->Gaus(0.,sigmatr);
33   dy = rnd->Gaus(0.,sigmatr);
34   dz = rnd->Gaus(0.,sigmatr);
35   dpsi = rnd->Gaus(0.,sigmarot);
36   dtheta = rnd->Gaus(0.,sigmarot);
37   dphi = rnd->Gaus(0.,sigmarot);
38   cout<<dx<<"  "<<dy<<"  "<<dz<<"  "<<dpsi<<"  "<<dtheta<<"  "<<dphi<<"\n";
39   new(alobj[1]) AliAlignObjAngles(T0left, volid, dx, dy, dz, dpsi, dtheta, dphi, kFALSE);
40
41   if(!gSystem->Getenv("$TOCDB")){
42     // save on file
43     TFile f("T0residualMisalignment.root","RECREATE");
44     if(!f) cerr<<"cannot open file for output\n";
45     f.cd();
46     f.WriteObject(array,"T0ResidualObjs ","kSingleKey");
47     f.Close();
48   }else{
49     // save in CDB storage
50     const char* Storage = gSystem->Getenv("$STORAGE");
51     AliCDBManager* cdb = AliCDBManager::Instance();
52     AliCDBStorage* storage = cdb->GetStorage(Storage);
53     AliCDBMetaData* md = new AliCDBMetaData();
54     md->SetResponsible("Tomasz Malkiewicz");
55     md->SetComment("Residual 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,9999999);
58     storage->Put(array,id,md);
59   }
60
61   array->Delete();
62
63 }
64