Coverity fixed
authorgvolpe <gvolpe@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 14 Dec 2011 15:54:43 +0000 (15:54 +0000)
committergvolpe <gvolpe@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 14 Dec 2011 15:54:43 +0000 (15:54 +0000)
HMPID/AliHMPIDDigit.h
HMPID/AliHMPIDHit.h
HMPID/AliHMPIDRecoParam.cxx
HMPID/AliHMPIDRecoParamV1.cxx
HMPID/AliHMPIDReconHTA.cxx

index 6b7f300..3beda52 100644 (file)
@@ -23,11 +23,45 @@ class AliHMPIDDigit :public AliDigit //TObject-AliDigit-AliHMPIDDigit
 public:
     
 //ctor&dtor    
-  AliHMPIDDigit(                          ):AliDigit( ),fPad(AliHMPIDParam::Abs(-1,-1,-1,-1)),fQ(-1)  {}                         //default ctor
-  AliHMPIDDigit(Int_t pad,Int_t q,Int_t *t):AliDigit(t),fPad(pad             ),fQ(q )  {if(fQ>4095)fQ=4095;}                     //digit ctor
-  AliHMPIDDigit(Int_t pad,Int_t q         ):AliDigit( ),fPad(pad             ),fQ(q )  {if(fQ>4095)fQ=4095;}                     //digit ctor
-  AliHMPIDDigit(const AliHMPIDDigit &d    ):AliDigit(d),fPad(d.fPad),fQ(d.fQ)          {}                                        //copy ctor
-  virtual ~AliHMPIDDigit()                                                             {}                         //dtor   
+AliHMPIDDigit():
+    AliDigit( ),
+    fPad(AliHMPIDParam::Abs(-1,-1,-1,-1)),
+    fQ(-1)  
+    {}                                       //default ctor
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+AliHMPIDDigit(Int_t pad,Int_t q,Int_t *t):
+  AliDigit(t),
+  fPad(pad),
+  fQ(q)  
+  {if(fQ>4095) fQ=4095;}                     //digit ctor
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
+AliHMPIDDigit(Int_t pad,Int_t q):
+  AliDigit( ),
+  fPad(pad),
+  fQ(q )  
+  {if(fQ>4095) fQ=4095;}                     //digit ctor
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+AliHMPIDDigit& operator=(const AliHMPIDDigit& d)
+{
+  //
+  // Assignment operator
+  //
+  if(this!=&d){
+    AliDigit::operator=(d); 
+    fPad = d.fPad; 
+    fQ   = d.fQ;
+  }
+  return *this;                           
+}                                            
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+AliHMPIDDigit(const AliHMPIDDigit &d):
+  AliDigit(d),
+  fPad(d.fPad),
+  fQ(d.fQ)         
+  {}                                        //copy ctor
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
+virtual ~AliHMPIDDigit()  {}                //dtor
+   
 //framework part    
          Bool_t  IsSortable  (                               )const{return kTRUE;}                                                     //provision to use TObject::Sort() 
   inline Int_t   Compare     (const TObject *pObj            )const;                                                                   //provision to use TObject::Sort()
index a87b016..1544cac 100644 (file)
 class AliHMPIDHit : public AliHit //   TObject-AliHit-AliHMPIDHit
 {
 public:
-  AliHMPIDHit(                                                                           ):AliHit(     ),fCh(-1),fPid(-1 ),fQ(-1),fLx(0),fLy(0),fT(0) {} //default ctor
-  AliHMPIDHit(Int_t c,Float_t &e,Int_t pid,Int_t tid,Float_t x,Float_t y, Float_t time, const TVector3 &p):AliHit(0,tid),fCh(c ),fPid(pid),fQ(0 ),fLx(x),fLy(y),fT(time) {e=QdcTot(e,time);fX=p.X();fY=p.Y();fZ=p.Z();}
-  AliHMPIDHit(Int_t c,Float_t &e,Int_t pid,Int_t tid,Float_t x,Float_t y, Float_t time                 ):AliHit(     ),fCh(c ),fPid(pid),fQ(0 ),fLx(x),fLy(y),fT(time){e=QdcTot(e,time);fTrack=tid;}//manual ctor 
-  AliHMPIDHit(const AliHMPIDHit &h):AliHit(h),fCh(h.fCh),fPid(h.fPid),fQ(h.fQ),fLx(h.fLx),fLy(h.fLy),fT(h.fT) {}//copy ctor
-  virtual ~AliHMPIDHit()                                                                                                                                 {}
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
+AliHMPIDHit():
+    AliHit(),
+    fCh(-1),
+    fPid(-1),
+    fQ(-1),
+    fLx(0),
+    fLy(0),
+    fT(0) 
+    {} //default ctor
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
+AliHMPIDHit(Int_t c,Float_t &e,Int_t pid,Int_t tid,Float_t x,Float_t y, Float_t time, const TVector3 &p):
+  AliHit(0,tid),
+  fCh(c),
+  fPid(pid),
+  fQ(0 ),
+  fLx(x),
+  fLy(y),
+  fT(time) 
+  {e=QdcTot(e,time);fX=p.X();fY=p.Y();fZ=p.Z();}
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
+AliHMPIDHit(Int_t c,Float_t &e,Int_t pid,Int_t tid,Float_t x,Float_t y, Float_t time):
+  AliHit(),
+  fCh(c),
+  fPid(pid),
+  fQ(0),
+  fLx(x),
+  fLy(y),
+  fT(time)
+  {e=QdcTot(e,time);fTrack=tid;}//manual ctor
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+AliHMPIDHit& operator=(const AliHMPIDHit& h)
+{
+  //
+  // Assignment operator
+  //
+  if(this!=&h){
+    AliHit::operator=(h);
+    fCh = h.fCh;
+    fPid = h.fPid;
+    fQ = h.fQ;
+    fLx = h.fLx;
+    fLy = h.fLy;
+    fT = h.fT;
+  }
+  return *this;    
+}    
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     
+AliHMPIDHit(const AliHMPIDHit &h):
+  AliHit(h),
+  fCh(h.fCh),
+  fPid(h.fPid),
+  fQ(h.fQ),
+  fLx(h.fLx),
+  fLy(h.fLy),
+  fT(h.fT) 
+  {}//copy ctor
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
+virtual ~AliHMPIDHit()       {}
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++   
 //framework part
          void    Print(Option_t *opt="")const;                                                    //from TObject to print current status
          void    Draw (Option_t *opt="");                                                         //from TObject to Draw this hit
index 6b6a9db..b30965b 100644 (file)
@@ -60,12 +60,14 @@ AliHMPIDRecoParam& AliHMPIDRecoParam::operator=(const AliHMPIDRecoParam &p)
 //
 // assign. operator
 //
-  AliDetectorRecoParam::operator=(p);
-  this->fHmpRecoMode= p.fHmpRecoMode;
-  this->fHmpFixedDistCut=p.fHmpFixedDistCut;
-  for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++) this->fHmpUserCut[iCh] = p.fHmpUserCut[iCh];   
-  this->fHmpTrackMatchingDist=p.fHmpTrackMatchingDist;
-  for(Int_t iPol=0;iPol<5;iPol++) this->fHmpTrackMatchingDistParas[iPol]=p.fHmpTrackMatchingDistParas[iPol];
+  if(this!=&p){
+    AliDetectorRecoParam::operator=(p);
+    this->fHmpRecoMode= p.fHmpRecoMode;
+    this->fHmpFixedDistCut=p.fHmpFixedDistCut;
+    for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++) this->fHmpUserCut[iCh] = p.fHmpUserCut[iCh];   
+    this->fHmpTrackMatchingDist=p.fHmpTrackMatchingDist;
+    for(Int_t iPol=0;iPol<5;iPol++) this->fHmpTrackMatchingDistParas[iPol]=p.fHmpTrackMatchingDistParas[iPol];
+  }
   return *this;
 }
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
index 51e4061..0fed53a 100644 (file)
@@ -59,13 +59,14 @@ AliHMPIDRecoParamV1& AliHMPIDRecoParamV1::operator=(const AliHMPIDRecoParamV1 &p
 {
 //
 // assign. operator
-//
-  AliDetectorRecoParam::operator=(p);
-  this->fHmpRecoMode= p.fHmpRecoMode;
-  this->fHmpFixedDistCut=p.fHmpFixedDistCut;
-  for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++) this->fHmpUserCut[iCh] = p.fHmpUserCut[iCh];   
-  this->fHmpTrackMatchingDist=p.fHmpTrackMatchingDist;
-  for(Int_t iPol=0;iPol<5;iPol++) this->fHmpTrackMatchingDistParas[iPol]=p.fHmpTrackMatchingDistParas[iPol];
+  if(this!=&p){
+    AliDetectorRecoParam::operator=(p);
+    this->fHmpRecoMode= p.fHmpRecoMode;
+    this->fHmpFixedDistCut=p.fHmpFixedDistCut;
+    for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++) this->fHmpUserCut[iCh] = p.fHmpUserCut[iCh];   
+    this->fHmpTrackMatchingDist=p.fHmpTrackMatchingDist;
+    for(Int_t iPol=0;iPol<5;iPol++) this->fHmpTrackMatchingDistParas[iPol]=p.fHmpTrackMatchingDistParas[iPol];
+  }
   return *this;
 }
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
index 6ba7dc1..804ae72 100644 (file)
@@ -255,9 +255,10 @@ Bool_t AliHMPIDReconHTA::FindShape(Double_t &thTrkRec,Double_t &phiTrkRec,Double
     dMean2+=dist[indphi[i]]*dist[indphi[i]];
     np++;
   }
-  
-  dMean  /=(Double_t)np;
-  dMean2 /=(Double_t)np;
+  if(np>0){    
+   dMean  /=(Double_t)np;
+   dMean2 /=(Double_t)np;}
   Double_t rms = TMath::Sqrt(dMean2 - dMean*dMean);
   
   for(Int_t i=0;i<fNClu;i++) {
@@ -755,8 +756,10 @@ Double_t AliHMPIDReconHTA::FindSimmPhi()
   
   //_____calc. met min quadr using effective distance _________________________________________________
   
-  coeff2ord = xy-xrotsumm*yrotsumm/np;    
-  coeff1ord = yrotsumm*yrotsumm/np - xrotsumm*xrotsumm/np - yy + xx;
+  if(np>0){ 
+    coeff2ord = xy-xrotsumm*yrotsumm/np;    
+    coeff1ord = yrotsumm*yrotsumm/np - xrotsumm*xrotsumm/np - yy + xx;
+  }
   coeff0ord = -coeff2ord;
   
   AliDebug(1,Form(" a = %f b = %f c = %f",coeff2ord,coeff1ord,coeff0ord));
@@ -767,8 +770,9 @@ Double_t AliHMPIDReconHTA::FindSimmPhi()
   
   r2(coeff,m1,m2);
   
-  n1=(yrotsumm-m1*xrotsumm)/np;                         
-  n2=(yrotsumm-m2*xrotsumm)/np;
+  if(np>0){ 
+    n1=(yrotsumm-m1*xrotsumm)/np;                         
+    n2=(yrotsumm-m2*xrotsumm)/np;}
   // 2 solutions.................
   
   // negative angles solved...