Macros for residual and full misalignment, collected by Raffaele
[u/mrichter/AliRoot.git] / TOF / MakeTOFFullMisAlignment.C
CommitLineData
1895a097 1void MakeTOFFullMisAlignment(){
2 // Create TClonesArray of full misalignment objects for TOF
3 //
4 TClonesArray *array = new TClonesArray("AliAlignObjAngles",100);
5 TClonesArray &alobj = *array;
6
7 if(!gGeoManager) TGeoManager::Import("geometry.root"); //needed for
8 // the constructors with local coordinates not to fail
9
10 AliAlignObjAngles a;
11
12 Int_t nSMTOF = 18;
13 Int_t iIndex=0; //let all modules have index=0 in a layer with no LUT
14 AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer;
15 UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iIndex);
16
17 Int_t i;
18 Int_t j=0;
19 Double_t dx, dy, dz, dpsi, dtheta, dphi;
20 TRandom *rnd = new TRandom(2345);
21 Double_t sigmatr = 0.4; // max shift in cm w.r.t. local ideal RS
22 Double_t sigmarot = 0.06; // max rot in deg w.r.t. local ideal RS (~ 1 mrad)
23
24 for(i=0; i<18; i++) {
25 Char_t path[100];
26 sprintf(path,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1/FTOA_0",i,i);
27 dx = rnd->Gaus(0.,sigmatr);
28 dy = 0;
29 dz = rnd->Gaus(0.,sigmatr);
30 dpsi = 0;
31 dtheta = rnd->Gaus(0.,sigmarot);
32 dphi = 0.;
33 new(alobj[j]) AliAlignObjAngles(path, volid, dx, dy, dz, dpsi, dtheta, dphi,kFALSE);
34 alobj[j]->Print();
35 j++;
36 }
37
38 if(!gSystem->Getenv("$TOCDB")){
39 // save on file
40 TFile f("TOFfullMisalignment.root","RECREATE");
41 if(!f) cerr<<"cannot open file for output\n";
42 f.cd();
43 f.WriteObject(array,"TOFAlignObjs","kSingleKey");
44 f.Close();
45 }else{
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("Silvia Arcelli");
52 md->SetComment("Full misalignment for TOF");
53 md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
54 AliCDBId id("TOF/Align/Data",0,9999999);
55 storage->Put(array,id,md);
56 }
57
58 array->Delete();
59
60}
61
62