]>
Commit | Line | Data |
---|---|---|
dc7ca31d | 1 | void MakeT0ResMisAlignment(){ |
2 | // Create TClonesArray of residual misalignment objects for T0 | |
3 | // | |
d3a9c52a | 4 | TClonesArray *array = new TClonesArray("AliAlignObjAngles",30); |
dc7ca31d | 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 | Double_t dx, dy, dz, dpsi, dtheta, dphi; | |
13 | TRandom *rnd = new TRandom(4321); | |
14 | Double_t sigmatr = 0.05; // max shift in cm | |
15 | Double_t sigmarot = 0.3; // max rot in degrees | |
16 | ||
d3a9c52a | 17 | TString symName, sn; |
dc7ca31d | 18 | |
19 | Int_t iIndex=0; | |
20 | AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer; | |
21 | UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iIndex); | |
22 | ||
d3a9c52a | 23 | Int_t j=0; |
24 | for (Int_t imod=0; imod<24; imod++){ | |
25 | if (imod < 12){ | |
26 | sn="T0/C/PMT"; | |
27 | }else{ | |
28 | sn="T0/A/PMT"; | |
29 | } | |
30 | symName = sn; | |
31 | symName += imod+1; | |
32 | ||
33 | dx = rnd->Gaus(0.,sigmatr); | |
34 | dy = rnd->Gaus(0.,sigmatr); | |
35 | dz = rnd->Gaus(0.,sigmatr); | |
36 | dpsi = rnd->Gaus(0.,sigmarot); | |
37 | dtheta = rnd->Gaus(0.,sigmarot); | |
38 | dphi = rnd->Gaus(0.,sigmarot); | |
39 | ||
40 | new(alobj[j++]) AliAlignObjAngles(symName.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); | |
41 | } | |
42 | ||
8d0a15a4 | 43 | if(!gSystem->Getenv("$TOCDB")){ |
dc7ca31d | 44 | // save on file |
45 | TFile f("T0residualMisalignment.root","RECREATE"); | |
46 | if(!f) cerr<<"cannot open file for output\n"; | |
47 | f.cd(); | |
48 | f.WriteObject(array,"T0ResidualObjs ","kSingleKey"); | |
49 | f.Close(); | |
50 | }else{ | |
51 | // save in CDB storage | |
8d0a15a4 | 52 | const char* Storage = gSystem->Getenv("$STORAGE"); |
dc7ca31d | 53 | AliCDBManager* cdb = AliCDBManager::Instance(); |
54 | AliCDBStorage* storage = cdb->GetStorage(Storage); | |
55 | AliCDBMetaData* md = new AliCDBMetaData(); | |
56 | md->SetResponsible("Tomasz Malkiewicz"); | |
57 | md->SetComment("Residual misalignment for T0, produced with sigmatr=0.05 and sigmarot=0.3 in the local RS"); | |
8d0a15a4 | 58 | md->SetAliRootVersion(gSystem->Getenv("$ARVERSION")); |
dc7ca31d | 59 | AliCDBId id("T0/Align/Data",0,9999999); |
60 | storage->Put(array,id,md); | |
61 | } | |
62 | ||
63 | array->Delete(); | |
64 | ||
65 | } | |
66 |