+
+void AliL3HoughEval::CompareMC(AliL3TrackArray *tracks,Char_t *trackfile)
+{
+
+ struct GoodTrack goodtracks[15000];
+ Int_t nt=0;
+ ifstream in(trackfile);
+ if(in)
+ {
+ printf("Reading good tracks from file %s\n",trackfile);
+ while (in>>goodtracks[nt].label>>goodtracks[nt].code>>
+ goodtracks[nt].px>>goodtracks[nt].py>>goodtracks[nt].pz>>
+ goodtracks[nt].pt>>goodtracks[nt].eta>>goodtracks[nt].nhits)
+ {
+ nt++;
+ if (nt==15000)
+ {
+ cerr<<"Too many good tracks"<<endl;
+ break;
+ }
+ }
+ if (!in.eof())
+ {
+ LOG(AliL3Log::kError,"AliL3HoughEval::CompareMC","Input file")
+ <<"Error in file reading"<<ENDLOG;
+ return;
+ }
+ }
+ else
+ {
+ LOG(AliL3Log::kError,"AliL3HoughEval::CompareMC","Input")
+ <<"No input trackfile "<<trackfile<<ENDLOG;
+ }
+
+ Int_t *particles = new Int_t[fNEtaSegments];
+ Int_t *ftracks = new Int_t[fNEtaSegments];
+ for(Int_t i=0; i<fNEtaSegments; i++)
+ {
+ particles[i]=0;
+ ftracks[i]=0;
+ }
+
+ Double_t etaslice = (fEtaMax - fEtaMin)/fNEtaSegments;
+ for(Int_t i=0; i<tracks->GetNTracks(); i++)
+ {
+ AliL3HoughTrack *tr = (AliL3HoughTrack*)tracks->GetCheckedTrack(i);
+ if(!tr) continue;
+ Int_t trackindex = tr->GetEtaIndex();
+ if(trackindex <0 || trackindex >= fNEtaSegments) continue;
+ ftracks[trackindex]++;
+ }
+ for(Int_t i=0; i<nt; i++)
+ {
+ if(goodtracks[i].nhits < 150) continue;
+ if(goodtracks[i].pt < 0.5) continue;
+ Int_t particleindex = (Int_t)(goodtracks[i].eta/etaslice);
+ if(particleindex < 0 || particleindex >= fNEtaSegments) continue;
+ particles[particleindex]++;
+ }
+
+ Double_t found=0;
+ Double_t good =0;
+ for(Int_t i=0; i<fNEtaSegments; i++)
+ {
+ printf("Slice %d : Found tracks %d, good tracks %d\n",i,ftracks[i],particles[i]);
+ found += ftracks[i];
+ good += particles[i];
+ }
+ printf("And the total efficiency was: %f\n",found/good);
+
+ delete [] particles;
+ delete [] ftracks;
+
+}
+