From Jochen: changes accumulated during Feb/Mar cosmic run and some coding convention...
authormtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 20 Mar 2008 20:49:02 +0000 (20:49 +0000)
committermtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 20 Mar 2008 20:49:02 +0000 (20:49 +0000)
12 files changed:
EVE/EveHLT/AliEveHOMERManager.cxx
EVE/EveHLT/AliEveHOMERManager.h
EVE/EveHLT/AliEveHOMERManagerEditor.cxx
EVE/EveHLT/AliEveHOMERManagerEditor.h
EVE/EveHLT/AliEveHOMERSourceList.cxx
EVE/EveHLT/AliEveHOMERSourceList.h
EVE/hlt-macros/DIMUONRawReader.C [new file with mode: 0644]
EVE/hlt-macros/geom_hlt.C [new file with mode: 0644]
EVE/hlt-macros/hlt_structs.C
EVE/hlt-macros/homer_display.C
EVE/hlt-macros/rootlogon.C
EVE/hlt-macros/sampleConfig_2.xml [new file with mode: 0755]

index 9086690c4a6aa903001a62c7d62f258e60e43949..ce47c2942ad352cdc9cbf4431651c2ee2adc532e 100644 (file)
 #define __ROOT__
 #define USE_ALILOG
 #define LINUX
-
+// -- -- -- -- -- -- -- 
 #include "AliHLTHOMERLibManager.h"
-
 #include "AliHLTHOMERSourceDesc.h"
 #include "AliHLTHOMERBlockDesc.h"
-
+// -- -- -- -- -- -- -- 
 #include "AliEveHOMERSource.h"
-
-#include "AliLog.h"
-
+// -- -- -- -- -- -- -- 
 #include "TString.h"
 #include <TApplication.h>
 #include "Riostream.h"
@@ -43,8 +40,8 @@
 #include "TList.h"
 #include "TObjString.h"
 #include "TObjArray.h"
-
-// ------------
+// -- -- -- -- -- -- -- 
+#include "AliLog.h"
 #include "AliTPCCalibPedestal.h"
 #include "AliTPCCalibPulser.h"
 #include "AliTPCCalibCE.h"
@@ -66,30 +63,35 @@ ClassImp(AliEveHOMERManager)
 //##################################################################################
 AliEveHOMERManager::AliEveHOMERManager( TString xmlFile ) :
   TEveElementList("AliEveHOMERManager"),
-
   fLibManager(new AliHLTHOMERLibManager),
   fXMLFile(xmlFile),
   fXMLParser(NULL),
   fRootNode(NULL),
   fSourceList(NULL),
   fReader(NULL),
+  fRealm("GPN"),
   fBlockList(NULL),
   fNBlks(0),
   fEventID(0),
   fCurrentBlk(0),
   fConnected(kFALSE),
   fStateHasChanged(kTRUE),
+  fSrcList(NULL),
   fTPCPre(NULL) {
-  // see header file for class documentation
-  // or
-  // refer to README to build package
-  // or
-  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+  // This Class should handle the communication
+  // from the HLT to AliEVE. The HLT sends data via 
+  // the HOMER interface on several TCP ports of nodes 
+  // in the CERN GPN and DCS network.
+  // All this communication is hidden from the user.
+  // 
+  // Right now, a xml file ( SCC1 ) is used to get the
+  // configuration, this will/ has to change to a proxy
+  // running on dedicated nodes.
 }
 
 //##################################################################################
 AliEveHOMERManager::~AliEveHOMERManager() {
-  // see header file for class documentation
+  // The destructor
 
   if ( fLibManager ) {
     if ( fReader )
@@ -111,6 +113,10 @@ AliEveHOMERManager::~AliEveHOMERManager() {
     delete fBlockList;
   fBlockList = NULL;
 
+ if ( fSrcList != NULL )
+    delete fSrcList;
+  fSrcList = NULL;
+  
   if ( fTPCPre != NULL )
     delete fTPCPre;
   fTPCPre = NULL;
@@ -124,7 +130,7 @@ AliEveHOMERManager::~AliEveHOMERManager() {
 
 //##################################################################################
 Int_t AliEveHOMERManager::CreateHOMERSourcesList() {
-  // see header file for class documentation
+  // Create Sources List from HOMER-Proxy
 
   // -- Initialize XML parser
   if ( fXMLParser != NULL )
@@ -195,24 +201,21 @@ Int_t AliEveHOMERManager::CreateHOMERSourcesList() {
   // -- New SourceList has been created --> All Sources are new --> State has changed
   fStateHasChanged = kTRUE;
 
-  /*
-  TIter next(fSourceList);
-  AliHLTHOMERSourceDesc* src = 0;
-  while ((src = (AliHLTHOMERSourceDesc*) next())) {
-    AliEveHOMERSource* re = new AliEveHOMERSource
-      (src,
-       Form("%s-%s-%s %s", src->GetDetector().Data(), src->GetSubDetector().Data(),
-           src->GetSubSubDetector().Data(), src->GetDataType().Data()),
-       "Title?\nNot.");
-    AddElement(re);
-  }
-  */
-
   if ( iResult ) {
     AliWarning( Form("There have been errors, while creating the sources list.") );
   }
   else {
     AliInfo( Form("New sources list created.") );
+    if ( fSrcList ) 
+      delete fSrcList;
+
+    // -- Create new AliEVE sources list 
+    fSrcList = new AliEveHOMERSourceList("HOMER Sources");
+    fSrcList->SetManager(this);
+    
+    AddElement(fSrcList);
+    fSrcList->CreateByType();
   }
 
   return iResult;
@@ -220,8 +223,10 @@ Int_t AliEveHOMERManager::CreateHOMERSourcesList() {
 
 //##################################################################################
 void AliEveHOMERManager::SetSourceState( AliHLTHOMERSourceDesc * source, Bool_t state ) {
-  // see header file for class documentation
-
+  // Set state of a source
+  // * param source      Pointer to AliHLTHOMERSourceDesc object.
+  // * param state       New (selected/not selected) state.
+  
   if ( source->IsSelected() != state ) {
     source->SetState( state );
     fStateHasChanged = kTRUE;
@@ -232,7 +237,9 @@ void AliEveHOMERManager::SetSourceState( AliHLTHOMERSourceDesc * source, Bool_t
 
 //##################################################################################
 Int_t AliEveHOMERManager::GetTDSAttributes( TXMLNode * xmlNode ) {
-  // see header file for class documentation
+  // 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;
 
@@ -276,7 +283,7 @@ Int_t AliEveHOMERManager::GetTDSAttributes( TXMLNode * xmlNode ) {
   // -- Reset loop to TDS node
   prevNode = xmlNode;
 
-  // -- Get Sources out of XML, resolve sources, add to sources ListxmlHostname.Data()
+  // -- Get Sources out of XML, resolve sources, add to sources List
   while ( ( attrNode = prevNode->GetNextNode() ) ) {
     prevNode = attrNode;
 
@@ -306,15 +313,21 @@ Int_t AliEveHOMERManager::GetTDSAttributes( TXMLNode * xmlNode ) {
 
 //##################################################################################
 Int_t AliEveHOMERManager::ResolveHostPortInformation ( TString xmlHostname, TString xmlPort, TString &hostname, Int_t &port ) {
-  // see header file for class documentation
+  // 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
 
-  TXMLNode * node = NULL;
-  TXMLNode * prevNode = fRootNode->GetChildren();
-  TString nodeName = 0;
   while ( ( node = prevNode->GetNextNode() ) && iResult == 1 ) {
     prevNode = node;
 
@@ -328,7 +341,6 @@ Int_t AliEveHOMERManager::ResolveHostPortInformation ( TString xmlHostname, TStr
     TIter next(attrList);
 
     TString nodeId = 0;
-    //    TString nodeName = 0;
 
     // Get "nodeID" and "nodeName" of this "Node" node
     while ( ( attr = (TXMLAttr*)next() ) ) {
@@ -343,15 +355,16 @@ Int_t AliEveHOMERManager::ResolveHostPortInformation ( TString xmlHostname, TStr
       continue;
 
     // -- Set hostname
-
-    // TEMP FIX
-    //    hostname = nodeName;
-    hostname = "alihlt-dcs0";
+    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 ) {
@@ -381,12 +394,30 @@ Int_t AliEveHOMERManager::ResolveHostPortInformation ( TString xmlHostname, TStr
       } else if ( xmlPort.CompareTo("49153") == 0 ){
        port = 50341;
       }
-    } else if ( nodeName.CompareTo("alihlt-dcs0") == 0 ){
+    } 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()) );
+    AliError( Form("Error resolving port : %s", xmlPort.Data()) );
     iResult = 2;
   }
 
@@ -401,7 +432,10 @@ Int_t AliEveHOMERManager::ResolveHostPortInformation ( TString xmlHostname, TStr
 
 //##################################################################################
 Int_t AliEveHOMERManager::ResolveSourceInformation( TString xmlParent, AliHLTHOMERSourceDesc *source ) {
-  // see header file for class documentation
+  // 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;
 
@@ -444,23 +478,33 @@ Int_t AliEveHOMERManager::ResolveSourceInformation( TString xmlParent, AliHLTHOM
       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";
@@ -477,10 +521,20 @@ Int_t AliEveHOMERManager::ResolveSourceInformation( TString xmlParent, AliHLTHOM
       specification = 0;
     }
     else if ( name == "ESDConv" ) {
-      objName = "AliESDEvent";
+      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" ) {
 
@@ -501,7 +555,7 @@ Int_t AliEveHOMERManager::ResolveSourceInformation( TString xmlParent, AliHLTHOM
 
   // **** DIMU ****
   else if ( detector == "MUON" ) {
-
+ Int_t UpdateSourcesFromSourcesList( );
   } // else if ( detector == "MUON" ) {
 
   // -- Fill object
@@ -509,10 +563,9 @@ Int_t AliEveHOMERManager::ResolveSourceInformation( TString xmlParent, AliHLTHOM
   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()) );
+  //  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;
 }
@@ -525,10 +578,14 @@ Int_t AliEveHOMERManager::ResolveSourceInformation( TString xmlParent, AliHLTHOM
 
 //##################################################################################
 Int_t AliEveHOMERManager::ConnectHOMER(){
-  // see header file for class documentation
+  // 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();
+
   // -- Check if already connected and state has not changed
   if ( fStateHasChanged == kFALSE && IsConnected() ) {
     AliInfo( Form("No need for reconnection.") );
@@ -600,7 +657,7 @@ Int_t AliEveHOMERManager::ConnectHOMER(){
 
 //##################################################################################
 void AliEveHOMERManager::DisconnectHOMER(){
-  // see header file for class documentation
+  // Disconnect from HOMER sources
 
   if ( ! IsConnected() )
     return;
@@ -619,7 +676,8 @@ void AliEveHOMERManager::DisconnectHOMER(){
 
 //##################################################################################
 Int_t AliEveHOMERManager::ReconnectHOMER(){
-  // see header file for class documentation
+  // Reconnect from HOMER sources
+  // * return            0 on sucess, "ConnectHOMER()" errors on error
 
   Int_t iResult = 0;
 
@@ -637,7 +695,10 @@ Int_t AliEveHOMERManager::ReconnectHOMER(){
 
 //##################################################################################
 void AliEveHOMERManager::CreateReadoutList( const char** sourceHostnames, UShort_t *sourcePorts, UInt_t &sourceCount ){
-  // see header file for class documentation
+  //  Create a readout list for Hostname and ports
+  // * param socurceHostnames   Array of selected hostnames
+  // * param socurcePorts       Array of selected ports
+  // * param socurceCount       Number of selected hostname:port
 
   AliHLTHOMERSourceDesc * source= NULL;
 
@@ -680,7 +741,8 @@ void AliEveHOMERManager::CreateReadoutList( const char** sourceHostnames, UShort
 
 //##################################################################################
 Int_t AliEveHOMERManager::NextEvent(){
-  // see header file for class documentation
+  // Loads the next Event, after being connected
+  // * return            0 on sucess, "HOMER" errors on error
 
   Int_t iResult = 0;
 
@@ -695,23 +757,30 @@ Int_t AliEveHOMERManager::NextEvent(){
 
     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) );
-
-     return 2;
+      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) );
+      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("Error reading event from source %d: %s (%d) -- IRESULTRY", ndx, strerror(iResult), iResult) );
+      AliError( Form("Retry: Error reading event from source %d: %s (%d)", 
+                    ndx, strerror(iResult), iResult) );
+      fConnected = kFALSE;
       continue;
     }
     else if ( iResult ) {
       Int_t ndx = fReader->GetErrorConnectionNdx();
-      AliError( Form("General Error reading event from source %d: %s (%d)", ndx, strerror(iResult), iResult) );
+      AliError( Form("General Error reading event from source %d: %s (%d)", 
+                    ndx, strerror(iResult), iResult) );
+      fConnected = kFALSE;
       return 2;
     }
     else {
@@ -721,8 +790,7 @@ Int_t AliEveHOMERManager::NextEvent(){
 
   if ( iResult )
     return iResult;
-
-
+  
   // -- Get blockCnt and eventID
   fNBlks = (ULong_t) fReader->GetBlockCnt();
   fEventID = (ULong64_t) fReader->GetEventID();
@@ -730,7 +798,7 @@ Int_t AliEveHOMERManager::NextEvent(){
 
   AliInfo( Form("Event 0x%016LX (%Lu) with %lu blocks", fEventID, fEventID, fNBlks) );
 
-#if 1
+#if 0
 
   // Loop for Debug only
   for ( ULong_t i = 0; i < fNBlks; i++ ) {
@@ -743,20 +811,22 @@ Int_t AliEveHOMERManager::NextEvent(){
     void *tmp21 = tmp2;
     ULong_t* tmp22 = (ULong_t*)tmp21;
     *tmp22 = fReader->GetBlockDataOrigin( i );
-    AliInfo( Form("Block %lu length: %lu - type: %s - origin: %s",i, fReader->GetBlockDataLength( i ), tmp1, tmp2) );
+    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
-  CreateBlockList();
+  AliInfo( Form("Create Block List") );
+  iResult = CreateBlockList();
 
   return iResult;
 }
 
 //##################################################################################
 Int_t AliEveHOMERManager::CreateBlockList() {
-  // see header file for class documentation
+  // Create a TList of blocks, which have been readout
 
   Int_t iResult = 0;
 
@@ -780,9 +850,10 @@ Int_t AliEveHOMERManager::CreateBlockList() {
     // -- Check sources list if block is requested
     if ( CheckIfRequested( block ) )
       fBlockList->Add( block );
-    else
+    else {
       delete block;
-
+      block = NULL;
+    }
     iter = GetNextBlk();
 
   } // while ( iter != NULL ){
@@ -798,8 +869,10 @@ Int_t AliEveHOMERManager::CreateBlockList() {
 
 //##################################################################################
 void* AliEveHOMERManager::GetBlk( Int_t ndx ) {
-  // see header file for class documentation
-
+  // Get pointer to current block in current event
+  // * param ndx        Block index
+  // * return           returns pointer to blk, NULL if no block present
+   
   void* data = NULL;
 
   if ( !fReader || ! IsConnected() ) {
@@ -815,8 +888,10 @@ void* AliEveHOMERManager::GetBlk( Int_t ndx ) {
 
 //##################################################################################
 ULong_t AliEveHOMERManager::GetBlkSize( Int_t ndx ) {
-  // see header file for class documentation
-
+  // Get size of block ndx
+  // * param ndx        Block index
+  // * return           returns pointer to blk, 0 if no block present
+   
   ULong_t length = 0;
 
   if ( !fReader || ! IsConnected() ) {
@@ -832,7 +907,9 @@ ULong_t AliEveHOMERManager::GetBlkSize( Int_t ndx ) {
 
 //##################################################################################
 TString AliEveHOMERManager::GetBlkOrigin( Int_t ndx ) {
-  // see header file for class documentation
+  // Get origin of block ndx
+  // * param ndx        Block index
+  // * return           origin of block
 
   TString origin = "";
 
@@ -866,7 +943,9 @@ TString AliEveHOMERManager::GetBlkOrigin( Int_t ndx ) {
 
 //##################################################################################
 TString AliEveHOMERManager:: GetBlkType( Int_t ndx ) {
-  // see header file for class documentation
+  // Get type of block ndx
+  // * param ndx        Block index
+  // * return           type of block
 
   TString type = "";
 
@@ -898,14 +977,14 @@ TString AliEveHOMERManager:: GetBlkType( Int_t ndx ) {
   return type;
 }
 
-
 //##################################################################################
 ULong_t AliEveHOMERManager:: GetBlkSpecification( Int_t ndx ) {
-  // see header file for class documentation
+  // Get specification of block ndx
+  // * param ndx        Block index
+  // * return           specification of block
 
   ULong_t spec = 0;
 
-
   // -- Check for Connection
   if ( !fReader || ! IsConnected() ) {
     AliError( Form("Not connected yet.") );
@@ -925,7 +1004,8 @@ ULong_t AliEveHOMERManager:: GetBlkSpecification( Int_t ndx ) {
 
 //##################################################################################
 Bool_t AliEveHOMERManager::CheckIfRequested( AliHLTHOMERBlockDesc * block ) {
-  // see header file for class documentation
+  // Checks if current Block should was requested
+  // * return           returns kTRUE, if block should was requested
 
   Bool_t requested = kFALSE;
 
@@ -951,8 +1031,8 @@ Bool_t AliEveHOMERManager::CheckIfRequested( AliHLTHOMERBlockDesc * block ) {
 
       if ( ! block->HasSubSubDetectorRange() ) {
 
-       //      if ( source->GetSubSubDetector().Atoi() != block->GetSubSubDetector().Atoi() )
-       //   continue;
+       if ( source->GetSubSubDetector().Atoi() != block->GetSubSubDetector().Atoi() )
+         continue;
 
       } // if ( ! block->HasSubSubDetectorRange ) {
     } //  if ( ! block->HasSubDetectorRange ) {
@@ -971,85 +1051,15 @@ Bool_t AliEveHOMERManager::CheckIfRequested( AliHLTHOMERBlockDesc * block ) {
   return requested;
 }
 
-//##################################################################################
-void AliEveHOMERManager::TestSelect() {
-  // see header file for class documentation
-
-  for (Int_t ii =0; ii < fSourceList->GetEntries() ; ii++ ) {
-    if ( (ii%2) == 0 )
-      ((AliHLTHOMERSourceDesc*) fSourceList->At(ii))->Select();
-  }
-}
-
-//##################################################################################
-void AliEveHOMERManager::TestSelectClass( TString objectName ) {
-  // see header file for class documentation
-
-  TList* srcList = GetSourceList();
-
-  AliHLTHOMERSourceDesc *desc = 0;
-
-  TIter next(srcList);
-
-  while ( ( desc = (AliHLTHOMERSourceDesc*)next() ) ) {
-    if ( ! desc->GetClassName().CompareTo( objectName ) )
-      desc->Select();
-  }
-}
-
-//##################################################################################
-void AliEveHOMERManager::SelectRawTPC() {
-  // see header file for class documentation
-
-  TList* srcList = GetSourceList();
-
-  AliHLTHOMERSourceDesc *desc = 0;
-
-  TIter next(srcList);
-
-  while ( ( desc = (AliHLTHOMERSourceDesc*)next() ) ) {
-    if ( ! desc->GetDataType().CompareTo( "DDL_RAW" ) ) {
-      desc->Select();
-    }
-  }
-}
-
-//##################################################################################
-void AliEveHOMERManager::SelectClusterTPC() {
-  // see header file for class documentation
-
-  TList* srcList = GetSourceList();
-
-  AliHLTHOMERSourceDesc *desc = 0;
-
-  TIter next(srcList);
-
-  while ( ( desc = (AliHLTHOMERSourceDesc*)next() ) ) {
-    if ( ! desc->GetDataType().CompareTo( "CLUSTERS" ) ) {
-      desc->Select();
-    }
-  }
-}
-
-//##################################################################################
-void AliEveHOMERManager::SelectESDTPC() {
-  // see header file for class documentation
-
-  TList* srcList = GetSourceList();
-
-  AliHLTHOMERSourceDesc *desc = 0;
-
-  TIter next(srcList);
+/*
+ * ---------------------------------------------------------------------------------
+ *                            Test Realm ....
+ * ---------------------------------------------------------------------------------
+ */
 
-  while ( ( desc = (AliHLTHOMERSourceDesc*)next() ) ) {
-    if ( ! desc->GetDataType().CompareTo( "ESD_TREE" ) ) {
-      desc->Select();
-    }
-  }
-}
 //##################################################################################
 void AliEveHOMERManager::DumpTPCCalib(TString objectName, Bool_t dumpToFile) {
-  // see header file for class documentation
+  // Still under testing ...
 
   if ( fTPCPre != NULL )
     delete fTPCPre;
index d078ded9c3b461a612b4704e4ef95a166bdd028e..4f3d6ceaf3f8b519680da14c25393934b9bbf5f1 100644 (file)
@@ -27,6 +27,7 @@
 #include "TXMLNode.h"
 #include "TList.h"
 
+#include "AliEveHOMERSourceList.h"
 #include "AliHLTHOMERSourceDesc.h"
 #include "AliHLTHOMERBlockDesc.h"
 #include "AliHLTHOMERReader.h"
 
 class AliHLTHOMERLibManager;
 
-/**
- * @class AliEveHOMERManager
- *
- * This class is the main class of the AliEveHOMERManager
- * ... more to come
- *
- * @ingroup alihlt_homer
- */
-
 class AliEveHOMERManager : public TEveElementList
 {
-private:
-  AliEveHOMERManager(const AliEveHOMERManager&);            // Not implemented.
-  AliEveHOMERManager& operator=(const AliEveHOMERManager&); // Not implemented.
-
 public:
 
   /*
@@ -59,11 +47,9 @@ public:
    * ---------------------------------------------------------------------------------
    */
 
-  /** constructor
-   * @param argc    Number of command line arguments.
-   * @param argv    Array of command line arguments.
-   */
+  /** constructor */
   AliEveHOMERManager(TString xmlFile="" );
+
   /** destructor */
   virtual ~AliEveHOMERManager();
 
@@ -76,16 +62,11 @@ public:
   /** Create Sources List from HOMER-Proxy */
   Int_t CreateHOMERSourcesList();
 
-  /** Set state of a source
-   * @param source      Pointer to AliHLTHOMERSourceDesc object.
-   * @param state       New (selected/not selected) state.
-   */
+  /** Set state of a source */
   void SetSourceState( AliHLTHOMERSourceDesc* source, Bool_t state);
 
-  /** Get pointer to source List
-   * @return            returns pointer to TList of sources
-   */
-  TList* GetSourceList() { return fSourceList; }
+  /** Get pointer to source List */
+  TList* GetSourceList() { return fSourceList; } // Get pointer to source List
 
   /*
    * ---------------------------------------------------------------------------------
@@ -93,17 +74,13 @@ public:
    * ---------------------------------------------------------------------------------
    */
 
-  /** Connect to HOMER sources, out of Readout List, which gets created when state has changed
-   * @return            0 on sucess, "HOMER" errors on error
-   */
+  /** Connect to HOMER sources, out of Readout List, which gets created when state has changed */
   Int_t ConnectHOMER();
 
   /** Disconnect from HOMER sources */
   void DisconnectHOMER();
 
-  /** Reconnect from HOMER sources
-   * @return            0 on sucess, "ConnectHOMER()" errors on error
-   */
+  /** Reconnect from HOMER sources */
   Int_t ReconnectHOMER();
 
   /*
@@ -112,70 +89,50 @@ public:
    * ---------------------------------------------------------------------------------
    */
 
-  /** Loads the next Event, after being connected
-   * @return            0 on sucess, "HOMER" errors on error
-   */
+  /** Loads the next Event, after being connected */
   Int_t NextEvent();
 
-  /** Get event ID
-   * @return            Returns eventID
-   */
-  ULong_t GetEventID() { return fEventID; }
+  /** Get event ID */
+  ULong_t GetEventID() { return fEventID; }    // Get event ID
 
-  /** Get pointer to block List
-   * @return            returns pointer to TList of blocks
+  /** Get pointer to block List */
+  TList* GetBlockList() { return fBlockList; } // Get pointer to block List
+  
+  /*
+   * ---------------------------------------------------------------------------------
+   *                            Test Realm ....
+   * ---------------------------------------------------------------------------------
    */
-  TList* GetBlockList() { return fBlockList; }
-
-
-  ///////////////////////////////////////////////////////////////////////////////////
-
-  void SelectRawTPC();
-  void SelectClusterTPC();
-  void SelectESDTPC();
-
-  void TestSelect();
-  void TestSelectClass( TString objectName );
 
+  /** Still under testing ... */
   void DumpTPCCalib(TString objectName, Bool_t dumpToFile);
 
   ///////////////////////////////////////////////////////////////////////////////////
 
 protected:
 
-  /** Dynamic loader manager for the HOMER library */
-  AliHLTHOMERLibManager* fLibManager;             //! transient
+  AliHLTHOMERLibManager* fLibManager;             //! Dynamic loader manager for the HOMER library
 
+  ///////////////////////////////////////////////////////////////////////////////////
 
 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
-   * @param xmlNode   Pointer to childs of TDS node
-   * @return          0 on sucess, > 0 on error
-   */
+  /** 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
-   * ( 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,
-   */
+  /** 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
-   * @param xmlParent   ParentString out of the XML
-   * @param source      Return the filled AliHLTHOMERSourceDesc object
-   * @return            0 on sucess, 1 on error
-   */
+  /** Resolve information of source */
   Int_t ResolveSourceInformation( TString xmlParent, AliHLTHOMERSourceDesc * source );
 
   /*
@@ -184,20 +141,17 @@ private:
    * ---------------------------------------------------------------------------------
    */
 
-  /** Create a readout list for Hostname and ports
-   * @param socurceHostnames   Array of selected hostnames
-   * @param socurcePorts       Array of selected ports
-   * @param socurceCount       Number of selected hostname:port
-   */
+  /** Create a readout list for Hostname and ports */
   void CreateReadoutList( const char** socurceHostnames, UShort_t* sourcePorts, UInt_t &sourceCount);
 
-  /** Checks if already connected to HOMER sources
-   * @return             kTRUE or kFALSE, depending on connection state
-   */
-  Bool_t IsConnected() { return fConnected; }
+  /** 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
 
   /* ---------------------------------------------------------------------------------
-   *                            Eve AliEveHOMERManager::foo(nt Handling - private
+   *                            Event Handling - private
    * ---------------------------------------------------------------------------------
    */
 
@@ -210,84 +164,46 @@ private:
    * ---------------------------------------------------------------------------------
    */
 
-  /** Get Number of blocks in current event
-   * @return           returns number of blocks in current event
-   */
-  ULong_t GetNBlks() { return fNBlks; }
+  /** Get Number of blocks in current event */
+  ULong_t GetNBlks() { return fNBlks; }                                        // Get Number of blocks in current event
 
-  /** Get pointer to block ndx in current event
-   * @param ndx        Block index
-   * @return           returns pointer to blk, NULL if no block present
-   */
+  /** Get pointer to block ndx in current event */
   void* GetBlk( Int_t ndx );
 
-  /** Get pointer to current block in current event
-   * @param ndx        Block index
-   * @return           returns pointer to blk, NULL if no block present
-   */
-  void* GetBlk() { return GetBlk( fCurrentBlk ); }
+  /** Get pointer to current block in current event */
+  void* GetBlk() { return GetBlk( fCurrentBlk ); }                             // Get pointer to current block in current event
 
-  /** Get first block in current event
-   * @return           returns pointer to blk, NULL if no block present
-   */
-  void* GetFirstBlk() { return GetBlk( 0 ); }
+  /** Get first block in current event */
+  void* GetFirstBlk() { return GetBlk( 0 ); }                                  // Get first block in current event
 
-  /** Get next block in current event
-   * @return           returns pointer to blk, NULL if no block present
-   */
-  void* GetNextBlk() { return GetBlk( ++fCurrentBlk ); }
+  /** Get next block in current event */
+  void* GetNextBlk() { return GetBlk( ++fCurrentBlk ); }                       // Get next block in current event
 
-  /** Get size of block ndx
-   * @param ndx        Block index
-   * @return           returns pointer to blk, 0 if no block present
-   */
+  /** Get size of block ndx */
   ULong_t GetBlkSize( Int_t ndx );
 
-  /** Get size of current block
-   * @param ndx        Block index
-   * @return           returns pointer to blk, 0 if no block present
-   */
-  ULong_t GetBlkSize() { return GetBlkSize( fCurrentBlk ); }
-
-  /** Get origin of block ndx
-   * @param ndx        Block index
-   * @return           origin of block
-   */
+  /** Get size of current block */ 
+  ULong_t GetBlkSize() { return GetBlkSize( fCurrentBlk ); }                   // Get size of current block 
+  /** Get origin of block ndx */
   TString GetBlkOrigin( Int_t ndx );
 
-  /** Get origin of current block
-   * @param ndx        Block index
-   * @return           origin of block
-   */
-  TString GetBlkOrigin(){ return GetBlkOrigin( fCurrentBlk ); }
+  /** Get origin of current block */
+  TString GetBlkOrigin(){ return GetBlkOrigin( fCurrentBlk ); }                // Get origin of current block
 
-  /** Get type of block ndx
-   * @param ndx        Block index
-   * @return           type of block
-   */
-  TString GetBlkType( Int_t ndx );
+  /** Get type of block ndx */
+  TString GetBlkType( Int_t ndx ); 
 
-  /** Get type of current block
-   * @param ndx        Block index
-   * @return           type of block
-   */
-  TString GetBlkType() { return GetBlkType( fCurrentBlk ); }
+  /** Get type of current block */
+  TString GetBlkType() { return GetBlkType( fCurrentBlk ); }                   // Get type of current block
 
-  /** Get specification of block ndx
-   * @param ndx        Block index
-   * @return           specification of block
-   */
+  /** Get specification of block ndx */
   ULong_t GetBlkSpecification( Int_t ndx );
 
-  /** Get specification of current block
-   * @param ndx        Block index
-   * @return           specification of block
-   */
-  ULong_t GetBlkSpecification(){ return GetBlkSpecification( fCurrentBlk ); }
+  /** Get specification of current block */
+  ULong_t GetBlkSpecification() { return GetBlkSpecification( fCurrentBlk ); } // Get specification of current block
 
-  /** Checks if current Block should was requested
-   * @return           returns kTRUE, if block should was requested
-   */
+  /** Checks if current Block should was requested */
   Bool_t CheckIfRequested( AliHLTHOMERBlockDesc* block );
 
   /*
@@ -297,55 +213,33 @@ private:
    */
 
   // == XML parser ==
-
-  /**   */
-  TString fXMLFile;                               // XML input file
-
-  /**  */
+  TString     fXMLFile;                           // XML input file
   TDOMParser* fXMLParser;                         //! XML parser into DOM model
-
-  /**  */
-  TXMLNode * fRootNode;                           //! Root node of parsed config file
+  TXMLNode *  fRootNode;                          //! Root node of parsed config file
 
   // == 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
 
   // == events ==
-
-  /**  */
-  ULong_t fNBlks;                                 // Number of blockes in current event
-
-  /**  */
+  ULong_t   fNBlks;                               // Number of blockes in current event
   ULong64_t fEventID;                             // EventID of current event
-
-  /**  */
-  ULong_t fCurrentBlk;                            // Current block in current event
+  ULong_t   fCurrentBlk;                          // Current block in current event
 
   // == states ==
-
-  /**  */
   Bool_t fConnected;                              // Shows connection status
-
-  /**  .
-   */
   Bool_t fStateHasChanged;                        // Indicates, if a sources have changes, so that one has to reconnect.
 
+  // == sources ==
+  AliEveHOMERSourceList* fSrcList;                // List of HOMER Sources
 
-  //----
-
+  //-----------------------------------------------------------------------------------------
   AliTPCPreprocessorOnline* fTPCPre;              // Preprocessor for TPC calibration.
 
   ClassDef(AliEveHOMERManager, 0); // Manage connections to HLT data-sources.
index a8b2a59c0cccae40434f5eba8e2661326e6fcf22..b0e7536b68a7c30d0fc793ac5a807f13bef51cb5 100644 (file)
@@ -38,7 +38,8 @@ AliEveHOMERManagerEditor::AliEveHOMERManagerEditor(const TGWindow *p, Int_t widt
   // fXYZZ = new TGSomeWidget(this, ...);
   // AddFrame(fXYZZ, new TGLayoutHints(...));
   // fXYZZ->Connect("SignalName()", "AliEveHOMERManagerEditor", this, "DoXYZZ()");
-  fButt = new TGTextButton(this, "Ooogadooga");
+
+  fButt = new TGTextButton(this, "  Connect to HLT  ");
   AddFrame(fButt); //, new TGLayoutHints(...));
   fButt->Connect("Clicked()", "AliEveHOMERManagerEditor", this, "DoButt()");
 
@@ -69,5 +70,6 @@ void AliEveHOMERManagerEditor::SetModel(TObject* obj)
 
 void AliEveHOMERManagerEditor::DoButt()
 {
-  fM->CreateHOMERSourcesList();
+  // Connects to HOMER sources -> to HLT
+  fM->ConnectHOMER();
 }
index 7014d717e216d7e782282404522782348c2a8b0f..0b167c5f4d95e2353de1471ef3f68a3e8ffdf25d 100644 (file)
@@ -29,7 +29,6 @@ protected:
   AliEveHOMERManager* fM; // fModel dynamic-casted to AliEveHOMERManagerEditor
 
   // Declare widgets
-  // TGSomeWidget*   fXYZZ;
   TGTextButton  *fButt;
 
 public:
@@ -39,7 +38,6 @@ public:
   virtual void SetModel(TObject* obj);
 
   // Declare callback/slot methods
-  // void DoXYZZ();
   void DoButt();
 
   ClassDef(AliEveHOMERManagerEditor, 0); // Editor for AliEveHOMERManager
index a1735bce96f6ef05349cbf4e53ddf557fdf43993..2d1deb6910b8b20f41a434b08bd6a72b75608436 100644 (file)
@@ -67,14 +67,53 @@ void AliEveHOMERSourceList::RebuildSourceReps()
     parentStack.back()->AddElement(src);
 
     parentStack.push_back(src); ++parentLvl;
-
+    /*
     printf("%*s%s [state=%d, handle=0x%lx] {ssdet='%s'}\n", 4*i.level(), "",
           i.description().Data(), i.state().fState,
           (ULong_t) i.state().fHandle,
           i.id().fSSDet.Data());
+
+    */
+  }
+}
+
+
+Bool_t AliEveHOMERSourceList::GetSelectedSources() {
+  // Set selected source in HOMER sources list, of HOMERManager
+
+  if ( ! fManager ) {
+    printf ( "Error : no ptr to HomerManager!");
+    return kFALSE;
+  }
+    
+
+  Bool_t bResult = kFALSE;
+
+  for ( AliEveHOMERSourceMap::iterator iter=fSrcMap->begin(); iter!=fSrcMap->end(); ++iter ) {
+
+    if ( ! iter.state().fHandle ) 
+      continue;
+    
+    fManager->SetSourceState( (AliHLTHOMERSourceDesc*) iter.state().fHandle,iter.state().fState );
+    bResult = kTRUE;
+
+    /*
+    printf("%*s%s [state=%d, handle=0x%lx] {ssdet='%s'}\n", 4*iter.level(), "",
+          iter.description().Data(), iter.state().fState,
+          (ULong_t) iter.state().fHandle,
+          iter.id().fSSDet.Data());
+    */
+
+    
+
+
   }
+
+
+  return bResult;
 }
 
+
 /******************************************************************************/
 /*
 void AliEveHOMERSourceList::SelectAll()
index 3dcc9379b461c2d358f7f0f316ac22d2b5ce3248..c42e204b01c39837b429d23ff20ae4549af0ab69 100644 (file)
@@ -42,6 +42,8 @@ public:
   AliEveHOMERManager* GetManager() const { return fManager; }
   void SetManager(AliEveHOMERManager* m) { fManager = m; }
 
+  Bool_t GetSelectedSources();
+
   void CreateByDet();  // *MENU*
   void CreateByType(); // *MENU*
 
diff --git a/EVE/hlt-macros/DIMUONRawReader.C b/EVE/hlt-macros/DIMUONRawReader.C
new file mode 100644 (file)
index 0000000..ee7d3ad
--- /dev/null
@@ -0,0 +1,231 @@
+#include "AliMUONTrackerDDLDecoder.h"
+#include "AliMUONTrackerDDLDecoderEventHandler.h"
+
+#include "hlt_structs.C"
+
+
+class DiMuonTrackerCustomHandler : public AliMUONTrackerDDLDecoderEventHandler
+{
+public:
+
+//   void OnData(UInt_t data) // Old type
+  void OnNewBusPatch(const AliMUONBusPatchHeaderStruct* header, const void* data)
+  {
+    fBusPatchId = header->fBusPatchId;
+  }
+
+  void OnData(const UInt_t data, bool isTrue)
+  {
+
+    fData[fDataCount].fDataId &= 0x0;
+    fData[fDataCount].fDataId = (fData[fDataCount].fDataId|fBusPatchId)<<17;  
+    fData[fDataCount].fDataId |= ((UInt_t)(data>>12) & 0x1FFFF) ;
+
+    fData[fDataCount].fADC = (UShort_t)(data) & 0xFFF;
+    
+    fDataCount++;
+    if(fDataCount>(27000-1))
+      cerr<<"Running Out of memory "<<endl;
+
+  };
+  
+  void OnError(ErrorCode code, const void* location)
+  {
+    
+    printf("Errorcode : %d, %s, %s\n",
+          code,ErrorCodeToString(code),ErrorCodeToMessage(code));
+  };
+  
+  void ResetDataCounter(){
+    fDataCount = 0;
+  }
+
+  Int_t GetDataSize(){return fDataCount;};
+
+  AliHLTMUONTrackerRawData GetData(Int_t iData){return fData[iData] ;};
+
+private:
+  Int_t fDataCount;
+  Int_t fMaxDataCount;
+  UInt_t fBusPatchId;
+  AliHLTMUONTrackerRawData fData[27000];
+};
+
+class DiMuonTriggerDDLDecoder : public TObject
+{
+public : 
+
+  DiMuonTriggerDDLDecoder(){;}
+  virtual ~DiMuonTriggerDDLDecoder(void){;}
+  void SetTriggerMappingData(AliHLTMUONTriggerMappingData* mappingData){ fMapData = mappingData;}
+  bool Decode(int* rawData);
+
+  void ResetDataCounter(){
+    fDataCount = 0;
+  }
+  Int_t GetDataSize(){return fDataCount;}
+
+  AliHLTMUONTriggerPointData  GetData(Int_t iData){return fData[iData] ;}
+  
+  
+private:
+  AliHLTMUONTriggerMappingData* fMapData;
+  Int_t fDataCount;
+  Int_t fMaxDataCount;
+  AliHLTMUONTriggerPointData fData[27000];
+};
+
+bool DiMuonTriggerDDLDecoder::Decode(int* rawData)
+{
+
+  int nofTrigRec = 0;
+  int index = 0;
+  int reg_output, reg_phys_trig_occur;
+  int iLocIndex,loc,locDec,triggY,sign,loDev,triggX;
+  short pattern[2][4]; // 2 stands for two cathode planes and 4 stands for 4 chambers
+       
+  int phys_trig_occur = (rawData[index]>>30)&0x1; // 1 for physics trigger, 0 for software trigger
+       
+  if (not phys_trig_occur) // for software trigger
+    index += 8 ;// corresponding to scalar words
+       
+  index += 1 ; // To skip the separator 0xDEADFACE
+  
+  index += 4 ; // corresponding to global input
+  
+  index += 1 ; // reaches to global output
+  
+  if (not phys_trig_occur) index += 10; // corresponds to scalar words
+       
+  index += 1; // separator 0xDEADBEEF 
+       
+  for (int iReg = 0; iReg < 8; iReg++){
+
+    index += 1; // DARC Status Word
+    index += 1; // Regeional Word
+    reg_output = rawData[index] & 0xFF;
+    reg_phys_trig_occur = ( rawData[index] >> 31) & 0x1;
+//     cout<<" reg_phys_trig_occur : "<<reg_phys_trig_occur<<endl;
+    index += 2; // 2 words for regional input
+    
+    index += 1; // L0 counter
+    
+    if (not reg_phys_trig_occur) index += 10;
+    
+    index += 1; // end of Regeonal header 0xBEEFFACE
+    
+    for(int iLoc = 0; iLoc < 16 ; iLoc++){
+      
+      iLocIndex = index;
+      
+      loc = (rawData[index+5] >> 19) &  0xF ;
+
+      locDec = (rawData[index+5] >> 15) & 0xF;
+      triggY = (rawData[index+5] >> 14) & 0x1;
+      sign = (rawData[index+5] >> 9) & 0x1;
+      loDev = (rawData[index+5] >> 5) & 0xF ;
+      triggX = (loDev >> 4 & 0x1 ) && !(loDev & 0xF);
+      
+      if( locDec != 0x9 ){ // check for Dec
+         
+       index += 1;
+       pattern[0][0] = rawData[index] & 0xFFFF; // x-strip pattern for chamber 0 
+       pattern[0][1] = (rawData[index] >> 16) & 0xFFFF; // x-strip pattern for chamber 1
+       index += 1; 
+       pattern[0][2] = rawData[index] & 0xFFFF; 
+       pattern[0][3] = (rawData[index] >> 16) & 0xFFFF; 
+       
+       index += 1;
+       pattern[1][0] = rawData[index] & 0xFFFF; // y-strip pattern for chamber 0
+       pattern[1][1] = (rawData[index] >> 16) & 0xFFFF; // y-strip pattern for chamber 0 
+       index += 1; 
+       pattern[1][2] = rawData[index] & 0xFFFF; 
+       pattern[1][3] = (rawData[index] >> 16) & 0xFFFF; 
+       
+
+       if (pattern[0][0] || pattern[0][1] || pattern[0][2] || pattern[0][3]
+           || pattern[1][0] || pattern[1][1] || pattern[1][2] || pattern[1][3]
+           ){
+             
+
+         bool Xset[4] = {false, false, false, false};
+         bool Yset[4] = {false, false, false, false};
+         AliHLTMUONTriggerPointData fHit[4];
+
+         for (int iChamber = 0; iChamber < 4 ; iChamber++){ //4 chambers per DDL 
+           for (int iPlane = 0; iPlane < 2 ; iPlane++){ // 2 cathode plane
+             for (Int_t ibitxy = 0; ibitxy < 16; ++ibitxy){
+               
+               if (((pattern[iPlane][iChamber] >> ibitxy) & 0x1) != 0x1)
+                 continue;
+                       
+               if (iPlane == 1){
+                 if((fMapData->fLut[iReg][iLoc][iChamber][iPlane][ibitxy]).fX != 0){
+
+                   fHit[iChamber].fX = (fMapData->fLut[iReg][iLoc][iChamber][iPlane][ibitxy]).fX ;
+                   fHit[iChamber].fDetElemId = (fMapData->fLut[iReg][iLoc][iChamber][iPlane][ibitxy]).fDetElemId ;
+                   
+                   Xset[iChamber] = true ;
+                 }
+               }
+               else{
+                 if((fMapData->fLut[iReg][iLoc][iChamber][iPlane][ibitxy]).fY != 0){
+                   
+                   fHit[iChamber].fY = (fMapData->fLut[iReg][iLoc][iChamber][iPlane][ibitxy]).fY ;
+                   fHit[iChamber].fZ = (fMapData->fLut[iReg][iLoc][iChamber][iPlane][ibitxy]).fZ ;
+                   
+//                 cout<<"2: X : "<<fMapData[iReg][iLoc][iChamber][iPlane][ibitxy].fX<<endl;
+//                 cout<<"2: Y : "<<fMapData[iReg][iLoc][iChamber][iPlane][ibitxy].fY<<endl;
+//                 cout<<"2: Z : "<<fMapData[iReg][iLoc][iChamber][iPlane][ibitxy].fZ<<endl;
+                   
+                   Yset[iChamber] = true ;
+                 }
+               }
+
+             }// loop of ibitxy
+           }// iplane
+           
+//         cout<<endl;
+             
+           }// ichamber
+         
+         for (int iChamber = 0; iChamber < 4 ; iChamber++){ //4 chambers per DDL 
+           if(Yset[iChamber] and Xset[iChamber]){
+//           cout<<"chamber : "<<iChamber
+//               <<", (X, Y, Z) : ("<<fHit[iChamber].fX
+//               <<", "<<fHit[iChamber].fY
+//               <<", "<<fHit[iChamber].fZ
+//               <<") "<<endl;
+             fData[fDataCount].fDetElemId = fHit[iChamber].fDetElemId ;
+             fData[fDataCount].fX = fHit[iChamber].fX ;
+             fData[fDataCount].fY = fHit[iChamber].fY ;
+             fData[fDataCount].fZ = fHit[iChamber].fZ ;
+             fDataCount++;
+
+             if(fDataCount>(27000-1)){
+               cerr<<"Running Out of memory "<<endl;
+               return false;
+             }// if data overflow quit
+             
+           }// of both chamber
+         }// chamber loop
+             
+         nofTrigRec++;
+             
+             
+       }// if any non zero pattern found
+       
+       index += 1 ; // the last word, important one
+      }// Dec Condn
+      
+      if (not reg_phys_trig_occur)
+       index += 45;
+      
+      index += 1; // end of local Data 0xCAFEFADE
+      
+      index = iLocIndex + 6; //important to reset the index counter for fake locids like 235 
+    }// iLoc loop
+  }// iReg Loop
+
+  return true;
+}
diff --git a/EVE/hlt-macros/geom_hlt.C b/EVE/hlt-macros/geom_hlt.C
new file mode 100644 (file)
index 0000000..a786bc3
--- /dev/null
@@ -0,0 +1,82 @@
+/**************************************************************************
+ * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
+ * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
+ * full copyright notice.                                                 *
+ **************************************************************************/
+
+/*
+ *   Geometry as used for HLT 
+ */
+
+#include "AliEveMUONData.h"
+#include "AliEveMUONChamber.h"
+
+#include "TEveGeoShapeExtract.h"
+#include "TEveGeoNode.h"
+#include "TEveManager.h"
+#include "TEveEventManager.h"
+#include "TEveElement.h"
+
+#include "TFile.h"
+#include "TStyle.h"
+
+TEveGeoShape* geom_hlt()
+{
+  TFile f("$REVESYS/alice-data/gentle_geo.root");
+  TEveGeoShapeExtract* gse = (TEveGeoShapeExtract*) f.Get("Gentle");
+  TEveGeoShape* gsre = TEveGeoShape::ImportShapeExtract(gse, 0);
+  f.Close();
+
+  TEveElement* elTRD = gsre->FindChild("TRD+TOF");
+  elTRD->SetRnrState(kFALSE);
+
+  TEveElement* elPHOS = gsre->FindChild("PHOS");
+  elPHOS->SetRnrState(kFALSE);
+
+  TEveElement* elHMPID = gsre->FindChild("HMPID");
+  elHMPID->SetRnrState(kFALSE);
+
+  Int_t MUON_geom();
+  MUON_geom();
+
+  return gsre;
+}
+
+Int_t MUON_geom()
+{
+
+  AliEveMUONChamber*   mucha[14];
+
+
+  AliEveMUONData * g_muon_data = new AliEveMUONData;
+
+  gStyle->SetPalette(1, 0);
+
+  gEve->DisableRedraw();
+
+  TEveElementList* mul = new TEveElementList("MUONChambers");
+  TEveElementList* muChData = new TEveElementList("MUONChamberData");
+  mul->SetTitle("MUON chambers");
+  mul->SetMainColor(Color_t(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);
+    
+  }
+
+  gEve->Redraw3D(kTRUE);
+  gEve->EnableRedraw();
+
+  
+  return true;
+}
index 0517ec4f059501cc6cc9089727d626936d535599..71ff8addd45e890e6714872437fcf1390a6c8898 100644 (file)
@@ -7,16 +7,15 @@
  * full copyright notice.                                                 *
  **************************************************************************/
 #include <Rtypes.h>
+#include "TEveElement.h"
+#include "TPolyMarker3D.h"
 
 struct AliHLTTPCSpacePointData
 {
-  //#ifdef do_mc
-  //Int_t fTrackID[3];
-  //#endif
-  Float_t fX;  //==fPadRow in local system
+  Float_t fX;       // == fPadRow in local system
   Float_t fY;
   Float_t fZ;
-  UInt_t fID;  //contains slice patch and number
+  UInt_t fID;       //contains slice patch and number
   UChar_t fPadRow;
   Float_t fSigmaY2; //error (former width) of the clusters
   Float_t fSigmaZ2; //error (former width) of the clusters
@@ -31,5 +30,30 @@ struct AliHLTTPCClusterData
   AliHLTTPCSpacePointData fSpacePoints[1];
 };
 
+
+struct AliHLTMUONTrackerRawData{
+  UInt_t fDataId;
+  UShort_t fADC;
+};
+
+struct AliHLTMUONTrackerMappingData{
+  Int_t fDetElemId;
+  Int_t fIX,fIY;
+  Int_t fCath;
+  Float_t fRealX,fRealY,fRealZ;
+  Int_t fADC;
+  Float_t fPed;
+  Float_t fSigma;
+};
+
+struct AliHLTMUONTriggerPointData{
+  Int_t fDetElemId;
+  Float_t fX,fY,fZ ;
+};
+
+struct AliHLTMUONTriggerMappingData{
+  AliHLTMUONTriggerPointData fLut[8][16][4][2][16];
+};
+
 void hlt_structs()
 {}
index f17737551dab76e8036044960a14e40995fc02bf..34f4ea1b061196594b833de7e61bb8031e0b3c3e 100644 (file)
@@ -16,7 +16,6 @@
 //
 // nextEvent() will get next event from HOMER.
 
-
 #include "TTimer.h"
 #include "TRandom.h"
 #include "TVirtualPad.h"
@@ -34,14 +33,88 @@ class AliEveTPCLoader;
 class AliEveTPCData;
 class AliEveTPCSector2D;
 class AliEveTPCSector3D;
+class AliEveITSDigitsInfo;
+
+#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 "TEveElement.h"
+
+#include "AliESDEvent.h"
+#include "AliCDBManager.h"
+#include "AliRawReaderMemory.h"
+
+#include "AliEveHOMERManager.h"
+#include "AliEveTPCLoader.h"
+#include "AliEveTPCData.h"
+#include "AliEveITSDigitsInfo.h"
+#include "AliEveITSModule.h"
+
+#include "AliHLTHOMERBlockDesc.h"
+#include "AliTPCRawStream.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"
+
+//***********************************************************
+
+// -- globals --
+
+AliEveTPCLoader*                          gTPCLoader    = 0;
+AliEveTPCData*                            gTPCData      = 0;
+TEvePointSet*                             gTPCClusters  = 0;
+TEveTrackList*                            gTPCTrack     = 0;
 
-AliEveTPCLoader* loader  = 0;
-AliEveTPCData*   tpcdata = 0;
-TEvePointSet*    tpc_cls = 0;
-TEveTrackList*   tpc_trk = 0;
+AliEveITSDigitsInfo*                      gITSDigits    = 0; 
 
-AliRawReaderMemory* memreader = 0;
-AliEveHOMERManager* homerM = 0;
+AliRawReaderMemory*                       gMemReader    = 0;
+AliEveHOMERManager*                       gHomerManager = 0;
+
+//***********************************************************
+
+map <UInt_t,AliHLTMUONTrackerMappingData> gDimuTrackerMapping;
+vector<UInt_t>                            gDimuTrackerDataList;
+vector<AliHLTMUONTriggerPointData>        gDimuTriggerDataList;
+AliHLTMUONTriggerMappingData              gDimuTriggerMapping[2];
+Bool_t                                    gMUONRawData = false;
+
+
+Int_t globMaxPoint = 0 ;
+
+//***********************************************************
+
+// -- needed below ??
 
 Int_t    event  = -1;
 
@@ -52,155 +125,462 @@ TThread* ldthread = 0;
 
 TRandom  rnd(0);
 
+Bool_t vC = kFALSE;
+TGFileBrowser *g_hlt_browser = 0;
+TCanvas       *g_hlt_canvas  = 0;
+
 TGLViewer::ECameraType camera = TGLViewer::kCameraPerspXOZ;
 
+//****************************************************************************
+Int_t nextEvent(Int_t ADCCut = 6);
 
 //****************************************************************************
-void nextEvent();
+Int_t processSPDRawData( AliHLTHOMERBlockDesc* block );
+Int_t drawSPDRawData();
 
 //****************************************************************************
-void process_tpc_clusters(AliHLTHOMERBlockDesc* b);
+Int_t processTPCRawData( AliHLTHOMERBlockDesc* block );
+Int_t processTPCClusters( AliHLTHOMERBlockDesc* block );
+Int_t processTPCTracks( AliHLTHOMERBlockDesc* block );
 
 //****************************************************************************
-void homer_display()
-{
-  //  homerM = new AliEveHOMERManager("/local/home/hlt/TPC-SCC1-Generate.xml");
-  homerM = new AliEveHOMERManager("./sampleConfig.xml");
+Int_t initDiMuonMapping();
+Int_t initTrackerMapping() ;
+Int_t processDiMuonRawData( AliHLTHOMERBlockDesc* block );
+Int_t drawDiMuonRawData(Int_t);
 
-  gEve->AddToListTree(homerM, kTRUE);
+//****************************************************************************
+TEveTrack* makeESDTrack( TEveTrackPropagator*   rnrStyle,
+                        Int_t                  idx,
+                        AliESDtrack*           at,
+                        AliExternalTrackParam* tp = 0 );
+
+//****************************************************************************
+void homer_display(Int_t run = 0) {
 
-  homerM->CreateHOMERSourcesList();
+  AliCDBManager::Instance()->SetRun(run);
+  AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
   
-  //  homerM->SelectRawTPC();
-  homerM->SelectClusterTPC();
-  homerM->SelectESDTPC();
-  homerM->ConnectHOMER();
+  gMemReader = new AliRawReaderMemory(0, 0);
 
-  memreader = new AliRawReaderMemory(0, 0);
   gStyle->SetPalette(1, 0);
 
-  loader = new AliEveTPCLoader;
-  loader->SetDoubleSR(kTRUE);
-  loader->SetInitParams(40, 900, 10, 100); // Sector params (mint, maxt, thr, maxval)
-  //loader->SetInitParams(40, 1023, 10); // Sector params (mint, maxt, thr)
-  tpcdata = loader->GetData();
-  tpcdata->SetLoadPedestal(0);
-  tpcdata->SetLoadThreshold(0);
-  // tpcdata->SetAutoPedestal(kTRUE); // For non-zero suppressed data.
-  tpcdata->SetAutoPedestal(kFALSE);
-  gEve->AddElement(loader);
-
-  tpc_cls = new TEvePointSet("TPC Clusters");
-  tpc_cls->SetMainColor((Color_t)kRed);
-  gEve->AddElement(tpc_cls);
-
-  tpc_trk = new TEveTrackList("TPC Tracks");
-  gEve->AddElement(tpc_trk);
-  tpc_trk->SetMainColor(Color_t(6));
-  TEveTrackPropagator* rnrStyle = tpc_trk->GetPropagator();
-  rnrStyle->SetMagField( 5 );
-
-  nextEvent();
-}
+  // -- Create HOMER Manager
+  gHomerManager = new AliEveHOMERManager("/local/home/hlt/AliEVE-Config.xml");
+
+  // -- Set Realm  ( can be "GPN","ACR","HLT" )
+  gHomerManager->SetRealm("ACR"); 
+  
+  gEve->AddToListTree(gHomerManager, kTRUE);
+
+  // -- Create list of HOMER sources
+  gHomerManager->CreateHOMERSourcesList();
+
+  // -- TPC Loader
+  gTPCLoader = new AliEveTPCLoader;
+  gTPCLoader->SetDoubleSR(kTRUE);
+  gTPCLoader->SetInitParams(40, 900, 10, 100);   // Sector params (mint, maxt, thr, maxval)
+  
+  // -- TPC Data
+  gTPCData = gTPCLoader->GetData();
+  gTPCData->SetLoadPedestal(0);
+  gTPCData->SetLoadThreshold(0);
+  gTPCData->SetAutoPedestal(kFALSE);             // For zero suppressed data.
 
+  // -- Load MUON mapping
+  initDiMuonMapping();  
+
+  gEve->AddElement(gTPCLoader);
+}
 
 //****************************************************************************
-void nextEvent()
-{
-  tpcdata->DropAllSectors();
-  tpc_cls->Reset();
-  tpc_trk->DestroyElements();
+Int_t nextEvent(Int_t ADCCut) {
 
-  homerM->NextEvent();
-  TIter next(homerM->GetBlockList());
-  AliHLTHOMERBlockDesc* b = 0;
-  while ((b = (AliHLTHOMERBlockDesc*)next())) {
+  Int_t iResult = 0;
 
-    //    printf("Q - %s\n", b->GetDataType().Data());
+  // ** Get Next Event from HOMER
+  if ( gHomerManager->NextEvent() ) 
+    return ++iResult;
 
-    if (b->GetDataType().CompareTo("CLUSTERS") == 0) {
-      process_tpc_clusters(b);
-      tpc_cls->ElementChanged();
-    }
+  // ** Reset
+  if ( gTPCClusters ) gTPCClusters->Reset();
+  if ( gTPCTrack )    gTPCTrack->DestroyElements();
+  if ( gTPCData )     gTPCData->DropAllSectors();
 
-    else if (b->GetDataType().CompareTo("DDL_RAW") == 0) {
-      Int_t slice = b->GetSubDetector().Atoi();
-      Int_t patch = b->GetSubSubDetector().Atoi();
-      Int_t eqid = 768 + patch;
-      if (patch >= 2)
-       eqid += 4*slice + 70;
-      else
-       eqid += 2*slice;
-
-      //printf("%d %d %d -- %p %d\n", slice, patch, eqid, b->GetData(), b->GetSize());
-
-      memreader->SetMemory(b->GetData(), b->GetSize());
-      memreader->SetEquipmentID(eqid);
-      memreader->Reset();
-
-      AliTPCRawStream input(memreader);
-      input.SetOldRCUFormat(kTRUE);
-      //input.SetOldRCUFormat(kFALSE);
-      memreader->Select("TPC"); // ("TPC", firstRCU, lastRCU);
-      tpcdata->LoadRaw(input, kTRUE, kTRUE);
+  if ( gITSDigits ) {
+    delete gITSDigits;
+    gITSDigits = NULL;
+  }
+  
+  if(gDimuTrackerDataList.size()>0)
+    gDimuTrackerDataList.clear();
+
+  if(gDimuTriggerDataList.size()>0)
+    gDimuTriggerDataList.clear();
+
+  for(Int_t ipoint=0;ipoint<globMaxPoint;ipoint++)
+    point3d[ipoint].SetPoint(0,0.0,0.0,0.0);
+
+
+  // ----------------------------------- foo A
+  vC = kFALSE;
+
+  // 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() );
+    
+    // +++ CLUSTERS BLOCK
+    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++
+    if ( block->GetDataType().CompareTo("CLUSTERS") == 0 ) {
+
+      // ** Initialize TPC Clusters
+      if ( !gTPCClusters ) {
+       gTPCClusters = new TEvePointSet("TPC Clusters");
+       gTPCClusters->SetMainColor((Color_t)kRed);
+       gTPCClusters->SetMarkerStyle((Style_t)kFullDotSmall);
+       gEve->AddElement(gTPCClusters);
+      }
+
+      // ** Process Clusters
+      processTPCClusters( block );
+    
+      gTPCClusters->ElementChanged();
+
+      // +++ ESD BLOCK
+      // +++++++++++++++++++++++++++++++++++++++++++++++++++++++
+    } else if ( block->GetDataType().CompareTo("ESD_TREE") == 0 ) {
+
+      // ** Initialize TPC Tracks
+      if ( !gTPCTrack ) {
+       gTPCTrack = new TEveTrackList("TPC Tracks");
+       gTPCTrack->SetMainColor((Color_t)kBlue);
+
+       gEve->AddElement(gTPCTrack);
+       
+       TEveTrackPropagator* rnrStyle = gTPCTrack->GetPropagator();
+       rnrStyle->SetMagField( 0 );
+       rnrStyle->SetFitDecay( 1 );
+      }
+
+      // ** Proces Tracks
+      processTPCTracks( block );
+      
+      // +++ RAW DATA BLOCK
+      // +++++++++++++++++++++++++++++++++++++++++++++++++++++++
+    } else if ( block->GetDataType().CompareTo("DDL_RAW") == 0 ) {
+
+      // -- TPC
+      // -----------------------------------------------------
+      if ( ! block->GetDetector().CompareTo("TPC") )
+       processTPCRawData( block );
+
+      // -- SPD 
+      // -----------------------------------------------------
+      else if ( ! block->GetDetector().CompareTo("SPD") ) {
+       // !!!!!! TODO add also other ITS detectors
+
+       // ** Initialize SPD Digits
+       if ( !gITSDigits ) {
+         gITSDigits = new AliEveITSDigitsInfo();
+       }
+         
+       processSPDRawData( block );             
+      }
+
+      // -- MUON
+      // -----------------------------------------------------
+      else if ( ! block->GetDetector().CompareTo("MUON") ) {
+
+       if( processDiMuonRawData ( block ) )
+         gMUONRawData = true;
+      }
+      
+      // +++ KRYPTON HISTOGRAM BLOCK
+      // +++++++++++++++++++++++++++++++++++++++++++++++++++++++
+    } else if (block->GetDataType().CompareTo("KRPTHIST") == 0) {
+      
+      
+
+
+      // ++ else
+      // +++++++++++++++++++++++++++++++++++++++++++++++++++++++
+    } else {
+
+
+      printf ("This is nothing");
     }
+    
   }
 
-  loader->UpdateSectors(kTRUE); // true -> delete non present
-  tpc_cls->ResetBBox();
-  tpc_trk->MakeTracks();
+  if ( gTPCLoader )   gTPCLoader->UpdateSectors( kTRUE );
+  if ( gTPCClusters ) gTPCClusters->ResetBBox();
+  if ( gTPCTrack )    gTPCTrack->MakeTracks();
+  if ( gITSDigits )   drawSPDRawData();
+  if ( gMUONRawData ) drawDiMuonRawData ( ADCCut ) ;
 
-  gEve->Redraw3D(1, 1);
+  gEve->Redraw3D(0,1); // (0, 1)
+  gMUONRawData = false;
+  
+  return iResult;
 }
 
+
 //****************************************************************************
-void process_tpc_clusters(AliHLTHOMERBlockDesc* b)
-{
-  AliHLTTPCClusterData    *cd = (AliHLTTPCClusterData*) b->GetData();
-  UChar_t *data = (UChar_t*) cd->fSpacePoints;
-
-  //  printf("XXX %p %d; sizeof=%d, calcsize=%d\n", b->GetData(), cd->fSpacePointCnt,
-  //    sizeof(AliHLTTPCSpacePointData), (b->GetSize() - 4)/cd->fSpacePointCnt);
-
-  Int_t   slice = b->GetSubDetector().Atoi();
-  Float_t phi = (slice+0.5)*TMath::Pi()/9.0;
-  Float_t cos = TMath::Cos(phi);
-  Float_t sin = TMath::Sin(phi);
-
-  for (Int_t i = 0; i < cd->fSpacePointCnt; ++i, data += sizeof(AliHLTTPCSpacePointData)) {
-    AliHLTTPCSpacePointData *sp = (AliHLTTPCSpacePointData *) data;
-    //if (i % 100 == 0)
-    //printf("  %4d  %6.2f, %6.2f, %6.2f\n", i, sp->fX, sp->fY, sp->fZ);
-    tpc_cls->SetNextPoint(cos*sp->fX - sin*sp->fY,
-                         sin*sp->fX + cos*sp->fY,
-                         sp->fZ);
+Int_t processSPDRawData(AliHLTHOMERBlockDesc* block) {
+  Int_t iResult = 0;
+
+  Int_t partition = block->GetSubDetector().Atoi();
+  Int_t eqId      = partition;
+
+  gMemReader->SetMemory( reinterpret_cast<UChar_t*> ( block->GetData() ), block->GetSize() );
+  gMemReader->SetEquipmentID( eqId );
+  gMemReader->Reset();
+
+  gITSDigits->ReadRaw( gMemReader, 3);
+
+  return iResult;
+}
+
+//****************************************************************************
+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( (Color_t) 2 );
+  gEve->AddElement( layer1 );
+  
+  for ( sector=0; sector<10; sector++ ) {
+    sSector  = bsSector;
+    sSector += sector;
+
+    TEveElementList* relSector = new TEveElementList( sSector.Data() );
+    relSector->SetMainColor( (Color_t) 2 );
+    gEve->AddElement( relSector, layer1 );
+
+    for ( stave=0; stave<2; stave++ ) {
+      sStave  = bsStave;
+      sStave += stave;
+      
+      TEveElementList* relStave = new TEveElementList( sStave.Data() );
+      relStave->SetMainColor( (Color_t) 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( (Color_t) 2 );
+  gEve->AddElement(layer2);
+  
+  for ( sector=0; sector<10; sector++ ) {
+    sSector  = bsSector;
+    sSector += sector;
+    
+    TEveElementList* relSector = new TEveElementList( sSector.Data() );
+    relSector->SetMainColor( (Color_t) 2 );
+    gEve->AddElement(relSector, layer2 );
+    
+    for ( stave=0; stave<4; stave++ ) {
+      sStave  = bsStave;
+      sStave += stave;
+
+      TEveElementList* relStave = new TEveElementList( sStave.Data() );
+      relStave->SetMainColor( (Color_t) 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;
+}
+
+
+//****************************************************************************
+Int_t processTPCRawData(AliHLTHOMERBlockDesc* block) {
+
+  Int_t iResult = 0;
+
+  Int_t sector = block->GetSubDetector().Atoi();
+  Int_t patch  = block->GetSubSubDetector().Atoi();
+  Int_t eqId   = 768 + patch;
+  
+  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());
+
+  gMemReader->SetMemory( reinterpret_cast<UChar_t*> ( block->GetData() ), block->GetSize() );
+  gMemReader->SetEquipmentID( eqId );
+  gMemReader->Reset();
+
+  AliTPCRawStream tpcStream( gMemReader );
+  tpcStream.SetOldRCUFormat(kTRUE);      
+  gMemReader->Select("TPC"); 
+  
+  gTPCData->LoadRaw( tpcStream, kTRUE, kTRUE );
+
+  return iResult;
+}
+
+//****************************************************************************
+Int_t processTPCClusters(AliHLTHOMERBlockDesc* block) {
+  Int_t iResult = 0;
+
+  Int_t   slice = block->GetSubDetector().Atoi();
+  Int_t   patch = block->GetSubSubDetector().Atoi();
+  Float_t phi   = ( slice + 0.5 ) * TMath::Pi() / 9.0;
+  Float_t cos   = TMath::Cos( phi );
+  Float_t sin   = TMath::Sin( phi );
+    
+  AliHLTTPCClusterData *cd = (AliHLTTPCClusterData*) block->GetData();
+  UChar_t *data            = (UChar_t*) cd->fSpacePoints;
+
+  if ( cd->fSpacePointCnt == 0 ) {
+    printf ("No Clusters found in sector %d patch %d.\n", slice, patch );
+    iResult = -1;
+  } 
+  else {
+    
+    for (Int_t ii = 0; ii < cd->fSpacePointCnt; ++ii, data += sizeof(AliHLTTPCSpacePointData)) {
+      AliHLTTPCSpacePointData *sp = (AliHLTTPCSpacePointData *) data;
+
+      gTPCClusters->SetNextPoint(cos*sp->fX - sin*sp->fY, sin*sp->fX + cos*sp->fY, sp->fZ);
+    }
   }
+
+  return iResult;
 }
 
 //****************************************************************************
-TEveTrack* esd_make_track(TEveTrackPropagator*   rnrStyle,
-                           Int_t                  index,
-                           AliESDtrack*           at,
-                           AliExternalTrackParam* tp=0)
-{
+TEveTrack* makeESDTrack( TEveTrackPropagator*   rnrStyle,
+                        Int_t                  idx,
+                        AliESDtrack*           esdTrack,
+                        AliExternalTrackParam* trackParam  ) {
   // Helper function
-  Double_t        pbuf[3], vbuf[3];
-  TEveRecTrack  rt;
-
-  if(tp == 0) tp = at;
-
-  rt.label  = at->GetLabel();
-  rt.index  = index;
-  rt.status = (Int_t) at->GetStatus();
-  rt.sign   = tp->GetSign();
-  tp->GetXYZ(vbuf);
-  rt.V.Set(vbuf);
-  tp->GetPxPyPz(pbuf);
-  rt.P.Set(pbuf);
-  Double_t ep = at->GetP(), mc = at->GetMass();
-  rt.beta = ep/TMath::Sqrt(ep*ep + mc*mc);
+
+  Double_t     pbuf[3], vbuf[3];
+  TEveRecTrack rt;
+
+  if ( trackParam == 0 ) 
+    trackParam = esdTrack;
+
+  rt.fLabel  = esdTrack->GetLabel();
+  rt.fIndex  = idx;
+  rt.fStatus = (Int_t) esdTrack->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 cA=TMath::Cos(trackParam->GetAlpha()), sA=TMath::Sin(trackParam->GetAlpha());
+
+    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));
+
+    pbuf[0] = pt*(cT*cA - sT*sA); 
+    pbuf[1] = pt*(sT*cA + cT*sA); 
+    pbuf[2] = pt*trackParam->GetTgl();
+  }
+  
+  rt.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
+
+    TEvePathMark *startPoint = new TEvePathMark(TEvePathMark::kReference);
+    TEvePathMark *endPoint = new TEvePathMark(TEvePathMark::kDecay);
+    startPoint->fV.Set(vbuf);
+    startPoint->fP.Set(pbuf);
+
+    endParam.GetXYZ(vbuf);
+    endPoint->fV.Set(vbuf);
+    cout<<"endPoint = "<<vbuf[0]<<" "<<vbuf[1]<<" "<<vbuf[2]<<endl;
+   
+    { // 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));
+      
+      pbuf[0] = pt*(cT*cA - sT*sA); 
+      pbuf[1] = pt*(sT*cA + cT*sA); 
+      pbuf[2] = pt*endParam.GetTgl();
+    }
+
+    endPoint->fP.Set(pbuf);
+    
+    track->AddPathMark( startPoint );
+     track->AddPathMark( endPoint );
+  }
   //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.)
@@ -209,113 +589,692 @@ TEveTrack* esd_make_track(TEveTrackPropagator*   rnrStyle,
   //PH                rt.sign*TMath::Hypot(rt.P.x, rt.P.y), rt.P.z,
   //PH                rt.V.x, rt.V.y, rt.V.z));
   char form[1000];
-  sprintf(form,"TEveTrack %d", rt.index);
+  sprintf(form,"TEveTrack %d", rt.fIndex);
   track->SetName(form);
   track->SetStdTitle();
   return track;
 }
 
 //****************************************************************************
-void process_tpc_tracks(AliHLTHOMERBlockDesc* b)
-{
-  AliESDEvent* esd = (AliESDEvent*) b->GetTObject();
+Int_t processTPCTracks(AliHLTHOMERBlockDesc* block) {
+
+  TTree *tr = (TTree*) block->GetTObject();
+
+  AliESDEvent* esd = new AliESDEvent;
+  esd->ReadFromTree(tr);
+  tr->GetEntry(0);
+
+  TEveTrackPropagator* rnrStyle = gTPCTrack->GetPropagator();
+  rnrStyle->SetMagField( 0.1*esd->GetMagneticField() );
 
-  TEveTrackPropagator* rnrStyle = tpc_trk->GetPropagator();
+  cout << "Number of tracks found :" << esd->GetNumberOfTracks() << endl;
+
+  for (Int_t ii=0; ii< esd->GetNumberOfTracks(); ii++) {
+
+    AliESDtrack           *esdTrack = esd->GetTrack(ii);
+    AliExternalTrackParam *trackParam = esdTrack;
+    
+    TEveTrack* track = makeESDTrack( rnrStyle, ii, esdTrack, trackParam );
+    
+    track->SetAttLineAttMarker(gTPCTrack);
+    
+    gEve->AddElement(track, gTPCTrack);
+  }
+  
+  //  delete esd;
+  
+  return 0;
+}
+//****************************************************************************
+Int_t initTrackerMapping()
+{
+  gDimuTrackerMapping.clear();
 
-  for (Int_t n=0; n<esd->GetNumberOfTracks(); n++)
-  {
-    AliESDtrack           *at = esd->GetTrack(n);
-    AliExternalTrackParam *tp = at;
+  if (! AliMpCDB::LoadDDLStore(true)){
+    cerr<<__FILE__<<": Failed to Load DDLStore specified for CDBPath "
+       <<AliCDBManager::Instance()->GetDefaultStorage()<<endl;
+    return kFALSE;
+  }
 
-    TEveTrack* track = esd_make_track(rnrStyle, n, at, tp);
-    track->SetAttLineAttMarker(tpc_trk);
-    gEve->AddElement(track, tpc_trk);
+  AliMpSegmentation *mpSegFactory = AliMpSegmentation::Instance(); 
+  AliGeomManager::LoadGeometry();
+  AliMUONGeometryTransformer* chamberGeometryTransformer = new AliMUONGeometryTransformer();
+  
+  if(! chamberGeometryTransformer->LoadGeometryData()){
+    cerr<<__FILE__<<": Failed to Load Geomerty Data "<<endl;
+    return kFALSE;
   }
 
+  AliMUONCalibrationData cd((AliCDBManager::Instance())->GetRun());
+  AliHLTMUONTrackerMappingData md;
+
+  cout<<"Loading Mapping for Dimuon Tracking Chambers.....be patient..."<<endl;
+
+  for(Int_t iCh = 0; iCh < 10; iCh++){ 
+    
+    AliMpDEIterator it;
+    for ( it.First(iCh); ! it.IsDone(); it.Next() ) {
+    
+      Int_t detElemId = it.CurrentDEId();
+      
+      for(Int_t iCath = 0 ; iCath <= 1 ; iCath++){
+       
+       AliMp::CathodType cath;
+
+       if(iCath == 0)
+         cath = AliMp::kCath0 ;
+       else
+         cath = AliMp::kCath1 ;
+       
+       const AliMpVSegmentation* seg = mpSegFactory->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
+
+    } // detElemId loop
+
+  }// ichamber loop
+
+  return 0;
 }
+//****************************************************************************
+Int_t initTrackerMappingPed()
+{
+  cout<<"Loading Pedestal for Dimuon..."<<endl;
+  Int_t linenum = 0;
+  
+  char line[90];
+  int buspatch,manu,channel;
+  float mean,sigma;
+  int idManuChannel;
+
+  FILE *fin[2] ;
+  fin[0] = fopen("/local/home/hlt/pedestal/MUONTRKda_ped_25948.St1.ped","r");
+  fin[1] = fopen("/local/home/hlt/pedestal/MUONTRKda_ped_25948.St2.ped","r");
+
+  while(feof(fin[0])==0){
+    fgets(line,100,fin[0]);
+    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);
+
+      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;
+
+  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);
+
+      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++;
+
+  }
+
+  return 0;
+}
 //****************************************************************************
-void process_tpc_xxxx(AliESDEvent* esd)
+Int_t initTriggerMapping()
 {
-  TEveTrackPropagator* rnrStyle = tpc_trk->GetPropagator();
 
-  for (Int_t n=0; n<esd->GetNumberOfTracks(); n++)
-  {
-    AliESDtrack           *at = esd->GetTrack(n);
-    AliExternalTrackParam *tp = at;
+  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;
+  }
+  
+  AliMpSegmentation* segmentation = AliMpSegmentation::Instance();
+  if (segmentation == NULL){
+    cerr << "ERROR: AliMpSegmentation::Instance() was NULL." << endl;
+    return false;
+  }
+
 
-    TEveTrack* track = esd_make_track(rnrStyle, n, at, tp);
-    track->SetAttLineAttMarker(tpc_trk);
-    gEve->AddElement(track, tpc_trk);
+  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 (Int_t iReg = 0; iReg < 8; iReg++){
+
+      AliMpTriggerCrate* crate = ddlStore->GetTriggerCrate(iDDL, iReg);
+      
+      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;
+       }
+
+       // skip copy cards
+       if (! localBoard->IsNotified()) continue;
+       
+       for (Int_t iChamber = 0; iChamber < 4; iChamber++){
+
+         Int_t detElemId = ddlStore->GetDEfromLocalBoard(boardId, iChamber);
+         
+         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 : "<<iEvent<<endl;
+  
+  TString rawDataPath = "$HOME/MUON_RawData";
+
+  bool MakeTrackDDLStream(int*& rawData, int* rawDataSize, TString rawDataPath, int iEvent, int iDDL);  
+  
+  int *buffer;
+  int bufferSize;
+
+  AliMUONTrackerDDLDecoder<DiMuonTrackerCustomHandler> trackerDDLDecoder;
+  DiMuonTrackerCustomHandler& handler = 
+    reinterpret_cast<DiMuonTrackerCustomHandler&>(trackerDDLDecoder.GetHandler());
+  
+  for(Int_t iDDL=1;iDDL<=20;iDDL++){
+
+    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;i<int(bufferSize/sizeof(int));i++)
+    //         printf("rawData[%d] : %-8x :: %15d\n",i,buffer[i],buffer[i]);
+    
+    handler.ResetDataCounter();
+    if(!trackerDDLDecoder.Decode(buffer, UInt_t(bufferSize))){
+      cerr<<"Cannot decode. "<<endl;
+      continue ;
+
+    }
+    
+    for(Int_t i=0;i<handler.GetDataSize();i++){
+      if(handler.GetData(i).fADC > 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 : "<<gDimuTrackerMapping[handler.GetData(i).fDataId].fDetElemId
+//         <<", iX : "<<gDimuTrackerMapping[handler.GetData(i).fDataId].fIX
+//         <<", iY : "<<gDimuTrackerMapping[handler.GetData(i).fDataId].fIY
+//         <<", realX : "<<gDimuTrackerMapping[handler.GetData(i).fDataId].fRealX
+//         <<", realY : "<<gDimuTrackerMapping[handler.GetData(i).fDataId].fRealY
+//         <<", realZ : "<<gDimuTrackerMapping[handler.GetData(i).fDataId].fRealZ
+//         <<", plane : "<<gDimuTrackerMapping[handler.GetData(i).fDataId].fCath
+//         <<", ADC : "<<gDimuTrackerMapping[handler.GetData(i).fDataId].fADC
+//         <<endl;
+
+       gDimuTrackerDataList.push_back(handler.GetData(i).fDataId);
+      }//fADC > refADC value
+      
+    }
+    
+    delete []buffer ;
+  }// DDL loop
 
+  cout<<"Tracker Data size : "<<gDimuTrackerDataList.size()<<endl;
+  return kTRUE;
 }
 
 //****************************************************************************
-/*
-  // Getting esd
-
-f=TFile::Open("AliESDs.root")
-AliESDEvent * esd = new AliESDEvent
-esd->ReadFromTree(esdTree)
-esdTree->GetEntry(0)
-esd->GetNumberOfTracks()
-///////////////////
-
-root [3] AliESDEvent * esd = new AliESDEvent
-root [4] esd->ReadFromTree(esdTree)
-W-TStreamerInfo::BuildOld: Cannot convert AliESDCaloCluster::fTracksMatched from type:TArrayS* to type:TArrayI, skip element
-W-TStreamerInfo::BuildOld: Cannot convert AliESDCaloCluster::fLabels from type:TArrayS* to type:TArrayI, skip element
-STEER/AliESDEvent.cxx 1040 AliESDEvent::ReadFromTree() TList contains less than the standard contents 21 < 22
-root [5] esdTree->GetEntry(0)
-(Int_t)(764314)
-root [6] esd->GetNumberOfTracks()
-(const Int_t)(275)
-root [7] process_tpc_xxxx(esd)
-root [8] gEve->Redraw3D(
-void Redraw3D(Bool_t resetCameras = kFALSE, Bool_t dropLogicals = kFALSE)
-root [8] gEve->Redraw3D(1,1)
-root [9] trk_cnt->Elem
-variable "trk_cnt" not defined.
-
-variable "trk_cnt->Elem" not defined.
-root [9] trk_cnt->Eleme
-variable "trk_cnt" not defined.
-
-variable "trk_cnt->Eleme" not defined.
-root [9] tpc_trk->ElementChanged(
-void ElementChanged(Bool_t update_scenes = kTRUE, Bool_t redraw = kFALSE)
-root [9] tpc_trk->ElementChanged(1,1)
-root [10] tpc_trk->SelectByP
-SelectByPt
-SelectByPt
-SelectByP
-SelectByP
-root [10] tpc_trk->SelectByPt(
-void SelectByPt(Float_t min_pt, Float_t max_pt)
-void SelectByPt(Float_t min_pt, Float_t max_pt, TEveElement* el)
-root [10] tpc_trk->SelectByPt(0,1000000000000)
-root [11] tpc_trk->MakeTracks(
-void MakeTracks(Bool_t recurse = kTRUE)
-root [11] tpc_trk->MakeTracks()
-root [12]
-
-
-
-*/
 
+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);
+
+  
+  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 : "<<rawDDLSize<<endl;
+//        for(int i=0;i<8;i++)
+//      printf("ddlHeader[%d] : %d\n",i,ddlHeader[i]);
+      
+      if(ddlHeader[0]>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 : "<<buffer<<endl;
+       }else{
+         fclose(fin);
+         return false;
+       }
+      }else{
+       fclose(fin);
+       return false;
+      }
+    }
+    
+  }// 
+  
+  fclose(fin);
+  return true;
+}
 
+//****************************************************************************
+Int_t ReadPort( AliHLTHOMERBlockDesc* block )
+{
+  int *buffer;
+  int bufferSize;
 
+  AliMUONTrackerDDLDecoder<DiMuonTrackerCustomHandler> trackerDDLDecoder;
+  DiMuonTrackerCustomHandler& handler = 
+    reinterpret_cast<DiMuonTrackerCustomHandler&>(trackerDDLDecoder.GetHandler());
+  
+  DiMuonTriggerDDLDecoder triggerDecoder;
+
+  unsigned long size = block->GetSize();
+  bufferSize = UInt_t(int(size/sizeof(int))-10);
+  buffer = reinterpret_cast<int *>(block->GetData());
+  buffer += 8;
+
+  //   if(buffer[0]==0xFC0000FC){
+  //     for(int i=0;i<int(bufferSize);i++)
+  //       printf("rawData[%d] : %-8x :: %15d\n",i,buffer[i],buffer[i]);
+  //   }
+
+  if(buffer[0]!=int(0xFC0000FC)){
+    
+//     for(int i=0;i<int(bufferSize);i++)
+//       printf("rawData[%d] : %-8x :: %15d\n",i,buffer[i],buffer[i]);
+    
+    triggerDecoder.ResetDataCounter();
+    triggerDecoder.SetTriggerMappingData(&gDimuTriggerMapping[0]);
+    if(!triggerDecoder.Decode(buffer)){
+      cerr<<"Cannot decode DiMuon Trigger RawData "<<endl;
+      //return kFALSE;
+    }
+  
+    for(Int_t i=0;i<triggerDecoder.GetDataSize();i++)
+      gDimuTriggerDataList.push_back(triggerDecoder.GetData(i));
+    
+      
+  }else{
+
+    handler.ResetDataCounter();
+    if(!trackerDDLDecoder.Decode(buffer,UInt_t(bufferSize*sizeof(int)))){
+      cerr<<"Cannot decode DiMuon Tracker RawData "<<endl;
+      //return kFALSE;
+    }
+  
+    for(Int_t i=0;i<handler.GetDataSize();i++){
+      if(handler.GetData(i).fADC > 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;
+}
+//****************************************************************************
+Int_t processDiMuonRawData( AliHLTHOMERBlockDesc* block )
+{
+  if(!ReadRawData(0))
+    return false;
 
+//   if(!ReadPort(block))
+//     return false;
+
+  return true ;
+}
 //****************************************************************************
-void loopEvent()
+Int_t drawDiMuonRawData(Int_t ADCCut) 
 {
+
+  cout<<"Trying to read RawData "<<endl;
+
+
+  char ChamberName[50];
+  TEveElement *eveMuonEventElmt = gEve->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 : "<<ichamber<<", mch : "<<mch<<endl;
+    mch->GetChamberData()->DropData();
+  }
+  
+  
+  // -- DrawTracker RawData
+  Int_t dataId,ich, busPatchId, manuId ;
+  
+  cout<<"Total number of Tracker data : "<<Int_t(gDimuTrackerDataList.size())<<endl;
+
+  for(Int_t idata = 0 ; idata < Int_t(gDimuTrackerDataList.size()); idata++){
+
+    dataId = gDimuTrackerDataList.at(idata);
+    cout<<"ADC : "<<gDimuTrackerMapping[dataId].fADC<<endl;
+    if(gDimuTrackerMapping[dataId].fADC > ADCCut){
+
+      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);
+      
+      mch = (AliEveMUONChamber*)(eveMuonGeomElmt->FindChild(ChamberName));
+      
+      //if(ich==0) continue ;
+
+      manuId =  (dataId>>6) & 0x7FF ;
+      busPatchId =  (dataId>>17) & 0xFFF ;
+      
+      if(busPatchId==728 and manuId==1122) continue ;
+
+      cout<<"ich : "<<ich<<", idata : "<<idata
+         <<", detElemId : "<<gDimuTrackerMapping[dataId].fDetElemId
+         <<" bus : "<<busPatchId
+         <<" manu : "<<manuId
+         <<" iX : "<<gDimuTrackerMapping[dataId].fIX
+         <<" iY : "<<gDimuTrackerMapping[dataId].fIY
+         <<" realX : "<<gDimuTrackerMapping[dataId].fRealX
+         <<" realY : "<<gDimuTrackerMapping[dataId].fRealY
+         <<" realZ : "<<gDimuTrackerMapping[dataId].fRealZ
+         <<" ADC : "<<gDimuTrackerMapping[dataId].fADC
+         <<endl;
+      
+      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);
+      
+      //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
+  
+  // -- DrawTrigger RawData
+//   cout<<"Total number of Trigger data : "<<Int_t(gDimuTriggerDataList.size())<<endl;
+//   AliHLTMUONTriggerPointData data;
+//   for(Int_t idata = 0 ; idata < Int_t(gDimuTriggerDataList.size()); idata++){
+
+//     data = gDimuTriggerDataList.at(idata) ;
+    
+//     if(Int_t(data.fDetElemId)<1100 or Int_t(data.fDetElemId) > 1417 ) 
+//       continue ;
+
+//     ich = Int_t(data.fDetElemId/100) - 1;
+//     sprintf(ChamberName,"Chamber %2d (trig)",ich);
+
+//     mch = (AliEveMUONChamber*)(eveMuonGeomElmt->FindChild(ChamberName));
+
+      
+//     cout<<"ich : "<<ich<<", idata : "<<idata
+//     <<", detElemId : "<<data.fDetElemId
+//       <<" realX : "<<data.fX
+//       <<" realY : "<<data.fY
+//       <<" realZ : "<<data.fZ
+//       <<endl;
+    
+//     mch->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 ;
+
+
+
+  return 0;
+}
+//****************************************************************************
+void loopEvent() {
   event_timer.SetCommand("nextEvent()");
   event_timer.Start(60);
 }
 
 //****************************************************************************
-void stopLoopEvent()
-{
+void stopLoopEvent() {
   event_timer.Stop();
 }
+
index 628904e194521c62b182a39d6c68eaf6a53664e4..083966aa7b738afbf8fe0ffc71f0d2c66a6cd5ba 100644 (file)
@@ -8,7 +8,6 @@
  **************************************************************************/
 
 {
-
   cout << "Setting include path ..." << endl;
   TString includePath = "-I${ALICE_ROOT}/include ";
   includePath        += "-I${ALICE_ROOT}/EVE ";
@@ -20,5 +19,7 @@
   includePath        += "-I${ALICE_ROOT}/HLT/BASE/HOMER ";
   includePath        += "-I${ALICE_ROOT}/TPC ";
   includePath        += "-I${ALICE_ROOT}/RAW ";
+  includePath        += "-I${ALICE_ROOT}/MUON ";
+  includePath        += "-I${ALICE_ROOT}/MUON/mapping ";
   gSystem->SetIncludePath(includePath.Data());
 }
diff --git a/EVE/hlt-macros/sampleConfig_2.xml b/EVE/hlt-macros/sampleConfig_2.xml
new file mode 100755 (executable)
index 0000000..0a8f783
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<SimpleChainConfig1 ID="HOMER-TEST" verbosity="0x39">
+
+
+     <!-- ============================================================== -->
+     <!-- =========================  NODELIST  ========================= -->
+     <!-- ============================================================== -->
+
+     <Node ID="fepphos2" hostname="alihlt-vobox0"/>
+     <Node ID="fepphos3" hostname="alihlt-vobox0"/>
+     <Node ID="fepphos4" hostname="alihlt-vobox0"/>
+     <Node ID="kifa" hostname="kifa"/>
+
+     <!-- =========================  Global TDS  ========================= -->
+
+     <Proc ID="TDS_1" type="snk">
+              <Cmd>TCPDumpSubscriber -port 58656</Cmd>
+              <Parent>TPC_CF</Parent>
+              <Node>fepphos2</Node>
+              <Shm blocksize="4k" blockcount="1" type="bigphysarea"/>
+     </Proc>
+
+     <Proc ID="TDS_2" type="snk">
+              <Cmd>TCPDumpSubscriber -port 58660</Cmd>
+              <Parent>TPC_FP</Parent>
+              <Node>fepphos3</Node>
+              <Shm blocksize="4k" blockcount="1" type="bigphysarea"/>
+     </Proc>
+
+</SimpleChainConfig1>