Macros for residual and full misalignment, collected by Raffaele
[u/mrichter/AliRoot.git] / TPC / MakeTPCFullMisAlignment.C
CommitLineData
1895a097 1void MakeTPCFullMisAlignment(){
2 // Create TClonesArray of full misalignment objects for TPC
3 //
4 if(!gGeoManager) TGeoManager::Import("geometry.root");
5 // needed for the constructors with local coordinates not to fail
6
7 TClonesArray *array = new TClonesArray("AliAlignObjAngles",100);
8 TClonesArray &alobj = *array;
9
10 TRandom *rnd = new TRandom(4357);
11 AliAlignObjAngles o;
12 Int_t j = 0;
13 // RS = local
14 // sigma translation = 1mm
15 // sigma rotation = 1mrad
16 Float_t sigmatr=0.01;
17 Float_t sigmarot = 0.06;
18 for (Int_t iLayer = AliAlignObj::kTPC1; iLayer <= AliAlignObj::kTPC2; iLayer++) {
19 for (Int_t iModule = 0; iModule < AliAlignObj::LayerSize(iLayer); iModule++) {
20
21 Float_t dx = (rnd->Uniform()-0.5)*sigmatr;
22 Float_t dy = (rnd->Uniform()-0.5)*sigmatr;
23 Float_t dz = (rnd->Uniform()-0.5)*sigmatr;
24 Float_t dpsi = (rnd->Uniform()-0.5)*sigmarot;
25 Float_t dtheta = (rnd->Uniform()-0.5)*sigmarot;
26 Float_t dphi = (rnd->Uniform()-0.5)*sigmarot;
27
28 UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iModule);
29 const char *path = AliAlignObj::SymName(volid);
30 new(alobj[j]) AliAlignObjAngles(path, volid, dx, dy, dz, dpsi, dtheta, dphi, kFALSE);
31 j++;
32 }
33 }
34
35
36 if(!gSystem->Getenv("$TOCDB")){
37 // save on file
38 TFile f("TPCfullMisalignment.root","RECREATE");
39 if(!f) cerr<<"cannot open file for output\n";
40 f.cd();
41 f.WriteObject(array,"TPCAlignObjs","kSingleKey");
42 f.Close();
43 }else{
44 // save in CDB storage
45 const char* Storage = gSystem->Getenv("$STORAGE");
46 AliCDBManager* cdb = AliCDBManager::Instance();
47 AliCDBStorage* storage = cdb->GetStorage(Storage);
48 AliCDBMetaData* md = new AliCDBMetaData();
49 md->SetResponsible("Marian Ivanov");
50 md->SetComment("Full misalignment for TPC, sigmatr=0.01 and sigmarot=0.6 in the local RS");
51 md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
52 AliCDBId id("TPC/Align/Data",0,9999999);
53 storage->Put(array,id,md);
54 }
55
56 array->Delete();
57
58}
59