//--------------------------------------------------------------------//
// //
-// AliTOFtrackerV1 Class //
+// AliTOFtrackerV1 Class //
// Task: Perform association of the ESD tracks to TOF Clusters //
// and Update ESD track with associated TOF Cluster parameters //
// //
#include <TFile.h>
#include <TH1F.h>
#include <TH2F.h>
+#include <TSeqCollection.h>
-#include "AliAlignObj.h"
#include "AliESDtrack.h"
#include "AliESDEvent.h"
#include "AliLog.h"
#include "AliTrackPointArray.h"
+#include "AliGeomManager.h"
+#include "AliCDBManager.h"
-#include "AliTOFcalib.h"
#include "AliTOFRecoParam.h"
+#include "AliTOFReconstructor.h"
#include "AliTOFcluster.h"
#include "AliTOFGeometry.h"
#include "AliTOFtrackerV1.h"
#include "AliTOFtrack.h"
-
-#include "AliCDBManager.h"
+#include "AliTOFpidESD.h"
extern TROOT *gROOT;
fnbadmatch(0),
fnunmatch(0),
fnmatch(0),
- fTracks(0x0),
- fSeeds(0x0),
+ fTracks(new TClonesArray("AliTOFtrack")),
+ fSeeds(new TClonesArray("AliESDtrack")),
fHDigClusMap(0x0),
fHDigNClus(0x0),
fHDigClusTime(0x0),
fHRecSigZVsPWin(0x0)
{
//AliTOFtrackerV1 main Ctor
-
- // Read the reconstruction parameters from the OCDB
- AliTOFcalib *calib = new AliTOFcalib();
- fRecoParam = (AliTOFRecoParam*)calib->ReadRecParFromCDB("TOF/Calib",-1);
- if(fRecoParam->GetApplyPbPbCuts())fRecoParam=fRecoParam->GetPbPbparam();
- Double_t parPID[2];
- parPID[0]=fRecoParam->GetTimeResolution();
- parPID[1]=fRecoParam->GetTimeNSigma();
- fPid=new AliTOFpidESD(parPID);
- InitCheckHists();
- delete calib;
-}
-//_____________________________________________________________________________
-AliTOFtrackerV1::AliTOFtrackerV1(const AliTOFtrackerV1 &t):
- AliTracker(),
- fRecoParam(0x0),
- fPid(0x0),
- fN(0),
- fNseeds(0),
- fNseedsTOF(0),
- fngoodmatch(0),
- fnbadmatch(0),
- fnunmatch(0),
- fnmatch(0),
- fTracks(0x0),
- fSeeds(0x0),
- fHDigClusMap(0x0),
- fHDigNClus(0x0),
- fHDigClusTime(0x0),
- fHDigClusToT(0x0),
- fHRecNClus(0x0),
- fHRecChi2(0x0),
- fHRecDistZ(0x0),
- fHRecSigYVsP(0x0),
- fHRecSigZVsP(0x0),
- fHRecSigYVsPWin(0x0),
- fHRecSigZVsPWin(0x0)
- {
- //AliTOFtrackerV1 copy Ctor
-
- fNseeds=t.fNseeds;
- fNseeds=t.fNseeds;
- fNseedsTOF=t.fNseedsTOF;
- fngoodmatch=t.fngoodmatch;
- fnbadmatch=t.fnbadmatch;
- fnunmatch=t.fnunmatch;
- fnmatch=t.fnmatch;
- fRecoParam=t.fRecoParam;
- fPid=t.fPid;
- fSeeds=t.fSeeds;
- fTracks=t.fTracks;
- fN=t.fN;
-}
-
-//_____________________________________________________________________________
-AliTOFtrackerV1& AliTOFtrackerV1::operator=(const AliTOFtrackerV1 &t)
-{
- //AliTOFtrackerV1 assignment operator
-
- this->fNseeds=t.fNseeds;
- this->fNseedsTOF=t.fNseedsTOF;
- this->fngoodmatch=t.fngoodmatch;
- this->fnbadmatch=t.fnbadmatch;
- this->fnunmatch=t.fnunmatch;
- this->fnmatch=t.fnmatch;
- this->fRecoParam = t.fRecoParam;
- this->fPid = t.fPid;
- this->fSeeds=t.fSeeds;
- this->fTracks=t.fTracks;
- this->fN=t.fN;
- return *this;
+ InitCheckHists();
}
//_____________________________________________________________________________
delete fHRecSigZVsP;
delete fHRecSigYVsPWin;
delete fHRecSigZVsPWin;
+ if (fTracks){
+ fTracks->Delete();
+ delete fTracks;
+ fTracks=0x0;
+ }
+ if (fSeeds){
+ fSeeds->Delete();
+ delete fSeeds;
+ fSeeds=0x0;
+ }
}
//_____________________________________________________________________________
Int_t AliTOFtrackerV1::PropagateBack(AliESDEvent* event) {
// Gets seeds from ESD event and Match with TOF Clusters
//
+ // initialize RecoParam for current event
+
+ AliInfo("Initializing params for TOF... ");
+
+ fRecoParam = AliTOFReconstructor::GetRecoParam(); // instantiate reco param from STEER...
+
+ if (fRecoParam == 0x0) {
+ AliFatal("No Reco Param found for TOF!!!");
+ }
+ //fRecoParam->Dump();
+ //if(fRecoParam->GetApplyPbPbCuts())fRecoParam=fRecoParam->GetPbPbparam();
+ //fRecoParam->PrintParameters();
+
+ Double_t parPID[2];
+ parPID[0]=fRecoParam->GetTimeResolution();
+ parPID[1]=fRecoParam->GetTimeNSigma();
+ fPid=new AliTOFpidESD(parPID);
//Initialise some counters
Int_t ntrk=event->GetNumberOfTracks();
fNseeds = ntrk;
- fSeeds= new TClonesArray("AliESDtrack",ntrk);
TClonesArray &aESDTrack = *fSeeds;
//Make TOF PID
fPid->MakePID(event,timeZero);
- if (fSeeds) {
- fSeeds->Delete();
- delete fSeeds;
- fSeeds = 0x0;
- }
- if (fTracks) {
- fTracks->Delete();
- delete fTracks;
- fTracks = 0x0;
- }
+ fSeeds->Clear();
+ fTracks->Clear();
return 0;
}
Int_t seedsTOF1=0;
Int_t seedsTOF2=0;
- fTracks= new TClonesArray("AliTOFtrack");
TClonesArray &aTOFTrack = *fTracks;
for (Int_t i=0; i<fNseeds; i++) {
AliESDtrack *t =(AliESDtrack*)fSeeds->UncheckedAt(i);
if ((t->GetStatus()&AliESDtrack::kTPCout)==0)continue;
- // TRD 'good' tracks, already propagated at 371 cm
+ // TRD 'good' tracks, already propagated at 372 cm
AliTOFtrack *track = new AliTOFtrack(*t); // New
Double_t x = track->GetX(); //New
Double_t cov[15]; trackTOFin->GetExternalCovariance(cov);
Double_t z = par[1];
- Double_t dz = scaleFact*3.*TMath::Sqrt(cov[2]+dZ*dZ/12);
+ Double_t dz = scaleFact*3.*TMath::Sqrt(cov[2]+dZ*dZ/12.);
Double_t dphi = scaleFact*3.*TMath::Sqrt(cov[0]+dY*dY/12.)/sensRadius;
Double_t phi=TMath::ATan2(par[0],x) + trackTOFin->GetAlpha();
Int_t index[kncmax];//to keep track of the cluster index
for (Int_t k=FindClusterIndex(z-dz); k<fN; k++) {
AliTOFcluster *c=fClusters[k];
- if(nc>kncmax)break;
+ // if(nc>kncmax)break; /* R+ fix (buffer overflow) */
+ if(nc>=kncmax)break; /* R+ fix (buffer overflow protection) */
if(c->GetZ() > z+dz) break;
if(c->IsUsed()) continue;
- if(!c->GetStatus()) continue; // skip bad channels as declared in OCDB
+ if(!c->GetStatus()) {
+ AliDebug(1,"Cluster in channel declared bad!");
+ continue; // skip bad channels as declared in OCDB
+ }
Float_t xyz[3]; c->GetGlobalXYZ(xyz);
Double_t clPhi=TMath::ATan2(xyz[1],xyz[0]);
Double_t dph=TMath::Abs(clPhi-phi);
nc++;
}
- //start propagation: go to the average TOF pad middle plane at ~378.5 cm
+ //start propagation: go to the average TOF pad middle plane at ~379.5 cm
Float_t xTOF = sensRadius;
Double_t ymax = xTOF*TMath::Tan(0.5*AliTOFGeometry::GetAlpha());
break;
}
} else if (ysect <-ymax) {
- if (!trackTOFin->Rotate(AliTOFGeometry::GetAlpha())) {
+ if (!trackTOFin->Rotate(-AliTOFGeometry::GetAlpha())) {
break;
}
}
AliTOFcluster *bestCluster=0;
Double_t bestChi2=maxChi2;
Int_t idclus=-1;
- for (Int_t i=0; i<nc; i++){
+ // for (Int_t i=0; i<nc; i++){ /* R+ fix (unsafe) */
+ for (Int_t i=0; i<nc && i<kncmax; i++){ /* R+ fix (buffer overflow protection) */
AliTOFcluster *c=clusters[i]; // one of the preselected clusters
Double_t chi2=trackTOFin->GetPredictedChi2((AliCluster3D*)c);
if (chi2 >= bestChi2) continue;
}
fnmatch++;
+
+ AliDebug(2, Form("%7i %7i %10i %10i %10i %10i %7i",
+ iseed,
+ fnmatch-1,
+ TMath::Abs(trackTOFin->GetLabel()),
+ bestCluster->GetLabel(0),
+ bestCluster->GetLabel(1),
+ bestCluster->GetLabel(2),
+ idclus)); // AdC
+
bestCluster->Use();
if (
(bestCluster->GetLabel(0)==TMath::Abs(trackTOFin->GetLabel()))
//Propagate the track to the best matched cluster
trackTOFin->PropagateTo(bestCluster);
+ // Fill the track residual histograms.
+ FillResiduals(trackTOFin,bestCluster,kFALSE);
//now take the local distance in Z from the pad center for time walk correction
Float_t tiltangle = AliTOFGeometry::GetAngles(bestCluster->GetDetInd(1),bestCluster->GetDetInd(2))*TMath::DegToRad();
return 1;
}
- TClonesArray dummy("AliTOFcluster",10000), *clusters=&dummy;
+ static TClonesArray dummy("AliTOFcluster",10000);
+ dummy.Clear();
+ TClonesArray *clusters=&dummy;
branch->SetAddress(&clusters);
cTree->GetEvent(0);
Int_t nc=clusters->GetEntriesFast();
fHDigNClus->Fill(nc);
+ AliInfo(Form("Number of clusters: %d",nc));
+
for (Int_t i=0; i<nc; i++) {
AliTOFcluster *c=(AliTOFcluster*)clusters->UncheckedAt(i);
fClusters[i]=new AliTOFcluster(*c); fN++;
//Init histos for Digits/Reco QA and Calibration
+ TDirectory *dir = gDirectory;
+ TFile *logFileTOF = 0;
+
+ TSeqCollection *list = gROOT->GetListOfFiles();
+ int n = list->GetEntries();
+ Bool_t isThere=kFALSE;
+ for(int i=0; i<n; i++) {
+ logFileTOF = (TFile*)list->At(i);
+ if (strstr(logFileTOF->GetName(), "TOFQA.root")){
+ isThere=kTRUE;
+ break;
+ }
+ }
+
+ if(!isThere)logFileTOF = new TFile( "TOFQA.root","RECREATE");
+ logFileTOF->cd();
+
//Digits "QA"
fHDigClusMap = new TH2F("TOFDig_ClusMap", "",182,0.5,182.5,864, 0.5,864.5);
fHDigNClus = new TH1F("TOFDig_NClus", "",200,0.5,200.5);
fHRecSigZVsP=new TH2F("TOFDig_SigZVsP", "",40,0.,4.,100, 0.,5.);
fHRecSigYVsPWin=new TH2F("TOFDig_SigYVsPWin", "",40,0.,4.,100, 0.,50.);
fHRecSigZVsPWin=new TH2F("TOFDig_SigZVsPWin", "",40,0.,4.,100, 0.,50.);
+
+ dir->cd();
+
}
//_________________________________________________________________________
}
}
+ if(!isThere) {
+ AliError(Form("File TOFQA.root not found!! not wring histograms...."));
+ return;
+ }
logFile->cd();
fHDigClusMap->Write(fHDigClusMap->GetName(), TObject::kOverwrite);
fHDigNClus->Write(fHDigNClus->GetName(), TObject::kOverwrite);
fHRecSigZVsPWin->Write(fHRecSigZVsPWin->GetName(), TObject::kOverwrite);
logFile->Flush();
- if(!isThere)logFileTOF = new TFile( "TOFQA.root","RECREATE");
- logFileTOF->cd();
- fHDigClusMap->Write(fHDigClusMap->GetName(), TObject::kOverwrite);
- fHDigNClus->Write(fHDigNClus->GetName(), TObject::kOverwrite);
- fHDigClusTime->Write(fHDigClusTime->GetName(), TObject::kOverwrite);
- fHDigClusToT->Write(fHDigClusToT->GetName(), TObject::kOverwrite);
- fHRecNClus->Write(fHRecNClus->GetName(), TObject::kOverwrite);
- fHRecChi2->Write(fHRecChi2->GetName(), TObject::kOverwrite);
- fHRecDistZ->Write(fHRecDistZ->GetName(), TObject::kOverwrite);
- fHRecSigYVsP->Write(fHRecSigYVsP->GetName(), TObject::kOverwrite);
- fHRecSigZVsP->Write(fHRecSigZVsP->GetName(), TObject::kOverwrite);
- fHRecSigYVsPWin->Write(fHRecSigYVsPWin->GetName(), TObject::kOverwrite);
- fHRecSigZVsPWin->Write(fHRecSigZVsPWin->GetName(), TObject::kOverwrite);
- logFileTOF->Flush();
-
dir->cd();
+
}
//_________________________________________________________________________
Float_t AliTOFtrackerV1::CorrectTimeWalk( Float_t dist, Float_t tof) {
}
return 0.;
}
+//_________________________________________________________________________
+
+void AliTOFtrackerV1::FillClusterArray(TObjArray* arr) const
+{
+ //
+ // Returns the TOF cluster array
+ //
+
+ if (fN==0)
+ arr = 0x0;
+ else
+ for (Int_t i=0; i<fN; ++i) arr->Add(fClusters[i]);
+
+}