]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDcluster.cxx
Protection in case of fITune >= 0 in kPyJets
[u/mrichter/AliRoot.git] / TRD / AliTRDcluster.cxx
index e248340a7de8d6aeae721266be37ccc3f16a519d..c0f5b71ea4de3693651ce30906e8a8e9367d4098 100644 (file)
@@ -86,8 +86,8 @@ AliTRDcluster::AliTRDcluster(Int_t det, UChar_t col, UChar_t row, UChar_t time
 
 //___________________________________________________________________________
 AliTRDcluster::AliTRDcluster(Int_t det, Float_t q
-                           , Float_t *pos, Float_t *sig
-                           , Int_t *tracks, Char_t npads, Short_t * const signals
+                           , const Float_t *pos, const Float_t *sig
+                           , const Int_t *tracks, Char_t npads, Short_t * const signals
                            , UChar_t col, UChar_t row, UChar_t time
                            , Char_t timebin, Float_t center, UShort_t volid)
   :AliCluster(volid,pos[0],pos[1],pos[2],sig[0],sig[1],0.0,0x0) 
@@ -131,6 +131,11 @@ AliTRDcluster::AliTRDcluster(const AliTRDtrackletWord *const tracklet, Int_t det
   //
   // Constructor from online tracklet 
   //
+
+  for (Int_t i = 0; i < 7; i++) {
+    fSignals[i] = 0;
+  }
+
 }
 
 //_____________________________________________________________________________
@@ -170,15 +175,40 @@ AliTRDcluster &AliTRDcluster::operator=(const AliTRDcluster &c)
 {
   //
   // Assignment operator
-  // 
+  //
 
-  if (this != &c) {
-    ((AliTRDcluster &) c).Copy(*this);
+  if (&c == this) {
+     return *this;
+  }
+
+  // Call the assignment operator of the base class
+  AliCluster::operator=(c);
+
+  fPadCol         = c.fPadCol;
+  fPadRow         = c.fPadRow;
+  fPadTime        = c.fPadTime;
+  fLocalTimeBin   = c.fLocalTimeBin;
+  fNPads          = c.fNPads;
+  fClusterMasking = c.fClusterMasking;
+  fDetector       = c.fDetector;
+  fQ              = c.fQ;
+  fCenter         = c.fCenter;
+
+  SetLabel(c.GetLabel(0),0);
+  SetLabel(c.GetLabel(1),1);
+  SetLabel(c.GetLabel(2),2);
+
+  SetY(c.GetY());
+  SetZ(c.GetZ());
+  SetSigmaZ2(c.GetSigmaZ2());
+
+  for (Int_t i = 0; i < 7; i++) {
+    fSignals[i] = c.fSignals[i];
   }
 
   return *this;
 
-}
+} 
 
 //_____________________________________________________________________________
 void AliTRDcluster::AddTrackIndex(const Int_t * const track)
@@ -328,7 +358,7 @@ Double_t AliTRDcluster::GetSX(Int_t tb, Double_t z)
   //
 
   if(tb<1 || tb>=24) return 10.; // return huge [10cm]
-  const Double_t sx[24][10]={
+  static const Double_t sx[24][10]={
     {0.000e+00, 9.352e-01, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 2.309e+00},
     {8.387e-02, 8.718e-02, 8.816e-02, 9.444e-02, 9.993e-02, 1.083e-01, 1.161e-01, 1.280e-01, 1.417e-01, 1.406e-01},
     {1.097e-01, 1.105e-01, 1.127e-01, 1.151e-01, 1.186e-01, 1.223e-01, 1.272e-01, 1.323e-01, 1.389e-01, 1.490e-01},
@@ -390,7 +420,7 @@ Double_t AliTRDcluster::GetSYdrift(Int_t tb, Int_t ly, Double_t/* z*/)
   //
 
   if(tb<1 || tb>=24) return 10.; // return huge [10cm]
-  const Float_t lSy[6][24] = {
+  static const Float_t lSy[6][24] = {
     {75.7561, 0.0325, 0.0175, 0.0174, 0.0206, 0.0232,
      0.0253, 0.0262, 0.0265, 0.0264, 0.0266, 0.0257,
      0.0258, 0.0261, 0.0259, 0.0253, 0.0257, 0.0261,
@@ -539,7 +569,7 @@ Double_t AliTRDcluster::GetXcorr(Int_t tb, Double_t z)
 
   if(tb<0 || tb>=24) return 0.;
   const Int_t nd = 5;
-  const Double_t dx[24][nd]={
+  static const Double_t dx[24][nd]={
     {+1.747e-01,+3.195e-01,+1.641e-01,+1.607e-01,+6.002e-01},
     {+5.468e-02,+5.760e-02,+6.365e-02,+8.003e-02,+1.067e-01},
     {-6.327e-02,-6.339e-02,-6.423e-02,-6.900e-02,-7.949e-02},
@@ -607,7 +637,7 @@ Double_t AliTRDcluster::GetYcorr(Int_t ly, Float_t y)
   //End_Html
   //
 
-  const Float_t cy[AliTRDgeometry::kNlayer][3] = {
+  static const Float_t cy[AliTRDgeometry::kNlayer][3] = {
     { 4.014e-04, 8.605e-03, -6.880e+00},
     {-3.061e-04, 9.663e-03, -6.789e+00},
     { 1.124e-03, 1.105e-02, -6.825e+00},
@@ -682,32 +712,10 @@ Float_t AliTRDcluster::GetXloc(Double_t t0, Double_t vd
   td -= 0.189;
 
   // apply fitted correction 
-  Float_t x = td*vd + GetXcorr(fLocalTimeBin);
+  Float_t x = td*vd + (HasXcorr() ? GetXcorr(fLocalTimeBin) : 0.);
   if(x>0.&&x<.5*AliTRDgeometry::CamHght()+AliTRDgeometry::CdrHght()) SetInChamber();
 
   return x;
-
-/*
-  // calculate radial posion of clusters in the drift region
-
-  // invert drift time function
-  Double_t xM= AliTRDgeometry::CamHght()+AliTRDgeometry::CdrHght(),
-           x = vd*td + .5*AliTRDgeometry::CamHght(), 
-           t = cp->TimeStruct(vd, x, z), dx1=0.,dx2;
-  while(TMath::Abs(td-t)>1.e-4){ // convergence on 100ps
-    dx2 = vd*(td-t);
-    if(TMath::Abs(TMath::Abs(dx2)-TMath::Abs(dx1))<1.e-6){
-      x+=.5*dx2;
-      break;
-    } else x+=dx2;
-
-    if(x<0. || x>xM) return 0.;
-    t = cp->TimeStruct(vd, x, z);
-    dx1 = dx2;
-  }
-
-  return x-.5*AliTRDgeometry::CamHght();
-*/
 }
 
 //_____________________________________________________________________________
@@ -800,6 +808,8 @@ void AliTRDcluster::SetSigmaY2(Float_t s2, Float_t dt, Float_t exb, Float_t x, F
   }
 
   // store tg^2(phi-a_L) and tg^2(a_L)
+  // limit parametrization to a maximum angle of 25 deg
+  if(TMath::Abs(tgp)>0.466) tgp = (tgp>0.)?0.466:-0.466;
   Double_t tgg = (tgp-exb)/(1.+tgp*exb); tgg *= tgg;
   Double_t exb2= exb*exb;
 
@@ -851,21 +861,34 @@ void AliTRDcluster::Print(Option_t *o) const
   // Print cluster information
   //
 
-  AliInfo(Form("Det[%3d] LTrC[%+6.2f %+6.2f %+6.2f] Q[%5.1f] FLAG[in(%c) use(%c) sh(%c)] Y[%s]", 
+  if(strcmp(o, "a")==0) {
+    Char_t mcInfo[100]; if(IsMCcluster()) snprintf(mcInfo, 100, "\n         MC[%5d %5d %5d]", GetLabel(0), GetLabel(1), GetLabel(2));
+    AliInfo(Form(
+    "\nDet[%3d] LTrC[%+6.2f %+6.2f %+6.2f] Q[%6.2f] Qr[%4d] FLAG[in(%c) use(%c) sh(%c)] Y[%s]"
+    "\n         LChC[c(%3d) r(%2d) t(%2d)] t-t0[%2d] Npad[%d] cen[%5.3f] mask[%d]"
+    "\n         QS[%s][%3d %3d %3d %3d %3d %3d %3d]"
+    "\n         S2Y[%e] S2Z[%e]"
+    "%s"
+    , fDetector, GetX(), GetY(), GetZ(), fQ, GetRawQ(),  
+    IsInChamber() ? 'y' : 'n', 
+    IsUsed() ? 'y' : 'n', 
+    IsShared() ? 'y' : 'n',
+    IsRPhiMethod(kGAUS)?"GAUS":(IsRPhiMethod(kLUT)?"LUT":"COG")
+    , fPadCol, fPadRow, fPadTime, fLocalTimeBin, fNPads, fCenter, fClusterMasking
+    , TestBit(kRawSignals)?"raw":"cal", fSignals[0], fSignals[1], fSignals[2], fSignals[3]
+    , fSignals[4], fSignals[5], fSignals[6]
+    , GetSigmaY2(), GetSigmaZ2()
+    , IsMCcluster()?mcInfo:""
+    ));
+  } else { 
+    AliInfo(Form("Det[%3d] LTrC[%+6.2f %+6.2f %+6.2f] Q[%6.2f] FLAG[in(%c) use(%c) sh(%c)] Y[%s]",
     fDetector, GetX(), GetY(), GetZ(), fQ, 
     IsInChamber() ? 'y' : 'n', 
     IsUsed() ? 'y' : 'n', 
     IsShared() ? 'y' : 'n',
     IsRPhiMethod(kGAUS)?"GAUS":(IsRPhiMethod(kLUT)?"LUT":"COG")
-  ));
-
-  if(strcmp(o, "a")!=0) return;
-  AliInfo(Form("LChC[c(%3d) r(%2d) t(%2d)] t-t0[%2d] Npad[%d] cen[%5.3f] mask[%d]"
-             , fPadCol, fPadRow, fPadTime, fLocalTimeBin, fNPads, fCenter, fClusterMasking)); 
-  AliInfo(Form("Signals[%3d %3d %3d %3d %3d %3d %3d]"
-             , fSignals[0], fSignals[1], fSignals[2], fSignals[3]
-             , fSignals[4], fSignals[5], fSignals[6]));
-
+    ));
+  }
 }
 
 //_____________________________________________________________________________