o add calculation of residuals in the track fit
authorwiechula <wiechula@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 8 Oct 2013 11:08:04 +0000 (11:08 +0000)
committerwiechula <wiechula@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 8 Oct 2013 11:08:04 +0000 (11:08 +0000)
TPC/Upgrade/AliToyMCReconstruction.cxx
TPC/Upgrade/AliToyMCReconstruction.h
TPC/Upgrade/macros/createSCprecal.C

index ecec86fc4c48e7b13ea4e6743954c65262fa7a34..6d5bd8eea655591261bbbb612ef8de34458145e0 100644 (file)
@@ -47,6 +47,7 @@ AliToyMCReconstruction::AliToyMCReconstruction() : TObject()
 , fTime0(-1)
 , fCreateT0seed(kFALSE)
 , fLongT0seed(kTRUE)
 , fTime0(-1)
 , fCreateT0seed(kFALSE)
 , fLongT0seed(kTRUE)
+, fFillClusterRes(kFALSE)
 , fStreamer(0x0)
 , fInputFile(0x0)
 , fTree(0x0)
 , fStreamer(0x0)
 , fInputFile(0x0)
 , fTree(0x0)
@@ -116,6 +117,12 @@ void AliToyMCReconstruction::RunReco(const char* file, Int_t nmaxEv)
   AliExternalTrackParam trackITS2;
   
   AliExternalTrackParam *dummy;
   AliExternalTrackParam trackITS2;
   
   AliExternalTrackParam *dummy;
+
+  //
+  TClonesArray *arrClustRes=0x0;
+  if (fFillClusterRes){
+    arrClustRes=new TClonesArray("AliTPCclusterMI",160);
+  }
   
   Int_t maxev=fTree->GetEntries();
   if (nmaxEv>0&&nmaxEv<maxev) maxev=nmaxEv;
   
   Int_t maxev=fTree->GetEntries();
   if (nmaxEv>0&&nmaxEv<maxev) maxev=nmaxEv;
@@ -208,7 +215,7 @@ void AliToyMCReconstruction::RunReco(const char* file, Int_t nmaxEv)
           // create fitted track
           if (fDoTrackFit){
 //             printf("track\n");
           // create fitted track
           if (fDoTrackFit){
 //             printf("track\n");
-            dummy = GetFittedTrackFromSeed(tr, &seed);
+            dummy = GetFittedTrackFromSeed(tr, &seed, arrClustRes);
             track = *dummy;
             delete dummy;
           }
             track = *dummy;
             delete dummy;
           }
@@ -274,7 +281,44 @@ void AliToyMCReconstruction::RunReco(const char* file, Int_t nmaxEv)
         
         "trackITS.="   << &trackITS       <<
         "trackITS1.="  << &trackITS1      <<
         
         "trackITS.="   << &trackITS       <<
         "trackITS1.="  << &trackITS1      <<
-        "trackITS2.="  << &trackITS2      <<
+        "trackITS2.="  << &trackITS2;
+
+        if (arrClustRes) {
+          const Int_t nCl=arrClustRes->GetEntriesFast();
+          // fracktion of outliers from track extrapolation
+          // for 1, 1.5, 2, 2.5 and 3 sigma of the cluster resolution (~1mm)
+          Float_t fracY[5]={0.};
+          Float_t fracZ[5]={0.};
+          
+          for (Int_t icl=0; icl<nCl; ++icl) {
+            AliTPCclusterMI *cl=static_cast<AliTPCclusterMI*>(arrClustRes->At(icl));
+            const Float_t sigmaY=TMath::Sqrt(cl->GetSigmaY2());
+            const Float_t sigmaZ=TMath::Sqrt(cl->GetSigmaZ2());
+            for (Int_t inSig=0; inSig<5; ++inSig) {
+              fracY[inSig] += cl->GetY()>(1+inSig*.5)*sigmaY;
+              fracZ[inSig] += cl->GetZ()>(1+inSig*.5)*sigmaZ;
+            }
+          }
+          
+          if (nCl>0) {
+            for (Int_t inSig=0; inSig<5; ++inSig) {
+              fracY[inSig]/=nCl;
+              fracZ[inSig]/=nCl;
+            }
+          }
+          
+          (*fStreamer) << "Tracks" <<
+          "clustRes.=" << arrClustRes;
+          for (Int_t inSig=0; inSig<5; ++inSig) {
+            const char* fracYname=Form("clFracY%02d=", 10+inSig*5);
+            const char* fracZname=Form("clFracZ%02d=", 10+inSig*5);
+            (*fStreamer) << "Tracks" <<
+            fracYname << fracY[inSig] <<
+            fracZname << fracZ[inSig];
+          }
+        }
+        
+        (*fStreamer) << "Tracks" <<
         "\n";
       }
       
         "\n";
       }
       
@@ -282,6 +326,7 @@ void AliToyMCReconstruction::RunReco(const char* file, Int_t nmaxEv)
     }
   }
 
     }
   }
 
+  delete arrClustRes;
   Cleanup();
 }
 
   Cleanup();
 }
 
@@ -1164,12 +1209,16 @@ void AliToyMCReconstruction::ClusterToSpacePoint(const AliTPCclusterMI *cl, Floa
 }
 
 //____________________________________________________________________________________
 }
 
 //____________________________________________________________________________________
-AliExternalTrackParam* AliToyMCReconstruction::GetFittedTrackFromSeed(const AliToyMCTrack *tr, const AliExternalTrackParam *seed)
+AliExternalTrackParam* AliToyMCReconstruction::GetFittedTrackFromSeed(const AliToyMCTrack *tr, const AliExternalTrackParam *seed, TClonesArray *arrClustRes)
 {
   //
   //
   //
 
 {
   //
   //
   //
 
+  if (arrClustRes) {
+    arrClustRes->Clear();
+  }
+  
   // create track
   AliExternalTrackParam *track = new AliExternalTrackParam(*seed);
 
   // create track
   AliExternalTrackParam *track = new AliExternalTrackParam(*seed);
 
@@ -1245,6 +1294,16 @@ AliExternalTrackParam* AliToyMCReconstruction::GetFittedTrackFromSeed(const AliT
     if (TMath::Abs(track->GetX())>kMaxR) break;
 //     if (TMath::Abs(track->GetZ())<kZcut)continue;
     //
     if (TMath::Abs(track->GetX())>kMaxR) break;
 //     if (TMath::Abs(track->GetZ())<kZcut)continue;
     //
+
+    // add residuals
+    if (arrClustRes) {
+      TClonesArray &arrDummy=*arrClustRes;
+      AliTPCclusterMI *clRes = new(arrDummy[arrDummy.GetEntriesFast()]) AliTPCclusterMI(*cl);
+      clRes->SetX(prot.GetX());
+      clRes->SetY(track->GetY()-prot.GetY());
+      clRes->SetZ(track->GetZ()-prot.GetZ());
+    }
+    
     Double_t pointPos[2]={0,0};
     Double_t pointCov[3]={0,0,0};
     pointPos[0]=prot.GetY();//local y
     Double_t pointPos[2]={0,0};
     Double_t pointCov[3]={0,0,0};
     pointPos[0]=prot.GetY();//local y
@@ -1268,7 +1327,6 @@ AliExternalTrackParam* AliToyMCReconstruction::GetFittedTrackFromSeed(const AliT
   return track;
 }
 
   return track;
 }
 
-
 //____________________________________________________________________________________
 AliExternalTrackParam* AliToyMCReconstruction::GetFittedTrackFromSeedAllClusters(const AliToyMCTrack *tr, const AliExternalTrackParam *seed, Int_t &nClus)
 {
 //____________________________________________________________________________________
 AliExternalTrackParam* AliToyMCReconstruction::GetFittedTrackFromSeedAllClusters(const AliToyMCTrack *tr, const AliExternalTrackParam *seed, Int_t &nClus)
 {
index 8f36fb8eb4fbfacdcc50938d867d69513eaa9d2e..1fc7374a397a58df6956af09d56f3224c1c4a11d 100644 (file)
@@ -67,13 +67,18 @@ public:
 
   void   SetIdealTracking(Bool_t tr)    { fIdealTracking = tr;    }
   Bool_t GetIdealTracking()  const      { return fIdealTracking;  }
 
   void   SetIdealTracking(Bool_t tr)    { fIdealTracking = tr;    }
   Bool_t GetIdealTracking()  const      { return fIdealTracking;  }
+
+  void   SetFillClusterRes(Bool_t res)  { fFillClusterRes=res;    }
+  Bool_t GetFillClusterRes()  const     { return fFillClusterRes; }
+
+  
   
   void   SetTree(TTree *tree) { fTree=tree; }
   TTree* GetTree() const { return fTree; }
 
   AliExternalTrackParam* GetSeedFromTrack(const AliToyMCTrack * const tr, Bool_t forceSeed=kFALSE);
   AliExternalTrackParam* GetSeedFromTrackIdeal(const AliToyMCTrack * const tr, EDet det );
   
   void   SetTree(TTree *tree) { fTree=tree; }
   TTree* GetTree() const { return fTree; }
 
   AliExternalTrackParam* GetSeedFromTrack(const AliToyMCTrack * const tr, Bool_t forceSeed=kFALSE);
   AliExternalTrackParam* GetSeedFromTrackIdeal(const AliToyMCTrack * const tr, EDet det );
-  AliExternalTrackParam* GetFittedTrackFromSeed(const AliToyMCTrack *tr, const AliExternalTrackParam *seed);
+  AliExternalTrackParam* GetFittedTrackFromSeed(const AliToyMCTrack *tr, const AliExternalTrackParam *seed, TClonesArray *arrClustRes=0x0);
   AliExternalTrackParam* GetFittedTrackFromSeedAllClusters(const AliToyMCTrack *tr, const AliExternalTrackParam *seed, Int_t &nClus);
   AliExternalTrackParam* GetTrackRefit(const AliToyMCTrack * const tr, EDet det);
 
   AliExternalTrackParam* GetFittedTrackFromSeedAllClusters(const AliToyMCTrack *tr, const AliExternalTrackParam *seed, Int_t &nClus);
   AliExternalTrackParam* GetTrackRefit(const AliToyMCTrack * const tr, EDet det);
 
@@ -156,6 +161,7 @@ public:
   Double_t fTime0;               // current time0 used for reconstruction
   Bool_t   fCreateT0seed;        // if current seed is the T0 seed
   Bool_t   fLongT0seed;          // if we should use a t0 seed including all clusters in the seed range
   Double_t fTime0;               // current time0 used for reconstruction
   Bool_t   fCreateT0seed;        // if current seed is the T0 seed
   Bool_t   fLongT0seed;          // if we should use a t0 seed including all clusters in the seed range
+  Bool_t   fFillClusterRes;      // fill cluster residuals?
   
   TTreeSRedirector *fStreamer;   // debug streamer
   TFile *fInputFile;             // input file
   
   TTreeSRedirector *fStreamer;   // debug streamer
   TFile *fInputFile;             // input file
index 2029c18bfb2efdf886576f4fc653dc00bca56ca7..60fc4b169d06e79e32631b1c6676bd7a7a432730 100644 (file)
@@ -11,7 +11,7 @@ void createSCprecal(TString input, Int_t gas=1)
   TString tGas[nOmegaTau] = {"NeCO2","NeCO2_2","ArCO2","NeCF4","NeCF4_2"}; // CF4 is the same as CO2 here, but different omegaTau
   TString sGas[nOmegaTau] = {"Ne-CO_{2} (90-10)","Ne-CO_{2}-N_{2} (90-10-5)","Ar-CO_{2} (90-10)","Ne-CF_{4} (90-10)","Ne-CF_{4} (80-20)"};
 
   TString tGas[nOmegaTau] = {"NeCO2","NeCO2_2","ArCO2","NeCF4","NeCF4_2"}; // CF4 is the same as CO2 here, but different omegaTau
   TString sGas[nOmegaTau] = {"Ne-CO_{2} (90-10)","Ne-CO_{2}-N_{2} (90-10-5)","Ar-CO_{2} (90-10)","Ne-CF_{4} (90-10)","Ne-CF_{4} (80-20)"};
 
-  spaceCharge->SetOmegaTauT1T2(omegaTau[iOmegaTau], T1[gas] , T2[gas]);
+  spaceCharge->SetOmegaTauT1T2(omegaTau[gas], T1[gas] , T2[gas]);
   spaceCharge->InitSpaceCharge3DDistortion();
 
   TString outName=input;
   spaceCharge->InitSpaceCharge3DDistortion();
 
   TString outName=input;