1 void MakeT0ResMisAlignment(){
2 // Create TClonesArray of residual misalignment objects for T0
4 TClonesArray *array = new TClonesArray("AliAlignObjAngles",30);
5 TClonesArray &alobj = *array;
7 if(!AliGeomManager::GetGeometry()){
8 if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
9 AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
10 AliCDBManager::Instance()->SetRun(0);
11 AliGeomManager::LoadGeometry();
13 // needed for the constructors with local coordinates not to fail
17 Double_t dx, dy, dz, dpsi, dtheta, dphi;
18 TRandom *rnd = new TRandom(4321);
19 Double_t sigmatr = 0.05; // max shift in cm
20 Double_t sigmarot = 0.3; // max rot in degrees
25 AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
26 UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);
29 for (Int_t imod=0; imod<24; imod++){
38 dx = rnd->Gaus(0.,sigmatr);
39 dy = rnd->Gaus(0.,sigmatr);
40 dz = rnd->Gaus(0.,sigmatr);
41 dpsi = rnd->Gaus(0.,sigmarot);
42 dtheta = rnd->Gaus(0.,sigmarot);
43 dphi = rnd->Gaus(0.,sigmarot);
45 new(alobj[j++]) AliAlignObjAngles(symName.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
48 const char* macroname = "MakeT0ResMisAlignment.C";
49 if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
51 const char* filename = "T0residualMisalignment.root";
52 TFile f(filename,"RECREATE");
54 Error(macroname,"cannot open file for output\n");
57 Info(macroname,"Saving alignment objects to the file %s", filename);
59 f.WriteObject(array,"T0AlignObjs","kSingleKey");
62 // save in CDB storage
63 TString Storage = gSystem->Getenv("STORAGE");
64 if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
65 Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
68 Info(macroname,"Saving alignment objects in CDB storage %s",
70 AliCDBManager* cdb = AliCDBManager::Instance();
71 AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
73 Error(macroname,"Unable to open storage %s\n",Storage.Data());
76 AliCDBMetaData* md = new AliCDBMetaData();
77 md->SetResponsible("Tomasz Malkiewicz");
78 md->SetComment("Residual misalignment for T0, produced with sigmatr=0.05 and sigmarot=0.3 in the local RS");
79 md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
80 AliCDBId id("T0/Align/Data",0,AliCDBRunRange::Infinity());
81 storage->Put(array,id,md);