Skip to content

Commit

Permalink
Retagging v5-03-Rev-01
Browse files Browse the repository at this point in the history
  • Loading branch information
hristov committed Nov 26, 2012
2 parents 417d121 + 07c1dae commit 1867ac9
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 88 deletions.
103 changes: 31 additions & 72 deletions HLT/TPCLib/AliHLTTPCClusterAccessHLTOUT.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
/** ROOT macro for the implementation of ROOT specific class methods */
ClassImp(AliHLTTPCClusterAccessHLTOUT)

const int AliHLTTPCClusterAccessHLTOUT::AliRawClusterContainer::iterator::fkRowOffsetOuterSector = AliHLTTPCTransform::GetFirstRow(2);

AliHLTTPCClusterAccessHLTOUT::AliHLTTPCClusterAccessHLTOUT()
: TObject()
, fVerbosity(0)
Expand Down Expand Up @@ -404,33 +406,21 @@ int AliHLTTPCClusterAccessHLTOUT::ProcessClusters(const char* params)
}

AliHLTTPCClusterAccessHLTOUT::AliRawClusterContainer::AliRawClusterContainer()
: fClusterVectors()
, fClusterMaps()
: fClusterMaps()
, fSectorArray(new TClonesArray(AliTPCclusterMI::Class()))
, fIterator()

{
/// constructor
AliHLTTPCRawClusterVector* first=new AliHLTTPCRawClusterVector;
if (first) {
first->reserve(500000);
fClusterVectors.push_back(first);
}
for (int i=0; i<72; i++) {
fClusterMaps.push_back(new AliRawClusterEntryVector);
fClusterMaps.back()->reserve(5000);
}
}

AliHLTTPCClusterAccessHLTOUT::AliRawClusterContainer::~AliRawClusterContainer()
{
/// dectructor
{
for (vector<AliHLTTPCRawClusterVector*>::iterator i=fClusterVectors.begin(); i!=fClusterVectors.end(); i++) {
if (*i) {
delete *i;
}
}
}
{
for (vector<AliRawClusterEntryVector*>::iterator i=fClusterMaps.begin(); i!=fClusterMaps.end(); i++) {
if (*i) {
Expand Down Expand Up @@ -475,48 +465,19 @@ AliHLTTPCClusterAccessHLTOUT::AliRawClusterEntry* AliHLTTPCClusterAccessHLTOUT::
{
/// load next cluster from array of the sepcific sector
unsigned sector=partition<2?slice:slice+36;
if (fClusterMaps.size()<=sector ||
if (fClusterMaps.size()<=sector ||
fClusterMaps[sector]==NULL) {
AliErrorClass(Form("no cluster array available for sector %d", sector));
return NULL;
}
if (fClusterVectors.size()==0) {
AliFatalClass("memory allocation of first cluster array failed");
return NULL;
}
AliHLTTPCRawClusterVector* pClusters=NULL;
for (vector<AliHLTTPCRawClusterVector*>::iterator i=fClusterVectors.begin(); i!=fClusterVectors.end(); i++) {
if (*i && (*i)->size()<(*i)->capacity()) {
pClusters=*i;
break;
}
}
if (!pClusters) {
pClusters=new AliHLTTPCRawClusterVector;
if (!pClusters) {
AliFatalClass("memory allocation of next cluster array failed");
return NULL;
}
pClusters->reserve(500000);
fClusterVectors.push_back(pClusters);
}

AliHLTTPCRawCluster dummy;
pClusters->push_back(dummy);
AliRawClusterEntry entry(&(pClusters->back()));
AliRawClusterEntryVector& map=*(fClusterMaps[sector]);
map.push_back(entry);
map.push_back(AliRawClusterEntry());
return &map.back();
}

void AliHLTTPCClusterAccessHLTOUT::AliRawClusterContainer::Clear(Option_t* /*option*/)
{
/// internal cleanup
{
for (vector<AliHLTTPCRawClusterVector*>::iterator i=fClusterVectors.begin(); i!=fClusterVectors.end(); i++) {
if (*i) (*i)->clear();
}
}
{
for (vector<AliRawClusterEntryVector*>::iterator i=fClusterMaps.begin(); i!=fClusterMaps.end(); i++)
if (*i) (*i)->clear();
Expand All @@ -543,27 +504,26 @@ int AliHLTTPCClusterAccessHLTOUT::AliRawClusterContainer::FillSectorArray(TClone
pSectorArray->Clear();

AliRawClusterEntryVector& map=*fClusterMaps[sector];
for (unsigned i=0; i<map.size(); i++) {
if (!map[i].fCluster) continue;
if (row>=0 && map[i].fCluster->GetPadRow()!=row) continue;
AliTPCclusterMI* pCluster=new ((*pSectorArray)[i]) AliTPCclusterMI;
unsigned nFilled=0;
for (unsigned i=0; i<map.size(); i++) {
if (row>=0 && map[i].fCluster.GetPadRow()!=row) continue;
AliTPCclusterMI* pCluster=new ((*pSectorArray)[nFilled]) AliTPCclusterMI;
if (!pCluster) break;

pCluster->SetRow(map[i].fCluster->GetPadRow());
pCluster->SetPad(map[i].fCluster->GetPad());
pCluster->SetTimeBin(map[i].fCluster->GetTime());
pCluster->SetSigmaY2(map[i].fCluster->GetSigmaY2());
pCluster->SetSigmaZ2(map[i].fCluster->GetSigmaZ2());
pCluster->SetQ(map[i].fCluster->GetCharge());
pCluster->SetMax(map[i].fCluster->GetQMax());

if (map[i].fMC) {
for (int k=0; k<3; k++) {
// TODO: sort the labels according to the weight in order to assign the most likely mc label
// to the first component
pCluster->SetLabel(map[i].fMC->fClusterID[k].fMCID, k);
}

pCluster->SetRow(map[i].fCluster.GetPadRow());
pCluster->SetPad(map[i].fCluster.GetPad());
pCluster->SetTimeBin(map[i].fCluster.GetTime());
pCluster->SetSigmaY2(map[i].fCluster.GetSigmaY2());
pCluster->SetSigmaZ2(map[i].fCluster.GetSigmaZ2());
pCluster->SetQ(map[i].fCluster.GetCharge());
pCluster->SetMax(map[i].fCluster.GetQMax());

for (int k=0; k<3; k++) {
// TODO: sort the labels according to the weight in order to assign the most likely mc label
// to the first component
pCluster->SetLabel(map[i].fMC.fClusterID[k].fMCID, k);
}
nFilled++;
}

return 0;
Expand All @@ -583,14 +543,13 @@ void AliHLTTPCClusterAccessHLTOUT::AliRawClusterContainer::Print(Option_t *optio
cout << " sector " << setfill(' ') << setw(2) << iArray << ": " << map.size() << endl;
if (bAll) {
for (unsigned iCluster=0; iCluster<map.size(); iCluster++) {
if (!map[iCluster].fCluster) continue;
AliHLTTPCRawCluster* pCluster=map[iCluster].fCluster;
AliHLTTPCRawCluster &cluster = map[iCluster].fCluster;
cout << " AliTPCclusterMI:"
<< " row=" << pCluster->GetPadRow()
<< " pad=" << pCluster->GetPad()
<< " time=" << pCluster->GetTime()
<< " charge=" << pCluster->GetCharge()
<< " maxq=" << pCluster->GetQMax()
<< " row=" << cluster.GetPadRow()
<< " pad=" << cluster.GetPad()
<< " time=" << cluster.GetTime()
<< " charge=" << cluster.GetCharge()
<< " maxq=" << cluster.GetQMax()
<< endl;
}
}
Expand All @@ -615,6 +574,6 @@ AliHLTTPCClusterAccessHLTOUT::AliRawClusterContainer::iterator& AliHLTTPCCluster

// offline uses row number in physical sector, inner sector consists of
// partitions 0 and 1, outer sector of partition 2-5
fRowOffset=partition<2?0:AliHLTTPCTransform::GetFirstRow(2);
fRowOffset=partition<2?0:fkRowOffsetOuterSector;
return *this;
}
32 changes: 16 additions & 16 deletions HLT/TPCLib/AliHLTTPCClusterAccessHLTOUT.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,21 +109,19 @@ class AliHLTTPCClusterAccessHLTOUT : public TObject
/// process the cluster data block of various formats from HLTOUT
int ProcessClusters(const char* params);

/// helper struct to store cluster pointers in a map together with MC info
/// helper struct to store cluster in a map together with MC info
struct AliRawClusterEntry {
AliRawClusterEntry() : fCluster(NULL), fMC(NULL) {}
AliRawClusterEntry(AliHLTTPCRawCluster* pCluster) : fCluster(pCluster), fMC(NULL) {}
AliRawClusterEntry() : fCluster(), fMC() {}
AliRawClusterEntry(const AliRawClusterEntry& other) : fCluster(other.fCluster), fMC(other.fMC) {}
AliRawClusterEntry& operator=(const AliRawClusterEntry& other) {
if (&other==this) return *this;
fCluster=other.fCluster; fMC=other.fMC;
return *this;
}
AliHLTTPCRawCluster* fCluster; //! pointer to cluster in the array of all clusters
const AliHLTTPCClusterMCLabel* fMC; //! pointer to corresponding MC data in HLTOUT block
AliHLTTPCRawCluster fCluster; //! cluster
AliHLTTPCClusterMCLabel fMC; //! MC labels
};

typedef vector<AliHLTTPCRawCluster> AliHLTTPCRawClusterVector;
typedef vector<AliRawClusterEntry> AliRawClusterEntryVector;

/**
Expand Down Expand Up @@ -154,25 +152,28 @@ class AliHLTTPCClusterAccessHLTOUT : public TObject
}
~iterator() {}

void SetPadRow(int row) {if (fEntry && fEntry->fCluster) fEntry->fCluster->SetPadRow(row-fRowOffset);}
void SetPad(float pad) {if (fEntry && fEntry->fCluster) fEntry->fCluster->SetPad(pad);}
void SetTime(float time) {if (fEntry && fEntry->fCluster) fEntry->fCluster->SetTime(time);}
void SetSigmaY2(float sigmaY2) {if (fEntry && fEntry->fCluster) fEntry->fCluster->SetSigmaY2(sigmaY2);}
void SetSigmaZ2(float sigmaZ2) {if (fEntry && fEntry->fCluster) fEntry->fCluster->SetSigmaZ2(sigmaZ2);}
void SetCharge(unsigned charge) {if (fEntry && fEntry->fCluster) fEntry->fCluster->SetCharge(charge);}
void SetQMax(unsigned qmax) {if (fEntry && fEntry->fCluster) fEntry->fCluster->SetQMax(qmax);}
void SetPadRow(int row) {if (fEntry ) fEntry->fCluster.SetPadRow(row-fRowOffset);}
void SetPad(float pad) {if (fEntry ) fEntry->fCluster.SetPad(pad);}
void SetTime(float time) {if (fEntry ) fEntry->fCluster.SetTime(time);}
void SetSigmaY2(float sigmaY2) {if (fEntry ) fEntry->fCluster.SetSigmaY2(sigmaY2);}
void SetSigmaZ2(float sigmaZ2) {if (fEntry ) fEntry->fCluster.SetSigmaZ2(sigmaZ2);}
void SetCharge(unsigned charge) {if (fEntry ) fEntry->fCluster.SetCharge(charge);}
void SetQMax(unsigned qmax) {if (fEntry ) fEntry->fCluster.SetQMax(qmax);}
void SetMC(const AliHLTTPCClusterMCLabel* pMC) {
if (fEntry) fEntry->fMC=pMC;
if (fEntry && pMC ) fEntry->fMC=*pMC;
}

// switch to next cluster
iterator& Next(int slice, int partition);

private:

static const Int_t fkRowOffsetOuterSector; //! transient

int fClusterNo; //! cluster no in the current block
AliRawClusterContainer* fData; //! pointer to actual data
AliRawClusterEntry* fEntry; //! pointer to current cluster
int fRowOffset; //! row offset for current partition
int fRowOffset; //! row offset for current partition
};

/// iterator of remaining clusters block of specification
Expand All @@ -199,7 +200,6 @@ class AliHLTTPCClusterAccessHLTOUT : public TObject
/// assignment operator prohibited
AliRawClusterContainer& operator=(const AliRawClusterContainer&);

vector<AliHLTTPCRawClusterVector*> fClusterVectors; //! instances of cluster arrays
vector<AliRawClusterEntryVector*> fClusterMaps; //! cluster pointer vectors per sector (offline notation 0-71)
TClonesArray* fSectorArray; //! current sector array of clusters provided to caller
iterator fIterator; //!
Expand Down

0 comments on commit 1867ac9

Please sign in to comment.