2 /**************************************************************************
3 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * Authors: Jochen Thaeder <thaeder@kip.uni-heidelberg.de> *
6 * for The ALICE HLT Project. *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 **************************************************************************/
17 /** @file AliHLTHOMERBlockDesc.cxx
18 @author Jochen Thaeder
20 @brief Container for HOMER Blocks
23 // see header file for class documentation
25 // refer to README to build package
27 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
33 #include "AliHLTHOMERBlockDesc.h"
35 #include "AliHLTMessage.h"
41 ClassImp(AliHLTHOMERBlockDesc)
44 * ---------------------------------------------------------------------------------
45 * Constructor / Destructor
46 * ---------------------------------------------------------------------------------
49 //##################################################################################
50 AliHLTHOMERBlockDesc::AliHLTHOMERBlockDesc() :
64 fHasSubDetectorRange(kFALSE),
65 fHasSubSubDetectorRange(kFALSE) {
66 // see header file for class documentation
68 // refer to README to build package
70 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
73 //##################################################################################
74 AliHLTHOMERBlockDesc::~AliHLTHOMERBlockDesc() {
75 // see header file for class documentation
77 if ( fMessage != NULL )
91 * ---------------------------------------------------------------------------------
92 * Data Handling - Setter - public
93 * ---------------------------------------------------------------------------------
96 //##################################################################################
97 void AliHLTHOMERBlockDesc::SetBlock( void * data, ULong_t size, TString origin,
98 TString dataType, ULong_t specification ) {
99 // see header file for class documentation
101 fData = new Char_t[size];
102 memcpy( fData, data, size);
106 fDataType = dataType;
107 fSpecification = specification;
109 fBlockName.Form("%s_%s_0x%08lX", fDetector.Data(), fDataType.Data(), fSpecification );
111 // -- Set block parameters
112 SetBlockParameters();
118 * ---------------------------------------------------------------------------------
119 * Data Handling - private
120 * ---------------------------------------------------------------------------------
123 //##################################################################################
124 void AliHLTHOMERBlockDesc::SetBlockParameters() {
125 // see header file for class documentation
129 // ---- SET SPECIFICATIONS ----
130 // ----------------------------
132 // **** TPC **** ( has special treatment )
133 if ( ! fDetector.CompareTo("TPC") ) {
135 Int_t minPatch = (fSpecification & 0x000000FF);
136 Int_t maxPatch = (fSpecification & 0x0000FF00) >> 8;
137 Int_t minSector = (fSpecification & 0x00FF0000) >> 16 ;
138 Int_t maxSector = (fSpecification & 0xFF000000) >> 24;
140 fSubDetector = minSector;
141 fSubSubDetector = minPatch;
143 // -- check for ranges
144 if ( minSector != maxSector )
145 fHasSubDetectorRange = kTRUE;
147 if ( minPatch != maxPatch )
148 fHasSubSubDetectorRange = kTRUE;
151 // **** OTHER DETECTORS ****
154 if ( fSpecification ) {
155 // find the max bin which is set to 1
156 fSubDetector = TMath::FloorNint( TMath::Log2(fSpecification) );
158 // -- check for ranges
159 if ( TMath::Log2(fSpecification) !=
160 static_cast<Double_t>(TMath::FloorNint(TMath::Log2(fSpecification))) )
161 fHasSubDetectorRange = kTRUE;
165 // ---- SET CLASS NAME, DATA CONTENTS ----
166 // ---------------------------------------
168 // -- Check if block contains raw data
169 if ( CheckIfRawData() )
172 // -- Check if block contains TObject
173 if ( CheckIfTObject() )
176 // -- Contains arbitrary data type
179 if ( ! fDetector.CompareTo("TPC") ) {
181 if ( ! fDataType.CompareTo("CLUSTERS") )
182 fClassName = "AliHLTTPCSpacePoints";
188 else if ( ! fDetector.CompareTo("TRD") ) {
193 else if ( ! fDetector.CompareTo("PHOS") ) {
198 else if ( ! fDetector.CompareTo("MUON") ) {
208 // -- Check if classname has been defined
209 // if ( iResult < 0 ) {
210 // AliWarning( Form("The classname for data type %s for the detector %s has not been defined yet.",
211 // fDataType.Data(), fDetector.Data()) );
216 //##################################################################################
217 Bool_t AliHLTHOMERBlockDesc::CheckIfTObject() {
218 // see header file for class documentation
220 // -- Check Length - First 32 bit word of payload contains the length
221 UInt_t len = *( (UInt_t*) fData );
223 if ( len != ( fSize - sizeof(UInt_t) ) )
226 // -- set AliHLTMessage
231 fMessage = new AliHLTMessage( fData, fSize );
233 // -- Check if TMessage payload is TObject
234 if ( fMessage->What() == kMESS_OBJECT and fMessage->GetClass() != NULL and fMessage->GetClass() != (TClass*)-1)
236 fClassName = fMessage->GetClass()->GetName();
239 fTObject = fMessage->ReadObject( fMessage->GetClass() );
247 //##################################################################################
248 Bool_t AliHLTHOMERBlockDesc::CheckIfRawData() {
249 // see header file for class documentation
251 if ( ! fDataType.CompareTo("DDL_RAW") )