Updated function EvaluatePoints.
authorvestbo <vestbo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 21 Jan 2003 18:56:32 +0000 (18:56 +0000)
committervestbo <vestbo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 21 Jan 2003 18:56:32 +0000 (18:56 +0000)
HLT/src/AliL3Evaluate.cxx
HLT/src/AliL3Evaluate.h

index fc90b1992a06e2d510ff5a9d149cfd18d1d570f1..d173028c12dd581e0ae4adb3984844e3d7ef1fc4 100644 (file)
@@ -136,7 +136,7 @@ AliL3Evaluate::~AliL3Evaluate()
   if(fNtuppel) delete fNtuppel;
 }
 
   if(fNtuppel) delete fNtuppel;
 }
 
-
+  
 void AliL3Evaluate::AssignIDs()
 {
   //Assign MC id to the tracks.
 void AliL3Evaluate::AssignIDs()
 {
   //Assign MC id to the tracks.
@@ -559,22 +559,33 @@ TNtupleD *AliL3Evaluate::CalculateResiduals(Char_t *datapath)
   return ntuppel;
 }
 
   return ntuppel;
 }
 
-TNtuple *AliL3Evaluate::EvaluatePoints(Char_t *rootfile)
+TNtuple *AliL3Evaluate::EvaluatePoints(Char_t *path)
 {
   //Compare points to the exact crossing points of track and padrows.
   //The input file to this function, contains the exact clusters calculated
   //in AliTPC::Hits2ExactClusters.
 {
   //Compare points to the exact crossing points of track and padrows.
   //The input file to this function, contains the exact clusters calculated
   //in AliTPC::Hits2ExactClusters.
-    
+  
   cout<<"Evaluating points"<<endl;
   TNtuple *ntuppel = new TNtuple("ntuppel","residuals","slice:padrow:resy:resz:zHit:pt");
   cout<<"Evaluating points"<<endl;
   TNtuple *ntuppel = new TNtuple("ntuppel","residuals","slice:padrow:resy:resz:zHit:pt");
+  ntuppel->SetDirectory(0);
   
   
-  TFile *exfile = TFile::Open(rootfile);
+  Char_t filename[1024];
+  sprintf(filename,"%s/alirunfile.root",path);
+  TFile *exfile = TFile::Open(filename);
   if(!exfile)
     {
   if(!exfile)
     {
-      cerr<<"Error opening rootfile "<<rootfile<<endl;
+      cerr<<"Error opening rootfile "<<filename<<endl;
       return 0;
     }
       return 0;
     }
-
+  gAlice = (AliRun*)exfile->Get("gAlice");
+  if (!gAlice) 
+    {
+      LOG(AliL3Log::kError,"AliL3Evaluate::InitMC","gAlice")
+       <<"AliRun object non existing on file"<<ENDLOG;
+      return false;
+    }
+  
+  gAlice->GetEvent(0);
   AliTPCParam *param = (AliTPCParam*)exfile->Get(AliL3Transform::GetParamName());
   
   //Get the exact clusters from file:
   AliTPCParam *param = (AliTPCParam*)exfile->Get(AliL3Transform::GetParamName());
   
   //Get the exact clusters from file:
@@ -603,35 +614,41 @@ TNtuple *AliL3Evaluate::EvaluatePoints(Char_t *rootfile)
       AliL3Transform::Sector2Slice(slice,padrow,cursec,currow);
       if(slice<fMinSlice || slice>fMaxSlice) continue;
       AliL3SpacePointData *points = fClusters[slice][0];
       AliL3Transform::Sector2Slice(slice,padrow,cursec,currow);
       if(slice<fMinSlice || slice>fMaxSlice) continue;
       AliL3SpacePointData *points = fClusters[slice][0];
-      
-      Int_t index = fRowid[slice][padrow];
-      if(!fDigitsTree->GetEvent(index))
-       printf("AliL3Evaluate::EvaluatePoints : ERROR IN DIGITSTREE\n");
+      if(!points)
+       {
+         cerr<<"AliL3Evaluate::EvalutePoints : Error getting clusters "<<endl;
+         return 0;
+       }
       printf("Checking slice %d padrow %d with %d clusters\n",slice,padrow,num_of_offline);
       printf("Checking slice %d padrow %d with %d clusters\n",slice,padrow,num_of_offline);
-      
+      cout<<"There are "<<fNcl[slice][0]<<" clusters here"<<endl;
       for(UInt_t c=0; c<fNcl[slice][0]; c++)
        {
       for(UInt_t c=0; c<fNcl[slice][0]; c++)
        {
-         if(points[c].fPadRow!=padrow) continue;
+         if((Int_t)points[c].fPadRow!=padrow) continue;
+         Float_t xyz_cl[3] = {points[c].fX,points[c].fY,points[c].fZ};
+         Float_t xyz_ex[3];
+         AliL3Transform::Global2Local(xyz_cl,cursec);
+
          for(Int_t m=0; m<num_of_offline; m++)
            {
              AliComplexCluster *cluster = (AliComplexCluster *)clusters->UncheckedAt(m);
              Int_t mcId = cluster->fTracks[0];
          for(Int_t m=0; m<num_of_offline; m++)
            {
              AliComplexCluster *cluster = (AliComplexCluster *)clusters->UncheckedAt(m);
              Int_t mcId = cluster->fTracks[0];
-             //Int_t mcId = cluster->GetLabel(0);
+
              if(mcId <0) continue;
              TParticle *part = gAlice->Particle(mcId);
              if(mcId <0) continue;
              TParticle *part = gAlice->Particle(mcId);
-             
-             Float_t xyz_cl[3] = {points[c].fX,points[c].fY,points[c].fZ};
-             Float_t xyz_ex[3];
-             AliL3Transform::Global2Raw(xyz_cl,cursec,currow);
-             if(fDigits->GetTrackID((Int_t)rint(xyz_cl[2]),(Int_t)rint(xyz_cl[1]),0)!=mcId &&
-                fDigits->GetTrackID((Int_t)rint(xyz_cl[2]),(Int_t)rint(xyz_cl[1]),1)!=mcId &&
-                fDigits->GetTrackID((Int_t)rint(xyz_cl[2]),(Int_t)rint(xyz_cl[1]),2)!=mcId)
+             if(points[c].fTrackID[0]!=mcId &&
+                points[c].fTrackID[1]!=mcId &&
+                points[c].fTrackID[2]!=mcId)
                continue;
                continue;
+
              AliL3Transform::Raw2Local(xyz_ex,cursec,currow,cluster->fY,cluster->fX);
              AliL3Transform::Raw2Local(xyz_ex,cursec,currow,cluster->fY,cluster->fX);
-             AliL3Transform::Raw2Local(xyz_cl,cursec,currow,xyz_cl[1],xyz_cl[2]);
+             
+             //In function AliTPC::Hits2ExactClusters the time offset is not included,
+             //so we have to substract it again here.
+             xyz_ex[2]-=AliL3Transform::GetZOffset();
+             
              Float_t resy = xyz_cl[1] - xyz_ex[1];//cluster->GetY()
              Float_t resz = xyz_cl[2] - xyz_ex[2];//cluster->GetZ()
              Float_t resy = xyz_cl[1] - xyz_ex[1];//cluster->GetY()
              Float_t resz = xyz_cl[2] - xyz_ex[2];//cluster->GetZ()
-             
+
              ntuppel->Fill(slice,padrow,resy,resz,xyz_ex[2],part->Pt());
            }
        }      
              ntuppel->Fill(slice,padrow,resy,resz,xyz_ex[2],part->Pt());
            }
        }      
index bc191e8c89390b076716ff10f2ec93f18ad74822..308a66e33ec71f4f8f067986611e30f2c9135abc 100644 (file)
@@ -41,8 +41,8 @@ class AliL3Evaluate {
   AliL3TrackArray *fTracks; //!
   AliTPCParam *fParam;
   AliL3SpacePointData *fClusters[36][6]; //!
   AliL3TrackArray *fTracks; //!
   AliTPCParam *fParam;
   AliL3SpacePointData *fClusters[36][6]; //!
-  AliSimDigits *fDigits;
   TTree *fDigitsTree;
   TTree *fDigitsTree;
+  AliSimDigits *fDigits;
   Int_t fMinSlice;
   Int_t fMaxSlice;
   UInt_t fNcl[36][6];
   Int_t fMinSlice;
   Int_t fMaxSlice;
   UInt_t fNcl[36][6];
@@ -74,7 +74,6 @@ class AliL3Evaluate {
   TH1F *fFakeTrackEffEta;
   
   
   TH1F *fFakeTrackEffEta;
   
   
-  
  public:
   AliL3Evaluate();
   AliL3Evaluate(Char_t *path,Int_t min_clusters,Int_t minhits,Double_t minpt=0.1,Int_t *slice=0);
  public:
   AliL3Evaluate();
   AliL3Evaluate(Char_t *path,Int_t min_clusters,Int_t minhits,Double_t minpt=0.1,Int_t *slice=0);
@@ -91,7 +90,7 @@ class AliL3Evaluate {
   void GetCFeff(Char_t *outfile);
   Int_t GetMCTrackLabel(AliL3Track *track);
   TNtupleD *CalculateResiduals(Char_t *datapath);
   void GetCFeff(Char_t *outfile);
   Int_t GetMCTrackLabel(AliL3Track *track);
   TNtupleD *CalculateResiduals(Char_t *datapath);
-  TNtuple *EvaluatePoints(Char_t *rootfile);
+  TNtuple *EvaluatePoints(Char_t *path);
   
   void SetMinPoints(Int_t f) {fMinPointsOnTrack = f;}
   void SetMinGoodPt(Double_t f) {fMinGoodPt = f;}
   
   void SetMinPoints(Int_t f) {fMinPointsOnTrack = f;}
   void SetMinGoodPt(Double_t f) {fMinGoodPt = f;}