Skip to content

Commit

Permalink
Add AliFlatMultiplicity to the flatESD
Browse files Browse the repository at this point in the history
  • Loading branch information
mkrzewic committed May 13, 2016
1 parent 781c07b commit 2eb9fe1
Show file tree
Hide file tree
Showing 7 changed files with 121 additions and 12 deletions.
53 changes: 51 additions & 2 deletions HLT/global/AliFlatESDEvent.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
#include "Riostream.h"

#include "AliFlatESDVZERO.h"
#include "AliFlatMultiplicity.h"
#include "AliFlatESDVertex.h"

#include "AliFlatESDV0.h"
Expand Down Expand Up @@ -87,6 +88,7 @@ AliFlatESDEvent::AliFlatESDEvent()
fNV0s(0),
fTriggerPointer(0),
fVZEROPointer(-1),
fMultiplicityPointer(-1),
fPrimaryVertexTracksPointer(0),
fPrimaryVertexTPCPointer(0),
fPrimaryVertexSPDPointer(0),
Expand All @@ -105,7 +107,7 @@ AliFlatESDEvent::AliFlatESDEvent( AliVConstructorReinitialisationFlag /*f*/ )
fFriendEvent(NULL)
{
// Constructor for reinitialisation of vtable

// Reinitialise trigger information
{
AliFlatESDTrigger * trigger = reinterpret_cast< AliFlatESDTrigger*>( fContent + fTriggerPointer );
Expand All @@ -116,11 +118,17 @@ AliFlatESDEvent::AliFlatESDEvent( AliVConstructorReinitialisationFlag /*f*/ )
}

// Reinitialise VZERO information
{
{
AliFlatESDVZERO * vzero = GetFlatVZERONonConst();
if( vzero ) vzero->Reinitialize();
}

// Reinitialise Multiplicity information
{
AliFlatMultiplicity * mult = GetFlatMultiplicityNonConst();
if( mult ) mult->Reinitialize();
}

// Reinitialise primary vertices

if( fPrimaryVertexMask & 0x1 ){
Expand Down Expand Up @@ -200,6 +208,7 @@ void AliFlatESDEvent::Reset()
fNV0s = 0;
fTriggerPointer = 0;
fVZEROPointer = -1;
fMultiplicityPointer = -1;
fPrimaryVertexTracksPointer = 0;
fPrimaryVertexTPCPointer = 0;
fPrimaryVertexSPDPointer = 0;
Expand All @@ -220,6 +229,7 @@ void AliFlatESDEvent::Reset()
size += esd->GetNumberOfTracks() * ( AliFlatESDTrack::EstimateSize() + sizeof(Long64_t) );
size += AliESDRun::kNTriggerClasses * sizeof(AliFlatESDTrigger) ;
if( esd->GetVZEROData() ) size += sizeof(AliFlatESDVZERO) ;
if( esd->GetMultiplicity() ) size += sizeof(AliFlatMultiplicity) ;
if( fillV0s ) size += esd->GetNumberOfV0s()*sizeof(AliFlatESDV0);
return size;
}
Expand All @@ -237,6 +247,32 @@ Int_t AliFlatESDEvent::SetVZEROData( const AliESDVZERO *vzero, size_t allocatedV
return 0;
}

Int_t AliFlatESDEvent::SetMultiplicity( const AliMultiplicity *mult, size_t allocatedMemory )
{
// fill Multiplicity info
fMultiplicityPointer = -1;
if( !mult ) return 0;
if( allocatedMemory < sizeof(AliFlatMultiplicity) ) return -1;
fMultiplicityPointer = fContentSize;
AliFlatMultiplicity *flatMult = reinterpret_cast<AliFlatMultiplicity*> (fContent + fMultiplicityPointer );
flatMult->SetFromMultiplicity( *mult );
fContentSize += flatMult->GetSize();
return 0;
}

Int_t AliFlatESDEvent::SetMultiplicity( const AliFlatMultiplicity *mult, size_t allocatedMemory )
{
// fill Multiplicity info
fMultiplicityPointer = -1;
if( !mult ) return 0;
if( allocatedMemory < sizeof(AliFlatMultiplicity) ) return -1;
fMultiplicityPointer = fContentSize;
AliFlatMultiplicity *flatMult = reinterpret_cast<AliFlatMultiplicity*> (fContent + fMultiplicityPointer );
*flatMult = *mult;
fContentSize += flatMult->GetSize();
return 0;
}

Int_t AliFlatESDEvent::SetPrimaryVertexTracks( const AliESDVertex *vtx, size_t allocatedVtxMemory )
{
// fill primary vertex tracks
Expand Down Expand Up @@ -338,6 +374,12 @@ Int_t AliFlatESDEvent::SetFromESD( const size_t allocatedMemorySize, const AliES
if( err!=0 ) return err;
freeSpace = allocatedMemorySize - GetSize();

// fill Multiplicity info

err = SetMultiplicity( esd->GetMultiplicity(), freeSpace );
if( err!=0 ) return err;
freeSpace = allocatedMemorySize - GetSize();

// fill primary vertices

err = SetPrimaryVertexTracks( esd->GetPrimaryVertexTracks(), freeSpace );
Expand Down Expand Up @@ -450,6 +492,13 @@ void AliFlatESDEvent::GetESDEvent( AliESDEvent *esd ) const
if( GetVZEROData( v )>=0 ) esd->SetVZEROData( &v );
}

// fill Multiplicity info

{
AliMultiplicity v;
if( GetMultiplicity( v )>=0 ) esd->SetMultiplicity( &v );
}

// fill primary vertices
{
AliESDVertex v;
Expand Down
31 changes: 28 additions & 3 deletions HLT/global/AliFlatESDEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "AliVMisc.h"
#include "AliVEvent.h"
#include "AliFlatESDVZERO.h"
#include "AliFlatMultiplicity.h"
#include "AliFlatESDTrack.h"
#include "AliFlatESDVertex.h"
#include "AliFlatESDFriend.h"
Expand Down Expand Up @@ -64,6 +65,8 @@ class AliFlatESDEvent :public AliVEvent {

using AliVEvent::GetVZEROData;
Int_t GetVZEROData( AliESDVZERO & ) const ;
using AliVEvent::GetMultiplicity;
Int_t GetMultiplicity( AliMultiplicity & ) const;

using AliVEvent::GetPrimaryVertex;
using AliVEvent::GetPrimaryVertexTPC;
Expand Down Expand Up @@ -103,6 +106,8 @@ class AliFlatESDEvent :public AliVEvent {
void SetTriggerMaskNext50(ULong64_t n) { fTriggerMaskNext50 = n; }

Int_t SetVZEROData( const AliESDVZERO *v, size_t allocatedVtxMemory );
Int_t SetMultiplicity( const AliMultiplicity *m, size_t allocatedMemory );
Int_t SetMultiplicity( const AliFlatMultiplicity *m, size_t allocatedMemory );

Int_t SetPrimaryVertexTracks( const AliESDVertex *v, size_t allocatedVtxMemory );
Int_t SetPrimaryVertexSPD( const AliESDVertex *v, size_t allocatedVtxMemory );
Expand All @@ -120,14 +125,22 @@ class AliFlatESDEvent :public AliVEvent {
// --------------------------------------------------------------------------------
// -- Getter methods

const AliFlatESDVZERO *GetFlatVZERO() const {
const AliFlatESDVZERO *GetFlatVZERO() const {
return ( fVZEROPointer>=0 ) ?reinterpret_cast<const AliFlatESDVZERO*>( fContent + fVZEROPointer ) :NULL;
}
AliFlatESDVZERO *GetFlatVZERONonConst() {

AliFlatESDVZERO *GetFlatVZERONonConst() {
return ( fVZEROPointer>=0 ) ?reinterpret_cast<AliFlatESDVZERO*>( fContent + fVZEROPointer ) :NULL;
}

const AliFlatMultiplicity *GetFlatMultiplicity() const {
return ( fMultiplicityPointer>=0 ) ?reinterpret_cast<const AliFlatMultiplicity*>( fContent + fMultiplicityPointer ) :NULL;
}

AliFlatMultiplicity *GetFlatMultiplicityNonConst() {
return ( fMultiplicityPointer>=0 ) ?reinterpret_cast<AliFlatMultiplicity*>( fContent + fMultiplicityPointer ) :NULL;
}

const AliFlatESDVertex* GetFlatPrimaryVertexSPD() const ;
const AliFlatESDVertex* GetFlatPrimaryVertexTracks() const ;
const AliFlatESDVertex* GetFlatPrimaryVertexTPC() const ;
Expand Down Expand Up @@ -179,6 +192,7 @@ class AliFlatESDEvent :public AliVEvent {
virtual Int_t EventIndexForPHOSCell(Int_t) const {return 0;}
virtual Int_t EventIndexForEMCALCell(Int_t) const {return 0;}
virtual AliVVZERO* GetVZEROData() const {return NULL;}
virtual AliVMultiplicity* GetMultiplicity() const {return NULL;}
virtual AliVZDC *GetZDCData() const {return NULL;}
virtual AliVEvent::EDataLayoutType GetDataLayoutType() const;

Expand Down Expand Up @@ -206,11 +220,14 @@ class AliFlatESDEvent :public AliVEvent {
UInt_t fNTriggerClasses; // N trigger classes
UInt_t fNTracks; // Number of tracks in array
UInt_t fNV0s; // Number of v0's
UInt_t fNclustersITS[6]; // Number of ITS clusters per layer
UInt_t fNtrackletsSPD; // number of SPD tracklets

// Pointers to specific data in fContent

size_t fTriggerPointer; // position of the first trigger description in fContent
Long_t fVZEROPointer; // position of the first trigger description in fContent
Long_t fMultiplicityPointer; //position of the SPD multiplicity in fContent
size_t fPrimaryVertexTracksPointer; // position of primary vertex tracks in fContent
size_t fPrimaryVertexTPCPointer; // position of primary vertex TPC in fContent
size_t fPrimaryVertexSPDPointer; // position of primary vertex SPD in fContent
Expand Down Expand Up @@ -353,4 +370,12 @@ inline Int_t AliFlatESDEvent::GetVZEROData( AliESDVZERO &v ) const
return 0;
}

inline Int_t AliFlatESDEvent::GetMultiplicity( AliMultiplicity &m ) const
{
const AliFlatMultiplicity* flatMult = GetFlatMultiplicity();
if (!flatMult) return -1;
flatMult->GetMultiplicity( m );
return 0;
}

#endif
25 changes: 23 additions & 2 deletions HLT/global/AliHLTGlobalFlatEsdConverterComponent.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,6 @@ int AliHLTGlobalFlatEsdConverterComponent::DoEvent( const AliHLTComponentEventDa
}
}

HLTInfo("converted %d TPC %d ITS %d ITSout track(s) to GlobalBarrelTrack", tracksTPC.size(), tracksITS.size(), tracksITSOut.size() );

// Set TPC MC labels to tracks
for( UInt_t itr=0; itr < tracksTPC.size(); itr++) {
AliHLTGlobalBarrelTrack &track = tracksTPC[itr];
Expand Down Expand Up @@ -375,6 +373,8 @@ int AliHLTGlobalFlatEsdConverterComponent::DoEvent( const AliHLTComponentEventDa
}
}

HLTInfo("converted %d TPC %d ITS %d ITSout track(s) to GlobalBarrelTrack, got %i ITS SAP tracks ", tracksTPC.size(), tracksITS.size(), tracksITSOut.size(), (dataSAP)?dataSAP->fCount:0 );


// ---------------------------------------------
//
Expand Down Expand Up @@ -465,6 +465,27 @@ int AliHLTGlobalFlatEsdConverterComponent::DoEvent( const AliHLTComponentEventDa

if( err ) break;

//fill the flat SPD multiplicity struct
{
if( dataSAP ){
AliFlatMultiplicity flatMult;
flatMult.SetNumberOfTracklets( dataSAP->fNSPDtracklets );
flatMult.SetITSClusters(dataSAP->fNclusters);
err = flatEsd->SetMultiplicity( &flatMult, freeSpace );
freeSpace = maxOutputSize - flatEsd->GetSize();
HLTInfo("filled multiplicity: %i %u %u %u %u %u %u", flatMult.GetNumberOfTracklets(),
flatMult.GetITSClusters(0),
flatMult.GetITSClusters(1),
flatMult.GetITSClusters(2),
flatMult.GetITSClusters(3),
flatMult.GetITSClusters(4),
flatMult.GetITSClusters(5)
);
}
}

if( err ) break;

const AliESDVertex *primaryVertex = 0;
const AliESDVertex *primaryVertexTracks = 0;
const AliESDVertex *primaryVertexSPD = 0;
Expand Down
4 changes: 4 additions & 0 deletions STEER/ESD/AliESDEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,10 @@ class AliESDEvent : public AliVEvent {
void SetMultiplicity(const AliMultiplicity *mul);

AliMultiplicity *GetMultiplicity() const {return fSPDMult;}
Int_t GetMultiplicity( AliMultiplicity & mult ) const {
if( fSPDMult ){ mult=*fSPDMult; return 0; }
return -1;
}
void EstimateMultiplicity(Int_t &tracklets,Int_t &trITSTPC,Int_t &trITSSApure,
Double_t eta=1.,Bool_t useDCAFlag=kTRUE,Bool_t useV0Flag=kTRUE) const;

Expand Down
14 changes: 10 additions & 4 deletions STEER/ESD/AliMultiplicity.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ AliVMultiplicity("AliMultiplicity",""), // must be named like that to be search
fPhisingle(0),
fLabelssingle(0),
fFastOrFiredChips(1200),
fClusterFiredChips(1200)
fClusterFiredChips(1200),
fNtracksOnline(0)
{
// Default Constructor
fFiredChips[0] = 0;
Expand Down Expand Up @@ -62,7 +63,8 @@ AliMultiplicity::AliMultiplicity(Int_t ntr, Float_t *th, Float_t *ph, Float_t *
fPhisingle(0),
fLabelssingle(0),
fFastOrFiredChips(1200),
fClusterFiredChips(1200)
fClusterFiredChips(1200),
fNtracksOnline(0)
{
// Standard constructor
for (int il=2;il--;) fSCl2Tracks[il] = fTCl2Tracks[il][0] = fTCl2Tracks[il][1] = 0;
Expand Down Expand Up @@ -122,7 +124,8 @@ AliMultiplicity::AliMultiplicity(Int_t ntr, Int_t ns, Short_t nfcL1, Short_t nfc
fPhisingle(0),
fLabelssingle(0),
fFastOrFiredChips(1200),
fClusterFiredChips(1200)
fClusterFiredChips(1200),
fNtracksOnline(0)
{
// Standard constructor to create the arrays w/o filling
for (int il=2;il--;) fSCl2Tracks[il] = fTCl2Tracks[il][0] = fTCl2Tracks[il][1] = 0;
Expand Down Expand Up @@ -174,7 +177,8 @@ AliMultiplicity::AliMultiplicity(const AliMultiplicity& m):
fPhisingle(0),
fLabelssingle(0),
fFastOrFiredChips(1200),
fClusterFiredChips(1200)
fClusterFiredChips(1200),
fNtracksOnline(0)
{
// copy constructor
for (int il=2;il--;) fSCl2Tracks[il] = fTCl2Tracks[il][0] = fTCl2Tracks[il][1] = 0;
Expand Down Expand Up @@ -282,6 +286,7 @@ void AliMultiplicity::Duplicate(const AliMultiplicity& m){
fNStdDev = m.fNStdDev;
fFastOrFiredChips = m.fFastOrFiredChips;
fClusterFiredChips = m.fClusterFiredChips;
fNtracksOnline = m.fNtracksOnline;
}

//______________________________________________________________________
Expand Down Expand Up @@ -331,6 +336,7 @@ void AliMultiplicity::Clear(Option_t*)
fFiredChips[0] = fFiredChips[1] = 0;
fFastOrFiredChips.ResetAllBits(kTRUE);
fClusterFiredChips.ResetAllBits(kTRUE);
fNtracksOnline = 0;
//
}

Expand Down
4 changes: 3 additions & 1 deletion STEER/ESD/AliMultiplicity.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ class AliMultiplicity : public AliVMultiplicity {
//
// methods supported on AliVMultiplicity level >>>
//
virtual Int_t GetNumberOfTracklets() const {return fNtracks;}
virtual Int_t GetNumberOfTracklets() const {if (fNtracks==0 && fNtracksOnline>0) { return fNtracksOnline; } return fNtracks;}
virtual void SetNumberOfTracklets( Int_t tr) { fNtracksOnline = tr; } //used online (HLT)
virtual Double_t GetTheta(Int_t i) const {
if(i>=0 && i<fNtracks) return fTh[i];
Error("GetTheta","Invalid track number %d",i); return -9999.;
Expand Down Expand Up @@ -190,6 +191,7 @@ class AliMultiplicity : public AliVMultiplicity {
UInt_t fITSClusters[6]; // Number of ITS cluster per layer
TBits fFastOrFiredChips; // Map of FastOr fired chips
TBits fClusterFiredChips; // Map of fired chips (= at least one cluster)
Int_t fNtracksOnline; //!Number of SPD tracklets set on the fly in online processing (HLT)

ClassDef(AliMultiplicity,20);
};
Expand Down
2 changes: 2 additions & 0 deletions STEER/STEERBase/AliVEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class AliESDkink;
class AliESDv0;
class AliESDVertex;
class AliESDVZERO;
class AliMultiplicity;
class AliVTrack;
class AliVAD;

Expand Down Expand Up @@ -233,6 +234,7 @@ class AliVEvent : public TObject {
virtual Int_t GetNumberOfKinks() const { return 0; }

virtual Int_t GetVZEROData( AliESDVZERO & ) const {return -1;}
virtual Int_t GetMultiplicity( AliMultiplicity & ) const {return -1;}

// Primary vertex
virtual const AliVVertex *GetPrimaryVertex() const {return 0x0;}
Expand Down

0 comments on commit 2eb9fe1

Please sign in to comment.