1 void MakeACORDEFullMisAlignment(){
2 // Create TClonesArray of full misalignment objects for ACORDE
4 const char* macroname = "MakeACORDEFullMisAlignment.C";
5 // Activate CDB storage and load geometry from CDB
6 AliCDBManager* cdb = AliCDBManager::Instance();
7 if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
10 AliCDBStorage* storage;
12 //load geom from local file till ACORDE is not switched on by default in standard config-files
13 if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){
14 TString 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());
19 storage = cdb->GetStorage(Storage.Data());
21 Error(macroname,"Unable to open storage %s\n",Storage.Data());
25 AliCDBPath path("GRP","Geometry","Data");
26 AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
27 if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");
29 TGeoManager* geom = (TGeoManager*) entry->GetObject();
30 AliGeomManager::SetGeometry(geom);
32 AliGeomManager::LoadGeometry(); //load geom from default CDB storage
35 // AliGeomManager::LoadGeometry("geometry.root");
37 TClonesArray *array = new TClonesArray("AliAlignObjParams",60);
38 TClonesArray &alobj = *array;
40 TRandom *rnd = new TRandom(4321);
42 Double_t dx, dy, dz, dpsi, dtheta, dphi;
45 // sigma translation = 1 mm
46 // sigma rotation = 0.5 degrees
48 Double_t sigmarot = 1;
51 TString basename = "ACORDE/Array";
53 AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
54 UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);
56 for (Int_t imod=0; imod<60; imod++){
57 dx = rnd->Gaus(0.,sigmatr);
58 dy = rnd->Gaus(0.,sigmatr);
59 dz = rnd->Gaus(0.,sigmatr);
60 dpsi = rnd->Gaus(0.,sigmarot);
61 dtheta = rnd->Gaus(0.,sigmarot);
62 dphi = rnd->Gaus(0.,sigmarot);
65 new(alobj[j++]) AliAlignObjParams(symname, volid, dx, dy, dz,dpsi, dtheta, dphi, kFALSE);
68 if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
70 const char* filename = "ACORDEfullMisalignment.root";
71 TFile f(filename,"RECREATE");
73 Error(macroname,"cannot open file for output\n");
76 Info(macroname,"Saving alignment objects to the file %s", filename);
78 f.WriteObject(array,"ACORDEAlignObjs","kSingleKey");
81 // save in CDB storage
82 AliCDBMetaData* md = new AliCDBMetaData();
83 md->SetResponsible("E. Cuautle & M. Rodriguez");
84 md->SetComment("Full misalignment for ACORDE");
85 md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
86 AliCDBId id("ACORDE/Align/Data",0,AliCDBRunRange::Infinity());
87 storage->Put(array,id,md);