Introduced better way to estimate number of clusters in TRD for offline
authorabercuci <abercuci@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 2 Oct 2008 10:50:50 +0000 (10:50 +0000)
committerabercuci <abercuci@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 2 Oct 2008 10:50:50 +0000 (10:50 +0000)
and HLT

TRD/AliTRDclusterizer.cxx
TRD/AliTRDrecoParam.cxx
TRD/AliTRDrecoParam.h
TRD/AliTRDtrackerV1.cxx

index 1d3af61..0f1be15 100644 (file)
@@ -1379,7 +1379,11 @@ TClonesArray *AliTRDclusterizer::RecPoints()
 
   if (!fRecPoints) {
     if(!(fRecPoints = AliTRDReconstructor::GetClusters())){
-      fRecPoints = new TClonesArray("AliTRDcluster", 400);
+      // determine number of clusters which has to be allocated
+      Float_t nclusters = fReconstructor->GetRecoParam()->GetNClusters();
+      if(fReconstructor->IsHLT()) nclusters /= AliTRDgeometry::kNsector;
+
+      fRecPoints = new TClonesArray("AliTRDcluster", Int_t(nclusters));
     }
     //SetClustersOwner(kTRUE);
     AliTRDReconstructor::SetClusters(0x0);
index 885c4e9..c6ad475 100644 (file)
@@ -33,6 +33,7 @@ ClassImp(AliTRDrecoParam)
 //______________________________________________________________
 AliTRDrecoParam::AliTRDrecoParam()
   :AliDetectorRecoParam()
+  ,fkdNchdy(12.)
   ,fkMaxTheta(1.0)     
   ,fkMaxPhi(2.0) 
   ,fkRoad0y(6.0)
@@ -48,8 +49,10 @@ AliTRDrecoParam::AliTRDrecoParam()
   ,fkChi2YCut(7.73)
   ,fkChi2ZCut(0.069)
   ,fkPhiCut(10.6)
-  ,fkMeanNclusters(72)
-  ,fkSigmaNclusters(5.2632)
+  ,fkNMeanClusters(20.)
+  ,fkNSigmaClusters(2.)
+  ,fkNClusterNoise(0.)
+  ,fkNMeanTracklets(5.5)
   ,fkTrackLikelihood(-15.)
   ,fMinMaxCutSigma(4.)
   ,fMinLeftRightCutSigma(8.)
@@ -80,6 +83,7 @@ AliTRDrecoParam::AliTRDrecoParam()
 //______________________________________________________________
 AliTRDrecoParam::AliTRDrecoParam(const AliTRDrecoParam &ref)
   :AliDetectorRecoParam(ref)
+  ,fkdNchdy(ref.fkdNchdy)
   ,fkMaxTheta(ref.fkMaxTheta)
   ,fkMaxPhi(ref.fkMaxPhi)
   ,fkRoad0y(ref.fkRoad0y)
@@ -95,8 +99,10 @@ AliTRDrecoParam::AliTRDrecoParam(const AliTRDrecoParam &ref)
   ,fkChi2YCut(ref.fkChi2YCut)
   ,fkChi2ZCut(ref.fkChi2ZCut)
   ,fkPhiCut(ref.fkPhiCut)
-  ,fkMeanNclusters(ref.fkMeanNclusters)
-  ,fkSigmaNclusters(ref.fkSigmaNclusters)
+  ,fkNMeanClusters(ref.fkNMeanClusters)
+  ,fkNSigmaClusters(ref.fkNSigmaClusters)
+  ,fkNClusterNoise(ref.fkNClusterNoise)
+  ,fkNMeanTracklets(ref.fkNMeanTracklets)
   ,fkTrackLikelihood(ref.fkTrackLikelihood)
   ,fMinMaxCutSigma(ref.fMinMaxCutSigma)
   ,fMinLeftRightCutSigma(ref.fMinLeftRightCutSigma)
@@ -126,7 +132,9 @@ AliTRDrecoParam *AliTRDrecoParam::GetLowFluxParam()
   // Parameters for the low flux environment
   //
 
-  return new AliTRDrecoParam();
+  AliTRDrecoParam *rec = new AliTRDrecoParam();
+  rec->fkdNchdy = 12.; // pp in TRD
+  return rec;
 
 }
 
@@ -138,7 +146,9 @@ AliTRDrecoParam *AliTRDrecoParam::GetHighFluxParam()
   //
 
   AliTRDrecoParam *rec = new AliTRDrecoParam();
+  rec->fkdNchdy = 4000.; // PbPb in TRD
   rec->SetImproveTracklets(kTRUE);
+
   return rec;
 
 }
@@ -153,12 +163,23 @@ AliTRDrecoParam *AliTRDrecoParam::GetCosmicTestParam()
   AliTRDrawStreamBase::SetRawStreamVersion("TB");
   AliTRDrecoParam *par = new AliTRDrecoParam();
   par->SetVertexConstrained(kFALSE);
-  par->SetChi2YCut(1.136);
-  par->SetChi2ZCut(0.069);
-  par->SetMaxTheta(2.1445);
-  par->SetMaxPhi(2.7475);
-  par->SetMeanNclusters(48.1197);
-  par->SetSigmaNclusters(8.59347);
+  par->fkChi2YCut       = 1.136;
+  par->fkChi2ZCut       = 0.069;
+  par->fkMaxTheta       = 2.1445;
+  par->fkMaxPhi         = 2.7475;
+  par->fkNMeanClusters  = 12.;
+  par->fkNSigmaClusters = 2.5;
   return par;
 
 }
+
+
+//______________________________________________________________
+Float_t AliTRDrecoParam::GetNClusters() const
+{
+  // Estimate the number of clusters in the TRD detector
+  
+  Float_t nclusters = (fkNMeanClusters + 2*fkNSigmaClusters)*fkNMeanTracklets*fkdNchdy;
+  nclusters *= 1.+fkNClusterNoise;
+  return nclusters;
+}
index 167c3c0..6c89917 100644 (file)
@@ -30,8 +30,9 @@ public:
   Double_t GetChi2YCut() const              { return fkChi2YCut; }
   Double_t GetChi2ZCut() const              { return fkChi2ZCut; }
   Double_t GetPhiCut() const                { return fkPhiCut;   }
-  Double_t GetMeanNclusters() const         { return fkMeanNclusters; }
-  Double_t GetSigmaNclusters() const        { return fkSigmaNclusters; }
+  Float_t  GetNClusters() const;
+  Double_t GetNMeanClusters() const         { return fkNMeanClusters; }
+  Double_t GetNSigmaClusters() const        { return fkNSigmaClusters; }
   Double_t GetFindableClusters() const      { return fkFindable; }
   Double_t GetMaxTheta() const              { return fkMaxTheta; }
   Double_t GetMaxPhi() const                { return fkMaxPhi;   }
@@ -72,8 +73,8 @@ public:
   void     SetChi2YCut(Double_t chi2YCut) {fkChi2YCut = chi2YCut;}
   void     SetChi2ZCut(Double_t chi2ZCut) {fkChi2ZCut = chi2ZCut;}
   void     SetPhiCut(Double_t phiCut) {fkPhiCut = phiCut;}
-  void     SetMeanNclusters(Double_t meanNclusters) {fkMeanNclusters = meanNclusters;}
-  void     SetSigmaNclusters(Double_t sigmaNclusters) {fkSigmaNclusters = sigmaNclusters;} 
+  void     SetNMeanClusters(Double_t meanNclusters) {fkNMeanClusters = meanNclusters;}
+  void     SetNSigmaClusters(Double_t sigmaNclusters) {fkNSigmaClusters = sigmaNclusters;} 
   void     SetClusterSharing(Bool_t share = kTRUE)            { SetBit(kClusterSharing, share);}
   void     SetImproveTracklets(Bool_t improve = kTRUE)         { SetBit(kImproveTracklet, improve);}
   void     SetVertexConstrained(Bool_t vc = kTRUE)            { SetBit(kVertexConstrained, vc); }
@@ -97,9 +98,10 @@ private:
    ,kVertexConstrained = BIT(17) // Perform vertex constrained fit
    ,kImproveTracklet   = BIT(18) // Improve tracklet in the SA TRD track finder 
   };
-
+  // Physics reference values for TRD
+  Double_t  fkdNchdy;                // dNch/dy
   Double_t  fkMaxTheta;              // Maximum theta
-  Double_t  fkMaxPhi;                // Maximum phi
+  Double_t  fkMaxPhi;                // Maximum phi - momentum cut
 
   Double_t  fkRoad0y;                // Road for middle cluster
   Double_t  fkRoad0z;                // Road for middle cluster
@@ -111,14 +113,16 @@ private:
   Double_t  fkRoad2z;                // Road in z for extrapolated cluster
   
   Double_t  fkPlaneQualityThreshold; // Quality threshold
-  Double_t  fkFindable;              // Ratio of clusters from a track in one chamber which are at minimum supposed to be found.
+  Double_t  fkFindable;              // minimum ratio of clusters per tracklet supposed to be attached.
   Double_t  fkChi2Z;                 // Max chi2 on the z direction for seeding clusters fit
   Double_t  fkChi2Y;                 // Max chi2 on the y direction for seeding clusters Rieman fit
   Double_t  fkChi2YCut;              // Cut on the Chi2 in y-direction in the likelihood filter
   Double_t  fkChi2ZCut;              // Cut on the Chi2 in z-direction in the likelihood filter
   Double_t  fkPhiCut;                // Cut on the deviation of the phi angles between tracklet and track fit (lik. filter)
-  Double_t  fkMeanNclusters;         // Mean of the distribution of the number of clusters per tracklet
-  Double_t  fkSigmaNclusters;        // Sigma of the distribution of the number of clusters per tracklet
+  Double_t  fkNMeanClusters;         // Mean number of clusters per tracklet
+  Double_t  fkNSigmaClusters;        // Sigma of the number of clusters per tracklet
+  Double_t  fkNClusterNoise;         // ratio of noisy clusters to the true one
+  Double_t  fkNMeanTracklets;        // Mean number of tracklets per track
   Double_t  fkTrackLikelihood;       // Track likelihood for tracklets Rieman fit
   
   Double_t  fSysCovMatrix[5];        // Systematic uncertainty from calibration and alignment for each tracklet
index fe2354d..fff38b5 100644 (file)
@@ -1537,7 +1537,9 @@ Int_t AliTRDtrackerV1::ReadClusters(TClonesArray* &array, TTree *clusterTree) co
   branch->SetAddress(&clusterArray); 
   
   if(!fClusters){ 
-    array = new TClonesArray("AliTRDcluster", nsize);
+    Float_t nclusters =  fReconstructor->GetRecoParam()->GetNClusters();
+    if(fReconstructor->IsHLT()) nclusters /= AliTRDgeometry::kNsector;
+    array = new TClonesArray("AliTRDcluster", Int_t(nclusters));
     array->SetOwner(kTRUE);
   }
   
@@ -1658,7 +1660,6 @@ void AliTRDtrackerV1::UnloadClusters()
 
   if(fTracks) fTracks->Delete(); 
   if(fTracklets) fTracklets->Delete();
-  if(fClusters && IsClustersOwner()) fClusters->Delete();
   if(fClusters){ 
     if(IsClustersOwner()) fClusters->Delete();
     
@@ -2840,18 +2841,20 @@ Double_t AliTRDtrackerV1::CookLikelihood(AliTRDseedV1 *cseed, Int_t planes[4])
        Double_t chi2y = GetChi2Y(&cseed[0]);
   Double_t chi2z = GetChi2Z(&cseed[0]);
 
-  Int_t nclusters = 0;
+  Float_t nclusters = 0.;
   Double_t sumda = 0.;
   for(UChar_t ilayer = 0; ilayer < 4; ilayer++){
     Int_t jlayer = planes[ilayer];
     nclusters += cseed[jlayer].GetN2();
     sumda += TMath::Abs(cseed[jlayer].GetYfitR(1) - cseed[jlayer].GetYref(1));
   }
+  nclusters *= .25;
+
   Double_t likea     = TMath::Exp(-sumda * fRecoPars->GetPhiCut());
   Double_t likechi2y  = 0.0000000001;
   if (fReconstructor->IsCosmic() || chi2y < 0.5) likechi2y += TMath::Exp(-TMath::Sqrt(chi2y) * fRecoPars->GetChi2YCut());
   Double_t likechi2z = TMath::Exp(-chi2z * fRecoPars->GetChi2ZCut());
-  Double_t likeN     = TMath::Exp(-(fRecoPars->GetMeanNclusters() - nclusters) / fRecoPars->GetSigmaNclusters());
+  Double_t likeN     = TMath::Exp(-(fRecoPars->GetNMeanClusters() - nclusters) / fRecoPars->GetNSigmaClusters());
   Double_t like      = likea * likechi2y * likechi2z * likeN;
 
   //   AliInfo(Form("sumda(%f) chi2[0](%f) chi2[1](%f) likea(%f) likechi2y(%f) likechi2z(%f) nclusters(%d) likeN(%f)", sumda, chi2[0], chi2[1], likea, likechi2y, likechi2z, nclusters, likeN));