]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/MakeTRDResMisAlignment.C
Loaders removed from the reconstruction code (C.Cheshkov)
[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
dfe9c69d 7 if(!AliGeomManager::GetGeometry()){
8 if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
9 AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
10 AliCDBManager::Instance()->SetRun(0);
11 AliGeomManager::LoadGeometry();
12 }
1895a097 13 // needed for the constructors with local coordinates not to fail
14
15 AliAlignObjAngles a;
16
1895a097 17 // sigmas for the chambers
d3a9c52a 18 Double_t chdx=0.002; // 20 microns
19 Double_t chdy=0.003; // 30 microns
20 Double_t chdz=0.007; // 70 microns
1895a097 21 Double_t chrx=0.3/1000/TMath::Pi()*180; // 0.3 mrad
22 Double_t chry=0.3/1000/TMath::Pi()*180; // 0.3 mrad
23 Double_t chrz=0.1/1000/TMath::Pi()*180; // 0.1 mrad
24
25 Double_t dx,dy,dz,rx,ry,rz;
26
27 Int_t j=0;
28 TRandom *ran = new TRandom(4357);
29 UShort_t volid;
30 const char *path;
31
1895a097 32 // create the chambers' alignment objects
ae079791 33 for (Int_t iLayer = AliGeomManager::kTRD1; iLayer <= AliGeomManager::kTRD6; iLayer++) {
34 for (Int_t iModule = 0; iModule < AliGeomManager::LayerSize(iLayer); iModule++) {
1895a097 35 ran.Rannor(dx,rx);
36 ran.Rannor(dy,ry);
37 ran.Rannor(dz,rz);
38 dx*=chdx;
39 dy*=chdy;
40 dz*=chdz;
41 rx*=chrx;
42 ry*=chry;
43 rz*=chrz;
ae079791 44 volid = AliGeomManager::LayerToVolUID(iLayer,iModule);
45 symname = AliGeomManager::SymName(volid);
7e154d52 46 new(alobj[j++]) AliAlignObjAngles(symname,volid,dx,dy,dz,rx,ry,rz,kFALSE);
1895a097 47 }
48 }
49
dfe9c69d 50 const char* macroname = "MakeTRDResMisAlignment.C";
5bd470e1 51 if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
1895a097 52 // save on file
dfe9c69d 53 const char* filename = "TRDresidualMisalignment.root";
54 TFile f(filename,"RECREATE");
55 if(!f){
56 Error(macroname,"cannot open file for output\n");
57 return;
58 }
59 Info(macroname,"Saving alignment objects to the file %s", filename);
1895a097 60 f.cd();
61 f.WriteObject(array,"TRDAlignObjs","kSingleKey");
62 f.Close();
63 }else{
64 // save in CDB storage
dfe9c69d 65 TString Storage = gSystem->Getenv("STORAGE");
66 if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
67 Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
68 return;
69 }
70 Info(macroname,"Saving alignment objects in CDB storage %s",
71 Storage.Data());
1895a097 72 AliCDBManager* cdb = AliCDBManager::Instance();
dfe9c69d 73 AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
74 if(!storage){
75 Error(macroname,"Unable to open storage %s\n",Storage.Data());
76 return;
77 }
1895a097 78 AliCDBMetaData* md = new AliCDBMetaData();
79 md->SetResponsible("Dariusz Miskowiec");
80 md->SetComment("Residual misalignment for TRD");
5bd470e1 81 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
dfe9c69d 82 AliCDBId id("TRD/Align/Data",0,AliCDBRunRange::Infinity());
1895a097 83 storage->Put(array,id,md);
84 }
85
86 array->Delete();
87
88}
89
90