1 void MakeACORDEZeroMisAlignment(){
2 // Create TClonesArray of zero misalignment objects for ACORDE
4 const char* macroname = "MakeACORDEZeroMisAlignment.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",64);
38 TClonesArray &alobj = *array;
40 TRandom *rnd = new TRandom(4321);
42 Double_t dx=0, dy=0, dz=0, dpsi=0, dtheta=0, dphi=0;
49 TString basename = "ACORDE/Array";
51 AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
52 UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);
54 for (Int_t imod=0; imod<60; imod++){
57 new(alobj[j++]) AliAlignObjParams(symname, volid, dx, dy, dz,dpsi, dtheta, dphi, kFALSE);
60 if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
62 const char* filename = "ACORDEZeroMisalignment.root";
63 TFile f(filename,"RECREATE");
65 Error(macroname,"cannot open file for output\n");
68 Info(macroname,"Saving alignment objects to the file %s", filename);
70 f.WriteObject(array,"ACORDEAlignObjs","kSingleKey");
73 // save in CDB storage
74 AliCDBMetaData* md = new AliCDBMetaData();
75 md->SetResponsible("E. Cuautle & M. Rodriguez");
76 md->SetComment("Zero misalignment for ACORDE");
77 md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
78 AliCDBId id("ACORDE/Align/Data",0,AliCDBRunRange::Infinity());
79 storage->Put(array,id,md);