X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=HLT%2FTPCLib%2FAliHLTTPCEsdWriterComponent.cxx;h=66425ac33bbfd55248bee1881390ee028f9bb444;hb=af885e0fc45eeab1177d3d34f858ccd8836787fb;hp=bad27f294fa4803549dd053a4fd84d035e3b33b4;hpb=04dbc9e4bbf22ed45abe61cc14b9a129575338d7;p=u%2Fmrichter%2FAliRoot.git diff --git a/HLT/TPCLib/AliHLTTPCEsdWriterComponent.cxx b/HLT/TPCLib/AliHLTTPCEsdWriterComponent.cxx index bad27f294fa..66425ac33bb 100644 --- a/HLT/TPCLib/AliHLTTPCEsdWriterComponent.cxx +++ b/HLT/TPCLib/AliHLTTPCEsdWriterComponent.cxx @@ -1,5 +1,21 @@ // @(#) $Id$ +/************************************************************************** + * This file is property of and copyright by the ALICE HLT Project * + * ALICE Experiment at CERN, All rights reserved. * + * * + * Primary Authors: Matthias Richter * + * for The ALICE HLT Project. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + /** @file AliHLTTPCEsdWriterComponent.cxx @author Matthias Richter @date @@ -8,7 +24,7 @@ */ #include "AliHLTTPCEsdWriterComponent.h" -#include "AliESD.h" +#include "AliESDEvent.h" #include "TTree.h" #include "AliHLTTPCTrack.h" #include "AliHLTTPCTrackArray.h" @@ -26,20 +42,28 @@ AliHLTTPCEsdWriterComponent::AliHLTTPCEsdWriterComponent() fTree(NULL), fESD(NULL) { + // see header file for class documentation + // or + // refer to README to build package + // or + // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt } AliHLTTPCEsdWriterComponent::~AliHLTTPCEsdWriterComponent() { + // see header file for class documentation } int AliHLTTPCEsdWriterComponent::InitWriter() { + // see header file for class documentation int iResult=0; - fESD = new AliESD; + fESD = new AliESDEvent; + fESD->CreateStdContent(); if (fESD) { fTree = new TTree("esdTree", "Tree with HLT ESD objects"); if (fTree) { - fTree->Branch("ESD", "AliESD", &fESD); + fESD->WriteToTree(fTree); } delete fESD; fESD=NULL; @@ -52,6 +76,7 @@ int AliHLTTPCEsdWriterComponent::InitWriter() int AliHLTTPCEsdWriterComponent::CloseWriter() { + // see header file for class documentation int iResult=0; if (fTree) { WriteObject(kAliHLTVoidEventID, fTree); @@ -61,49 +86,61 @@ int AliHLTTPCEsdWriterComponent::CloseWriter() } else { HLTWarning("not initialized"); } - AliHLTRootFileWriterComponent::CloseWriter(); + iResult=AliHLTRootFileWriterComponent::CloseWriter(); + return iResult; } int AliHLTTPCEsdWriterComponent::DumpEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, AliHLTComponentTriggerData& trigData ) { + // see header file for class documentation int iResult=0; TTree* pTree=fTree; if (pTree) { - fESD = new AliESD; + fESD = new AliESDEvent; + fESD->CreateStdContent(); if (fESD) { - AliESD* pESD=fESD; + AliESDEvent* pESD=fESD; const AliHLTComponentBlockData* iter = NULL; - AliHLTTPCTrackArray* tracks=NULL; AliHLTTPCTrackletData* inPtr=NULL; + int bIsTrackSegs=0; - for (int ndx=0; ndx=0; ndx++) { + for (int ndx=0; ndx<(int)evtData.fBlockCnt && iResult>=0; ndx++) { iter = blocks+ndx; - if ( iter->fDataType == AliHLTTPCDefinitions::gkTrackSegmentsDataType ) { - if (tracks==NULL) { - tracks=new AliHLTTPCTrackArray; - if (tracks) { - inPtr=(AliHLTTPCTrackletData*)iter->fPtr; - HLTDebug("reading block %d: %d tracklets", ndx, inPtr->fTrackletCnt); - tracks->FillTracks(inPtr->fTrackletCnt, inPtr->fTracklets); - if ((iResult=Tracks2ESD(tracks, pESD))>=0) { - pTree->Fill(); - } - } else { - iResult=-ENOMEM; + if ( (bIsTrackSegs=(iter->fDataType == AliHLTTPCDefinitions::fgkTrackSegmentsDataType))==1 || + iter->fDataType == AliHLTTPCDefinitions::fgkTracksDataType ) { + Int_t minslice=AliHLTTPCDefinitions::GetMinSliceNr(iter->fSpecification); + Int_t maxslice=AliHLTTPCDefinitions::GetMaxSliceNr(iter->fSpecification); + if (bIsTrackSegs==0) { + // slice parameter and data specification ignored, tracks already in global coordinates + minslice=0; + maxslice=0; + } + //HLTDebug("dataspec %#x minslice %d", iter->fSpecification, minslice); + if (minslice >=0 && minslice<36) { + if (minslice!=maxslice) { + HLTWarning("data from multiple sectors in one block: " + "possible missmatch in treatment of local coordinate system"); + } + AliHLTTPCTrackArray tracks; + inPtr=(AliHLTTPCTrackletData*)iter->fPtr; + HLTDebug("reading block %d (slice %d): %d tracklets", ndx, minslice, inPtr->fTrackletCnt); + tracks.FillTracks(inPtr->fTrackletCnt, inPtr->fTracklets, minslice, 0/*don't rotate*/); + if ((iResult=Tracks2ESD(&tracks, pESD))>=0) { } } else { - HLTWarning("can not process more than one track segment data block, " - "please put a track merger in between"); - break; // don't print the warning again + HLTError("invalid sector number"); + iResult=-EBADF; } } } + if (iResult>=0) { + pTree->Fill(); + } - - fESD=NULL; + fESD->Reset(); delete pESD; } else { iResult=-ENOMEM; @@ -114,12 +151,14 @@ int AliHLTTPCEsdWriterComponent::DumpEvent( const AliHLTComponentEventData& evtD int AliHLTTPCEsdWriterComponent::ScanArgument(int argc, const char** argv) { + // see header file for class documentation int iResult=AliHLTRootFileWriterComponent::ScanArgument(argc, argv); return iResult; } -int AliHLTTPCEsdWriterComponent::Tracks2ESD(AliHLTTPCTrackArray* pTracks, AliESD* pESD) +int AliHLTTPCEsdWriterComponent::Tracks2ESD(AliHLTTPCTrackArray* pTracks, AliESDEvent* pESD) { + // see header file for class documentation int iResult=0; if (pTracks && pESD) { HLTDebug("converting %d tracks from track array", pTracks->GetNTracks());