#include <TFile.h>
#include <TH2F.h>
-//#include "AliAlignObj.h"
#include "AliGeomManager.h"
#include "AliESDtrack.h"
#include "AliESDEvent.h"
#include "AliTrackPointArray.h"
#include "AliCDBManager.h"
-#include "AliTOFcalib.h"
#include "AliTOFpidESD.h"
#include "AliTOFRecoParam.h"
+#include "AliTOFReconstructor.h"
#include "AliTOFcluster.h"
#include "AliTOFGeometry.h"
#include "AliTOFtracker.h"
// Gettimg the geometry
fGeom= new AliTOFGeometry();
- // 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;
-}
-//_____________________________________________________________________________
-AliTOFtracker::AliTOFtracker(const AliTOFtracker &t):
- AliTracker(),
- fRecoParam(0x0),
- fGeom(0x0),
- fPid(0x0),
- fN(0),
- fNseeds(0),
- fNseedsTOF(0),
- fngoodmatch(0),
- fnbadmatch(0),
- fnunmatch(0),
- fnmatch(0),
- fTracks(new TClonesArray("AliTOFtrack")),
- fSeeds(new TClonesArray("AliESDtrack")),
- fHDigClusMap(0x0),
- fHDigNClus(0x0),
- fHDigClusTime(0x0),
- fHDigClusToT(0x0),
- fHRecNClus(0x0),
- fHRecDist(0x0),
- fHRecSigYVsP(0x0),
- fHRecSigZVsP(0x0),
- fHRecSigYVsPWin(0x0),
- fHRecSigZVsPWin(0x0),
- fCalTree(0x0),
- fIch(-1),
- fToT(-1.),
- fTime(-1.),
- fExpTimePi(-1.),
- fExpTimeKa(-1.),
- fExpTimePr(-1.)
- {
- //AliTOFtracker 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;
-}
-//_____________________________________________________________________________
-AliTOFtracker& AliTOFtracker::operator=(const AliTOFtracker &t)
-{
- //AliTOFtracker 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->fGeom=t.fGeom;
- this->fPid = t.fPid;
- this->fSeeds=t.fSeeds;
- this->fTracks=t.fTracks;
- this->fN=t.fN;
- return *this;
+ InitCheckHists();
}
//_____________________________________________________________________________
// 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
Float_t * trackPos[4];
for (Int_t ii=0; ii<4; ii++) trackPos[ii] = new Float_t[nSteps];
- Int_t * clind[6];
- for (Int_t ii=0;ii<6;ii++) clind[ii] = new Int_t[fN];
+ Int_t * clind = new Int_t[fN];
for (Int_t iseed=0; iseed<fNseedsTOF; iseed++) {
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
+ }
Double_t dph=TMath::Abs(c->GetPhi()-phi);
if (dph>TMath::Pi()) dph-=2.*TMath::Pi();
Double_t cov2[3]= {dY*dY/12., 0., dZ*dZ/12.};
if (trackTOFin->AliExternalTrackParam::GetPredictedChi2(p,cov2) > maxChi2)continue;
- clind[0][nc] = c->GetDetInd(0);
- clind[1][nc] = c->GetDetInd(1);
- clind[2][nc] = c->GetDetInd(2);
- clind[3][nc] = c->GetDetInd(3);
- clind[4][nc] = c->GetDetInd(4);
- clind[5][nc] = k;
+ clind[nc] = k;
Char_t path[100];
Int_t ind[5];
- ind[0]=clind[0][nc];
- ind[1]=clind[1][nc];
- ind[2]=clind[2][nc];
- ind[3]=clind[3][nc];
- ind[4]=clind[4][nc];
+ ind[0]=c->GetDetInd(0);
+ ind[1]=c->GetDetInd(1);
+ ind[2]=c->GetDetInd(2);
+ ind[3]=c->GetDetInd(3);
+ ind[4]=c->GetDetInd(4);
fGeom->GetVolumePath(ind,path);
gGeoManager->cd(path);
global[nc] = *gGeoManager->GetCurrentMatrix();
Float_t dist3d[3];
accept=kFALSE;
for (Int_t i=0; i<nc; i++){
- Int_t cind[5];
- cind[0]= clind[0][i];
- cind[1]= clind[1][i];
- cind[2]= clind[2][i];
- cind[3]= clind[3][i];
- cind[4]= clind[4][i];
isInside=fGeom->IsInsideThePad(global[i],ctrackPos,dist3d);
if( mLastStep){
dist[nfound]=TMath::Sqrt(dist3d[0]*dist3d[0]+dist3d[1]*dist3d[1]+dist3d[2]*dist3d[2]);
distZ[nfound]=dist3d[2];
crecL[nfound]=trackPos[3][istep];
- index[nfound]=clind[5][i]; // store cluster id
+ index[nfound]=clind[i]; // store cluster id
cxpos[nfound]=AliTOFGeometry::RinTOF()+istep*0.1; //store prop.radius
nfound++;
if(accept &&!mLastStep)break;
// now choose the cluster to be matched with the track.
- Int_t idclus=0;
+ Int_t idclus=-1;
Float_t recL = 0.;
Float_t xpos=0.;
Float_t mindist=1000.;
AliTOFcluster *c=fClusters[idclus];
+
+ AliDebug(2, Form("%7i %7i %10i %10i %10i %10i %7i",
+ iseed,
+ fnmatch-1,
+ TMath::Abs(trackTOFin->GetLabel()),
+ c->GetLabel(0), c->GetLabel(1), c->GetLabel(2),
+ idclus)); // AdC
+
c->Use();
// Track length correction for matching Step 2
delete trackTOFout;
}
for (Int_t ii=0; ii<4; ii++) delete [] trackPos[ii];
- for (Int_t ii=0;ii<6;ii++) delete [] clind[ii];
+ delete [] clind;
}
//_________________________________________________________________________
//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();
+
fCalTree = new TTree("CalTree", "Tree for TOF calibration");
fCalTree->Branch("TOFchannelindex",&fIch,"iTOFch/I");
fCalTree->Branch("ToT",&fToT,"TOFToT/F");
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();
+
}
//_________________________________________________________________________
//write histos for Digits/Reco QA and Calibration
TDirectory *dir = gDirectory;
- TFile *logFile = 0;
TFile *logFileTOF = 0;
TSeqCollection *list = gROOT->GetListOfFiles();
int n = list->GetEntries();
- for(int i=0; i<n; i++) {
- logFile = (TFile*)list->At(i);
- if (strstr(logFile->GetName(), "AliESDs.root")) break;
- }
-
Bool_t isThere=kFALSE;
for(int i=0; i<n; i++) {
logFileTOF = (TFile*)list->At(i);
}
}
- logFile->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);
- fHRecDist->Write(fHRecDist->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);
- //fCalTree->Write(fCalTree->GetName(),TObject::kOverwrite);
- logFile->Flush();
-
- if(!isThere)logFileTOF = new TFile( "TOFQA.root","RECREATE");
+ if(!isThere) {
+ AliError(Form("File TOFQA.root not found!! not wring histograms...."));
+ return;
+ }
logFileTOF->cd();
fHDigClusMap->Write(fHDigClusMap->GetName(), TObject::kOverwrite);
fHDigNClus->Write(fHDigNClus->GetName(), TObject::kOverwrite);
}
return 0.;
}
+//_________________________________________________________________________
+
+void AliTOFtracker::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]);
+
+}