1 void MakeTOFResMisAlignment(){
2 // Create TClonesArray of residual misalignment objects for TOF
4 TClonesArray *array = new TClonesArray("AliAlignObjAngles",2000);
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 AliGeomManager::ELayerID idTOF = AliGeomManager::kTOF;
23 Double_t dpsi, dtheta, dphi;
24 TRandom *rnd = new TRandom(4357);
25 Double_t sigmatr = 0.1; // max shift in cm w.r.t. local ideal RS
27 for(i=0; i<AliGeomManager::LayerSize(idTOF); i++) {
29 dy = rnd->Gaus(0.,sigmatr);
30 dz = rnd->Gaus(0.,sigmatr);
34 new(alobj[j]) AliAlignObjAngles(AliGeomManager::SymName(idTOF,i), AliGeomManager::LayerToVolUID(idTOF,i), dx, dy, dz, dpsi, dtheta, dphi, kFALSE);
38 const char* macroname = "MakeTOFResMisAlignment.C";
39 if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
41 const char* filename = "TOFresidualMisalignment.root";
42 TFile f(filename,"RECREATE");
44 Error(macroname,"cannot open file for output\n");
47 Info(macroname,"Saving alignment objects to the file %s", filename);
49 f.WriteObject(array,"TOFAlignObjs","kSingleKey");
52 // save in CDB storage
53 TString Storage = gSystem->Getenv("STORAGE");
54 if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
55 Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
58 Info(macroname,"Saving alignment objects in CDB storage %s",
60 AliCDBManager* cdb = AliCDBManager::Instance();
61 AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
63 Error(macroname,"Unable to open storage %s\n",Storage.Data());
66 AliCDBMetaData* md = new AliCDBMetaData();
67 md->SetResponsible("Silvia Arcelli");
68 md->SetComment("Residual misalignment for TOF, sigmatr=1mm in the local RS");
69 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
70 AliCDBId id("TOF/Align/Data",0,AliCDBRunRange::Infinity());
71 storage->Put(array,id,md);