#include "AliHLTTPCDefinitions.h"
#include "AliHLTTPCSpacePointData.h"
#include "AliHLTTPCClusterDataFormat.h"
+#include "AliHLTTPCTransform.h"
/** ROOT macro for the implementation of ROOT specific class methods */
ClassImp(AliHLTTPCClusterDumpComponent)
AliHLTTPCClusterDumpComponent::AliHLTTPCClusterDumpComponent()
:
- AliHLTFileWriter(),
- fDirectory("")
+ AliHLTFileWriter()
+//fSlice(-1)
{
// see header file for class documentation
// or
// see header file for class documentation
list.clear();
list.push_back(AliHLTTPCDefinitions::fgkClustersDataType);
+ list.push_back(AliHLTTPCDefinitions::fgkAlterClustersDataType);
}
AliHLTComponent* AliHLTTPCClusterDumpComponent::Spawn()
return 0;
}
-int AliHLTTPCClusterDumpComponent::ScanArgument(int argc, const char** argv)
+int AliHLTTPCClusterDumpComponent::ScanArgument(int /*argc*/, const char** /*argv*/)
{
// see header file for class documentation
-
+ int iResult=0;
TString argument="";
bool bMissingParam=0;
int i=0;
- do {
- if (i>=argc || (argument=argv[i]).IsNull()) continue;
-
- // -directory
- if (argument.CompareTo("-directory")==0) {
- if ((bMissingParam=(++i>=argc))) break;
- fDirectory=argv[i];
- break;
- }
- }while(0);
-
- HLTWarning("AliHLTTPCClusterDumpComponent does not have any arguments at this time");
- return 0;
+
+ if (bMissingParam) iResult=-EPROTO;
+ else if (iResult>=0) iResult=i;
+
+ return iResult;
}
int AliHLTTPCClusterDumpComponent::CloseWriter()
}
int AliHLTTPCClusterDumpComponent::DumpEvent( const AliHLTComponentEventData& evtData,
- const AliHLTComponentBlockData* /*blocks*/,
AliHLTComponentTriggerData& /*trigData*/ )
{
// see header file for class documentation
int blockno=0;
const AliHLTComponentBlockData* pDesc=NULL;
- Int_t spacePointCounter=0;
-
- //building the filename
- fCurrentFileName="";
- ios::openmode filemode=(ios::openmode)0;
- if (!fDirectory.IsNull()) {
- fCurrentFileName+=fDirectory;
- }
- fCurrentFileName+="TPCClusterDump_Event";
- fCurrentFileName+=Form("_%d", GetEventCount());
- ofstream dump(fCurrentFileName.Data(), filemode);
+ if ( GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR ) )
+ return 0;
+ Int_t spacePointCounter=0;
+
for (pDesc=GetFirstInputBlock(AliHLTTPCDefinitions::fgkClustersDataType); pDesc!=NULL; pDesc=GetNextInputBlock(), blockno++) {
- HLTDebug("event %Lu block %d: %s 0x%08x size %d", evtData.fEventID, blockno, DataType2Text(pDesc->fDataType).c_str(), pDesc->fSpecification, pDesc->fSize);
-
- if(pDesc->fDataType!=AliHLTTPCDefinitions::fgkClustersDataType){continue;}
-
- if (dump.good()) {
- iResult=1;
- const AliHLTTPCClusterData* clusterData = (const AliHLTTPCClusterData*) pDesc->fPtr;
- Int_t nSpacepoints = (Int_t) clusterData->fSpacePointCnt;
- AliHLTTPCSpacePointData *clusters = (AliHLTTPCSpacePointData*) &clusterData->fSpacePoints;
-
- for(int i=0;i<nSpacepoints;i++){
- dump << "" << endl;
- dump << "ClusterNumber: " << spacePointCounter << endl;
- dump << "Slice: " << clusters[i].fUsed << endl;//quick fix to get the partiion and slice numbers to the clusterdump
- dump << "Partition: " << clusters[i].fTrackN << endl;//quick fix to get the partiion and slice numbers to the clusterdump
- dump << "X: " << clusters[i].fX << endl;
- dump << "Y: " << clusters[i].fY << endl;
- dump << "Z: " << clusters[i].fZ << endl;
- dump << "ID: " << clusters[i].fID << endl;
- dump << "Pad row: " << clusters[i].fPadRow << endl;
- dump << "fSigmaY2: " << clusters[i].fSigmaY2 << endl;
- dump << "fSigmaZ2: " << clusters[i].fSigmaZ2 << endl;
- dump << "Charge: " << clusters[i].fCharge << endl;
- dump << "Q Max: " << clusters[i].fMaxQ << endl;
- spacePointCounter++;
- }
-
- }
- else {
- HLTError("can not open file %s for writing", fCurrentFileName.Data());
- iResult=-EBADF;
- }
-
- dump.close();
+ TString filename;
+ iResult=BuildFileName(evtData.fEventID, 0, pDesc->fDataType, 0, filename);
+ ios::openmode filemode=(ios::openmode)0;
+ if (fCurrentFileName.CompareTo(filename)==0) {
+ filemode=ios::app;
+ } else {
+ fCurrentFileName=filename;
+ }
+
+ if (iResult>=0) {
+ ofstream dump(fCurrentFileName.Data(), filemode);
+ if (dump.good()) {
+
+ if(pDesc->fDataType!=AliHLTTPCDefinitions::fgkClustersDataType){continue;}
+
+ //if (dump.good() || 1) {//the || 1 is there since dump.good() will return false( EOF )
+ iResult=1;
+ const AliHLTTPCClusterData* clusterData = (const AliHLTTPCClusterData*) pDesc->fPtr;
+ Int_t nSpacepoints = (Int_t) clusterData->fSpacePointCnt;
+ AliHLTTPCSpacePointData *clusters = (AliHLTTPCSpacePointData*) &clusterData->fSpacePoints;
+
+ for(int i=0;i<nSpacepoints;i++){
+ UInt_t idCluster = clusters[i].fID;
+ Int_t slice = AliHLTTPCSpacePointData::GetSlice(idCluster);
+ Int_t patch = AliHLTTPCSpacePointData::GetPatch(idCluster);
+
+ dump << "" << endl;
+ dump << "ClusterNumber: " << spacePointCounter << endl;
+ dump << "Slice: " << slice << endl;
+ dump << "Partition: " << patch << endl;
+ dump << "[X,Y,Z]: [" << clusters[i].fX<<" , "<<clusters[i].fY<<" , "<<clusters[i].fZ <<"]"<< endl;
+ //Float_t xyz[3]={clusters[i].fX,clusters[i].fY,clusters[i].fZ};
+ //AliHLTTPCTransform::LocHLT2Raw(xyz,(Int_t)(clusters[i].fID/10),(Int_t)(clusters[i].fID%10));
+ //dump << "[R,P,T]: [" << xyz[0]<<" , "<<xyz[1]<<" , "<<xyz[2] <<"]"<< endl;
+ dump << "Total Charge: " << clusters[i].fCharge << endl;
+ dump << "Q Max: " << clusters[i].fQMax << endl;
+ spacePointCounter++;
+ }
+ }
+ else {
+ HLTError("can not open file %s for writing", fCurrentFileName.Data());
+ iResult=-EBADF;
+ }
+ dump.close();
+ }
+ }
+
+ for (pDesc=GetFirstInputBlock(AliHLTTPCDefinitions::fgkAlterClustersDataType); pDesc!=NULL; pDesc=GetNextInputBlock(), blockno++) {
+ TString filename;
+ iResult=BuildFileName(evtData.fEventID, 0, pDesc->fDataType, 0, filename);
+ ios::openmode filemode=(ios::openmode)0;
+ if (fCurrentFileName.CompareTo(filename)==0) {
+ filemode=ios::app;
+ } else {
+ fCurrentFileName=filename;
+ }
+
+ if (iResult>=0) {
+ ofstream dump(fCurrentFileName.Data(), filemode);
+ if (dump.good()) {
+
+ if(pDesc->fDataType!=AliHLTTPCDefinitions::fgkAlterClustersDataType){continue;}
+
+ //if (dump.good() || 1) {//the || 1 is there since dump.good() will return false( EOF )
+ iResult=1;
+ const AliHLTTPCClusterData* clusterData = (const AliHLTTPCClusterData*) pDesc->fPtr;
+ Int_t nSpacepoints = (Int_t) clusterData->fSpacePointCnt;
+ AliHLTTPCSpacePointData *clusters = (AliHLTTPCSpacePointData*) &clusterData->fSpacePoints;
+
+ for(int i=0;i<nSpacepoints;i++){
+ UInt_t idCluster = clusters[i].fID;
+ Int_t slice = AliHLTTPCSpacePointData::GetSlice(idCluster);
+ Int_t patch = AliHLTTPCSpacePointData::GetPatch(idCluster);
+
+ dump << "" << endl;
+ dump << "ClusterNumber: " << spacePointCounter << endl;
+ dump << "Slice: " << slice << endl;
+ dump << "Partition: " << patch << endl;
+ dump << "[X,Y,Z]: [" << clusters[i].fX<<" , "<<clusters[i].fY<<" , "<<clusters[i].fZ <<"]"<< endl;
+ //Float_t xyz[3]={clusters[i].fX,clusters[i].fY,clusters[i].fZ};
+ //AliHLTTPCTransform::LocHLT2Raw(xyz,(Int_t)(clusters[i].fID/10),(Int_t)(clusters[i].fID%10));
+ //dump << "[R,P,T]: [" << xyz[0]<<" , "<<xyz[1]<<" , "<<xyz[2] <<"]"<< endl;
+ dump << "Total Charge: " << clusters[i].fCharge << endl;
+ dump << "Q Max: " << clusters[i].fQMax << endl;
+ spacePointCounter++;
+ }
+ }
+ else {
+ HLTError("can not open file %s for writing", fCurrentFileName.Data());
+ iResult=-EBADF;
+ }
+ dump.close();
+ }
}
return iResult;
}