From: mtadel Date: Tue, 15 Apr 2008 11:14:40 +0000 (+0000) Subject: AliEveEventManager X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=commitdiff_plain;h=c2c4b7a2af55d52eb6876ae74adeee68dbb64a22 AliEveEventManager ================== Add support for loading of raw-data, symmetric to loading of other event-data (via run-loader and direct ESD reading). This adds dependence of EveBase to RAW. Event-navigation via gAliEveEvent->Goto/Next/PrevEvent() works fine. As a temporary fix, unlock geo-manager after the loading of THE geometry as simplified geometries can be loaded at a later time. alieve_init.C ============= Change script arguments so that all relevant parameters can be set therein. void alieve_init(const Text_t* path = ".", Int_t event=0, const Text_t* esdfile = 0, const Text_t* rawfile = 0, const Text_t* cdburi = 0, Bool_t assert_runloader = kFALSE, Bool_t assert_esd = kFALSE, Bool_t assert_raw = kFALSE) ITS-raw/digits ============== Use raw-data as provided from AliEveEventManager. Put code that is common to raw/digi dicplay into its_common_foos.C. ACORDE macros ============= First version of acorde_raw.C using data from AliEveEventManager. Use new geometry hierarchy of ACORDE. There are two things to investigate about this: 1. Is this really the geometry in AliRoot; why is ACORDE not used in (some/most?) test macros, as in 'Int_t iACORDE = 0;'. 2. Excessive use of geo-assemblies. --- diff --git a/EVE/EveBase/AliEveEventManager.cxx b/EVE/EveBase/AliEveEventManager.cxx index 2e1d20e1213..bd9efd9a04a 100644 --- a/EVE/EveBase/AliEveEventManager.cxx +++ b/EVE/EveBase/AliEveEventManager.cxx @@ -14,6 +14,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -46,7 +49,10 @@ AliEveEventManager* gAliEveEvent = 0; Bool_t AliEveEventManager::fgAssertRunLoader = kFALSE; Bool_t AliEveEventManager::fgAssertESD = kFALSE; +Bool_t AliEveEventManager::fgAssertRaw = kFALSE; +TString AliEveEventManager::fgESDFileName("AliESDs.root"); +TString AliEveEventManager::fgRawFileName("raw.root"); TString AliEveEventManager::fgCdbUri("local://$ALICE_ROOT"); AliMagF* AliEveEventManager::fgMagField = 0; @@ -55,10 +61,11 @@ AliMagF* AliEveEventManager::fgMagField = 0; AliEveEventManager::AliEveEventManager() : TEveEventManager(), - fPath (), fEventId (0), + fPath ( ), fEventId (-1), fRunLoader (0), fESDFile (0), fESDTree (0), fESD (0), - fESDfriend (0), fESDfriendExists(kFALSE) + fESDfriend (0), fESDfriendExists(kFALSE), + fRawReader (0) { // Default constructor. } @@ -69,7 +76,8 @@ AliEveEventManager::AliEveEventManager(TString path, Int_t ev) : fPath (path), fEventId(-1), fRunLoader (0), fESDFile (0), fESDTree (0), fESD (0), - fESDfriend (0), fESDfriendExists(kFALSE) + fESDfriend (0), fESDfriendExists(kFALSE), + fRawReader (0) { // Constructor with event-directory URL and event-id. @@ -88,6 +96,40 @@ AliEveEventManager::~AliEveEventManager() /******************************************************************************/ +void AliEveEventManager::SetESDFileName(const Text_t* esd) +{ + // Set file-name for opening ESD, default "AliESDs.root". + + if (esd) fgESDFileName = esd; +} + +void AliEveEventManager::SetRawFileName(const Text_t* raw) +{ + // Set file-name for opening of raw-data, default "raw.root" + if (raw) fgRawFileName = raw; +} + +void AliEveEventManager::SetCdbUri(const Text_t* cdb) +{ + // Set path to CDB, default "local://$ALICE_ROOT". + + if (cdb) fgCdbUri = cdb; +} + +void AliEveEventManager::SetAssertElements(Bool_t assertRunloader, + Bool_t assertEsd, + Bool_t assertRaw) +{ + // Set global flags that detrmine which parts of the event-data must + // be present when the event is opened. + + fgAssertRunLoader = assertRunloader; + fgAssertESD = assertEsd; + fgAssertRaw = assertRaw; +} + +/******************************************************************************/ + void AliEveEventManager::Open() { // Open event-data from URL specified in fPath. @@ -105,6 +147,8 @@ void AliEveEventManager::Open() Int_t runNo = -1; TString gaPath(Form("%s/galice.root", fPath.Data())); + // If i use open directly, we get fatal. + // Is this (AccessPathName check) ok for xrootd / alien? if (gSystem->AccessPathName(gaPath, kReadPermission) == kFALSE) { fRunLoader = AliRunLoader::Open(gaPath); @@ -114,17 +158,17 @@ void AliEveEventManager::Open() fRunLoader->SetDirName(alicePath); if (fRunLoader->LoadgAlice() != 0) - Warning(kEH, "failed loading gAlice via run-loader."); + Warning(kEH, "failed loading gAlice via run-loader."); if (fRunLoader->LoadHeader() == 0) { - runNo = fRunLoader->GetHeader()->GetRun(); + runNo = fRunLoader->GetHeader()->GetRun(); } else { - Warning(kEH, "failed loading run-loader's header."); - delete fRunLoader; - fRunLoader = 0; + Warning(kEH, "failed loading run-loader's header."); + delete fRunLoader; + fRunLoader = 0; } } else // run-loader open failed @@ -139,44 +183,35 @@ void AliEveEventManager::Open() if (fRunLoader == 0) { if (fgAssertRunLoader) - throw(kEH + "Bootstraping of run-loader failed. Its precence was requested."); + throw (kEH + "Bootstraping of run-loader failed. Its precence was requested."); else Warning(kEH, "Bootstraping of run-loader failed."); } - TString esdPath(Form("%s/AliESDs.root", fPath.Data())); - if (gSystem->AccessPathName(esdPath, kReadPermission) == kFALSE) + TString esdPath(Form("%s/%s", fPath.Data(), fgESDFileName.Data())); + if ((fESDFile = TFile::Open(esdPath))) { - fESDFile = new TFile(esdPath); - if (fESDFile->IsZombie() == kFALSE) + fESD = new AliESDEvent(); + fESDTree = (TTree*) fESDFile->Get("esdTree"); + if (fESDTree != 0) { - fESD = new AliESDEvent(); - fESDTree = (TTree*) fESDFile->Get("esdTree"); - if (fESDTree != 0) - { - fESD->ReadFromTree(fESDTree); - runNo = fESD->GetESDRun()->GetRunNumber(); - - // Check if ESDfriends exists and attach the branch - TString p = Form("%s/AliESDfriends.root", fPath.Data()); - if (gSystem->AccessPathName(p, kReadPermission) == kFALSE) - { - fESDfriendExists = kTRUE; - fESDTree->SetBranchStatus ("ESDfriend*", 1); - fESDTree->SetBranchAddress("ESDfriend.", &fESDfriend); - } - } - else // esdtree == 0 + fESD->ReadFromTree(fESDTree); + runNo = fESD->GetESDRun()->GetRunNumber(); + + // Check if ESDfriends exists and attach the branch + TString p = Form("%s/AliESDfriends.root", fPath.Data()); + if (gSystem->AccessPathName(p, kReadPermission) == kFALSE) { - delete fESDFile; fESDFile = 0; - Warning(kEH, "failed getting the esdTree."); + fESDfriendExists = kTRUE; + fESDTree->SetBranchStatus ("ESDfriend*", 1); + fESDTree->SetBranchAddress("ESDfriend.", &fESDfriend); } } - else // esd tfile is zombie + else // esdtree == 0 { delete fESDFile; fESDFile = 0; - Warning(kEH, "failed opening ESD from '%s'.", esdPath.Data()); + Warning(kEH, "failed getting the esdTree."); } } else // esd not readable @@ -187,20 +222,60 @@ void AliEveEventManager::Open() { if (fgAssertESD) { - throw(kEH + "ESD not initialized. Its precence was requested."); + throw (kEH + "ESD not initialized. Its precence was requested."); } else { Warning(kEH, "ESD not initialized."); } } + TString rawPath(Form("%s/%s", fPath.Data(), fgRawFileName.Data())); + // If i use open directly, raw-reader reports an error but i have + // no way to detect it. + // Is this (AccessPathName check) ok for xrootd / alien? + if (gSystem->AccessPathName(rawPath, kReadPermission) == kFALSE) + { + if (fgRawFileName.EndsWith("/")) + { + fRawReader = new AliRawReaderFile(rawPath); + } + else if (fgRawFileName.EndsWith(".root")) + { + fRawReader = new AliRawReaderRoot(rawPath); + } + else if (!fgRawFileName.IsNull()) + { + fRawReader = new AliRawReaderDate(rawPath); + } + } + + if (fRawReader == 0) + { + if (fgAssertRaw) + { + throw (kEH + "raw-data not initialized. Its precence was requested."); + } else { + Warning(kEH, "raw-data not initialized."); + } + } + if (runNo < 0) - throw(kEH + "invalid run number."); + { + if (fRawReader) + { + fRawReader->NextEvent(); + runNo = fRawReader->GetRunNumber(); + printf("Determining run-no from raw ... run=%d\n", runNo); + fRawReader->RewindEvents(); + } else { + throw (kEH + "unknown run number."); + } + } { AliCDBManager* cdb = AliCDBManager::Instance(); cdb->SetDefaultStorage(fgCdbUri); if (cdb->IsDefaultStorageSet() == kFALSE) - throw(kEH + "CDB initialization failed."); + throw (kEH + "CDB initialization failed."); cdb->SetRun(runNo); } @@ -219,17 +294,25 @@ void AliEveEventManager::GotoEvent(Int_t event) static const TEveException kEH("AliEveEventManager::GotoEvent "); + if (event < 0) { + Error(kEH, "event must be non-negative."); + return; + } + Int_t maxEvent = 0; - if (fRunLoader) + if (fRunLoader) { maxEvent = fRunLoader->GetNumberOfEvents() - 1; - else if (fESDTree) + } else if (fESDTree) { maxEvent = fESDTree->GetEntries() - 1; - else - throw(kEH + "neither RunLoader nor ESD loaded."); - + } else if (fRawReader) { + maxEvent = 10000000; + Info(kEH, "number of events unknown for raw-data, setting max-event id to 10M."); + } else { + throw (kEH + "neither RunLoader, ESD nor Raw loaded."); + } if (event < 0 || event > maxEvent) - throw(kEH + Form("event %d not present, available range [%d, %d].", - event, 0, maxEvent)); + throw (kEH + Form("event %d not present, available range [%d, %d].", + event, 0, maxEvent)); TEveManager::TRedrawDisabler rd(gEve); gEve->Redraw3D(kFALSE, kTRUE); // Enforce drop of all logicals. @@ -238,23 +321,47 @@ void AliEveEventManager::GotoEvent(Int_t event) // a bit gentler, checking for objs owning their external refs and having // additinal parents. DestroyElements(); - fEventId = event; - SetName(Form("Event %d", fEventId)); - UpdateItems(); if (fRunLoader) { - if (fRunLoader->GetEvent(fEventId) != 0) - throw(kEH + "failed getting required event."); + if (fRunLoader->GetEvent(event) != 0) + throw (kEH + "failed getting required event."); } if (fESDTree) { - if (fESDTree->GetEntry(fEventId) <= 0) - throw(kEH + "failed getting required event from ESD."); + if (fESDTree->GetEntry(event) <= 0) + throw (kEH + "failed getting required event from ESD."); if (fESDfriendExists) fESD->SetESDfriend(fESDfriend); } + if (fRawReader) + { + Int_t rawEv = fEventId; + if (event < rawEv) + { + fRawReader->RewindEvents(); + rawEv = -1; + } + + while (rawEv < event) + { + if ( ! fRawReader->NextEvent()) + { + fRawReader->RewindEvents(); + fEventId = -1; + throw (kEH + Form("Error going to next raw-event from event %d.", rawEv)); + } + ++rawEv; + } + + printf ("Loaded raw-event %d.\n", rawEv); + } + + fEventId = event; + SetName(Form("Event %d", fEventId)); + UpdateItems(); + AfterNewEventLoaded(); } @@ -287,9 +394,9 @@ AliRunLoader* AliEveEventManager::AssertRunLoader() static const TEveException kEH("AliEveEventManager::AssertRunLoader "); if (gAliEveEvent == 0) - throw(kEH + "ALICE event not ready."); + throw (kEH + "ALICE event not ready."); if (gAliEveEvent->fRunLoader == 0) - throw(kEH + "AliRunLoader not initialised."); + throw (kEH + "AliRunLoader not initialised."); return gAliEveEvent->fRunLoader; } @@ -302,9 +409,9 @@ AliESDEvent* AliEveEventManager::AssertESD() static const TEveException kEH("AliEveEventManager::AssertESD "); if (gAliEveEvent == 0) - throw(kEH + "ALICE event not ready."); + throw (kEH + "ALICE event not ready."); if (gAliEveEvent->fESD == 0) - throw(kEH + "AliESD not initialised."); + throw (kEH + "AliESD not initialised."); return gAliEveEvent->fESD; } @@ -317,12 +424,26 @@ AliESDfriend* AliEveEventManager::AssertESDfriend() static const TEveException kEH("AliEveEventManager::AssertESDfriend "); if (gAliEveEvent == 0) - throw(kEH + "ALICE event not ready."); + throw (kEH + "ALICE event not ready."); if (gAliEveEvent->fESDfriend == 0) - throw(kEH + "AliESDfriend not initialised."); + throw (kEH + "AliESDfriend not initialised."); return gAliEveEvent->fESDfriend; } +AliRawReader* AliEveEventManager::AssertRawReader() +{ + // Make sure raw-reader is initialized and return it. + + static const TEveException kEH("AliEveEventManager::AssertRawReader "); + + if (gAliEveEvent == 0) + throw (kEH + "ALICE event not ready."); + if (gAliEveEvent->fRawReader == 0) + throw (kEH + "RawReader not ready."); + + return gAliEveEvent->fRawReader; +} + AliMagF* AliEveEventManager::AssertMagField() { // Make sure AliMagF is initialized and return it. @@ -357,13 +478,19 @@ TGeoManager* AliEveEventManager::AssertGeometry() AliGeomManager::LoadGeometry(); if ( ! AliGeomManager::GetGeometry()) { - throw(kEH + "can not load geometry."); + throw (kEH + "can not load geometry."); } if ( ! AliGeomManager::ApplyAlignObjsFromCDB("ITS TPC TRD TOF PHOS HMPID EMCAL MUON FMD ZDC PMD T0 VZERO ACORDE")) { ::Warning(kEH, "mismatch of alignable volumes. Proceeding."); - // throw(kEH + "could not apply align objs."); + // throw (kEH + "could not apply align objs."); } + + // Temporary fix. + // In AliEve several simplified geometries can be loaded at a later stage. + // Should handle this inTEveManager::GetGeometry() by properly + // unlocking and re-locking the geo-manager. + TGeoManager::UnlockGeometry(); } return AliGeomManager::GetGeometry(); diff --git a/EVE/EveBase/AliEveEventManager.h b/EVE/EveBase/AliEveEventManager.h index f0425d861b2..564cf4e75af 100644 --- a/EVE/EveBase/AliEveEventManager.h +++ b/EVE/EveBase/AliEveEventManager.h @@ -15,6 +15,7 @@ class AliRunLoader; class AliESDEvent; class AliESDfriend; +class AliRawReader; class AliMagF; @@ -34,9 +35,10 @@ class TGeoManager; class AliEveEventManager : public TEveEventManager { public: - static void SetCdbUri(const Text_t* cdb) { if (cdb) fgCdbUri = cdb; } - static void SetAssertElements(Bool_t assertRunloader, Bool_t assertEsd) - { fgAssertRunLoader = assertRunloader; fgAssertESD = assertEsd; } + static void SetESDFileName(const Text_t* esd); + static void SetRawFileName(const Text_t* raw); + static void SetCdbUri(const Text_t* cdb); + static void SetAssertElements(Bool_t assertRunloader, Bool_t assertEsd, Bool_t assertRaw); AliEveEventManager(); AliEveEventManager(TString path, Int_t ev=0); @@ -60,6 +62,7 @@ public: static AliRunLoader* AssertRunLoader(); static AliESDEvent* AssertESD(); static AliESDfriend* AssertESDfriend(); + static AliRawReader* AssertRawReader(); static AliMagF* AssertMagField(); @@ -77,9 +80,14 @@ protected: AliESDfriend* fESDfriend; // ESDfriend object. Bool_t fESDfriendExists; // Flag specifying if ESDfriend was found during opening of the event-data. + AliRawReader* fRawReader; // Raw-adata reader. + + static TString fgESDFileName; // Name by which to open ESD. + static TString fgRawFileName; // Name by which to open raw-data file. static TString fgCdbUri; // Global URI to CDB. static Bool_t fgAssertRunLoader; // Global flag specifying if AliRunLoader must be asserted during opening of the event-data. static Bool_t fgAssertESD; // Global flag specifying if ESDEvent must be asserted during opening of the event-data. + static Bool_t fgAssertRaw; // Global flag specifying if raw-data presence must be asserted during opening of the event-data. static AliMagF* fgMagField; // Global pointer to magneti field. diff --git a/EVE/alice-macros/acorde_raw.C b/EVE/alice-macros/acorde_raw.C new file mode 100644 index 00000000000..0c13c9a100d --- /dev/null +++ b/EVE/alice-macros/acorde_raw.C @@ -0,0 +1,94 @@ +// $Id: geom_acorde.C 23412 2008-01-18 21:04:54Z mtadel $ +// Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007 + +/************************************************************************** + * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. * + * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for * + * full copyright notice. * + **************************************************************************/ + +TString acorde_module_path(Int_t module); + + +void acorde_raw() +{ + AliRawReader * reader = AliEveEventManager::AssertRawReader(); + AliACORDERawStream * stream = new AliACORDERawStream(reader); + + stream->Reset(); + stream->Next(); + + UInt_t dy[4]; + dy[0] = stream->GetWord(0); + dy[1] = stream->GetWord(1); + dy[2] = stream->GetWord(2); + dy[3] = stream->GetWord(3); + + printf ("ACORDE event 0x%08x 0x%08x 0x%08x 0x%08x\n", dy[0], dy[1], dy[2], dy[3]); + + gGeoManager = gEve->GetGeometry("geometry.root"); + + TEveElementList* acorde = new TEveElementList("ACORDE Raw"); + + gEve->AddElement(acorde); + + Int_t shape_offset = TEveGeoShape::Class()->GetDataMemberOffset("fShape"); + + for (Int_t module=0; module < 60; ++module) + { + TString path = acorde_module_path(module); + // printf("%2d - %s\n", i, path.Data()); + + if ( ! gGeoManager->cd(path)) + { + Warning("acorde_raw", "Module id=%d, path='%s' not found.\n", module, path.Data()); + continue; + } + + TEveGeoShape* eg_shape = new TEveGeoShape(Form("Module %d", module)); + + eg_shape->RefMainTrans().SetFrom(* gGeoManager->GetCurrentMatrix()); + + // Hack to set shape pointer, no interface available in TEveGeoShape. + * (TGeoShape**) (((char*)eg_shape) + shape_offset) = gGeoManager->GetCurrentVolume()->GetShape(); + + // From Matevz: + // Here check ctate and assign color, I do it partially for now. + Int_t word_idx = module / 30; + Int_t bit_idx = module % 30; + Bool_t val = (dy[word_idx] & (1 << bit_idx)) != 0; + //printf("Module %2d: word_idx = %d, bit_idx = %2d => val = %d\n", + // module, word_idx, bit_idx, val); + if (val) + eg_shape->SetMainColor((Color_t) 2); + else + eg_shape->SetMainColor((Color_t) 4); + eg_shape->StampColorSelection(); + + acorde->AddElement(eg_shape); + } + + gEve->Redraw3D(); +} + +//============================================================================== +//============================================================================== + +TString acorde_module_path(Int_t module) +{ + Int_t i, j; + + if (module < 0 || module > 59) + { + Error("acorde_module_path", "module %d out of range.", module); + return ""; + } + + if (module == 0) i = 5, j = 71; + else if (module == 9) i = 5, j = 72; + else if (module == 50) i = 5, j = 73; + else if (module == 59) i = 5, j = 74; + else i = module / 20 + 4, j = module; + + return Form("/ACORDE_1/ACORDE_%d_%d/ACORDE_MODULE_%d/ACORDE2_5", i, i, j); +} diff --git a/EVE/alice-macros/geom_acorde.C b/EVE/alice-macros/geom_acorde.C index 8ef29779942..c04fe6bb130 100644 --- a/EVE/alice-macros/geom_acorde.C +++ b/EVE/alice-macros/geom_acorde.C @@ -11,18 +11,17 @@ void geom_acorde() { gGeoManager = gEve->GetGeometry("geometry.root"); + TGeoNode* node = gGeoManager->GetTopVolume()->FindNode("ACORDE_1"); + if (!node) { + Warning("geom_acorde()", "Node ACORDE_1 not found,"); + } + TEveElementList* list = new TEveElementList("ACORDE"); gEve->AddGlobalElement(list); - for (Int_t i=1; i<61; ++i) - { - char form[1000]; - sprintf(form, "ACORDE1_%d", i); - TGeoNode* node = gGeoManager->GetTopVolume()->FindNode(form); - TEveGeoTopNode* re = new TEveGeoTopNode(gGeoManager, node); - re->UseNodeTrans(); - gEve->AddGlobalElement(re, list); - } + TEveGeoTopNode* re = new TEveGeoTopNode(gGeoManager, node); + re->UseNodeTrans(); + gEve->AddGlobalElement(re, list); gEve->Redraw3D(); } diff --git a/EVE/alice-macros/its_common_foos.C b/EVE/alice-macros/its_common_foos.C new file mode 100644 index 00000000000..11cfba7110a --- /dev/null +++ b/EVE/alice-macros/its_common_foos.C @@ -0,0 +1,174 @@ +// $Id: its_raw.C 24929 2008-04-04 13:51:43Z mtadel $ +// Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007 + +/************************************************************************** + * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. * + * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for * + * full copyright notice. * + **************************************************************************/ + +void its_common_foos() +{} + +void its_display_raw_digits(AliEveITSDigitsInfo* di, Int_t mode) +{ + TString sSector; + TString bsSector="Sector"; + TString sStave; + TString bsStave="Stave"; + TString sLadder; + TString bsLadder="Ladder"; + + Int_t i=0; + Int_t nsec, nstave, nlad, nMod; + + gEve->DisableRedraw(); + + if (mode & 1) { + TEveElementList* l = new TEveElementList("SPD0"); + l->SetTitle("SPDs' first layer"); + l->SetMainColor((Color_t)2); + gEve->AddElement(l); + for (nsec=0; nsec<10; nsec++) { + sSector = bsSector; + sSector += nsec; + TEveElementList* relSector = new TEveElementList(sSector.Data()); + relSector->SetMainColor((Color_t)2); + gEve->AddElement(relSector, l); + for (nstave=0; nstave<2; nstave++){ + sStave = bsStave; + sStave += nstave; + TEveElementList* relStave = new TEveElementList(sStave.Data()); + relStave->SetMainColor((Color_t)2); + gEve->AddElement(relStave, relSector); + for (nMod=0; nMod<4; nMod++) + { + if (di->GetDigits(i, 0) && di->GetDigits(i, 0)->GetEntriesFast() > 0) + { + AliEveITSModule* m = new AliEveITSModule(i, di); + gEve->AddElement(m, relStave); + } + ++i; + } + } + } + } else { + i += 10*2*4; + } + + if (mode & 2) { + TEveElementList* l = new TEveElementList("SPD1"); + l->SetTitle("SPDs' second layer"); + l->SetMainColor((Color_t)2); + gEve->AddElement(l); + + for (nsec=0; nsec<10; nsec++) { + sSector = bsSector; + sSector += nsec; + TEveElementList* relSector = new TEveElementList(sSector.Data()); + relSector->SetMainColor((Color_t)2); + gEve->AddElement(relSector, l); + for (nstave=0; nstave<4; nstave++){ + sStave = bsStave; + sStave += nstave; + TEveElementList* relStave = new TEveElementList(sStave.Data()); + relStave->SetMainColor((Color_t)2); + gEve->AddElement(relStave, relSector); + for (nMod=0; nMod<4; nMod++) + { + if (di->GetDigits(i, 0) && di->GetDigits(i, 0)->GetEntriesFast() > 0) + { + AliEveITSModule* m = new AliEveITSModule(i, di); + gEve->AddElement(m, relStave); + } + ++i; + } + } + } + } else { + i += 10*4*4; + } + + if (mode & 4) { + TEveElementList* l = new TEveElementList("SDD2"); + l->SetTitle("SDDs' first layer"); + l->SetMainColor((Color_t)3); + gEve->AddElement(l); + + for (nlad=0; nlad<14; nlad++) { + sLadder = bsLadder; + sLadder += nlad; + TEveElementList* relLadder = new TEveElementList(sLadder.Data()); + relLadder->SetMainColor((Color_t)3); + gEve->AddElement(relLadder, l); + for (nMod=0; nMod<6; nMod++) { + AliEveITSModule* m = new AliEveITSModule(i++, di); + gEve->AddElement(m, relLadder); + } + } + } else { + i += 14*6; + } + + if (mode & 8) { + TEveElementList* l = new TEveElementList("SDD3"); + l->SetTitle("SDDs' second layer"); + l->SetMainColor((Color_t)3); + gEve->AddElement(l); + for (nlad=0; nlad<22; nlad++) { + sLadder = bsLadder; + sLadder += nlad; + TEveElementList* relLadder = new TEveElementList(sLadder.Data()); + relLadder->SetMainColor((Color_t)3); + gEve->AddElement(relLadder, l); + for (nMod=0; nMod<8; nMod++) { + AliEveITSModule* m = new AliEveITSModule(i++, di); + gEve->AddElement(m, relLadder); + } + } + } else { + i += 22*8; + } + + if (mode & 16) { + TEveElementList* l = new TEveElementList("SSD4"); + l->SetTitle("SSDs' first layer"); + l->SetMainColor((Color_t)4); + gEve->AddElement(l); + for (nlad=0; nlad<34; nlad++) { + sLadder = bsLadder; + sLadder += nlad; + TEveElementList* relLadder = new TEveElementList(sLadder.Data()); + relLadder->SetMainColor((Color_t)4); + gEve->AddElement(relLadder, l); + for (nMod=0; nMod<22; nMod++) { + AliEveITSModule* m = new AliEveITSModule(i++, di); + gEve->AddElement(m, relLadder); + } + } + } else { + i += 34*22; + } + + if (mode & 32) { + TEveElementList* l = new TEveElementList("SSD5"); + l->SetTitle("SSDs' second layer"); + l->SetMainColor((Color_t)4); + gEve->AddElement(l); + for (nlad=0; nlad<38; nlad++) { + sLadder = bsLadder; + sLadder += nlad; + TEveElementList* relLadder = new TEveElementList(sLadder.Data()); + relLadder->SetMainColor((Color_t)4); + gEve->AddElement(relLadder, l); + for (nMod=0; nMod<25; nMod++) { + AliEveITSModule* m = new AliEveITSModule(i++, di); + gEve->AddElement(m, relLadder); + } + } + } else { + i += 38*25; + } + + gEve->EnableRedraw(); +} diff --git a/EVE/alice-macros/its_digits.C b/EVE/alice-macros/its_digits.C index dc316701b86..1aa1b997c59 100644 --- a/EVE/alice-macros/its_digits.C +++ b/EVE/alice-macros/its_digits.C @@ -14,165 +14,19 @@ // 16, 32 : SSD // By default import all layers. -void its_digits(Int_t mode=63) +void its_digits(Int_t mode = 63) { AliRunLoader* rl = AliEveEventManager::AssertRunLoader(); rl->LoadDigits("ITS"); TTree* dt = rl->GetTreeD("ITS", false); + TEveUtil::LoadMacro("its_common_foos.C"); + AliEveITSDigitsInfo* di = new AliEveITSDigitsInfo(); di->SetTree(dt); - di->Dump(); + // di->Dump(); gStyle->SetPalette(1, 0); - gEve->DisableRedraw(); - - TString sSector; - TString bsSector="Sector"; - TString sStave; - TString bsStave="Stave"; - TString sLadder; - TString bsLadder="Ladder"; - - Int_t i=0; - Int_t nsec, nstave, nlad, nMod; - - if (mode & 1) { - TEveElementList* l = new TEveElementList("SPD0"); - l->SetTitle("SPDs' first layer"); - l->SetMainColor((Color_t)2); - gEve->AddElement(l); - for (nsec=0; nsec<10; nsec++) { - sSector = bsSector; - sSector += nsec; - TEveElementList* relSector = new TEveElementList(sSector.Data()); - relSector->SetMainColor((Color_t)2); - gEve->AddElement(relSector, l); - for (nstave=0; nstave<2; nstave++){ - sStave = bsStave; - sStave += nstave; - TEveElementList* relStave = new TEveElementList(sStave.Data()); - relStave->SetMainColor((Color_t)2); - gEve->AddElement(relStave, relSector); - for (nMod=0; nMod<4; nMod++) { - AliEveITSModule* m = new AliEveITSModule(i++, di); - gEve->AddElement(m, relStave); - } - } - } - } else { - i += 10*2*4; - } - - if (mode & 2) { - TEveElementList* l = new TEveElementList("SPD1"); - l->SetTitle("SPDs' second layer"); - l->SetMainColor((Color_t)2); - gEve->AddElement(l); - - for (nsec=0; nsec<10; nsec++) { - sSector = bsSector; - sSector += nsec; - TEveElementList* relSector = new TEveElementList(sSector.Data()); - relSector->SetMainColor((Color_t)2); - gEve->AddElement(relSector, l); - for (nstave=0; nstave<4; nstave++){ - sStave = bsStave; - sStave += nstave; - TEveElementList* relStave = new TEveElementList(sStave.Data()); - relStave->SetMainColor((Color_t)2); - gEve->AddElement(relStave, relSector); - for (nMod=0; nMod<4; nMod++) { - AliEveITSModule* m = new AliEveITSModule(i++, di); - gEve->AddElement(m, relStave); - } - } - } - } else { - i += 10*4*4; - } - - if (mode & 4) { - TEveElementList* l = new TEveElementList("SDD2"); - l->SetTitle("SDDs' first layer"); - l->SetMainColor((Color_t)3); - gEve->AddElement(l); - - for (nlad=0; nlad<14; nlad++) { - sLadder = bsLadder; - sLadder += nlad; - TEveElementList* relLadder = new TEveElementList(sLadder.Data()); - relLadder->SetMainColor((Color_t)3); - gEve->AddElement(relLadder, l); - for (nMod=0; nMod<6; nMod++) { - AliEveITSModule* m = new AliEveITSModule(i++, di); - gEve->AddElement(m, relLadder); - } - } - } else { - i += 14*6; - } - - if (mode & 8) { - TEveElementList* l = new TEveElementList("SDD3"); - l->SetTitle("SDDs' second layer"); - l->SetMainColor((Color_t)3); - gEve->AddElement(l); - for (nlad=0; nlad<22; nlad++) { - sLadder = bsLadder; - sLadder += nlad; - TEveElementList* relLadder = new TEveElementList(sLadder.Data()); - relLadder->SetMainColor((Color_t)3); - gEve->AddElement(relLadder, l); - for (nMod=0; nMod<8; nMod++) { - AliEveITSModule* m = new AliEveITSModule(i++, di); - gEve->AddElement(m, relLadder); - } - } - } else { - i += 22*8; - } - - if (mode & 16) { - TEveElementList* l = new TEveElementList("SSD4"); - l->SetTitle("SSDs' first layer"); - l->SetMainColor((Color_t)4); - gEve->AddElement(l); - for (nlad=0; nlad<34; nlad++) { - sLadder = bsLadder; - sLadder += nlad; - TEveElementList* relLadder = new TEveElementList(sLadder.Data()); - relLadder->SetMainColor((Color_t)4); - gEve->AddElement(relLadder, l); - for (nMod=0; nMod<22; nMod++) { - AliEveITSModule* m = new AliEveITSModule(i++, di); - gEve->AddElement(m, relLadder); - } - } - } else { - i += 34*22; - } - - if (mode & 32) { - TEveElementList* l = new TEveElementList("SSD5"); - l->SetTitle("SSDs' second layer"); - l->SetMainColor((Color_t)4); - gEve->AddElement(l); - for (nlad=0; nlad<38; nlad++) { - sLadder = bsLadder; - sLadder += nlad; - TEveElementList* relLadder = new TEveElementList(sLadder.Data()); - relLadder->SetMainColor((Color_t)4); - gEve->AddElement(relLadder, l); - for (nMod=0; nMod<25; nMod++) { - AliEveITSModule* m = new AliEveITSModule(i++, di); - gEve->AddElement(m, relLadder); - } - } - } else { - i += 38*25; - } - - gEve->EnableRedraw(); + its_display_raw_digits(di, mode); } diff --git a/EVE/alice-macros/its_raw.C b/EVE/alice-macros/its_raw.C index 42fe729a9fd..75c8f54eb1b 100644 --- a/EVE/alice-macros/its_raw.C +++ b/EVE/alice-macros/its_raw.C @@ -7,213 +7,24 @@ * full copyright notice. * **************************************************************************/ -void its_raw(const char *input = "rawdata.root", - Int_t mode = 63, - Int_t nrun = 0, - Int_t event = 0, - Bool_t accumulate = kFALSE) +// Load ITS raw-data. +// Argument mode is a bitwise or determining which layers to import: +// 1, 2 : SPD +// 4, 8 : SDD +// 16, 32 : SSD +// By default import all layers. + +void its_raw(Int_t mode = 63) { - if (gSystem->AccessPathName(input, kReadPermission)) - { - Error("its_raw", "file '%s' not found.", input); - return; - } + AliRawReader *rawReader = AliEveEventManager::AssertRawReader(); - AliCDBManager::Instance()->SetRun(nrun); - AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT"); - - AliRawReader *rawReader = NULL; - TString fileName(input); - if (fileName.EndsWith("/")) { - rawReader = new AliRawReaderFile(fileName); - } else if (fileName.EndsWith(".root")) { - rawReader = new AliRawReaderRoot(fileName); - } else if (!fileName.IsNull()) { - rawReader = new AliRawReaderDate(fileName); - } + TEveUtil::LoadMacro("its_common_foos.C"); AliEveITSDigitsInfo* di = new AliEveITSDigitsInfo(); - - if (accumulate) AliLog::SetGlobalLogLevel(AliLog::kError); - Int_t ev = 0; - do { - if (ev % 100 == 0) printf("AliEveEventManager: %d\n", ev); - if (rawReader->NextEvent() == kFALSE) - { - Error("its_raw", "Reading event %d failed (requested event %d).", ev, event); - if (accumulate) - break; - else - return; - } - if (accumulate) di->ReadRaw(rawReader,mode); - } while (++ev < event); - - if ( ! accumulate) di->ReadRaw(rawReader,mode); - - di->Dump(); - - delete rawReader; + di->ReadRaw(rawReader,mode); + // di->Dump(); gStyle->SetPalette(1, 0); - gEve->DisableRedraw(); - - TString sSector; - TString bsSector="Sector"; - TString sStave; - TString bsStave="Stave"; - TString sLadder; - TString bsLadder="Ladder"; - - Int_t i=0; - Int_t nsec, nstave, nlad, nMod; - - if (mode & 1) { - TEveElementList* l = new TEveElementList("SPD0"); - l->SetTitle("SPDs' first layer"); - l->SetMainColor((Color_t)2); - gEve->AddElement(l); - for (nsec=0; nsec<10; nsec++) { - sSector = bsSector; - sSector += nsec; - TEveElementList* relSector = new TEveElementList(sSector.Data()); - relSector->SetMainColor((Color_t)2); - gEve->AddElement(relSector, l); - for (nstave=0; nstave<2; nstave++){ - sStave = bsStave; - sStave += nstave; - TEveElementList* relStave = new TEveElementList(sStave.Data()); - relStave->SetMainColor((Color_t)2); - gEve->AddElement(relStave, relSector); - for (nMod=0; nMod<4; nMod++) - { - if (di->GetDigits(i, 0) && di->GetDigits(i, 0)->GetEntriesFast() > 0) - { - AliEveITSModule* m = new AliEveITSModule(i, di); - gEve->AddElement(m, relStave); - } - ++i; - } - } - } - } else { - i += 10*2*4; - } - - if (mode & 2) { - TEveElementList* l = new TEveElementList("SPD1"); - l->SetTitle("SPDs' second layer"); - l->SetMainColor((Color_t)2); - gEve->AddElement(l); - - for (nsec=0; nsec<10; nsec++) { - sSector = bsSector; - sSector += nsec; - TEveElementList* relSector = new TEveElementList(sSector.Data()); - relSector->SetMainColor((Color_t)2); - gEve->AddElement(relSector, l); - for (nstave=0; nstave<4; nstave++){ - sStave = bsStave; - sStave += nstave; - TEveElementList* relStave = new TEveElementList(sStave.Data()); - relStave->SetMainColor((Color_t)2); - gEve->AddElement(relStave, relSector); - for (nMod=0; nMod<4; nMod++) - { - if (di->GetDigits(i, 0) && di->GetDigits(i, 0)->GetEntriesFast() > 0) - { - AliEveITSModule* m = new AliEveITSModule(i, di); - gEve->AddElement(m, relStave); - } - ++i; - } - } - } - } else { - i += 10*4*4; - } - - if (mode & 4) { - TEveElementList* l = new TEveElementList("SDD2"); - l->SetTitle("SDDs' first layer"); - l->SetMainColor((Color_t)3); - gEve->AddElement(l); - - for (nlad=0; nlad<14; nlad++) { - sLadder = bsLadder; - sLadder += nlad; - TEveElementList* relLadder = new TEveElementList(sLadder.Data()); - relLadder->SetMainColor((Color_t)3); - gEve->AddElement(relLadder, l); - for (nMod=0; nMod<6; nMod++) { - AliEveITSModule* m = new AliEveITSModule(i++, di); - gEve->AddElement(m, relLadder); - } - } - } else { - i += 14*6; - } - - if (mode & 8) { - TEveElementList* l = new TEveElementList("SDD3"); - l->SetTitle("SDDs' second layer"); - l->SetMainColor((Color_t)3); - gEve->AddElement(l); - for (nlad=0; nlad<22; nlad++) { - sLadder = bsLadder; - sLadder += nlad; - TEveElementList* relLadder = new TEveElementList(sLadder.Data()); - relLadder->SetMainColor((Color_t)3); - gEve->AddElement(relLadder, l); - for (nMod=0; nMod<8; nMod++) { - AliEveITSModule* m = new AliEveITSModule(i++, di); - gEve->AddElement(m, relLadder); - } - } - } else { - i += 22*8; - } - - if (mode & 16) { - TEveElementList* l = new TEveElementList("SSD4"); - l->SetTitle("SSDs' first layer"); - l->SetMainColor((Color_t)4); - gEve->AddElement(l); - for (nlad=0; nlad<34; nlad++) { - sLadder = bsLadder; - sLadder += nlad; - TEveElementList* relLadder = new TEveElementList(sLadder.Data()); - relLadder->SetMainColor((Color_t)4); - gEve->AddElement(relLadder, l); - for (nMod=0; nMod<22; nMod++) { - AliEveITSModule* m = new AliEveITSModule(i++, di); - gEve->AddElement(m, relLadder); - } - } - } else { - i += 34*22; - } - - if (mode & 32) { - TEveElementList* l = new TEveElementList("SSD5"); - l->SetTitle("SSDs' second layer"); - l->SetMainColor((Color_t)4); - gEve->AddElement(l); - for (nlad=0; nlad<38; nlad++) { - sLadder = bsLadder; - sLadder += nlad; - TEveElementList* relLadder = new TEveElementList(sLadder.Data()); - relLadder->SetMainColor((Color_t)4); - gEve->AddElement(relLadder, l); - for (nMod=0; nMod<25; nMod++) { - AliEveITSModule* m = new AliEveITSModule(i++, di); - gEve->AddElement(m, relLadder); - } - } - } else { - i += 38*25; - } - - gEve->EnableRedraw(); + its_display_raw_digits(di, mode); } diff --git a/EVE/alieve_main/alieve_main.cxx b/EVE/alieve_main/alieve_main.cxx index e8350b48286..483cd9b066d 100644 --- a/EVE/alieve_main/alieve_main.cxx +++ b/EVE/alieve_main/alieve_main.cxx @@ -13,6 +13,8 @@ #include #include +#include + #include #include @@ -47,6 +49,8 @@ int main(int argc, char **argv) } gROOT->SetMacroPath(macPath); + AliLog* log = new AliLog; + TRint app("App", &argc, argv); TEveManager::Create(); diff --git a/EVE/libEveBase.pkg b/EVE/libEveBase.pkg index 1c07d633b70..b109cb9a425 100644 --- a/EVE/libEveBase.pkg +++ b/EVE/libEveBase.pkg @@ -4,4 +4,4 @@ HDRS := $(SRCS:.cxx=.h) DHDR := EveBase/LinkDef.h -EINCLUDE := ITS TPC +EINCLUDE := RAW ITS TPC diff --git a/EVE/macros/alieve_init.C b/EVE/macros/alieve_init.C index 8046af138d4..09f3873701a 100644 --- a/EVE/macros/alieve_init.C +++ b/EVE/macros/alieve_init.C @@ -12,13 +12,13 @@ #include #endif -// !!!!! Need initialization that will also work for raw. -// Path and event-id are usually not needed. -// const Text_t* raw_file = 0, - void alieve_init(const Text_t* path = ".", Int_t event=0, - const Text_t* cdburi = 0, - Bool_t assert_runloader=kFALSE, Bool_t assert_esd=kFALSE) + const Text_t* esdfile = 0, + const Text_t* rawfile = 0, + const Text_t* cdburi = 0, + Bool_t assert_runloader = kFALSE, + Bool_t assert_esd = kFALSE, + Bool_t assert_raw = kFALSE) { Info("alieve_init", "Adding standard macros."); TString hack = gSystem->pwd(); // Problem with TGFileBrowser cding @@ -29,10 +29,14 @@ void alieve_init(const Text_t* path = ".", Int_t event=0, gSystem->ProcessEvents(); + AliEveEventManager::SetESDFileName(esdfile); + AliEveEventManager::SetRawFileName(rawfile); + AliEveEventManager::SetAssertElements(assert_runloader, assert_esd, assert_raw); + AliEveEventManager::SetCdbUri(cdburi); + // Open event - if(path != 0) { - AliEveEventManager::SetCdbUri(cdburi); - AliEveEventManager::SetAssertElements(assert_runloader, assert_esd); + if(path != 0) + { printf("Opening event %d from '%s' ...", event, path); fflush(stdout); gAliEveEvent = new AliEveEventManager(path, event); printf(" done.\n");