2 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3 // Author: Jochen Thaeder <thaeder@kip.uni-heidelberg.de> *
4 // for The ALICE HLT Project. *
6 /** @file AliEveHOMERManager.cxx
9 @brief Manger for HOMER in offline
16 #include "AliEveHOMERManager.h"
20 #define ROWHOUGHPARAMS
21 #define use_reconstruction
23 #define ROOTVERSION "unchecked"
24 #define ALIROOTVERSION "unchecked"
28 // -- -- -- -- -- -- --
29 #include "AliHLTHOMERLibManager.h"
30 #include "AliHLTHOMERSourceDesc.h"
31 #include "AliHLTHOMERBlockDesc.h"
32 // -- -- -- -- -- -- --
33 #include "AliEveHOMERSource.h"
34 // -- -- -- -- -- -- --
36 #include <TApplication.h>
37 #include "Riostream.h"
39 #include "TCollection.h"
41 #include "TObjString.h"
42 #include "TObjArray.h"
43 // -- -- -- -- -- -- --
45 #include "AliTPCCalibPedestal.h"
46 #include "AliTPCCalibPulser.h"
47 #include "AliTPCCalibCE.h"
48 #include "AliTPCPreprocessorOnline.h"
49 #include "AliTPCCalROC.h"
51 //______________________________________________________________________________
53 // Manage connections to HLT data-sources.
55 ClassImp(AliEveHOMERManager)
58 * ---------------------------------------------------------------------------------
59 * Constructor / Destructor
60 * ---------------------------------------------------------------------------------
63 //##################################################################################
64 AliEveHOMERManager::AliEveHOMERManager( TString xmlFile ) :
65 TEveElementList("AliEveHOMERManager"),
66 fLibManager(new AliHLTHOMERLibManager),
78 fStateHasChanged(kTRUE),
81 // This Class should handle the communication
82 // from the HLT to AliEVE. The HLT sends data via
83 // the HOMER interface on several TCP ports of nodes
84 // in the CERN GPN and DCS network.
85 // All this communication is hidden from the user.
87 // Right now, a xml file ( SCC1 ) is used to get the
88 // configuration, this will/ has to change to a proxy
89 // running on dedicated nodes.
92 //##################################################################################
93 AliEveHOMERManager::~AliEveHOMERManager() {
98 fLibManager->DeleteReader(fReader);
108 if ( fSourceList != NULL )
112 if ( fBlockList != NULL )
116 if ( fSrcList != NULL )
120 if ( fTPCPre != NULL )
126 * ---------------------------------------------------------------------------------
128 * ---------------------------------------------------------------------------------
131 //##################################################################################
132 Int_t AliEveHOMERManager::CreateHOMERSourcesList() {
133 // Create Sources List from HOMER-Proxy
135 // -- Initialize XML parser
136 if ( fXMLParser != NULL )
140 fXMLParser = new TDOMParser();
141 fXMLParser->SetValidate( kFALSE );
143 Int_t iResult = fXMLParser->ParseFile( fXMLFile );
146 AliError( Form("Parsing file with error: %s", fXMLParser->GetParseCodeMessage( fXMLParser->GetParseCode() )) );
150 // -- Initialize sources list
152 if ( fSourceList != NULL )
156 fSourceList = new TList();
157 fSourceList->SetOwner( kTRUE );
160 fRootNode = fXMLParser->GetXMLDocument()->GetRootNode();
162 TXMLNode * node = NULL;
163 TXMLNode * prevNode = fRootNode->GetChildren();
165 // -- Loop over all nodes
166 while ( ( node = prevNode->GetNextNode() ) ) {
169 // -- Find only "Process" nodes, otherwise continue to next node
170 if ( strcmp( node->GetNodeName(), "Proc" ) != 0 )
173 // -- Get Attributes of current node
174 TList *attrList = node->GetAttributes();
176 TIter next(attrList);
178 while ( ( attr = (TXMLAttr*)next() ) ) {
180 // -- Find "ID" attribute, otherwise continue to next attribute
181 if ( strcmp( attr->GetName(), "ID" ) != 0 )
184 TString nodeId( attr->GetValue() );
186 // -- Find only TDS processes
187 TObjArray * nodeIdTok = nodeId.Tokenize("_");
189 for ( Int_t ii=0 ; ii < nodeIdTok->GetEntries() ; ii++ ) {
190 if ( ! ( (TObjString*) nodeIdTok->At(ii) )->GetString().CompareTo("TDS") ) {
191 iResult = GetTDSAttributes( node->GetChildren() );
193 AliError( Form("Error processing TDS process : %s", nodeId.Data()) );
197 } // while ( ( attr = (TXMLAttr*)next() ) ) {
199 } // while ( ( node = prevNode->GetNextNode() ) ) {
201 // -- New SourceList has been created --> All Sources are new --> State has changed
202 fStateHasChanged = kTRUE;
205 AliWarning( Form("There have been errors, while creating the sources list.") );
208 AliInfo( Form("New sources list created.") );
213 // -- Create new AliEVE sources list
214 fSrcList = new AliEveHOMERSourceList("HOMER Sources");
215 fSrcList->SetManager(this);
217 AddElement(fSrcList);
218 fSrcList->CreateByType();
224 //##################################################################################
225 void AliEveHOMERManager::SetSourceState( AliHLTHOMERSourceDesc * source, Bool_t state ) {
226 // Set state of a source
227 // * param source Pointer to AliHLTHOMERSourceDesc object.
228 // * param state New (selected/not selected) state.
230 if ( source->IsSelected() != state ) {
231 source->SetState( state );
232 fStateHasChanged = kTRUE;
238 //##################################################################################
239 Int_t AliEveHOMERManager::GetTDSAttributes( TXMLNode * xmlNode ) {
240 // Get Information out of a TDS process in XML file
241 // * param xmlNode Pointer to childs of TDS node
242 // * return 0 on sucess, > 0 on errorsee header file for class documentation
246 TXMLNode * attrNode = NULL;
247 TXMLNode * prevNode = xmlNode;
249 TString xmlHostname = 0;
252 TString hostname = 0;
255 // -- Get hostname and port from TDS node out of XML
256 while ( ( attrNode = prevNode->GetNextNode() ) ) {
259 // -- Get port out of the commandline
260 if ( strcmp( attrNode->GetNodeName(), "Cmd" ) == 0 ) {
261 TString cmd( attrNode->GetText() );
263 TObjArray * cmdTok = cmd.Tokenize(" ");
264 xmlPort = ((TObjString*) cmdTok->At(2))->GetString();
267 else if ( strcmp( attrNode->GetNodeName(), "Node" ) == 0 )
268 xmlHostname = attrNode->GetText();
270 } // while ( ( attrNode = prevNode->GetNextNode() ) ) {
272 // -- Resolve hostname and port information
273 iResult = ResolveHostPortInformation ( xmlHostname, xmlPort, hostname, port );
274 if ( iResult == 1 ) {
275 AliError( Form("Error resolving hostname : %s", xmlHostname.Data()) );
278 else if ( iResult == 2 ) {AliInfo( Form("Connection established") );
279 AliError( Form("Error resolving port : %s", xmlPort.Data()) );
283 // -- Reset loop to TDS node
286 // -- Get Sources out of XML, resolve sources, add to sources List
287 while ( ( attrNode = prevNode->GetNextNode() ) ) {
290 // Find only "Parent" tags, otherwise continue to next tag
291 if ( strcmp( attrNode->GetNodeName(), "Parent" ) != 0 )
294 TString xmlParent = attrNode->GetText();
296 AliHLTHOMERSourceDesc * source = new AliHLTHOMERSourceDesc( hostname, port );
298 if ( ResolveSourceInformation( xmlParent, source ) ) {
300 AliError( Form("Error resolving source : %s", xmlParent.Data()) );
305 fSourceList->Add( source );
306 AliInfo( Form("New Source added : %s", xmlParent.Data()) );
309 } // while ( ( attrNode = prevNode->GetNextNode() ) ) {
314 //##################################################################################
315 Int_t AliEveHOMERManager::ResolveHostPortInformation ( TString xmlHostname, TString xmlPort, TString &hostname, Int_t &port ) {
316 // Resolve Information of hostname and port for source which has to be used by HOMER
317 // ( due to port mapping inside the HLT )
318 // * param xmlHostname Hostname out of the XML
319 // * param xmlPort Port out of the XML
320 // * param hostname Return of the hostname
321 // * param port Return of the port
322 // * return 0 on sucess, 1 if hostname couldn't be resolved, 2 if port couldn't be resolved,
325 TString nodeName = 0;
326 TXMLNode * node = NULL;
327 TXMLNode * prevNode = fRootNode->GetChildren();
329 // *** Resolve hostname
331 while ( ( node = prevNode->GetNextNode() ) && iResult == 1 ) {
334 // -- Find only "Node" nodes, otherwise continue
335 if ( strcmp( node->GetNodeName(), "Node" ) != 0 )
338 // -- Get Attributes of current node
339 TList *attrList = node->GetAttributes();
341 TIter next(attrList);
345 // Get "nodeID" and "nodeName" of this "Node" node
346 while ( ( attr = (TXMLAttr*)next() ) ) {
347 if ( strcmp( attr->GetName(), "ID" ) == 0 )
348 nodeId = attr->GetValue();
349 else if ( strcmp( attr->GetName(), "hostname" ) == 0 )
350 nodeName = attr->GetValue();
353 // -- if this is not the correct nodeID continue
354 if ( nodeId != xmlHostname )
358 if ( ! fRealm.CompareTo( "ACR" ) )
359 hostname = "alihlt-dcs0.cern.ch";
360 else if ( ! fRealm.CompareTo( "GPN" ) )
361 hostname = "alihlt-vobox0.cern.ch";
368 } // while ( ( node = prevNode->GetNextNode() ) ) {
371 AliError( Form("Error resolving hostname : %s", xmlHostname.Data()) );
377 if ( xmlPort.IsDigit() ) {
379 if ( nodeName.CompareTo("feptriggerdet") ==0 ){
380 if ( xmlPort.CompareTo("49152") == 0 ){
382 } else if ( xmlPort.CompareTo("49153") == 0 ){
385 } else if ( nodeName.CompareTo("fepfmdaccorde") == 0 ){
386 if ( xmlPort.CompareTo("49152") == 0 ){
388 } else if ( xmlPort.CompareTo("49153") == 0 ){
391 } else if ( nodeName.CompareTo("feptpcao15") == 0 ){
392 if ( xmlPort.CompareTo("49152") == 0 ){
394 } else if ( xmlPort.CompareTo("49153") == 0 ){
397 } else if ( nodeName.CompareTo("fepphos2") == 0 ){
398 if ( xmlPort.CompareTo("49152") == 0 ){
400 } else if ( xmlPort.CompareTo("58656") == 0 ){
403 } else if ( nodeName.CompareTo("fepphos3") == 0 ){
404 if ( xmlPort.CompareTo("49152") == 0 ){
406 } else if ( xmlPort.CompareTo("58660") == 0 ){
409 } else if ( nodeName.CompareTo("fepphos4") == 0 ){
410 if ( xmlPort.CompareTo("49152") == 0 ){
412 } else if ( xmlPort.CompareTo("58664") == 0 ){
415 } else if ( nodeName.CompareTo("alihlt-vobox0") == 0 ){
416 port = xmlPort.Atoi();
420 AliError( Form("Error resolving port : %s", xmlPort.Data()) );
427 AliInfo( Form("%s:%i resolved out of %s:%s", hostname.Data(), port, xmlHostname.Data(), xmlPort.Data()) );
433 //##################################################################################
434 Int_t AliEveHOMERManager::ResolveSourceInformation( TString xmlParent, AliHLTHOMERSourceDesc *source ) {
435 // Resolve information of source
436 // * param xmlParent ParentString out of the XML
437 // * param source Return the filled AliHLTHOMERSourceDesc object
438 // * return 0 on sucess, 1 on errorsee header file for class documentation
442 if ( ! xmlParent.Contains( "_" ) ) {
443 AliError( Form("Source %s could not be resolved", xmlParent.Data() ) );
449 TObjArray * parentTokens = xmlParent.Tokenize("_");
451 Int_t nEntries = parentTokens->GetEntries();
453 TString detector = ((TObjString*) parentTokens->At(0) )->GetString();
454 TString subDetector = "";
455 TString subSubDetector = "";
456 TString dataType = "";
457 ULong_t specification = 0;
459 TString name = ((TObjString*) parentTokens->At(1) )->GetString();
460 TString objName = "";
463 subDetector = ((TObjString*) parentTokens->At(2) )->GetString();
464 else if ( nEntries == 4 ) {
465 subDetector = ((TObjString*) parentTokens->At(2) )->GetString();
466 subSubDetector = ((TObjString*) parentTokens->At(3) )->GetString();
469 // -- Corecct TPC subdetector, because in we have somtimes "A","C"
470 if ( ! detector.CompareTo("TPC") ) {
471 if ( subDetector.BeginsWith('A') ) {
472 subDetector.Remove( TString::kLeading, 'A' );
474 else if ( subDetector.BeginsWith('C') ) {
475 subDetector.Remove( TString::kLeading, 'C' );
476 Int_t tmp = subDetector.Atoi() + 18;
482 // -- Correct for MUON
483 if ( ! detector.CompareTo("DIMU") ) {
486 if ( ! subDetector.CompareTo("TRG") )
488 else if ( ! subDetector.CompareTo("TRK") )
492 // -- Remove Leading '0' in sub detector and subsubdetector
493 subDetector.Remove( TString::kLeading, '0' );
494 subSubDetector.Remove( TString::kLeading, '0' );
496 // -- Set Object Names
499 if ( name == "RP" || name == "FP" || name == "Relay" ) {
501 dataType = "DDL_RAW";
506 else if ( detector == "TPC" ) {
508 if ( name == "CalibPedestal" ) {
509 objName = "AliTPCCalibPedestal";
510 dataType = "HIS_CAL";
513 else if ( name == "CalibPulser" ) {
514 objName = "AliTPCCalibPulser";
515 dataType = "HIS_CAL";
518 else if ( name == "CF" || name == "RelayCF" ) {
519 objName = "AliHLTTPCClusterDataFormat";
520 dataType = "CLUSTERS";
523 else if ( name == "ESDConv" ) {
525 dataType = "ESD_TREE";
528 else if ( name == "KryptonCF" ) {
529 objName = "TObjArray";
530 dataType = "KRPTHIST";
534 // not defined yet ...
535 AliError( Form("Parent Process not defined yet : %s .", name.Data()) );
539 } // if ( detector == "TPC" ) {
542 else if ( detector == "TRD" ) {
544 if ( name == "foo" ) {
546 dataType = "FOO_BAR";
549 } // else if ( detector == "TRD" ) {
552 else if ( detector == "PHOS" ) {
554 } // else if ( detector == "PHOS" ) {
557 else if ( detector == "MUON" ) {
558 Int_t UpdateSourcesFromSourcesList( );
559 } // else if ( detector == "MUON" ) {
562 source->SetSourceName( name, objName );
563 source->SetSourceType( specification, dataType );
564 source->SetDetectors( detector, subDetector, subSubDetector );
566 // AliInfo( Form("Set Source %s , Type %s, ClassName %s .", name.Data(), dataType.Data(), objName.Data()) );
567 // AliInfo( Form(" Detector %s , SubDetector : %s, SubSubDetector %s .",
568 // detector.Data(), subDetector.Data(), subSubDetector.Data()) );
574 * ---------------------------------------------------------------------------------
575 * Connection Handling
576 * ---------------------------------------------------------------------------------
579 //##################################################################################
580 Int_t AliEveHOMERManager::ConnectHOMER(){
581 // Connect to HOMER sources, out of Readout List, which gets created when state has changed
582 // * return 0 on sucess, "HOMER" errors on error
587 fStateHasChanged = fSrcList->GetSelectedSources();
589 // -- Check if already connected and state has not changed
590 if ( fStateHasChanged == kFALSE && IsConnected() ) {
591 AliInfo( Form("No need for reconnection.") );
595 // -- If already connected, disconnect before connect
599 // *** Create the Readoutlist
601 UShort_t* sourcePorts = new UShort_t [fSourceList->GetEntries()];
602 const char ** sourceHostnames = new const char* [fSourceList->GetEntries()];
603 UInt_t sourceCount = 0;
605 CreateReadoutList( sourceHostnames, sourcePorts, sourceCount );
607 if ( sourceCount == 0 ) {
608 AliError(Form("No sources selected, aborting.") );
612 // *** Connect to data sources
616 fReader = fLibManager->OpenReader( sourceCount, sourceHostnames, sourcePorts );
619 iResult = fReader->GetConnectionStatus();
622 // -- Connection failed
624 UInt_t ndx = fReader->GetErrorConnectionNdx();
626 if ( ndx < sourceCount ) {
627 AliError( Form("Error : Error establishing connection to TCP source %s:%hu: %s (%d)",
628 sourceHostnames[ndx], sourcePorts[ndx], strerror(iResult), iResult) );
631 AliError( Form("Error : Error establishing connection to unknown source with index %d: %s (%d)",
632 ndx, strerror(iResult), iResult) );
636 fLibManager->DeleteReader( fReader );
641 // -- Connection ok - set reader
644 AliInfo( Form("Connection established") );
647 delete[] sourceHostnames;
648 delete[] sourcePorts;
658 //##################################################################################
659 void AliEveHOMERManager::DisconnectHOMER(){
660 // Disconnect from HOMER sources
662 if ( ! IsConnected() )
666 fLibManager->DeleteReader( fReader );
669 fStateHasChanged = kTRUE;
672 AliInfo( Form("Connection closed") );
677 //##################################################################################
678 Int_t AliEveHOMERManager::ReconnectHOMER(){
679 // Reconnect from HOMER sources
680 // * return 0 on sucess, "ConnectHOMER()" errors on error
687 iResult = ConnectHOMER();
689 AliError( Form("Error connecting.") );
696 //##################################################################################
697 void AliEveHOMERManager::CreateReadoutList( const char** sourceHostnames, UShort_t *sourcePorts, UInt_t &sourceCount ){
698 // Create a readout list for Hostname and ports
699 // * param socurceHostnames Array of selected hostnames
700 // * param socurcePorts Array of selected ports
701 // * param socurceCount Number of selected hostname:port
703 AliHLTHOMERSourceDesc * source= NULL;
705 // -- Read all sources and check if they should be read out
706 TIter next( fSourceList );
707 while ( ( source = (AliHLTHOMERSourceDesc*)next() ) ) {
709 if ( ! source->IsSelected() )
712 Bool_t exists = kFALSE;
714 // -- Loop over existing entries and check if entry is already in readout list
715 for ( UInt_t ii = 0; ii < sourceCount; ii++ ){
716 if ( !strcmp( sourceHostnames[ii], source->GetHostname().Data() ) && sourcePorts[ii] == source->GetPort() ) {
722 // -- Add new entires to readout list
724 sourcePorts[sourceCount] = source->GetPort();
725 sourceHostnames[sourceCount] = source->GetHostname().Data();
729 } // while ( ( source = (AliHLTHOMERSourceDesc*)next() ) ) {
731 fStateHasChanged = kFALSE;
737 * ---------------------------------------------------------------------------------
739 * ---------------------------------------------------------------------------------
742 //##################################################################################
743 Int_t AliEveHOMERManager::NextEvent(){
744 // Loads the next Event, after being connected
745 // * return 0 on sucess, "HOMER" errors on error
749 if ( !fReader || ! IsConnected() ) {
750 AliWarning( Form( "Not connected yet." ) );
754 // -- Read next event data and error handling for HOMER (error codes and empty blocks)
756 iResult = fReader->ReadNextEvent( 20000000 /*timeout in us*/);
758 if ( iResult == 111 || iResult == 32 || iResult == 6 ) {
759 Int_t ndx = fReader->GetErrorConnectionNdx();
760 AliError( Form("Error, No Connection to source %d: %s (%d)",
761 ndx, strerror(iResult), iResult) );
765 else if ( iResult == 110 ) {
766 Int_t ndx = fReader->GetErrorConnectionNdx();
767 AliError( Form("Timout occured, reading event from source %d: %s (%d)",
768 ndx, strerror(iResult), iResult) );
772 else if ( iResult == 56) {
773 Int_t ndx = fReader->GetErrorConnectionNdx();
774 AliError( Form("Retry: Error reading event from source %d: %s (%d)",
775 ndx, strerror(iResult), iResult) );
779 else if ( iResult ) {
780 Int_t ndx = fReader->GetErrorConnectionNdx();
781 AliError( Form("General Error reading event from source %d: %s (%d)",
782 ndx, strerror(iResult), iResult) );
794 // -- Get blockCnt and eventID
795 fNBlks = (ULong_t) fReader->GetBlockCnt();
796 fEventID = (ULong64_t) fReader->GetEventID();
799 AliInfo( Form("Event 0x%016LX (%Lu) with %lu blocks", fEventID, fEventID, fNBlks) );
803 // Loop for Debug only
804 for ( ULong_t i = 0; i < fNBlks; i++ ) {
805 Char_t tmp1[9], tmp2[5];
806 memset( tmp1, 0, 9 );
807 memset( tmp2, 0, 5 );
809 ULong64_t* tmp12 = (ULong64_t*)tmp11;
810 *tmp12 = fReader->GetBlockDataType( i );
812 ULong_t* tmp22 = (ULong_t*)tmp21;
813 *tmp22 = fReader->GetBlockDataOrigin( i );
814 AliInfo( Form("Block %lu length: %lu - type: %s - origin: %s",
815 i, fReader->GetBlockDataLength( i ), tmp1, tmp2) );
816 } // end for ( ULong_t i = 0; i < fNBlks; i++ ) {
820 // -- Create BlockList
821 AliInfo( Form("Create Block List") );
822 iResult = CreateBlockList();
827 //##################################################################################
828 Int_t AliEveHOMERManager::CreateBlockList() {
829 // Create a TList of blocks, which have been readout
833 // -- Initialize block list
834 if ( fBlockList != NULL )
838 fBlockList = new TList();
839 fBlockList->SetOwner( kTRUE );
841 void* iter = GetFirstBlk();
843 // -- Fill block list
844 while ( iter != NULL ){
846 // -- Create new block
847 AliHLTHOMERBlockDesc * block = new AliHLTHOMERBlockDesc( GetBlk(), GetBlkSize(), GetBlkOrigin(),
848 GetBlkType(), GetBlkSpecification() );
850 // -- Check sources list if block is requested
851 if ( CheckIfRequested( block ) )
852 fBlockList->Add( block );
859 } // while ( iter != NULL ){
865 * ---------------------------------------------------------------------------------
867 * ---------------------------------------------------------------------------------
870 //##################################################################################
871 void* AliEveHOMERManager::GetBlk( Int_t ndx ) {
872 // Get pointer to current block in current event
873 // * param ndx Block index
874 // * return returns pointer to blk, NULL if no block present
878 if ( !fReader || ! IsConnected() ) {
879 AliError( Form("Not connected yet.") );
882 if ( ( ndx ) < (Int_t) fNBlks )
883 data = (void*) fReader->GetBlockData( ndx );
889 //##################################################################################
890 ULong_t AliEveHOMERManager::GetBlkSize( Int_t ndx ) {
891 // Get size of block ndx
892 // * param ndx Block index
893 // * return returns pointer to blk, 0 if no block present
897 if ( !fReader || ! IsConnected() ) {
898 AliError( Form("Not connected yet.") );
901 if ( ( ndx ) < (Int_t) fNBlks )
902 length = (ULong_t) fReader->GetBlockDataLength( ndx );
908 //##################################################################################
909 TString AliEveHOMERManager::GetBlkOrigin( Int_t ndx ) {
910 // Get origin of block ndx
911 // * param ndx Block index
912 // * return origin of block
916 // -- Check for Connection
917 if ( !fReader || ! IsConnected() ) {
918 AliError( Form("Not connected yet.") );
922 // -- Check block index
923 if ( ( ndx ) >= (Int_t) fNBlks ) {
924 AliError( Form("Block index %d out of range.", ndx ) );
934 reverseOrigin.data = (UInt_t) fReader->GetBlockDataOrigin( ndx );
936 // -- Reverse the order
937 for (Int_t ii = 3; ii >= 0; ii-- )
938 if ( reverseOrigin.array[ii] != ' ')
939 origin.Append( reverseOrigin.array[ii] );
944 //##################################################################################
945 TString AliEveHOMERManager:: GetBlkType( Int_t ndx ) {
946 // Get type of block ndx
947 // * param ndx Block index
948 // * return type of block
952 // -- Check for Connection
953 if ( !fReader || ! IsConnected() ) {
954 AliError( Form("Not connected yet.") );
958 // -- Check blockk index
959 if ( ( ndx ) >= (Int_t) fNBlks ) {
960 AliError( Form("Block index %d out of range.", ndx ) );
970 reverseType.data = (ULong64_t) fReader->GetBlockDataType( ndx );
972 // -- Reverse the order
973 for (Int_t ii = 7; ii >= 0; ii-- )
974 if ( reverseType.array[ii] != ' ')
975 type.Append( reverseType.array[ii] );
980 //##################################################################################
981 ULong_t AliEveHOMERManager:: GetBlkSpecification( Int_t ndx ) {
982 // Get specification of block ndx
983 // * param ndx Block index
984 // * return specification of block
988 // -- Check for Connection
989 if ( !fReader || ! IsConnected() ) {
990 AliError( Form("Not connected yet.") );
994 // -- Check blockk index
995 if ( ( ndx ) >= (Int_t) fNBlks ) {
996 AliError( Form("Block index %d out of range.", ndx ) );
1000 spec = (ULong_t) fReader->GetBlockDataSpec( ndx );
1005 //##################################################################################
1006 Bool_t AliEveHOMERManager::CheckIfRequested( AliHLTHOMERBlockDesc * block ) {
1007 // Checks if current Block should was requested
1008 // * return returns kTRUE, if block should was requested
1010 Bool_t requested = kFALSE;
1012 AliHLTHOMERSourceDesc * source= NULL;
1014 // -- Read all sources and check if they should be read out
1015 TIter next( fSourceList );
1016 while ( ( source = (AliHLTHOMERSourceDesc*)next() ) ) {
1018 if ( ! source->IsSelected() )
1021 if ( source->GetDetector().CompareTo( block->GetDetector() ) )
1024 if ( source->GetDataType().CompareTo( block->GetDataType() ) )
1027 if ( ! block->HasSubDetectorRange() ) {
1029 if ( source->GetSubDetector().Atoi() != block->GetSubDetector().Atoi() )
1032 if ( ! block->HasSubSubDetectorRange() ) {
1034 if ( source->GetSubSubDetector().Atoi() != block->GetSubSubDetector().Atoi() )
1037 } // if ( ! block->HasSubSubDetectorRange ) {
1038 } // if ( ! block->HasSubDetectorRange ) {
1042 } // while ( ( source = (AliHLTHOMERSourceDesc*)next() ) ) {
1045 AliInfo( Form("Block requested : %s - %s : %s/%s -> %s ", block->GetDetector().Data(), block->GetDataType().Data(),
1046 block->GetSubDetector().Data(), block->GetSubSubDetector().Data(), block->GetClassName().Data() ) );
1049 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() ) );
1055 * ---------------------------------------------------------------------------------
1057 * ---------------------------------------------------------------------------------
1060 //##################################################################################
1061 void AliEveHOMERManager::DumpTPCCalib(TString objectName, Bool_t dumpToFile) {
1062 // Still under testing ...
1064 if ( fTPCPre != NULL )
1067 fTPCPre = new AliTPCPreprocessorOnline();
1069 TList* blockList = GetBlockList();
1071 AliHLTHOMERBlockDesc *desc = 0;
1073 TIter next(blockList);
1075 while ( ( desc = (AliHLTHOMERBlockDesc*)next() ) ) {
1076 if ( ! desc->IsTObject() )
1079 Int_t sectorTPC = 0;
1081 if ( desc->GetSubSubDetector().Atoi() <= 1 ) {
1082 sectorTPC = desc->GetSubDetector().Atoi();
1085 sectorTPC = 36 + desc->GetSubDetector().Atoi();
1088 if ( ! objectName.CompareTo( desc->GetClassName() ) ){
1091 // AliTPCCalibPedestal
1094 if ( ! objectName.CompareTo( "AliTPCCalibPedestal" ) ) {
1095 AliTPCCalROC* calROC = NULL;
1097 AliTPCCalibPedestal * cal = (AliTPCCalibPedestal*) desc->GetTObject();
1098 if ( cal == NULL ) {
1099 cout << "error 1" << endl;
1105 calROC = cal->GetCalRocRMS(sectorTPC);
1106 if ( calROC == NULL ) {
1107 cout << "error 2" << endl;
1111 calROC->SetName(Form("RMS_ROC%d", sectorTPC));
1112 fTPCPre->AddComponent((TObject*) calROC );
1114 calROC = cal->GetCalRocPedestal(sectorTPC);
1115 if ( calROC == NULL ) {
1116 cout << "error 3" << endl;
1121 calROC->SetName(Form("Pedestal_ROC%d", sectorTPC));
1122 cout << "added" << endl;
1123 fTPCPre->AddComponent((TObject*) calROC );
1127 // AliTPCCalibPulser
1130 else if ( ! objectName.CompareTo( "AliTPCCalibPulser" ) ) {
1131 AliTPCCalROC* calROC = NULL;
1133 AliTPCCalibPulser * cal = (AliTPCCalibPulser*) desc->GetTObject();
1137 calROC = cal->GetCalRocT0(sectorTPC);
1138 calROC->SetName(Form("T0_ROC%d", sectorTPC));
1139 fTPCPre->AddComponent((TObject*) calROC );
1141 calROC = cal->GetCalRocQ(sectorTPC);
1142 calROC->SetName(Form("Q_ROC%d", sectorTPC));
1143 fTPCPre->AddComponent((TObject*) calROC );
1145 calROC = cal->GetCalRocRMS(sectorTPC);
1146 calROC->SetName(Form("RMS_ROC%d", sectorTPC));
1147 fTPCPre->AddComponent((TObject*) calROC );
1149 calROC = cal->GetCalRocOutliers(sectorTPC);
1150 calROC->SetName(Form("Outliers_ROC%d", sectorTPC));
1151 fTPCPre->AddComponent((TObject*) calROC );
1159 else if ( ! objectName.CompareTo( "AliTPCCalibCE" ) ) {
1160 AliTPCCalROC* calROC = NULL;
1162 AliTPCCalibPulser * cal = (AliTPCCalibPulser*) desc->GetTObject();
1166 calROC = cal->GetCalRocT0(sectorTPC);
1167 calROC->SetName(Form("T0_ROC%d", sectorTPC));
1168 fTPCPre->AddComponent((TObject*) calROC );
1170 calROC = cal->GetCalRocQ(sectorTPC);
1171 calROC->SetName(Form("Q_ROC%d", sectorTPC));
1172 fTPCPre->AddComponent((TObject*) calROC );
1174 calROC = cal->GetCalRocRMS(sectorTPC);
1175 calROC->SetName(Form("RMS_ROC%d", sectorTPC));
1176 fTPCPre->AddComponent((TObject*) calROC );
1178 calROC = cal->GetCalRocOutliers(sectorTPC);
1179 calROC->SetName(Form("Outliers_ROC%d", sectorTPC));
1180 fTPCPre->AddComponent((TObject*) calROC );
1183 } // if ( ! objectName.CompareTo( desc->GetClassName() ) ) {
1185 } // while ( ( desc = (AliHLTHOMERBlockDesc*)next() ) ) {
1189 fTPCPre->DumpToFile("pedestals.root");
1190 cout << "DUMP" << endl;