macro for reading RAWDDL data
[u/mrichter/AliRoot.git] / TRD / MakeTRDResMisAlignment.C
CommitLineData
1895a097 1void MakeTRDResMisAlignment(){
2 // Create TClonesArray of residual misalignment objects for TRD
3 //
4 TClonesArray *array = new TClonesArray("AliAlignObjAngles",1000);
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
1895a097 12 // sigmas for the chambers
13 Double_t chdx=0.02; // 200 microns
14 Double_t chdy=0.03; // 300 microns
15 Double_t chdz=0.07; // 700 microns
16 Double_t chrx=0.3/1000/TMath::Pi()*180; // 0.3 mrad
17 Double_t chry=0.3/1000/TMath::Pi()*180; // 0.3 mrad
18 Double_t chrz=0.1/1000/TMath::Pi()*180; // 0.1 mrad
19
20 Double_t dx,dy,dz,rx,ry,rz;
21
22 Int_t j=0;
23 TRandom *ran = new TRandom(4357);
24 UShort_t volid;
25 const char *path;
26
1895a097 27 // create the chambers' alignment objects
28 for (Int_t iLayer = AliAlignObj::kTRD1; iLayer <= AliAlignObj::kTRD6; iLayer++) {
29 for (Int_t iModule = 0; iModule < AliAlignObj::LayerSize(iLayer); iModule++) {
30 ran.Rannor(dx,rx);
31 ran.Rannor(dy,ry);
32 ran.Rannor(dz,rz);
33 dx*=chdx;
34 dy*=chdy;
35 dz*=chdz;
36 rx*=chrx;
37 ry*=chry;
38 rz*=chrz;
39 volid = AliAlignObj::LayerToVolUID(iLayer,iModule);
7e154d52 40 symname = AliAlignObj::SymName(volid);
41 new(alobj[j++]) AliAlignObjAngles(symname,volid,dx,dy,dz,rx,ry,rz,kFALSE);
1895a097 42 }
43 }
44
45 if(!gSystem->Getenv("$TOCDB")){
46 // save on file
47 TFile f("TRDresidualMisalignment.root","RECREATE");
48 if(!f) cerr<<"cannot open file for output\n";
49 f.cd();
50 f.WriteObject(array,"TRDAlignObjs","kSingleKey");
51 f.Close();
52 }else{
53 // save in CDB storage
54 const char* Storage = gSystem->Getenv("$STORAGE");
55 AliCDBManager* cdb = AliCDBManager::Instance();
56 AliCDBStorage* storage = cdb->GetStorage(Storage);
57 AliCDBMetaData* md = new AliCDBMetaData();
58 md->SetResponsible("Dariusz Miskowiec");
59 md->SetComment("Residual misalignment for TRD");
60 md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
61 AliCDBId id("TRD/Align/Data",0,9999999);
62 storage->Put(array,id,md);
63 }
64
65 array->Delete();
66
67}
68
69