adding contructors and assignment operator for better usability; removing deprecated...
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 25 Nov 2011 09:37:45 +0000 (09:37 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 25 Nov 2011 09:37:45 +0000 (09:37 +0000)
HLT/TPCLib/AliHLTTPCRawCluster.h

index 8ee8dc2..8bab1f6 100644 (file)
  * @ingroup alihlt_tpc_datastructs
  */
 struct AliHLTTPCRawCluster {
-  /* UInt_t fP0;       // First  4 bytes of the packed data */
-  /* UInt_t fP1;       // Second 4 bytes of the packed data */
-  /* UInt_t fP2;       // Third  4 bytes of the packed data */
-  /* UInt_t fP3;       // Last   4 bytes of the packed data */
+  AliHLTTPCRawCluster()
+    : fPadRow(0)
+    , fPad(0.)
+    , fTime(0.)
+    , fSigmaY2(0.)
+    , fSigmaZ2(0.)
+    , fCharge(0)
+    , fQMax(0)
+  {}
+
+  AliHLTTPCRawCluster(short PadRow,
+                     float Pad,
+                     float Time,
+                     float SigmaY2,
+                     float SigmaZ2,
+                     unsigned short Charge,
+                     unsigned short QMax
+                     )
+    : fPadRow(PadRow)
+    , fPad(Pad)
+    , fTime(Time)
+    , fSigmaY2(SigmaY2)
+    , fSigmaZ2(SigmaZ2)
+    , fCharge(Charge)
+    , fQMax(QMax)
+  {}
+
+  AliHLTTPCRawCluster(const AliHLTTPCRawCluster& other)
+    : fPadRow(other.fPadRow)
+    , fPad(other.fPad)
+    , fTime(other.fTime)
+    , fSigmaY2(other.fSigmaY2)
+    , fSigmaZ2(other.fSigmaZ2)
+    , fCharge(other.fCharge)
+    , fQMax(other.fQMax)
+  {}
+
+  AliHLTTPCRawCluster& operator=(const AliHLTTPCRawCluster& other) {
+    if (this==&other) return *this;
+    this->~AliHLTTPCRawCluster();
+    new (this) AliHLTTPCRawCluster(other);
+    return *this;
+  }
+
+  void Clear() {
+    this->~AliHLTTPCRawCluster();
+    new (this) AliHLTTPCRawCluster;
+  }
+
   short fPadRow;
   float fPad;
   float fTime;
@@ -38,34 +83,6 @@ struct AliHLTTPCRawCluster {
   void SetSigmaZ2(Float_t sigmaZ2) {fSigmaZ2=sigmaZ2;}
   void SetCharge(UShort_t charge)  {fCharge=charge;}
   void SetQMax(UShort_t qmax)    {fQMax=qmax;}
-
-  /* Int_t GetPadRow()    const {return        (fP0>>24) &     0xff;} */
-  /* Float_t GetPad()     const {return (float( fP0      & 0xffffff)-8388608.)*1.e-4;} */
-  /* Float_t GetTime()    const {return (float( fP1      & 0xffffff)-8388608.)*1.e-4;} */
-  /* Float_t GetSigmaY2() const {return (float( fP2      &   0xffff)-32768.)*1.e-4;} */
-  /* Float_t GetSigmaZ2() const {return (float((fP2>>16) &   0xffff)-32768.)*1.e-4;} */
-  /* Int_t   GetCharge()  const {return         fP3      &  0xfffff;} */
-  /* Int_t   GetQMax()    const {return        (fP3>>20) &    0x3ff;} */
-
-  /* void SetPadRow(Int_t padrow)       { fP0&=0x00ffffff; fP0|=(padrow & 0xff)<<24;} */
-  /* void SetPad(Float_t pad)         { fP0&=0xff000000; float v=pad*1.e4+8388608.; */
-  /*                                       if( v<0 ) v=0; else if( v>0x00FFFFFF ) v=0x00FFFFFF; */
-  /*                                   UInt_t iv=(UInt_t) v; fP0|=iv; */
-  /* } */
-  /* void SetTime(Float_t time)       { fP1&=0xff000000; float v=time*1.e4+8388608.; */
-  /*                                       if( v<0 ) v=0; else if( v>0x00FFFFFF ) v=0x00FFFFFF; */
-  /*                                   UInt_t iv=(UInt_t) v; fP1|=iv; */
-  /* } */
-  /* void SetSigmaY2(Float_t sigmaY2) { fP2&=0xffff0000; float v=sigmaY2*1.e4+32768.; */
-  /*                                       if( v<0 ) v=0; else if( v>0x0000FFFF ) v=0x0000FFFF; */
-  /*                                   UInt_t iv=(UInt_t) v; fP2|=iv; */
-  /* } */
-  /* void SetSigmaZ2(Float_t sigmaZ2) { fP2&=0x0000ffff; float v=sigmaZ2*1.e4+32768.; */
-  /*                                       if( v<0 ) v=0; else if( v>0x0000FFFF ) v=0x0000FFFF; */
-  /*                                   UInt_t iv=(UInt_t) v; fP2|=iv<<16; */
-  /* } */
-  /* void SetCharge(Int_t charge)     { fP3&=0xfff00000; fP3|=charge&0xfffff;} */
-  /* void SetQMax(Int_t qmax)         { fP3&=0x000fffff; fP3|=(qmax&0x3ff)<<20;} */
 };
 typedef struct AliHLTTPCRawCluster AliHLTTPCRawCluster;