add special constructors for restoring the vtable ptr
authormkrzewic <mikolaj.krzewicki@cern.ch>
Thu, 3 Jul 2014 17:16:21 +0000 (19:16 +0200)
committermkrzewic <mikolaj.krzewicki@cern.ch>
Thu, 3 Jul 2014 17:22:26 +0000 (19:22 +0200)
17 files changed:
HLT/global/AliFlatESDEvent.cxx
HLT/global/AliFlatESDEvent.h
HLT/global/AliFlatESDTrack.cxx
HLT/global/AliFlatESDTrack.h
HLT/global/AliFlatESDV0.h
HLT/global/AliFlatESDVertex.h
HLT/global/AliFlatExternalTrackParam.h
HLT/global/AliFlatTPCCluster.h
STEER/CMakelibSTEERBase.pkg
STEER/STEERBase/AliVVcluster.cxx [new file with mode: 0644]
STEER/STEERBase/AliVVcluster.h [new file with mode: 0644]
STEER/STEERBase/AliVVexternalTrackParam.cxx [new file with mode: 0644]
STEER/STEERBase/AliVVexternalTrackParam.h [new file with mode: 0644]
STEER/STEERBase/AliVVkink.h
STEER/STEERBase/AliVVv0.h
STEER/STEERBase/AliVVvertex.h
STEER/STEERBaseLinkDef.h

index ad29493..d0669a4 100644 (file)
@@ -72,6 +72,29 @@ AliFlatESDEvent::AliFlatESDEvent() :
 {
 }
 
+// _______________________________________________________________________________________________________
+AliFlatESDEvent::AliFlatESDEvent(Bool_t)
+{
+  //special constructor, used to restore the vtable pointer
+  //uses the special dummy constructors of contained objects
+  AliFlatESDVertex* vertexSPD = const_cast<AliFlatESDVertex*>(GetPrimaryVertexSPD());
+  if (vertexSPD ) { new (vertexSPD) AliFlatESDVertex(1); }
+  AliFlatESDVertex* vertexTracks = const_cast<AliFlatESDVertex*>(GetPrimaryVertexTracks());
+  if (vertexTracks ) { new (vertexTracks) AliFlatESDVertex(1); }
+  AliFlatESDTrack* track = GetTracks();
+  for (Int_t i=0; i<GetNumberOfTracks(); i++)
+  {
+    new (track) AliFlatESDTrack(1);
+    track += track->GetSize();
+  }
+  AliFlatESDV0* v0 = GetV0s();
+  for (Int_t i=0; i<GetNumberOfV0s(); i++)
+  {
+    new (v0) AliFlatESDV0(1);
+    v0 += sizeof(AliFlatESDV0);
+  }
+}
+
 /*
 AliFlatESDEvent::AliFlatESDEvent(const AliFlatESDEvent& ev) :
   // Default constructor
index 2a9035a..d11eed3 100644 (file)
@@ -28,14 +28,14 @@ class AliFlatESDEvent: public AliVVevent {
   // -- Constructor / Destructors
   AliFlatESDEvent();   
 
-// empty constructor, to be called by placement new,
+// special constructor, to be called by placement new,
 // when accessing information after reinterpret_cast
 // so that vtable is generated, but values are not overwritten
-       AliFlatESDEvent(Bool_t){}
+       AliFlatESDEvent(Bool_t);
 
   AliFlatESDEvent(AliESDEvent *esd);   
   AliFlatESDEvent(AliESDEvent *esd, Bool_t useESDFriends);   
-  ~AliFlatESDEvent();  
+  virtual ~AliFlatESDEvent();  
 
   // --------------------------------------------------------------------------------
   // -- Fill / Set methods
@@ -87,6 +87,10 @@ class AliFlatESDEvent: public AliVVevent {
 
   Int_t GetNumberOfTracks() const {return fNTracks;}
   
+  AliFlatESDV0* GetV0s() {
+  AliFlatESDV0* v = reinterpret_cast<AliFlatESDV0*> (fContent + fV0Pointer);
+  }
+
   AliFlatESDTrack *GetTracks() {
        return reinterpret_cast<AliFlatESDTrack*> (fContent + fTracksPointer);
 }
index f3f31b0..b21b36e 100644 (file)
@@ -56,6 +56,33 @@ AliFlatESDTrack::AliFlatESDTrack() :
 }
 
 // _______________________________________________________________________________________________________
+AliFlatESDTrack::AliFlatESDTrack(Bool_t)
+{
+  //special contructor
+  //use to restore the vtable pointer
+  
+  AliFlatExternalTrackParam* trackParam = GetTrackParamRefitted();
+  if (trackParam) { new (trackParam) AliFlatExternalTrackParam(1); }
+  trackParam = GetTrackParamIp();
+  if (trackParam) { new (trackParam) AliFlatExternalTrackParam(1); }
+  trackParam = GetTrackParamTPCInner();
+  if (trackParam) { new (trackParam) AliFlatExternalTrackParam(1); }
+  trackParam = GetTrackParamOp();
+  if (trackParam) { new (trackParam) AliFlatExternalTrackParam(1); }
+  trackParam = GetTrackParamCp();
+  if (trackParam) { new (trackParam) AliFlatExternalTrackParam(1); }
+  trackParam = GetTrackParamITSOut();
+  if (trackParam) { new (trackParam) AliFlatExternalTrackParam(1); }
+  
+  AliFlatTPCCluster* clusterTPC = GetTPCClusters();
+  for (Int_t i=0; i<GetNumberOfTPCClusters(); i++)
+  {
+    new (clusterTPC) AliFlatTPCCluster(1);
+    clusterTPC += sizeof(AliFlatTPCCluster);
+  }
+}
+
+// _______________________________________________________________________________________________________
 AliFlatESDTrack::AliFlatESDTrack(const AliESDtrack* track, AliESDfriendTrack* friendTrack) :
   // Constructor
   fTrackParamMask(0),
index 8fae1b5..255c318 100644 (file)
@@ -27,14 +27,13 @@ class AliESDfriendTrack;
 class AliExternalTrackParam;
 
 class AliFlatESDTrack: public AliVVtrack {
-//class AliFlatESDTrack {
  public:
   // --------------------------------------------------------------------------------
   // -- Constructor / Destructors
-  AliFlatESDTrack();   
-  AliFlatESDTrack(Bool_t){}   
+  AliFlatESDTrack();
+  AliFlatESDTrack(Bool_t);
   AliFlatESDTrack(const AliESDtrack* track, AliESDfriendTrack* friendTrack); 
-  ~AliFlatESDTrack();  
+  virtual ~AliFlatESDTrack();  
 
   // --------------------------------------------------------------------------------
   // -- Fill / Set methods
@@ -104,6 +103,10 @@ class AliFlatESDTrack: public AliVVtrack {
     return fNITSClusters;
   } 
   
+  AliFlatTPCCluster *GetITSClusters() {
+    return reinterpret_cast< AliFlatTPCCluster*>(fContent + sizeof(AliFlatExternalTrackParam)*CountBits(fTrackParamMask));
+  } 
+
   
   // --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  
   
@@ -143,4 +146,5 @@ class AliFlatESDTrack: public AliVVtrack {
   Byte_t fContent[1];                  // Variale size object, which contains all data
 
 };
+
 #endif
index 4bf76ec..67dc531 100644 (file)
 #include "Rtypes.h"
 #include "AliVVv0.h"
 
-struct AliFlatESDV0: public AliVVv0
-//struct AliFlatESDV0
+class AliFlatESDV0: public AliVVv0
 {
+  public:
   AliFlatESDV0(Bool_t){}
+  virtual ~AliFlatESDV0() {}
   Int_t fNegTrackID;
   Int_t fPosTrackID;
 };
 
-typedef struct AliFlatESDV0 AliFlatESDV0;
+//typedef struct AliFlatESDV0 AliFlatESDV0;
 
 #endif
index 6704490..8961b4b 100644 (file)
@@ -28,6 +28,7 @@ class AliFlatESDVertex: public AliVVvertex
   */
 
        AliFlatESDVertex(Bool_t){}
+  virtual ~AliFlatESDVertex() {}
 
   AliFlatESDVertex() :fNContributors(0), fChi2(0){
     for( int i=0; i<3; i++) fPosition[i] = -9999;
index 20745d0..4d54ab6 100644 (file)
  */
 
 #include "Rtypes.h"
+#include "AliVVexternalTrackParam.h"
 
-struct AliFlatExternalTrackParam
+class AliFlatExternalTrackParam: public AliVVexternalTrackParam
 {
+  public:
+  AliFlatExternalTrackParam(Bool_t) {}
+  virtual ~AliFlatExternalTrackParam() {}
   Float_t fAlpha;     // azimuthal angle of reference frame
   Float_t fX;         // x: radial distance
   Float_t fY;         // local Y-coordinate of a track (cm)
@@ -42,6 +46,6 @@ struct AliFlatExternalTrackParam
   Float_t  GetCovEntry(Int_t idx) const {return (idx >= 0 && idx < 15) ? fC[idx] : 0.;}
 };
 
-typedef struct AliFlatExternalTrackParam AliFlatExternalTrackParam;
+//typedef struct AliFlatExternalTrackParam AliFlatExternalTrackParam;
 
 #endif
index 9558013..941f8ba 100644 (file)
  */
 
 #include "Rtypes.h"
+#include "AliVVcluster.h"
 
-struct AliFlatTPCCluster
+class AliFlatTPCCluster: public AliVVcluster
 {
+  public:
+  AliFlatTPCCluster(Bool_t):AliVVcluster() {}
+  virtual ~AliFlatTPCCluster() {}
   Float_t fX;       // X coordinate in local coordinates
   Float_t fY;       // Y coordinate in local coordinates
   Float_t fZ;       // Z coordinate in local coordinates
@@ -22,6 +26,7 @@ struct AliFlatTPCCluster
   UInt_t  fCharge;  // total charge of cluster
   UInt_t  fQMax;    // QMax of cluster
 
+  public:
   void SetX(Float_t x)             {fX = x;}
   void SetY(Float_t y)             {fY = y;}
   void SetZ(Float_t z)             {fZ = z;}
@@ -51,6 +56,4 @@ struct AliFlatTPCCluster
   }
 };
 
-typedef struct AliFlatTPCCluster AliFlatTPCCluster;
-
 #endif
index 4dc5f75..e897eaf 100644 (file)
@@ -6,6 +6,8 @@ set ( SRCS
     STEERBase/AliVVvertex.cxx
     STEERBase/AliVVv0.cxx
     STEERBase/AliVVkink.cxx
+    STEERBase/AliVVcluster.cxx
+    STEERBase/AliVVexternalTrackParam.cxx
     STEERBase/AliVParticle.cxx 
     STEERBase/AliVTrack.cxx 
     STEERBase/AliEventplane.cxx 
diff --git a/STEER/STEERBase/AliVVcluster.cxx b/STEER/STEERBase/AliVVcluster.cxx
new file mode 100644 (file)
index 0000000..3f1f9ff
--- /dev/null
@@ -0,0 +1 @@
+#include "AliVVcluster.h"
diff --git a/STEER/STEERBase/AliVVcluster.h b/STEER/STEERBase/AliVVcluster.h
new file mode 100644 (file)
index 0000000..70345d6
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef ALIVVCLUSTER_H
+#define ALIVVCLUSTER_H
+
+#include "Rtypes.h"
+
+class AliVVcluster
+{
+  public:
+  AliVVcluster() {}
+  AliVVcluster(Bool_t) {}
+  virtual ~AliVVcluster() {}
+  virtual void SetX(Float_t /*x*/)             {}
+  virtual void SetY(Float_t /*y*/)             {}
+  virtual void SetZ(Float_t /*z*/)             {}
+  virtual void SetPadRow(Short_t /*padrow*/)   {}
+  virtual void SetSigmaY2(Float_t /*sigmaY2*/) {}
+  virtual void SetSigmaZ2(Float_t /*sigmaZ2*/) {}
+  virtual void SetCharge(UShort_t /*charge*/)  {}
+  virtual void SetQMax(UShort_t /*qmax*/)      {}
+
+  virtual Float_t  GetX()       const      {return 0.;}
+  virtual Float_t  GetY()       const      {return 0.;}
+  virtual Float_t  GetZ()       const      {return 0.;}
+  virtual UShort_t GetPadRow()  const      {return 0;}
+  virtual Float_t  GetSigmaY2() const      {return 0.;}
+  virtual Float_t  GetSigmaZ2() const      {return 0.;}
+  virtual UShort_t GetCharge()  const      {return 0;}
+  virtual UShort_t GetQMax()    const      {return 0;}
+};
+
+#endif
diff --git a/STEER/STEERBase/AliVVexternalTrackParam.cxx b/STEER/STEERBase/AliVVexternalTrackParam.cxx
new file mode 100644 (file)
index 0000000..c1e9a7f
--- /dev/null
@@ -0,0 +1 @@
+#include "AliVVexternalTrackParam.h"
diff --git a/STEER/STEERBase/AliVVexternalTrackParam.h b/STEER/STEERBase/AliVVexternalTrackParam.h
new file mode 100644 (file)
index 0000000..9b6604e
--- /dev/null
@@ -0,0 +1,40 @@
+#ifndef ALIVVEXTERNALTRACKPARAM_H
+#define ALIVVEXTERNALTRACKPARAM_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               *
+ * Primary Author: Mikolaj Krzewicki, mkrzewic@cern.ch     */
+
+/**
+ * >> interface class <<
+ */
+
+#include "Rtypes.h"
+
+class AliVVexternalTrackParam
+{
+  public:
+  AliVVexternalTrackParam() {}
+  AliVVexternalTrackParam(Bool_t) {}
+  virtual ~AliVVexternalTrackParam() {}
+  virtual void SetAlpha(Float_t /*alpha*/)                 {}
+  virtual void SetX(Float_t /*x*/)                         {}
+  virtual void SetY(Float_t /*y*/)                         {}
+  virtual void SetZ(Float_t /*z*/)                         {}
+  virtual void SetSnp(Float_t /*snp*/)                     {}
+  virtual void SetTgl(Float_t /*tgl*/)                     {}
+  virtual void SetSigned1Pt(Float_t /*signed1Pt*/)         {}
+  virtual void SetCovEntry(Int_t /*idx*/, Float_t /*cov*/) {}
+
+  virtual Float_t  GetAlpha()             const {return 0.;}
+  virtual Float_t  GetX()                 const {return 0.;}
+  virtual Float_t  GetY()                 const {return 0.;}
+  virtual Float_t  GetZ()                 const {return 0.;}
+  virtual Float_t  GetSnp()               const {return 0.;}
+  virtual Float_t  GetTgl()               const {return 0.;}
+  virtual Float_t  GetSigned1Pt()         const {return 0.;}
+  virtual Float_t* GetCov()               const {return NULL;}
+  virtual Float_t  GetCovEntry(Int_t /*idx*/) const {return 0.;}
+};
+
+#endif
index 4eb4e85..a85ff05 100644 (file)
@@ -11,8 +11,9 @@
 
 class AliVVkink
 {
-       public:
+  public:
   virtual ~AliVVkink() {}
+
   //  ClassDef(AliVVkink, 0)  // base class for kink data
 
 };
index 6415cb3..83e9679 100644 (file)
 
 class AliVVv0: public AliVVtrack
 {
-
+  public:
+  AliVVv0() {}
+  AliVVv0(Bool_t) {}
+  virtual ~AliVVv0() {}
   ClassDef(AliVVv0,1)  // base class for v0 data
 };
 
index 6f7faa7..7d29fd4 100644 (file)
@@ -14,17 +14,18 @@ class AliVVvertex
 {
   public:
   AliVVvertex() {} 
+  AliVVvertex(Bool_t) {} 
   virtual ~AliVVvertex() {}
   virtual Double_t GetX() const { return 0; }
   virtual Double_t GetY() const { return 0; }
   virtual Double_t GetZ() const { return 0; }
-  virtual void GetXYZ(Double_t pos[3]) const {if (pos[0]<0) return;}
-  virtual void     GetCovarianceMatrix(Double_t /*covmatrix*/[6]) const { return ; }
+  virtual void GetXYZ(Double_t pos[3]) const { if (pos[0]) return; }
+  virtual void     GetCovarianceMatrix(Double_t covmatrix[6]) const {if (covmatrix[0]) return;}
   virtual Double_t GetChi2perNDF() const { return 0; }
   virtual Double_t GetChi2() const { return 0; }
   virtual Int_t    GetNDF() const{ return 0; }
   virtual void     PrintIndices() const { return ; }
-  virtual void     Print(Option_t* /*option = ""*/) const { return ; }
+  virtual void     Print(Option_t* /*option = ""*/) const {}
   virtual Int_t    GetBC() const{ return 0; }
   virtual void Clear(Option_t* /*option*/) { return ; }
   virtual Int_t    GetNContributors() const { return 0; }
index aac694b..21d7e0f 100644 (file)
 #pragma link C++ class AliVVevent+;
 #pragma link C++ class AliVVkink+;
 #pragma link C++ class AliVVv0+;
+#pragma link C++ class AliVVcluster+;
+#pragma link C++ class AliVVexternalTrackParam+;
 
 #endif