From 0f26dbc2a4fc3cab15a068b7df566fb9b55fa42b Mon Sep 17 00:00:00 2001 From: masera Date: Thu, 22 May 2008 11:37:29 +0000 Subject: [PATCH] Possibility of reading AliAlignObj from OCDB (R. Grosso) --- ITS/DrawITSAlignObj.C | 71 +++++++++++++++++++++++++++++++------------ 1 file changed, 51 insertions(+), 20 deletions(-) diff --git a/ITS/DrawITSAlignObj.C b/ITS/DrawITSAlignObj.C index f1b342bc505..21ef98e7058 100644 --- a/ITS/DrawITSAlignObj.C +++ b/ITS/DrawITSAlignObj.C @@ -8,21 +8,51 @@ #include #include "AliAlignObj.h" #endif -void DrawITSAlignObj(const char* filename="ITSfullMisalignment.root", - const char* filenameOut="ITSfullModuleMisalignment.root", - Bool_t local=kFALSE) { - // +void DrawITSAlignObj(Bool_t local=kFALSE) { // // Draw distribution of alignment constants - // (original version: A.Jacholkowski; modified by: A.Dainese) + // Set TOCDB and STORAGE environment variables to run the macro + // on an AliCDBEntry instead of on a file // -/* $Id$ */ - - AliGeomManager::LoadGeometry("geometry.root"); - - TFile* f = TFile::Open(filename); - if(!f) {cerr<<"cannot open input file\n"; return;} - + const char* filenameOut="ITSfullModuleMisalignment.root"; + TClonesArray* ar = 0; + + AliCDBManager* cdb = AliCDBManager::Instance(); + + // Activate CDB storage and load geometry from CDB + if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){ + TString Storage = gSystem->Getenv("STORAGE"); + if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) { + Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data()); + return; + } + cdb->SetDefaultStorage(Storage.Data()); + cdb->SetRun(0); + AliCDBEntry *entry = cdb->Get("GRP/Geometry/Data"); + if(!entry) Fatal("Could not get the specified CDB entry!"); + entry->SetOwner(0); + TGeoManager* geom = (TGeoManager*) entry->GetObject(); + AliGeomManager::SetGeometry(geom); + AliCDBEntry* eItsAlign = cdb->Get("ITS/Align/Data"); + ar = (TClonesArray*)eItsAlign->GetObject(); + if(!ar) { + Fatal("Could not get the alignment-objects array from the CDB entry!"); + return; + } + }else{ + cdb->SetDefaultStorage("local://$ALICE_ROOT"); + cdb->SetRun(0); + AliGeomManager::LoadGeometry("geometry.root"); //load geom from default CDB storage + const char* filename="ITSfullMisalignment.root"; + TFile* f = TFile::Open(filename); + if(!f) {cerr<<"cannot open input file\n"; return;} + ar = (TClonesArray*)f->Get("ITSAlignObjs"); + if(!ar) { + Fatal("Could not get the alignment-objects array from the file %s!", filename); + return; + } + } + TCanvas *cSPDsector = new TCanvas("cSPDsector","SPD sectors alignobjs",0,0,800,600); cSPDsector->Divide(3,2); TH1F* hxSPDsector = new TH1F("hxSPDsector","x in SPD sectors",100,-0.1,0.1); @@ -130,12 +160,11 @@ void DrawITSAlignObj(const char* filename="ITSfullMisalignment.root", hrzSSDsensor->SetXTitle("[deg]"); - - TClonesArray* ar = (TClonesArray*)f->Get("ITSAlignObjs"); Int_t entries = ar->GetEntriesFast(); - cout<<"number of alignment objects: "<UncheckedAt(i); + TString symName = a->GetSymName(); + UShort_t volUID = a->GetVolUID(); + //printf("VolId %d %s\n",volUID,symName.Data()); + if(local) { a->GetLocalPars(tr,rot); } else { a->GetPars(tr,rot); } - TString symName = a->GetSymName(); - UShort_t volUID = a->GetVolUID(); - printf("VolId %d %s\n",volUID,symName.Data()); AliGeomManager::GetDeltaForBranch(*a,delta); //delta.Print(); @@ -335,3 +365,4 @@ void DrawITSAlignObj(const char* filename="ITSfullMisalignment.root", return; } + -- 2.43.0