3 //**************************************************************************
4 //* This file is property of and copyright by the ALICE HLT Project *
5 //* ALICE Experiment at CERN, All rights reserved. *
7 //* Primary Authors: Gaute Øvrebekk <st05886@alf.uib.no> *
8 //* for The ALICE HLT Project. *
10 //* Permission to use, copy, modify and distribute this software and its *
11 //* documentation strictly for non-commercial purposes is hereby granted *
12 //* without fee, provided that the above copyright notice appears in all *
13 //* copies and that both the copyright notice and this permission notice *
14 //* appear in the supporting documentation. The authors make no claims *
15 //* about the suitability of this software for any purpose. It is *
16 //* provided "as is" without express or implied warranty. *
17 //**************************************************************************
19 /** @file AliHLTITSClusterFinderSPDComponent.cxx
20 @author Gaute Øvrebekk <st05886@alf.uib.no>
22 @brief Component to run offline clusterfinder for SPD
29 #include "AliHLTITSClusterFinderSPDComponent.h"
31 #include "AliCDBEntry.h"
32 #include "AliCDBManager.h"
33 #include "AliHLTDataTypes.h"
34 #include "AliITSgeomTGeo.h"
35 #include "AliITSRecPoint.h"
40 #include "TObjString.h"
43 /** ROOT macro for the implementation of ROOT specific class methods */
44 ClassImp(AliHLTITSClusterFinderSPDComponent);
46 AliHLTITSClusterFinderSPDComponent::AliHLTITSClusterFinderSPDComponent()
56 //fRawReaderOff(NULL),
58 //fNModules(AliITSgeomTGeo::GetNModules()),
59 //fNModules(AliITSDetTupeRec::fgkDefaultNModulesSPD),
63 // see header file for class documentation
65 // refer to README to build package
67 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
70 AliHLTITSClusterFinderSPDComponent::~AliHLTITSClusterFinderSPDComponent() {
71 // see header file for class documentation
74 // Public functions to implement AliHLTComponent's interface.
75 // These functions are required for the registration process
77 const char* AliHLTITSClusterFinderSPDComponent::GetComponentID()
79 // see header file for class documentation
81 return "ITSClusterFinderSPD";
84 void AliHLTITSClusterFinderSPDComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) {
85 // see header file for class documentation
87 list.push_back( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginITSSPD );
91 AliHLTComponentDataType AliHLTITSClusterFinderSPDComponent::GetOutputDataType() {
92 // see header file for class documentation
93 return kAliHLTDataTypeTObjArray;
96 void AliHLTITSClusterFinderSPDComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) {
97 // see header file for class documentation
100 inputMultiplier = 0.3;
103 AliHLTComponent* AliHLTITSClusterFinderSPDComponent::Spawn() {
104 // see header file for class documentation
105 return new AliHLTITSClusterFinderSPDComponent();
108 Int_t AliHLTITSClusterFinderSPDComponent::DoInit( int /*argc*/, const char** /*argv*/ ) {
109 // see header file for class documentation
111 if ( fClusterFinder )
114 fClusters = new TClonesArray*[fNModules];
115 for (Int_t iModule = 0; iModule < fNModules; iModule++) {
116 fClusters[iModule] = NULL;
119 fcal = new AliITSCalibrationSPD();
120 //fgeomInit = new AliITSInitGeometry(kvSPD02,2);
121 fgeomInit = new AliITSInitGeometry(kvPPRasymmFMD,2);
122 fgeom = fgeomInit->CreateAliITSgeom();
125 fDettype = new AliITSDetTypeRec();
126 fDettype->SetITSgeom(fgeom);
127 for (Int_t iModule = 0; iModule < fNModules; iModule++) {
128 fDettype->SetCalibrationModel(iModule,fcal);
131 fClusterFinder = new AliITSClusterFinderV2SPD(fDettype);
136 fRawReader = new AliRawReaderMemory();
141 Int_t AliHLTITSClusterFinderSPDComponent::DoDeinit() {
142 // see header file for class documentation
148 if ( fClusterFinder )
149 delete fClusterFinder;
150 fClusterFinder = NULL;
155 Int_t AliHLTITSClusterFinderSPDComponent::DoEvent( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& /*trigData*/)
156 { // see header file for class documentation
158 // -- Iterator over Data Blocks --
159 const AliHLTComponentBlockData* iter = NULL;
161 if(GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR )){
165 if (!IsDataEvent()) return 0;
167 if ( evtData.fBlockCnt<=0 )
169 Logging( kHLTLogWarning, "HLT::ITSClusterFinderSPD::DoEvent", "DoEvent", "no blocks in event" );
173 // -- Loop over blocks
174 for ( iter = GetFirstInputBlock(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginITSSPD); iter != NULL; iter = GetNextInputBlock() ) {
176 // -- Debug output of datatype --
177 HLTDebug("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s",
178 evtData.fEventID, evtData.fEventID,
179 DataType2Text(iter->fDataType).c_str(),
180 DataType2Text(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginITSSPD).c_str());
182 // -- Check for the correct data type
183 if ( iter->fDataType != (kAliHLTDataTypeDDLRaw | kAliHLTDataOriginITSSPD) ) //Add SPD to data origin????????
187 //fRawReader->SetMemory( (UChar_t*) iter->fPtr, iter->fSize );
189 // -- Get equipment ID out of specification
190 AliHLTUInt32_t spec = iter->fSpecification;
193 HLTDebug("The Spec is to high for ITS SPD");
197 for ( Int_t ii = 1; ii < 20 ; ii++ ) { //number of ddl's
198 if ( spec & 0x00000001 ) {
205 // -- Set equipment ID to the raw reader
207 if(!fRawReader->AddBuffer((UChar_t*) iter->fPtr, iter->fSize, id)){
208 HLTWarning("Could not add buffer");
211 fClusterFinder->RawdataToClusters(fRawReader,fClusters);
214 for(int i=0;i<fNModules;i++){
215 if(fClusters[i] != NULL){
216 for(int j=0;j<fClusters[i]->GetEntries();j++){
217 AliITSRecPoint *recpoint = (AliITSRecPoint*) fClusters[i]->At(j);
218 cout<<"Cluster: X: "<<recpoint->GetX()<<" Y: "<<recpoint->GetY()<<" Z: "<<recpoint->GetZ()<<endl;
224 PushBack(*fClusters,kAliHLTDataTypeTObjArray|kAliHLTDataOriginITSSPD,iter->fSpecification);
227 for(int i=0;i<fNModules;i++){
228 if(fClusters[i] != NULL){
229 PushBack(fClusters[i],kAliHLTDataTypeTObjArray|kAliHLTDataOriginITSSPD,iter->fSpecification);
235 for (Int_t iModule = 0; iModule < fNModules; iModule++) {
236 fClusters[iModule] = NULL;
239 fRawReader->ClearBuffers();
241 } // for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) {
243 //fClusterFinder->RawdataToClusters(fRawReader,&fClusters);
245 //PushBack( (TObject**) fClusters,kAliHLTDataTypeTObjArray,0x00000000);