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() :
55 fHasSubDetectorRange(kFALSE),
56 fHasSubSubDetectorRange(kFALSE) {
57 // see header file for class documentation
59 // refer to README to build package
61 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
64 //##################################################################################
65 AliHLTHOMERBlockDesc::AliHLTHOMERBlockDesc( void * data, ULong_t size, TString origin,
66 TString dataType, ULong_t specification ) :
77 fSpecification(specification),
79 fHasSubDetectorRange(kFALSE),
80 fHasSubSubDetectorRange(kFALSE) {
81 // see header file for class documentation
83 // -- Set block parameters
88 //##################################################################################
89 AliHLTHOMERBlockDesc::~AliHLTHOMERBlockDesc() {
90 // see header file for class documentation
92 if ( fMessage != NULL )
98 //##################################################################################
99 void AliHLTHOMERBlockDesc::SetBlock( void * data, ULong_t size, TString origin,
100 TString dataType, ULong_t specification ) {
101 // see header file for class documentation
106 fDataType = dataType;
107 fSpecification = specification;
109 // -- Set block parameters
110 SetBlockParameters();
115 //##################################################################################
116 void AliHLTHOMERBlockDesc::SetBlockParameters() {
117 // see header file for class documentation
121 // ---- SET CLASS NAME, DATA CONTENTS ----
123 // -- Check if block contains raw data
124 if ( ! CheckIfRawData() ) {
126 // -- Check if block contains TObject
127 if ( ! CheckIfTObject() ) {
129 // -- Contains arbitrary data type
132 if ( ! fDetector.CompareTo("TPC") ) {
134 if ( ! fDataType.CompareTo("CLUSTERS") )
135 fClassName = "AliHLTTPCSpacePoints";
142 else if ( ! fDetector.CompareTo("TRD") ) {
148 else if ( ! fDetector.CompareTo("PHOS") ) {
154 else if ( ! fDetector.CompareTo("MUON") ) {
164 } // if ( ! CheckIfRawData() ) {
166 // -- Check if Data Type has been defined
168 //AliError( Form("The data type %s for the detector %s has not been defined yet.",
169 // fDataType.Data(), fDetector.Data()) );
172 // ---- SET SPECIFICATIONS ----
173 // -- Convert Specification to "SubDetector/SubSubDetector"
175 // **** TPC **** ( has special treatment )
177 if ( ! fDetector.CompareTo("TPC") ) {
179 Int_t minPatch = (fSpecification & 0x000000FF);
180 Int_t maxPatch = (fSpecification & 0x0000FF00) >> 8;
181 Int_t minSector = (fSpecification & 0x00FF0000) >> 16 ;
182 Int_t maxSector = (fSpecification & 0xFF000000) >> 24;
184 fSubDetector += minSector;
185 fSubSubDetector += minPatch;
187 // -- check for ranges
188 if ( minSector != maxSector )
189 fHasSubDetectorRange = kTRUE;
191 if ( minPatch != maxPatch )
192 fHasSubSubDetectorRange = kTRUE;
195 // **** OTHER DETECTORS ****
199 if ( fSpecification ) {
200 // find the max bin which is set to 1
201 fSubDetector += TMath::FloorNint( TMath::Log2(fSpecification) );
203 // -- check for ranges
204 if ( TMath::Log2(fSpecification) != ( (Double_t) TMath::FloorNint( TMath::Log2(fSpecification) ) ) )
205 fHasSubDetectorRange = kTRUE;
213 //##################################################################################
214 Bool_t AliHLTHOMERBlockDesc::CheckIfTObject() {
215 // see header file for class documentation
217 // -- Check Length - First 32 bit word of payload contains the length
218 UInt_t len = *( (UInt_t*) fData );
220 if ( len != ( fSize - sizeof(UInt_t) ) )
223 // -- set AliHLTMessage
228 fMessage = new AliHLTMessage( fData, fSize );
230 // -- Check if TMessage payload is TObject
231 if ( fMessage->What() == kMESS_OBJECT ) {
232 fClassName = fMessage->GetClass()->GetName();
235 fTObject = fMessage->ReadObject( fMessage->GetClass() );
243 //##################################################################################
244 Bool_t AliHLTHOMERBlockDesc::CheckIfRawData() {
245 // see header file for class documentation
247 if ( ! fDataType.CompareTo("DDL_RAW") )