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"
33 #include "AliHLTMessage.h"
39 ClassImp(AliHLTHOMERBlockDesc)
41 //##################################################################################
42 AliHLTHOMERBlockDesc::AliHLTHOMERBlockDesc() :
54 fHasSubDetectorRange(kFALSE),
55 fHasSubSubDetectorRange(kFALSE) {
56 // see header file for class documentation
58 // refer to README to build package
60 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
63 //##################################################################################
64 AliHLTHOMERBlockDesc::AliHLTHOMERBlockDesc( void * data, ULong_t size, TString origin,
65 TString dataType, ULong_t specification ) :
75 fSpecification(specification),
77 fHasSubDetectorRange(kFALSE),
78 fHasSubSubDetectorRange(kFALSE) {
79 // see header file for class documentation
81 // -- Set block parameters
86 //##################################################################################
87 AliHLTHOMERBlockDesc::~AliHLTHOMERBlockDesc() {
88 // see header file for class documentation
90 if ( fMessage != NULL )
95 //##################################################################################
96 void AliHLTHOMERBlockDesc::SetBlock( void * data, ULong_t size, TString origin,
97 TString dataType, ULong_t specification ) {
98 // see header file for class documentation
103 fDataType = dataType;
104 fSpecification = specification;
106 // -- Set block parameters
107 SetBlockParameters();
112 //##################################################################################
113 void AliHLTHOMERBlockDesc::SetBlockParameters() {
114 // see header file for class documentation
118 // ---- SET CLASS NAME, DATA CONTENTS ----
120 // -- Check if block contains raw data
121 if ( ! CheckIfRawData() ) {
123 // -- Check if block contains TObject
124 if ( ! CheckIfTObject() ) {
126 // -- Contains arbitrary data type
129 if ( ! fDetector.CompareTo("TPC") ) {
131 if ( ! fDataType.CompareTo("CLUSTERS") )
132 fClassName = "AliHLTTPCSpacePoints";
139 else if ( ! fDetector.CompareTo("TRD") ) {
145 else if ( ! fDetector.CompareTo("PHOS") ) {
151 else if ( ! fDetector.CompareTo("MUON") ) {
161 } // if ( ! CheckIfRawData() ) {
163 // -- Check if Data Type has been defined
165 //AliError( Form("The data type %s for the detector %s has not been defined yet.",
166 // fDataType.Data(), fDetector.Data()) );
169 // ---- SET SPECIFICATIONS ----
170 // -- Convert Specification to "SubDetector/SubSubDetector"
172 // **** TPC **** ( has special treatment )
174 if ( ! fDetector.CompareTo("TPC") ) {
176 Int_t minPatch = (fSpecification & 0x000000FF);
177 Int_t maxPatch = (fSpecification & 0x0000FF00) >> 8;
178 Int_t minSector = (fSpecification & 0x00FF0000) >> 16 ;
179 Int_t maxSector = (fSpecification & 0xFF000000) >> 24;
181 fSubDetector += minSector;
182 fSubSubDetector += minPatch;
184 // -- check for ranges
185 if ( minSector != maxSector )
186 fHasSubDetectorRange = kTRUE;
188 if ( minPatch != maxPatch )
189 fHasSubSubDetectorRange = kTRUE;
192 // **** OTHER DETECTORS ****
196 if ( fSpecification ) {
197 // find the max bin which is set to 1
198 fSubDetector += TMath::FloorNint( TMath::Log2(fSpecification) );
200 // -- check for ranges
201 if ( TMath::Log2(fSpecification) != ( (Double_t) TMath::FloorNint( TMath::Log2(fSpecification) ) ) )
202 fHasSubDetectorRange = kTRUE;
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();
236 //##################################################################################
237 Bool_t AliHLTHOMERBlockDesc::CheckIfRawData() {
238 // see header file for class documentation
240 if ( ! fDataType.CompareTo("DDL_RAW") )
246 //##################################################################################
247 TObject* AliHLTHOMERBlockDesc::GetTObject() {
248 // see header file for class documentation
251 TObject* obj = fMessage->ReadObject( fMessage->GetClass() );