#include "AliHLTHOMERLibManager.h"
#include "AliHLTHOMERSourceDesc.h"
#include "AliHLTHOMERBlockDesc.h"
-
+// -- -- -- -- -- -- --
+#include "AliLog.h"
ClassImp(AliHLTHOMERManager)
/*
if ( fProxyHandler ) {
iResult = fProxyHandler->Initialize();
if (iResult)
- HLTError("Initialize of ProxyHandler failed.");
+ AliError(Form("Initialize of ProxyHandler failed."));
}
else {
iResult = -1;
- HLTError("Creating of ProxyHandler failed.");
+ AliError(Form("Creating of ProxyHandler failed."));
}
return iResult;
iResult = fProxyHandler->FillSourceList( fSourceList );
if ( iResult < 0 ) {
- HLTWarning("There have been errors, while creating the sources list.");
+ AliWarning(Form("There have been errors, while creating the sources list."));
}
else if ( iResult > 0 ) {
- HLTWarning("No active services found.");
+ AliWarning(Form("No active services found."));
}
else {
- HLTInfo("New sources list created.");
+ AliInfo(Form("New sources list created."));
// -- New SourceList has been created
// --> All Sources are new --> State has changed
*/
//##################################################################################
-Int_t AliHLTHOMERManager::ConnectHOMER( TString detector="" ){
+Int_t AliHLTHOMERManager::ConnectHOMER( TString detector ){
// see header file for class documentation
Int_t iResult = 0;
// -- Check if already connected and state has not changed
if ( fStateHasChanged == kFALSE && IsConnected() ) {
- HLTInfo("No need for reconnection.");
+ AliInfo(Form("No need for reconnection."));
return iResult;
}
CreateReadoutList( sourceHostnames, sourcePorts, sourceCount, detector );
if ( sourceCount == 0 ) {
- HLTError("No sources selected, aborting.");
+ AliError(Form("No sources selected, aborting."));
return -1;
}
if ( !fReader && fLibManager )
fReader = fLibManager->OpenReader( sourceCount, sourceHostnames, sourcePorts );
else {
- HLTError("No LibManager present.");
+ AliError(Form("No LibManager present."));
return -2;
}
UInt_t ndx = fReader->GetErrorConnectionNdx();
if ( ndx < sourceCount ) {
- HLTError("Error establishing connection to TCP source %s:%hu: %s (%d)",
- sourceHostnames[ndx], sourcePorts[ndx], strerror(iResult), iResult);
+ AliError(Form("Error establishing connection to TCP source %s:%hu: %s (%d)",
+ sourceHostnames[ndx], sourcePorts[ndx], strerror(iResult), iResult));
}
else {
- HLTError("Error establishing connection to unknown source with index %d: %s (%d)",
- ndx, strerror(iResult), iResult);
+ AliError(Form("Error establishing connection to unknown source with index %d: %s (%d)",
+ ndx, strerror(iResult), iResult));
}
if ( fReader )
// -- Connection ok - set reader
fConnected = kTRUE;
- HLTInfo("Connection established.");
+ AliInfo(Form("Connection established."));
}
delete[] sourceHostnames;
fStateHasChanged = kTRUE;
fConnected = kFALSE;
- HLTInfo("Connection closed.");
+ AliInfo(Form("Connection closed."));
return;
}
iResult = ConnectHOMER(detector);
if ( iResult ) {
- HLTError("Error reconnecting.");
+ AliError(Form("Error reconnecting."));
}
return iResult;
Int_t iRetryCount = 0;
if ( !fReader || ! IsConnected() ) {
- HLTWarning( "Not connected yet." );
+ AliWarning(Form( "Not connected yet." ));
return -1;
}
iResult = fReader->ReadNextEvent( 40000000 /*timeout in us*/);
if ( iResult == 111 || iResult == 32 || iResult == 6 ) {
- HLTError("No Connection to source %d: %s (%d)",
- fReader->GetErrorConnectionNdx(), strerror(iResult), iResult);
+ AliError(Form("No Connection to source %d: %s (%d)",
+ fReader->GetErrorConnectionNdx(), strerror(iResult), iResult));
return -iResult;
}
else if ( iResult == 110 ) {
- HLTError("Timout occured, reading event from source %d: %s (%d)",
- fReader->GetErrorConnectionNdx(), strerror(iResult), iResult);
+ AliError(Form("Timout occured, reading event from source %d: %s (%d)",
+ fReader->GetErrorConnectionNdx(), strerror(iResult), iResult));
return -iResult;
}
else if ( iResult == 56) {
++iRetryCount;
if ( iRetryCount >= 20 ) {
- HLTError("Retry Failed: Error reading event from source %d: %s (%d)",
- fReader->GetErrorConnectionNdx(), strerror(iResult), iResult);
+ AliError(Form("Retry Failed: Error reading event from source %d: %s (%d)",
+ fReader->GetErrorConnectionNdx(), strerror(iResult), iResult));
return -iResult;
}
else {
- HLTError("Retry: Error reading event from source %d: %s (%d)",
- fReader->GetErrorConnectionNdx(), strerror(iResult), iResult);
+ AliError(Form("Retry: Error reading event from source %d: %s (%d)",
+ fReader->GetErrorConnectionNdx(), strerror(iResult), iResult));
continue;
}
}
else if ( iResult ) {
- HLTError("General Error reading event from source %d: %s (%d)",
- fReader->GetErrorConnectionNdx(), strerror(iResult), iResult);
+ AliError(Form("General Error reading event from source %d: %s (%d)",
+ fReader->GetErrorConnectionNdx(), strerror(iResult), iResult));
fConnected = kFALSE;
return -iResult;
}
fEventID = static_cast<ULong64_t>(fReader->GetEventID());
fCurrentBlk = 0;
- HLTInfo("Event 0x%016LX (%Lu) with %lu blocks", fEventID, fEventID, fNBlks);
+ AliInfo(Form("Event 0x%016LX (%Lu) with %lu blocks", fEventID, fEventID, fNBlks));
#if EVE_DEBUG
// Loop for Debug only
memset( tmp2, 0, 5 );
void *tmp11 = tmp1;
ULong64_t* tmp12 = static_cast<ULong64_t*>(tmp11);
- *tmp12 = fReader->GetBlockDataType( ii );
+ *tmp12 = fReader->GetBlockDataType(ii);
void *tmp21 = tmp2;
ULong_t* tmp22 = static_cast<ULong_t*>(tmp21);
- *tmp22 = fReader->GetBlockDataOrigin( ii );
- HLTInfo("Block %lu length: %lu - type: %s - origin: %s",
- ii, fReader->GetBlockDataLength( ii ), tmp1, tmp2);
+ *tmp22 = fReader->GetBlockDataOrigin(ii);
+ AliInfo(Form( "Block %lu length: %lu - type: %s - origin: %s - spec 0x%08X",
+ ii, fReader->GetBlockDataLength(ii), tmp1, tmp2, fReader->GetBlockDataSpec(ii) ));
} // end for ( ULong_t ii = 0; ii < fNBlks; ii++ ) {
#endif
// -- Create BlockList
- HLTInfo("Create Block List");
+ AliInfo(Form("Create Block List"));
CreateBlockList();
return iResult;
TIter next( fSourceList );
while ( ( source = dynamic_cast<AliHLTHOMERSourceDesc*>(next()) ) ) {
-
+ printf("DAT = %s\n",detector.Data());
- // -- If detector name given
- if ( ! detector.IsNull() ) {
- // -- Continue if detector name doesn't match
- if ( detector.CompareTo(source->GetDetector()) )
+ // -- If detector NO detector name given
+ if ( ! detector.CompareTo("ALL") ) {
+ // -- Continue if source is not selected
+ if ( ! source->IsSelected() )
continue;
}
+ // -- DetectorName given
else {
- // -- Continue if source is not selected
- if ( ! source->IsSelected() )
+ // -- Continue if detector name doesn't match
+ if ( detector.CompareTo(source->GetDetector()) )
continue;
+ else
+ source->Select();
}
Bool_t exists = kFALSE;
// Get pointer to current block in current event
if ( !fReader || !IsConnected() ) {
- HLTError("Not connected yet.");
+ AliError(Form("Not connected yet."));
return NULL;
}
if ( ndx < static_cast<Int_t>(fNBlks) )
// see header file for class documentation
if ( !fReader || !IsConnected() ) {
- HLTError("Not connected yet.");
+ AliError(Form("Not connected yet."));
return 0;
}
// -- Check for Connection
if ( !fReader || ! IsConnected() ) {
- HLTError("Not connected yet.");
+ AliError(Form("Not connected yet."));
return origin;
}
// -- Check block index
if ( ndx >= static_cast<Int_t>(fNBlks) ) {
- HLTError("Block index %d out of range.", ndx );
+ AliError(Form("Block index %d out of range.", ndx ));
return origin;
}
// -- Check for Connection
if ( !fReader || ! IsConnected() ) {
- HLTError("Not connected yet.");
+ AliError(Form("Not connected yet."));
return type;
}
// -- Check block index
if ( ndx >= static_cast<Int_t>(fNBlks) ) {
- HLTError("Block index %d out of range.", ndx );
+ AliError(Form("Block index %d out of range.", ndx ));
return type;
}
// -- Check for Connection
if ( !fReader || ! IsConnected() ) {
- HLTError("Not connected yet.");
+ AliError(Form("Not connected yet."));
return 0;
}
// -- Check block index
if ( ndx >= static_cast<Int_t>(fNBlks) ) {
- HLTError("Block index %d out of range.", ndx );
+ AliError(Form("Block index %d out of range.", ndx ));
return 0;
}
TIter next( fSourceList );
while ( ( source = dynamic_cast<AliHLTHOMERSourceDesc*>(next()) ) ) {
+
+
// -- Check if source is selected
if ( ! source->IsSelected() )
continue;
-
+ else
+ AliError(Form("IS SELECTED"));
+
// -- Check if detector matches
if ( source->GetSourceName().CompareTo( block->GetBlockName() ) )
continue;
#if EVE_DEBUG
if ( requested ) {
- HLTInfo ("Block requested : %s", block->GetBlockName().Data());
+ AliInfo(Form("Block requested : %s", block->GetBlockName().Data()));
}
else {
- HLTInfo("Block NOT requested : %s", block->GetBlockName().Data());
+ AliInfo(Form("Block NOT requested : %s", block->GetBlockName().Data()));
}
#endif
#include "TSystem.h"
// -- -- -- -- -- -- --
#include "AliHLTHOMERProxyHandler.h"
+// -- -- -- -- -- -- --
+#include "AliLog.h"
ClassImp(AliHLTHOMERProxyHandler)
iResult = ProcessXmlRpcResponse();
if (iResult < 0) {
- HLTError("Filling SourceList failed.");
+ AliError(Form("Filling SourceList failed."));
}
return iResult;
TSocket *socket = new TSocket(fgkHOMERProxyNode[fRealm], proxyPort);
if ( ! socket->IsValid() ) {
- HLTWarning("Failed to create socket to %s:%d,",fgkHOMERProxyNode[fRealm], proxyPort);
- HLTWarning("trying %s:%d now.", fgkHOMERProxyNode[fRealm+kHOMERRealmsMax],proxyPort);
+ AliWarning(Form("Failed to create socket to %s:%d,",fgkHOMERProxyNode[fRealm], proxyPort));
+ AliWarning(Form("trying %s:%d now.", fgkHOMERProxyNode[fRealm+kHOMERRealmsMax],proxyPort));
socket = new TSocket(fgkHOMERProxyNode[fRealm+kHOMERRealmsMax], proxyPort);
if ( ! socket->IsValid() ) {
- HLTError("Failed to create socket to %s:%d and %s:%d.",
- fgkHOMERProxyNode[fRealm], proxyPort,
- fgkHOMERProxyNode[fRealm+kHOMERRealmsMax],proxyPort);
+ AliError(Form("Failed to create socket to %s:%d and %s:%d.",
+ fgkHOMERProxyNode[fRealm], proxyPort,
+ fgkHOMERProxyNode[fRealm+kHOMERRealmsMax],proxyPort));
+
fRealm = -1;
return -1;
}
iResult = socket->SendRaw( reqMsg, strlen(reqMsg) );
if ( iResult < 1 ||
iResult != static_cast<Int_t>(strlen(reqMsg))) {
- HLTError("Error sending! -- send length %d -- msg length %d.", iResult, strlen(reqMsg) );
+ AliError(Form("Error sending! -- send length %d -- msg length %d.", iResult, static_cast<Int_t>(strlen(reqMsg)) ));
socket->Close();
return iResult;
}
iResult = socket->RecvRaw(&buffer[bufferLength], 1);
if ( iResult < 0) {
- HLTError("Error reading form socket.");
+ AliError(Form("Error reading form socket."));
socket->Close();
return iResult;
}
TDOMParser xmlParser;
xmlParser.SetValidate(kFALSE);
- HLTDebug("XMLResponse:\n %s",fXmlRpcResponse.Data());
+ AliInfo(Form("XMLResponse: %s",fXmlRpcResponse.Data()));
iResult = xmlParser.ParseBuffer(fXmlRpcResponse.Data(), fXmlRpcResponse.Length());
if ( iResult < 0 ) {
- HLTError("Parsing buffer with error: %s",
- xmlParser.GetParseCodeMessage(xmlParser.GetParseCode()) );
+ AliError(Form("Parsing buffer with error: %s",
+ xmlParser.GetParseCodeMessage(xmlParser.GetParseCode()) ));
+
+
return iResult;
}
GetChildren()->GetChildren()->GetChildren()->GetChildren();
if ( strcmp( node->GetNodeName(), "string" ) ) {
- HLTError("No node 'string' in XmlRpcResponse.");
+ AliError(Form("No node 'string' in XmlRpcResponse."));
return -1;
}
// -- Get Content
TString xmlContent(node->GetText() );
- HLTDebug("XMLContent:\n %s",xmlContent.Data());
+ AliInfo(Form("XMLContent: %s",xmlContent.Data()));
iResult = xmlParser.ParseBuffer(xmlContent.Data(), xmlContent.Length());
if ( iResult < 0 ) {
- HLTError("Parsing buffer with error: %s",
- xmlParser.GetParseCodeMessage(xmlParser.GetParseCode()) );
+ AliError(Form("Parsing buffer with error: %s",
+ xmlParser.GetParseCodeMessage(xmlParser.GetParseCode()) ));
+
return iResult;
}
if ( !xmlParser.GetXMLDocument()->GetRootNode()->HasChildren() ) {
- HLTInfo("No Services active.");
+ AliWarning(Form("No Services active."));
return 1;
}
Int_t iResult = 0;
- HLTInfo(">> New service");
+ AliInfo(Form(">> New service"));
// -- Loop over all service properties and
// read them from the service tag
if ( ! strcmp(innerNode->GetNodeName(), "text" ) )
continue;
- HLTInfo(" %s ++ %s", innerNode->GetNodeName(), innerNode->GetText() );
+ AliInfo(Form(" %s ++ %s", innerNode->GetNodeName(), innerNode->GetText() ));
// -- hostname
if ( ! strcmp( innerNode->GetNodeName(), "address") )
if ( portS.IsDigit() )
port = portS.Atoi();
else {
- HLTError("Port %s is not a digit.", portS.Data());
+ AliError(Form("Port %s is not a digit.", portS.Data()));
iResult = -1;
}
}
// -- Check for completeness of the source properties
if ( hostname.IsNull() || !port || dataOrigin.IsNull() ||
- dataType.IsNull() /*|| dataSpecification.IsNull()*/ ) {
- HLTError("Service provides not all values:\n\thostname\t\t %s\n\tport\t\t\t %d\n\tdataorigin\t\t %s\n\tdatatype\t\t %s\n\tdataspecification\t %s", hostname.Data(),
- port, dataOrigin.Data(), dataType.Data(), dataSpecification.Data());
+ dataType.IsNull() || dataSpecification.IsNull() ) {
+ AliError(Form("Service provides not all values:\n\thostname\t\t %s\n\tport\t\t\t %d\n\tdataorigin\t\t %s\n\tdatatype\t\t %s\n\tdataspecification\t %s",
+ hostname.Data(), port, dataOrigin.Data(), dataType.Data(), dataSpecification.Data()));
+
return -2;
}
fSourceList->Add( source );
- HLTInfo( "New Source added : %s", source->GetSourceName().Data());
+ AliInfo(Form( "New Source added : %s", source->GetSourceName().Data()));
return iResult;
}