From 7279ee15a7d8b485afe764c8ccf4c5805f941bc0 Mon Sep 17 00:00:00 2001 From: mtadel Date: Mon, 8 Sep 2008 18:42:56 +0000 Subject: [PATCH] From Jochen - EveHLT development accumulated since the end of March. --- EVE/EveHLT/AliEveHOMERManager.cxx | 500 ++------- EVE/EveHLT/AliEveHOMERManager.h | 29 +- EVE/EveHLT/AliEveHOMERManagerEditor.cxx | 39 +- EVE/EveHLT/AliEveHOMERManagerEditor.h | 14 +- EVE/EveHLT/AliEveHOMERSrcObject.cxx | 61 ++ EVE/EveHLT/AliEveHOMERSrcObject.h | 79 ++ EVE/EveHLT/AliEveHOMERSrcTranslator.cxx | 538 ++++++++++ EVE/EveHLT/AliEveHOMERSrcTranslator.h | 142 +++ EVE/EveHLT/AliEveHOMERXMLHandler.cxx | 346 ++++++ EVE/EveHLT/AliEveHOMERXMLHandler.h | 106 ++ EVE/EveHLT/LinkDef.h | 6 +- EVE/hlt-macros/ReadESDTree.C | 10 + EVE/hlt-macros/geom_hlt.C | 48 +- EVE/hlt-macros/hlt_structs.C | 2 + EVE/hlt-macros/homer_display.C | 1299 ++++++++--------------- EVE/hlt-macros/rootlogon.C | 9 + EVE/hlt-macros/sampleConfig.xml | 31 - EVE/hlt-macros/sampleConfig_2.xml | 30 - EVE/hlt-macros/test_sources.C | 31 - 19 files changed, 1856 insertions(+), 1464 deletions(-) create mode 100644 EVE/EveHLT/AliEveHOMERSrcObject.cxx create mode 100644 EVE/EveHLT/AliEveHOMERSrcObject.h create mode 100644 EVE/EveHLT/AliEveHOMERSrcTranslator.cxx create mode 100644 EVE/EveHLT/AliEveHOMERSrcTranslator.h create mode 100644 EVE/EveHLT/AliEveHOMERXMLHandler.cxx create mode 100644 EVE/EveHLT/AliEveHOMERXMLHandler.h create mode 100644 EVE/hlt-macros/ReadESDTree.C diff --git a/EVE/EveHLT/AliEveHOMERManager.cxx b/EVE/EveHLT/AliEveHOMERManager.cxx index ce47c2942ad..9a3d72f7e93 100644 --- a/EVE/EveHLT/AliEveHOMERManager.cxx +++ b/EVE/EveHLT/AliEveHOMERManager.cxx @@ -3,6 +3,8 @@ // Author: Jochen Thaeder * // for The ALICE HLT Project. * +//-*- Mode: C++ -*- + /** @file AliEveHOMERManager.cxx @author Jochen Thaeder @date @@ -25,6 +27,8 @@ #define __ROOT__ #define USE_ALILOG #define LINUX + +#define EVE_DEBUG 1 // -- -- -- -- -- -- -- #include "AliHLTHOMERLibManager.h" #include "AliHLTHOMERSourceDesc.h" @@ -64,12 +68,9 @@ ClassImp(AliEveHOMERManager) AliEveHOMERManager::AliEveHOMERManager( TString xmlFile ) : TEveElementList("AliEveHOMERManager"), fLibManager(new AliHLTHOMERLibManager), - fXMLFile(xmlFile), - fXMLParser(NULL), - fRootNode(NULL), + fXMLHandler( new AliEveHOMERXMLHandler( xmlFile ) ), fSourceList(NULL), fReader(NULL), - fRealm("GPN"), fBlockList(NULL), fNBlks(0), fEventID(0), @@ -87,6 +88,7 @@ AliEveHOMERManager::AliEveHOMERManager( TString xmlFile ) : // Right now, a xml file ( SCC1 ) is used to get the // configuration, this will/ has to change to a proxy // running on dedicated nodes. + } //################################################################################## @@ -101,9 +103,9 @@ AliEveHOMERManager::~AliEveHOMERManager() { fReader = NULL; } - if ( fXMLParser ) - delete fXMLParser; - fXMLParser = NULL; + if ( fXMLHandler != NULL ) + delete fXMLHandler; + fXMLHandler = NULL; if ( fSourceList != NULL ) delete fSourceList; @@ -120,11 +122,12 @@ AliEveHOMERManager::~AliEveHOMERManager() { if ( fTPCPre != NULL ) delete fTPCPre; fTPCPre = NULL; + } /* * --------------------------------------------------------------------------------- - * Source Handling + * Source Handling * --------------------------------------------------------------------------------- */ @@ -132,20 +135,7 @@ AliEveHOMERManager::~AliEveHOMERManager() { Int_t AliEveHOMERManager::CreateHOMERSourcesList() { // Create Sources List from HOMER-Proxy - // -- Initialize XML parser - if ( fXMLParser != NULL ) - delete fXMLParser; - fXMLParser = NULL; - - fXMLParser = new TDOMParser(); - fXMLParser->SetValidate( kFALSE ); - - Int_t iResult = fXMLParser->ParseFile( fXMLFile ); - if ( iResult < 0 ) { - iResult = 1; - AliError( Form("Parsing file with error: %s", fXMLParser->GetParseCodeMessage( fXMLParser->GetParseCode() )) ); - return iResult; - } + Int_t iResult = 0; // -- Initialize sources list DestroyElements(); @@ -156,62 +146,22 @@ Int_t AliEveHOMERManager::CreateHOMERSourcesList() { fSourceList = new TList(); fSourceList->SetOwner( kTRUE ); - // -- Set ROOT node - fRootNode = fXMLParser->GetXMLDocument()->GetRootNode(); - - TXMLNode * node = NULL; - TXMLNode * prevNode = fRootNode->GetChildren(); - - // -- Loop over all nodes - while ( ( node = prevNode->GetNextNode() ) ) { - prevNode = node; - - // -- Find only "Process" nodes, otherwise continue to next node - if ( strcmp( node->GetNodeName(), "Proc" ) != 0 ) - continue; - - // -- Get Attributes of current node - TList *attrList = node->GetAttributes(); - TXMLAttr *attr = 0; - TIter next(attrList); - - while ( ( attr = (TXMLAttr*)next() ) ) { - - // -- Find "ID" attribute, otherwise continue to next attribute - if ( strcmp( attr->GetName(), "ID" ) != 0 ) - continue; - - TString nodeId( attr->GetValue() ); - - // -- Find only TDS processes - TObjArray * nodeIdTok = nodeId.Tokenize("_"); - - for ( Int_t ii=0 ; ii < nodeIdTok->GetEntries() ; ii++ ) { - if ( ! ( (TObjString*) nodeIdTok->At(ii) )->GetString().CompareTo("TDS") ) { - iResult = GetTDSAttributes( node->GetChildren() ); - if ( iResult ) { - AliError( Form("Error processing TDS process : %s", nodeId.Data()) ); - } - } - } - } // while ( ( attr = (TXMLAttr*)next() ) ) { - - } // while ( ( node = prevNode->GetNextNode() ) ) { - - // -- New SourceList has been created --> All Sources are new --> State has changed - fStateHasChanged = kTRUE; + iResult = fXMLHandler->FillSourceList( fSourceList ); if ( iResult ) { AliWarning( Form("There have been errors, while creating the sources list.") ); } else { AliInfo( Form("New sources list created.") ); + + // -- New SourceList has been created --> All Sources are new --> State has changed + fStateHasChanged = kTRUE; if ( fSrcList ) delete fSrcList; // -- Create new AliEVE sources list - fSrcList = new AliEveHOMERSourceList("HOMER Sources"); + fSrcList = new AliEveHOMERSourceList("HLT Sources"); fSrcList->SetManager(this); AddElement(fSrcList); @@ -235,341 +185,6 @@ void AliEveHOMERManager::SetSourceState( AliHLTHOMERSourceDesc * source, Bool_t return; } -//################################################################################## -Int_t AliEveHOMERManager::GetTDSAttributes( TXMLNode * xmlNode ) { - // Get Information out of a TDS process in XML file - // * param xmlNode Pointer to childs of TDS node - // * return 0 on sucess, > 0 on errorsee header file for class documentation - - Int_t iResult = 0; - - TXMLNode * attrNode = NULL; - TXMLNode * prevNode = xmlNode; - - TString xmlHostname = 0; - TString xmlPort = 0; - - TString hostname = 0; - Int_t port = 0; - - // -- Get hostname and port from TDS node out of XML - while ( ( attrNode = prevNode->GetNextNode() ) ) { - prevNode = attrNode; - - // -- Get port out of the commandline - if ( strcmp( attrNode->GetNodeName(), "Cmd" ) == 0 ) { - TString cmd( attrNode->GetText() ); - - TObjArray * cmdTok = cmd.Tokenize(" "); - xmlPort = ((TObjString*) cmdTok->At(2))->GetString(); - } - // -- Get hostname - else if ( strcmp( attrNode->GetNodeName(), "Node" ) == 0 ) - xmlHostname = attrNode->GetText(); - - } // while ( ( attrNode = prevNode->GetNextNode() ) ) { - - // -- Resolve hostname and port information - iResult = ResolveHostPortInformation ( xmlHostname, xmlPort, hostname, port ); - if ( iResult == 1 ) { - AliError( Form("Error resolving hostname : %s", xmlHostname.Data()) ); - return iResult; - } - else if ( iResult == 2 ) {AliInfo( Form("Connection established") ); - AliError( Form("Error resolving port : %s", xmlPort.Data()) ); - return iResult; - } - - // -- Reset loop to TDS node - prevNode = xmlNode; - - // -- Get Sources out of XML, resolve sources, add to sources List - while ( ( attrNode = prevNode->GetNextNode() ) ) { - prevNode = attrNode; - - // Find only "Parent" tags, otherwise continue to next tag - if ( strcmp( attrNode->GetNodeName(), "Parent" ) != 0 ) - continue; - - TString xmlParent = attrNode->GetText(); - - AliHLTHOMERSourceDesc * source = new AliHLTHOMERSourceDesc( hostname, port ); - - if ( ResolveSourceInformation( xmlParent, source ) ) { - iResult = 3; - AliError( Form("Error resolving source : %s", xmlParent.Data()) ); - - delete source; - } - else { - fSourceList->Add( source ); - AliInfo( Form("New Source added : %s", xmlParent.Data()) ); - } - - } // while ( ( attrNode = prevNode->GetNextNode() ) ) { - - return iResult; -} - -//################################################################################## -Int_t AliEveHOMERManager::ResolveHostPortInformation ( TString xmlHostname, TString xmlPort, TString &hostname, Int_t &port ) { - // Resolve Information of hostname and port for source which has to be used by HOMER - // ( due to port mapping inside the HLT ) - // * param xmlHostname Hostname out of the XML - // * param xmlPort Port out of the XML - // * param hostname Return of the hostname - // * param port Return of the port - // * return 0 on sucess, 1 if hostname couldn't be resolved, 2 if port couldn't be resolved, - - Int_t iResult = 1; - TString nodeName = 0; - TXMLNode * node = NULL; - TXMLNode * prevNode = fRootNode->GetChildren(); - - // *** Resolve hostname - - while ( ( node = prevNode->GetNextNode() ) && iResult == 1 ) { - prevNode = node; - - // -- Find only "Node" nodes, otherwise continue - if ( strcmp( node->GetNodeName(), "Node" ) != 0 ) - continue; - - // -- Get Attributes of current node - TList *attrList = node->GetAttributes(); - TXMLAttr *attr = 0; - TIter next(attrList); - - TString nodeId = 0; - - // Get "nodeID" and "nodeName" of this "Node" node - while ( ( attr = (TXMLAttr*)next() ) ) { - if ( strcmp( attr->GetName(), "ID" ) == 0 ) - nodeId = attr->GetValue(); - else if ( strcmp( attr->GetName(), "hostname" ) == 0 ) - nodeName = attr->GetValue(); - } - - // -- if this is not the correct nodeID continue - if ( nodeId != xmlHostname ) - continue; - - // -- Set hostname - if ( ! fRealm.CompareTo( "ACR" ) ) - hostname = "alihlt-dcs0.cern.ch"; - else if ( ! fRealm.CompareTo( "GPN" ) ) - hostname = "alihlt-vobox0.cern.ch"; - else - hostname = nodeName; - - iResult = 0; - - break; - } // while ( ( node = prevNode->GetNextNode() ) ) { - - if ( iResult ) { - AliError( Form("Error resolving hostname : %s", xmlHostname.Data()) ); - return iResult; - } - - // *** Resolve port - - if ( xmlPort.IsDigit() ) { - - if ( nodeName.CompareTo("feptriggerdet") ==0 ){ - if ( xmlPort.CompareTo("49152") == 0 ){ - port = 58140; - } else if ( xmlPort.CompareTo("49153") == 0 ){ - port = 58141; - } - } else if ( nodeName.CompareTo("fepfmdaccorde") == 0 ){ - if ( xmlPort.CompareTo("49152") == 0 ){ - port = 58144; - } else if ( xmlPort.CompareTo("49153") == 0 ){ - port = 58145; - } - } else if ( nodeName.CompareTo("feptpcao15") == 0 ){ - if ( xmlPort.CompareTo("49152") == 0 ){ - port = 50340; - } else if ( xmlPort.CompareTo("49153") == 0 ){ - port = 50341; - } - } else if ( nodeName.CompareTo("fepphos2") == 0 ){ - if ( xmlPort.CompareTo("49152") == 0 ){ - port = 58656; - } else if ( xmlPort.CompareTo("58656") == 0 ){ - port = 58656; - } - } else if ( nodeName.CompareTo("fepphos3") == 0 ){ - if ( xmlPort.CompareTo("49152") == 0 ){ - port = 58660; - } else if ( xmlPort.CompareTo("58660") == 0 ){ - port = 58660; - } - } else if ( nodeName.CompareTo("fepphos4") == 0 ){ - if ( xmlPort.CompareTo("49152") == 0 ){ - port = 58664; - } else if ( xmlPort.CompareTo("58664") == 0 ){ - port = 58664; - } - } else if ( nodeName.CompareTo("alihlt-vobox0") == 0 ){ - port = xmlPort.Atoi(); - } - } - else { - AliError( Form("Error resolving port : %s", xmlPort.Data()) ); - iResult = 2; - } - - // *** Summary - - if ( !iResult ) { - AliInfo( Form("%s:%i resolved out of %s:%s", hostname.Data(), port, xmlHostname.Data(), xmlPort.Data()) ); - } - - return iResult; -} - -//################################################################################## -Int_t AliEveHOMERManager::ResolveSourceInformation( TString xmlParent, AliHLTHOMERSourceDesc *source ) { - // Resolve information of source - // * param xmlParent ParentString out of the XML - // * param source Return the filled AliHLTHOMERSourceDesc object - // * return 0 on sucess, 1 on errorsee header file for class documentation - - Int_t iResult = 0; - - if ( ! xmlParent.Contains( "_" ) ) { - AliError( Form("Source %s could not be resolved", xmlParent.Data() ) ); - iResult = 1; - - return iResult; - } - - TObjArray * parentTokens = xmlParent.Tokenize("_"); - - Int_t nEntries = parentTokens->GetEntries(); - - TString detector = ((TObjString*) parentTokens->At(0) )->GetString(); - TString subDetector = ""; - TString subSubDetector = ""; - TString dataType = ""; - ULong_t specification = 0; - - TString name = ((TObjString*) parentTokens->At(1) )->GetString(); - TString objName = ""; - - if ( nEntries == 3 ) - subDetector = ((TObjString*) parentTokens->At(2) )->GetString(); - else if ( nEntries == 4 ) { - subDetector = ((TObjString*) parentTokens->At(2) )->GetString(); - subSubDetector = ((TObjString*) parentTokens->At(3) )->GetString(); - } - - // -- Corecct TPC subdetector, because in we have somtimes "A","C" - if ( ! detector.CompareTo("TPC") ) { - if ( subDetector.BeginsWith('A') ) { - subDetector.Remove( TString::kLeading, 'A' ); - } - else if ( subDetector.BeginsWith('C') ) { - subDetector.Remove( TString::kLeading, 'C' ); - Int_t tmp = subDetector.Atoi() + 18; - subDetector = ""; - subDetector += tmp; - } - } - - // -- Correct for MUON - if ( ! detector.CompareTo("DIMU") ) { - detector = "MUON"; - - if ( ! subDetector.CompareTo("TRG") ) - subDetector = "1"; - else if ( ! subDetector.CompareTo("TRK") ) - subDetector = "2"; - } - - // -- Remove Leading '0' in sub detector and subsubdetector - subDetector.Remove( TString::kLeading, '0' ); - subSubDetector.Remove( TString::kLeading, '0' ); - - // -- Set Object Names - - // **** General **** - if ( name == "RP" || name == "FP" || name == "Relay" ) { - objName = ""; - dataType = "DDL_RAW"; - specification = 0; - } - - // **** TPC **** - else if ( detector == "TPC" ) { - - if ( name == "CalibPedestal" ) { - objName = "AliTPCCalibPedestal"; - dataType = "HIS_CAL"; - specification = 0; - } - else if ( name == "CalibPulser" ) { - objName = "AliTPCCalibPulser"; - dataType = "HIS_CAL"; - specification = 0; - } - else if ( name == "CF" || name == "RelayCF" ) { - objName = "AliHLTTPCClusterDataFormat"; - dataType = "CLUSTERS"; - specification = 0; - } - else if ( name == "ESDConv" ) { - objName = "TTree"; - dataType = "ESD_TREE"; - specification = 0; - } - else if ( name == "KryptonCF" ) { - objName = "TObjArray"; - dataType = "KRPTHIST"; - specification = 0; - } - else { - // not defined yet ... - AliError( Form("Parent Process not defined yet : %s .", name.Data()) ); - iResult = 1; - } - - } // if ( detector == "TPC" ) { - - // **** TRD **** - else if ( detector == "TRD" ) { - - if ( name == "foo" ) { - objName = "bar"; - dataType = "FOO_BAR"; - specification = 0; - } - } // else if ( detector == "TRD" ) { - - // **** PHOS **** - else if ( detector == "PHOS" ) { - - } // else if ( detector == "PHOS" ) { - - // **** DIMU **** - else if ( detector == "MUON" ) { - Int_t UpdateSourcesFromSourcesList( ); - } // else if ( detector == "MUON" ) { - - // -- Fill object - source->SetSourceName( name, objName ); - source->SetSourceType( specification, dataType ); - source->SetDetectors( detector, subDetector, subSubDetector ); - - // AliInfo( Form("Set Source %s , Type %s, ClassName %s .", name.Data(), dataType.Data(), objName.Data()) ); - // AliInfo( Form(" Detector %s , SubDetector : %s, SubSubDetector %s .", - // detector.Data(), subDetector.Data(), subSubDetector.Data()) ); - - return iResult; -} - /* * --------------------------------------------------------------------------------- * Connection Handling @@ -581,7 +196,6 @@ Int_t AliEveHOMERManager::ConnectHOMER(){ // Connect to HOMER sources, out of Readout List, which gets created when state has changed // * return 0 on sucess, "HOMER" errors on error - Int_t iResult = 0; fStateHasChanged = fSrcList->GetSelectedSources(); @@ -647,11 +261,6 @@ Int_t AliEveHOMERManager::ConnectHOMER(){ delete[] sourceHostnames; delete[] sourcePorts; - - // -- Get next event - if ( ! iResult ) - NextEvent(); - return iResult; } @@ -692,7 +301,6 @@ Int_t AliEveHOMERManager::ReconnectHOMER(){ return iResult; } - //################################################################################## void AliEveHOMERManager::CreateReadoutList( const char** sourceHostnames, UShort_t *sourcePorts, UInt_t &sourceCount ){ // Create a readout list for Hostname and ports @@ -745,36 +353,47 @@ Int_t AliEveHOMERManager::NextEvent(){ // * return 0 on sucess, "HOMER" errors on error Int_t iResult = 0; + Int_t iRetryCount = 0; if ( !fReader || ! IsConnected() ) { AliWarning( Form( "Not connected yet." ) ); return 1; } + // fReader->SetEventRequestAdvanceTime( 20000000 /*timeout in us*/ ); + // -- Read next event data and error handling for HOMER (error codes and empty blocks) while( 1 ) { - iResult = fReader->ReadNextEvent( 20000000 /*timeout in us*/); + + iResult = fReader->ReadNextEvent( 40000000 /*timeout in us*/); if ( iResult == 111 || iResult == 32 || iResult == 6 ) { Int_t ndx = fReader->GetErrorConnectionNdx(); AliError( Form("Error, No Connection to source %d: %s (%d)", ndx, strerror(iResult), iResult) ); - fConnected = kFALSE; return 2; } else if ( iResult == 110 ) { Int_t ndx = fReader->GetErrorConnectionNdx(); AliError( Form("Timout occured, reading event from source %d: %s (%d)", ndx, strerror(iResult), iResult) ); - fConnected = kFALSE; return 3; } else if ( iResult == 56) { Int_t ndx = fReader->GetErrorConnectionNdx(); - AliError( Form("Retry: Error reading event from source %d: %s (%d)", - ndx, strerror(iResult), iResult) ); - fConnected = kFALSE; - continue; + + ++iRetryCount; + + if ( iRetryCount >= 20 ) { + AliError( Form("Retry Failed: Error reading event from source %d: %s (%d)", + ndx, strerror(iResult), iResult) ); + return 4; + } + else { + AliError( Form("Retry: Error reading event from source %d: %s (%d)", + ndx, strerror(iResult), iResult) ); + continue; + } } else if ( iResult ) { Int_t ndx = fReader->GetErrorConnectionNdx(); @@ -798,8 +417,7 @@ Int_t AliEveHOMERManager::NextEvent(){ AliInfo( Form("Event 0x%016LX (%Lu) with %lu blocks", fEventID, fEventID, fNBlks) ); -#if 0 - +#if EVE_DEBUG // Loop for Debug only for ( ULong_t i = 0; i < fNBlks; i++ ) { Char_t tmp1[9], tmp2[5]; @@ -814,7 +432,6 @@ Int_t AliEveHOMERManager::NextEvent(){ AliInfo( Form("Block %lu length: %lu - type: %s - origin: %s", i, fReader->GetBlockDataLength( i ), tmp1, tmp2) ); } // end for ( ULong_t i = 0; i < fNBlks; i++ ) { - #endif // -- Create BlockList @@ -851,8 +468,10 @@ Int_t AliEveHOMERManager::CreateBlockList() { if ( CheckIfRequested( block ) ) fBlockList->Add( block ); else { - delete block; - block = NULL; + //The Following 2 line commented out and the previous is added. + // delete block; + // block = NULL; + fBlockList->Add( block ); } iter = GetNextBlk(); @@ -942,7 +561,7 @@ TString AliEveHOMERManager::GetBlkOrigin( Int_t ndx ) { } //################################################################################## -TString AliEveHOMERManager:: GetBlkType( Int_t ndx ) { +TString AliEveHOMERManager::GetBlkType( Int_t ndx ) { // Get type of block ndx // * param ndx Block index // * return type of block @@ -978,7 +597,7 @@ TString AliEveHOMERManager:: GetBlkType( Int_t ndx ) { } //################################################################################## -ULong_t AliEveHOMERManager:: GetBlkSpecification( Int_t ndx ) { +ULong_t AliEveHOMERManager::GetBlkSpecification( Int_t ndx ) { // Get specification of block ndx // * param ndx Block index // * return specification of block @@ -1014,18 +633,22 @@ Bool_t AliEveHOMERManager::CheckIfRequested( AliHLTHOMERBlockDesc * block ) { // -- Read all sources and check if they should be read out TIter next( fSourceList ); while ( ( source = (AliHLTHOMERSourceDesc*)next() ) ) { - + if ( ! source->IsSelected() ) continue; - if ( source->GetDetector().CompareTo( block->GetDetector() ) ) - continue; + if ( !( block->GetDetector().CompareTo( "*** " ) && block->GetDetector().CompareTo( "***" ) ) ) { + // if not any detector + if ( source->GetDetector().CompareTo( block->GetDetector() ) ) + continue; + } - if ( source->GetDataType().CompareTo( block->GetDataType() ) ) - continue; + if ( ! ( block->GetDataType().CompareTo( "******* " ) && block->GetDataType().CompareTo( "******* " ) ) ) { + if ( source->GetDataType().CompareTo( block->GetDataType() ) ) + continue; + } if ( ! block->HasSubDetectorRange() ) { - if ( source->GetSubDetector().Atoi() != block->GetSubDetector().Atoi() ) continue; @@ -1038,15 +661,24 @@ Bool_t AliEveHOMERManager::CheckIfRequested( AliHLTHOMERBlockDesc * block ) { } // if ( ! block->HasSubDetectorRange ) { requested = kTRUE; + break; } // while ( ( source = (AliHLTHOMERSourceDesc*)next() ) ) { + +#if EVE_DEBUG - if ( requested) { - AliInfo( Form("Block requested : %s - %s : %s/%s -> %s ", block->GetDetector().Data(), block->GetDataType().Data(), - block->GetSubDetector().Data(), block->GetSubSubDetector().Data(), block->GetClassName().Data() ) ); + if ( block->GetDataType().CompareTo("CLUSTERS") ) { + if ( requested ) { + AliError( Form("Block requested : %s - %s : %s/%s -> %s ", block->GetDetector().Data(), block->GetDataType().Data(), + block->GetSubDetector().Data(), block->GetSubSubDetector().Data(), block->GetClassName().Data() ) ); } - else - AliInfo( Form("Block NOT requested : %s - %s : %s/%s -> %s ", block->GetDetector().Data(), block->GetDataType().Data(), block->GetSubDetector().Data(), block->GetSubSubDetector().Data(), block->GetClassName().Data() ) ); + else { + AliError( Form("Block NOT requested : %s - %s : %s/%s -> %s ", block->GetDetector().Data(), block->GetDataType().Data(), + block->GetSubDetector().Data(), block->GetSubSubDetector().Data(), block->GetClassName().Data() ) ); + } + + } +#endif return requested; } diff --git a/EVE/EveHLT/AliEveHOMERManager.h b/EVE/EveHLT/AliEveHOMERManager.h index 4f3d6ceaf3f..d89f2d2fb9c 100644 --- a/EVE/EveHLT/AliEveHOMERManager.h +++ b/EVE/EveHLT/AliEveHOMERManager.h @@ -31,6 +31,7 @@ #include "AliHLTHOMERSourceDesc.h" #include "AliHLTHOMERBlockDesc.h" #include "AliHLTHOMERReader.h" +#include "AliEveHOMERXMLHandler.h" #include "AliTPCPreprocessorOnline.h" @@ -120,21 +121,6 @@ private: AliEveHOMERManager(const AliEveHOMERManager&); // Not implemented. AliEveHOMERManager& operator=(const AliEveHOMERManager&); // Not implemented. - /* - * --------------------------------------------------------------------------------- - * Source Handling - private - * --------------------------------------------------------------------------------- - */ - - /** Get Information out of a TDS process in XML file */ - Int_t GetTDSAttributes( TXMLNode * xmlNode ); - - /** Resolve Information of hostname and port for source which has to be used by HOMER */ - Int_t ResolveHostPortInformation( TString xmlHostname, TString xmlPort, TString &hostname, Int_t &port ); - - /** Resolve information of source */ - Int_t ResolveSourceInformation( TString xmlParent, AliHLTHOMERSourceDesc * source ); - /* * --------------------------------------------------------------------------------- * Connection Handling - private @@ -142,13 +128,13 @@ private: */ /** Create a readout list for Hostname and ports */ - void CreateReadoutList( const char** socurceHostnames, UShort_t* sourcePorts, UInt_t &sourceCount); + void CreateReadoutList( const char** sourceHostnames, UShort_t* sourcePorts, UInt_t &sourceCount); /** Checks if already connected to HOMER sources */ Bool_t IsConnected() { return fConnected; } // Checks if already connected to HOMER sources - /** Sets realm ( which can be ACR, GPN, HLT ) */ - void SetRealm( TString s ) { fRealm = s; } // Sets realm ( which can be ACR, GPN, HLT + /** Sets realm ( which can be ACR, GPN, HLT, KIP ) */ + void SetRealm( TString s ) { fXMLHandler->SetRealm(s); } // Sets realm ( which can be ACR, GPN, HLT, KIP ) /* --------------------------------------------------------------------------------- * Event Handling - private @@ -212,17 +198,14 @@ private: * --------------------------------------------------------------------------------- */ - // == XML parser == - TString fXMLFile; // XML input file - TDOMParser* fXMLParser; //! XML parser into DOM model - TXMLNode * fRootNode; //! Root node of parsed config file + // == XML handler == + AliEveHOMERXMLHandler* fXMLHandler; //! Handles HLT XML Config Files // == sources == TList * fSourceList; //! List to HOMER sources // == connection == AliHLTHOMERReader* fReader; //! Pointer to HOMER reader - TString fRealm; // Indicates the realm where AliEve can connect to ( HLT, GPN, ACR ); // == blocks == TList * fBlockList; //! List to HOMER blocks diff --git a/EVE/EveHLT/AliEveHOMERManagerEditor.cxx b/EVE/EveHLT/AliEveHOMERManagerEditor.cxx index e7939a86c6d..5d7ac5b11c4 100644 --- a/EVE/EveHLT/AliEveHOMERManagerEditor.cxx +++ b/EVE/EveHLT/AliEveHOMERManagerEditor.cxx @@ -12,6 +12,7 @@ #include #include +#include #include #include @@ -29,9 +30,11 @@ AliEveHOMERManagerEditor::AliEveHOMERManagerEditor(const TGWindow *p, Int_t widt UInt_t options, Pixel_t back) : TGedFrame(p, width, height, options | kVerticalFrame, back), fM(0), - fButt(0) - // Initialize widget pointers to 0 -{ + fButtonConnect(0), + fButtonNextEvent(0), + fButtonEventLoop(0), + fEventLoopStarted(kFALSE) { + MakeTitle("AliEveHOMERManager"); // Create widgets @@ -39,9 +42,17 @@ AliEveHOMERManagerEditor::AliEveHOMERManagerEditor(const TGWindow *p, Int_t widt // AddFrame(fXYZZ, new TGLayoutHints(...)); // fXYZZ->Connect("SignalName()", "AliEveHOMERManagerEditor", this, "DoXYZZ()"); - fButt = new TGTextButton(this, " Connect to HLT "); - AddFrame(fButt); //, new TGLayoutHints(...)); - fButt->Connect("Clicked()", "AliEveHOMERManagerEditor", this, "DoButt()"); + fButtonConnect = new TGTextButton(this, " Connect to HLT "); + AddFrame(fButtonConnect); //, new TGLayoutHints(...)); + fButtonConnect->Connect("Clicked()", "AliEveHOMERManagerEditor", this, "ConnectToHLT()"); + + fButtonNextEvent = new TGTextButton(this, " NextEvent "); + AddFrame(fButtonNextEvent); //, new TGLayoutHints(...)); + fButtonNextEvent->Connect("Clicked()", "AliEveHOMERManagerEditor", this, "NextEvent()"); + + fButtonEventLoop = new TGTextButton(this, " not yet used "); + AddFrame(fButtonEventLoop); //, new TGLayoutHints(...)); + fButtonEventLoop->Connect("Clicked()", "AliEveHOMERManagerEditor", this, "EventLoop()"); } @@ -65,9 +76,23 @@ void AliEveHOMERManagerEditor::SetModel(TObject* obj) // Update(); // } -void AliEveHOMERManagerEditor::DoButt() +void AliEveHOMERManagerEditor::ConnectToHLT() { // Connects to HOMER sources -> to HLT. fM->ConnectHOMER(); } + +void AliEveHOMERManagerEditor::NextEvent() +{ + // call next event from macro + gROOT->ProcessLineFast("nextEvent();"); + +} + +void AliEveHOMERManagerEditor::EventLoop() +{ + // Start/stop event loop + + fM->ConnectHOMER(); +} diff --git a/EVE/EveHLT/AliEveHOMERManagerEditor.h b/EVE/EveHLT/AliEveHOMERManagerEditor.h index 2b53f8ff6fb..d04e2b5b3a4 100644 --- a/EVE/EveHLT/AliEveHOMERManagerEditor.h +++ b/EVE/EveHLT/AliEveHOMERManagerEditor.h @@ -22,23 +22,31 @@ class AliEveHOMERManager; class AliEveHOMERManagerEditor : public TGedFrame { public: - AliEveHOMERManagerEditor(const TGWindow* p=0, Int_t width=170, Int_t height=30, UInt_t options = kChildFrame, Pixel_t back=GetDefaultFrameBackground()); + AliEveHOMERManagerEditor(const TGWindow* p=0, Int_t width=170, Int_t height=30, + UInt_t options = kChildFrame, Pixel_t back=GetDefaultFrameBackground()); virtual ~AliEveHOMERManagerEditor() {} virtual void SetModel(TObject* obj); // Declare callback/slot methods - void DoButt(); + void ConnectToHLT(); + void NextEvent(); + void EventLoop(); + protected: AliEveHOMERManager *fM; // Model object. - TGTextButton *fButt; // Button to connect to HOMER. + TGTextButton *fButtonConnect; // Button to connect to HOMER. + TGTextButton *fButtonNextEvent; // Button to call next Event + TGTextButton *fButtonEventLoop; // Button to start/stop event loop private: AliEveHOMERManagerEditor(const AliEveHOMERManagerEditor&); // Not implemented AliEveHOMERManagerEditor& operator=(const AliEveHOMERManagerEditor&); // Not implemented + Bool_t fEventLoopStarted; + ClassDef(AliEveHOMERManagerEditor, 0); // Editor for AliEveHOMERManager }; diff --git a/EVE/EveHLT/AliEveHOMERSrcObject.cxx b/EVE/EveHLT/AliEveHOMERSrcObject.cxx new file mode 100644 index 00000000000..bc7e8bd8a05 --- /dev/null +++ b/EVE/EveHLT/AliEveHOMERSrcObject.cxx @@ -0,0 +1,61 @@ +// $Id$ +// Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007 +// Author: Jochen Thaeder * +// for The ALICE HLT Project. * + +//-*- Mode: C++ -*- + +/** @file AliEveHOMERSrcObject.cxx + @author Jochen Thaeder + @date + @brief Src Object for Src Mapping +*/ + +#if __GNUC__>= 3 + using namespace std; +#endif + +#define use_aliroot +#define use_root +#define ROWHOUGHPARAMS +#define use_reconstruction +#define use_newio +#define ROOTVERSION "unchecked" +#define ALIROOTVERSION "unchecked" +#define __ROOT__ +#define USE_ALILOG +#define LINUX + +#include "AliEveHOMERSrcObject.h" + +//______________________________________________________________________________ +// +// Translate HLT data-sources. + +ClassImp(AliEveHOMERSrcObject) + +/* + * --------------------------------------------------------------------------------- + * Constructor / Destructor + * --------------------------------------------------------------------------------- + */ + +//################################################################################## +AliEveHOMERSrcObject::AliEveHOMERSrcObject( TString dataType, TString className, ULong_t specification ) : + fDataType(dataType), + fClassName(className), + fSpecification(specification) { + // This Class is a mapping object, which should allow, to + // add new sources out of the HLT. + // This should be only needed by AliEveHOMERSrcTranslator + + printf ("%s - %s - %lu\n", fDataType.Data(),fClassName.Data(), fSpecification); + +} + +//################################################################################## +AliEveHOMERSrcObject::~AliEveHOMERSrcObject() { + // The destructor + +} + diff --git a/EVE/EveHLT/AliEveHOMERSrcObject.h b/EVE/EveHLT/AliEveHOMERSrcObject.h new file mode 100644 index 00000000000..63c24cd424b --- /dev/null +++ b/EVE/EveHLT/AliEveHOMERSrcObject.h @@ -0,0 +1,79 @@ +// $Id$ +// 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. * + **************************************************************************/ + +//-*- Mode: C++ -*- +#ifndef ALIEVEHOMERSRCOBJECT_H +#define ALIEVEHOMERSRCOBJECT_H + +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/** @file AliEveHOMERSrcObject.h + @author Jochen Thaeder + @date + @brief Src Object for Src Mapping +*/ + +#include "TString.h" +#include "TObject.h" + +class AliEveHOMERSrcObject : public TObject +{ + public: + + /* + * --------------------------------------------------------------------------------- + * Constructor / Destructor + * --------------------------------------------------------------------------------- + */ + + /** constructor */ + AliEveHOMERSrcObject( TString dataType, TString className, ULong_t specification ); + + /** destructor */ + virtual ~AliEveHOMERSrcObject(); + + /* + * --------------------------------------------------------------------------------- + * Getter - public + * --------------------------------------------------------------------------------- + */ + + /** Returns the HLT dataType */ + TString GetDataType() { return fDataType; } // Returns the HLT dataType + + /** Returns the HLT className */ + TString GetClassName() { return fClassName; } // Returns the HLT className + + /** Returns the HLT specification in HLT */ + ULong_t GetSpecification() { return fSpecification; } // Returns the HLT specification in HLT + + /////////////////////////////////////////////////////////////////////////////////// + +private: + + AliEveHOMERSrcObject(const AliEveHOMERSrcObject&); // Not implemented. + AliEveHOMERSrcObject& operator=(const AliEveHOMERSrcObject&); // Not implemented. + + /* + * --------------------------------------------------------------------------------- + * Members - private + * --------------------------------------------------------------------------------- + */ + + TString fDataType; // Contains the HLT DataType + TString fClassName; // Contains the Classname in HLT + ULong_t fSpecification; // Contains the HLT Specification + + ClassDef(AliEveHOMERSrcObject, 0); // Object for mapping of HLT data-sources. +}; + +#endif + + diff --git a/EVE/EveHLT/AliEveHOMERSrcTranslator.cxx b/EVE/EveHLT/AliEveHOMERSrcTranslator.cxx new file mode 100644 index 00000000000..b3f6ac9049d --- /dev/null +++ b/EVE/EveHLT/AliEveHOMERSrcTranslator.cxx @@ -0,0 +1,538 @@ +// $Id$ +// Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007 +// Author: Jochen Thaeder * +// for The ALICE HLT Project. * + +//-*- Mode: C++ -*- + +/** @file AliEveHOMERSrcTranslator.cxx + @author Jochen Thaeder + @date + @brief Src Translator of HomerManger +*/ + +#if __GNUC__>= 3 + using namespace std; +#endif + +#define use_aliroot +#define use_root +#define ROWHOUGHPARAMS +#define use_reconstruction +#define use_newio +#define ROOTVERSION "unchecked" +#define ALIROOTVERSION "unchecked" +#define __ROOT__ +#define USE_ALILOG +#define LINUX + +#define EVE_DEBUG 1 +// -- -- -- -- -- -- -- +#include "AliEveHOMERSource.h" +#include "AliEveHOMERSrcTranslator.h" +#include "AliEveHOMERSrcObject.h" +// -- -- -- -- -- -- -- +#include "TString.h" +#include +#include "Riostream.h" +#include "TXMLAttr.h" +#include "TCollection.h" +#include "TList.h" +#include "TObjString.h" +#include "TObjArray.h" +// -- -- -- -- -- -- -- +#include "AliLog.h" + +//______________________________________________________________________________ +// +// Translate HLT data-sources. + +ClassImp(AliEveHOMERSrcTranslator) + +/* + * --------------------------------------------------------------------------------- + * Constructor / Destructor + * --------------------------------------------------------------------------------- + */ + +//################################################################################## + AliEveHOMERSrcTranslator::AliEveHOMERSrcTranslator( TString realm ) : + fBasePortMap(NULL), + fObjectMap(NULL), + fRealm(realm) +{ + // This Class should handle the translation of + // internal hostnames and ports to the ones used by + // HOMER according to realm, where AliEVE is running in. + + SetupPortMap(); + SetupObjectMap(); +} + +//################################################################################## +AliEveHOMERSrcTranslator::~AliEveHOMERSrcTranslator() { + // The destructor + + if ( fBasePortMap ) + delete fBasePortMap; + fBasePortMap = NULL; +} + +/* + * --------------------------------------------------------------------------------- + * Translation - public + * --------------------------------------------------------------------------------- + */ + +//################################################################################## +Int_t AliEveHOMERSrcTranslator::Translate( TString xmlNodename, TString xmlPort, + TString &hostname, Int_t &port ) { + // Translate hostname and port for source which has to be used by HOMER + // ( due to port mapping inside the HLT ) + // * param xmlNodename Nodename out of the XML + // * param xmlPort Port out of the XML + // * param hostname Return of the hostname + // * param port Return of the port + // * return 0 on sucess, 1 if port couldn't be resolved, + + Int_t iResult = 0; + + // *** Resolve hostname + hostname = ResolveHostname( xmlNodename ); + + // *** Resolve port + port = ResolvePort( xmlPort, xmlNodename ); + + if ( port == -1 ) { + AliError( Form("Error resolving port : %s", xmlPort.Data()) ); + iResult = 1; + } + + // *** Summary +#if EVE_DEBUG + if ( !iResult ) { + AliInfo( Form("%s:%i resolved out of %s:%s", hostname.Data(), port, xmlNodename.Data(), xmlPort.Data()) ); + } +#endif + + return iResult; +} + +//################################################################################## +void AliEveHOMERSrcTranslator::ApplyDetectorCorrections( TString &detector, TString &subDetector) { + // Apply corrections for differnt detectors and subdetectors */ + + // -- Correct TPC subdetector, because in we have somtimes "A","C" + if ( ! detector.CompareTo("TPC") ) { + if ( subDetector.BeginsWith('A') ) { + subDetector.Remove( TString::kLeading, 'A' ); + } + else if ( subDetector.BeginsWith('C') ) { + subDetector.Remove( TString::kLeading, 'C' ); + Int_t tmp = subDetector.Atoi() + 18; + subDetector = ""; + subDetector += tmp; + } + } + + // -- Correct for MUON + if ( ! detector.CompareTo("DIMU") ) { + detector = "MUON"; + + if ( ! subDetector.CompareTo("TRG") ) + subDetector = "1"; + else if ( ! subDetector.CompareTo("TRK") ) + subDetector = "2"; + } +} + +//################################################################################## +Int_t AliEveHOMERSrcTranslator::FillSourceDesc( AliHLTHOMERSourceDesc* source, TString name ) { + // Fill SourceDesc with object Information + + Int_t iResult = 0; + + TString detector = source->GetDetector(); + + if ( ! fObjectMap->FindObject( detector ) ) { + AliError( Form("Error mapping for detector not known : %s", detector.Data()) ); + AliError( Form("Error mapping for NAME : %s", name.Data()) ); + iResult = 1; + + return iResult; + } + + + TMap * objectMap = (TMap*) fObjectMap->GetValue( detector ); + + + + if ( ! objectMap->FindObject( name ) ) { + cout << "DET..." << detector.Data() << endl; + + source->SetSourceName( name, "" ); + source->SetSourceType( 0, "*******" ); + } + else { + AliEveHOMERSrcObject* srcObject = (AliEveHOMERSrcObject*) objectMap->FindObject( name ); + source->SetSourceName( name, srcObject->GetClassName() ); + source->SetSourceType( srcObject->GetSpecification(), srcObject->GetDataType() ); + } + + return iResult; +} + +/* + * --------------------------------------------------------------------------------- + * Source Resolving - private + * --------------------------------------------------------------------------------- + */ + +//################################################################################## +TString AliEveHOMERSrcTranslator::ResolveHostname( TString nodename ){ + // resolves the hostname, out of the XML nodename, and the realm set + + TString hostname = 0; + + // -- Set hostname according to realm + if ( ! fRealm.CompareTo( "ACR" ) ) + hostname = "alihlt-dcs0.cern.ch"; + else if ( ! fRealm.CompareTo( "GPN" ) ) + hostname = "alihlt-vobox0.cern.ch"; + else if ( ! fRealm.CompareTo( "KIP" ) ) + hostname = "alihlt-gw0.kip.uni-heidelberg.de"; + else + hostname = nodename; + + return hostname; +} + +//################################################################################## +Int_t AliEveHOMERSrcTranslator::ResolvePort( TString srcPort, TString nodename ) { + // resolves the port, out of the XML port, and the realm set + Int_t port = -1; + + if ( ! srcPort.IsDigit() ) + return port; + + if ( srcPort.Atoi() < kNodeBasePort ) + return port; + + if ( ! fBasePortMap->FindObject( nodename ) ) + return port; + + port = srcPort.Atoi(); + + if ( ! fRealm.CompareTo( "HLT" ) ) + return port; + + Int_t offset = port - kNodeBasePort; + + port = ( ( (TObjString*) fBasePortMap->GetValue(nodename) )->GetString() ).Atoi(); + port += offset; + + return port; +} + +/* + * --------------------------------------------------------------------------------- + * Setup - private + * --------------------------------------------------------------------------------- + */ + +//################################################################################## +void AliEveHOMERSrcTranslator::SetupPortMap () { + // Setup hostname to port mapping + + fBasePortMap = new TMap(); + //fBasePortMap->SetOwnerKeyValue(); + + fBasePortMap->Add( new TObjString("cntpca000"), new TObjString("49408")); + fBasePortMap->Add( new TObjString("feptpcao00"), new TObjString("49436")); + fBasePortMap->Add( new TObjString("feptpcai00"), new TObjString("49440")); + fBasePortMap->Add( new TObjString("feptpcao01"), new TObjString("49444")); + fBasePortMap->Add( new TObjString("feptpcao02"), new TObjString("49564")); + fBasePortMap->Add( new TObjString("feptpcai02"), new TObjString("49568")); + fBasePortMap->Add( new TObjString("feptpcao03"), new TObjString("49572")); + fBasePortMap->Add( new TObjString("cntpca040"), new TObjString("49664")); + fBasePortMap->Add( new TObjString("feptpcao04"), new TObjString("49692")); + fBasePortMap->Add( new TObjString("feptpcai04"), new TObjString("49696")); + fBasePortMap->Add( new TObjString("feptpcao05"), new TObjString("49700")); + fBasePortMap->Add( new TObjString("feptpcao06"), new TObjString("49820")); + fBasePortMap->Add( new TObjString("feptpcai06"), new TObjString("49824")); + fBasePortMap->Add( new TObjString("feptpcao07"), new TObjString("49828")); + fBasePortMap->Add( new TObjString("cntpca080"), new TObjString("49920")); + fBasePortMap->Add( new TObjString("feptpcao08"), new TObjString("49948")); + fBasePortMap->Add( new TObjString("feptpcai08"), new TObjString("49952")); + fBasePortMap->Add( new TObjString("feptpcao09"), new TObjString("49956")); + fBasePortMap->Add( new TObjString("feptpcao10"), new TObjString("50076")); + fBasePortMap->Add( new TObjString("feptpcai10"), new TObjString("50080")); + fBasePortMap->Add( new TObjString("feptpcao11"), new TObjString("50084")); + fBasePortMap->Add( new TObjString("cntpca120"), new TObjString("50176")); + fBasePortMap->Add( new TObjString("feptpcao12"), new TObjString("50204")); + fBasePortMap->Add( new TObjString("feptpcai12"), new TObjString("50208")); + fBasePortMap->Add( new TObjString("feptpcao13"), new TObjString("50212")); + fBasePortMap->Add( new TObjString("feptpcao14"), new TObjString("50332")); + fBasePortMap->Add( new TObjString("feptpcai14"), new TObjString("50336")); + fBasePortMap->Add( new TObjString("feptpcao15"), new TObjString("50340")); + fBasePortMap->Add( new TObjString("cntpca160"), new TObjString("50432")); + fBasePortMap->Add( new TObjString("feptpcao16"), new TObjString("50460")); + fBasePortMap->Add( new TObjString("feptpcai16"), new TObjString("50464")); + fBasePortMap->Add( new TObjString("feptpcao17"), new TObjString("50468")); + fBasePortMap->Add( new TObjString("cntrd0"), new TObjString("54144")); + fBasePortMap->Add( new TObjString("feptrd00"), new TObjString("54168")); + fBasePortMap->Add( new TObjString("feptrd04"), new TObjString("54172")); + fBasePortMap->Add( new TObjString("feptrd08"), new TObjString("54176")); + fBasePortMap->Add( new TObjString("feptrd10"), new TObjString("54180")); + fBasePortMap->Add( new TObjString("feptrd14"), new TObjString("54184")); + fBasePortMap->Add( new TObjString("feptpcco16"), new TObjString("54428")); + fBasePortMap->Add( new TObjString("feptpcci16"), new TObjString("54432")); + fBasePortMap->Add( new TObjString("feptpcco17"), new TObjString("54436")); + fBasePortMap->Add( new TObjString("feptpcco14"), new TObjString("54556")); + fBasePortMap->Add( new TObjString("feptpcci14"), new TObjString("54560")); + fBasePortMap->Add( new TObjString("feptpcco15"), new TObjString("54564")); + fBasePortMap->Add( new TObjString("cntpcc120"), new TObjString("54656")); + fBasePortMap->Add( new TObjString("feptpcco12"), new TObjString("54684")); + fBasePortMap->Add( new TObjString("feptpcci12"), new TObjString("54688")); + fBasePortMap->Add( new TObjString("feptpcco13"), new TObjString("54692")); + fBasePortMap->Add( new TObjString("feptpcco10"), new TObjString("54812")); + fBasePortMap->Add( new TObjString("feptpcci10"), new TObjString("54816")); + fBasePortMap->Add( new TObjString("feptpcco11"), new TObjString("54820")); + fBasePortMap->Add( new TObjString("cntpcc080"), new TObjString("54912")); + fBasePortMap->Add( new TObjString("feptpcco08"), new TObjString("54940")); + fBasePortMap->Add( new TObjString("feptpcci08"), new TObjString("54944")); + fBasePortMap->Add( new TObjString("feptpcco09"), new TObjString("54948")); + fBasePortMap->Add( new TObjString("feptpcco06"), new TObjString("55068")); + fBasePortMap->Add( new TObjString("feptpcci06"), new TObjString("55072")); + fBasePortMap->Add( new TObjString("feptpcco07"), new TObjString("55076")); + fBasePortMap->Add( new TObjString("cntpcc040"), new TObjString("55168")); + fBasePortMap->Add( new TObjString("feptpcco04"), new TObjString("55196")); + fBasePortMap->Add( new TObjString("feptpcci04"), new TObjString("55200")); + fBasePortMap->Add( new TObjString("feptpcco05"), new TObjString("55204")); + fBasePortMap->Add( new TObjString("feptpcco02"), new TObjString("55324")); + fBasePortMap->Add( new TObjString("feptpcci02"), new TObjString("55328")); + fBasePortMap->Add( new TObjString("feptpcco03"), new TObjString("55332")); + fBasePortMap->Add( new TObjString("cntpcc000"), new TObjString("55424")); + fBasePortMap->Add( new TObjString("feptpcco00"), new TObjString("55452")); + fBasePortMap->Add( new TObjString("feptpcci00"), new TObjString("55456")); + fBasePortMap->Add( new TObjString("feptpcco01"), new TObjString("55460")); + fBasePortMap->Add( new TObjString("cnspd0"), new TObjString("57728")); + fBasePortMap->Add( new TObjString("fepspd0"), new TObjString("57752")); + fBasePortMap->Add( new TObjString("fepspd1"), new TObjString("57756")); + fBasePortMap->Add( new TObjString("fepspd2"), new TObjString("57760")); + fBasePortMap->Add( new TObjString("fepspd3"), new TObjString("57764")); + fBasePortMap->Add( new TObjString("fepspd4"), new TObjString("57768")); + fBasePortMap->Add( new TObjString("cnssd0"), new TObjString("57856")); + fBasePortMap->Add( new TObjString("fepssd0"), new TObjString("57880")); + fBasePortMap->Add( new TObjString("fepssd1"), new TObjString("57884")); + fBasePortMap->Add( new TObjString("fepssd2"), new TObjString("57888")); + fBasePortMap->Add( new TObjString("fepssd3"), new TObjString("57892")); + fBasePortMap->Add( new TObjString("fepphos4"), new TObjString("57896")); + fBasePortMap->Add( new TObjString("fepsdd5"), new TObjString("57896")); + fBasePortMap->Add( new TObjString("fephmpid0"), new TObjString("58008")); + fBasePortMap->Add( new TObjString("fepsdd0"), new TObjString("58008")); + fBasePortMap->Add( new TObjString("fephmpid1"), new TObjString("58012")); + fBasePortMap->Add( new TObjString("fepsdd1"), new TObjString("58012")); + fBasePortMap->Add( new TObjString("fephmpid2"), new TObjString("58016")); + fBasePortMap->Add( new TObjString("fepsdd2"), new TObjString("58016")); + fBasePortMap->Add( new TObjString("fephmpid3"), new TObjString("58020")); + fBasePortMap->Add( new TObjString("fepsdd3"), new TObjString("58020")); + fBasePortMap->Add( new TObjString("fepphos1"), new TObjString("58024")); + fBasePortMap->Add( new TObjString("fepsdd4"), new TObjString("58024")); + fBasePortMap->Add( new TObjString("feptriggerdet"), new TObjString("58140")); + fBasePortMap->Add( new TObjString("fepfmdaccorde"), new TObjString("58144")); + fBasePortMap->Add( new TObjString("fephltout0"), new TObjString("58400")); + fBasePortMap->Add( new TObjString("fephltout1"), new TObjString("58404")); + fBasePortMap->Add( new TObjString("cnphos0"), new TObjString("58624")); + fBasePortMap->Add( new TObjString("fepphos2"), new TObjString("58656")); + fBasePortMap->Add( new TObjString("fepphos3"), new TObjString("58660")); + fBasePortMap->Add( new TObjString("cndimutrg0"), new TObjString("58752")); + fBasePortMap->Add( new TObjString("fepdimutrg"), new TObjString("58784")); + fBasePortMap->Add( new TObjString("cndimutrk0"), new TObjString("58880")); + fBasePortMap->Add( new TObjString("fepdimutrk1"), new TObjString("58904")); + fBasePortMap->Add( new TObjString("fepdimutrk2"), new TObjString("58908")); + fBasePortMap->Add( new TObjString("fepdimutrk3"), new TObjString("58912")); + fBasePortMap->Add( new TObjString("fepdimutrk4"), new TObjString("58916")); + fBasePortMap->Add( new TObjString("fepdimutrk5"), new TObjString("58920")); + + +// fBasePortMap->Add( new TObjString("feptpcao00"), new TObjString("49436")); +// fBasePortMap->Add( new TObjString("feptpcai00"), new TObjString("49440")); +// fBasePortMap->Add( new TObjString("feptpcao01"), new TObjString("49444")); +// fBasePortMap->Add( new TObjString("feptpcao02"), new TObjString("49564")); +// fBasePortMap->Add( new TObjString("feptpcai02"), new TObjString("49568")); +// fBasePortMap->Add( new TObjString("feptpcao03"), new TObjString("49572")); +// fBasePortMap->Add( new TObjString("feptpcao04"), new TObjString("49692")); +// fBasePortMap->Add( new TObjString("feptpcai04"), new TObjString("49696")); +// fBasePortMap->Add( new TObjString("feptpcao05"), new TObjString("49700")); +// fBasePortMap->Add( new TObjString("feptpcao06"), new TObjString("49820")); +// fBasePortMap->Add( new TObjString("feptpcai06"), new TObjString("49824")); +// fBasePortMap->Add( new TObjString("feptpcao07"), new TObjString("49828")); +// fBasePortMap->Add( new TObjString("feptpcao08"), new TObjString("49948")); +// fBasePortMap->Add( new TObjString("feptpcai08"), new TObjString("49952")); +// fBasePortMap->Add( new TObjString("feptpcao09"), new TObjString("49956")); +// fBasePortMap->Add( new TObjString("feptpcao10"), new TObjString("50076")); +// fBasePortMap->Add( new TObjString("feptpcai10"), new TObjString("50080")); +// fBasePortMap->Add( new TObjString("feptpcao11"), new TObjString("50084")); +// fBasePortMap->Add( new TObjString("feptpcao12"), new TObjString("50204")); +// fBasePortMap->Add( new TObjString("feptpcai12"), new TObjString("50208")); +// fBasePortMap->Add( new TObjString("feptpcao13"), new TObjString("50212")); +// fBasePortMap->Add( new TObjString("feptpcao14"), new TObjString("50332")); +// fBasePortMap->Add( new TObjString("feptpcai14"), new TObjString("50336")); +// fBasePortMap->Add( new TObjString("feptpcao15"), new TObjString("50340")); +// fBasePortMap->Add( new TObjString("feptpcao16"), new TObjString("50460")); +// fBasePortMap->Add( new TObjString("feptpcai16"), new TObjString("50464")); +// fBasePortMap->Add( new TObjString("feptpcao17"), new TObjString("50468")); +// fBasePortMap->Add( new TObjString("feptrd00"), new TObjString("54168")); +// fBasePortMap->Add( new TObjString("feptrd04"), new TObjString("54172")); +// fBasePortMap->Add( new TObjString("feptrd08"), new TObjString("54176")); +// fBasePortMap->Add( new TObjString("feptrd10"), new TObjString("54180")); +// fBasePortMap->Add( new TObjString("feptrd14"), new TObjString("54184")); +// fBasePortMap->Add( new TObjString("feptpcco16"), new TObjString("54428")); +// fBasePortMap->Add( new TObjString("feptpcci16"), new TObjString("54432")); +// fBasePortMap->Add( new TObjString("feptpcco17"), new TObjString("54436")); +// fBasePortMap->Add( new TObjString("feptpcco14"), new TObjString("54556")); +// fBasePortMap->Add( new TObjString("feptpcci14"), new TObjString("54560")); +// fBasePortMap->Add( new TObjString("feptpcco15"), new TObjString("54564")); +// fBasePortMap->Add( new TObjString("feptpcco12"), new TObjString("54684")); +// fBasePortMap->Add( new TObjString("feptpcci12"), new TObjString("54688")); +// fBasePortMap->Add( new TObjString("feptpcco13"), new TObjString("54692")); +// fBasePortMap->Add( new TObjString("feptpcco10"), new TObjString("54812")); +// fBasePortMap->Add( new TObjString("feptpcci10"), new TObjString("54816")); +// fBasePortMap->Add( new TObjString("feptpcco11"), new TObjString("54820")); +// fBasePortMap->Add( new TObjString("feptpcco08"), new TObjString("54940")); +// fBasePortMap->Add( new TObjString("feptpcci08"), new TObjString("54944")); +// fBasePortMap->Add( new TObjString("feptpcco09"), new TObjString("54948")); +// fBasePortMap->Add( new TObjString("feptpcco06"), new TObjString("55068")); +// fBasePortMap->Add( new TObjString("feptpcci06"), new TObjString("55072")); +// fBasePortMap->Add( new TObjString("feptpcco07"), new TObjString("55076")); +// fBasePortMap->Add( new TObjString("feptpcco04"), new TObjString("55196")); +// fBasePortMap->Add( new TObjString("feptpcci04"), new TObjString("55200")); +// fBasePortMap->Add( new TObjString("feptpcco05"), new TObjString("55204")); +// fBasePortMap->Add( new TObjString("feptpcco02"), new TObjString("55324")); +// fBasePortMap->Add( new TObjString("feptpcci02"), new TObjString("55328")); +// fBasePortMap->Add( new TObjString("feptpcco03"), new TObjString("55332")); +// fBasePortMap->Add( new TObjString("feptpcco00"), new TObjString("55452")); +// fBasePortMap->Add( new TObjString("feptpcci00"), new TObjString("55456")); +// fBasePortMap->Add( new TObjString("feptpcco01"), new TObjString("55460")); +// fBasePortMap->Add( new TObjString("fepspd0"), new TObjString("57752")); +// fBasePortMap->Add( new TObjString("fepspd1"), new TObjString("57756")); +// fBasePortMap->Add( new TObjString("fepspd2"), new TObjString("57760")); +// fBasePortMap->Add( new TObjString("fepspd3"), new TObjString("57764")); +// fBasePortMap->Add( new TObjString("fepspd4"), new TObjString("57768")); +// fBasePortMap->Add( new TObjString("fepssd0"), new TObjString("57880")); +// fBasePortMap->Add( new TObjString("fepssd1"), new TObjString("57884")); +// fBasePortMap->Add( new TObjString("fepssd2"), new TObjString("57888")); +// fBasePortMap->Add( new TObjString("fepssd3"), new TObjString("57892")); +// fBasePortMap->Add( new TObjString("feptriggerdet"), new TObjString("58140")); +// fBasePortMap->Add( new TObjString("fepfmdaccorde"), new TObjString("58144")); +// fBasePortMap->Add( new TObjString("fephmpid0"), new TObjString("58264")); +// fBasePortMap->Add( new TObjString("fephmpid1"), new TObjString("58268")); +// fBasePortMap->Add( new TObjString("fephmpid2"), new TObjString("58272")); +// fBasePortMap->Add( new TObjString("fephmpid3"), new TObjString("58276")); +// fBasePortMap->Add( new TObjString("fephltout0"), new TObjString("58400")); +// fBasePortMap->Add( new TObjString("fephltout1"), new TObjString("58404")); +// fBasePortMap->Add( new TObjString("fepphos2"), new TObjString("58656")); +// fBasePortMap->Add( new TObjString("fepphos3"), new TObjString("58660")); +// fBasePortMap->Add( new TObjString("fepphos4"), new TObjString("58664")); +// fBasePortMap->Add( new TObjString("fepdimutrg"), new TObjString("58784")); +// fBasePortMap->Add( new TObjString("fepdimutrk1"), new TObjString("58904")); +// fBasePortMap->Add( new TObjString("fepdimutrk2"), new TObjString("58908")); +// fBasePortMap->Add( new TObjString("fepdimutrk3"), new TObjString("58912")); +// fBasePortMap->Add( new TObjString("fepdimutrk4"), new TObjString("58916")); +// fBasePortMap->Add( new TObjString("fepdimutrk5"), new TObjString("58920")); + +} + +//################################################################################## +void AliEveHOMERSrcTranslator::SetupObjectMap () { + // Setup hostname to port mapping + + fObjectMap = new TMap(); + // fObjectMap->SetOwnerKeyValue(); + + SetupObjectMapTPC(); + SetupObjectMapTRD(); + SetupObjectMapPHOS(); + SetupObjectMapDIMUON(); +} + +//################################################################################## +void AliEveHOMERSrcTranslator::SetupObjectMapTPC() { + //Setup the Object mapping for TPC + + TMap* objectMap = new TMap(); + fObjectMap->Add( new TObjString("TPC"), objectMap ); + + SetupObjectMapCommon( objectMap ); + + objectMap->Add( new TObjString("CF"), new AliEveHOMERSrcObject( "AliHLTTPCClusterDataFormat", "CLUSTERS", 0 ) ); + objectMap->Add( new TObjString("RelayCF"), new AliEveHOMERSrcObject( "AliHLTTPCClusterDataFormat", "CLUSTERS", 0 ) ); + objectMap->Add( new TObjString("CalibPedestal"), new AliEveHOMERSrcObject( "AliTPCCalibPedestal", "HIS_CAL", 0 ) ); + objectMap->Add( new TObjString("CalibPulser"), new AliEveHOMERSrcObject( "AliTPCCalibPulser", "HIS_CAL", 0 ) ); + objectMap->Add( new TObjString("ESDConv"), new AliEveHOMERSrcObject( "TTree", "ESD_TREE", 0 ) ); + objectMap->Add( new TObjString("ESDCM"), new AliEveHOMERSrcObject( "TTree", "ESD_TREE", 0 ) ); + objectMap->Add( new TObjString("ESDCA"), new AliEveHOMERSrcObject( "TTree", "ESD_TREE", 0 ) ); + objectMap->Add( new TObjString("RelayESD"), new AliEveHOMERSrcObject( "TTree", "ESD_TREE", 0 ) ); + objectMap->Add( new TObjString("KRCF"), new AliEveHOMERSrcObject( "TH1F", "ROOTHIST", 0 ) ); + objectMap->Add( new TObjString("RelayKR"), new AliEveHOMERSrcObject( "TH1F", "ROOTHIST", 0 ) ); + objectMap->Add( new TObjString("CLHI"), new AliEveHOMERSrcObject( "TH1F", "ROOTHIST", 0 ) ); + objectMap->Add( new TObjString("RelayCLHI"), new AliEveHOMERSrcObject( "TH1F", "ROOTHIST", 0 ) ); + objectMap->Add( new TObjString("NM"), new AliEveHOMERSrcObject( "TH1F", "ROOTHIST", 0 ) ); + objectMap->Add( new TObjString("HH"), new AliEveHOMERSrcObject( "TH1F", "ROOTHIST", 0 ) ); + +} + +//################################################################################## +void AliEveHOMERSrcTranslator::SetupObjectMapTRD(){ + //Setup the Object mapping for TRD + + TMap* objectMap = new TMap(); + fObjectMap->Add( new TObjString("TRD"), objectMap ); + + SetupObjectMapCommon( objectMap ); + +} + +//################################################################################## +void AliEveHOMERSrcTranslator::SetupObjectMapPHOS(){ + //Setup the Object mapping for PHOS + + TMap* objectMap = new TMap(); + fObjectMap->Add( new TObjString("PHOS"), objectMap ); + + SetupObjectMapCommon( objectMap ); + + +} + +//################################################################################## +void AliEveHOMERSrcTranslator::SetupObjectMapDIMUON(){ + //Setup the Object mapping for DIMUON + + TMap* objectMap = new TMap(); + fObjectMap->Add( new TObjString("MUON"), objectMap ); + + objectMap->Add( new TObjString("RECHITS"), new AliEveHOMERSrcObject( "", "RECHITS", 0 ) ); + objectMap->Add( new TObjString("TRIGRECS"), new AliEveHOMERSrcObject( "", "TRIGRECS", 0 ) ); + objectMap->Add( new TObjString("DECIDSIN"), new AliEveHOMERSrcObject( "", "DECIDSIN", 0 ) ); + objectMap->Add( new TObjString("DECIDPAR"), new AliEveHOMERSrcObject( "", "DECIDPAR", 0 ) ); + objectMap->Add( new TObjString("MANTRACK"), new AliEveHOMERSrcObject( "", "MANTRACK", 0 ) ); + + + SetupObjectMapCommon( objectMap ); + + +} + +//################################################################################## +void AliEveHOMERSrcTranslator::SetupObjectMapCommon( TMap* objectMap) { + // Setup the common Object mappings + + objectMap->Add( new TObjString("RP"), new AliEveHOMERSrcObject( "", "DDL_RAW", 0 ) ); + objectMap->Add( new TObjString("FP"), new AliEveHOMERSrcObject( "", "DDL_RAW", 0 ) ); + objectMap->Add( new TObjString("Relay"), new AliEveHOMERSrcObject( "", "DDL_RAW", 0 ) ); +} + + + diff --git a/EVE/EveHLT/AliEveHOMERSrcTranslator.h b/EVE/EveHLT/AliEveHOMERSrcTranslator.h new file mode 100644 index 00000000000..b59f9edf92b --- /dev/null +++ b/EVE/EveHLT/AliEveHOMERSrcTranslator.h @@ -0,0 +1,142 @@ +//-*- Mode: C++ -*- +// $Id$ +// 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. * + **************************************************************************/ + +#ifndef ALIEVEHOMERSRCTRANSLATOR_H +#define ALIEVEHOMERSRCTRANSLATOR_H + +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/** @file AliEveHOMERSrcTranslator.h + @author Jochen Thaeder + @date + @brief Src Translator of HomerManger +*/ + +#include "TString.h" +#include "TDOMParser.h" +#include "TXMLNode.h" +#include "TList.h" + +#include "AliEveHOMERSourceList.h" +#include "AliHLTHOMERSourceDesc.h" + +#include "TMap.h" + +class AliEveHOMERSrcTranslator : public TObject +{ +public: + + /* + * --------------------------------------------------------------------------------- + * Constructor / Destructor + * --------------------------------------------------------------------------------- + */ + + /** constructor */ + AliEveHOMERSrcTranslator( TString realm ); + + /** destructor */ + virtual ~AliEveHOMERSrcTranslator(); + + /* + * --------------------------------------------------------------------------------- + * Setter - public + * --------------------------------------------------------------------------------- + */ + + /** Sets realm ( which can be ACR, GPN, HLT, KIP ) */ + void SetRealm( TString s ) { fRealm = s; } // Sets realm ( which can be ACR, GPN, HLT, KIP ) + + /* + * --------------------------------------------------------------------------------- + * Translation - public + * --------------------------------------------------------------------------------- + */ + + /** Resolve Information of nodename and port for source which has to be used by HOMER */ + Int_t Translate( TString Nodename, TString xmlPort, TString &hostname, Int_t &port ); + + /** Apply corrections for differnt detectors and subdetectors */ + void ApplyDetectorCorrections( TString &detector, TString &subDetector); + + /** Fill SourceDesc with object Information */ + Int_t FillSourceDesc( AliHLTHOMERSourceDesc* source, TString name ); + + /////////////////////////////////////////////////////////////////////////////////// + +private: + + AliEveHOMERSrcTranslator(const AliEveHOMERSrcTranslator&); // Not implemented. + AliEveHOMERSrcTranslator& operator=(const AliEveHOMERSrcTranslator&); // Not implemented. + + /* + * --------------------------------------------------------------------------------- + * Source Resolving - private + * --------------------------------------------------------------------------------- + */ + + /** Resolve hostname out of XML and realm */ + TString ResolveHostname( TString nodename ); + + /** Resolve port out of XML and realm */ + Int_t ResolvePort( TString srcPort, TString srcHostname ); + + /* + * --------------------------------------------------------------------------------- + * Setup - private + * --------------------------------------------------------------------------------- + */ + + /** Setup the BasePort mapping */ + void SetupPortMap(); + + /** Setup the Object mapping */ + void SetupObjectMap(); + + /** Setup the Object mapping for TPC */ + void SetupObjectMapTPC(); + + /** Setup the Object mapping for TRD */ + void SetupObjectMapTRD(); + + /** Setup the Object mapping for PHOS */ + void SetupObjectMapPHOS(); + + /** Setup the Object mapping for DIMUON */ + void SetupObjectMapDIMUON(); + + /** Setup the common Object mappings */ + void SetupObjectMapCommon( TMap* objectMap ); + + /* + * --------------------------------------------------------------------------------- + * Members - private + * --------------------------------------------------------------------------------- + */ + + TMap* fBasePortMap; //! Map of BasePorts on the gateways + + TMap* fObjectMap; //! Map of Objects and DataTypes + + TString fRealm; // Indicates the realm where AliEve can connect to ( HLT, GPN, ACR, KIP ); + + /* + * --------------------------------------------------------------------------------- + * Constants - private + * --------------------------------------------------------------------------------- + */ + + static const Int_t kNodeBasePort = 49152; // BasePort of TCP ports on the nodes + + ClassDef(AliEveHOMERSrcTranslator, 0); // Translate HLT data-sources. +}; + +#endif diff --git a/EVE/EveHLT/AliEveHOMERXMLHandler.cxx b/EVE/EveHLT/AliEveHOMERXMLHandler.cxx new file mode 100644 index 00000000000..e4b4751127c --- /dev/null +++ b/EVE/EveHLT/AliEveHOMERXMLHandler.cxx @@ -0,0 +1,346 @@ +// $Id: +// Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007 +// Author: Jochen Thaeder * +// for The ALICE HLT Project. * + +//-*- Mode: C++ -*- + +/** @file AliEveHOMERXMLHandler.cxx + @author Jochen Thaeder + @date + @brief Src Translator of HomerManger +*/ + +#if __GNUC__>= 3 + using namespace std; +#endif + +#define use_aliroot +#define use_root +#define ROWHOUGHPARAMS +#define use_reconstruction +#define use_newio +#define ROOTVERSION "unchecked" +#define ALIROOTVERSION "unchecked" +#define __ROOT__ +#define USE_ALILOG +#define LINUX + +#define EVE_DEBUG 1 +// -- -- -- -- -- -- -- +#include "AliEveHOMERSource.h" +#include "AliEveHOMERXMLHandler.h" +// -- -- -- -- -- -- -- +#include "TString.h" +#include +#include "Riostream.h" +#include "TXMLAttr.h" +#include "TCollection.h" +#include "TList.h" +#include "TObjString.h" +#include "TObjArray.h" +// -- -- -- -- -- -- -- +#include "AliLog.h" + + + +//______________________________________________________________________________ +// +// Manage connections to HLT data-sources. + +ClassImp(AliEveHOMERXMLHandler) + +/* + * --------------------------------------------------------------------------------- + * Constructor / Destructor + * --------------------------------------------------------------------------------- + */ + +//################################################################################## + AliEveHOMERXMLHandler::AliEveHOMERXMLHandler( TString xmlFile ) : + fXMLFile(xmlFile), + fXMLParser(NULL), + fRootNode(NULL), + fSrcTranslator(NULL), + fSourceList(NULL) +{ + // This Class should handle the HLT XML config file. + // host the XML parser, and do all searching in the + // XML File + + Initialize(); +} + +//################################################################################## +AliEveHOMERXMLHandler::~AliEveHOMERXMLHandler() { + // The destructor + + if ( fXMLParser ) + delete fXMLParser; + fXMLParser = NULL; + + if ( fSrcTranslator != NULL ) + delete fSrcTranslator; + fSrcTranslator = NULL; + +} + +//################################################################################## +Int_t AliEveHOMERXMLHandler::Initialize() { + // Initialize the XML Parser, set the root node + + Int_t iResult = 0 ; + + // -- Initialize XML parser + if ( fXMLParser != NULL ) + delete fXMLParser; + fXMLParser = NULL; + + fXMLParser = new TDOMParser(); + fXMLParser->SetValidate( kFALSE ); + + iResult = fXMLParser->ParseFile( fXMLFile ); + if ( iResult < 0 ) { + iResult = 1; + AliError( Form("Parsing file with error: %s", fXMLParser->GetParseCodeMessage( fXMLParser->GetParseCode() )) ); + return iResult; + } + + // -- Set root node + fRootNode = fXMLParser->GetXMLDocument()->GetRootNode(); + + // -- Initialize Src Translator + fSrcTranslator = new AliEveHOMERSrcTranslator( "GPN" ); + + return iResult; +} + +//################################################################################## +Int_t AliEveHOMERXMLHandler::FillSourceList(TList *srcList) { + // Files the source list of HOMER sources + + fSourceList = srcList; + + Int_t iResult = 0; + + TXMLNode * node = NULL; + TXMLNode * prevNode = fRootNode->GetChildren(); + + // -- Loop over all nodes + while ( ( node = prevNode->GetNextNode() ) ) { + prevNode = node; + + // -- Find only "Process" nodes, otherwise continue to next node + if ( strcmp( node->GetNodeName(), "Proc" ) != 0 ) + continue; + + // -- Get Attributes of current node + TList *attrList = node->GetAttributes(); + TXMLAttr *attr = 0; + TIter next(attrList); + + while ( ( attr = (TXMLAttr*)next() ) ) { + + // -- Find "ID" attribute, otherwise continue to next attribute + if ( strcmp( attr->GetName(), "ID" ) != 0 ) + continue; + + TString nodeId( attr->GetValue() ); + + // -- Find only TDS processes + TObjArray * nodeIdTok = nodeId.Tokenize("_"); + + for ( Int_t ii=0 ; ii < nodeIdTok->GetEntries() ; ii++ ) { + + if ( ! ( (TObjString*) nodeIdTok->At(ii) )->GetString().CompareTo("TDS") ) { + + iResult = AddSourceTDS( node->GetChildren() ); + if ( iResult ) { + AliError( Form("Error processing TDS process : %s", nodeId.Data()) ); + } + + } + + } // for ( Int_t ii=0 ; ii < nodeIdTok->GetEntries() ; ii++ ) { + + } // while ( ( attr = (TXMLAttr*)next() ) ) { + + } // while ( ( node = prevNode->GetNextNode() ) ) { + + return iResult; +} + +//################################################################################## +Int_t AliEveHOMERXMLHandler::AddSourceTDS( TXMLNode * xmlNode ) { + // Get Information out of a TDS process in XML file + // * param xmlNode Pointer to childs of TDS node + // * return 0 on sucess, > 0 on errorsee header file for class documentation + + Int_t iResult = 0; + + TXMLNode * attrNode = NULL; + TXMLNode * prevNode = xmlNode; + + TString xmlHostname = 0; + TString xmlPort = 0; + + TString hostname = 0; + Int_t port = 0; + + // -- Get hostname and port from TDS node out of XML + while ( ( attrNode = prevNode->GetNextNode() ) ) { + prevNode = attrNode; + + // -- Get port out of the commandline + if ( strcmp( attrNode->GetNodeName(), "Cmd" ) == 0 ) { + TString cmd( attrNode->GetText() ); + + TObjArray * cmdTok = cmd.Tokenize(" "); + xmlPort = ((TObjString*) cmdTok->At(2))->GetString(); + } + // -- Get hostname + else if ( strcmp( attrNode->GetNodeName(), "Node" ) == 0 ) + xmlHostname = attrNode->GetText(); + + } // while ( ( attrNode = prevNode->GetNextNode() ) ) { + + TString xmlNodename = GetNodename( xmlHostname ); + + // -- Resolve hostname and port information -- + iResult = fSrcTranslator->Translate( xmlNodename, xmlPort, hostname, port ); + if ( iResult ) { + if ( iResult == 1 ) + { AliError( Form("Error resolving hostname : %s", xmlHostname.Data()) ); } + else if ( iResult == 2 ) + { AliError( Form("Error resolving port : %s", xmlPort.Data()) ); } + return iResult; + } + + // -- Reset loop to TDS node + prevNode = xmlNode; + + // -- Get Sources out of XML, resolve sources, add to sources List + while ( ( attrNode = prevNode->GetNextNode() ) ) { + prevNode = attrNode; + + // Find only "Parent" tags, otherwise continue to next tag + if ( strcmp( attrNode->GetNodeName(), "Parent" ) != 0 ) + continue; + + TString xmlParent = attrNode->GetText(); + + AliHLTHOMERSourceDesc * source = new AliHLTHOMERSourceDesc( hostname, port ); + + if ( FillSourceInformation( xmlParent, source ) ) { + AliError( Form("Error resolving source : %s", xmlParent.Data()) ); + iResult = 3; + delete source; + } + else { + fSourceList->Add( source ); +#if EVE_DEBUG + AliInfo( Form("New Source added : %s", xmlParent.Data()) ); +#endif + } + + } // while ( ( attrNode = prevNode->GetNextNode() ) ) { + + return iResult; +} + +//################################################################################## +Int_t AliEveHOMERXMLHandler::FillSourceInformation( TString xmlParent, AliHLTHOMERSourceDesc *source ) { + // Resolve information of source + // * param xmlParent ParentString out of the XML + // * param source Return the filled AliHLTHOMERSourceDesc object + // * return 0 on sucess, 1 on errorsee header file for class documentation + + Int_t iResult = 0; + + if ( ! xmlParent.Contains( "_" ) ) { + AliError( Form("Source %s could not be resolved", xmlParent.Data() ) ); + iResult = 1; + + return iResult; + } + + // -- Get detector / subDetector / subSubDetector + TObjArray * parentTokens = xmlParent.Tokenize("_"); + Int_t nParentTokens = parentTokens->GetEntries(); + + TString detector = ((TObjString*) parentTokens->At(0) )->GetString(); + TString subDetector = ""; + TString subSubDetector = ""; + TString name = ((TObjString*) parentTokens->At(1) )->GetString(); + + if ( nParentTokens == 3 ) + subDetector = ((TObjString*) parentTokens->At(2) )->GetString(); + else if ( nParentTokens == 4 ) { + subDetector = ((TObjString*) parentTokens->At(2) )->GetString(); + subSubDetector = ((TObjString*) parentTokens->At(3) )->GetString(); + } + + // -- Apply detector corrections + fSrcTranslator->ApplyDetectorCorrections( detector, subDetector ); + + // -- Remove Leading '0' in sub detector and subsubdetector + subDetector.Remove( TString::kLeading, '0' ); + subSubDetector.Remove( TString::kLeading, '0' ); + + // -- Set detector / subDetector / subSubDetector + source->SetDetectors( detector, subDetector, subSubDetector ); + + // -- Fill dataType / specification / className + iResult = fSrcTranslator->FillSourceDesc( source, name ); + +#if EVE_DEBUG + AliInfo( Form("Set Source %s , Type %s, ClassName %s .", name.Data(), + source->GetDataType().Data(), source->GetClassName().Data()) ); + AliInfo( Form(" Detector %s , SubDetector : %s, SubSubDetector %s .", + detector.Data(), subDetector.Data(), subSubDetector.Data()) ); +#endif + + return iResult; +} + +//################################################################################## +TString AliEveHOMERXMLHandler::GetNodename( TString xmlHostname ) { + // Get xml nodename out of xml hostname + + TString nodename = 0; + + TXMLNode * node = NULL; + TXMLNode * prevNode = fRootNode->GetChildren(); + + while ( node = prevNode->GetNextNode() ) { + prevNode = node; + + // -- Find only "Node" nodes, otherwise continue + if ( strcmp( node->GetNodeName(), "Node" ) != 0 ) + continue; + + // -- Get Attributes of current node + TList *attrList = node->GetAttributes(); + TXMLAttr *attr = 0; + TIter next(attrList); + + TString nodeId = 0; + + // Get "nodeID" and "nodeName" of this "Node" node + while ( ( attr = (TXMLAttr*)next() ) ) { + if ( strcmp( attr->GetName(), "ID" ) == 0 ) + nodeId = attr->GetValue(); + else if ( strcmp( attr->GetName(), "hostname" ) == 0 ) + nodename = attr->GetValue(); + } + + // -- if this is not the correct "nodeID" continue + if ( nodeId != xmlHostname ) + continue; + + break; + + } // while ( node = prevNode->GetNextNode() ) { + + return nodename; +} diff --git a/EVE/EveHLT/AliEveHOMERXMLHandler.h b/EVE/EveHLT/AliEveHOMERXMLHandler.h new file mode 100644 index 00000000000..a2a346fb8ce --- /dev/null +++ b/EVE/EveHLT/AliEveHOMERXMLHandler.h @@ -0,0 +1,106 @@ +// $Id: +// 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. * + **************************************************************************/ + +//-*- Mode: C++ -*- +#ifndef ALIEVEHOMERXMLHANDLER_H +#define ALIEVEHOMERXMLHANDLER_H + +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/** @file AliEveHOMERXMLHandler.h + @author Jochen Thaeder + @date + @brief XML Handler for HomerManger +*/ + +#include "TString.h" +#include "TDOMParser.h" +#include "TXMLNode.h" +#include "TList.h" + +#include "AliEveHOMERSrcTranslator.h" +#include "AliHLTHOMERSourceDesc.h" + + +class AliEveHOMERXMLHandler : public TObject +{ +public: + + /* + * --------------------------------------------------------------------------------- + * Constructor / Destructor + * --------------------------------------------------------------------------------- + */ + + /** constructor */ + AliEveHOMERXMLHandler( TString xmlFile ); + + /** destructor */ + virtual ~AliEveHOMERXMLHandler(); + + /* + * --------------------------------------------------------------------------------- + * Source List - public + * --------------------------------------------------------------------------------- + */ + + /** Fill's source list, with entries */ + Int_t FillSourceList(TList *srcList); + + /** Sets realm ( which can be ACR, GPN, HLT, KIP ) */ + void SetRealm( TString s ) { fSrcTranslator->SetRealm(s); } // Sets realm ( which can be ACR, GPN, HLT, KIP ) + + + /////////////////////////////////////////////////////////////////////////////////// + +private: + + AliEveHOMERXMLHandler(const AliEveHOMERXMLHandler&); // Not implemented. + AliEveHOMERXMLHandler& operator=(const AliEveHOMERXMLHandler&); // Not implemented. + + /* + * --------------------------------------------------------------------------------- + * Source Resolving - private + * --------------------------------------------------------------------------------- + */ + + /** Initialize the XML Handler, create the SrcTranslator */ + Int_t Initialize(); + + /** Get Information out of a TDS process in XML file */ + Int_t AddSourceTDS( TXMLNode * xmlNode ); + + /** Get xml nodename out of xml hostname */ + TString GetNodename( TString xmlHostname ); + + /** Resolve information of source */ + Int_t FillSourceInformation( TString xmlParent, AliHLTHOMERSourceDesc * source ); + + /* + * --------------------------------------------------------------------------------- + * Members - private + * --------------------------------------------------------------------------------- + */ + + // == XML parser == + TString fXMLFile; // XML input file + TDOMParser* fXMLParser; //! XML parser into DOM model + TXMLNode* fRootNode; //! Root node of parsed config file + + // == Source Translator == + AliEveHOMERSrcTranslator* fSrcTranslator; //! Translates HOMER sources to real hostname,port + + // == Sources List == + TList* fSourceList; //! List to HOMER sources + + ClassDef(AliEveHOMERXMLHandler, 0); // Handles HLT xml sources. +}; + +#endif diff --git a/EVE/EveHLT/LinkDef.h b/EVE/EveHLT/LinkDef.h index 9aee420b6c8..d4d097a81bc 100644 --- a/EVE/EveHLT/LinkDef.h +++ b/EVE/EveHLT/LinkDef.h @@ -15,5 +15,9 @@ #pragma link C++ class AliEveHOMERManagerEditor+; #pragma link C++ class AliEveHOMERSource+; #pragma link C++ class AliEveHOMERSourceList+; - #pragma link C++ class AliEveHOMERSourceMap+; + +#pragma link C++ class AliEveHOMERSrcTranslator+; +#pragma link C++ class AliEveHOMERSrcObject+; + +#pragma link C++ class AliEveHOMERXMLHandler+; diff --git a/EVE/hlt-macros/ReadESDTree.C b/EVE/hlt-macros/ReadESDTree.C new file mode 100644 index 00000000000..46c9c854495 --- /dev/null +++ b/EVE/hlt-macros/ReadESDTree.C @@ -0,0 +1,10 @@ +int ReadESDTree(TString fileName = "ESD_TPC.root") +{ + TFile *esdFile = TFile::Open(fileName.Data()); + AliESDEvent *esdEvent = new AliESDEvent(); + TTree *tr = (TTree*)esdFile->Get("esdTree"); + esdEvent->ReadFromTree(tr); + tr->StartViewer(); + + return 0; +} diff --git a/EVE/hlt-macros/geom_hlt.C b/EVE/hlt-macros/geom_hlt.C index 2b93099684a..67c6ff51401 100644 --- a/EVE/hlt-macros/geom_hlt.C +++ b/EVE/hlt-macros/geom_hlt.C @@ -10,6 +10,7 @@ #include "AliEveMUONData.h" #include "AliEveMUONChamber.h" +#include "AliCDBManager.h" #include "TEveGeoShapeExtract.h" #include "TEveGeoNode.h" @@ -25,6 +26,7 @@ TEveGeoShape* geom_hlt() TFile f("$ALICE_ROOT/EVE/alice-data/gentle_geo.root"); TEveGeoShapeExtract* gse = (TEveGeoShapeExtract*) f.Get("Gentle"); TEveGeoShape* gsre = TEveGeoShape::ImportShapeExtract(gse, 0); + gEve->AddGlobalElement(gsre); f.Close(); TEveElement* elTRD = gsre->FindChild("TRD+TOF"); @@ -42,41 +44,43 @@ TEveGeoShape* geom_hlt() return gsre; } +//#if 0 + Int_t MUON_geom() { + gStyle->SetPalette(1, 0); + gEve->DisableRedraw(); - AliEveMUONChamber* mucha[14]; + AliCDBManager *cdb = AliCDBManager::Instance(); + cdb->SetDefaultStorage("local://$ALICE_ROOT"); + cdb->SetRun(0); + AliEveMUONData *g_muon_data = new AliEveMUONData; - AliEveMUONData * g_muon_data = new AliEveMUONData; + TEveElementList* l = new TEveElementList("MUONChambers"); + l->SetTitle("MUON chambers"); + l->SetMainColor(2); + gEve->AddGlobalElement(l); - gStyle->SetPalette(1, 0); + for (Int_t ic = 0; ic < 14; ic++) + { + AliEveMUONChamber* mucha = new AliEveMUONChamber(ic); - gEve->DisableRedraw(); + mucha->SetFrameColor(2); + mucha->SetChamberID(ic); - TEveElementList* mul = new TEveElementList("MUONChambers"); - TEveElementList* muChData = new TEveElementList("MUONChamberData"); - mul->SetTitle("MUON chambers"); - mul->SetMainColor(3); - gEve->AddGlobalElement(mul); - gEve->AddElement(muChData); - - for (Int_t ic = 0; ic < 14; ic++){ - - mucha[ic] = new AliEveMUONChamber(ic); - - mucha[ic]->SetFrameColor(3); - mucha[ic]->SetChamberID(ic); - - mucha[ic]->SetDataSource(g_muon_data); - - gEve->AddElement(mucha[ic], mul); - + mucha->SetDataSource(g_muon_data); + + gEve->AddElement(mucha, l); } gEve->Redraw3D(kTRUE); gEve->EnableRedraw(); + + return true; } + +//#endif diff --git a/EVE/hlt-macros/hlt_structs.C b/EVE/hlt-macros/hlt_structs.C index 71ff8addd45..6eb779e22f0 100644 --- a/EVE/hlt-macros/hlt_structs.C +++ b/EVE/hlt-macros/hlt_structs.C @@ -6,6 +6,7 @@ * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for * * full copyright notice. * **************************************************************************/ + #include #include "TEveElement.h" #include "TPolyMarker3D.h" @@ -20,6 +21,7 @@ struct AliHLTTPCSpacePointData Float_t fSigmaY2; //error (former width) of the clusters Float_t fSigmaZ2; //error (former width) of the clusters UInt_t fCharge; + UInt_t fMaxQ; // QMax of cluster Bool_t fUsed; // only used in AliHLTTPCDisplay Int_t fTrackN; // only used in AliHLTTPCDisplay }; diff --git a/EVE/hlt-macros/homer_display.C b/EVE/hlt-macros/homer_display.C index 0404fd58d78..cbb79eb9b7f 100644 --- a/EVE/hlt-macros/homer_display.C +++ b/EVE/hlt-macros/homer_display.C @@ -16,12 +16,8 @@ // // nextEvent() will get next event from HOMER. -#include "TTimer.h" -#include "TRandom.h" -#include "TVirtualPad.h" class AliRawReaderMemory; - class AliEveHOMERManager; class AliHLTHOMERBlockDesc; @@ -35,62 +31,52 @@ class AliEveTPCSector2D; class AliEveTPCSector3D; class AliEveITSDigitsInfo; +//*********************************************************** +#include "TTimer.h" +#include "TRandom.h" +#include "TVirtualPad.h" #include "TGLViewer.h" #include "TThread.h" #include "TGFileBrowser.h" #include "TStyle.h" #include "TList.h" #include "TDirectory.h" - +//*********************************************************** #include "TEveManager.h" #include "TEvePointSet.h" #include "TEveTrack.h" #include "TEveVSDStructs.h" #include "TEveTrackPropagator.h" +#include "TEvePointSet.h" +#include "TEveScene.h" #include "TEveElement.h" - +// #include "TEveElementList.h" +#include "TEveEventManager.h" +//*********************************************************** #include "AliESDEvent.h" #include "AliCDBManager.h" #include "AliRawReaderMemory.h" - +#include "AliTPCRawStream.h" +#include "AliGeomManager.h" +//*********************************************************** #include "AliEveHOMERManager.h" -#include "AliEveTPCLoader.h" +#include "AliEveTPCLoader.h" #include "AliEveTPCData.h" #include "AliEveITSDigitsInfo.h" #include "AliEveITSModule.h" - +//*********************************************************** #include "AliHLTHOMERBlockDesc.h" -#include "AliTPCRawStream.h" - +#include "AliHLTHOMERReader.h" //*********************************************************** -#include "DIMUONRawReader.C" - -#include "TEvePointSet.h" -#include "TEveScene.h" -#include "AliEveMUONData.h" -#include "AliEveMUONChamber.h" -#include "AliEveMUONChamberData.h" - -#include "AliGeomManager.h" - -#include "AliMpCDB.h" -#include "AliMpDDLStore.h" -#include "AliMpDetElement.h" -#include "AliMpDEIterator.h" -#include "AliMpVSegmentation.h" -#include "AliMUONGeometryTransformer.h" -#include "AliMpSegmentation.h" -#include "AliMUONCalibrationData.h" -#include "AliMUONVCalibParam.h" -#include "TEveEventManager.h" -#include "AliMpTriggerCrate.h" -#include "AliMpLocalBoard.h" -#include "AliMUONGeometryDetElement.h" - +#include "hlt_structs.C" +#include "TFile.h" //*********************************************************** +#include +#include "AliHLTMUONDataBlockReader.h" +#include "tracking-ca/AliHLTTPCCATrackParam.h" // -- globals -- - + AliEveTPCLoader* gTPCLoader = 0; AliEveTPCData* gTPCData = 0; TEvePointSet* gTPCClusters = 0; @@ -101,15 +87,10 @@ AliEveITSDigitsInfo* gITSDigits = 0; AliRawReaderMemory* gMemReader = 0; AliEveHOMERManager* gHomerManager = 0; +TEvePointSet* gMUONClusters = 0; +Double_t gSolenoidField = 5; //*********************************************************** -map gDimuTrackerMapping; -vector gDimuTrackerDataList; -vector gDimuTriggerDataList; -AliHLTMUONTriggerMappingData gDimuTriggerMapping[2]; -Bool_t gMUONRawData = false; - - Int_t globMaxPoint = 0 ; //*********************************************************** @@ -132,7 +113,7 @@ TCanvas *g_hlt_canvas = 0; TGLViewer::ECameraType camera = TGLViewer::kCameraPerspXOZ; //**************************************************************************** -Int_t nextEvent(Int_t ADCCut = 6); +Int_t nextEvent(); //**************************************************************************** Int_t processSPDRawData( AliHLTHOMERBlockDesc* block ); @@ -143,11 +124,7 @@ Int_t processTPCRawData( AliHLTHOMERBlockDesc* block ); Int_t processTPCClusters( AliHLTHOMERBlockDesc* block ); Int_t processTPCTracks( AliHLTHOMERBlockDesc* block ); -//**************************************************************************** -Int_t initDiMuonMapping(); -Int_t initTrackerMapping() ; -Int_t processDiMuonRawData( AliHLTHOMERBlockDesc* block ); -Int_t drawDiMuonRawData(Int_t); +Int_t processMUONClusters( AliHLTHOMERBlockDesc* block ); //**************************************************************************** TEveTrack* makeESDTrack( TEveTrackPropagator* rnrStyle, @@ -156,7 +133,7 @@ TEveTrack* makeESDTrack( TEveTrackPropagator* rnrStyle, AliExternalTrackParam* tp = 0 ); //**************************************************************************** -void homer_display(Int_t run = 0) { +void homer_display( Int_t run = 0) { AliCDBManager::Instance()->SetRun(run); AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT"); @@ -164,11 +141,12 @@ void homer_display(Int_t run = 0) { gMemReader = new AliRawReaderMemory(0, 0); gStyle->SetPalette(1, 0); + gEve->DisableRedraw(); // -- Create HOMER Manager gHomerManager = new AliEveHOMERManager("/local/home/hlt/AliEVE-Config.xml"); - // -- Set Realm ( can be "GPN","ACR","HLT" ) + // -- Set Realm ( can be "GPN","ACR","HLT","KIP" ) gHomerManager->SetRealm("ACR"); gEve->AddToListTree(gHomerManager, kTRUE); @@ -179,7 +157,7 @@ void homer_display(Int_t run = 0) { // -- TPC Loader gTPCLoader = new AliEveTPCLoader; gTPCLoader->SetDoubleSR(kTRUE); - gTPCLoader->SetInitParams(40, 900, 10, 100); // Sector params (mint, maxt, thr, maxval) + gTPCLoader->SetInitParams(40, 900, 2, 100); // Sector params (mint, maxt, thr, maxval) // -- TPC Data gTPCData = gTPCLoader->GetData(); @@ -187,17 +165,20 @@ void homer_display(Int_t run = 0) { gTPCData->SetLoadThreshold(0); gTPCData->SetAutoPedestal(kFALSE); // For zero suppressed data. - // -- Load MUON mapping - initDiMuonMapping(); - gEve->AddElement(gTPCLoader); + + gEve->Redraw3D(0,1); // (0, 1) + gEve->EnableRedraw(); } //**************************************************************************** -Int_t nextEvent(Int_t ADCCut) { +Int_t nextEvent() { Int_t iResult = 0; + gStyle->SetPalette(1, 0); + gEve->DisableRedraw(); + // ** Get Next Event from HOMER if ( gHomerManager->NextEvent() ) return ++iResult; @@ -212,14 +193,7 @@ Int_t nextEvent(Int_t ADCCut) { gITSDigits = NULL; } - if(gDimuTrackerDataList.size()>0) - gDimuTrackerDataList.clear(); - - if(gDimuTriggerDataList.size()>0) - gDimuTriggerDataList.clear(); - - for(Int_t ipoint=0;ipointReset(); // ----------------------------------- foo A @@ -228,225 +202,132 @@ Int_t nextEvent(Int_t ADCCut) { // TList* hListKR = new TList; // TList* hListCF = new TList; - gDirectory = 0; // ----------------------------------- foo A TIter next(gHomerManager->GetBlockList()); AliHLTHOMERBlockDesc* block = 0; while ((block = (AliHLTHOMERBlockDesc*)next())) { + +// printf ( "Det : %s\n" ,block->GetDetector().Data() ); +// printf ( "Datatype : %s\n" ,block->GetDataType().Data() ); - printf ( "Det : %s\n" ,block->GetDetector().Data() ); - printf ( "Datatype : %s\n" ,block->GetDataType().Data() ); - // +++ CLUSTERS BLOCK - // +++++++++++++++++++++++++++++++++++++++++++++++++++++++ - if ( block->GetDataType().CompareTo("CLUSTERS") == 0 ) { - - // ** Initialize TPC Clusters - if ( !gTPCClusters ) { - gTPCClusters = new TEvePointSet("TPC Clusters"); - gTPCClusters->SetMainColor(kRed); - gTPCClusters->SetMarkerStyle((Style_t)kFullDotSmall); - gEve->AddElement(gTPCClusters); - } - - // ** Process Clusters - processTPCClusters( block ); - gTPCClusters->ElementChanged(); + // -- TPC + // ----------------------------------------------------- + + if ( ! block->GetDetector().CompareTo("TPC") ){ + + // +++ CLUSTERS BLOCK + // +++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + if ( block->GetDataType().CompareTo("CLUSTERS") == 0 ) { + if ( !gTPCClusters ) { + gTPCClusters = new TEvePointSet("TPC Clusters"); + gTPCClusters->SetMainColor(kRed); + gTPCClusters->SetMarkerStyle((Style_t)kFullDotSmall); + gEve->AddElement(gTPCClusters); + } + + // ** Process Clusters + processTPCClusters( block ); + + gTPCClusters->ElementChanged(); + + }else if ( block->GetDataType().CompareTo("ESD_TREE") == 0 ) { // +++ ESD BLOCK // +++++++++++++++++++++++++++++++++++++++++++++++++++++++ - } else if ( block->GetDataType().CompareTo("ESD_TREE") == 0 ) { - - // ** Initialize TPC Tracks - if ( !gTPCTrack ) { - gTPCTrack = new TEveTrackList("TPC Tracks"); - gTPCTrack->SetMainColor(kBlue); - gEve->AddElement(gTPCTrack); + // ** Initialize TPC Tracks + if ( !gTPCTrack ) { + gTPCTrack = new TEveTrackList("TPC Tracks"); + gTPCTrack->SetMainColor(kBlue); + + gEve->AddElement(gTPCTrack); - TEveTrackPropagator* rnrStyle = gTPCTrack->GetPropagator(); - rnrStyle->SetMagField( 0 ); - rnrStyle->SetFitDecay( 1 ); + TEveTrackPropagator* rnrStyle = gTPCTrack->GetPropagator(); + rnrStyle->SetMagField( 0 ); + rnrStyle->SetFitDecay( 1 ); + } + cout<<"SIZE : "<GetSize()<GetDataType().CompareTo("DDL_RAW") == 0 ) { + processTPCRawData( block ); } - - // ** Proces Tracks - processTPCTracks( block ); - // +++ RAW DATA BLOCK - // +++++++++++++++++++++++++++++++++++++++++++++++++++++++ - } else if ( block->GetDataType().CompareTo("DDL_RAW") == 0 ) { + } else if ( ! block->GetDetector().CompareTo("MUON") ) { + + // -- MUON + //----------------------------------------------------- + if ( (block->GetDataType().CompareTo("RECHITS") == 0) || (block->GetDataType().CompareTo("TRIGRECS") == 0) ) { + +// printf ( "Inside : Datatype : %s\n" ,block->GetDataType().Data() ); +// printf ( "Inside : DataSize : %d\n" ,block->GetSize() ); + if ( !gMUONClusters ) { + gMUONClusters = new TEvePointSet("MUON RecHits"); + gMUONClusters->SetMainColor(kBlue); + gMUONClusters->SetMarkerStyle(20); + gEve->AddElement(gMUONClusters); + } + + // ** Process Clusters + processMUONClusters( block ); + + gMUONClusters->ElementChanged(); + + }//MUON Clusters - // -- TPC - // ----------------------------------------------------- - if ( ! block->GetDetector().CompareTo("TPC") ) - processTPCRawData( block ); + + } else if ( ! block->GetDetector().CompareTo("SPD") ) { // -- SPD // ----------------------------------------------------- - else if ( ! block->GetDetector().CompareTo("SPD") ) { - // !!!!!! TODO add also other ITS detectors + if ( block->GetDataType().CompareTo("DDL_RAW") == 0 ) { // ** Initialize SPD Digits if ( !gITSDigits ) { gITSDigits = new AliEveITSDigitsInfo(); } - + processSPDRawData( block ); } - // -- MUON - // ----------------------------------------------------- - else if ( ! block->GetDetector().CompareTo("MUON") ) { + }else{ - if( processDiMuonRawData ( block ) ) - gMUONRawData = true; - } - - // +++ KRYPTON HISTOGRAM BLOCK - // +++++++++++++++++++++++++++++++++++++++++++++++++++++++ - } else if (block->GetDataType().CompareTo("KRPTHIST") == 0) { - - - - - // ++ else - // +++++++++++++++++++++++++++++++++++++++++++++++++++++++ - } else { - - - printf ("This is nothing"); + printf ("Detector \"%s\" has not been recognized",block->GetDetector().Data()); } } - + if ( gTPCLoader ) gTPCLoader->UpdateSectors( kTRUE ); if ( gTPCClusters ) gTPCClusters->ResetBBox(); if ( gTPCTrack ) gTPCTrack->MakeTracks(); if ( gITSDigits ) drawSPDRawData(); - if ( gMUONRawData ) drawDiMuonRawData ( ADCCut ) ; - - gEve->Redraw3D(0,1); // (0, 1) - gMUONRawData = false; + if ( gMUONClusters ) gMUONClusters->ResetBBox(); + + gEve->Redraw3D(0,1); // (0, 1) + gEve->EnableRedraw(); + return iResult; } - //**************************************************************************** -Int_t processSPDRawData(AliHLTHOMERBlockDesc* block) { - Int_t iResult = 0; - - Int_t partition = block->GetSubDetector().Atoi(); - Int_t eqId = partition; - - gMemReader->SetMemory( reinterpret_cast ( block->GetData() ), block->GetSize() ); - gMemReader->SetEquipmentID( eqId ); - gMemReader->Reset(); - - gITSDigits->ReadRaw( gMemReader, 3); - - return iResult; +//**************************************************************************** +//**************************************************************************** +void loopEvent() { + event_timer.SetCommand("nextEvent()"); + event_timer.Start(6000); } //**************************************************************************** -Int_t drawSPDRawData() { - - Int_t iResult = 0; - - TString sSector; - TString bsSector="Sector"; - TString sStave; - TString bsStave="Stave"; - - Int_t ndx=0; - Int_t sector, stave, module; - - gEve->DisableRedraw(); - - // ** first layer ** - - TEveElementList* layer1 = new TEveElementList( "SPD0" ); - layer1->SetTitle( "SPDs' first layer" ); - layer1->SetMainColor(2); - gEve->AddElement( layer1 ); - - for ( sector=0; sector<10; sector++ ) { - sSector = bsSector; - sSector += sector; - - TEveElementList* relSector = new TEveElementList( sSector.Data() ); - relSector->SetMainColor(2); - gEve->AddElement( relSector, layer1 ); - - for ( stave=0; stave<2; stave++ ) { - sStave = bsStave; - sStave += stave; - - TEveElementList* relStave = new TEveElementList( sStave.Data() ); - relStave->SetMainColor(2); - gEve->AddElement( relStave, relSector ); - - for ( module=0; module<4; module++ ) { - - if ( gITSDigits->GetDigits( ndx, 0 ) && - gITSDigits->GetDigits( ndx, 0 )->GetEntriesFast() > 0) { - - AliEveITSModule* moduleITS = new AliEveITSModule( ndx, gITSDigits ); - gEve->AddElement( moduleITS, relStave ); - } - - ++ndx; - - } // for ( module=0; module<4; module++ ) { - } // for ( stave=0; stave<2; stave++ ) { - } // for ( sector=0; sector<10; sector++ ) { - - // ** second layer ** - - TEveElementList* layer2 = new TEveElementList( "SPD1" ); - layer2->SetTitle( "SPDs' second layer" ); - layer2->SetMainColor(2); - gEve->AddElement(layer2); - - for ( sector=0; sector<10; sector++ ) { - sSector = bsSector; - sSector += sector; - - TEveElementList* relSector = new TEveElementList( sSector.Data() ); - relSector->SetMainColor(2); - gEve->AddElement(relSector, layer2 ); - - for ( stave=0; stave<4; stave++ ) { - sStave = bsStave; - sStave += stave; - - TEveElementList* relStave = new TEveElementList( sStave.Data() ); - relStave->SetMainColor(2); - gEve->AddElement( relStave, relSector ); - - for ( module=0; module<4; module++) { - - if ( gITSDigits->GetDigits( ndx, 0 ) && - gITSDigits->GetDigits( ndx, 0 )->GetEntriesFast() > 0) { - - AliEveITSModule* moduleITS = new AliEveITSModule( ndx, gITSDigits ); - gEve->AddElement( moduleITS, relStave ); - } - - ++ndx; - } // for ( module=0; module<4; module++) { - } // for ( stave=0; stave<2; stave++ ) { - } //for ( sector=0; sector<10; sector++ ) { - - gEve->EnableRedraw(); - - return iResult; +void stopLoopEvent() { + event_timer.Stop(); } - //**************************************************************************** Int_t processTPCRawData(AliHLTHOMERBlockDesc* block) { @@ -459,7 +340,7 @@ Int_t processTPCRawData(AliHLTHOMERBlockDesc* block) { if ( patch >= 2) eqId += 4 * sector + 70; else eqId += 2 * sector; - printf("%d %d %d -- %p %lu\n", sector, patch, eqId, block->GetData(), block->GetSize()); + printf("sector : %d %d %d -- %p %lu\n", sector, patch, eqId, block->GetData(), block->GetSize()); gMemReader->SetMemory( reinterpret_cast ( block->GetData() ), block->GetSize() ); gMemReader->SetEquipmentID( eqId ); @@ -479,7 +360,7 @@ Int_t processTPCClusters(AliHLTHOMERBlockDesc* block) { Int_t slice = block->GetSubDetector().Atoi(); Int_t patch = block->GetSubSubDetector().Atoi(); - Float_t phi = ( slice + 0.5 ) * TMath::Pi() / 9.0; + Float_t phi = ( slice + 0.5 ) * TMath::Pi() / 9.0; Float_t cos = TMath::Cos( phi ); Float_t sin = TMath::Sin( phi ); @@ -508,9 +389,26 @@ TEveTrack* makeESDTrack( TEveTrackPropagator* rnrStyle, AliESDtrack* esdTrack, AliExternalTrackParam* trackParam ) { // Helper function - + Double_t pbuf[3], vbuf[3]; TEveRecTrack rt; + TEvePathMark startPoint(TEvePathMark::kReference); + TEvePathMark midPoint(TEvePathMark::kReference); + TEvePathMark mid1Point(TEvePathMark::kReference); + TEvePathMark endPoint(TEvePathMark::kReference); + TEvePathMark decPoint(TEvePathMark::kDecay); + + /*printf("ESD track: %f, %f, %f, %f, %f, %f, %f", + esdTrack->GetAlpha(), + esdTrack->GetX(), + esdTrack->GetY(), + esdTrack->GetZ(), + esdTrack->GetSnp(), + esdTrack->GetTgl(), + esdTrack->GetSigned1Pt() + ); + */ + cout<<"TPCPoints::"<GetTPCPoints(0)<<" "<GetTPCPoints(1)<<" "<GetTPCPoints(2)<<" "<GetTPCPoints(3)<GetStatus(); rt.fSign = (Int_t) trackParam->GetSign(); - trackParam->GetXYZ(vbuf); - rt.fV.Set(vbuf); - - { // get momentum manually because trackParam->GetPxPyPz doesn't works for straight lines - Double_t pt= TMath::Abs(trackParam->GetSigned1Pt()); - pt = (pt>kAlmost0) ?1./pt :100.; + Double_t x0 = trackParam->GetX(); + Double_t dx = esdTrack->GetTPCPoints(2) - x0; - Double_t cA=TMath::Cos(trackParam->GetAlpha()), sA=TMath::Sin(trackParam->GetAlpha()); + for( Double_t x1=x0; x1.99 ) continue; - Double_t sT=trackParam->GetSnp(); - if( sT>=kAlmost1 ){ sT = kAlmost1; } - else if( sT<-kAlmost1 ){ sT = -kAlmost1; } - Double_t cT = TMath::Sqrt(TMath::Abs(1 - sT*sT)); + startParam.GetXYZ(vbuf); + + { // get momentum manually because trackParam->GetPxPyPz doesn't works for straight lines - pbuf[0] = pt*(cT*cA - sT*sA); - pbuf[1] = pt*(sT*cA + cT*sA); - pbuf[2] = pt*trackParam->GetTgl(); - } + Double_t pt= TMath::Abs(startParam.GetSigned1Pt()); + pt = (pt>kAlmost0) ?1./pt :100.; + + Double_t cA=TMath::Cos(startParam.GetAlpha()), sA=TMath::Sin(startParam.GetAlpha()); + + Double_t sT=startParam.GetSnp(); + if( sT>kAlmost1 ){ sT = kAlmost1; } + else if( sT<-kAlmost1 ){ sT = -kAlmost1; } + Double_t cT = TMath::Sqrt(TMath::Abs(1 - sT*sT)); + + pbuf[0] = pt*(cT*cA - sT*sA); + pbuf[1] = pt*(sT*cA + cT*sA); + pbuf[2] = pt*startParam.GetTgl(); + } + break; + } + + rt.fV.Set(vbuf); rt.fP.Set(pbuf); + startPoint.fV.Set(vbuf); + startPoint.fP.Set(pbuf); Double_t ep = esdTrack->GetP(), mc = esdTrack->GetMass(); rt.fBeta = ep/TMath::Sqrt(ep*ep + mc*mc); TEveTrack* track = new TEveTrack(&rt, rnrStyle); - AliExternalTrackParam endParam = *trackParam; - if( endParam.PropagateTo(esdTrack->GetTPCPoints(2), 0.) ){ // 5 kG + cout<<"startPoint = "<fV.Set(vbuf); - startPoint->fP.Set(pbuf); + + for( ; TMath::Abs(dx)>=1.; dx*=.9 ){ + AliExternalTrackParam endParam = *trackParam; + //if( !endParam.PropagateTo(x0+dx, gSolenoidField) ) continue; + AliHLTTPCCATrackParam t; + t.SetExtParam(endParam, gSolenoidField ); + if( !t.TransportToX(x0+dx) ) continue; + t.GetExtParam( endParam, endParam.GetAlpha(), gSolenoidField ); - endParam.GetXYZ(vbuf); - endPoint->fV.Set(vbuf); - cout<<"endPoint = "<.99 ) continue; + { // get momentum manually because trackParam->GetPxPyPz doesn't works for straight lines Double_t pt= TMath::Abs(endParam.GetSigned1Pt()); @@ -570,16 +486,94 @@ TEveTrack* makeESDTrack( TEveTrackPropagator* rnrStyle, else if( sT<-kAlmost1 ){ sT = -kAlmost1; } Double_t cT = TMath::Sqrt(TMath::Abs(1 - sT*sT)); - pbuf[0] = pt*(cT*cA - sT*sA); - pbuf[1] = pt*(sT*cA + cT*sA); + endParam.GetXYZ(vbuf); + pbuf[0] = pt*(cT*cA - sT*sA); + pbuf[1] = pt*(sT*cA + cT*sA); pbuf[2] = pt*endParam.GetTgl(); } + break; + } + endPoint.fV.Set(vbuf); + endPoint.fP.Set(pbuf); + decPoint.fV.Set(vbuf); + decPoint.fP.Set(pbuf); + + cout<<"endPoint = "<=.5; dx*=.8 ){ + AliExternalTrackParam endParam = *trackParam; + //if( !endParam.PropagateTo(x0+dx, gSolenoidField) ) continue; + AliHLTTPCCATrackParam t; + t.SetExtParam(endParam, gSolenoidField ); + if( !t.TransportToX(x0+dx) ) continue; + t.GetExtParam( endParam, endParam.GetAlpha(), gSolenoidField ); + if( TMath::Abs(endParam.GetSnp())>.99 ) continue; + + { // get momentum manually because trackParam->GetPxPyPz doesn't works for straight lines - endPoint->fP.Set(pbuf); + Double_t pt= TMath::Abs(endParam.GetSigned1Pt()); + pt = (pt>kAlmost0) ?1./pt :100.; + + Double_t cA=TMath::Cos(endParam.GetAlpha()), sA=TMath::Sin(endParam.GetAlpha()); + + Double_t sT=endParam.GetSnp(); + if( sT>=kAlmost1 ){ sT = kAlmost1; } + else if( sT<-kAlmost1 ){ sT = -kAlmost1; } + Double_t cT = TMath::Sqrt(TMath::Abs(1 - sT*sT)); + + endParam.GetXYZ(vbuf); + pbuf[0] = pt*(cT*cA - sT*sA); + pbuf[1] = pt*(sT*cA + cT*sA); + pbuf[2] = pt*endParam.GetTgl(); + } + break; + } + + mid1Point.fV.Set(vbuf); + mid1Point.fP.Set(pbuf); + + //cout<<"midPoint = "<=.5; dx*=.8 ){ + AliExternalTrackParam endParam = *trackParam; + //if( !endParam.PropagateTo(x0+dx, gSolenoidField) ) continue; + AliHLTTPCCATrackParam t; + t.SetExtParam(endParam, gSolenoidField ); + if( !t.TransportToX(x0+dx) ) continue; + t.GetExtParam( endParam, endParam.GetAlpha(), gSolenoidField ); + if( TMath::Abs(endParam.GetSnp())>.99 ) continue; - track->AddPathMark( startPoint ); - track->AddPathMark( endPoint ); + { // get momentum manually because trackParam->GetPxPyPz doesn't works for straight lines + + Double_t pt= TMath::Abs(endParam.GetSigned1Pt()); + pt = (pt>kAlmost0) ?1./pt :100.; + + Double_t cA=TMath::Cos(endParam.GetAlpha()), sA=TMath::Sin(endParam.GetAlpha()); + + Double_t sT=endParam.GetSnp(); + if( sT>=kAlmost1 ){ sT = kAlmost1; } + else if( sT<-kAlmost1 ){ sT = -kAlmost1; } + Double_t cT = TMath::Sqrt(TMath::Abs(1 - sT*sT)); + + endParam.GetXYZ(vbuf); + pbuf[0] = pt*(cT*cA - sT*sA); + pbuf[1] = pt*(sT*cA + cT*sA); + pbuf[2] = pt*endParam.GetTgl(); + } + break; } + + midPoint.fV.Set(vbuf); + midPoint.fP.Set(pbuf); + + track->AddPathMark( startPoint ); + track->AddPathMark( midPoint ); + track->AddPathMark( mid1Point ); + track->AddPathMark( endPoint ); + track->AddPathMark( decPoint ); + //PH The line below is replaced waiting for a fix in Root //PH which permits to use variable siza arguments in CINT //PH on some platforms (alphalinuxgcc, solariscc5, etc.) @@ -599,681 +593,222 @@ Int_t processTPCTracks(AliHLTHOMERBlockDesc* block) { TTree *tr = (TTree*) block->GetTObject(); - AliESDEvent* esd = new AliESDEvent; - esd->ReadFromTree(tr); - tr->GetEntry(0); +// ofstream fout("ESD_TPC.dat",ios::binary); +// fout.write((char*)block->GetData(),block->GetSize()); +// fout.close(); + TFile f("ESD_TPC.root","recreate"); + tr->Write(); + f.Close(); + + TFile* esdFile = TFile::Open("ESD_TPC.root"); + + AliESDEvent* esd = new AliESDEvent(); + TTree* tree = (TTree*) esdFile->Get("esdTree"); + esd->ReadFromTree(tree); + //tr->SetBranchAddress("ESD", &esd); + // if(tr->GetBranch("ESD")) + // return 0; + + tree->GetEntry(0); TEveTrackPropagator* rnrStyle = gTPCTrack->GetPropagator(); rnrStyle->SetMagField( 0.1*esd->GetMagneticField() ); + gSolenoidField = esd->GetMagneticField(); cout << "Number of tracks found :" << esd->GetNumberOfTracks() << endl; + Double_t pin[3]; + for (Int_t ii=0; ii< esd->GetNumberOfTracks(); ii++) { AliESDtrack *esdTrack = esd->GetTrack(ii); AliExternalTrackParam *trackParam = esdTrack; - + cout<<"\nESD track N"<Print(); + TEveTrack* track = makeESDTrack( rnrStyle, ii, esdTrack, trackParam ); - - track->SetAttLineAttMarker(gTPCTrack); - - gEve->AddElement(track, gTPCTrack); - } + esdTrack->GetPxPyPz(pin); + + //cout<<"pt : "<SetAttLineAttMarker(gTPCTrack); + gEve->AddElement(track, gTPCTrack); + } - // delete esd; + delete esd; return 0; } -//**************************************************************************** -Int_t initTrackerMapping() -{ - gDimuTrackerMapping.clear(); - - if (! AliMpCDB::LoadDDLStore(true)){ - cerr<<__FILE__<<": Failed to Load DDLStore specified for CDBPath " - <GetDefaultStorage()<LoadGeometryData()){ - cerr<<__FILE__<<": Failed to Load Geomerty Data "<GetRun()); - AliHLTMUONTrackerMappingData md; - - cout<<"Loading Mapping for Dimuon Tracking Chambers.....be patient..."<GetMpSegmentation(detElemId, cath); - AliMp::PlaneType plane = seg->PlaneType(); - Int_t maxIX = seg->MaxPadIndexX(); - Int_t maxIY = seg->MaxPadIndexY(); - UInt_t idManuChannel; - Int_t buspatchId, manuId, channelId; - Double_t realX, realY, realZ; - Double_t localX, localY, localZ; - - //Pad Info of a segment - for(Int_t iX = 0; iX<= maxIX ; iX++){ - for(Int_t iY = 0; iY<= maxIY ; iY++){ - if(seg->HasPad(AliMpIntPair(iX,iY))){ - AliMpPad pad = seg->PadByIndices(AliMpIntPair(iX,iY),kFALSE); - - - // Getting Manu id - manuId = pad.GetLocation().GetFirst(); - manuId &= 0x7FF; // 11 bits - - // Getting channel id - channelId = pad.GetLocation().GetSecond(); - channelId &= 0x3F; // 6 bits - - buspatchId = AliMpDDLStore::Instance()->GetBusPatchId(detElemId,manuId); - - idManuChannel &= 0x0; - idManuChannel = (idManuChannel|buspatchId)<<11; - idManuChannel = (idManuChannel|manuId)<<6 ; - idManuChannel |= channelId ; - - localX = pad.Position().X(); - localY = pad.Position().Y(); - localZ = 0.0; - - chamberGeometryTransformer->Local2Global(detElemId,localX,localY,localZ, - realX,realY,realZ); - md.fDetElemId = detElemId; - md.fIX = iX ; - md.fIY = iY ; - md.fCath = cath ; - md.fRealX = realX ; - md.fRealY = realY; - md.fRealZ = realZ; - md.fPed = (cd.Pedestals(detElemId,manuId))->ValueAsFloat(channelId); - - gDimuTrackerMapping[idManuChannel] = md; - - }// HasPad condn - }// iY loop - }// iX loop - - }// iPlane + Int_t partition = block->GetSubDetector().Atoi(); + Int_t eqId = partition; - } // detElemId loop + gMemReader->SetMemory( reinterpret_cast ( block->GetData() ), block->GetSize() ); + gMemReader->SetEquipmentID( eqId ); + gMemReader->Reset(); - }// ichamber loop + gITSDigits->ReadRaw( gMemReader, 3); - return 0; + return iResult; } -//**************************************************************************** -Int_t initTrackerMappingPed() -{ - cout<<"Loading Pedestal for Dimuon..."<12){ -// printf("%d\t%d\t%d\t%f\t%f\n",buspatch,manu,channel,mean,sigma); - - idManuChannel &= 0x0; - idManuChannel = (idManuChannel|buspatch)<<11; - idManuChannel = (idManuChannel|manu)<<6 ; - idManuChannel |= channel ; - -// data.fBuspatchId = UInt_t(buspatch) ; -// data.fManuId = UInt_t(manu) ; -// data.fChannelId = UInt_t(channel) ; -// data.fADC = UShort_t(mean); - -// lookuptable[idManuChannel] = data; - gDimuTrackerMapping[idManuChannel].fPed = mean; - gDimuTrackerMapping[idManuChannel].fSigma = sigma; - - } - linenum++; - } - - linenum = 0; +//**************************************************************************** +Int_t drawSPDRawData() { - while(feof(fin[1])==0){ - fgets(line,100,fin[1]); - sscanf(line,"%d\t%d\t%d\t%f\t%f\n",&buspatch,&manu,&channel,&mean,&sigma); - if(linenum>12){ -// printf("%d\t%d\t%d\t%f\t%f\n",buspatch,manu,channel,mean,sigma); + Int_t iResult = 0; - idManuChannel &= 0x0; - idManuChannel = (idManuChannel|buspatch)<<11; - idManuChannel = (idManuChannel|manu)<<6 ; - idManuChannel |= channel ; + TString sSector; + TString bsSector="Sector"; + TString sStave; + TString bsStave="Stave"; -// data.fBuspatchId = UInt_t(buspatch) ; -// data.fManuId = UInt_t(manu) ; -// data.fChannelId = UInt_t(channel) ; -// data.fADC = UShort_t(mean); - -// lookuptable[idManuChannel] = data; + Int_t ndx=0; + Int_t sector, stave, module; - gDimuTrackerMapping[idManuChannel].fPed = mean; - gDimuTrackerMapping[idManuChannel].fSigma = sigma; - } - linenum++; + //gEve->DisableRedraw(); - } + // ** first layer ** - return 0; -} -//**************************************************************************** -Int_t initTriggerMapping() -{ - - for (Int_t d = 0; d < 2; d++) - for (Int_t i = 0; i < 8; i++) - for (Int_t j = 0; j < 16; j++) - for (Int_t k = 0; k < 4; k++) - for (Int_t n = 0; n < 2; n++) - for (Int_t m = 0; m < 16; m++){ - gDimuTriggerMapping[d].fLut[i][j][k][n][m].fDetElemId = 0; - gDimuTriggerMapping[d].fLut[i][j][k][n][m].fX = 0; - gDimuTriggerMapping[d].fLut[i][j][k][n][m].fY = 0; - gDimuTriggerMapping[d].fLut[i][j][k][n][m].fZ = 0; - } - - - AliCDBManager* cdbManager = AliCDBManager::Instance(); - cdbManager->SetRun((AliCDBManager::Instance())->GetRun()); - - AliGeomManager::LoadGeometry(); - - AliMUONGeometryTransformer transformer; - if (! transformer.LoadGeometryData()){ - cerr << "ERROR: Could not load geometry into transformer." << endl; - return false; - } - - if (! AliMpCDB::LoadDDLStore()){ - cerr << "ERROR: Could not load DDL mapping." << endl; - return false; - } + TEveElementList* layer1 = new TEveElementList( "SPD0" ); + layer1->SetTitle( "SPDs' first layer" ); + layer1->SetMainColor(2); + gEve->AddElement( layer1 ); - AliMpSegmentation* segmentation = AliMpSegmentation::Instance(); - if (segmentation == NULL){ - cerr << "ERROR: AliMpSegmentation::Instance() was NULL." << endl; - return false; - } - - - AliMpDDLStore* ddlStore = AliMpDDLStore::Instance(); - if (ddlStore == NULL){ - cerr << "ERROR: AliMpDDLStore::Instance() was NULL." << endl; - return false; - } - - cout << "Loading Mapping for Dimuon Trigger Chambers....." << endl; - - AliMpDEIterator detElemIter; - for (Int_t iDDL = 20; iDDL <= 21; iDDL++){ + for ( sector=0; sector<10; sector++ ) { + sSector = bsSector; + sSector += sector; - for (Int_t iReg = 0; iReg < 8; iReg++){ + TEveElementList* relSector = new TEveElementList( sSector.Data() ); + relSector->SetMainColor(2); + gEve->AddElement( relSector, layer1 ); - AliMpTriggerCrate* crate = ddlStore->GetTriggerCrate(iDDL, iReg); + for ( stave=0; stave<2; stave++ ) { + sStave = bsStave; + sStave += stave; - if (crate == NULL){ - cerr << "ERROR: Could not get crate for regional header = " << iReg - << ", and DDL ID = " << iDDL << endl; - continue; - } - - for (Int_t iLocBoard = 0; iLocBoard < 16; iLocBoard++){ - Int_t boardId = crate->GetLocalBoardId(iLocBoard); - if (boardId == 0) continue; - - AliMpLocalBoard* localBoard = ddlStore->GetLocalBoard(boardId); - if (localBoard == NULL){ - cerr << "ERROR: Could not get loacl board: " << boardId << endl; - continue; - } + TEveElementList* relStave = new TEveElementList( sStave.Data() ); + relStave->SetMainColor(2); + gEve->AddElement( relStave, relSector ); - // skip copy cards - if (! localBoard->IsNotified()) continue; + for ( module=0; module<4; module++ ) { - for (Int_t iChamber = 0; iChamber < 4; iChamber++){ - - Int_t detElemId = ddlStore->GetDEfromLocalBoard(boardId, iChamber); + if ( gITSDigits->GetDigits( ndx, 0 ) && + gITSDigits->GetDigits( ndx, 0 )->GetEntriesFast() > 0) { - const AliMUONGeometryDetElement* detElemTransform = transformer.GetDetElement(detElemId); - if (detElemTransform == NULL){ - cerr << "ERROR: Got NULL pointer for geometry transformer for detection element ID = " - << detElemId << endl; - continue; - } - - for (Int_t iCathode = 0; iCathode <= 1; iCathode++){ - const AliMpVSegmentation* seg = segmentation->GetMpSegmentation - (detElemId, AliMp::GetCathodType(iCathode)); - - for (Int_t bitxy = 0; bitxy < 16; bitxy++){ - Int_t offset = 0; - if (iCathode && localBoard->GetSwitch(6)) offset = -8; - - AliMpPad pad = seg->PadByLocation(AliMpIntPair(boardId, bitxy+offset), kFALSE); - - if (! pad.IsValid()){ - // There is no pad associated with the given local board and bit pattern. - continue; - } - - // Get the global coodinates of the pad. - Float_t lx = pad.Position().X(); - Float_t ly = pad.Position().Y(); - Float_t gx, gy, gz; - detElemTransform->Local2Global(lx, ly, 0, gx, gy, gz); - - // Fill the LUT - gDimuTriggerMapping[(iDDL%20)].fLut[iReg][iLocBoard][iChamber][iCathode][bitxy].fDetElemId = detElemId; - gDimuTriggerMapping[(iDDL%20)].fLut[iReg][iLocBoard][iChamber][iCathode][bitxy].fX = gx; - gDimuTriggerMapping[(iDDL%20)].fLut[iReg][iLocBoard][iChamber][iCathode][bitxy].fY = gy; - gDimuTriggerMapping[(iDDL%20)].fLut[iReg][iLocBoard][iChamber][iCathode][bitxy].fZ = gz; - - }// ibitxy loop - }// cathode loop - }// chamber loop - }// local board loop - }// regional card loop - }// ddl loop - - - return true; -} -//**************************************************************************** -Int_t initDiMuonMapping() -{ - initTrackerMapping(); - initTrackerMappingPed(); - initTriggerMapping(); - - return 0; -} -//**************************************************************************** - -int ReadRawData(int iEvent = 0) -{ - cout<<"Executing for Event : "<AddElement( moduleITS, relStave ); + } - bool MakeTrackDDLStream(int*& rawData, int* rawDataSize, TString rawDataPath, int iEvent, int iDDL); - - int *buffer; - int bufferSize; + ++ndx; - AliMUONTrackerDDLDecoder trackerDDLDecoder; - DiMuonTrackerCustomHandler& handler = - reinterpret_cast(trackerDDLDecoder.GetHandler()); - - for(Int_t iDDL=1;iDDL<=20;iDDL++){ + } // for ( module=0; module<4; module++ ) { + } // for ( stave=0; stave<2; stave++ ) { + } // for ( sector=0; sector<10; sector++ ) { - if(!MakeTrackDDLStream(buffer,&bufferSize,rawDataPath,iEvent,iDDL)){ - printf("Cannot Read DDL Stream, Check the Event number in RawData Directory or DDL number \n"); - continue ; - } - - // for(int i=0;iSetTitle( "SPDs' second layer" ); + layer2->SetMainColor(2); + gEve->AddElement(layer2); + + for ( sector=0; sector<10; sector++ ) { + sSector = bsSector; + sSector += sector; - for(Int_t i=0;i 5){ - gDimuTrackerMapping[handler.GetData(i).fDataId].fADC = - Int_t(handler.GetData(i).fADC) ;//- -// Int_t(gDimuTrackerMapping[handler.GetData(i).fDataId].fPed + 4*gDimuTrackerMapping[handler.GetData(i).fDataId].fSigma); - -// cout<<"detElem : "< refADC value - - } + TEveElementList* relSector = new TEveElementList( sSector.Data() ); + relSector->SetMainColor(2); + gEve->AddElement(relSector, layer2 ); - delete []buffer ; - }// DDL loop + for ( stave=0; stave<4; stave++ ) { + sStave = bsStave; + sStave += stave; - cout<<"Tracker Data size : "<SetMainColor(2); + gEve->AddElement( relStave, relSector ); -//**************************************************************************** + for ( module=0; module<4; module++) { -bool MakeTrackDDLStream(int*& rawData, int* rawDataSize, TString rawDataPath, int iEvent, int iDDL) -{ - char rawDataFile[500]; - sprintf(rawDataFile,"%s/raw%d/MUONTRK_%d.ddl",gSystem->ExpandPathName(rawDataPath.Data()),iEvent,0xA00 + iDDL - 1); + if ( gITSDigits->GetDigits( ndx, 0 ) && + gITSDigits->GetDigits( ndx, 0 )->GetEntriesFast() > 0) { - - FILE *fin = fopen(rawDataFile,"r"); - if(fin == NULL){ - printf("Failed to open file %s\n",rawDataFile); - return false; - }else{ -// printf("Opening file %s\n",rawDataFile); - - int ddlHeader[8]; - int rawDDLSize; - - if(feof(fin)==0){ - fread((char *) & ddlHeader,(size_t)4*8,1,fin); - rawDDLSize = ddlHeader[0]/sizeof(int) - 8; -// rawDDLSize = ddlHeader[0]/sizeof(int) - 8 - 2 ; // temporary solution - //rewind(fin); - -// cout<<"rawDDLSize : "<10){ // 10 is temporary inprinciple 8 should be enough - int* buffer = new int[rawDDLSize]; - fread(buffer,sizeof(int), rawDDLSize,fin); - if(UInt_t(buffer[0])==0xFC0000FC){ - rawData = buffer; - *rawDataSize = rawDDLSize*sizeof(int) ; - //cout<<"buffer : "<AddElement( moduleITS, relStave ); } - }else{ - fclose(fin); - return false; - } - } - - }// - - fclose(fin); - return true; -} - -//**************************************************************************** -Int_t ReadPort( AliHLTHOMERBlockDesc* block ) -{ - int *buffer; - int bufferSize; - - AliMUONTrackerDDLDecoder trackerDDLDecoder; - DiMuonTrackerCustomHandler& handler = - reinterpret_cast(trackerDDLDecoder.GetHandler()); - - DiMuonTriggerDDLDecoder triggerDecoder; - - unsigned long size = block->GetSize(); - bufferSize = UInt_t(int(size/sizeof(int))-10); - buffer = reinterpret_cast(block->GetData()); - buffer += 8; - - // if(buffer[0]==0xFC0000FC){ - // for(int i=0;iEnableRedraw(); - - }else{ - - handler.ResetDataCounter(); - if(!trackerDDLDecoder.Decode(buffer,UInt_t(bufferSize*sizeof(int)))){ - cerr<<"Cannot decode DiMuon Tracker RawData "< 0){ - - gDimuTrackerMapping[handler.GetData(i).fDataId].fADC = - Int_t(handler.GetData(i).fADC) - - Int_t(gDimuTrackerMapping[handler.GetData(i).fDataId].fPed);// + 4*gDimuTrackerMapping[handler.GetData(i).fDataId].fSigma); - - if(gDimuTrackerMapping[handler.GetData(i).fDataId].fADC > 0) - gDimuTrackerDataList.push_back(handler.GetData(i).fDataId); - - - }// adc cut - }// tracker dataSize - }// if trigger/tracker data - - - return true; + return iResult; } -//**************************************************************************** -Int_t processDiMuonRawData( AliHLTHOMERBlockDesc* block ) -{ - if(!ReadRawData(0)) - return false; -// if(!ReadPort(block)) -// return false; - - return true ; -} //**************************************************************************** -Int_t drawDiMuonRawData(Int_t ADCCut) -{ - - cout<<"Trying to read RawData "<GetCurrentEvent()->FindChild("MUONChamberData"); - TEveElement *eveMuonGeomElmt = gEve->GetGlobalScene()->FindChild("MUONChambers"); - - eveMuonEventElmt->DestroyElements(); - - AliEveMUONChamber* mch = 0; - int ipoint = 0 ; - - - for(Int_t ichamber = 0 ; ichamber < 14; ichamber++){ - - if(ichamber<10) - sprintf(ChamberName,"Chamber 0%d (trac)",ichamber); - else - sprintf(ChamberName,"Chamber %2d (trig)",ichamber); - - mch = (AliEveMUONChamber*)(eveMuonGeomElmt->FindChild(ChamberName)); - -// cout<<"ichamber : "<GetChamberData()->DropData(); - } - - - // -- DrawTracker RawData - Int_t dataId,ich, busPatchId, manuId ; - - cout<<"Total number of Tracker data : "< ADCCut){ + unsigned long size = block->GetSize(); + int * buffer ; - if(Int_t(gDimuTrackerMapping[dataId].fDetElemId)<100 or Int_t(gDimuTrackerMapping[dataId].fDetElemId) > 1025 ) - continue ; - - ich = Int_t(gDimuTrackerMapping[dataId].fDetElemId/100) - 1; - sprintf(ChamberName,"Chamber 0%d (trac)",ich); + // for(int idata=0;idataFindChild(ChamberName)); + buffer = (int *)block->GetData(); - //if(ich==0) continue ; - - manuId = (dataId>>6) & 0x7FF ; - busPatchId = (dataId>>17) & 0xFFF ; + if(block->GetDataType().CompareTo("RECHITS") == 0){ + + AliHLTMUONRecHitsBlockReader trackblock((char*)buffer, size); + const AliHLTMUONRecHitStruct* hit = trackblock.GetArray(); - if(busPatchId==728 and manuId==1122) continue ; - - cout<<"ich : "<fX << setw(0); +// cout << setw(13) << left << hit->fY << setw(0); +// cout << hit->fZ << setw(0) << endl; + gMUONClusters->SetNextPoint(hit->fX,hit->fY,hit->fZ); + hit++; + + }// track hit loop + }else{// if rechits - if(gDimuTrackerMapping[dataId].fCath == 0) - mch->GetChamberData()->RegisterDigit(gDimuTrackerMapping[dataId].fDetElemId, - 0, - gDimuTrackerMapping[dataId].fIX, - gDimuTrackerMapping[dataId].fIY, - gDimuTrackerMapping[dataId].fADC); - mch->GetChamberData()->RegisterHit(gDimuTrackerMapping[dataId].fDetElemId, - gDimuTrackerMapping[dataId].fRealX, - gDimuTrackerMapping[dataId].fRealY, - gDimuTrackerMapping[dataId].fRealZ); - - TEvePointSet* ps = new TEvePointSet(Form("Point-%d-Ch-0%d",ipoint,ich),1); - ps->SetPoint(0, - gDimuTrackerMapping[dataId].fRealX, - gDimuTrackerMapping[dataId].fRealY, - gDimuTrackerMapping[dataId].fRealZ); +// if(!strcmp((BlockType(ULong64_t(reader->GetBlockDataType(i)))).Data(),"TRIGRECS")){ + + AliHLTMUONTriggerRecordsBlockReader trigblock(buffer, size); + const AliHLTMUONTriggerRecordStruct* trigrec = trigblock.GetArray(); + for(AliHLTUInt32_t ientry = 0; ientry < trigblock.Nentries(); ientry++){ + + const AliHLTMUONRecHitStruct* hit = &trigrec->fHit[0]; + for(AliHLTUInt32_t ch = 0; ch < 4; ch++) + { +// cout << setw(10) << left << ch + 11 << setw(0); +// cout << setw(13) << left << hit->fX << setw(0); +// cout << setw(13) << left << hit->fY << setw(0); +// cout << hit->fZ << setw(0) << endl; + gMUONClusters->SetNextPoint(hit->fX,hit->fY,hit->fZ); + hit++; + }// trig chamber loop + + }//trig hit loop + }// if trigrecs - //point3d[ipoint].SetElementName(); - //point3d[ipoint].SetRnrState(kFALSE); - //point3d[ipoint].SetMarkerSize(15); - //point3d[ipoint].SetMarkerColor(4); - //point3d[ipoint].SetMarkerStyle(4); - //gEve->AddElement(&point3d[ipoint],eveMuonEventElmt); - - ps->SetMarkerSize(15); - ps->SetMarkerColor(4); - ps->SetMarkerStyle(4); - - eveMuonEventElmt->AddElement(ps); - ipoint++; - - }// ADC Cut - }//foor loop +// //delete[] buffer; +// }//nof Block received +// }// if any event found - // -- DrawTrigger RawData -// cout<<"Total number of Trigger data : "< 1417 ) -// continue ; - -// ich = Int_t(data.fDetElemId/100) - 1; -// sprintf(ChamberName,"Chamber %2d (trig)",ich); - -// mch = (AliEveMUONChamber*)(eveMuonGeomElmt->FindChild(ChamberName)); - - -// cout<<"ich : "<GetChamberData()->RegisterHit(data.fDetElemId,data.fX,data.fY,data.fZ); - - -// point3d[ipoint].SetPoint(0,data.fX,data.fY,data.fZ); - - -// sprintf(ChamberName,"Point-%d-Ch-0%d",ipoint,ich); -// point3d[ipoint].SetName(ChamberName); -// point3d[ipoint].SetRnrState(kFALSE); -// point3d[ipoint].SetMarkerSize(15); -// point3d[ipoint].SetMarkerColor(4); -// point3d[ipoint].SetMarkerStyle(4); - -// gEve->AddElement(&point3d[ipoint],eveMuonEventElmt); -// ipoint++; - -// }// data loop - - - globMaxPoint = ipoint ; - + +// delete reader; - return 0; -} -//**************************************************************************** -void loopEvent() { - event_timer.SetCommand("nextEvent()"); - event_timer.Start(60); + return iResult; } -//**************************************************************************** -void stopLoopEvent() { - event_timer.Stop(); -} +//**************************************************************************** diff --git a/EVE/hlt-macros/rootlogon.C b/EVE/hlt-macros/rootlogon.C index 083966aa7b7..60124bc606f 100644 --- a/EVE/hlt-macros/rootlogon.C +++ b/EVE/hlt-macros/rootlogon.C @@ -8,6 +8,13 @@ **************************************************************************/ { + cout<<"Loading HLT libraries..."<Load("libHLTbase"); + gSystem->Load("libAliHLTUtil"); + gSystem->Load("libHLTinterface"); + gSystem->Load("libAliHLTMUON"); + gSystem->Load("libAliHLTTPC"); + cout << "Setting include path ..." << endl; TString includePath = "-I${ALICE_ROOT}/include "; includePath += "-I${ALICE_ROOT}/EVE "; @@ -21,5 +28,7 @@ includePath += "-I${ALICE_ROOT}/RAW "; includePath += "-I${ALICE_ROOT}/MUON "; includePath += "-I${ALICE_ROOT}/MUON/mapping "; + includePath += "-I${ALICE_ROOT}/HLT/MUON "; + includePath += "-I${ALICE_ROOT}/HLT/TPCLib/tracking-ca"; gSystem->SetIncludePath(includePath.Data()); } diff --git a/EVE/hlt-macros/sampleConfig.xml b/EVE/hlt-macros/sampleConfig.xml index 7dbc3773426..e69de29bb2d 100755 --- a/EVE/hlt-macros/sampleConfig.xml +++ b/EVE/hlt-macros/sampleConfig.xml @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - TCPDumpSubscriber -port 51000 - TPC_CalibPedestal_A15 - master - - - - - TCPDumpSubscriber -port 51001 - TPC_RP_A15_02 - TPC_RP_A15_03 - TPC_RP_A15_04 - TPC_RP_A15_05 - master - - - - diff --git a/EVE/hlt-macros/sampleConfig_2.xml b/EVE/hlt-macros/sampleConfig_2.xml index 0a8f783e9ea..e69de29bb2d 100755 --- a/EVE/hlt-macros/sampleConfig_2.xml +++ b/EVE/hlt-macros/sampleConfig_2.xml @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - TCPDumpSubscriber -port 58656 - TPC_CF - fepphos2 - - - - - TCPDumpSubscriber -port 58660 - TPC_FP - fepphos3 - - - - diff --git a/EVE/hlt-macros/test_sources.C b/EVE/hlt-macros/test_sources.C index b21f34379d1..e69de29bb2d 100644 --- a/EVE/hlt-macros/test_sources.C +++ b/EVE/hlt-macros/test_sources.C @@ -1,31 +0,0 @@ -AliEveHOMERManager* homerM = 0; - -void test_sources() -{ - homerM = new AliEveHOMERManager("./sampleConfig.xml"); - - gEve->AddToListTree(homerM, kTRUE); - - homerM->CreateHOMERSourcesList(); - - AliEveHOMERSourceList* srcL = new AliEveHOMERSourceList("Sources"); - srcL->SetManager(homerM); - homerM->AddElement(srcL); - - srcL->CreateByType(); - - /* - TList* srcList = homerM->GetSourceList(); - - AliEveHOMERSourceMap* smd = AliEveHOMERSourceMap::Create(AliEveHOMERSourceMap::kSG_ByDet); - smd->FillMap(srcList, 1); - printf(" **** ByDet XXX ****\n"); - smd->PrintXXX(); - - AliEveHOMERSourceMap* smt = AliEveHOMERSourceMap::Create(AliEveHOMERSourceMap::kSG_ByType); - smt->FillMap(srcList, 1); - printf(" **** ByType XXX ****\n"); - smt->PrintXXX(); - - */ -} -- 2.39.3