]>
Commit | Line | Data |
---|---|---|
d3da6dc4 | 1 | void MakeHMPIDResMisAlignment(){ |
2 | // Create TClonesArray of residual misalignment objects for HMPID | |
3 | // | |
71efb7b5 | 4 | const char* macroname = "MakeHMPIDResMisAlignment.C"; |
5 | // Activate CDB storage and load geometry from CDB | |
6 | AliCDBManager* cdb = AliCDBManager::Instance(); | |
162637e4 | 7 | if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); |
71efb7b5 | 8 | cdb->SetRun(0); |
9 | ||
10 | AliCDBStorage* storage; | |
11 | TString Storage; | |
12 | ||
13 | if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){ | |
14 | Storage = gSystem->Getenv("STORAGE"); | |
15 | if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) { | |
16 | Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data()); | |
17 | return; | |
18 | } | |
19 | storage = cdb->GetStorage(Storage.Data()); | |
20 | if(!storage){ | |
21 | Error(macroname,"Unable to open storage %s\n",Storage.Data()); | |
22 | return; | |
23 | } | |
24 | AliCDBPath path("GRP","Geometry","Data"); | |
25 | AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun()); | |
26 | if(!entry) Fatal(macroname,"Could not get the specified CDB entry!"); | |
27 | entry->SetOwner(0); | |
28 | TGeoManager* geom = (TGeoManager*) entry->GetObject(); | |
29 | AliGeomManager::SetGeometry(geom); | |
30 | }else{ | |
31 | AliGeomManager::LoadGeometry(); //load geom from default CDB storage | |
32 | } | |
33 | ||
d3da6dc4 | 34 | Float_t sigmaTrans=0.1; // 1mm |
35 | Float_t sigmaRot=0.001*180/TMath::Pi(); // 1 mrad | |
36 | Float_t dX, dY, dX; Float_t dPsi, dTheta, dPhi; //displacements | |
37 | ||
38 | TClonesArray *pCA = new TClonesArray("AliAlignObjMatrix",10); | |
39 | ||
40 | TRandom *pRnd = new TRandom(4357); | |
41 | ||
ae079791 | 42 | Int_t idHMPID = AliGeomManager::kHMPID; |
d3da6dc4 | 43 | for (Int_t iCh = 0; iCh < 7; iCh++) { |
44 | dX = (pRnd->Uniform()-0.5)*sigmaTrans; dY = (pRnd->Uniform()-0.5)*sigmaTrans; dZ = (pRnd->Uniform()-0.5)*sigmaTrans; | |
45 | dPsi = (pRnd->Uniform()-0.5)*sigmaRot; dTheta = (pRnd->Uniform()-0.5)*sigmaRot; dPhi = (pRnd->Uniform()-0.5)*sigmaRot; | |
ae079791 | 46 | new((*pCA)[iCh]) AliAlignObjMatrix(AliGeomManager::SymName(idHMPID,iCh),AliGeomManager::LayerToVolUID(idHMPID,iCh),dX,dY,dZ,dPsi,dTheta,dPhi,kTRUE); |
d3da6dc4 | 47 | } |
48 | ||
49 | // pCA->Print(); | |
50 | ||
a24be56b | 51 | if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ |
d3da6dc4 | 52 | // save on file |
dfe9c69d | 53 | const char* filename = "HMPIDresidualMisalignment.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); | |
d3da6dc4 | 60 | f.cd(); |
61 | f.WriteObject(pCA,"HMPIDAlignObjs","kSingleKey"); | |
62 | f.Close(); | |
63 | }else{ | |
64 | // save in CDB storage | |
71efb7b5 | 65 | Info(macroname,"Saving alignment objects in CDB storage %s", Storage.Data()); |
d3da6dc4 | 66 | AliCDBMetaData *pMeta= new AliCDBMetaData(); |
67 | pMeta->SetResponsible("HMPID Expert"); | |
68 | pMeta->SetComment("Residual alignment objects for HMPID produced with sigmaTrans=1mm and sigmaRot=1mrad"); | |
5bd470e1 | 69 | pMeta->SetAliRootVersion(gSystem->Getenv("ARVERSION")); |
dfe9c69d | 70 | AliCDBId id("HMPID/Align/Data",0,AliCDBRunRange::Infinity()); |
d3da6dc4 | 71 | storage->Put(pCA,id,pMeta); |
72 | } | |
73 | ||
74 | pCA->Delete(); | |
75 | } |