ClassImp(AliRsnCutESD2010)
-//Bool_t AliRsnCutESD2010::fgTOFcalibrateESD = kTRUE;
-Bool_t AliRsnCutESD2010::fgTOFcorrectTExp = kTRUE;
-Bool_t AliRsnCutESD2010::fgTOFuseT0 = kTRUE;
-Bool_t AliRsnCutESD2010::fgTOFtuneMC = kFALSE;
-Double_t AliRsnCutESD2010::fgTOFresolution = 100.0;
-AliTOFT0maker* AliRsnCutESD2010::fgTOFmaker = 0x0;
-AliTOFcalib* AliRsnCutESD2010::fgTOFcalib = 0x0;
-Int_t AliRsnCutESD2010::fgLastRun = -1;
-Int_t AliRsnCutESD2010::fgLastEventID = -1;
-
//_________________________________________________________________________________________________
AliRsnCutESD2010::AliRsnCutESD2010
(const char *name, Bool_t isMC) :
fESDtrackCutsTPC(),
fESDtrackCutsITS(),
fMinTOF(-3.0),
- fMaxTOF(3.0),
- fOCDBDefaultStorage("raw://")
+ fMaxTOF(3.0)
{
//
// Main constructor.
fESDtrackCutsTPC(copy.fESDtrackCutsTPC),
fESDtrackCutsITS(copy.fESDtrackCutsITS),
fMinTOF(copy.fMinTOF),
- fMaxTOF(copy.fMaxTOF),
- fOCDBDefaultStorage(copy.fOCDBDefaultStorage)
+ fMaxTOF(copy.fMaxTOF)
{
//
// Copy constructor.
fMinTOF = copy.fMinTOF;
fMaxTOF = copy.fMaxTOF;
fESDpid = copy.fESDpid;
- fOCDBDefaultStorage = copy.fOCDBDefaultStorage;
+
Int_t i = 0;
for (i = 0; i < 5; i++) fTPCpar[i] = copy.fTPCpar[i];
AliITSPIDResponse itsresponse(fIsMC);
fESDpid.GetITSResponse() = itsresponse;
-
- if (isMC) {
- //fgTOFcalibrateESD = kFALSE;
- fgTOFtuneMC = kTRUE;
- } else {
- //fgTOFcalibrateESD = kTRUE;
- fgTOFtuneMC = kFALSE;
- }
-}
-
-//_________________________________________________________________________________________________
-void AliRsnCutESD2010::ProcessEvent(AliESDEvent *esd)
-{
- // get current run
- Int_t run = esd->GetRunNumber();
-
- // if the run number has changed, update it now and give a message
- if (run != fgLastRun) {
- AliInfo("============================================================================================");
- AliInfo(Form("*** CHANGING RUN NUMBER: PREVIOUS = %d --> CURRENT = %d ***", fgLastRun, run));
- AliInfo("============================================================================================");
- fgLastRun = run;
-
- AliCDBManager::Instance()->SetDefaultStorage(fOCDBDefaultStorage.Data());
- AliCDBManager::Instance()->SetRun(fgLastRun);
-
- if (fgTOFmaker) delete fgTOFmaker;
- if (fgTOFcalib) delete fgTOFcalib;
-
- fgTOFcalib = new AliTOFcalib();
- if (fIsMC) {
- fgTOFcalib->SetRemoveMeanT0(kFALSE);
- fgTOFcalib->SetCalibrateTOFsignal(kFALSE);
- } else {
- fgTOFcalib->SetRemoveMeanT0(kTRUE);
- fgTOFcalib->SetCalibrateTOFsignal(kTRUE);
- }
- if (fgTOFcorrectTExp) fgTOFcalib->SetCorrectTExp(kTRUE);
- fgTOFcalib->Init();
-
- fgTOFmaker = new AliTOFT0maker(&fESDpid, fgTOFcalib);
- fgTOFmaker->SetTimeResolution(fgTOFresolution);
- }
-
- /*if (fgTOFcalibrateESD)*/ fgTOFcalib->CalibrateESD(esd);
- if (fgTOFtuneMC) fgTOFmaker->TuneForMC(esd);
- if (fgTOFuseT0) {
- fgTOFmaker->ComputeT0TOF(esd);
- fgTOFmaker->ApplyT0TOF(esd);
- fESDpid.MakePID(esd, kFALSE, 0.);
- }
}
//_________________________________________________________________________________________________
// if no reference event, skip
AliRsnEvent *rsn = AliRsnTarget::GetCurrentEvent();
if (!rsn) return kFALSE;
- if (fgLastEventID != rsn->GetLocalID()) {
- ProcessEvent(rsn->GetRefESD());
- fgLastEventID = rsn->GetLocalID();
- }
+ fESDpid.SetTOFResponse(rsn->GetRefESD(), AliESDpid::kTOF_T0);
// check quality and track type and reject tracks not passing this step
if (!OkQuality(track)) {
AliInfo(Form("ITS PID range (pt) : %f", fMaxITSPIDmom));
AliInfo(Form("TPC PID ranges (sigmas): %f %f", fMinTPCband, fMaxTPCband));
AliInfo(Form("TPC PID limit (p) : %f", fTPCpLimit));
- AliInfo(Form("TOF resolution : %f", fgTOFresolution));
AliInfo(Form("TOF range (sigmas) : %f - %f", fMinTOF, fMaxTOF));
- AliInfo(Form("TOF PID tuning from MC : %s", (fgTOFtuneMC ? "YES" : "NO")));
}
fMaxVz = copy.fMaxVz;
fMaxITSband = copy.fMaxITSband;
fMaxITSmom = copy.fMaxITSmom;
-
+
fTPCpLimit = copy.fTPCpLimit;
fMinTPCband = copy.fMinTPCband;
fMaxTPCband = copy.fMaxTPCband;
-
+
fESDtrackCutsTPC = copy.fESDtrackCutsTPC;
fESDtrackCutsITS = copy.fESDtrackCutsITS;
-
+
fTOFcalibrateESD = copy.fTOFcalibrateESD;
fTOFcorrectTExp = copy.fTOFcorrectTExp;
fTOFuseT0 = copy.fTOFuseT0;
fTOFtuneMC = copy.fTOFtuneMC;
fTOFresolution = copy.fTOFresolution;
-
+
SetUseMC(copy.fUseMC);
return (*this);
//
fUseMC = isMC;
-
+
if (isMC)
{
SetTPCpar(2.15898 / 50.0, 1.75295E1, 3.40030E-9, 1.96178, 3.91720);
//
// Create the output data container
//
-
+
// initialize random
//gRandom->SetSeed(0);
fLikeMM = (TH3F*)tmp->Clone("hMM");
fTrues = (TH3F*)tmp->Clone("hTR");
}
-
+
fHEvents->GetXaxis()->SetBinLabel(1, "Good vertex with tracks");
fHEvents->GetXaxis()->SetBinLabel(2, "Good vertex with SPD");
fHEvents->GetXaxis()->SetBinLabel(3, "Far vertex with tracks");
fOutList->Add(fLikePP);
fOutList->Add(fLikeMM);
fOutList->Add(fTrues);
-
+
// setup RSN-related objects
-
+
fRsnCuts.SetMC (fUseMC);
fRsnCuts.SetCheckITS (fCheckITS);
fRsnCuts.SetCheckTPC (fCheckTPC);
fRsnCuts.SetTPCrange(fMinTPCband, fMaxTPCband);
fRsnCuts.SetTPCpar(fTPCpar[0],fTPCpar[1],fTPCpar[2],fTPCpar[3],fTPCpar[4]);
//fRsnCuts.SetTOFcalibrateESD(fTOFcalibrateESD);
- fRsnCuts.SetTOFcorrectTExp (fTOFcorrectTExp);
- fRsnCuts.SetTOFuseT0 (fTOFuseT0);
- fRsnCuts.SetTOFtuneMC (fTOFtuneMC);
- fRsnCuts.SetTOFresolution (fTOFresolution);
+ //fRsnCuts.SetTOFcorrectTExp (fTOFcorrectTExp);
+ //fRsnCuts.SetTOFuseT0 (fTOFuseT0);
+ //fRsnCuts.SetTOFtuneMC (fTOFtuneMC);
+ //fRsnCuts.SetTOFresolution (fTOFresolution);
fRsnCuts.SetTOFrange (fMinTOF, fMaxTOF);
fRsnCuts.GetCutsTPC()->Copy(fESDtrackCutsTPC);
fRsnCuts.GetCutsITS()->Copy(fESDtrackCutsITS);
// retrieve ESD event and related stack (if available)
AliESDEvent *esd = dynamic_cast<AliESDEvent*>(fInputEvent);
AliStack *stack = (fMCEvent ? fMCEvent->Stack() : 0x0);
-
+
// check the event
Int_t eval = EventEval(esd);
fHEvents->Fill(eval);
-
+
// if the event is good for analysis, process it
if (eval == kGoodTracksPrimaryVertex || eval == kGoodSPDPrimaryVertex)
{
ProcessESD(esd, stack);
}
-
+
// update histogram container
PostData(1, fOutList);
}
static Int_t evNum = 0;
evNum++;
-
+
// reject empty events
Int_t ntracks = esd->GetNumberOfTracks();
if (!ntracks) return kEmptyEvent;
-
+
// get the best primary vertex:
// first try the one with tracks
const AliESDVertex *vTrk = esd->GetPrimaryVertexTracks();
fVertexX[0]->Fill(vTrk->GetXv());
fVertexY[0]->Fill(vTrk->GetYv());
fVertexZ[0]->Fill(vTrk->GetZv());
-
+
// check VZ position
if (vzTrk <= fMaxVz)
return kGoodTracksPrimaryVertex;
fVertexX[1]->Fill(vSPD->GetXv());
fVertexY[1]->Fill(vSPD->GetYv());
fVertexZ[1]->Fill(vSPD->GetZv());
-
+
// check VZ position
if (vzSPD <= fMaxVz)
return kGoodSPDPrimaryVertex;
static Int_t lastRun = -1;
static Int_t evnum = 0;
evnum++;
-
+
// get current run
Int_t run = esd->GetRunNumber();
-
+
// if absent, initialize ESD pid response
if (!fESDpid)
{
AliITSPIDResponse itsresponse(fUseMC);
-
+
fESDpid = new AliESDpid;
fESDpid->GetTPCResponse().SetBetheBlochParameters(fTPCpar[0],fTPCpar[1],fTPCpar[2],fTPCpar[3],fTPCpar[4]);
fESDpid->GetITSResponse() = itsresponse;
AliInfo(Form("*** CHANGING RUN NUMBER: PREVIOUS = %d --> CURRENT = %d ***", lastRun, run));
AliInfo("============================================================================================");
lastRun = run;
-
+
AliCDBManager::Instance()->SetDefaultStorage("raw://");
AliCDBManager::Instance()->SetRun(lastRun);
-
+
if (fTOFmaker) delete fTOFmaker;
if (fTOFcalib) delete fTOFcalib;
-
+
fTOFcalib = new AliTOFcalib();
if (fTOFcorrectTExp) fTOFcalib->SetCorrectTExp(kTRUE);
fTOFcalib->Init();
-
+
fTOFmaker = new AliTOFT0maker(fESDpid, fTOFcalib);
fTOFmaker->SetTimeResolution(fTOFresolution);
}
fTOFmaker->ApplyT0TOF(esd);
fESDpid->MakePID(esd, kFALSE, 0.);
}
-
+
// RSN event
AliRsnEvent event;
event.SetRef(esd);
event.SetRefMC(fMCEvent);
//fRsnCuts.ProcessEvent(esd);
-
+
// loop on all tracks
Int_t i1, i2, label, pdg, ntracks = esd->GetNumberOfTracks();
Bool_t okTrack;
AliMCParticle *p1 = 0x0, *p2 = 0x0;
AliESDtrack *t1 = 0x0, *t2 = 0x0;
TLorentzVector v1, v2, vsum, vref;
-
+
// external loop (T1)
for (i1 = 0; i1 < ntracks; i1++)
{
t1 = esd->GetTrack(i1);
if (!t1) continue;
-
+
// setup RSN
fDaughter.SetRef(t1);
if (stack)
}
fDaughter.SetMass(kmass);
v1.SetXYZM(t1->Px(), t1->Py(), t1->Pz(), kmass);
-
+
// check track
okTrack = OkTrack(t1, AliPID::kKaon);
-
+
// internal loop (T2)
for (i2 = i1+1; i2 < ntracks; i2++)
{
t2 = esd->GetTrack(i2);
if (!t2) continue;
-
+
// check track
if (!OkTrack(t2, AliPID::kKaon)) continue;
-
+
// if unlike pair, check if it is true
pdg = 0;
if ((t1->Charge() == t2->Charge()) && p1 && p2)
// If tracks of any type are not flagged to be used, they are rejected anyway.
//
- if (IsITSTPC(track))
+ if (IsITSTPC(track))
return fESDtrackCutsTPC.IsSelected(track);
else if (IsITSSA (track))
{
- if (fAddITSSA)
+ if (fAddITSSA)
return fESDtrackCutsITS.IsSelected(track);
else
return kFALSE;
// reject not ITS standalone tracks
if (!IsITSSA(track)) return kFALSE;
-
+
// count PID layers and reject if they are too few
Int_t k, nITSpidLayers = 0;
UChar_t itsCluMap = track->GetITSClusterMap();
AliDebug(AliLog::kDebug+2, "Rejecting track with too few ITS pid layers");
return kFALSE;
}
-
+
// check the track type (ITS+TPC or ITS standalone)
// and reject it if it is of none of the allowed types
Bool_t isSA = kFALSE;
AliWarning("Track is neither ITS+TPC nor ITS standalone");
return kFALSE;
}
-
+
// create the PID response object and compute nsigma
AliITSPIDResponse &itsrsp = fESDpid->GetITSResponse();
Double_t mom = track->P();
Double_t nSigma = itsrsp.GetNumberOfSigmas(mom, track->GetITSsignal(), pid, nITSpidLayers, isSA);
-
+
// evaluate the cut
Bool_t ok = (TMath::Abs(nSigma) <= fMaxITSband);
-
+
// debug message
AliDebug(AliLog::kDebug + 2, Form("ITS nsigma = %f -- max = %f -- cut %s", nSigma, fMaxITSband, (ok ? "passed" : "failed")));
-
+
// outcome
return ok;
}
// setup TPC PID response
AliTPCPIDResponse &tpcrsp = fESDpid->GetTPCResponse();
tpcrsp.SetBetheBlochParameters(fTPCpar[0],fTPCpar[1],fTPCpar[2],fTPCpar[3],fTPCpar[4]);
-
+
// get momentum and number of sigmas and choose the reference band
Double_t mom = track->GetInnerParam()->P();
Double_t nSigma = tpcrsp.GetNumberOfSigmas(mom, track->GetTPCsignal(), track->GetTPCsignalN(), pid);
Double_t maxNSigma = fMaxTPCband;
if (mom < fTPCpLimit) maxNSigma = fMinTPCband;
-
+
// evaluate the cut
Bool_t ok = (TMath::Abs(nSigma) <= maxNSigma);
-
+
// debug message
AliDebug(AliLog::kDebug + 2, Form("TPC nsigma = %f -- max = %f -- cut %s", nSigma, maxNSigma, (ok ? "passed" : "failed")));
-
+
// outcome
return ok;
}
// reject not TOF-matched tracks
if (!MatchTOF(track)) return kFALSE;
-
+
// setup TOF PID response
AliTOFPIDResponse &tofrsp = fESDpid->GetTOFResponse();
-
+
// get info for computation
Double_t momentum = track->P();
Double_t time = track->GetTOFsignal();
Double_t timeDiff = time - timeint[(Int_t)pid];
Double_t sigmaRef = tofrsp.GetExpectedSigma(momentum, timeint[(Int_t)pid], AliPID::ParticleMass(pid));
Double_t nSigma = timeDiff / sigmaRef;
-
+
// evaluate the cut
Bool_t ok = (nSigma >= fMinTOF && nSigma <= fMaxTOF);
-
+
// debug message
AliDebug(AliLog::kDebug + 2, Form("TOF nsigma = %f -- range = %f - %f -- cut %s", nSigma, fMinTOF, fMaxTOF, (ok ? "passed" : "failed")));
//if (print) cout << Form("**PHI** TOF nsigma = %f -- range = %f - %f -- cut %s", nSigma, fMinTOF, fMaxTOF, (ok ? "passed" : "failed")) << endl;
-
+
// outcome
return ok;
}
//printf("[PHI] Track %4d: REJECTED\n", i);
return kFALSE;
}
-
+
// ITS PID can be checked always
// if PID is not required, the flag is sed as
- // if the cut was alsways passed
+ // if the cut was alsways passed
okITS = OkITSPID(track, AliPID::kKaon);
if (!fCheckITS) okITS = kTRUE;
-
+
// TPC PID can be checked only for TPC+ITS tracks
// if PID is not required, the flag is sed as
// if the cut was alsways passed
okTPC = kFALSE;
if (IsITSTPC(track)) okTPC = OkTPCPID(track, AliPID::kKaon);
if (!fCheckTPC) okTPC = kTRUE;
-
+
// TOF PID can be checked only if TOF is matched
// if PID is not required, the flag is sed as
// if the cut was alsways passed
okTOF = kFALSE;
if (IsITSTPC(track) && MatchTOF(track)) okTOF = OkTOFPID(track, AliPID::kKaon);
if (!fCheckTOF) okTOF = kTRUE;
-
+
// now combine all outcomes according to the different possibilities:
// -- ITS standalone:
// --> only ITS PID, always
return kFALSE;
}
}
-
+
// this point is reached only if function didn't exit before due to somecheck not passed
return kTRUE;
}