2 //**************************************************************************
3 //* This file is property of and copyright by the ALICE HLT Project *
4 //* ALICE Experiment at CERN, All rights reserved. *
6 //* Primary Authors: Kenneth Aamodt <Kenneth.Aamodt@cern.ch> *
7 //* for The ALICE HLT Project. *
9 //* Permission to use, copy, modify and distribute this software and its *
10 //* documentation strictly for non-commercial purposes is hereby granted *
11 //* without fee, provided that the above copyright notice appears in all *
12 //* copies and that both the copyright notice and this permission notice *
13 //* appear in the supporting documentation. The authors make no claims *
14 //* about the suitability of this software for any purpose. It is *
15 //* provided "as is" without express or implied warranty. *
16 //**************************************************************************
18 /** @file AliHLTTPCClusterDumpComponent.cxx
19 @author Kenneth Aamodt
21 @brief Special file writer converting TPC clusters input to readable
26 #include "AliHLTTPCClusterDumpComponent.h"
27 #include "AliHLTTPCDefinitions.h"
28 #include "AliHLTTPCSpacePointData.h"
29 #include "AliHLTTPCClusterDataFormat.h"
31 /** ROOT macro for the implementation of ROOT specific class methods */
32 ClassImp(AliHLTTPCClusterDumpComponent)
34 AliHLTTPCClusterDumpComponent::AliHLTTPCClusterDumpComponent()
39 // see header file for class documentation
41 // refer to README to build package
43 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
46 AliHLTTPCClusterDumpComponent::~AliHLTTPCClusterDumpComponent()
48 // see header file for class documentation
51 const char* AliHLTTPCClusterDumpComponent::GetComponentID()
53 // see header file for class documentation
54 return "TPCClusterDump";
57 void AliHLTTPCClusterDumpComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
59 // see header file for class documentation
61 list.push_back(AliHLTTPCDefinitions::fgkClustersDataType);
64 AliHLTComponent* AliHLTTPCClusterDumpComponent::Spawn()
66 // see header file for class documentation
67 return new AliHLTTPCClusterDumpComponent;
70 int AliHLTTPCClusterDumpComponent::InitWriter()
72 // see header file for class documentation
76 int AliHLTTPCClusterDumpComponent::ScanArgument(int argc, const char** argv)
78 // see header file for class documentation
84 if (i>=argc || (argument=argv[i]).IsNull()) continue;
87 if (argument.CompareTo("-directory")==0) {
88 if ((bMissingParam=(++i>=argc))) break;
94 HLTWarning("AliHLTTPCClusterDumpComponent does not have any arguments at this time");
98 int AliHLTTPCClusterDumpComponent::CloseWriter()
100 // see header file for class documentation
104 int AliHLTTPCClusterDumpComponent::DumpEvent( const AliHLTComponentEventData& evtData,
105 const AliHLTComponentBlockData* /*blocks*/,
106 AliHLTComponentTriggerData& /*trigData*/ )
108 // see header file for class documentation
110 HLTDebug("Entering DumpEvent");
114 const AliHLTComponentBlockData* pDesc=NULL;
116 Int_t spacePointCounter=0;
118 //building the filename
120 ios::openmode filemode=(ios::openmode)0;
121 if (!fDirectory.IsNull()) {
122 fCurrentFileName+=fDirectory;
124 fCurrentFileName+="TPCClusterDump_Event";
125 fCurrentFileName+=Form("_%d", GetEventCount());
126 ofstream dump(fCurrentFileName.Data(), filemode);
128 for (pDesc=GetFirstInputBlock(AliHLTTPCDefinitions::fgkClustersDataType); pDesc!=NULL; pDesc=GetNextInputBlock(), blockno++) {
129 HLTDebug("event %Lu block %d: %s 0x%08x size %d", evtData.fEventID, blockno, DataType2Text(pDesc->fDataType).c_str(), pDesc->fSpecification, pDesc->fSize);
131 if(pDesc->fDataType!=AliHLTTPCDefinitions::fgkClustersDataType){continue;}
135 const AliHLTTPCClusterData* clusterData = (const AliHLTTPCClusterData*) pDesc->fPtr;
136 Int_t nSpacepoints = (Int_t) clusterData->fSpacePointCnt;
137 AliHLTTPCSpacePointData *clusters = (AliHLTTPCSpacePointData*) &clusterData->fSpacePoints;
139 for(int i=0;i<nSpacepoints;i++){
141 dump << "ClusterNumber: " << spacePointCounter << endl;
142 dump << "Slice: " << clusters[i].fUsed << endl;//quick fix to get the partiion and slice numbers to the clusterdump
143 dump << "Partition: " << clusters[i].fTrackN << endl;//quick fix to get the partiion and slice numbers to the clusterdump
144 dump << "X: " << clusters[i].fX << endl;
145 dump << "Y: " << clusters[i].fY << endl;
146 dump << "Z: " << clusters[i].fZ << endl;
147 dump << "ID: " << clusters[i].fID << endl;
148 dump << "Pad row: " << clusters[i].fPadRow << endl;
149 dump << "fSigmaY2: " << clusters[i].fSigmaY2 << endl;
150 dump << "fSigmaZ2: " << clusters[i].fSigmaZ2 << endl;
151 dump << "Charge: " << clusters[i].fCharge << endl;
152 dump << "Q Max: " << clusters[i].fMaxQ << endl;
158 HLTError("can not open file %s for writing", fCurrentFileName.Data());