]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/exa/HOMERManager.C
bugfix: output of one extra cluster when the last rawcluster was accepted by the...
[u/mrichter/AliRoot.git] / HLT / exa / HOMERManager.C
1 //-*- Mode: C++ -*-
2 // $Id: HOMERManager.C  $
3 /**
4  * @file HOMERManager.C
5  * @brief Sample macro for the use of the HOMERManager
6  *
7  * Usage:
8  * <pre>
9  *   aliroot -l HOMERManager.C 
10  * </pre>
11  *
12  * This macro illustrates the usage of the AliHLTHOMERManager in order
13  * to on-line read events outside the HLT.
14  *
15  * This macro can be run inside the
16  * <ul>
17  *    <li>DAQ/DCS(ACR) network</li>
18  *    <li>HLT network</li>
19  *    <li>CERN GPN network</li>
20  * </ul>
21  * 
22  * See AliHLTHOMERManager for detailed description.
23  *
24  * @author Jochen Thaeder 
25  * @ingroup alihlt_tutorial
26  * @ingroup alihlt_homer
27  */
28
29
30 Int_t HOMERManager() {
31   
32   Int_t iResult = 0;
33
34   // -- Create new hM object
35   AliHLTHOMERManager *hM = new AliHLTHOMERManager();
36
37   printf( "== INITIALIZE ==\n" );
38
39   iResult = hM->Initialize();
40   if (iResult) return iResult;
41
42   printf( "== CREATE SOURCE LIST ==\n" );
43
44   iResult = hM->CreateSourcesList();
45   if (iResult) return iResult; 
46
47   printf( "== CONNECT HOMER ==\n" );
48   
49   iResult = hM->ConnectHOMER(); 
50   if (iResult) return iResult;
51   
52   printf( "== NEXT EVENT ==\n" );
53   
54   iResult = hM->NextEvent();
55   if (iResult) return iResult;
56   
57   printf( "== LOOP OVER BLOCKS ==\n" );
58
59   if ( hM->GetBlockList() == NULL )
60     return -1;
61
62   if ( hM->GetBlockList()->IsEmpty() )
63     return -2;
64
65   TIter next(hM->GetBlockList());
66   AliHLTHOMERBlockDesc* block = NULL;
67
68   AliESDEvent* esd = NULL;
69   
70   while ((block = (AliHLTHOMERBlockDesc*)next())) {
71    
72     //printf ( "Detector : %s\n" ,block->GetDetector().Data() );
73     //printf ( "Datatype : %s\n" ,block->GetDataType().Data() );
74     
75     if ( block->IsTObject() ) { 
76       TObject*     object = block->GetTObject();
77       // printf("ClassName %s\n", block->GetClassName().Data() );
78     }
79
80     // ++ HLT BLOCK
81     // +++++++++++++++++++++++++++++++++++++++++++++++++++++++
82     if ( ! block->GetDetector().CompareTo("HLT") ) {
83
84       // -- ESDTREE
85       if ( ! block->GetDataType().CompareTo("ALIESDV0") ) {
86         esd = static_cast<AliESDEvent*> ( block->GetTObject() );
87         esd->GetStdContent();
88         
89         printf( "Number of ESD Tracks : %d \n", esd->GetNumberOfTracks());
90       } //if ( ! block->GetDataType().CompareTo("ALIESDV0") ) {
91     } // if ( ! block->GetDetector().CompareTo("HLT") ) {
92
93     else if ( ! block->GetDetector().CompareTo("TPC") ) {
94       // -- Process TPC Clusters
95       if ( ! block->GetDataType().CompareTo("CLUSTERS") ) {
96
97         Int_t   slice = block->GetSubDetector();
98         Int_t   patch = block->GetSubSubDetector();
99         //      Float_t phi   = ( slice + 0.5 ) * TMath::Pi() / 9.0;  
100         //      Float_t cos   = TMath::Cos( phi );
101         //      Float_t sin   = TMath::Sin( phi );
102
103         Int_t ddl = slice*6 + patch;
104
105         // cout << slice << " -- " << patch << " -- " << ddl << endl;
106         
107         //      AliHLTTPCClusterData *cd = reinterpret_cast<AliHLTTPCClusterData*> (block->GetData());
108         //      UChar_t *data            = reinterpret_cast<UChar_t*> (cd->fSpacePoints);
109
110       } // if ( ! block->GetDataType().CompareTo("CLUSTERS") ) {
111     } //     else if ( ! block->GetDetector().CompareTo("TPC") ) {
112     
113   } // while ((block = (AliHLTHOMERBlockDesc*)next())) {
114   
115   // -- Destroy hM object
116   if (hM)
117     delete hM;
118   hM = NULL;
119   
120   return iResult;
121 }