]>
Commit | Line | Data |
---|---|---|
dc7ca31d | 1 | void MakeT0ResMisAlignment(){ |
2 | // Create TClonesArray of residual misalignment objects for T0 | |
3 | // | |
90dbf5fb | 4 | TClonesArray *array = new TClonesArray("AliAlignObjParams",30); |
dc7ca31d | 5 | TClonesArray &alobj = *array; |
6 | ||
dc7ca31d | 7 | Double_t dx, dy, dz, dpsi, dtheta, dphi; |
8 | TRandom *rnd = new TRandom(4321); | |
9 | Double_t sigmatr = 0.05; // max shift in cm | |
10 | Double_t sigmarot = 0.3; // max rot in degrees | |
11 | ||
d3a9c52a | 12 | TString symName, sn; |
dc7ca31d | 13 | |
14 | Int_t iIndex=0; | |
ae079791 | 15 | AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer; |
16 | UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex); | |
dc7ca31d | 17 | |
d3a9c52a | 18 | Int_t j=0; |
19 | for (Int_t imod=0; imod<24; imod++){ | |
20 | if (imod < 12){ | |
21 | sn="T0/C/PMT"; | |
22 | }else{ | |
23 | sn="T0/A/PMT"; | |
24 | } | |
25 | symName = sn; | |
26 | symName += imod+1; | |
27 | ||
28 | dx = rnd->Gaus(0.,sigmatr); | |
29 | dy = rnd->Gaus(0.,sigmatr); | |
30 | dz = rnd->Gaus(0.,sigmatr); | |
31 | dpsi = rnd->Gaus(0.,sigmarot); | |
32 | dtheta = rnd->Gaus(0.,sigmarot); | |
33 | dphi = rnd->Gaus(0.,sigmarot); | |
34 | ||
90dbf5fb | 35 | new(alobj[j++]) AliAlignObjParams(symName.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); |
d3a9c52a | 36 | } |
37 | ||
dfe9c69d | 38 | const char* macroname = "MakeT0ResMisAlignment.C"; |
39 | if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ | |
dc7ca31d | 40 | // save on file |
dfe9c69d | 41 | const char* filename = "T0residualMisalignment.root"; |
42 | TFile f(filename,"RECREATE"); | |
43 | if(!f){ | |
44 | Error(macroname,"cannot open file for output\n"); | |
45 | return; | |
46 | } | |
47 | Info(macroname,"Saving alignment objects to the file %s", filename); | |
dc7ca31d | 48 | f.cd(); |
dfe9c69d | 49 | f.WriteObject(array,"T0AlignObjs","kSingleKey"); |
dc7ca31d | 50 | f.Close(); |
51 | }else{ | |
52 | // save in CDB storage | |
dfe9c69d | 53 | TString Storage = gSystem->Getenv("STORAGE"); |
54 | if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) { | |
55 | Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data()); | |
56 | return; | |
57 | } | |
58 | Info(macroname,"Saving alignment objects in CDB storage %s", | |
59 | Storage.Data()); | |
dc7ca31d | 60 | AliCDBManager* cdb = AliCDBManager::Instance(); |
dfe9c69d | 61 | AliCDBStorage* storage = cdb->GetStorage(Storage.Data()); |
62 | if(!storage){ | |
63 | Error(macroname,"Unable to open storage %s\n",Storage.Data()); | |
64 | return; | |
65 | } | |
dc7ca31d | 66 | AliCDBMetaData* md = new AliCDBMetaData(); |
67 | md->SetResponsible("Tomasz Malkiewicz"); | |
68 | md->SetComment("Residual misalignment for T0, produced with sigmatr=0.05 and sigmarot=0.3 in the local RS"); | |
8d0a15a4 | 69 | md->SetAliRootVersion(gSystem->Getenv("$ARVERSION")); |
dfe9c69d | 70 | AliCDBId id("T0/Align/Data",0,AliCDBRunRange::Infinity()); |
dc7ca31d | 71 | storage->Put(array,id,md); |
72 | } | |
73 | ||
74 | array->Delete(); | |
75 | ||
76 | } | |
77 |