]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/MakeTRDFullMisAlignment.C
Macros for residual and full misalignment, collected by Raffaele
[u/mrichter/AliRoot.git] / TRD / MakeTRDFullMisAlignment.C
1 void MakeTRDFullMisAlignment(){
2   // Create TClonesArray of full 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
12   // sigmas for the chambers
13   Double_t chdx=1; // 1 cm
14   Double_t chdy=1; // 1 cm
15   Double_t chdz=1; // 1 cm
16   Double_t chrx=1.0/1000/TMath::Pi()*180; // 1 mrad
17   Double_t chry=1.0/1000/TMath::Pi()*180; // 1 mrad
18   Double_t chrz=0.7/1000/TMath::Pi()*180; // 0.7 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
27   //generate the paths for the 18 supermodules
28   Double_t r=325.;
29   Double_t phi;
30   Int_t isec;
31   TString ts0;
32   TString* sm_path = new TString[18];
33   TRegexp regexp(".*BTRD[0-9][^/]*");
34
35   // create the chambers' alignment objects
36   for (Int_t iLayer = AliAlignObj::kTRD1; iLayer <= AliAlignObj::kTRD6; iLayer++) {
37     for (Int_t iModule = 0; iModule < AliAlignObj::LayerSize(iLayer); iModule++) {
38       ran.Rannor(dx,rx);
39       ran.Rannor(dy,ry);
40       ran.Rannor(dz,rz);
41       dx*=chdx;
42       dy*=chdy;
43       dz*=chdz;
44       rx*=chrx;
45       ry*=chry;
46       rz*=chrz;
47       volid = AliAlignObj::LayerToVolUID(iLayer,iModule);
48       path = AliAlignObj::SymName(volid);
49       new(alobj[j++]) AliAlignObjAngles(path,volid,dx,dy,dz,rx,ry,rz,kFALSE);
50     }
51   }
52
53   if(!gSystem->Getenv("$TOCDB")){
54     // save on file
55     TFile f("TRDfullMisalignment.root","RECREATE");
56     if(!f) cerr<<"cannot open file for output\n";
57     f.cd();
58     f.WriteObject(array,"TRDAlignObjs","kSingleKey");
59     f.Close();
60   }else{
61     // save in CDB storage
62     const char* Storage = gSystem->Getenv("$STORAGE");
63     AliCDBManager* cdb = AliCDBManager::Instance();
64     AliCDBStorage* storage = cdb->GetStorage(Storage);
65     AliCDBMetaData* md = new AliCDBMetaData();
66     md->SetResponsible("Dariusz Miskowiec");
67     md->SetComment("Full misalignment for TRD");
68     md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
69     AliCDBId id("TRD/Align/Data",0,9999999);
70     storage->Put(array,id,md);
71   }
72
73   array->Delete();
74
75 }
76
77