1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Authors: Jochen Thaeder <thaeder@kip.uni-heidelberg.de> *
5 * for The ALICE HLT Project. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 /** @file AliHLTHOMERBlockDesc.cxx
17 @author Jochen Thaeder
19 @brief Container for HOMER Blocks
22 // see header file for class documentation
24 // refer to README to build package
26 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
32 #include "AliHLTHOMERBlockDesc.h"
34 #include "AliHLTMessage.h"
40 ClassImp(AliHLTHOMERBlockDesc)
43 * ---------------------------------------------------------------------------------
44 * Constructor / Destructor
45 * ---------------------------------------------------------------------------------
48 //##################################################################################
49 AliHLTHOMERBlockDesc::AliHLTHOMERBlockDesc() :
63 fHasSubDetectorRange(kFALSE),
64 fHasSubSubDetectorRange(kFALSE) {
65 // see header file for class documentation
67 // refer to README to build package
69 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
72 //##################################################################################
73 AliHLTHOMERBlockDesc::~AliHLTHOMERBlockDesc() {
74 // see header file for class documentation
76 if ( fMessage != NULL )
86 * ---------------------------------------------------------------------------------
87 * Data Handling - Setter - public
88 * ---------------------------------------------------------------------------------
91 //##################################################################################
92 void AliHLTHOMERBlockDesc::SetBlock( void * data, ULong_t size, TString origin,
93 TString dataType, ULong_t specification ) {
94 // see header file for class documentation
96 fData = new Char_t[size];
97 memcpy( fData, data, size);
101 fDataType = dataType;
102 fSpecification = specification;
104 fBlockName.Form("%s_%s_0x%08X", fDetector.Data(), fDataType.Data(), fSpecification );
106 // -- Set block parameters
107 SetBlockParameters();
113 * ---------------------------------------------------------------------------------
114 * Data Handling - private
115 * ---------------------------------------------------------------------------------
118 //##################################################################################
119 void AliHLTHOMERBlockDesc::SetBlockParameters() {
120 // see header file for class documentation
124 // ---- SET SPECIFICATIONS ----
125 // ----------------------------
127 // **** TPC **** ( has special treatment )
128 if ( ! fDetector.CompareTo("TPC") ) {
130 Int_t minPatch = (fSpecification & 0x000000FF);
131 Int_t maxPatch = (fSpecification & 0x0000FF00) >> 8;
132 Int_t minSector = (fSpecification & 0x00FF0000) >> 16 ;
133 Int_t maxSector = (fSpecification & 0xFF000000) >> 24;
135 fSubDetector = minSector;
136 fSubSubDetector = minPatch;
138 // -- check for ranges
139 if ( minSector != maxSector )
140 fHasSubDetectorRange = kTRUE;
142 if ( minPatch != maxPatch )
143 fHasSubSubDetectorRange = kTRUE;
146 // **** OTHER DETECTORS ****
149 if ( fSpecification ) {
150 // find the max bin which is set to 1
151 fSubDetector = TMath::FloorNint( TMath::Log2(fSpecification) );
153 // -- check for ranges
154 if ( TMath::Log2(fSpecification) !=
155 static_cast<Double_t>(TMath::FloorNint(TMath::Log2(fSpecification))) )
156 fHasSubDetectorRange = kTRUE;
160 // ---- SET CLASS NAME, DATA CONTENTS ----
161 // ---------------------------------------
163 // -- Check if block contains raw data
164 if ( CheckIfRawData() )
167 // -- Check if block contains TObject
168 if ( CheckIfTObject() )
171 // -- Contains arbitrary data type
174 if ( ! fDetector.CompareTo("TPC") ) {
176 if ( ! fDataType.CompareTo("CLUSTERS") )
177 fClassName = "AliHLTTPCSpacePoints";
183 else if ( ! fDetector.CompareTo("TRD") ) {
188 else if ( ! fDetector.CompareTo("PHOS") ) {
193 else if ( ! fDetector.CompareTo("MUON") ) {
202 // -- Check if classname has been defined
203 // if ( iResult < 0 ) {
204 // AliWarning( Form("The classname for data type %s for the detector %s has not been defined yet.",
205 // fDataType.Data(), fDetector.Data()) );
210 //##################################################################################
211 Bool_t AliHLTHOMERBlockDesc::CheckIfTObject() {
212 // see header file for class documentation
214 // -- Check Length - First 32 bit word of payload contains the length
215 UInt_t len = *( (UInt_t*) fData );
217 if ( len != ( fSize - sizeof(UInt_t) ) )
220 // -- set AliHLTMessage
225 fMessage = new AliHLTMessage( fData, fSize );
227 // -- Check if TMessage payload is TObject
228 if ( fMessage->What() == kMESS_OBJECT ) {
229 fClassName = fMessage->GetClass()->GetName();
232 fTObject = fMessage->ReadObject( fMessage->GetClass() );
240 //##################################################################################
241 Bool_t AliHLTHOMERBlockDesc::CheckIfRawData() {
242 // see header file for class documentation
244 if ( ! fDataType.CompareTo("DDL_RAW") )