#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"
#include "TList.h"
#include "TObjString.h"
#include "TObjArray.h"
-
-// ------------
+// -- -- -- -- -- -- --
+#include "AliLog.h"
#include "AliTPCCalibPedestal.h"
#include "AliTPCCalibPulser.h"
#include "AliTPCCalibCE.h"
//##################################################################################
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 )
delete fBlockList;
fBlockList = NULL;
+ if ( fSrcList != NULL )
+ delete fSrcList;
+ fSrcList = NULL;
+
if ( fTPCPre != NULL )
delete fTPCPre;
fTPCPre = NULL;
//##################################################################################
Int_t AliEveHOMERManager::CreateHOMERSourcesList() {
- // see header file for class documentation
+ // Create Sources List from HOMER-Proxy
// -- Initialize XML parser
if ( fXMLParser != NULL )
// -- 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;
//##################################################################################
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;
//##################################################################################
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;
// -- 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;
//##################################################################################
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;
TIter next(attrList);
TString nodeId = 0;
- // TString nodeName = 0;
// Get "nodeID" and "nodeName" of this "Node" node
while ( ( attr = (TXMLAttr*)next() ) ) {
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 ) {
} 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;
}
//##################################################################################
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;
subDetector += tmp;
}
}
-
+
+ // -- Correct for MUON
+ if ( ! detector.CompareTo("DIMU") ) {
+ detector = "MUON";
+
+ if ( ! subDetector.CompareTo("TRG") )
+ subDetector = "1";
+ else if ( ! subDetector.CompareTo("TRK") )
+ subDetector = "2";
+ }
+
// -- Remove Leading '0' in sub detector and subsubdetector
subDetector.Remove( TString::kLeading, '0' );
subSubDetector.Remove( TString::kLeading, '0' );
-
+
// -- Set Object Names
-
+
// **** General ****
if ( name == "RP" || name == "FP" || name == "Relay" ) {
objName = "";
dataType = "DDL_RAW";
specification = 0;
}
-
+
// **** TPC ****
else if ( detector == "TPC" ) {
-
+
if ( name == "CalibPedestal" ) {
objName = "AliTPCCalibPedestal";
dataType = "HIS_CAL";
specification = 0;
}
else if ( name == "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" ) {
// **** DIMU ****
else if ( detector == "MUON" ) {
-
+ Int_t UpdateSourcesFromSourcesList( );
} // else if ( detector == "MUON" ) {
// -- Fill object
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;
}
//##################################################################################
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.") );
//##################################################################################
void AliEveHOMERManager::DisconnectHOMER(){
- // see header file for class documentation
+ // Disconnect from HOMER sources
if ( ! IsConnected() )
return;
//##################################################################################
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;
//##################################################################################
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;
//##################################################################################
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;
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 {
if ( iResult )
return iResult;
-
-
+
// -- Get blockCnt and eventID
fNBlks = (ULong_t) fReader->GetBlockCnt();
fEventID = (ULong64_t) fReader->GetEventID();
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++ ) {
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;
// -- Check sources list if block is requested
if ( CheckIfRequested( block ) )
fBlockList->Add( block );
- else
+ else {
delete block;
-
+ block = NULL;
+ }
iter = GetNextBlk();
} // while ( iter != NULL ){
//##################################################################################
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() ) {
//##################################################################################
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() ) {
//##################################################################################
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 = "";
//##################################################################################
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 = "";
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.") );
//##################################################################################
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;
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 ) {
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;
#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:
/*
* ---------------------------------------------------------------------------------
*/
- /** constructor
- * @param argc Number of command line arguments.
- * @param argv Array of command line arguments.
- */
+ /** constructor */
AliEveHOMERManager(TString xmlFile="" );
+
/** destructor */
virtual ~AliEveHOMERManager();
/** 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
/*
* ---------------------------------------------------------------------------------
* ---------------------------------------------------------------------------------
*/
- /** 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();
/*
* ---------------------------------------------------------------------------------
*/
- /** 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 );
/*
* ---------------------------------------------------------------------------------
*/
- /** 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
* ---------------------------------------------------------------------------------
*/
* ---------------------------------------------------------------------------------
*/
- /** 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 );
/*
*/
// == 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.
//
// nextEvent() will get next event from HOMER.
-
#include "TTimer.h"
#include "TRandom.h"
#include "TVirtualPad.h"
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;
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.)
//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();
}
+