-//_____________________________________________________________________________
-Int_t AliTRDtracker::PropagateBack(const TFile *inp, TFile *out) {
- //
- // Reads seeds from file <inp>. The seeds are AliTPCtrack's found and
- // backpropagated by the TPC tracker. Each seed is first propagated
- // to the TRD, and then its prolongation is searched in the TRD.
- // If sufficiently long continuation of the track is found in the TRD
- // the track is updated, otherwise it's stored as originaly defined
- // by the TPC tracker.
- //
-
- LoadEvent();
-
- TDirectory *savedir=gDirectory;
-
- TFile *in=(TFile*)inp;
-
- if (!in->IsOpen()) {
- cerr<<"AliTRDtracker::PropagateBack(): ";
- cerr<<"file with back propagated TPC tracks is not open !\n";
- return 1;
- }
-
- if (!out->IsOpen()) {
- cerr<<"AliTRDtracker::PropagateBack(): ";
- cerr<<"file for back propagated TRD tracks is not open !\n";
- return 2;
- }
-
- in->cd();
- char tname[100];
- sprintf(tname,"seedsTPCtoTRD_%d",GetEventNumber());
- TTree *seedTree=(TTree*)in->Get(tname);
- if (!seedTree) {
- cerr<<"AliTRDtracker::PropagateBack(): ";
- cerr<<"can't get a tree with seeds from TPC !\n";
- cerr<<"check if your version of TPC tracker creates tree "<<tname<<"\n";
- return 3;
- }
-
- AliTPCtrack *seed=new AliTPCtrack;
- seedTree->SetBranchAddress("tracks",&seed);
-
- Int_t n=(Int_t)seedTree->GetEntries();
- for (Int_t i=0; i<n; i++) {
- seedTree->GetEvent(i);
- Int_t lbl = seed->GetLabel();
- AliTRDtrack *tr = new AliTRDtrack(*seed,seed->GetAlpha());
- tr->SetSeedLabel(lbl);
- fSeeds->AddLast(tr);
- fNseeds++;
- }
-
- delete seed;
- delete seedTree;
-
- out->cd();
-
- AliTPCtrack *otrack=0;
-
- sprintf(tname,"seedsTRDtoTOF1_%d",GetEventNumber());
- TTree tofTree1(tname,"Tracks back propagated through TPC and TRD");
- tofTree1.Branch("tracks","AliTPCtrack",&otrack,32000,0);
-
- sprintf(tname,"seedsTRDtoTOF2_%d",GetEventNumber());
- TTree tofTree2(tname,"Tracks back propagated through TPC and TRD");
- tofTree2.Branch("tracks","AliTPCtrack",&otrack,32000,0);
-
- sprintf(tname,"seedsTRDtoPHOS_%d",GetEventNumber());
- TTree phosTree(tname,"Tracks back propagated through TPC and TRD");
- phosTree.Branch("tracks","AliTPCtrack",&otrack,32000,0);
-
- sprintf(tname,"seedsTRDtoRICH_%d",GetEventNumber());
- TTree richTree(tname,"Tracks back propagated through TPC and TRD");
- richTree.Branch("tracks","AliTPCtrack",&otrack,32000,0);
-
- sprintf(tname,"TRDb_%d",GetEventNumber());
- TTree trdTree(tname,"Back propagated TRD tracks at outer TRD time bin");
- AliTRDtrack *otrackTRD=0;
- trdTree.Branch("tracks","AliTRDtrack",&otrackTRD,32000,0);
-
- if (IsStoringBarrel()) SetBarrelTree("back");
- out->cd();
-
- Int_t found=0;
- Int_t nseed=fSeeds->GetEntriesFast();
-
- // Float_t foundMin = fgkMinClustersInTrack * fTimeBinsPerPlane * fGeom->Nplan();
- Float_t foundMin = 40;
-
- Int_t outermostTB = fTrSec[0]->GetOuterTimeBin();
-
- for (Int_t i=0; i<nseed; i++) {
-
- AliTRDtrack *ps=(AliTRDtrack*)fSeeds->UncheckedAt(i), &s=*ps;
- Int_t expectedClr = FollowBackProlongation(s);
-
- if (IsStoringBarrel()) {
- StoreBarrelTrack(ps, fgkLastPlane, kTrackBack);
- fBarrelTree->Fill();
- }
-
- Int_t foundClr = s.GetNumberOfClusters();
- Int_t lastTB = fTrSec[0]->GetLayerNumber(s.GetX());
-
- // printf("seed %d: found %d out of %d expected clusters, Min is %f\n",
- // i, foundClr, expectedClr, foundMin);
-
- if (foundClr >= foundMin) {
- if(foundClr >= 2) {
- s.CookdEdx();
- CookLabel(ps, 1-fgkLabelFraction);
- UseClusters(ps);
- }
-
- // Propagate to outer reference plane [SR, GSI, 18.02.2003]
- ps->PropagateTo(364.8);
- otrackTRD=ps;
- trdTree.Fill();
- found++;
-// cout<<found<<'\r';
- }
-
- if(((expectedClr < 10) && (lastTB == outermostTB)) ||
- ((expectedClr >= 10) &&
- (((Float_t) foundClr) / ((Float_t) expectedClr) >=
- fgkMinFractionOfFoundClusters) && (lastTB == outermostTB))) {
-
- Double_t xTOF = 375.5;
-
- if(PropagateToOuterPlane(s,xTOF)) {
- AliTPCtrack *pt = new AliTPCtrack(*ps,ps->GetAlpha());
- otrack = pt;
- tofTree1.Fill();
- delete pt;
-
- xTOF = 381.5;
-
- if(PropagateToOuterPlane(s,xTOF)) {
- AliTPCtrack *pt = new AliTPCtrack(*ps,ps->GetAlpha());
- otrack = pt;
- tofTree2.Fill();
- delete pt;
-
- Double_t xPHOS = 460.;
-
- if(PropagateToOuterPlane(s,xPHOS)) {
- AliTPCtrack *pt = new AliTPCtrack(*ps,ps->GetAlpha());
- otrack = pt;
- phosTree.Fill();
- delete pt;
-
- Double_t xRICH = 490+1.267;
-
- if(PropagateToOuterPlane(s,xRICH)) {
- AliTPCtrack *pt = new AliTPCtrack(*ps,ps->GetAlpha());
- otrack = pt;
- richTree.Fill();
- delete pt;
- }
- }
- }
- }
- }
- }
-
-
- out->cd();
- tofTree1.Write();
- tofTree2.Write();
- phosTree.Write();
- richTree.Write();
- trdTree.Write();
-
- if (IsStoringBarrel()) { // [SR, 03.04.2003]
- fBarrelFile->cd();
- fBarrelTree->Write();
- fBarrelFile->Flush();
- }
-
- savedir->cd();
- cerr<<"Number of seeds: "<<nseed<<endl;
- cerr<<"Number of back propagated TRD tracks: "<<found<<endl;
-
- UnloadEvent();
-
- return 0;
-
-}
-