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 )
83 * ---------------------------------------------------------------------------------
84 * Data Handling - Setter - public
85 * ---------------------------------------------------------------------------------
88 //##################################################################################
89 void AliHLTHOMERBlockDesc::SetBlock( void * data, ULong_t size, TString origin,
90 TString dataType, ULong_t specification ) {
91 // see header file for class documentation
97 fSpecification = specification;
99 // fBlockName.Form("%s_%s_0x%08LX", fDetector.Data(), fDataType.Data(), fSpecification );
100 fBlockName.Form("%s_%s_0", fDetector.Data(), fDataType.Data() );
102 // -- Set block parameters
103 SetBlockParameters();
109 * ---------------------------------------------------------------------------------
110 * Data Handling - private
111 * ---------------------------------------------------------------------------------
114 //##################################################################################
115 void AliHLTHOMERBlockDesc::SetBlockParameters() {
116 // see header file for class documentation
120 // ---- SET SPECIFICATIONS ----
121 // ----------------------------
123 // **** TPC **** ( has special treatment )
124 if ( ! fDetector.CompareTo("TPC") ) {
126 Int_t minPatch = (fSpecification & 0x000000FF);
127 Int_t maxPatch = (fSpecification & 0x0000FF00) >> 8;
128 Int_t minSector = (fSpecification & 0x00FF0000) >> 16 ;
129 Int_t maxSector = (fSpecification & 0xFF000000) >> 24;
131 fSubDetector = minSector;
132 fSubSubDetector = minPatch;
134 // -- check for ranges
135 if ( minSector != maxSector )
136 fHasSubDetectorRange = kTRUE;
138 if ( minPatch != maxPatch )
139 fHasSubSubDetectorRange = kTRUE;
142 // **** OTHER DETECTORS ****
145 if ( fSpecification ) {
146 // find the max bin which is set to 1
147 fSubDetector = TMath::FloorNint( TMath::Log2(fSpecification) );
149 // -- check for ranges
150 if ( TMath::Log2(fSpecification) !=
151 static_cast<Double_t>(TMath::FloorNint(TMath::Log2(fSpecification))) )
152 fHasSubDetectorRange = kTRUE;
156 // ---- SET CLASS NAME, DATA CONTENTS ----
157 // ---------------------------------------
159 // -- Check if block contains raw data
160 if ( CheckIfRawData() )
163 // -- Check if block contains TObject
164 if ( CheckIfTObject() )
167 // -- Contains arbitrary data type
170 if ( ! fDetector.CompareTo("TPC") ) {
172 if ( ! fDataType.CompareTo("CLUSTERS") )
173 fClassName = "AliHLTTPCSpacePoints";
179 else if ( ! fDetector.CompareTo("TRD") ) {
184 else if ( ! fDetector.CompareTo("PHOS") ) {
189 else if ( ! fDetector.CompareTo("MUON") ) {
198 // -- Check if classname has been defined
199 // if ( iResult < 0 ) {
200 // AliWarning( Form("The classname for data type %s for the detector %s has not been defined yet.",
201 // fDataType.Data(), fDetector.Data()) );
206 //##################################################################################
207 Bool_t AliHLTHOMERBlockDesc::CheckIfTObject() {
208 // see header file for class documentation
210 // -- Check Length - First 32 bit word of payload contains the length
211 UInt_t len = *( (UInt_t*) fData );
213 if ( len != ( fSize - sizeof(UInt_t) ) )
216 // -- set AliHLTMessage
221 fMessage = new AliHLTMessage( fData, fSize );
223 // -- Check if TMessage payload is TObject
224 if ( fMessage->What() == kMESS_OBJECT ) {
225 fClassName = fMessage->GetClass()->GetName();
228 fTObject = fMessage->ReadObject( fMessage->GetClass() );
236 //##################################################################################
237 Bool_t AliHLTHOMERBlockDesc::CheckIfRawData() {
238 // see header file for class documentation
240 if ( ! fDataType.CompareTo("DDL_RAW") )