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 ad29493bee8d866802b9ee222ab98379f1e5f342..d0669a43c80276db4c5f3d15beb133b2e4ef596f 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 2a9035a806acc57f2e2b274552951b50766249ab..d11eed3958872648bffd43468ca9d9933c01b2af 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 f3f31b0759260fd20a623469b8ad05d1c2b9894d..b21b36eb90df66db1b70284e8d62fcb08b57b0ec 100644 (file)
@@ -55,6 +55,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
index 8fae1b525c5c0b458af3f944d4fbce7e0cc105c0..255c318d76f52dcfb4f48bd62a60405a19d5e900 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 4bf76eca9b05148d869b39e55994903cc690fe4c..67dc531ca54688e5ab10d5c29b062d6f18077e68 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 67044909e5987296f77bffeafecf0405767a18bf..8961b4bfae93687ea32022cac5ba52915bf4a214 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 20745d06c392db64ad786dd95a85b0c914a6890d..4d54ab6e3dcf9424210c2fcfc02f1f17c3239ebf 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 95580136fcd50853d6c461bcf0e76f7cabd22993..941f8ba8ab4205f2ce00ab048b566528117dea6d 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 4dc5f75219b7fcac3dae84ada23c5f66d5869dfd..e897eaf8d102a167bcb6024fbade42450ca99691 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 4eb4e85f91ea337fe0f0f3551ad30e5d194c4b12..a85ff05abc7dba0d195cd3c5e4cfeb392f97ec52 100644 (file)
@@ -11,8 +11,9 @@
 
 class AliVVkink
 {
-       public:
+  public:
   virtual ~AliVVkink() {}
+
   //  ClassDef(AliVVkink, 0)  // base class for kink data
 
 };
index 6415cb32d0ef64d64e283f13748f86911473963f..83e96799fbb702da4a8dee540a35e9888d390d5b 100644 (file)
 
 class AliVVv0: public AliVVtrack
 {
-
+  public:
+  AliVVv0() {}
+  AliVVv0(Bool_t) {}
+  virtual ~AliVVv0() {}
   ClassDef(AliVVv0,1)  // base class for v0 data
 };
 
index 6f7faa7faf67b21e9aedeec0d498d41cc2663251..7d29fd4976c6248d6bd3efce8d9e3b0876021f5d 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 aac694b53375a1c25208a7cdcdaa75b346d88786..21d7e0f9cbdf93c769805296a2d139a65d2d43f5 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