1 void MakeTPCResMisAlignment(){
2 // Create TClonesArray of residual misalignment objects for TPC
4 if(!gGeoManager) TGeoManager::Import("geometry.root");
5 // needed for the constructors with local coordinates not to fail
7 TClonesArray *array = new TClonesArray("AliAlignObjAngles",100);
8 TClonesArray &alobj = *array;
10 TRandom *rnd = new TRandom(4357);
12 Double_t dx, dy, dz, dpsi, dtheta, dphi;
16 // sigma translation = 0.1 mm
17 // sigma rotation = 0.1 mrad
19 Float_t sigmarot = 0.006;
20 for (Int_t iLayer = AliAlignObj::kTPC1; iLayer <= AliAlignObj::kTPC2; iLayer++) {
21 for (Int_t iModule = 0; iModule < AliAlignObj::LayerSize(iLayer); iModule++) {
23 dx = rnd->Gaus(0,sigmatr);
24 dy = rnd->Gaus(0,sigmatr);
25 dz = rnd->Gaus(0,sigmatr);
26 dpsi = rnd->Gaus(0,sigmarot);
27 dtheta = rnd->Gaus(0,sigmarot);
28 dphi = rnd->Gaus(0,sigmarot);
30 UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iModule);
31 const char *symname = AliAlignObj::SymName(volid);
32 new(alobj[j]) AliAlignObjAngles(symname, volid, dx, dy, dz, dpsi, dtheta, dphi, kFALSE);
38 if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
40 TFile f("TPCresidualMisalignment.root","RECREATE");
41 if(!f) cerr<<"cannot open file for output\n";
43 f.WriteObject(array,"TPCAlignObjs","kSingleKey");
46 // save in CDB storage
47 const char* Storage = gSystem->Getenv("STORAGE");
48 AliCDBManager* cdb = AliCDBManager::Instance();
49 AliCDBStorage* storage = cdb->GetStorage(Storage);
50 AliCDBMetaData* md = new AliCDBMetaData();
51 md->SetResponsible("Marian Ivanov");
52 md->SetComment("Residual misalignment for TPC, sigmatr=0.01 and sigmarot=0.6 in the local RS");
53 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
54 AliCDBId id("TPC/Align/Data",0,9999999);
55 storage->Put(array,id,md);