From 5faf5a07766ed0ffd52f070f1d9560e3dd2330c5 Mon Sep 17 00:00:00 2001 From: pulvir Date: Fri, 10 Dec 2010 09:59:03 +0000 Subject: [PATCH] Implemented a static AliRsnEvent pointer to point to the current event being analyzed in order to remove such a pointer as datamembers of many classes which depend on it. Most classes having a pointer to AliRsnEven for this purposes have been reviewed to remove it. In AliRsnAnalysisManager, improved the double loop on particles to run on a single event. Reviewed the AliRsnCutESD2010 after some interexchange of informations with TOF group. --- PWG2/RESONANCES/AliRsnAnalysisEffSE.cxx | 114 +-- PWG2/RESONANCES/AliRsnAnalysisEffSE.h | 1 + PWG2/RESONANCES/AliRsnAnalysisME.cxx | 5 +- PWG2/RESONANCES/AliRsnAnalysisManager.cxx | 92 +- PWG2/RESONANCES/AliRsnAnalysisManager.h | 6 +- PWG2/RESONANCES/AliRsnAnalysisPhi7TeV.cxx | 848 ++++++++---------- PWG2/RESONANCES/AliRsnAnalysisPhi7TeV.h | 103 ++- PWG2/RESONANCES/AliRsnAnalysisSE.cxx | 143 ++- PWG2/RESONANCES/AliRsnAnalysisSE.h | 27 +- PWG2/RESONANCES/AliRsnCut.cxx | 4 +- PWG2/RESONANCES/AliRsnCutAOD2010.cxx | 4 +- PWG2/RESONANCES/AliRsnCutESD2010.cxx | 165 ++-- PWG2/RESONANCES/AliRsnCutESD2010.h | 74 +- PWG2/RESONANCES/AliRsnCutManager.cxx | 13 - PWG2/RESONANCES/AliRsnCutManager.h | 4 +- PWG2/RESONANCES/AliRsnCutPrimaryVertex.cxx | 25 +- PWG2/RESONANCES/AliRsnCutSet.cxx | 17 +- PWG2/RESONANCES/AliRsnCutSet.h | 4 +- PWG2/RESONANCES/AliRsnEvent.cxx | 26 +- PWG2/RESONANCES/AliRsnEvent.h | 23 +- PWG2/RESONANCES/AliRsnFunction.cxx | 20 - PWG2/RESONANCES/AliRsnFunction.h | 1 - PWG2/RESONANCES/AliRsnPair.cxx | 31 +- PWG2/RESONANCES/AliRsnPair.h | 4 +- PWG2/RESONANCES/AliRsnPairFunctions.cxx | 18 - PWG2/RESONANCES/AliRsnPairFunctions.h | 1 - PWG2/RESONANCES/AliRsnPairNtuple.cxx | 20 +- PWG2/RESONANCES/AliRsnPairNtuple.h | 1 - PWG2/RESONANCES/AliRsnTarget.cxx | 13 +- PWG2/RESONANCES/AliRsnTarget.h | 18 +- PWG2/RESONANCES/AliRsnVATProcessInfo.cxx | 5 +- PWG2/RESONANCES/AliRsnVATProcessInfo.h | 2 +- PWG2/RESONANCES/AliRsnVAnalysisTaskSE.cxx | 236 ++--- PWG2/RESONANCES/AliRsnVAnalysisTaskSE.h | 45 +- PWG2/RESONANCES/AliRsnValue.cxx | 25 +- PWG2/RESONANCES/AliRsnValue.h | 1 + .../train/LHC2010-7TeV-phi/AddRsnAnalysis.C | 3 +- .../LHC2010-7TeV-phi/AddRsnAnalysisMult.C | 81 +- .../train/LHC2010-7TeV-phi/QualityCutsITS.C | 31 + .../train/LHC2010-7TeV-phi/QualityCutsTPC.C | 33 + .../macros/train/LHC2010-7TeV-phi/RsnConfig.C | 234 +++-- .../train/LHC2010-7TeV-phi/RsnConfigDipNoSA.C | 2 +- .../train/LHC2010-7TeV-phi/RsnConfigDipSA.C | 2 +- .../train/LHC2010-7TeV-phi/RsnConfigNoSA.C | 2 +- .../train/LHC2010-7TeV-phi/RsnConfigSA.C | 2 +- 45 files changed, 1226 insertions(+), 1303 deletions(-) create mode 100644 PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/QualityCutsITS.C create mode 100644 PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/QualityCutsTPC.C diff --git a/PWG2/RESONANCES/AliRsnAnalysisEffSE.cxx b/PWG2/RESONANCES/AliRsnAnalysisEffSE.cxx index 817cee3b34b..0761193e8ba 100644 --- a/PWG2/RESONANCES/AliRsnAnalysisEffSE.cxx +++ b/PWG2/RESONANCES/AliRsnAnalysisEffSE.cxx @@ -180,82 +180,7 @@ void AliRsnAnalysisEffSE::RsnUserExec(Option_t*) // Execution of the analysis task. // Recovers the input event and processes it with all included pair objects. // In this case, we NEED to have ESD and MC, otherwise we cannod do anything. -//ULTIMO UNDO -/* - AliRsnDaughter trk; - for (Int_t i = 0; i <= AliPID::kSPECIES; i++) - { - cout << AliPID::ParticleName((AliPID::EParticleType)i) << ": " << endl; - for (Int_t m = 0; m < AliRsnDaughter::kMethods; m++) - { - cout << "-- method: " << AliRsnDaughter::MethodName((AliRsnDaughter::EPIDMethod)m) << endl; - Char_t sign[2] = {'+', '-'}; - for (Int_t s = 0; s < 2; s++) - { - TArrayI *a = fRsnPIDIndex.GetTracksArray((AliRsnDaughter::EPIDMethod)m, sign[s], (AliPID::EParticleType)i); - Int_t n = a->GetSize(); - for (Int_t j = 0; j < n; j++) - { - Int_t k = a->At(j); - cout << "-- -- track " << Form("%4d ", k) << ": "; - fRsnEvent.SetDaughter(trk, k); - cout << "charge = " << (trk.IsPos() ? "+ " : (trk.IsNeg() ? "- " : "0 ")); - cout << "truePID = " << Form("%10s ", AliPID::ParticleName(trk.PerfectPID())); - cout << "realPID = " << Form("%10s ", AliPID::ParticleName(trk.RealisticPID())); - cout << endl; - cout << "-- -- -- weights (computed): "; - for (Int_t q = 0; q < AliPID::kSPECIES; q++) - cout << Form("%15.12f", trk.ComputedWeights()[q]) << ' '; - cout << endl; - cout << "-- -- -- weights (original): "; - for (Int_t q = 0; q < AliPID::kSPECIES; q++) - cout << Form("%15.12f", trk.GetRef()->PID()[q]) << ' '; - cout << endl; - } - } - } - } return; - */ - - AliDebug(AliLog::kDebug+2,"<-"); - if (fMCOnly && fMCEvent) - { - fRsnEvent.SetRef (fMCEvent); - fRsnEvent.SetRefMC(fMCEvent); - } - else if (fESDEvent) - { - fRsnEvent.SetRef (fESDEvent); - fRsnEvent.SetRefMC(fMCEvent); - } - else if (fAODEventOut) - { - fRsnEvent.SetRef (fAODEventOut); - fRsnEvent.SetRefMC(fAODEventOut); - } - else if (fAODEventIn) - { - fRsnEvent.SetRef (fAODEventIn); - fRsnEvent.SetRefMC(fAODEventIn); - } - else { - AliError("NO ESD or AOD object!!! Skipping ..."); - return; - } - - // if general event cuts are added to the task (recommended) - // they are checked here on the RSN event interface and, - // if the event does not pass them, it is skipped and ProcessInfo - // is updated accordingly - if (!fEventCuts.IsSelected(&fRsnEvent)) - { - fTaskInfo.SetEventUsed(kFALSE); - return; - } - - // if cuts are passed or not cuts were defined, - // update the task info before processing the event - fTaskInfo.SetEventUsed(kTRUE); +// // process first MC steps and then ESD steps AliRsnPairDef *pairDef = 0; @@ -268,8 +193,6 @@ void AliRsnAnalysisEffSE::RsnUserExec(Option_t*) // Post the data PostData(2, fOutList); - - AliDebug(AliLog::kDebug+2,"->"); } //_____________________________________________________________________________ @@ -587,7 +510,7 @@ void AliRsnAnalysisEffSE::FillContainer(AliCFContainer *cont, const TObjArray *s for (istep = 0; istep < nSteps; istep++) { AliRsnCutManager *cutMgr = (AliRsnCutManager*)stepList->At(istep); - cutMgr->SetEvent(&fRsnEvent); + AliRsnTarget::SwitchToFirst(); if (!cutMgr->PassCommonDaughterCuts(&fDaughter[0])) break; if (!cutMgr->PassCommonDaughterCuts(&fDaughter[1])) break; if (!cutMgr->PassDaughter1Cuts(&fDaughter[0])) break; @@ -875,3 +798,36 @@ TArrayI AliRsnAnalysisEffSE::FindAODtracks(Int_t label, AliAODEvent *aod) return array; } +//______________________________________________________________________________ +Bool_t AliRsnAnalysisEffSE::EventProcess() +{ +// +// Customized event pre-processing. +// First checks if the current event passes all cuts, +// and if it does, updates the informations and then +// call the operations which are already defined in the +// omonyme function in mother class +// + + // initially, an event is expected to be bad + fTaskInfo.SetEventUsed(kFALSE); + + // check the event cuts and update the info data accordingly + // events not passing the cuts must be rejected + if (!fEventCuts.IsSelected(&fRsnEvent)) + { + fTaskInfo.SetEventUsed(kFALSE); + return kFALSE; + } + + // if we reach this point, cuts were passed; + // then additional operations can be done + + // find leading particle (without any PID/momentum restriction) + fRsnEvent.SelectLeadingParticle(0); + + // final return value is positive + // but call the mother class method which updates info object + fTaskInfo.SetEventUsed(kTRUE); + return AliRsnVAnalysisTaskSE::EventProcess(); +} diff --git a/PWG2/RESONANCES/AliRsnAnalysisEffSE.h b/PWG2/RESONANCES/AliRsnAnalysisEffSE.h index 43eb68e588d..5e2df07101d 100644 --- a/PWG2/RESONANCES/AliRsnAnalysisEffSE.h +++ b/PWG2/RESONANCES/AliRsnAnalysisEffSE.h @@ -43,6 +43,7 @@ class AliRsnAnalysisEffSE : public AliRsnVAnalysisTaskSE virtual void RsnUserCreateOutputObjects(); virtual void RsnUserExec(Option_t*); virtual void RsnTerminate(Option_t*); + virtual Bool_t EventProcess(); // settings AliRsnCutSet* GetEventCuts() {return &fEventCuts;} diff --git a/PWG2/RESONANCES/AliRsnAnalysisME.cxx b/PWG2/RESONANCES/AliRsnAnalysisME.cxx index e8aea7bb4cb..951b10a51af 100644 --- a/PWG2/RESONANCES/AliRsnAnalysisME.cxx +++ b/PWG2/RESONANCES/AliRsnAnalysisME.cxx @@ -140,8 +140,11 @@ void AliRsnAnalysisME::DoAODMixing(AliAODEvent* aod1, AliAODEvent* aod2) fEventMix.SetRef(aod2); if (fEvent.GetMultiplicity() < 2) return; if (fEventMix.GetMultiplicity() < 2) return; + + AliRsnEvent::SetCurrentEvent1(&fEvent); + AliRsnEvent::SetCurrentEvent2(&fEventMix); - fRsnAnalysisManager.ProcessAllPairs(&fEvent, &fEventMix); + fRsnAnalysisManager.ProcessAllPairs(); PostData(2, fOutList); AliDebug(AliLog::kDebug, Form("AOD tracks %d", aod1->GetNumberOfTracks())); diff --git a/PWG2/RESONANCES/AliRsnAnalysisManager.cxx b/PWG2/RESONANCES/AliRsnAnalysisManager.cxx index 17b7960d5cc..358256c8c22 100644 --- a/PWG2/RESONANCES/AliRsnAnalysisManager.cxx +++ b/PWG2/RESONANCES/AliRsnAnalysisManager.cxx @@ -129,10 +129,6 @@ void AliRsnAnalysisManager::InitAllPairs(TList *list) AliDebug(AliLog::kDebug+2,"<-"); -// TList *list = new TList(); -// list->SetName(GetName()); -// list->SetOwner(); - AliRsnPair *pair = 0; TObjArrayIter next(&fPairs); Int_t i = 0; @@ -146,61 +142,74 @@ void AliRsnAnalysisManager::InitAllPairs(TList *list) TH1I *hPairUsed = new TH1I(Form("_%s_USED", pair->GetName()), "Used events for pair", 2, 0, 2); list->Add(hPairUsed); } - AliDebug(AliLog::kDebug+2, "->"); -// return list; - + fList = list; + + AliDebug(AliLog::kDebug+2, "->"); } //_____________________________________________________________________________ -void AliRsnAnalysisManager::ProcessAllPairs(AliRsnEvent *ev0, AliRsnEvent *ev1) +void AliRsnAnalysisManager::ProcessAllPairs() { // // Process one or two events for all pair managers. // + static Int_t evnum = 0; + evnum++; + AliDebug(AliLog::kDebug+2,"<-"); - if (!ev1) ev1 = ev0; + // skip if the global event pointers are NULL + if (!AliRsnEvent::IsCurrentEvent1()) return; + if (!AliRsnEvent::IsCurrentEvent2()) return; + // for better readability, reference two pointers to the current events + AliRsnEvent *ev0 = AliRsnEvent::GetCurrentEvent1(); + AliRsnEvent *ev1 = AliRsnEvent::GetCurrentEvent2(); + + // count total number of candidates per event + // (sum of tracks, V0s and cascades) Int_t nTot[2]; - nTot[0] = ev0->GetAbsoluteSum(); - nTot[1] = ev1->GetAbsoluteSum(); + nTot[0] = AliRsnEvent::GetCurrentEvent1()->GetAbsoluteSum(); + nTot[1] = AliRsnEvent::GetCurrentEvent2()->GetAbsoluteSum(); - // external loop - // joins the loop on tracks and v0s, by looping the indexes from 0 - // to the sum of them, and checking what to take depending of its value - // in this step, the global cuts are checked - Int_t i0, i1, i, realIndex; + // variables + Int_t i0, i1, i, start, index0, index1; AliRsnDaughter daughter0, daughter1; AliRsnPair *pair = 0x0; TObjArrayIter next(&fPairs); - AliRsnDaughter::ERefType type; + AliRsnDaughter::ERefType type0, type1; - // reset all counters + // reset all counters which tell us + // how many entries were added now while ((pair = (AliRsnPair*)next())) { pair->ResetCount(); } + // external loop for (i0 = 0; i0 < nTot[0]; i0++) { // assign first track - if (!ev0->ConvertAbsoluteIndex(i0, realIndex, type)) continue; - ev0->SetDaughter(daughter0, realIndex, type); + if (!ev0->ConvertAbsoluteIndex(i0, index0, type0)) continue; + ev0->SetDaughter(daughter0, index0, type0); // check global cuts if (!fGlobalTrackCuts.IsSelected(&daughter0)) continue; + + // define start depending if we are processing one or two events + start = (AliRsnEvent::SameEvent() ? i0 + 1 : 0); // internal loop (same criterion) - for (i1 = 0; i1 < nTot[1]; i1++) + for (i1 = start; i1 < nTot[1]; i1++) { // if looking same event, skip the case when the two indexes are equal - if (ev0 == ev1 && i0 == i1) continue; + // if (AliRsnEvent::SameEvent() && i0 == i1) continue; // assign second track - if (!ev1->ConvertAbsoluteIndex(i1, realIndex, type)) continue; - ev1->SetDaughter(daughter1, realIndex, type); + if (!ev1->ConvertAbsoluteIndex(i1, index1, type1)) continue; + ev1->SetDaughter(daughter1, index1, type1); // check global cuts if (!fGlobalTrackCuts.IsSelected(&daughter1)) continue; @@ -215,12 +224,17 @@ void AliRsnAnalysisManager::ProcessAllPairs(AliRsnEvent *ev0, AliRsnEvent *ev1) // if the pair is a like-sign, skip the case when i1 < i0, // in order not to double count each like-sign pair // (equivalent to looping from i0+1 to ntracks) - if (pair->GetPairDef()->IsLikeSign() && i1 < i0) continue; + // if (AliRsnEvent::SameEvent() && pair->GetPairDef()->IsLikeSign() && i1 < i0) continue; // process the two tracks - if (!pair->Fill(&daughter0, &daughter1, ev0, ev1)) continue; - pair->SetEvent(ev0); - pair->Compute(); + if (pair->Fill(&daughter0, &daughter1)) + { + pair->Compute(); + } + else if (pair->Fill(&daughter1, &daughter0)) + { + pair->Compute(); + } } } } @@ -239,7 +253,7 @@ void AliRsnAnalysisManager::ProcessAllPairs(AliRsnEvent *ev0, AliRsnEvent *ev1) } //_____________________________________________________________________________ -void AliRsnAnalysisManager::ProcessAllPairsMC(AliRsnEvent *ev0, AliRsnEvent *ev1) +void AliRsnAnalysisManager::ProcessAllPairsMC() { // // Process one or two events for all pair managers. @@ -247,8 +261,15 @@ void AliRsnAnalysisManager::ProcessAllPairsMC(AliRsnEvent *ev0, AliRsnEvent *ev1 AliDebug(AliLog::kDebug+2,"<-"); - if (!ev1) ev1 = ev0; + // skip if the global event pointers are NULL + if (!AliRsnEvent::IsCurrentEvent1()) return; + if (!AliRsnEvent::IsCurrentEvent2()) return; + // for better readability, reference two pointers to the current events + AliRsnEvent *ev0 = AliRsnEvent::GetCurrentEvent1(); + AliRsnEvent *ev1 = AliRsnEvent::GetCurrentEvent2(); + + // this time the number of tracks comes from MC Int_t nTracks[2]; nTracks[0] = ev0->GetRefMC()->GetNumberOfTracks(); nTracks[1] = ev1->GetRefMC()->GetNumberOfTracks(); @@ -256,7 +277,7 @@ void AliRsnAnalysisManager::ProcessAllPairsMC(AliRsnEvent *ev0, AliRsnEvent *ev1 // external loop // joins the loop on tracks and v0s, by looping the indexes from 0 // to the sum of them, and checking what to take depending of its value - Int_t i0, i1, i; + Int_t i0, i1, start, i; Bool_t filled; AliRsnDaughter daughter0, daughter1; AliRsnPair *pair = 0x0; @@ -275,12 +296,15 @@ void AliRsnAnalysisManager::ProcessAllPairsMC(AliRsnEvent *ev0, AliRsnEvent *ev1 // assign first track ev0->SetDaughterMC(daughter0, i0); + + // define start depending if we are processing one or two events + start = (AliRsnEvent::SameEvent() ? i0 + 1 : 0); // internal loop (same criterion) - for (i1 = 0; i1 < nTracks[1]; i1++) + for (i1 = start; i1 < nTracks[1]; i1++) { // if looking same event, skip the case when the two indexes are equal - if (ev0 == ev1 && i0 == i1) continue; + if (AliRsnEvent::SameEvent() && i0 == i1) continue; // skip not physical primaries if (!ev1->GetRefMCESD()->Stack()->IsPhysicalPrimary(i1)) continue; @@ -301,7 +325,7 @@ void AliRsnAnalysisManager::ProcessAllPairsMC(AliRsnEvent *ev0, AliRsnEvent *ev1 if (pair->GetPairDef()->IsLikeSign() && i1 < i0) continue; // process the two tracks - filled = pair->Fill(&daughter0, &daughter1, ev0, ev1); + filled = pair->Fill(&daughter0, &daughter1); if (!filled) continue; pair->Compute(); } diff --git a/PWG2/RESONANCES/AliRsnAnalysisManager.h b/PWG2/RESONANCES/AliRsnAnalysisManager.h index f4dd876647a..97867559181 100644 --- a/PWG2/RESONANCES/AliRsnAnalysisManager.h +++ b/PWG2/RESONANCES/AliRsnAnalysisManager.h @@ -40,15 +40,15 @@ class AliRsnAnalysisManager : public TNamed virtual void Print(Option_t *option = "") const; void InitAllPairs(TList*list); - void ProcessAllPairs(AliRsnEvent *ev0, AliRsnEvent *ev1); - void ProcessAllPairsMC(AliRsnEvent *ev0, AliRsnEvent *ev1); + void ProcessAllPairs(); + void ProcessAllPairsMC(); AliRsnCutSet* GetGlobalTrackCuts() {return &fGlobalTrackCuts;} private: TList *fList; // container for output histograms (external object) TObjArray fPairs; // collection of pair objects for the different outputs - AliRsnCutSet fGlobalTrackCuts; // a set of cuts which are applied to all tracks for all analysis, in order to put only once + AliRsnCutSet fGlobalTrackCuts; // a set of cuts which are applied to all tracks for all analysis ClassDef(AliRsnAnalysisManager, 1) }; diff --git a/PWG2/RESONANCES/AliRsnAnalysisPhi7TeV.cxx b/PWG2/RESONANCES/AliRsnAnalysisPhi7TeV.cxx index 1ca7fd11d82..179e904028f 100644 --- a/PWG2/RESONANCES/AliRsnAnalysisPhi7TeV.cxx +++ b/PWG2/RESONANCES/AliRsnAnalysisPhi7TeV.cxx @@ -8,6 +8,8 @@ #include #include "TH1.h" +#include "TH3.h" +#include "TFile.h" #include "TTree.h" #include "TParticle.h" #include "TRandom.h" @@ -18,6 +20,7 @@ #include "AliESDEvent.h" #include "AliESDVertex.h" #include "AliESDtrack.h" +#include "AliESDtrackCuts.h" #include "AliStack.h" #include "AliMCEvent.h" #include "AliTOFT0maker.h" @@ -25,49 +28,54 @@ #include "AliCDBManager.h" #include "AliITSPIDResponse.h" +#include "AliRsnEvent.h" +#include "AliRsnTarget.h" +#include "AliRsnDaughter.h" +#include "AliRsnCutESD2010.h" + #include "AliRsnAnalysisPhi7TeV.h" //__________________________________________________________________________________________________ -AliRsnAnalysisPhi7TeV::AliRsnAnalysisPhi7TeV(const char *name) : +AliRsnAnalysisPhi7TeV::AliRsnAnalysisPhi7TeV(const char *name, Bool_t isMC) : AliAnalysisTaskSE(name), fUseMC(kFALSE), fCheckITS(kTRUE), fCheckTPC(kTRUE), fCheckTOF(kTRUE), - fPDG(0), - fCh(0), - fIM(0.0), - fPt(0.0), - fY(0.0), - fEta(0.0), + fAddITSSA(kFALSE), fMaxVz(1E6), fMaxITSband(1E6), + fMaxITSmom(0.0), fTPCpLimit(0.35), fMinTPCband(-1E6), fMaxTPCband( 1E6), - fRsnTreeComp(0x0), - fRsnTreeTrue(0x0), + fMinTOF(-3.0), + fMaxTOF( 3.0), fOutList(0x0), + fUnlike(0x0), + fLikePP(0x0), + fLikeMM(0x0), + fTrues(0x0), fHEvents(0x0), fESDtrackCutsTPC(), fESDtrackCutsITS(), fESDpid(0x0), fTOFmaker(0x0), fTOFcalib(0x0), - fTOFcalibrateESD(kFALSE), - fTOFcorrectTExp(kFALSE), - fTOFuseT0(kFALSE), - fTOFtuneMC(kFALSE), - fTOFresolution(0.0) - + fTOFcalibrateESD(!isMC), + fTOFcorrectTExp(kTRUE), + fTOFuseT0(kTRUE), + fTOFtuneMC(isMC), + fTOFresolution(100.0), + fDaughter(), + fRsnCuts() { // // Constructor // - DefineOutput(1, TTree::Class()); - DefineOutput(2, TTree::Class()); - DefineOutput(3, TList::Class()); + SetUseMC(isMC); + DefineOutput(1, TList::Class()); } //__________________________________________________________________________________________________ @@ -77,20 +85,20 @@ AliRsnAnalysisPhi7TeV::AliRsnAnalysisPhi7TeV(const AliRsnAnalysisPhi7TeV& copy) fCheckITS(copy.fCheckITS), fCheckTPC(copy.fCheckTPC), fCheckTOF(copy.fCheckTOF), - fPDG(0), - fCh(0), - fIM(0.0), - fPt(0.0), - fY(0.0), - fEta(0.0), + fAddITSSA(copy.fAddITSSA), fMaxVz(copy.fMaxVz), fMaxITSband(copy.fMaxITSband), + fMaxITSmom(copy.fMaxITSmom), fTPCpLimit(copy.fTPCpLimit), fMinTPCband(copy.fMinTPCband), fMaxTPCband(copy.fMaxTPCband), - fRsnTreeComp(0x0), - fRsnTreeTrue(0x0), + fMinTOF(copy.fMinTOF), + fMaxTOF(copy.fMaxTOF), fOutList(0x0), + fUnlike(0x0), + fLikePP(0x0), + fLikeMM(0x0), + fTrues(0x0), fHEvents(0x0), fESDtrackCutsTPC(copy.fESDtrackCutsTPC), fESDtrackCutsITS(copy.fESDtrackCutsITS), @@ -101,11 +109,15 @@ AliRsnAnalysisPhi7TeV::AliRsnAnalysisPhi7TeV(const AliRsnAnalysisPhi7TeV& copy) fTOFcorrectTExp(kFALSE), fTOFuseT0(kFALSE), fTOFtuneMC(kFALSE), - fTOFresolution(0.0) + fTOFresolution(0.0), + fDaughter(), + fRsnCuts() { // // Copy constructor // + + SetUseMC(copy.fUseMC); } //__________________________________________________________________________________________________ @@ -119,9 +131,11 @@ AliRsnAnalysisPhi7TeV& AliRsnAnalysisPhi7TeV::operator=(const AliRsnAnalysisPhi7 fCheckITS = copy.fCheckITS; fCheckTPC = copy.fCheckTPC; fCheckTOF = copy.fCheckTOF; + fAddITSSA = copy.fAddITSSA; fMaxVz = copy.fMaxVz; fMaxITSband = copy.fMaxITSband; + fMaxITSmom = copy.fMaxITSmom; fTPCpLimit = copy.fTPCpLimit; fMinTPCband = copy.fMinTPCband; @@ -135,6 +149,8 @@ AliRsnAnalysisPhi7TeV& AliRsnAnalysisPhi7TeV::operator=(const AliRsnAnalysisPhi7 fTOFuseT0 = copy.fTOFuseT0; fTOFtuneMC = copy.fTOFtuneMC; fTOFresolution = copy.fTOFresolution; + + SetUseMC(copy.fUseMC); return (*this); } @@ -144,12 +160,30 @@ AliRsnAnalysisPhi7TeV::~AliRsnAnalysisPhi7TeV() { // // Destructor +// +} + +//_________________________________________________________________________________________________ +void AliRsnAnalysisPhi7TeV::SetUseMC(Bool_t isMC) +{ +// +// Sets some aspects of cuts depending on the fact that runs on MC or not // - if (fRsnTreeComp) delete fRsnTreeComp; - if (fRsnTreeTrue) delete fRsnTreeTrue; - if (fHEvents) delete fHEvents; - if (fESDpid) delete fESDpid; + fUseMC = isMC; + + if (isMC) + { + SetTPCpar(2.15898 / 50.0, 1.75295E1, 3.40030E-9, 1.96178, 3.91720); + SetTOFcalibrateESD(kFALSE); + SetTOFtuneMC(kTRUE); + } + else + { + SetTPCpar(1.41543 / 50.0, 2.63394E1, 5.0411E-11, 2.12543, 4.88663); + SetTOFcalibrateESD(kTRUE); + SetTOFtuneMC(kFALSE); + } } //__________________________________________________________________________________________________ @@ -158,54 +192,40 @@ void AliRsnAnalysisPhi7TeV::UserCreateOutputObjects() // // Create the output data container // - - // setup TPC response - fESDpid = new AliESDpid; - fESDpid->GetTPCResponse().SetBetheBlochParameters(fTPCpar[0],fTPCpar[1],fTPCpar[2],fTPCpar[3],fTPCpar[4]); - - // setup TOF maker & calibration - fTOFcalib = new AliTOFcalib; - fTOFmaker = new AliTOFT0maker(fESDpid, fTOFcalib); - fTOFmaker->SetTimeResolution(fTOFresolution); // initialize random - gRandom->SetSeed(0); + //gRandom->SetSeed(0); // create output trees OpenFile(1); - fRsnTreeComp = new TTree("rsnTree", "Pairs"); - - fRsnTreeComp->Branch("pdg", &fPDG, "pdg/S" ); - fRsnTreeComp->Branch("ch" , &fCh , "ch/S" ); - fRsnTreeComp->Branch("im" , &fIM , "im/F" ); - fRsnTreeComp->Branch("y" , &fY , "y/F" ); - fRsnTreeComp->Branch("pt" , &fPt , "pt/F" ); - fRsnTreeComp->Branch("eta", &fEta, "eta/F" ); - fRsnTreeComp->Branch("its", &fITS, "its[2]/S"); - - OpenFile(2); - fRsnTreeTrue = new TTree("rsnTrue", "True pairs"); - - fRsnTreeTrue->Branch("im" , &fIM , "im/F" ); - fRsnTreeTrue->Branch("y" , &fY , "y/F" ); - fRsnTreeTrue->Branch("pt" , &fPt , "pt/F" ); - fRsnTreeTrue->Branch("eta", &fEta, "eta/F"); - - OpenFile(3); fOutList = new TList; - fHEvents = new TH1I("hEvents", "Event details", 5, 0, 5); + fHEvents = new TH1I("hEvents", "Event details", 6, 0, 6); fVertexX[0] = new TH1F("hVertexTracksX", "X position of primary vertex (tracks)", 200, -2, 2); fVertexY[0] = new TH1F("hVertexTracksY", "Y position of primary vertex (tracks)", 200, -2, 2); fVertexZ[0] = new TH1F("hVertexTracksZ", "Z position of primary vertex (tracks)", 400, -40, 40); fVertexX[1] = new TH1F("hVertexSPDX", "X position of primary vertex (SPD)", 200, -2, 2); fVertexY[1] = new TH1F("hVertexSPDY", "Y position of primary vertex (SPD)", 200, -2, 2); fVertexZ[1] = new TH1F("hVertexSPDZ", "Z position of primary vertex (SPD)", 400, -40, 40); + //fUnlike = new TH3F("hPM", "+- pairs", 500, 0.9, 1.4, 100, 0.0, 10.0, 24, -1.2, 1.2); + //fLikePP = new TH3F("hPP", "++ pairs", 500, 0.9, 1.4, 100, 0.0, 10.0, 24, -1.2, 1.2); + //fLikeMM = new TH3F("hMM", "-- pairs", 500, 0.9, 1.4, 100, 0.0, 10.0, 24, -1.2, 1.2); + //fTrues = new TH3F("hTR", "True pairs", 500, 0.9, 1.4, 100, 0.0, 10.0, 24, -1.2, 1.2); + TFile *ffile = TFile::Open("template.root"); + if (ffile) + { + TH3F *tmp = (TH3F*)ffile->Get("template"); + fUnlike = (TH3F*)tmp->Clone("hPM"); + fLikePP = (TH3F*)tmp->Clone("hPP"); + 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"); fHEvents->GetXaxis()->SetBinLabel(4, "Far vertex with SPD"); fHEvents->GetXaxis()->SetBinLabel(5, "No good vertex"); + fHEvents->GetXaxis()->SetBinLabel(6, "Empty event"); fOutList->Add(fHEvents); fOutList->Add(fVertexX[0]); @@ -214,6 +234,33 @@ void AliRsnAnalysisPhi7TeV::UserCreateOutputObjects() fOutList->Add(fVertexX[1]); fOutList->Add(fVertexY[1]); fOutList->Add(fVertexZ[1]); + fOutList->Add(fUnlike); + fOutList->Add(fLikePP); + fOutList->Add(fLikeMM); + fOutList->Add(fTrues); + + // setup RSN-related objects + + fRsnCuts.SetMC (fUseMC); + fRsnCuts.SetCheckITS (fCheckITS); + fRsnCuts.SetCheckTPC (fCheckTPC); + fRsnCuts.SetCheckTOF (fCheckTOF); + fRsnCuts.SetUseITSTPC(kTRUE); + fRsnCuts.SetUseITSSA (fAddITSSA); + fRsnCuts.SetPID (AliPID::kKaon); + fRsnCuts.SetMaxITSPIDmom(fMaxITSmom); + fRsnCuts.SetITSband(fMaxITSband); + fRsnCuts.SetTPCpLimit(fTPCpLimit); + 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.SetTOFrange (fMinTOF, fMaxTOF); + fRsnCuts.GetCutsTPC()->Copy(fESDtrackCutsTPC); + fRsnCuts.GetCutsITS()->Copy(fESDtrackCutsITS); } //__________________________________________________________________________________________________ @@ -228,9 +275,6 @@ void AliRsnAnalysisPhi7TeV::UserExec(Option_t *) // 3 -- event bad // - static Int_t evNum = 0; - evNum++; - // retrieve ESD event and related stack (if available) AliESDEvent *esd = dynamic_cast(fInputEvent); AliStack *stack = (fMCEvent ? fMCEvent->Stack() : 0x0); @@ -243,11 +287,10 @@ void AliRsnAnalysisPhi7TeV::UserExec(Option_t *) if (eval == kGoodTracksPrimaryVertex || eval == kGoodSPDPrimaryVertex) { ProcessESD(esd, stack); - ProcessMC(stack); } // update histogram container - PostData(3, fOutList); + PostData(1, fOutList); } //__________________________________________________________________________________________________ @@ -269,12 +312,16 @@ Int_t AliRsnAnalysisPhi7TeV::EventEval(AliESDEvent *esd) 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(); const AliESDVertex *vSPD = esd->GetPrimaryVertexSPD(); - Double_t vzTrk = 1000.0; - Double_t vzSPD = 1000.0; + Double_t vzTrk = 1000000.0; + Double_t vzSPD = 1000000.0; Int_t ncTrk = -1; Int_t ncSPD = -1; if (vTrk) ncTrk = (Int_t)vTrk->GetNContributors(); @@ -320,452 +367,355 @@ void AliRsnAnalysisPhi7TeV::ProcessESD // static Int_t lastRun = -1; - - // ITS stuff #1 create the response function - Bool_t isMC = (stack != 0x0); - AliITSPIDResponse itsrsp(isMC); - - // TOF stuff #1: init OCDB + 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; + } + + // if the run number has changed, update it now and give a message if (run != lastRun) { - cout << "Run = " << run << " -- LAST = " << lastRun << endl; + AliInfo("============================================================================================"); + AliInfo(Form("*** CHANGING RUN NUMBER: PREVIOUS = %d --> CURRENT = %d ***", lastRun, run)); + AliInfo("============================================================================================"); lastRun = run; - AliCDBManager *cdb = AliCDBManager::Instance(); - cdb->SetDefaultStorage("raw://"); - cdb->SetRun(run); - fTOFcalib->SetCorrectTExp(fTOFcorrectTExp); + + 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); } - //AliCDBManager *cdb = AliCDBManager::Instance(); - //cdb->SetDefaultStorage("raw://"); - //cdb->SetRun(run); - // TOF stuff #2: init calibration - //fTOFcalib->SetCorrectTExp(fTOFcorrectTExp); - //fTOFcalib->Init(); - // TOF stuff #3: calibrate + if (fTOFcalibrateESD) fTOFcalib->CalibrateESD(esd); if (fTOFtuneMC) fTOFmaker->TuneForMC(esd); - if (fTOFuseT0) + if (fTOFuseT0) { fTOFmaker->ComputeT0TOF(esd); fTOFmaker->ApplyT0TOF(esd); fESDpid->MakePID(esd, kFALSE, 0.); } - // TOF stuff #4: define fixed function for compatibility range - Double_t a1 = 0.01, a2 = -0.03; - Double_t b1 = 0.25, b2 = 0.25; - Double_t c1 = 0.05, c2 = -0.03; - Double_t ymax, ymin; - - // prepare to look on all tracks to select the ones - // which pass all the cuts - Int_t ntracks = esd->GetNumberOfTracks(); - TArrayI pos(ntracks); - TArrayI neg(ntracks); - TArrayI itspos(ntracks); - TArrayI itsneg(ntracks); + + // RSN event + AliRsnEvent event; + event.SetRef(esd); + event.SetRefMC(fMCEvent); + //fRsnCuts.ProcessEvent(esd); // loop on all tracks - ULong_t status; - Int_t i, k, charge, npos = 0, nneg = 0, nITS; - Double_t times[10], tpcNSigma, tpcMaxNSigma, itsSignal, itsNSigma, mom, tofTime, tofSigma, tofRef, tofDiff, tofRel; - Bool_t okQuality, okTOF, okTPC, okITS, okTrack, isTPC, isITSSA; - UChar_t itsCluMap; - for (i = 0; i < ntracks; i++) + Int_t i1, i2, label, pdg, ntracks = esd->GetNumberOfTracks(); + Bool_t okTrack; + AliPID pid; + Double_t kmass = pid.ParticleMass(AliPID::kKaon); + Double_t phimass = 1.019455; + Double_t angle, cosangle; + AliMCParticle *p1 = 0x0, *p2 = 0x0; + AliESDtrack *t1 = 0x0, *t2 = 0x0; + TLorentzVector v1, v2, vsum, vref; + + // external loop (T1) + for (i1 = 0; i1 < ntracks; i1++) { - AliESDtrack *track = esd->GetTrack(i); - if (!track) continue; - - // get commonly used variables - status = (ULong_t)track->GetStatus(); - mom = track->P(); - isTPC = ((status & AliESDtrack::kTPCin) != 0); - isITSSA = ((status & AliESDtrack::kTPCin) == 0 && (status & AliESDtrack::kITSrefit) != 0 && (status & AliESDtrack::kITSpureSA) == 0 && (status & AliESDtrack::kITSpid) != 0); - //cout << isTPC << ' ' << isITSSA << endl; + t1 = esd->GetTrack(i1); + if (!t1) continue; - // accept only tracks which are TPC+ITS or ITS standalone - if (!isTPC && !isITSSA) continue; + // setup RSN + fDaughter.SetRef(t1); + if (stack) + { + p1 = (AliMCParticle*)fMCEvent->GetTrack(TMath::Abs(t1->GetLabel())); + if (p1) fDaughter.SetRefMC(p1); + } + fDaughter.SetMass(kmass); + v1.SetXYZM(t1->Px(), t1->Py(), t1->Pz(), kmass); - // define selection properties depending on track type - // it track is standard TPC+ITS+TOF track, check standard cuts and TOF - // if the track is an ITS standalone, check its specific cuts only - okTrack = kTRUE; + // check track + okTrack = OkTrack(t1, AliPID::kKaon); - if (isTPC) + // internal loop (T2) + for (i2 = i1+1; i2 < ntracks; i2++) { - // check standard ESD cuts - okQuality = fESDtrackCutsTPC.IsSelected(track); - //cout << "GLOBAL -- quality = " << (okQuality ? "GOOD" : "BAD") << endl; - if (!okQuality) continue; + t2 = esd->GetTrack(i2); + if (!t2) continue; - // check TPC dE/dx - if (fCheckTPC) - { - tpcNSigma = TMath::Abs(fESDpid->NumberOfSigmasTPC(track, AliPID::kKaon)); - if (track->GetInnerParam()->P() > fTPCpLimit) tpcMaxNSigma = fMinTPCband; else tpcMaxNSigma = fMaxTPCband; - okTPC = (tpcNSigma <= tpcMaxNSigma); - //cout << "ALT -- TPC -- nsigma = " << tpcNSigma << ", max = " << tpcMaxNSigma << " --> " << (okTPC ? "OK" : "FAILED") << endl; - //cout << "ALTTPC -- " << fTPCpar[0] << ' ' << fTPCpar[1] << ' ' << fTPCpar[2] << ' ' << fTPCpar[3] << ' ' << fTPCpar[4] << endl; - } - else + // 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) { - okTPC = kTRUE; - } - - // check TOF (only if momentum is large than function asymptote and flags are OK) - if (fCheckTOF) - { - if (((status & AliESDtrack::kTOFout) != 0) && ((status & AliESDtrack::kTIME) != 0) && mom > TMath::Max(b1, b2)) + TParticle *part1 = p1->Particle(); + TParticle *part2 = p2->Particle(); + if (TMath::Abs(part1->GetPdgCode()) == 321 && TMath::Abs(part2->GetPdgCode()) == 321 && part1->GetFirstMother() == part2->GetFirstMother()) { - track->GetIntegratedTimes(times); - tofTime = (Double_t)track->GetTOFsignal(); - tofSigma = fTOFmaker->GetExpectedSigma(mom, times[AliPID::kKaon], AliPID::ParticleMass(AliPID::kKaon)); - tofRef = times[AliPID::kKaon]; - if (tofRef > 0.0) + label = part1->GetFirstMother(); + if (label >= 0 && label < stack->GetNtrack()) { - tofDiff = (tofTime - tofRef); - tofRel = (tofTime - tofRef) / tofRef; - ymax = a1 / (mom - b1) + c1; - ymin = a2 / (mom - b2) + c2; - okTOF = (tofRel >= ymin && tofRel <= ymax); - //cout << "TOF -- diff = " << tofDiff << ", rel diff = " << tofRel << ", range = " << ymin << " to " << ymax << ", sigma = " << tofSigma << " --> " << (okTOF ? "OK" : "FAILED") << endl; + TParticle *mum = stack->Particle(label); + pdg = mum->GetPdgCode(); } - else - { - okTOF = kTRUE; - //cout << "TOF -- not checked due to ZERO reference time" << endl; - } - } - else - { - okTOF = kTRUE; - //cout << "TOF -- not checked because TOF pid absent" << endl; } } - else + pdg = TMath::Abs(pdg); + + // combine momenta + v1.SetXYZM(t1->Px(), t1->Py(), t1->Pz(), kmass); + v2.SetXYZM(t2->Px(), t2->Py(), t2->Pz(), kmass); + angle = v1.Angle(v2.Vect()); + cosangle = TMath::Abs(TMath::Cos(angle)); + if (cosangle <= 0.02) continue; + vsum = v1 + v2; + vref.SetXYZM(vsum.X(), vsum.Y(), vsum.Z(), phimass); + + // fill appropriate histogram + if (t1->Charge() != t2->Charge()) { - okTOF = kTRUE; + fUnlike->Fill(vsum.M(), vsum.Perp(), vref.Rapidity()); + if (pdg == 333) fTrues->Fill(vsum.M(), vsum.Perp(), vref.Rapidity()); } - - okTrack = okQuality && okTPC && okTOF; - //cout << "GLOBAL -- overall = " << (okTrack ? "ACCEPTED" : "REJECTED") << endl; - } - else - { - // check standard ESD cuts - okQuality = fESDtrackCutsITS.IsSelected(track); - //cout << "ITSSA -- quality = " << (okQuality ? "GOOD" : "BAD") << endl; - if (!okQuality) continue; - - // check dE/dx - if (fCheckITS) + else if (t1->Charge() > 0) { - itsSignal = track->GetITSsignal(); - itsCluMap = track->GetITSClusterMap(); - nITS = 0; - for(k = 2; k < 6; k++) if(itsCluMap & (1 << k)) ++nITS; - if (nITS < 3) - { - okITS = kFALSE; - //cout << "ITS -- not checked due to too few PID clusters" << endl; - } - else - { - itsNSigma = itsrsp.GetNumberOfSigmas(mom, itsSignal, AliPID::kKaon, nITS, kTRUE); - okITS = (TMath::Abs(itsNSigma) <= fMaxITSband); - //cout << "ITS -- nsigma = " << itsNSigma << ", max = " << fMaxITSband << " --> " << (okITS ? "OK" : "FAILED") << endl; - } + fLikePP->Fill(vsum.M(), vsum.Perp(), vref.Rapidity()); } else { - okITS = kTRUE; + fLikeMM->Fill(vsum.M(), vsum.Perp(), vref.Rapidity()); } - - okTrack = okQuality && okITS; - //cout << "ITSSA -- overall = " << (okTrack ? "ACCEPTED" : "REJECTED") << endl; - } - - // skip tracks not passing cuts - if (!okTrack) continue; - - // if all checks are passed, add the track index in one of the - // charged tracks arrays - charge = (Int_t)track->Charge(); - if (charge > 0) - { - pos[npos] = i; - if (isITSSA) itspos[npos] = 1; else itspos[npos] = 0; - npos++; - } - else if (charge < 0) - { - neg[nneg] = i; - if (isITSSA) itsneg[nneg] = 1; else itsneg[nneg] = 0; - nneg++; } } - - // resize arrays accordingly - pos.Set(npos); - neg.Set(nneg); - itspos.Set(npos); - itsneg.Set(nneg); - - /* - // fill unlike-sign - Int_t i1, i2; - for (i1 = 0; i1 < npos; i1++) - for (i2 = 0; i2 < nneg; i2++) - AddEntryFromESD(esd, i1, i2, itspos[i1], itsneg[i2], 0, stack); - - // fill ++ like-sign - for (i1 = 0; i1 < npos; i1++) - for (i2 = i1 + 1; i2 < npos; i2++) - AddEntryFromESD(esd, i1, i2, itspos[i1], itspos[i2], 1, 0x0); - - // fill -- like-sign - for (i1 = 0; i1 < nneg; i1++) - for (i2 = i1 + 1; i2 < nneg; i2++) - AddEntryFromESD(esd, i1, i2, itsneg[i1], itsneg[i2], -1, 0x0); - */ - - // loop on unlike-sign pairs to compute invariant mass signal - Int_t ip, in, lp, ln; - AliPID pid; - Double_t kmass = pid.ParticleMass(AliPID::kKaon); - Double_t phimass = 1.019455; - TParticle *partp = 0x0, *partn = 0x0; - AliESDtrack *tp = 0x0, *tn = 0x0; - TLorentzVector vp, vn, vsum, vref; - for (ip = 0; ip < npos; ip++) - { - tp = esd->GetTrack(pos[ip]); - lp = TMath::Abs(tp->GetLabel()); - if (stack) partp = stack->Particle(lp); - for (in = 0; in < nneg; in++) - { - if (pos[ip] == neg[in]) - { - AliError("POS = NEG"); - continue; - } - tn = esd->GetTrack(neg[in]); - ln = TMath::Abs(tn->GetLabel()); - if (stack) partn = stack->Particle(ln); + PostData(1, fOutList); +} - fPDG = 0; - if (partp && partn) - { - if (partp->GetFirstMother() == partn->GetFirstMother()) - { - if (partp->GetFirstMother() > 0) - { - TParticle *mum = stack->Particle(partp->GetFirstMother()); - fPDG = mum->GetPdgCode(); - } - } - } - fPDG = TMath::Abs(fPDG); +//______________________________________________________________________________ +Bool_t AliRsnAnalysisPhi7TeV::OkQuality(AliESDtrack *track) +{ +// +// Check track quality parameters. +// Rejects all tracks which are not either TPC+ITS nor ITS standalone. +// If tracks of any type are not flagged to be used, they are rejected anyway. +// - vp.SetXYZM(tp->Px(), tp->Py(), tp->Pz(), kmass); - vn.SetXYZM(tn->Px(), tn->Py(), tn->Pz(), kmass); - vsum = vp + vn; - vref.SetXYZM(vsum.X(), vsum.Y(), vsum.Z(), phimass); + if (IsITSTPC(track)) + return fESDtrackCutsTPC.IsSelected(track); + else if (IsITSSA (track)) + { + if (fAddITSSA) + return fESDtrackCutsITS.IsSelected(track); + else + return kFALSE; + } + else + return kFALSE; +} - fCh = 0; - fIM = (Float_t)vsum.M(); - fPt = (Float_t)vsum.Perp(); - fEta = (Float_t)vsum.Eta(); - fY = (Float_t)vref.Rapidity(); - fITS[0] = itspos[ip]; - fITS[1] = itsneg[in]; +//______________________________________________________________________________ +Bool_t AliRsnAnalysisPhi7TeV::OkITSPID (AliESDtrack *track, AliPID::EParticleType pid) +{ +// +// Check ITS particle identification with 3sigma cut +// - //if (fIM < 0.9 || fIM > 1.4) continue; - //if (fPt < 0.0 || fPt > 20.0) continue; - - fRsnTreeComp->Fill(); - } - } - - // loop on like-sign pairs to compute invariant mass background - Int_t i1, i2; - AliESDtrack *t1 = 0x0, *t2 = 0x0; - TLorentzVector v1, v2; + // reject not ITS standalone tracks + if (!IsITSSA(track)) return kFALSE; - // pos-pos - for (i1 = 0; i1 < npos; i1++) + // count PID layers and reject if they are too few + Int_t k, nITSpidLayers = 0; + UChar_t itsCluMap = track->GetITSClusterMap(); + for(k = 2; k < 6; k++) if(itsCluMap & (1 << k)) ++nITSpidLayers; + if (nITSpidLayers < 3) { - t1 = esd->GetTrack(pos[i1]); - - for (i2 = i1+1; i2 < npos; i2++) - { - t2 = esd->GetTrack(pos[i2]); - - v1.SetXYZM(t1->Px(), t1->Py(), t1->Pz(), kmass); - v2.SetXYZM(t2->Px(), t2->Py(), t2->Pz(), kmass); - vsum = v1 + v2; - vref.SetXYZM(vsum.X(), vsum.Y(), vsum.Z(), phimass); - - fPDG = 0; - fCh = 1; - fIM = (Float_t)vsum.M(); - fPt = (Float_t)vsum.Perp(); - fEta = (Float_t)vsum.Eta(); - fY = (Float_t)vref.Rapidity(); - fITS[0] = itspos[i1]; - fITS[1] = itspos[i2]; - - //if (fIM < 0.9 || fIM > 1.4) continue; - //if (fPt < 0.0 || fPt > 20.0) continue; - - fRsnTreeComp->Fill(); - } + AliDebug(AliLog::kDebug+2, "Rejecting track with too few ITS pid layers"); + return kFALSE; } - // neg-neg - for (i1 = 0; i1 < nneg; i1++) + + // 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; + if (IsITSTPC(track)) isSA = kFALSE; + else if (IsITSSA(track)) isSA = kTRUE; + else { - t1 = esd->GetTrack(neg[i1]); - - for (i2 = i1+1; i2 < nneg; i2++) - { - t2 = esd->GetTrack(neg[i2]); + 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; +} - v1.SetXYZM(t1->Px(), t1->Py(), t1->Pz(), kmass); - v2.SetXYZM(t2->Px(), t2->Py(), t2->Pz(), kmass); - vsum = v1 + v2; - vref.SetXYZM(vsum.X(), vsum.Y(), vsum.Z(), phimass); +//______________________________________________________________________________ +Bool_t AliRsnAnalysisPhi7TeV::OkTPCPID (AliESDtrack *track, AliPID::EParticleType pid) +{ +// +// Check TPC particle identification with {3|5}sigmacut, +// depending on the track total momentum. +// - fPDG = 0; - fCh = -1; - fIM = (Float_t)vsum.M(); - fPt = (Float_t)vsum.Perp(); - fEta = (Float_t)vsum.Eta(); - fY = (Float_t)vref.Rapidity(); - fITS[0] = itsneg[i1]; - fITS[1] = itsneg[i2]; - - //if (fIM < 0.9 || fIM > 1.4) continue; - //if (fPt < 0.0 || fPt > 20.0) continue; - - fRsnTreeComp->Fill(); - } - } + // reject not TPC tracks + if (!IsITSTPC(track)) return kFALSE; - PostData(1, fRsnTreeComp); + // 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; } -//__________________________________________________________________________________________________ -void AliRsnAnalysisPhi7TeV::AddEntryFromESD(AliESDEvent *esd, Int_t i1, Int_t i2, Int_t its1, Int_t its2, Short_t charge, AliStack *stack) +//______________________________________________________________________________ +Bool_t AliRsnAnalysisPhi7TeV::OkTOFPID (AliESDtrack *track, AliPID::EParticleType pid) { // -// Add an entry to the output TTree computed from two tracks in the ESD +// Check TOF particle identification if matched there. // - // loop on unlike-sign pairs to compute invariant mass signal - AliPID pid; - Double_t kmass = pid.ParticleMass(AliPID::kKaon); - Double_t phimass = 1.019455; - TLorentzVector v1, v2, vsum, vref; + // reject not TOF-matched tracks + if (!MatchTOF(track)) return kFALSE; - AliESDtrack *t1 = esd->GetTrack(i1); - AliESDtrack *t2 = esd->GetTrack(i2); - - v1.SetXYZM(t1->Px(), t1->Py(), t1->Pz(), kmass); - v2.SetXYZM(t2->Px(), t2->Py(), t2->Pz(), kmass); - vsum = v1 + v2; - vref.SetXYZM(vsum.X(), vsum.Y(), vsum.Z(), phimass); + // setup TOF PID response + AliTOFPIDResponse &tofrsp = fESDpid->GetTOFResponse(); - // if stack is present, search for true pair - fPDG = 0; - Int_t l1 = TMath::Abs(t1->GetLabel()); - Int_t l2 = TMath::Abs(t2->GetLabel()); - if (stack) - { - TParticle *part1 = stack->Particle(l1); - TParticle *part2 = stack->Particle(l2); - if (part1 && part2) - { - if (part1->GetFirstMother() == part2->GetFirstMother()) - { - if (part1->GetFirstMother() > 0) - { - TParticle *mum = stack->Particle(part1->GetFirstMother()); - fPDG = mum->GetPdgCode(); - } - } - } - } + // get info for computation + Double_t momentum = track->P(); + Double_t time = track->GetTOFsignal(); + Double_t timeint[AliPID::kSPECIES]; + tofrsp.GetStartTime(momentum); + track->GetIntegratedTimes(timeint); + + // check the cut + 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; - fPDG = TMath::Abs(fPDG); - fCh = charge; - fIM = (Float_t)vsum.M(); - fPt = (Float_t)vsum.Perp(); - fEta = (Float_t)vsum.Eta(); - fY = (Float_t)vref.Rapidity(); - fITS[0] = its1; - fITS[1] = its2; - - //if (fIM < 0.9 || fIM > 1.4) return; - //if (fPt < 0.0 || fPt > 20.0) return; - - fRsnTreeComp->Fill(); -} + // evaluate the cut + Bool_t ok = (nSigma >= fMinTOF && nSigma <= fMaxTOF); -//__________________________________________________________________________________________________ -void AliRsnAnalysisPhi7TeV::ProcessMC(AliStack *stack) + // 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; +} + +//______________________________________________________________________________ +Bool_t AliRsnAnalysisPhi7TeV::OkTrack(AliESDtrack *track, AliPID::EParticleType pid) { // -// Function to process stack only +// Global track cut check // - if (!stack) return; - Int_t nPart = stack->GetNtrack(); - - // loop to compute invariant mass - Int_t ip, in; - AliPID pid; - Double_t kmass = pid.ParticleMass(AliPID::kKaon); - Double_t phimass = 1.019455; - TParticle *partp = 0x0, *partn = 0x0; - TLorentzVector vp, vn, vsum, vref; + Bool_t okITS, okTPC, okTOF; - for (ip = 0; ip < nPart; ip++) + // check quality and track type and reject tracks not passing this step + if (!OkQuality(track)) { - partp = stack->Particle(ip); - if (partp->GetPdgCode() != 321) continue; - - for (in = 0; in < nPart; in++) + AliDebug(AliLog::kDebug+2, "Failed quality cut"); + //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 + 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 + // -- ITS + TPC: + // --> ITS PID, only for momenta lower than 'fMaxITSPIDmom' and when the ITSpid flag is active + // --> TPC PID, always --> MASTER (first to be checked, if fails, track is rejected) + // --> TOF PID, only if matched + if (IsITSSA(track)) + { + if (!okITS) { - partn = stack->Particle(in); - if (partn->GetPdgCode() != -321) continue; - - fPDG = 0; - if (partp->GetFirstMother() == partn->GetFirstMother()) - { - if (partp->GetFirstMother() > 0) - { - TParticle *mum = stack->Particle(partp->GetFirstMother()); - fPDG = mum->GetPdgCode(); - } - } - fPDG = TMath::Abs(fPDG); - if (fPDG != 333) continue; - - vp.SetXYZM(partp->Px(), partp->Py(), partp->Pz(), kmass); - vn.SetXYZM(partn->Px(), partn->Py(), partn->Pz(), kmass); - vsum = vp + vn; - vref.SetXYZM(vsum.X(), vsum.Y(), vsum.Z(), phimass); - - fIM = (Float_t)vsum.M(); - fPt = (Float_t)vsum.Perp(); - fEta = (Float_t)vsum.Eta(); - fY = (Float_t)vref.Rapidity(); - - fRsnTreeTrue->Fill(); + AliDebug(AliLog::kDebug+2, "ITS standalone track --> ITS PID failed"); + //printf("[PHI] Track %4d: REJECTED\n", i); + return kFALSE; } } - - PostData(2, fRsnTreeTrue); + else // checking IsITSTPC() is redundant due to OkQuality() cut check + { + if (!okTPC) + { + AliDebug(AliLog::kDebug+2, "ITS+TPC track --> TPC PID failed"); + //printf("[PHI] Track %4d: REJECTED\n", i); + return kFALSE; + } + else if (MatchTOF(track) && !okTOF) + { + AliDebug(AliLog::kDebug+2, "ITS+TPC track --> TOF matched but TOF PID failed"); + //printf("[PHI] Track %4d: REJECTED\n", i); + return kFALSE; + } + else if (track->IsOn(AliESDtrack::kITSpid) && track->P() <= fMaxITSmom && !okITS) + { + AliDebug(AliLog::kDebug+2, Form("ITS+TPC track --> Momentum lower than limit (%.2f) and ITS PID failed", fMaxITSmom)); + //printf("[PHI] Track %4d: REJECTED\n", i); + return kFALSE; + } + } + + // this point is reached only if function didn't exit before due to somecheck not passed + return kTRUE; } diff --git a/PWG2/RESONANCES/AliRsnAnalysisPhi7TeV.h b/PWG2/RESONANCES/AliRsnAnalysisPhi7TeV.h index ff0739457ee..7e8599c6e1d 100644 --- a/PWG2/RESONANCES/AliRsnAnalysisPhi7TeV.h +++ b/PWG2/RESONANCES/AliRsnAnalysisPhi7TeV.h @@ -7,12 +7,16 @@ #ifndef ALIRSNANALYSISPHI7TEV_H #define ALIRSNANALYSISPHI7TEV_H +#include "AliRsnDaughter.h" +#include "AliRsnCutESD2010.h" #include "AliAnalysisTaskSE.h" #include "AliRsnTOFT0maker.h" #include "AliESDtrackCuts.h" +#include "AliPID.h" class TH1I; class TH1F; +class TH3F; class TTree; class AliStack; @@ -33,22 +37,24 @@ class AliRsnAnalysisPhi7TeV : public AliAnalysisTaskSE kFarTracksPrimaryVertex = 2, kFarSPDPrimaryVertex = 3, kNoGoodPrimaryVertex = 4, - kEvaluations = 5 + kEmptyEvent = 5 }; - AliRsnAnalysisPhi7TeV(const char *name = "Phi7TeV"); + AliRsnAnalysisPhi7TeV(const char *name = "Phi7TeV", Bool_t isMC = kFALSE); AliRsnAnalysisPhi7TeV(const AliRsnAnalysisPhi7TeV& copy); AliRsnAnalysisPhi7TeV& operator=(const AliRsnAnalysisPhi7TeV& copy); virtual ~AliRsnAnalysisPhi7TeV(); - void SetUseMC(Bool_t yn = kTRUE) {fUseMC = yn;} + void SetUseMC (Bool_t yn = kTRUE); void SetCheckITS(Bool_t yn = kTRUE) {fCheckITS = yn;} void SetCheckTPC(Bool_t yn = kTRUE) {fCheckTPC = yn;} void SetCheckTOF(Bool_t yn = kTRUE) {fCheckTOF = yn;} + void SetAddITSSA(Bool_t yn = kTRUE) {fAddITSSA = yn;} void SetMaxVz(Double_t v) {fMaxVz = v;} void SetITSband(Double_t v) {fMaxITSband = v;} + void SetITSmom (Double_t v) {fMaxITSmom = v;} void SetTPCpLimit(Double_t v) {fTPCpLimit = v;} void SetTPCrange(Double_t min, Double_t max) {fMinTPCband = min; fMaxTPCband = max;} @@ -60,6 +66,8 @@ class AliRsnAnalysisPhi7TeV : public AliAnalysisTaskSE void SetTOFuseT0 (Bool_t yn = kTRUE) {fTOFuseT0 = yn;} void SetTOFtuneMC (Bool_t yn = kTRUE) {fTOFtuneMC = yn;} void SetTOFresolution (Double_t v = 100.0) {fTOFresolution = v;} + void SetMinTOF (Double_t v) {fMinTOF = v;} + void SetMaxTOF (Double_t v) {fMaxTOF = v;} virtual void UserCreateOutputObjects(); virtual void UserExec(Option_t *option = ""); @@ -68,38 +76,43 @@ class AliRsnAnalysisPhi7TeV : public AliAnalysisTaskSE Int_t EventEval(AliESDEvent *esd); AliESDtrackCuts* GetCutsTPC() {return &fESDtrackCutsTPC;} AliESDtrackCuts* GetCutsITS() {return &fESDtrackCutsITS;} + + Bool_t IsITSTPC (AliESDtrack *track); + Bool_t IsITSSA (AliESDtrack *track); + Bool_t MatchTOF (AliESDtrack *track); + Bool_t OkQuality(AliESDtrack *track); + Bool_t OkITSPID (AliESDtrack *track, AliPID::EParticleType pid); + Bool_t OkTPCPID (AliESDtrack *track, AliPID::EParticleType pid); + Bool_t OkTOFPID (AliESDtrack *track, AliPID::EParticleType pid); + Bool_t OkTrack (AliESDtrack *track, AliPID::EParticleType pid); private: void ProcessESD(AliESDEvent *esd, AliStack *stack); - void ProcessMC(AliStack *stack); - void AddEntryFromESD(AliESDEvent *esd, Int_t i1, Int_t i2, Int_t its1, Int_t its2, Short_t charge, AliStack *stack = 0x0); Bool_t fUseMC; // use MC or data? Bool_t fCheckITS; // chec ITS PID? Bool_t fCheckTPC; // chec TPC PID? Bool_t fCheckTOF; // chec TOF PID? - - Short_t fPDG; // PDG code - Short_t fCh; // control flag for like/unlike sign - Short_t fITS[2]; // check flag to know if one or both candidates are ITS standalone - Float_t fIM; // inv mass - Float_t fPt; // transv momentum - Float_t fY; // rapidity - Float_t fEta; // pseudo-rapidity + Bool_t fAddITSSA; // add ITS standalone? Double_t fMaxVz; // range in Z of primary vertex w.r. to origin Double_t fMaxITSband; // range for ITS de/dx band + Double_t fMaxITSmom; // maximum momentum for ITS identification Double_t fTPCpLimit; // limit to choose what band to apply Double_t fTPCpar[5]; // parameters for TPC bethe-Bloch Double_t fMinTPCband; // range for TPC de/dx band - min Double_t fMaxTPCband; // range for TPC de/dx band - max + Double_t fMinTOF; // TOF range (min) + Double_t fMaxTOF; // TOF range (min) - TTree *fRsnTreeComp; // output tree of computed pairs - TTree *fRsnTreeTrue; // output tree of true pairs TList *fOutList; // list for monitoring histograms + TH3F *fUnlike; // unlike-sign pairs + TH3F *fLikePP; // unlike-sign pairs + TH3F *fLikeMM; // unlike-sign pairs + TH3F *fTrues; // true pairs TH1I *fHEvents; // histogram of event types TH1F *fVertexX[2]; // histogram of X coordinate of primary vertex ([0] = tracks, [1] = SPD) TH1F *fVertexY[2]; // histogram of Y coordinate of primary vertex ([0] = tracks, [1] = SPD) @@ -115,9 +128,69 @@ class AliRsnAnalysisPhi7TeV : public AliAnalysisTaskSE Bool_t fTOFuseT0; // TOF settings Bool_t fTOFtuneMC; // TOF settings Double_t fTOFresolution; // TOF settings + + AliRsnDaughter fDaughter; + AliRsnCutESD2010 fRsnCuts; // ROOT dictionary ClassDef(AliRsnAnalysisPhi7TeV,1) }; +inline Bool_t AliRsnAnalysisPhi7TeV::IsITSTPC(AliESDtrack *vtrack) +{ +// +// Checks if the track has the status flags required for a global track +// + + if (!vtrack) + { + AliWarning("NULL argument: impossible to check status"); + return kFALSE; + } + + return vtrack->IsOn(AliESDtrack::kTPCin); +} + +inline Bool_t AliRsnAnalysisPhi7TeV::IsITSSA(AliESDtrack *vtrack) +{ +// +// Checks if the track has the status flags required for an ITS standalone track +// + + if (!vtrack) + { + AliWarning("NULL argument: impossible to check status"); + return kFALSE; + } + + Bool_t isTPCin = vtrack->IsOn(AliESDtrack::kTPCin); + Bool_t isITSrefit = vtrack->IsOn(AliESDtrack::kITSrefit); + Bool_t isITSpureSA = vtrack->IsOn(AliESDtrack::kITSpureSA); + Bool_t isITSpid = vtrack->IsOn(AliESDtrack::kITSpid); + + return ( (!isTPCin) && isITSrefit && (!isITSpureSA) && isITSpid ); +} + + +inline Bool_t AliRsnAnalysisPhi7TeV::MatchTOF(AliESDtrack *vtrack) +{ +// +// Checks if the track has matched the TOF detector +// + + if (!vtrack) + { + AliWarning("NULL argument: impossible to check status"); + return kFALSE; + } + + // require a minimum length to have meaningful match + if (vtrack->GetIntegratedLength() < 350.) return kFALSE; + + Bool_t isTOFout = vtrack->IsOn(AliESDtrack::kTOFout); + Bool_t isTIME = vtrack->IsOn(AliESDtrack::kTIME); + + return ( isTOFout && isTIME ); +} + #endif diff --git a/PWG2/RESONANCES/AliRsnAnalysisSE.cxx b/PWG2/RESONANCES/AliRsnAnalysisSE.cxx index 6912e88b73a..e37b1697fcf 100644 --- a/PWG2/RESONANCES/AliRsnAnalysisSE.cxx +++ b/PWG2/RESONANCES/AliRsnAnalysisSE.cxx @@ -31,10 +31,10 @@ AliRsnAnalysisSE::AliRsnAnalysisSE(const char *name, Bool_t useKine) : { // // Default constructor. +// Defines another output slot for histograms/ntuples // - AliDebug(AliLog::kDebug+2, "<-"); + DefineOutput(2, TList::Class()); - AliDebug(AliLog::kDebug+2,"->"); } //_____________________________________________________________________________ @@ -55,7 +55,7 @@ AliRsnAnalysisSE::AliRsnAnalysisSE(const AliRsnAnalysisSE& copy) : AliRsnAnalysisSE& AliRsnAnalysisSE::operator=(const AliRsnAnalysisSE& copy) { // -// Copy constructor. +// Assigment operator. // AliRsnVAnalysisTaskSE::operator=(copy); @@ -75,19 +75,16 @@ void AliRsnAnalysisSE::RsnUserCreateOutputObjects() // // Creation of output objects. // These are created through the utility methods in the analysis manager, -// which produces a list of histograms for each specified set of pairs. -// Each of these lists is added to the main list of this task. +// which asks all the AliRsnPair objects to initialize their output which +// is then linked to the TList data member of this, which will contain all the output. // - AliDebug(AliLog::kDebug+2,"<-"); - - if (fOutList) fOutList->Clear(); - fOutList = new TList; + if (!fOutList) fOutList = new TList; + fOutList->Clear(); + fRsnAnalysisManager.InitAllPairs(fOutList); PostData(2, fOutList); - - AliDebug(AliLog::kDebug+2,"->"); } //_____________________________________________________________________________ @@ -95,71 +92,18 @@ void AliRsnAnalysisSE::RsnUserExec(Option_t*) { // // Execution of the analysis task. -// Recovers the input event and processes it with all included pair objects. +// Recovers the input event and processes it with all included pair objects, +// using 'reconstructed' or 'MonteCarlo' functions depending on MC-only flag. // - AliDebug(AliLog::kDebug+2,"<-"); + if (fMCOnly) + fRsnAnalysisManager.ProcessAllPairsMC(); + else + fRsnAnalysisManager.ProcessAllPairs(); - fTaskInfo.SetEventUsed(kFALSE); - - if (fESDEvent) { - AliDebug(AliLog::kDebug+1, Form("fESDEvent is %p", fESDEvent)); - AliDebug(AliLog::kDebug, Form("ESD tracks %d", fESDEvent->GetNumberOfTracks())); - } - if (fMCEvent) { - AliDebug(AliLog::kDebug+1, Form("fMCEvent is %p", fMCEvent)); - AliDebug(AliLog::kDebug, Form("MC tracks %d", fMCEvent->GetNumberOfTracks())); - } - if (fAODEventIn) { - AliDebug(AliLog::kDebug+1, Form("fAODEventIn is %p", fAODEventIn)); - AliDebug(AliLog::kDebug, Form("AOD(in) tracks %d", fAODEventIn->GetNumberOfTracks())); - } - if (fAODEventOut) { - AliDebug(AliLog::kDebug+1, Form("fAODEventOut if %p", fAODEventOut)); - AliDebug(AliLog::kDebug, Form("AOD(out) tracks %d", fAODEventOut->GetNumberOfTracks())); - } - - // Removing empty events - if (fRsnEvent.GetMultiplicity()<=0) { - AliDebug(AliLog::kDebug, "Zero event!!! Skipping ..."); - fTaskInfo.SetEventUsed(kFALSE); - if (fUseZeroEventWarning) - { - TH1I *hist = (TH1I*)fInfoList->FindObject(fTaskInfo.GetEventHistogramName()); - if (!hist) return; - Double_t zeroEventPercent = 0.0; - if (hist->Integral() > 1) zeroEventPercent = (Double_t)hist->GetBinContent(1) / hist->Integral() * 100; - if ((zeroEventPercent>fZeroEventPercentWarning)&&(fEntry>100)) - AliWarning(Form("%3.2f%% Events are with zero tracks (CurrentEvent=%d)!!!",zeroEventPercent,fEntry)); - } - return; - } - - // if general event cuts are added to the task (recommended) - // they are checked here on the RSN event interface and, - // if the event does not pass them, it is skipped and ProcessInfo - // is updated accordingly -// if (fEventCuts) { - if (!fEventCuts.IsSelected(&fRsnEvent)) { - fTaskInfo.SetEventUsed(kFALSE); - return; - } -// } - - // if cuts are passed or not cuts were defined, - // update the task info... - fTaskInfo.SetEventUsed(kTRUE); - - // the virtual class has already sorted tracks in the PID index - // so we need here just to call the execution of analysis - if (!fMCOnly) fRsnAnalysisManager.ProcessAllPairs(&fRsnEvent, &fRsnEvent); - else fRsnAnalysisManager.ProcessAllPairsMC(&fRsnEvent, &fRsnEvent); PostData(2, fOutList); - - AliDebug(AliLog::kDebug+2,"->"); } - //_____________________________________________________________________________ void AliRsnAnalysisSE::RsnTerminate(Option_t*) { @@ -167,8 +111,61 @@ void AliRsnAnalysisSE::RsnTerminate(Option_t*) // Termination. // Could be added some monitor histograms here. // - - AliDebug(AliLog::kDebug+2,"<-"); - AliDebug(AliLog::kDebug+2,"->"); } +//______________________________________________________________________________ +Bool_t AliRsnAnalysisSE::EventProcess() +{ +// +// Customized event pre-processing. +// First checks if the current event passes all cuts, +// and if it does, updates the informations and then +// call the operations which are already defined in the +// omonyme function in mother class +// + + // initially, an event is expected to be bad + fTaskInfo.SetEventUsed(kFALSE); + + // check #1: number of tracks in event (reject empty events) + Int_t ntracks = fRsnEvent.GetMultiplicity(); + Double_t zeroEventPercent = 0.0; + if (ntracks < 1) + { + // if using the checker for amount of empty events, update it + if (fUseZeroEventWarning) + { + TH1I *hist = (TH1I*)fInfoList->FindObject(fTaskInfo.GetEventHistogramName()); + if (hist) + { + if (hist->Integral() > 1) zeroEventPercent = (Double_t)hist->GetBinContent(1) / hist->Integral() * 100; + if ((zeroEventPercent > fZeroEventPercentWarning) && (fEntry > 100)) + AliWarning(Form("%3.2f%% Events are with zero tracks (CurrentEvent=%d)!!!", zeroEventPercent, fEntry)); + } + } + + // empty events are rejected by default + fTaskInfo.SetEventUsed(kFALSE); + AliDebug(AliLog::kDebug, "Empty event. Skipping..."); + return kFALSE; + } + + // check the event cuts and update the info data accordingly + // events not passing the cuts must be rejected + if (!fEventCuts.IsSelected(&fRsnEvent)) + { + fTaskInfo.SetEventUsed(kFALSE); + return kFALSE; + } + + // if we reach this point, cuts were passed; + // then additional operations can be done + + // find leading particle (without any PID/momentum restriction) + fRsnEvent.SelectLeadingParticle(0); + + // final return value is positive + // but call the mother class method which updates info object + fTaskInfo.SetEventUsed(kTRUE); + return AliRsnVAnalysisTaskSE::EventProcess(); +} diff --git a/PWG2/RESONANCES/AliRsnAnalysisSE.h b/PWG2/RESONANCES/AliRsnAnalysisSE.h index a551389903e..0b3b51ac605 100644 --- a/PWG2/RESONANCES/AliRsnAnalysisSE.h +++ b/PWG2/RESONANCES/AliRsnAnalysisSE.h @@ -27,26 +27,27 @@ class AliRsnAnalysisSE : public AliRsnVAnalysisTaskSE AliRsnAnalysisSE& operator=(const AliRsnAnalysisSE& copy); virtual ~AliRsnAnalysisSE() {} - virtual void RsnUserCreateOutputObjects(); - virtual void RsnUserExec(Option_t*); - virtual void RsnTerminate(Option_t*); + virtual void RsnUserCreateOutputObjects(); + virtual void RsnUserExec(Option_t*); + virtual void RsnTerminate(Option_t*); + virtual Bool_t EventProcess(); - AliRsnCutSet* GetEventCuts() {return &fEventCuts;} - AliRsnAnalysisManager* GetAnalysisManager() {return &fRsnAnalysisManager;} + AliRsnCutSet* GetEventCuts() {return &fEventCuts;} + AliRsnAnalysisManager* GetAnalysisManager() {return &fRsnAnalysisManager;} void SetAnalysisManagerName(const char *name) {fRsnAnalysisManager.SetName(name);} - Double_t GetZeroEventPercentWarning() const {return fZeroEventPercentWarning;} - void SetZeroEventPercentWarning(Double_t val = 50) {fZeroEventPercentWarning = val;} - void UseZeroEventWarning(Bool_t b = true) {fUseZeroEventWarning = b;} + Double_t GetZeroEventPercentWarning() const {return fZeroEventPercentWarning;} + void SetZeroEventPercentWarning(Double_t val = 50) {fZeroEventPercentWarning = val;} + void UseZeroEventWarning(Bool_t b = kTRUE) {fUseZeroEventWarning = b;} private: - AliRsnAnalysisManager fRsnAnalysisManager; // analysis main engine - AliRsnCutSet fEventCuts; // event cuts - TList *fOutList; // list of output events + AliRsnAnalysisManager fRsnAnalysisManager; // analysis main engine + AliRsnCutSet fEventCuts; // event cuts + TList *fOutList; // list of output events - Double_t fZeroEventPercentWarning; // Percent Number for Zero Event Warning - Bool_t fUseZeroEventWarning; // flag if Zero Event Warning is used (default is true) + Double_t fZeroEventPercentWarning; // Percent Number for Zero Event Warning + Bool_t fUseZeroEventWarning; // flag if Zero Event Warning is used (default is true) ClassDef(AliRsnAnalysisSE, 1) }; diff --git a/PWG2/RESONANCES/AliRsnCut.cxx b/PWG2/RESONANCES/AliRsnCut.cxx index 95ae03b2064..c2a4ba5e4f0 100644 --- a/PWG2/RESONANCES/AliRsnCut.cxx +++ b/PWG2/RESONANCES/AliRsnCut.cxx @@ -178,7 +178,7 @@ Bool_t AliRsnCut::OkRangeI() // // eval result - fCutResult = ((fCutValueI >= fMinI) && (fCutValueI < fMaxI)); + fCutResult = ((fCutValueI >= fMinI) && (fCutValueI <= fMaxI)); // print debug message AliDebug(AliLog::kDebug + 2, "=== CUT DEBUG ===================================="); @@ -201,7 +201,7 @@ Bool_t AliRsnCut::OkRangeD() // // eval result - fCutResult = ((fCutValueD >= fMinD) && (fCutValueD < fMaxD)); + fCutResult = ((fCutValueD >= fMinD) && (fCutValueD <= fMaxD)); // print debug message AliDebug(AliLog::kDebug + 2, "=== CUT DEBUG ===================================="); diff --git a/PWG2/RESONANCES/AliRsnCutAOD2010.cxx b/PWG2/RESONANCES/AliRsnCutAOD2010.cxx index e234c78c581..fd639de0ff8 100644 --- a/PWG2/RESONANCES/AliRsnCutAOD2010.cxx +++ b/PWG2/RESONANCES/AliRsnCutAOD2010.cxx @@ -252,13 +252,13 @@ Bool_t AliRsnCutAOD2010::IsSelected(TObject *object) // step #5: DCA cut (transverse) Double_t dz[2], cov[3], sigmaDCA = 0.0, nsigma = 0.0; - vertex = fEvent->GetRefAOD()->GetPrimaryVertex(); + vertex = AliRsnTarget::GetCurrentEvent()->GetRefAOD()->GetPrimaryVertex(); if (!vertex) { AliDebug(AliLog::kDebug + 2, "NULL vertex"); return kFALSE; } - if (!track->PropagateToDCA(vertex, fEvent->GetRefAOD()->GetMagneticField(), kVeryBig, dz, cov)) + if (!track->PropagateToDCA(vertex, AliRsnTarget::GetCurrentEvent()->GetRefAOD()->GetMagneticField(), kVeryBig, dz, cov)) { AliDebug(AliLog::kDebug + 2, "Failed propagation to vertex"); return kFALSE; diff --git a/PWG2/RESONANCES/AliRsnCutESD2010.cxx b/PWG2/RESONANCES/AliRsnCutESD2010.cxx index 8d90c02aa74..8ef753d7311 100644 --- a/PWG2/RESONANCES/AliRsnCutESD2010.cxx +++ b/PWG2/RESONANCES/AliRsnCutESD2010.cxx @@ -30,7 +30,15 @@ ClassImp(AliRsnCutESD2010) -Int_t AliRsnCutESD2010::fgLastRun = -1; +//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 @@ -48,18 +56,11 @@ AliRsnCutESD2010::AliRsnCutESD2010 fTPCpLimit(0.35), fMinTPCband(3.0), fMaxTPCband(5.0), - fESDpid(0x0), + fESDpid(), fESDtrackCutsTPC(), fESDtrackCutsITS(), - fTOFmaker(0x0), - fTOFcalib(0x0), - fTOFcalibrateESD(!isMC), - fTOFcorrectTExp(kTRUE), - fTOFuseT0(kTRUE), - fTOFtuneMC(isMC), - fTOFresolution(100.0), - fMinTOF(-2.5), - fMaxTOF( 3.5) + fMinTOF(-3.0), + fMaxTOF( 3.0) { // // Main constructor. @@ -84,16 +85,9 @@ AliRsnCutESD2010::AliRsnCutESD2010 fTPCpLimit(copy.fTPCpLimit), fMinTPCband(copy.fMinTPCband), fMaxTPCband(copy.fMaxTPCband), - fESDpid(0x0), + fESDpid(copy.fESDpid), fESDtrackCutsTPC(copy.fESDtrackCutsTPC), fESDtrackCutsITS(copy.fESDtrackCutsITS), - fTOFmaker(0x0), - fTOFcalib(0x0), - fTOFcalibrateESD(copy.fTOFcalibrateESD), - fTOFcorrectTExp(copy.fTOFcorrectTExp), - fTOFuseT0(copy.fTOFuseT0), - fTOFtuneMC(copy.fTOFtuneMC), - fTOFresolution(copy.fTOFresolution), fMinTOF(copy.fMinTOF), fMaxTOF(copy.fMaxTOF) { @@ -101,6 +95,8 @@ AliRsnCutESD2010::AliRsnCutESD2010 // Copy constructor. // + SetMC(copy.fIsMC); + Int_t i = 0; for (i = 0; i < 5; i++) fTPCpar[i] = copy.fTPCpar[i]; } @@ -114,7 +110,8 @@ AliRsnCutESD2010& AliRsnCutESD2010::operator=(const AliRsnCutESD2010& copy) AliRsnCut::operator=(copy); - fIsMC = copy.fIsMC; + SetMC(copy.fIsMC); + fCheckITS = copy.fCheckITS; fCheckTPC = copy.fCheckTPC; fCheckTOF = copy.fCheckTOF; @@ -126,22 +123,16 @@ AliRsnCutESD2010& AliRsnCutESD2010::operator=(const AliRsnCutESD2010& copy) fTPCpLimit = copy.fTPCpLimit; fMinTPCband = copy.fMinTPCband; fMaxTPCband = copy.fMaxTPCband; - fTOFcalibrateESD = copy.fTOFcalibrateESD; - fTOFcorrectTExp = copy.fTOFcorrectTExp; - fTOFuseT0 = copy.fTOFuseT0; - fTOFtuneMC = copy.fTOFtuneMC; - fTOFresolution = copy.fTOFresolution; fMinTOF = copy.fMinTOF; fMaxTOF = copy.fMaxTOF; + fESDpid = copy.fESDpid; Int_t i = 0; for (i = 0; i < 5; i++) fTPCpar[i] = copy.fTPCpar[i]; - delete fESDpid; - fESDpid = 0x0; - copy.GetCutsTPC()->Copy(fESDtrackCutsTPC); - copy.GetCutsITS()->Copy(fESDtrackCutsITS); + fESDtrackCutsTPC = copy.fESDtrackCutsTPC; + fESDtrackCutsITS = copy.fESDtrackCutsITS; return (*this); } @@ -155,80 +146,66 @@ void AliRsnCutESD2010::SetMC(Bool_t isMC) fIsMC = isMC; + AliITSPIDResponse itsresponse(fIsMC); + fESDpid.GetITSResponse() = itsresponse; + if (isMC) { - SetTPCpar(2.15898 / 50.0, 1.75295E1, 3.40030E-9, 1.96178, 3.91720); - SetTOFcalibrateESD(kFALSE); - SetTOFtuneMC(kTRUE); + //fgTOFcalibrateESD = kFALSE; + fgTOFtuneMC = kTRUE; } else { - SetTPCpar(1.41543 / 50.0, 2.63394E1, 5.0411E-11, 2.12543, 4.88663); - SetTOFcalibrateESD(kTRUE); - SetTOFtuneMC(kFALSE); + //fgTOFcalibrateESD = kTRUE; + fgTOFtuneMC = kFALSE; } } //_________________________________________________________________________________________________ -void AliRsnCutESD2010::SetEvent(AliRsnEvent *event) +void AliRsnCutESD2010::ProcessEvent(AliESDEvent *esd) { - // don't do anything if the event is the same as before - if (fEvent != 0x0 && fEvent == event) return; - - // retrieve the ESD event - AliESDEvent *esd = event->GetRefESD(); - if (!esd) - { - fEvent = 0x0; - return; - } - else - { - fEvent = event; - } - - // if the run number has changed, - // reset the CDB in order to point to the correct one + // 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 *cdb = AliCDBManager::Instance(); - cdb->ClearCache(); // suggestion by Annalisa - cdb->Clear(); // suggestion by Annalisa - cdb->SetDefaultStorage("raw://"); - cdb->SetRun(run); - } - // if absent, initialize ESD pid response - if (!fESDpid) - { - AliITSPIDResponse itsresponse(fIsMC); + AliCDBManager::Instance()->SetDefaultStorage("raw://"); + 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(); - fESDpid = new AliESDpid; - fESDpid->GetTPCResponse().SetBetheBlochParameters(fTPCpar[0],fTPCpar[1],fTPCpar[2],fTPCpar[3],fTPCpar[4]); - fESDpid->GetITSResponse() = itsresponse; + fgTOFmaker = new AliTOFT0maker(&fESDpid, fgTOFcalib); + fgTOFmaker->SetTimeResolution(fgTOFresolution); } - - // if absent, initialize TOF objects for calibration - if (!fTOFcalib) fTOFcalib = new AliTOFcalib; - fTOFcalib->SetCorrectTExp(fTOFcorrectTExp); - fTOFcalib->Init(); - if (!fTOFmaker) fTOFmaker = new AliTOFT0maker(fESDpid, fTOFcalib); - fTOFmaker->SetTimeResolution(fTOFresolution); - - // if required, calibrate the TOF t0 maker with current event - if (fTOFcalibrateESD) fTOFcalib->CalibrateESD(esd); - if (fTOFtuneMC) fTOFmaker->TuneForMC(esd); - if (fTOFuseT0) + + /*if (fgTOFcalibrateESD)*/ fgTOFcalib->CalibrateESD(esd); + if (fgTOFtuneMC) fgTOFmaker->TuneForMC(esd); + if (fgTOFuseT0) { - fTOFmaker->ComputeT0TOF(esd); - fTOFmaker->ApplyT0TOF(esd); - fESDpid->MakePID(esd, kFALSE, 0.); + fgTOFmaker->ComputeT0TOF(esd); + fgTOFmaker->ApplyT0TOF(esd); + fESDpid.MakePID(esd, kFALSE, 0.); } } @@ -246,7 +223,13 @@ Bool_t AliRsnCutESD2010::IsSelected(TObject *object) if (!track) return kFALSE; // if no reference event, skip - if (!fEvent) return kFALSE; + AliRsnEvent *rsn = AliRsnTarget::GetCurrentEvent(); + if (!rsn) return kFALSE; + if (fgLastEventID != rsn->GetLocalID()) + { + ProcessEvent(rsn->GetRefESD()); + fgLastEventID = rsn->GetLocalID(); + } // check quality and track type and reject tracks not passing this step if (!OkQuality(track)) @@ -357,7 +340,7 @@ Bool_t AliRsnCutESD2010::OkITSPID (AliESDtrack *track) } // create the PID response object and compute nsigma - AliITSPIDResponse &itsrsp = fESDpid->GetITSResponse(); + AliITSPIDResponse &itsrsp = fESDpid.GetITSResponse(); Double_t mom = track->P(); Double_t nSigma = itsrsp.GetNumberOfSigmas(mom, track->GetITSsignal(), fPID, nITSpidLayers, isSA); @@ -380,8 +363,8 @@ Bool_t AliRsnCutESD2010::OkTPCPID (AliESDtrack *track) // // setup TPC PID response - AliTPCPIDResponse &tpcrsp = fESDpid->GetTPCResponse(); - tpcrsp.SetBetheBlochParameters(fTPCpar[0],fTPCpar[1],fTPCpar[2],fTPCpar[3],fTPCpar[4]); + 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(); @@ -406,11 +389,11 @@ Bool_t AliRsnCutESD2010::OkTOFPID (AliESDtrack *track) // Check TOF particle identification if matched there. // - // check integrated length - if (track->GetIntegratedLength() < 350.) return kFALSE; + // reject not TOF-matched tracks + if (!MatchTOF(track)) return kFALSE; // setup TOF PID response - AliTOFPIDResponse &tofrsp = fESDpid->GetTOFResponse(); + AliTOFPIDResponse &tofrsp = fESDpid.GetTOFResponse(); // get info for computation Double_t momentum = track->P(); @@ -453,7 +436,7 @@ void AliRsnCutESD2010::Print(const Option_t *) const 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", fTOFresolution)); + AliInfo(Form("TOF resolution : %f", fgTOFresolution)); AliInfo(Form("TOF range (sigmas) : %f - %f", fMinTOF, fMaxTOF)); - AliInfo(Form("TOF PID tuning from MC : %s", (fTOFtuneMC ? "YES" : "NO"))); + AliInfo(Form("TOF PID tuning from MC : %s", (fgTOFtuneMC ? "YES" : "NO"))); } diff --git a/PWG2/RESONANCES/AliRsnCutESD2010.h b/PWG2/RESONANCES/AliRsnCutESD2010.h index d3be84e63f6..83f28c3f3aa 100644 --- a/PWG2/RESONANCES/AliRsnCutESD2010.h +++ b/PWG2/RESONANCES/AliRsnCutESD2010.h @@ -16,6 +16,7 @@ #include "AliPID.h" #include "AliESDtrack.h" #include "AliESDtrackCuts.h" +#include "AliESDpid.h" #include "AliRsnCut.h" class AliESDpid; @@ -31,10 +32,15 @@ class AliRsnCutESD2010 : public AliRsnCut AliRsnCutESD2010& operator=(const AliRsnCutESD2010& copy); virtual ~AliRsnCutESD2010() {;}; - const AliESDtrackCuts* GetCutsTPC() const {return &fESDtrackCutsTPC;} - const AliESDtrackCuts* GetCutsITS() const {return &fESDtrackCutsITS;} - virtual Bool_t IsSelected(TObject *object); - virtual void Print(const Option_t *option = "") const; + AliESDpid* GetESDpid() {return &fESDpid;} + AliESDtrackCuts* GetCutsTPC() {return &fESDtrackCutsTPC;} + AliESDtrackCuts* GetCutsITS() {return &fESDtrackCutsITS;} + void CopyCutsTPC(const AliESDtrackCuts *cuts) {fESDtrackCutsTPC = (*cuts);} + void CopyCutsITS(const AliESDtrackCuts *cuts) {fESDtrackCutsITS = (*cuts);} + void CopyCutsTPC(AliESDtrackCuts cuts) {fESDtrackCutsTPC = cuts;} + void CopyCutsITS(AliESDtrackCuts cuts) {fESDtrackCutsITS = cuts;} + virtual Bool_t IsSelected(TObject *object); + virtual void Print(const Option_t *option = "") const; void SetMC (Bool_t yn = kTRUE); void SetCheckITS (Bool_t yn = kTRUE) {fCheckITS = yn;} @@ -52,14 +58,15 @@ class AliRsnCutESD2010 : public AliRsnCut void SetTPCpar(Double_t p0, Double_t p1, Double_t p2, Double_t p3, Double_t p4) {fTPCpar[0]=p0;fTPCpar[1]=p1;fTPCpar[2]=p2;fTPCpar[3]=p3;fTPCpar[4]=p4;} - void SetTOFcalibrateESD(Bool_t yn = kTRUE) {fTOFcalibrateESD = yn;} - void SetTOFcorrectTExp (Bool_t yn = kTRUE) {fTOFcorrectTExp = yn;} - void SetTOFuseT0 (Bool_t yn = kTRUE) {fTOFuseT0 = yn;} - void SetTOFtuneMC (Bool_t yn = kTRUE) {fTOFtuneMC = yn;} - void SetTOFresolution (Double_t v = 100.0) {fTOFresolution = v;} void SetTOFrange (Double_t v1, Double_t v2) {fMinTOF = v1; fMaxTOF = v2;} - virtual void SetEvent(AliRsnEvent *event); + virtual void ProcessEvent(AliESDEvent *esd); + + //static void SetTOFcalibrateESD(Bool_t yn) {fgTOFcalibrateESD = yn;} + static void SetTOFcorrectTExp (Bool_t yn) {fgTOFcorrectTExp = yn;} + static void SetTOFuseT0 (Bool_t yn) {fgTOFuseT0 = yn;} + static void SetTOFtuneMC (Bool_t yn) {fgTOFtuneMC = yn;} + static void SetTOFresolution (Double_t r) {fgTOFresolution = r;} protected: @@ -87,20 +94,21 @@ class AliRsnCutESD2010 : public AliRsnCut Double_t fMinTPCband; // range for TPC de/dx band - min Double_t fMaxTPCband; // range for TPC de/dx band - max - AliESDpid *fESDpid; // ESD PID object + AliESDpid fESDpid; // ESD PID object AliESDtrackCuts fESDtrackCutsTPC; // ESD standard defined track cuts for TPC tracks AliESDtrackCuts fESDtrackCutsITS; // ESD standard defined track cuts for ITS-SA tracks - AliTOFT0maker *fTOFmaker; //! TOF time0 computator - AliTOFcalib *fTOFcalib; //! TOF calibration - Bool_t fTOFcalibrateESD; // TOF settings - Bool_t fTOFcorrectTExp; // TOF settings - Bool_t fTOFuseT0; // TOF settings - Bool_t fTOFtuneMC; // TOF settings - Double_t fTOFresolution; // TOF settings Double_t fMinTOF; // range for TOF PID (min) Double_t fMaxTOF; // range for TOF PID (max) + //static Bool_t fgTOFcalibrateESD; //! TOF settings + static Bool_t fgTOFcorrectTExp; //! TOF settings + static Bool_t fgTOFuseT0; //! TOF settings + static Bool_t fgTOFtuneMC; //! TOF settings + static Double_t fgTOFresolution; //! TOF settings + static AliTOFT0maker *fgTOFmaker; //! TOF time0 computator + static AliTOFcalib *fgTOFcalib; //! TOF calibration static Int_t fgLastRun; //! last run number + static Int_t fgLastEventID; //! ID of last event processed ClassDef(AliRsnCutESD2010, 1) }; @@ -117,10 +125,7 @@ inline Bool_t AliRsnCutESD2010::IsITSTPC(AliESDtrack *vtrack) return kFALSE; } - ULong_t status = (ULong_t)vtrack->GetStatus(); - ULong_t sTPCin = status & AliESDtrack::kTPCin; - - if (sTPCin == 0) return kFALSE; + return vtrack->IsOn(AliESDtrack::kTPCin); return kTRUE; } @@ -137,16 +142,12 @@ inline Bool_t AliRsnCutESD2010::IsITSSA(AliESDtrack *vtrack) return kFALSE; } - ULong_t status = (ULong_t)vtrack->GetStatus(); - ULong_t sTPCin = status & AliESDtrack::kTPCin; - ULong_t sITSrefit = status & AliESDtrack::kITSrefit; - ULong_t sITSpureSA = status & AliESDtrack::kITSpureSA; - ULong_t sITSpid = status & AliESDtrack::kITSpid; + Bool_t isTPCin = vtrack->IsOn(AliESDtrack::kTPCin); + Bool_t isITSrefit = vtrack->IsOn(AliESDtrack::kITSrefit); + Bool_t isITSpureSA = vtrack->IsOn(AliESDtrack::kITSpureSA); + Bool_t isITSpid = vtrack->IsOn(AliESDtrack::kITSpid); - if (sTPCin != 0) return kFALSE; - if (sITSrefit == 0) return kFALSE; - if (sITSpureSA != 0) return kFALSE; - if (sITSpid == 0) return kFALSE; + return ( (!isTPCin) && isITSrefit && (!isITSpureSA) && isITSpid ); return kTRUE; } @@ -164,12 +165,13 @@ inline Bool_t AliRsnCutESD2010::MatchTOF(AliESDtrack *vtrack) return kFALSE; } - ULong_t status = (ULong_t)vtrack->GetStatus(); - ULong_t sTOFout = status & AliESDtrack::kTOFout; - ULong_t sTIME = status & AliESDtrack::kTIME; + // require a minimum length to have meaningful match + if (vtrack->GetIntegratedLength() < 350.) return kFALSE; + + Bool_t isTOFout = vtrack->IsOn(AliESDtrack::kTOFout); + Bool_t isTIME = vtrack->IsOn(AliESDtrack::kTIME); - if (sTOFout == 0) return kFALSE; - if (sTIME == 0) return kFALSE; + return ( isTOFout && isTIME ); return kTRUE; } diff --git a/PWG2/RESONANCES/AliRsnCutManager.cxx b/PWG2/RESONANCES/AliRsnCutManager.cxx index 2b07d88b5dc..f150d874ba1 100644 --- a/PWG2/RESONANCES/AliRsnCutManager.cxx +++ b/PWG2/RESONANCES/AliRsnCutManager.cxx @@ -89,16 +89,3 @@ AliRsnCutManager::~AliRsnCutManager() // Does nothing. // } - -//_____________________________________________________________________________ -void AliRsnCutManager::SetEvent(AliRsnEvent *event) -{ -// -// Sets reference event in all cut sets -// - - fDaughterCuts2.SetEvent(event); - fDaughterCuts1.SetEvent(event); - fDaughterCutsCommon.SetEvent(event); - fMotherCuts.SetEvent(event); -} diff --git a/PWG2/RESONANCES/AliRsnCutManager.h b/PWG2/RESONANCES/AliRsnCutManager.h index 64558228146..2a9b48d24e2 100644 --- a/PWG2/RESONANCES/AliRsnCutManager.h +++ b/PWG2/RESONANCES/AliRsnCutManager.h @@ -38,8 +38,6 @@ class AliRsnCutManager : public TNamed AliRsnCutManager& operator=(const AliRsnCutManager& cut); ~AliRsnCutManager(); - void SetEvent(AliRsnEvent *event); - AliRsnCutSet* GetCommonDaughterCuts() {return &fDaughterCutsCommon;} AliRsnCutSet* GetDaughter1Cuts() {return &fDaughterCuts1;} AliRsnCutSet* GetDaughter2Cuts() {return &fDaughterCuts2;} @@ -49,6 +47,8 @@ class AliRsnCutManager : public TNamed Bool_t PassDaughter1Cuts(AliRsnDaughter *daughter) {return fDaughterCuts2.IsSelected(daughter);} Bool_t PassDaughter2Cuts(AliRsnDaughter *daughter) {return fDaughterCuts2.IsSelected(daughter);} Bool_t PassMotherCuts(AliRsnMother *mother) {return fMotherCuts.IsSelected(mother);} + Bool_t PassSpecificDaughterCuts(Bool_t first, AliRsnDaughter *daughter) + {if (first) return PassDaughter1Cuts(daughter); else return PassDaughter2Cuts(daughter);} private: diff --git a/PWG2/RESONANCES/AliRsnCutPrimaryVertex.cxx b/PWG2/RESONANCES/AliRsnCutPrimaryVertex.cxx index 9b13d9d38cc..afc75ebe7b7 100644 --- a/PWG2/RESONANCES/AliRsnCutPrimaryVertex.cxx +++ b/PWG2/RESONANCES/AliRsnCutPrimaryVertex.cxx @@ -44,9 +44,6 @@ Bool_t AliRsnCutPrimaryVertex::IsSelected(TObject *object) // // Cut checker // - - static Int_t evNum = 0; - evNum++; // retrieve ESD event AliRsnEvent *rsn = dynamic_cast(object); @@ -70,9 +67,9 @@ Bool_t AliRsnCutPrimaryVertex::IsSelected(TObject *object) Int_t ncTrk = -1; Int_t ncSPD = -1; Int_t ncTPC = -1; - Double_t vzTrk = 2.0 * fMaxD; - Double_t vzSPD = 2.0 * fMaxD; - Double_t vzTPC = 2.0 * fMaxD; + Double_t vzTrk = 1000000.0; + Double_t vzSPD = 1000000.0; + Double_t vzTPC = 1000000.0; if (vTrk) vzTrk = TMath::Abs(vTrk->GetZv()); if (vSPD) vzSPD = TMath::Abs(vSPD->GetZv()); if (vTPC) vzTPC = TMath::Abs(vTPC->GetZv()); @@ -89,16 +86,18 @@ Bool_t AliRsnCutPrimaryVertex::IsSelected(TObject *object) fCutValueI = ncSPD; fCutValueD = vzSPD; } - else if (vTPC && fAcceptTPC && ncTPC > 0) + else if (vTPC && ncTPC > 0) { - fCutValueI = ncTPC; - fCutValueD = vzTPC; + if (!fAcceptTPC) + return kFALSE; + else + { + fCutValueI = ncTPC; + fCutValueD = vzTPC; + } } else - { - fCutValueI = -1; - fCutValueD = 2.0 * fMaxD; - } + return kFALSE; } else if (aod) { diff --git a/PWG2/RESONANCES/AliRsnCutSet.cxx b/PWG2/RESONANCES/AliRsnCutSet.cxx index f8f7a61210f..69037bb178e 100644 --- a/PWG2/RESONANCES/AliRsnCutSet.cxx +++ b/PWG2/RESONANCES/AliRsnCutSet.cxx @@ -194,7 +194,7 @@ Bool_t AliRsnCutSet::IsSelected(TObject *object) } //_____________________________________________________________________________ -void AliRsnCutSet::SetCutScheme(const TString & theValue) +void AliRsnCutSet::SetCutScheme(const char *theValue) { // // Define the combination of cuts with logical operators @@ -366,18 +366,3 @@ TString AliRsnCutSet::GetCutSchemeIndexed() AliDebug(AliLog::kDebug,"->"); return str; } - -//_____________________________________________________________________________ -void AliRsnCutSet::SetEvent(AliRsnEvent *event) -{ -// -// Set the reference event to all contained cuts -// - - Int_t i; - AliRsnCut *cut; - for (i = 0; i < fCuts.GetEntriesFast(); i++) { - cut = (AliRsnCut*) fCuts.At(i); - if (cut) cut->SetEvent(event); - } -} diff --git a/PWG2/RESONANCES/AliRsnCutSet.h b/PWG2/RESONANCES/AliRsnCutSet.h index 04c1bfc486d..c029c8b8da1 100644 --- a/PWG2/RESONANCES/AliRsnCutSet.h +++ b/PWG2/RESONANCES/AliRsnCutSet.h @@ -48,7 +48,7 @@ class AliRsnCutSet : public AliRsnTarget void SetBoolValue(Bool_t theValue,Int_t index) { fBoolValues[index] = theValue; } Bool_t GetBoolValue(Int_t index) const { return fBoolValues[index]; } - void SetCutScheme(const TString& theValue); + void SetCutScheme(const char *theValue); TString GetCutScheme() const { return fCutScheme; } void SetCutSchemeIndexed(TString theValue); @@ -56,8 +56,6 @@ class AliRsnCutSet : public AliRsnTarget TObjArray *GetCuts() { return &fCuts; } - void SetEvent(AliRsnEvent *event); - private: TObjArray fCuts; // array of cuts diff --git a/PWG2/RESONANCES/AliRsnEvent.cxx b/PWG2/RESONANCES/AliRsnEvent.cxx index 99e19c5054e..cf9e2b891ce 100644 --- a/PWG2/RESONANCES/AliRsnEvent.cxx +++ b/PWG2/RESONANCES/AliRsnEvent.cxx @@ -26,11 +26,15 @@ ClassImp(AliRsnEvent) +AliRsnEvent* AliRsnEvent::fgRsnEvent1 = 0; +AliRsnEvent* AliRsnEvent::fgRsnEvent2 = 0; + //_____________________________________________________________________________ AliRsnEvent::AliRsnEvent(AliVEvent *ref, AliVEvent *refMC) : fRef(ref), fRefMC(refMC), - fLeading(-1) + fLeading(-1), + fLocalID(-1) { // // Default constructor. @@ -42,7 +46,8 @@ AliRsnEvent::AliRsnEvent(const AliRsnEvent &event) : TObject(event), fRef(event.fRef), fRefMC(event.fRefMC), - fLeading(event.fLeading) + fLeading(event.fLeading), + fLocalID(event.fLocalID) { // // Copy constructor. @@ -60,10 +65,23 @@ AliRsnEvent& AliRsnEvent::operator= (const AliRsnEvent & event) fRef = event.fRef; fRefMC = event.fRefMC; fLeading = event.fLeading; + fLocalID = event.fLocalID; return (*this); } +//_____________________________________________________________________________ +AliRsnEvent::~AliRsnEvent() +{ +// +// Destructor. +// Dereferences global pointer, if needed. +// + + //if (gRsnCurrentEvent == this) gRsnCurrentEvent = 0; + //if (gRsnMixedEvent == this) gRsnMixedEvent = 0; +} + //_____________________________________________________________________________ Bool_t AliRsnEvent::SetDaughter(AliRsnDaughter &out, Int_t i, AliRsnDaughter::ERefType type) { @@ -563,7 +581,7 @@ Bool_t AliRsnEvent::SetDaughterAODv0(AliRsnDaughter &out, Int_t i) } //_____________________________________________________________________________ -Bool_t AliRsnEvent::SetDaughterESDcascade(AliRsnDaughter &out, Int_t i) +Bool_t AliRsnEvent::SetDaughterESDcascade(AliRsnDaughter &, Int_t) { // // Setup the first argument to the track identified by the index. @@ -576,7 +594,7 @@ Bool_t AliRsnEvent::SetDaughterESDcascade(AliRsnDaughter &out, Int_t i) } //_____________________________________________________________________________ -Bool_t AliRsnEvent::SetDaughterAODcascade(AliRsnDaughter &out, Int_t i) +Bool_t AliRsnEvent::SetDaughterAODcascade(AliRsnDaughter &, Int_t) { // // Setup the first argument to the track identified by the index. diff --git a/PWG2/RESONANCES/AliRsnEvent.h b/PWG2/RESONANCES/AliRsnEvent.h index 260095907c0..f24a3a591b7 100644 --- a/PWG2/RESONANCES/AliRsnEvent.h +++ b/PWG2/RESONANCES/AliRsnEvent.h @@ -30,16 +30,18 @@ class AliRsnEvent : public TObject AliRsnEvent(AliVEvent *ref = 0, AliVEvent *refMC = 0); AliRsnEvent(const AliRsnEvent& copy); AliRsnEvent& operator= (const AliRsnEvent& copy); - virtual ~AliRsnEvent() { /*nothing*/ } + virtual ~AliRsnEvent(); // basic setters/getters void SetRef (AliVEvent *ref) {fRef = ref;} void SetRefMC(AliVEvent *refmc) {fRefMC = refmc;} void SetLeadingIndex(Int_t i) {fLeading = i;} + void SetLocalID(Int_t i) {fLocalID = i;} AliVEvent* GetRef() {return fRef;} AliVEvent* GetRefMC() {return fRefMC;} Int_t GetLeadingIndex() const {return fLeading;} Int_t GetLeadingParticleID() const {return fLeading;} + Int_t GetLocalID() const {return fLocalID;} // getters which convert into allowed input types AliESDEvent* GetRefESD() {return dynamic_cast(fRef);} @@ -66,6 +68,15 @@ class AliRsnEvent : public TObject Int_t SelectLeadingParticle(Double_t ptMin = 0.0, AliRsnCutPID *cutPID = 0x0); Double_t GetAverageMomentum(Int_t &count, AliRsnCutPID *cutPID = 0x0); Bool_t GetAngleDistr(Double_t &angleMean, Double_t &angleRMS, AliRsnDaughter reference); + + // statig getters + static AliRsnEvent *GetCurrentEvent1() {return fgRsnEvent1;} + static AliRsnEvent *GetCurrentEvent2() {return fgRsnEvent2;} + static void SetCurrentEvent1(AliRsnEvent *event, Int_t id = 0) {fgRsnEvent1 = event; fgRsnEvent1->SetLocalID(id);} + static void SetCurrentEvent2(AliRsnEvent *event, Int_t id = 0) {fgRsnEvent2 = event; fgRsnEvent2->SetLocalID(id);} + static Bool_t IsCurrentEvent1() {if (fgRsnEvent1 != 0x0) return kTRUE; return kFALSE;} + static Bool_t IsCurrentEvent2() {if (fgRsnEvent2 != 0x0) return kTRUE; return kFALSE;} + static Bool_t SameEvent() {if (fgRsnEvent1 == fgRsnEvent2) return kTRUE; return kFALSE;} private: @@ -78,9 +89,13 @@ class AliRsnEvent : public TObject Bool_t SetMCInfoESD (AliRsnDaughter &target); Bool_t SetMCInfoAOD (AliRsnDaughter &target); - AliVEvent *fRef; // pointer to input event - AliVEvent *fRefMC; // pointer to reference MC event (if any) - Int_t fLeading; // index of leading track + AliVEvent *fRef; // pointer to input event + AliVEvent *fRefMC; // pointer to reference MC event (if any) + Int_t fLeading; // index of leading track + Int_t fLocalID; // identification number used locally + + static AliRsnEvent *fgRsnEvent1; //! pointer to current event #1 (default current event) + static AliRsnEvent *fgRsnEvent2; //! pointer to current event #2 (different from the other when doing mixing) ClassDef(AliRsnEvent, 4); }; diff --git a/PWG2/RESONANCES/AliRsnFunction.cxx b/PWG2/RESONANCES/AliRsnFunction.cxx index 3d35f4d6db5..c4edb0f2b94 100644 --- a/PWG2/RESONANCES/AliRsnFunction.cxx +++ b/PWG2/RESONANCES/AliRsnFunction.cxx @@ -357,23 +357,3 @@ Bool_t AliRsnFunction::Fill() AliDebug(AliLog::kDebug +2,"->"); return kTRUE; } - -//__________________________________________________________________________________________________ -void AliRsnFunction::SetEvent(AliRsnEvent *const event) -{ -// -// Set current event -// - - Int_t i; - fEvent = event; - - // set also to all values - AliRsnValue *fcnAxis = 0; - for (i = 0; i < fSize; i++) - { - fcnAxis = (AliRsnValue*)fAxisList.At(i); - if (!fcnAxis) continue; - fcnAxis->SetEvent(event); - } -} diff --git a/PWG2/RESONANCES/AliRsnFunction.h b/PWG2/RESONANCES/AliRsnFunction.h index 815fcc30cc6..f59a35e1ba1 100644 --- a/PWG2/RESONANCES/AliRsnFunction.h +++ b/PWG2/RESONANCES/AliRsnFunction.h @@ -47,7 +47,6 @@ class AliRsnFunction : public TObject void SetPairDef(AliRsnPairDef * const def) {fPairDef = def;} void SetPair(AliRsnMother * const pair) {fPair = pair;} - void SetEvent(AliRsnEvent *const event); AliRsnPairDef* GetPairDef() const {return fPairDef;} AliRsnMother* GetPair() const {return fPair;} diff --git a/PWG2/RESONANCES/AliRsnPair.cxx b/PWG2/RESONANCES/AliRsnPair.cxx index 21e571ad67e..8b551133c6e 100644 --- a/PWG2/RESONANCES/AliRsnPair.cxx +++ b/PWG2/RESONANCES/AliRsnPair.cxx @@ -36,8 +36,7 @@ AliRsnPair::AliRsnPair(const char *name, AliRsnPairDef *def) : fCount(0), fPairDef(def), fCutManager(Form("cutMgr_%s", name)), - fMother(), - fEvent(0x0) + fMother() { // // Default constructor @@ -53,8 +52,7 @@ AliRsnPair::AliRsnPair(const AliRsnPair& copy) : fCount(copy.fCount), fPairDef(copy.fPairDef), fCutManager(copy.fCutManager), - fMother(copy.fMother), - fEvent(0x0) + fMother(copy.fMother) { // // Default constructor @@ -71,7 +69,6 @@ AliRsnPair& AliRsnPair::operator=(const AliRsnPair& copy) fPairDef = copy.fPairDef; fMother = copy.fMother; fCutManager = copy.fCutManager; - fEvent = 0x0; return (*this); } @@ -97,7 +94,7 @@ void AliRsnPair::Print(Option_t* /*option*/) const //_____________________________________________________________________________ Bool_t AliRsnPair::Fill -(AliRsnDaughter *daughter0, AliRsnDaughter *daughter1, AliRsnEvent *ev0, AliRsnEvent *ev1) +(AliRsnDaughter *daughter0, AliRsnDaughter *daughter1) { // // Sets the two passed daughters to the AliRsnMother data member of this object @@ -125,7 +122,7 @@ Bool_t AliRsnPair::Fill if (daughter1->ChargeChar() != fPairDef->GetCharge(1)) return kFALSE; // cuts on track #1 & common - fCutManager.SetEvent(ev0); + AliRsnTarget::SwitchToFirst(); if (!fCutManager.PassDaughter1Cuts(daughter0)) { AliDebug(AliLog::kDebug+2, "Specific cuts for track #1 not passed"); @@ -138,7 +135,7 @@ Bool_t AliRsnPair::Fill } // cuts on track #2 & common - fCutManager.SetEvent(ev1); + AliRsnTarget::SwitchToSecond(); if (!fCutManager.PassDaughter2Cuts(daughter1)) { AliDebug(AliLog::kDebug+2, "Specific cuts for track #2 not passed"); @@ -150,11 +147,9 @@ Bool_t AliRsnPair::Fill return kFALSE; } - // point to first event as reference - fEvent = ev0; - - // define pair & check - fCutManager.SetEvent(fEvent); + // point again to first event as reference + // and for checking the pair cuts + AliRsnTarget::SwitchToFirst(); if (!fCutManager.PassMotherCuts(&fMother)) return kFALSE; // if required a true pair, check this here and eventually return a fail message @@ -232,13 +227,3 @@ void AliRsnPair::Init(const char* /*prefix*/, TList* /*list*/) AliWarning("Implement this method in derived classes"); } - -//_____________________________________________________________________________ -void AliRsnPair::SetEvent(AliRsnEvent *event) -{ -// -// Set current event -// - - fEvent = event; -} diff --git a/PWG2/RESONANCES/AliRsnPair.h b/PWG2/RESONANCES/AliRsnPair.h index 7cceaa924ec..f95c99131f9 100644 --- a/PWG2/RESONANCES/AliRsnPair.h +++ b/PWG2/RESONANCES/AliRsnPair.h @@ -47,13 +47,12 @@ class AliRsnPair : public TNamed AliRsnCutManager* GetCutManager() {return &fCutManager;} AliRsnMother* GetMother() {return &fMother;} AliRsnPairDef* GetPairDef() {return fPairDef;} - Bool_t Fill(AliRsnDaughter *d0, AliRsnDaughter *d1, AliRsnEvent *ev1, AliRsnEvent *ev2); + Bool_t Fill(AliRsnDaughter *d0, AliRsnDaughter *d1); Int_t GetCount() const {return fCount;} void ResetCount() {fCount = 0;} virtual void Compute(); virtual void Init(const char *prefix, TList *list); - virtual void SetEvent(AliRsnEvent *event); protected: @@ -65,7 +64,6 @@ class AliRsnPair : public TNamed AliRsnPairDef *fPairDef; // pair definition (particles, charges) AliRsnCutManager fCutManager; // collection of all cuts AliRsnMother fMother; // mother candidate (to avoid creating it continuously) - AliRsnEvent *fEvent; //! pointer to current event private: diff --git a/PWG2/RESONANCES/AliRsnPairFunctions.cxx b/PWG2/RESONANCES/AliRsnPairFunctions.cxx index c649c47b1a8..2e2710d4035 100644 --- a/PWG2/RESONANCES/AliRsnPairFunctions.cxx +++ b/PWG2/RESONANCES/AliRsnPairFunctions.cxx @@ -96,7 +96,6 @@ void AliRsnPairFunctions::Compute() { fcn->SetPairDef(fPairDef); fcn->SetPair(&fMother); - fcn->SetEvent(fEvent); fcn->Fill(); } @@ -149,20 +148,3 @@ void AliRsnPairFunctions::AddFunction(AliRsnFunction *const fcn) AliDebug(AliLog::kDebug+2,"->"); } - -//_____________________________________________________________________________ -void AliRsnPairFunctions::SetEvent(AliRsnEvent *event) -{ -// -// Set current event -// - - Int_t i; - fEvent = event; - - for (i = 0; i < fFunctions.GetEntries(); i++) - { - AliRsnFunction *fcn = (AliRsnFunction*)fFunctions.At(i); - fcn->SetEvent(event); - } -} diff --git a/PWG2/RESONANCES/AliRsnPairFunctions.h b/PWG2/RESONANCES/AliRsnPairFunctions.h index e8221a0dd83..732fda2c059 100644 --- a/PWG2/RESONANCES/AliRsnPairFunctions.h +++ b/PWG2/RESONANCES/AliRsnPairFunctions.h @@ -35,7 +35,6 @@ class AliRsnPairFunctions : public AliRsnPair TList* GenerateHistograms(const char *prefix = "", TList *list = 0); virtual void Compute(); virtual void Init(const char *prefix, TList *list); - virtual void SetEvent(AliRsnEvent *event); protected: diff --git a/PWG2/RESONANCES/AliRsnPairNtuple.cxx b/PWG2/RESONANCES/AliRsnPairNtuple.cxx index e82595b2260..a887d0068de 100644 --- a/PWG2/RESONANCES/AliRsnPairNtuple.cxx +++ b/PWG2/RESONANCES/AliRsnPairNtuple.cxx @@ -110,7 +110,7 @@ void AliRsnPairNtuple::Compute() computeOK = value->Eval(&fMother); break; case AliRsnTarget::kEvent: - computeOK = value->Eval(fEvent); + computeOK = value->Eval(AliRsnTarget::GetCurrentEvent()); break; default: AliError(Form("Allowed targets are mothers and events; cannot use axis '%s' which has target '%s'", value->GetName(), value->GetTargetTypeName())); @@ -174,21 +174,3 @@ Bool_t AliRsnPairNtuple::AddValue(AliRsnValue *const val) return kTRUE; } - -//_____________________________________________________________________________ -void AliRsnPairNtuple::SetEvent(AliRsnEvent *event) -{ -// -// Set current event -// - - fEvent = event; - - Int_t i, n = fValues.GetEntries(); - AliRsnValue *val = 0; - for (i = 0; i < n; i++) - { - val = (AliRsnValue*)fValues.At(i); - val->SetEvent(event); - } -} diff --git a/PWG2/RESONANCES/AliRsnPairNtuple.h b/PWG2/RESONANCES/AliRsnPairNtuple.h index 43daa9cc738..2d3132f16a0 100644 --- a/PWG2/RESONANCES/AliRsnPairNtuple.h +++ b/PWG2/RESONANCES/AliRsnPairNtuple.h @@ -28,7 +28,6 @@ class AliRsnPairNtuple : public AliRsnPair void GenerateNtuple(const char *prefix = "", TList *list = 0); virtual void Compute(); virtual void Init(const char *prefix, TList *list); - virtual void SetEvent(AliRsnEvent *event); private: diff --git a/PWG2/RESONANCES/AliRsnTarget.cxx b/PWG2/RESONANCES/AliRsnTarget.cxx index cc61c273ad3..106f4dd65dd 100644 --- a/PWG2/RESONANCES/AliRsnTarget.cxx +++ b/PWG2/RESONANCES/AliRsnTarget.cxx @@ -19,6 +19,8 @@ ClassImp(AliRsnTarget) +AliRsnEvent* AliRsnTarget::fgCurrentEvent = 0x0; + //_____________________________________________________________________________ Bool_t AliRsnTarget::TargetOK(TObject *object) { @@ -100,14 +102,3 @@ const char* AliRsnTarget::GetTargetTypeName() const default: return "Undefined"; } } - -//______________________________________________________________________________ -void AliRsnTarget::SetEvent(AliRsnEvent *event) -{ -// -// -// - - AliDebug(AliLog::kDebug + 3, "Using implementation of mother class"); - fEvent = event; -} diff --git a/PWG2/RESONANCES/AliRsnTarget.h b/PWG2/RESONANCES/AliRsnTarget.h index 85147e4ee7e..d98d7eb20c0 100644 --- a/PWG2/RESONANCES/AliRsnTarget.h +++ b/PWG2/RESONANCES/AliRsnTarget.h @@ -28,10 +28,10 @@ class AliRsnTarget : public TNamed kTargetTypes }; - AliRsnTarget() : fTargetType(kTargetTypes), fEvent(0x0) { /*nothing*/ } - AliRsnTarget(const char *name, ETargetType type) : TNamed(name, ""), fTargetType(type), fEvent(0x0) { /*nothing*/ } - AliRsnTarget(const AliRsnTarget& copy) : TNamed(copy), fTargetType(copy.fTargetType), fEvent(copy.fEvent) { /*nothing*/ } - AliRsnTarget& operator=(const AliRsnTarget& copy) { TNamed::operator=(copy); fTargetType = copy.fTargetType; fEvent = copy.fEvent; return (*this); } + AliRsnTarget() : fTargetType(kTargetTypes) { /*nothing*/ } + AliRsnTarget(const char *name, ETargetType type) : TNamed(name, ""), fTargetType(type) { /*nothing*/ } + AliRsnTarget(const AliRsnTarget& copy) : TNamed(copy), fTargetType(copy.fTargetType) { /*nothing*/ } + AliRsnTarget& operator=(const AliRsnTarget& copy) { TNamed::operator=(copy); fTargetType = copy.fTargetType; return (*this); } virtual ~AliRsnTarget() { /*nothing*/ } Bool_t IsTarget(ETargetType targetType) {return (fTargetType == targetType);} @@ -41,13 +41,15 @@ class AliRsnTarget : public TNamed void SetTargetType(ETargetType type) {fTargetType = type;} Bool_t TargetOK(TObject *object); - AliRsnEvent* GetEvent() {return fEvent;} - virtual void SetEvent(AliRsnEvent *event); + static AliRsnEvent* GetCurrentEvent() {return fgCurrentEvent;} + static void SetCurrentEvent(AliRsnEvent *event) {fgCurrentEvent = event;} + static void SwitchToFirst() {fgCurrentEvent = AliRsnEvent::GetCurrentEvent1();} + static void SwitchToSecond() {fgCurrentEvent = AliRsnEvent::GetCurrentEvent2();} protected: - ETargetType fTargetType; // target type selected for this object - AliRsnEvent *fEvent; //! pointer to current event (useful in many cases) + ETargetType fTargetType; // target type selected for this object + static AliRsnEvent *fgCurrentEvent; //! pointer to current event (useful in many cases) // ROOT dictionary ClassDef(AliRsnTarget, 1) diff --git a/PWG2/RESONANCES/AliRsnVATProcessInfo.cxx b/PWG2/RESONANCES/AliRsnVATProcessInfo.cxx index dafe636adce..fe020f30c07 100644 --- a/PWG2/RESONANCES/AliRsnVATProcessInfo.cxx +++ b/PWG2/RESONANCES/AliRsnVATProcessInfo.cxx @@ -136,7 +136,7 @@ void AliRsnVATProcessInfo::GenerateInfoList(TList *list) } //______________________________________________________________________________ -void AliRsnVATProcessInfo::FillInfo(AliRsnEvent *event) +void AliRsnVATProcessInfo::FillInfo() { // // This method defines how the information histograms must be filled. @@ -149,12 +149,13 @@ void AliRsnVATProcessInfo::FillInfo(AliRsnEvent *event) fHistUsedEvents->Fill(fEventUsed); + if (!fEventUsed) return; + Int_t i; AliRsnFunction *fcn = 0; for (i = 0; i < fEventFunctions.GetEntries(); i++) { fcn = (AliRsnFunction*)fEventFunctions.At(i); - fcn->SetEvent(event); fcn->Fill(); } } diff --git a/PWG2/RESONANCES/AliRsnVATProcessInfo.h b/PWG2/RESONANCES/AliRsnVATProcessInfo.h index 06aa03b4576..9d8930e2269 100644 --- a/PWG2/RESONANCES/AliRsnVATProcessInfo.h +++ b/PWG2/RESONANCES/AliRsnVATProcessInfo.h @@ -29,7 +29,7 @@ class AliRsnVATProcessInfo : public TNamed ~AliRsnVATProcessInfo(); void GenerateInfoList(TList* list); - virtual void FillInfo(AliRsnEvent *event = 0x0); + virtual void FillInfo(); virtual void PrintInfo(const Long64_t &num); const char* GetEventHistogramName() { return Form("hEventsUsed_%s",GetName()); }; diff --git a/PWG2/RESONANCES/AliRsnVAnalysisTaskSE.cxx b/PWG2/RESONANCES/AliRsnVAnalysisTaskSE.cxx index 09d787ab611..7720935058d 100644 --- a/PWG2/RESONANCES/AliRsnVAnalysisTaskSE.cxx +++ b/PWG2/RESONANCES/AliRsnVAnalysisTaskSE.cxx @@ -10,12 +10,13 @@ #include -#include "AliRsnVAnalysisTaskSE.h" - #include "AliESDEvent.h" #include "AliMCEvent.h" #include "AliAODEvent.h" #include "AliRsnEvent.h" +#include "AliRsnTarget.h" + +#include "AliRsnVAnalysisTaskSE.h" ClassImp(AliRsnVAnalysisTaskSE) @@ -39,12 +40,8 @@ AliRsnVAnalysisTaskSE::AliRsnVAnalysisTaskSE // Define the output slot for histograms. // - AliDebug(AliLog::kDebug+2,"<-"); - DefineOutput(1, TList::Class()); DefineOutput(2, TList::Class()); - - AliDebug(AliLog::kDebug+2,"->"); } //_____________________________________________________________________________ @@ -65,9 +62,6 @@ AliRsnVAnalysisTaskSE::AliRsnVAnalysisTaskSE(const AliRsnVAnalysisTaskSE& copy) // Copy constructor. // Defined for coding conventions compliance but never used. // - - AliDebug(AliLog::kDebug+2, "<-"); - AliDebug(AliLog::kDebug+2, "->"); } //_____________________________________________________________________________ @@ -78,11 +72,8 @@ void AliRsnVAnalysisTaskSE::LocalInit() // Defines the debug message level and calls the mother class LocalInit(). // - SetDebugForAllClasses(); - - AliDebug(AliLog::kDebug+2, "<-"); AliAnalysisTaskSE::LocalInit(); - AliDebug(AliLog::kDebug+2, "->"); + SetDebugForAllClasses(); } //_____________________________________________________________________________ @@ -92,9 +83,6 @@ Bool_t AliRsnVAnalysisTaskSE::UserNotify() // Calls the mother class Notify() // - AliDebug(AliLog::kDebug+2,"<-"); - AliDebug(AliLog::kDebug+2,"->"); - return AliAnalysisTaskSE::UserNotify(); } @@ -102,51 +90,38 @@ Bool_t AliRsnVAnalysisTaskSE::UserNotify() void AliRsnVAnalysisTaskSE::ConnectInputData(Option_t *opt) { // -// Connect input data. -// Links the data member pointers to any possible AliVEvenb input -// to the appropriate object belonging to the mother class, -// for a fast retrieval of informations from it through the -// data interface classes provided in this package. -// Makes use of dynamic_cast, in order to know the kind of input -// just checking if the casted pointers are NULL or not. -// +// Connect input data, which consist in initializing properly +// the pointer to the input event, which is dynamically casted +// to all available types, and this allows to know its type. +// Calls also the mother class omonyme method. +// - AliDebug(AliLog::kDebug+2,"<-"); AliAnalysisTaskSE::ConnectInputData(opt); - // getting AliESDEvent + // get AliESDEvent and, if successful + // retrieve the corresponding MC if exists fESDEvent = dynamic_cast(fInputEvent); - - if (fESDEvent) { - AliInfo(Form("Input is ESD (%p)", fESDEvent)); - - // getting AliMCEvent + if (fESDEvent) + { fMCEvent = (AliMCEvent*) MCEvent(); - if (fMCEvent) AliInfo(Form("Input is MC (%p)", fMCEvent)); + AliInfo(Form("Input event is of type ESD (%p)", fESDEvent)); + if (fMCEvent) AliInfo(Form("Input has an associated MC (%p)", fMCEvent)); } - // getting AliAODEvent from input + // get AliAODEvent from input and, if successful + // it will contain both the reconstructed and MC informations fAODEventIn = dynamic_cast(fInputEvent); - if (fAODEventIn) AliInfo(Form("Input is AOD INPUT (%p)",fAODEventIn)); + if (fAODEventIn) + { + AliInfo(Form("Input event if of type native AOD (%p)", fAODEventIn)); + } - // getting AliAODEvent if it is output from previous task + // get AliAODEvent from output of previous task fAODEventOut = dynamic_cast(AODEvent()); - if (fAODEventOut) AliInfo(Form("Input is AOD OUTPUT (%p)",fAODEventOut)); - - AliDebug(AliLog::kDebug+2,"->"); -} - -//_____________________________________________________________________________ -void AliRsnVAnalysisTaskSE::RsnUserCreateOutputObjects() -{ -// -// Define here all instructions to create output objects. -// This method will be called inside the "UserCreateOutputObjects" -// in the used task. -// - - AliDebug(AliLog::kDebug+2,"<-"); - AliDebug(AliLog::kDebug+2,"->"); + if (fAODEventOut) + { + AliInfo(Form("Input event if of type produced AOD from previous step (%p)",fAODEventOut)); + } } //_____________________________________________________________________________ @@ -154,37 +129,33 @@ void AliRsnVAnalysisTaskSE::UserCreateOutputObjects() { // // Creates and links to task all output objects. -// They are all stored inside a unique TList which will be saved -// in output slot #1. +// Does explicitly the initialization for the event info class, +// and then calls the customized function which must be overloaded +// in the applications of this base class. // SetDebugForAllClasses(); - AliDebug(AliLog::kDebug+2, "<-"); - + // set event info outputs fInfoList = new TList(); fInfoList->SetOwner(); fTaskInfo.GenerateInfoList(fInfoList); + + // create customized outputs RsnUserCreateOutputObjects(); PostData(1, fInfoList); - - AliDebug(AliLog::kDebug+2,"<-"); } //_____________________________________________________________________________ void AliRsnVAnalysisTaskSE::UserExec(Option_t* opt) { // -// +// Prepares for execution, setting the correct pointers of the +// RSN package event interface, which will point to the not NULL +// objects obtained from dynamic-casts called in ConnectInputData(). // - AliDebug(AliLog::kDebug+2,"<-"); - - // sets properly the RSN package event interface: - // if an ESD event is available, it has priority, - // otherwise the AOD event is used; - // if the MC information is available, it is linked if (fMCOnly && fMCEvent) { fRsnEvent.SetRef (fMCEvent); @@ -205,49 +176,38 @@ void AliRsnVAnalysisTaskSE::UserExec(Option_t* opt) fRsnEvent.SetRef (fAODEventIn); fRsnEvent.SetRefMC(fAODEventIn); } - else { - AliError("NO ESD or AOD object!!! Skipping ..."); + else + { + AliError("Unknown input event format. Skipping"); return; } - EventProcess(); - //AliRsnEvent::SetCurrentEvent(&fRsnEvent); - - RsnUserExec(opt); - - FillInfo(); - + // since this class is for single-event analysis + // both static pointers of AliRsnEvent class + // will point to the same unique datamember + AliRsnEvent::SetCurrentEvent1(&fRsnEvent, fEntry); + AliRsnEvent::SetCurrentEvent2(&fRsnEvent, fEntry); + AliRsnTarget::SwitchToFirst(); + + // call event preprocessing... + Bool_t preCheck = EventProcess(); + // ...then fill the information object and print informations... + fTaskInfo.FillInfo(); fTaskInfo.PrintInfo(fTaskInfo.GetNumerOfEventsProcessed()); - - PostData(1, fInfoList); - - AliDebug(AliLog::kDebug+2,"->"); -} - -//_____________________________________________________________________________ -void AliRsnVAnalysisTaskSE::RsnUserExec(Option_t*) -{ -// -// -// - - if (fESDEvent) { - AliDebug(AliLog::kDebug+1, Form("fESDEvent is %p", fESDEvent)); - AliDebug(AliLog::kDebug, Form("ESD tracks %d", fESDEvent->GetNumberOfTracks())); - } - if (fMCEvent) { - AliDebug(AliLog::kDebug+1, Form("fMCEvent is %p", fMCEvent)); - AliDebug(AliLog::kDebug, Form("MC tracks %d", fMCEvent->GetNumberOfTracks())); - } - if (fAODEventIn) { - AliDebug(AliLog::kDebug+1, Form("fAODEventIn is %p", fAODEventIn)); - AliDebug(AliLog::kDebug, Form("AOD (in) tracks %d", fAODEventIn->GetNumberOfTracks())); - } - - if (fAODEventOut) { - AliDebug(AliLog::kDebug+1, Form("fAODEventOut if %p", fAODEventOut)); - AliDebug(AliLog::kDebug, Form("AOD (out) tracks %d", fAODEventOut->GetNumberOfTracks())); + // ...and return if event did not pass selections + if (!preCheck) + { + AliDebug(AliLog::kDebug, "Event preprocessing has failed. Skipping event"); + return; } + + + // call customized implementation for execution + RsnUserExec(opt); + + // post outputs for the info object + // (eventually others are done in the derived classes) + PostData(1, fInfoList); } //_____________________________________________________________________________ @@ -259,11 +219,11 @@ void AliRsnVAnalysisTaskSE::Terminate(Option_t* opt) // and includes to the TList all task informations. // - AliDebug(AliLog::kDebug+2,"<-"); AliAnalysisTask::Terminate(); TList* list = dynamic_cast(GetOutputData(1)); - if (!list) { + if (!list) + { AliError(Form("At end of analysis, fOutList is %p", list)); return; } @@ -271,11 +231,11 @@ void AliRsnVAnalysisTaskSE::Terminate(Option_t* opt) RsnTerminate(opt); TH1I *hEventInfo = (TH1I*) list->FindObject(fTaskInfo.GetEventHistogramName()); - if (!hEventInfo) { - AliError(Form("hEventInfo is %p",hEventInfo)); + if (!hEventInfo) + { + AliError(Form("hEventInfo is %p", hEventInfo)); return; } - AliInfo(Form("=== %s ==================",GetName())); AliInfo(Form("Number Of Events Processed : %10lld",(Long64_t)hEventInfo->Integral())); AliInfo(Form("Number Of Events Accepted : %10lld",(Long64_t)hEventInfo->GetBinContent(2))); @@ -286,51 +246,48 @@ void AliRsnVAnalysisTaskSE::Terminate(Option_t* opt) } //_____________________________________________________________________________ -void AliRsnVAnalysisTaskSE::RsnTerminate(Option_t*) +void AliRsnVAnalysisTaskSE::RsnUserCreateOutputObjects() { // -// Overload this to add additional termination operations +// Define here all instructions to create output objects. +// This method will be called inside the "UserCreateOutputObjects" +// in the used task. // - AliDebug(AliLog::kDebug+2, "<-"); - AliDebug(AliLog::kDebug+2, "->"); + AliWarning("Implement this in derived classes"); } //_____________________________________________________________________________ -void AliRsnVAnalysisTaskSE::FillInfo() +void AliRsnVAnalysisTaskSE::RsnUserExec(Option_t*) { // -// Fill information object with statistics of analysis +// // - AliDebug(AliLog::kDebug+2, "<-"); - - fTaskInfo.FillInfo(&fRsnEvent); - - AliDebug(AliLog::kDebug+2,"->"); + AliWarning("Implement this in derived classes"); } //_____________________________________________________________________________ -void AliRsnVAnalysisTaskSE::EventProcess() +void AliRsnVAnalysisTaskSE::RsnTerminate(Option_t*) { // -// Performs some pre-processing of current event +// Overload this to add additional termination operations // - - fRsnEvent.SelectLeadingParticle(0); + + AliWarning("Implement this in derived classes"); } //_____________________________________________________________________________ -void AliRsnVAnalysisTaskSE::SetLogType(AliLog::EType_t type, TString allClasses) +Bool_t AliRsnVAnalysisTaskSE::EventProcess() { // -// Set Log level for this and other classes (list of their names) +// Performs some pre-processing of current event, +// which is useful for all the operations which +// need to be done only once for each event. // - - AliDebug(AliLog::kDebug+2,"<-"); - fLogType = type; - fLogClassesString = allClasses; - AliDebug(AliLog::kDebug+2,"->"); + + // in this case, return always a success + return kTRUE; } //_____________________________________________________________________________ @@ -340,16 +297,17 @@ void AliRsnVAnalysisTaskSE::SetDebugForAllClasses() // Set debug level for all classes for which it is required // - AliDebug(AliLog::kDebug+2, "<-"); - TObjArray* array = fLogClassesString.Tokenize(":"); - TObjString *str; - TString strr; - for (Int_t i=0;i< array->GetEntriesFast();i++) { - str = (TObjString *) array->At(i); - strr = str->GetString(); - AliLog::SetClassDebugLevel(strr.Data(), fLogType); - AliInfo(Form("Setting Debug to %s",strr.Data())); + TObjArray *array = fLogClassesString.Tokenize(":"); + TObjString *objStr; + TString str; + Int_t i, n = array->GetEntriesFast(); + + for (i = 0; i < n; i++) + { + objStr = (TObjString*)array->At(i); + str = objStr->GetString(); + AliLog::SetClassDebugLevel(str.Data(), fLogType); + AliInfo(Form("Setting Debug to %s", str.Data())); } - AliDebug(AliLog::kDebug+2,"->"); } diff --git a/PWG2/RESONANCES/AliRsnVAnalysisTaskSE.h b/PWG2/RESONANCES/AliRsnVAnalysisTaskSE.h index 8d4fcd6dd1f..e1560d23c59 100644 --- a/PWG2/RESONANCES/AliRsnVAnalysisTaskSE.h +++ b/PWG2/RESONANCES/AliRsnVAnalysisTaskSE.h @@ -7,13 +7,12 @@ // authors: Martin Vala (martin.vala@cern.ch) // Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it) // + #ifndef ALIRSNVANALYSISTASKSE_H #define ALIRSNVANALYSISTASKSE_H #include -#include "AliLog.h" - #include "AliAnalysisTaskSE.h" #include "AliRsnEvent.h" @@ -26,54 +25,52 @@ class AliMCEvent; class AliRsnVAnalysisTaskSE : public AliAnalysisTaskSE { public: - enum { - kMaxNumberOfOutputs=10 - }; - + AliRsnVAnalysisTaskSE(const char *name = "AliRsnVAnalysisTaskSE", Bool_t mcOnly = kFALSE); AliRsnVAnalysisTaskSE(const AliRsnVAnalysisTaskSE& copy); AliRsnVAnalysisTaskSE& operator= (const AliRsnVAnalysisTaskSE& /*copy*/) { return *this; } virtual ~AliRsnVAnalysisTaskSE() {/* Does nothing*/;} + // basic interface methods virtual void LocalInit(); virtual Bool_t UserNotify(); virtual void ConnectInputData(Option_t *opt); - // Implementation of interface methods virtual void UserCreateOutputObjects(); virtual void UserExec(Option_t* opt); virtual void Terminate(Option_t* opt); - // Implement this + // customized methods (to be implemented in derived classes) virtual void RsnUserCreateOutputObjects(); virtual void RsnUserExec(Option_t*); virtual void RsnTerminate(Option_t*); - virtual void FillInfo(); - virtual void EventProcess(); + // event pre-processing functions + virtual Bool_t EventProcess(); - // Prior probs + // getters AliRsnEvent* GetRsnEvent() {return &fRsnEvent;} AliRsnVATProcessInfo* GetInfo() {return &fTaskInfo;} - void SetMCOnly(Bool_t mcOnly = kTRUE) {fMCOnly = mcOnly;} - void SetLogType(AliLog::EType_t type, TString allClasses = ""); - void SetPrintInfoNumber(const Long64_t &num = 100) { fTaskInfo.SetPrintInfoNumber(num); } + // setters + void SetMCOnly(Bool_t mcOnly = kTRUE) {fMCOnly = mcOnly;} + void SetLogType(AliLog::EType_t type, const char *classes = "") {fLogType = type; fLogClassesString = classes;} + void SetPrintInfoNumber(const Long64_t &num = 100) {fTaskInfo.SetPrintInfoNumber(num);} protected: - AliLog::EType_t fLogType; // log type - TString fLogClassesString;// all classes string divided with ":" + AliLog::EType_t fLogType; // log type + TString fLogClassesString; // all classes string divided with ":" - AliESDEvent *fESDEvent; // ESD event - AliMCEvent *fMCEvent; // MC event - AliAODEvent *fAODEventIn; // AOD event from input - AliAODEvent *fAODEventOut; // AOD event from output from previous taks + AliESDEvent *fESDEvent; // ESD event + AliMCEvent *fMCEvent; // MC event + AliAODEvent *fAODEventIn; // AOD event from input + AliAODEvent *fAODEventOut; // AOD event from output from previous taks - Bool_t fMCOnly; // use only MC information - AliRsnEvent fRsnEvent; // interface to event for RSN package + Bool_t fMCOnly; // use only MC information + AliRsnEvent fRsnEvent; // interface to event for RSN package - TList *fInfoList; //! output list for informations - AliRsnVATProcessInfo fTaskInfo; // task info + TList *fInfoList; //! output list for informations + AliRsnVATProcessInfo fTaskInfo; // task info void SetDebugForAllClasses(); diff --git a/PWG2/RESONANCES/AliRsnValue.cxx b/PWG2/RESONANCES/AliRsnValue.cxx index e2acbe44775..6494b096121 100644 --- a/PWG2/RESONANCES/AliRsnValue.cxx +++ b/PWG2/RESONANCES/AliRsnValue.cxx @@ -231,6 +231,7 @@ const char* AliRsnValue::GetValueTypeName() const case kEventLeadingPt: return "EventLeadingPt"; case kEventMult: return "EventMult"; case kEventMultESDCuts: return "EventMultESDCuts"; + case kEventVz: return "EventVz"; default: return "Undefined"; } } @@ -279,6 +280,7 @@ void AliRsnValue::AssignTarget() case kEventLeadingPt: case kEventMult: case kEventMultESDCuts: + case kEventVz: SetTargetType(AliRsnTarget::kEvent); // end of event-related values break; // undefined value @@ -320,7 +322,7 @@ Bool_t AliRsnValue::Eval(TObject *object, Bool_t useMC) } break; case AliRsnTarget::kEvent: - if (!fEvent) + if (!AliRsnTarget::GetCurrentEvent()) { AliError(Form("[%s] expected: AliRsnEvent, passed: [%s]", GetName(), object->ClassName())); return kFALSE; @@ -460,12 +462,13 @@ Bool_t AliRsnValue::Eval(TObject *object, Bool_t useMC) break; case kPairAngleToLeading: { + AliRsnEvent *event = AliRsnTarget::GetCurrentEvent(); int ID1 = (mother->GetDaughter(0))->GetID(); int ID2 = (mother->GetDaughter(1))->GetID(); - //int leadingID = fEvent->SelectLeadingParticle(0); - Int_t leadingID = fEvent->GetLeadingParticleID(); + //int leadingID = event->SelectLeadingParticle(0); + Int_t leadingID = event->GetLeadingParticleID(); if (leadingID == ID1 || leadingID == ID2) return kFALSE; - AliRsnDaughter leadingPart = fEvent->GetDaughter(leadingID); + AliRsnDaughter leadingPart = event->GetDaughter(leadingID); AliVParticle *ref = leadingPart.GetRef(); fComputedValue = ref->Phi() - mother->Sum().Phi(); //return angle w.r.t. leading particle in the range -pi/2, 3/2pi @@ -475,7 +478,7 @@ Bool_t AliRsnValue::Eval(TObject *object, Bool_t useMC) } break; case kEventMult: - fComputedValue = (Double_t)fEvent->GetMultiplicity(0x0); + fComputedValue = (Double_t)AliRsnTarget::GetCurrentEvent()->GetMultiplicity(0x0); break; case kEventMultESDCuts: // this value requires an initialized ESDtrackCuts @@ -485,19 +488,23 @@ Bool_t AliRsnValue::Eval(TObject *object, Bool_t useMC) fComputedValue = 1E+10; return kFALSE; } - fComputedValue = (Double_t)fEvent->GetMultiplicity(esdCuts); + fComputedValue = (Double_t)AliRsnTarget::GetCurrentEvent()->GetMultiplicity(esdCuts); break; case kEventLeadingPt: { - int leadingID = fEvent->GetLeadingParticleID(); //fEvent->SelectLeadingParticle(0); - if(leadingID >= 0) { - AliRsnDaughter leadingPart = fEvent->GetDaughter(leadingID); + int leadingID = AliRsnTarget::GetCurrentEvent()->GetLeadingParticleID(); //fEvent->SelectLeadingParticle(0); + if(leadingID >= 0) + { + AliRsnDaughter leadingPart = AliRsnTarget::GetCurrentEvent()->GetDaughter(leadingID); AliVParticle *ref = leadingPart.GetRef(); fComputedValue = ref->Pt(); } else fComputedValue = 0; } break; + case kEventVz: + fComputedValue = AliRsnTarget::GetCurrentEvent()->GetRef()->GetPrimaryVertex()->GetZ(); + break; default: AliError(Form("[%s] Invalid value type for this computation", GetName())); return kFALSE; diff --git a/PWG2/RESONANCES/AliRsnValue.h b/PWG2/RESONANCES/AliRsnValue.h index 49288db295f..7d9bb353c30 100644 --- a/PWG2/RESONANCES/AliRsnValue.h +++ b/PWG2/RESONANCES/AliRsnValue.h @@ -53,6 +53,7 @@ class AliRsnValue : public AliRsnTarget kEventLeadingPt, // transverse momentum of the event leading particle kEventMult, // multiplicity computed as the number of tracks kEventMultESDCuts, // multiplicity computed as the number of track passing an ESD quality cut (need this cut defined) + kEventVz, // Z position of event primary vertex kValueTypes // last value is used to have a meaningless enum value for initializations }; diff --git a/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/AddRsnAnalysis.C b/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/AddRsnAnalysis.C index 87531fd2b0a..13dd0fa07c0 100644 --- a/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/AddRsnAnalysis.C +++ b/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/AddRsnAnalysis.C @@ -13,7 +13,8 @@ Bool_t AddRsnAnalysis ( const char *options, - const char *configs = "RsnConfigNoSA.C RsnConfigSA.C RsnConfigDipNoSA.C RsnConfigDipSA.C", + //const char *configs = "RsnConfigNoSA.C RsnConfigSA.C RsnConfigDipNoSA.C RsnConfigDipSA.C", + const char *configs = "RsnConfigTest.C", const char *path = "$(ALICE_ROOT)/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi" ) { diff --git a/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/AddRsnAnalysisMult.C b/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/AddRsnAnalysisMult.C index 11bdb310bfb..c17e0efa7ce 100644 --- a/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/AddRsnAnalysisMult.C +++ b/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/AddRsnAnalysisMult.C @@ -13,60 +13,78 @@ Bool_t AddRsnAnalysisMult ( const char *options, - const char *configs = "RsnConfigNoSA.C RsnConfigSA.C RsnConfigDipNoSA.C RsnConfigDipSA.C", + //const char *configs = "RsnConfigNoSA.C RsnConfigSA.C RsnConfigDipNoSA.C RsnConfigDipSA.C", + const char *configs = "RsnConfigDipSA.C", const char *path = "$(ALICE_ROOT)/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi" ) { // retrieve analysis manager AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); - - // interpret config string - TString strDataLabel(options); - Bool_t isSim = strDataLabel.Contains("sim"); - // initialize cuts: - // always the same on primary vertex - // different on multiplicity - gROOT->LoadMacro(Form("%s/ConfigESDCutsTPC.C", path)); - Double_t multMin[6] = {0 , 0, 6, 10, 15, 23 }; - Double_t multMax[6] = {1E+10, 6, 10, 15, 23, 1E+10}; - AliRsnCutPrimaryVertex *cutVertex = new AliRsnCutPrimaryVertex("cutVertex", 10.0, 0, kFALSE); - AliRsnCutValue *cutMult[6] = {0, 0, 0, 0, 0, 0}; - for (Int_t i = 0; i < 6; i++) + // define a common cut on primary vertex, + // which also checks pile-up + AliRsnCutPrimaryVertex *cutVertex = new AliRsnCutPrimaryVertex("cutVertex", 10.0, 0, kFALSE); + cutVertex->SetCheckPileUp(kTRUE); + + // initialize multiplicity cuts, and loads a standard macro for + // initializing the required support object + gROOT->LoadMacro(Form("%s/QualityCutsTPC.C", path)); + Double_t multMin[5] = {0, 6, 10, 15, 23 }; + Double_t multMax[5] = {5, 9, 14, 22, 1E+10}; + AliRsnCutValue *cutMult[5] = {0, 0, 0, 0, 0 }; + for (Int_t i = 0; i < 5; i++) { cutMult[i] = new AliRsnCutValue(Form("cutMult_%d", i), AliRsnValue::kEventMultESDCuts, multMin[i], multMax[i]); - // add the support cut to the value which computes the multiplicity - AliESDtrackCuts *cuts = new AliESDtrackCuts; - ConfigESDCutsTPC(cuts); + // initialize the support object: AliESDtrackCuts + // configured using the standard values + AliESDtrackCuts *cuts = new AliESDtrackCuts(QualityCutsTPC()); cutMult[i]->GetValueObj()->SetSupportObject(cuts); } - // initialize tasks with all available slots, even if not all of them will be used: - // loop on all multiplicity bins - for (Int_t i = 0; i < 6; i++) + // initialize several tasks, each one with different multiplicity cut + // and all with the same primary vertex + pile-up cut + for (Int_t i = 0; i < 1; i++) { + + // create the task and connect with physics selection AliRsnAnalysisSE *task = new AliRsnAnalysisSE(Form("RsnAnalysis_%d", i)); task->SetZeroEventPercentWarning(100.0); task->SelectCollisionCandidates(); - task->GetEventCuts()->AddCut(cutVertex); - task->GetEventCuts()->AddCut(cutMult[i]); - task->GetEventCuts()->SetCutScheme(Form("cutVertex&%s", cutMult[i]->GetName())); + // setup the cuts (first loop is for all multiplicities) + if (i == 0) + { + task->GetEventCuts()->AddCut(cutVertex); + task->GetEventCuts()->SetCutScheme("cutVertex"); + } + else + { + task->GetEventCuts()->AddCut(cutVertex); + task->GetEventCuts()->AddCut(cutMult[i - 1]); + task->GetEventCuts()->SetCutScheme(Form("cutVertex&%s", cutMult[i - 1]->GetName())); + } // add the task to manager mgr->AddTask(task); - // load and execute configuration macroes - TString sList(configs); - TObjArray *list = sList.Tokenize(" "); - Int_t nConfig = list->GetEntries(); - Int_t iConfig = 0; + // load and execute all required configuration macroes in the string (arg #2) + TString sList = configs; + TObjArray *list = sList.Tokenize(" "); + Int_t nConfig = list->GetEntries(); + Int_t iConfig = 0; for (iConfig = 0; iConfig < nConfig; iConfig++) { TObjString *ostr = (TObjString*)list->At(iConfig); - cout << "***** Processing config macro '" << ostr->GetString().Data() << endl; - gROOT->ProcessLine(Form(".x %s/%s(\"%s\",\"%s\",\"%s\")", path, ostr->GetString().Data(), task->GetName(), options, path)); + + // the config macro is assumed to be stored in the path in argument #3 + // and to have three arguments: task name, a free string of options and the path where it is stored + // --> all of them is a string, and then it must be passed with the quote marks + const char *macro = ostr->GetString().Data(); + const char *argName = Form("\"%s\"", task->GetName()); + const char *argOption = Form("\"%s\"", options); + const char *argPath = Form("\"%s\"", path); + gROOT->ProcessLine(Form(".x %s/%s(%s,%s,%s)", path, macro, argName, argOption, argPath)); } // connect input container according to source choice @@ -81,7 +99,8 @@ Bool_t AddRsnAnalysisMult AliAnalysisDataContainer *outputHist = mgr->CreateContainer(Form("RsnHist_%d", i), TList::Class(), AliAnalysisManager::kOutputContainer, commonPath); mgr->ConnectOutput(task, 1, outputInfo); mgr->ConnectOutput(task, 2, outputHist); - } + + } // end loop on tasks return kTRUE; } diff --git a/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/QualityCutsITS.C b/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/QualityCutsITS.C new file mode 100644 index 00000000000..e1682fad234 --- /dev/null +++ b/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/QualityCutsITS.C @@ -0,0 +1,31 @@ +// +// This macro is defined in order to have a unique point +// where the standard cuts are configured, in order to be sure +// that all common parts of the cuts will be defined coherently +// +AliESDtrackCuts QualityCutsITS() +{ + // create output variable + AliESDtrackCuts cuts; + + // general acceptance/pt cuts + cuts.SetPtRange ( 0.15, 1.0e+10); + cuts.SetEtaRange(-0.8 , 0.8); + + // DCA cuts + cuts.SetMaxDCAToVertexXYPtDep("0.02289+0.03136/pt^1.3"); + cuts.SetMaxDCAToVertexZ(2.0); + cuts.SetDCAToVertex2D(kFALSE); + cuts.SetRequireSigmaToVertex(kFALSE); + + // ITS related cuts for TPC+ITS tracks + cuts.SetRequireITSStandAlone(kTRUE); + cuts.SetRequireITSPureStandAlone(kFALSE); + cuts.SetRequireITSRefit(kTRUE); + cuts.SetMinNClustersITS(4); + cuts.SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny); + cuts.SetMaxChi2PerClusterITS(3.0); + + // finished + return cuts; +} diff --git a/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/QualityCutsTPC.C b/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/QualityCutsTPC.C new file mode 100644 index 00000000000..ecdf9f0f257 --- /dev/null +++ b/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/QualityCutsTPC.C @@ -0,0 +1,33 @@ +// +// This macro is defined in order to have a unique point +// where the standard cuts are configured, in order to be sure +// that all common parts of the cuts will be defined coherently +// +AliESDtrackCuts QualityCutsTPC() +{ + // create output variable + AliESDtrackCuts cuts; + + // general acceptance/pt cuts + cuts.SetPtRange ( 0.15, 1.0e+10); + cuts.SetEtaRange(-0.8 , 0.8); + + // DCA cuts + cuts.SetMaxDCAToVertexXYPtDep("0.0182+0.0350/pt^1.01"); + cuts.SetMaxDCAToVertexZ(2.0); + cuts.SetDCAToVertex2D(kFALSE); + cuts.SetRequireSigmaToVertex(kFALSE); + + // TPC related cuts for TPC+ITS tracks + cuts.SetMinNClustersTPC(70); + cuts.SetMaxChi2PerClusterTPC(4); + cuts.SetAcceptKinkDaughters(kFALSE); + cuts.SetRequireTPCRefit(kTRUE); + + // ITS related cuts for TPC+ITS tracks + cuts.SetRequireITSRefit(kTRUE); + cuts.SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny); + + // finished + return cuts; +} diff --git a/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfig.C b/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfig.C index e4bc6a739a5..eb9e6fc4fb1 100644 --- a/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfig.C +++ b/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfig.C @@ -1,3 +1,16 @@ +/* +#include +#include +#include +#include +#include +#include +#include +#include +#include "config/QualityCutsITS.C" +#include "config/QualityCutsTPC.C" +*/ + // // This function configures the entire task for all resonances the user is interested in. // This is done by creating all configuration objects which are defined in the package. @@ -22,39 +35,33 @@ Bool_t RsnConfig ) { // load useful macros - gROOT->LoadMacro(Form("%s/ConfigESDCutsITS.C", path)); - gROOT->LoadMacro(Form("%s/ConfigESDCutsTPC.C", path)); + gROOT->LoadMacro(Form("%s/QualityCutsITS.C", path)); + gROOT->LoadMacro(Form("%s/QualityCutsTPC.C", path)); // interpret the useful information from second argument TString opt(options); Bool_t isSim = opt.Contains("sim"); Bool_t isData = opt.Contains("data"); - Bool_t isESD = opt.Contains("ESD"); - Bool_t isAOD = opt.Contains("AOD"); + if (!isSim && !isData) + { + Error("RsnConfig", "Required to know if working on data or MC"); + return kFALSE; + } // interpret the specific info from third argument // which should be fixed in the various calls to this function - TString opt(config); - Bool_t realPID = opt.Contains("realistic"); - Bool_t perfPID = opt.Contains("perfect"); - Bool_t addITSSA = opt.Contains("its"); - Bool_t dipAngleCut = opt.Contains("dip"); - Int_t typePID = 0; - if (realPID) typePID = 1; - else if (perfPID) typePID = 2; + TString conf(config); + Bool_t addPID = conf.Contains("pid"); + Bool_t addITSSA = conf.Contains("its"); + Bool_t addDipCut = conf.Contains("dip"); - // info - const Char_t *pid[3] = {"nopid", "realistic", "perfect"}; - Info("RsnConfig2010PhiFcn", "=== Specific configuration: %s ===", config); - Info("RsnConfig2010PhiFcn", "--> PID : %s", pid[typePID]); - Info("RsnConfig2010PhiFcn", "--> ITS standalone: %s", (addITSSA ? "INCLUDED" : "EXCLUDED")); - Info("RsnConfig2010PhiFcn", "--> dip-angle cut : %s", (dipAngleCut ? "INCLUDED" : "EXCLUDED")); - // generate a common suffix depending on chosen options - TString suffix(pid[typePID]); - if (addITSSA) suffix += "_sa"; else suffix += "_nosa"; - if (dipAngleCut) suffix += "_dip"; - Info("RsnConfig2010PhiFcn", "--> suffix used : %s", suffix.Data()); + TString suffix; + if (addPID) suffix += "_pid"; + if (addITSSA) suffix += "_its"; + if (addDipCut) suffix += "_dip"; + Info("RsnConfig", "=== Specific configuration: %s ====================================================", config); + Info("RsnConfig", "=== suffix used : %s ====================================================", suffix.Data()); // retrieve analysis manager & task AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); @@ -77,10 +84,10 @@ Bool_t RsnConfig AliRsnPairDef *pairDefMM = new AliRsnPairDef(AliPID::kKaon, '-', AliPID::kKaon, '-', 333, 1.019455); // computation objects - AliRsnPairFunctions *pairPM = new AliRsnPairFunctions(Form("PairPM_%s", suffix.Data()), pairDefPM); - AliRsnPairFunctions *truePM = new AliRsnPairFunctions(Form("TruePM_%s", suffix.Data()), pairDefPM); - AliRsnPairFunctions *pairPP = new AliRsnPairFunctions(Form("PairPP_%s", suffix.Data()), pairDefPP); - AliRsnPairFunctions *pairMM = new AliRsnPairFunctions(Form("PairMM_%s", suffix.Data()), pairDefMM); + AliRsnPairFunctions *pairPM = new AliRsnPairFunctions(Form("PairPM%s", suffix.Data()), pairDefPM); + AliRsnPairFunctions *truePM = new AliRsnPairFunctions(Form("TruePM%s", suffix.Data()), pairDefPM); + AliRsnPairFunctions *pairPP = new AliRsnPairFunctions(Form("PairPP%s", suffix.Data()), pairDefPP); + AliRsnPairFunctions *pairMM = new AliRsnPairFunctions(Form("PairMM%s", suffix.Data()), pairDefMM); // // -- Setup cuts ---------------------------------------------------------------------------------- @@ -89,97 +96,66 @@ Bool_t RsnConfig // track cut ----------------------- // --> global cuts for 2010 analysis // --> most options are set to right values by default - AliRsnCutESD2010 *cuts2010_esd = new AliRsnCutESD2010(Form("cuts2010_esd_%s", suffix.Data())); - AliRsnCutAOD2010 *cuts2010_aod = new AliRsnCutAOD2010(Form("cuts2010_aod_%s", suffix.Data())); - // ----> set the flag for sim/data management (which sets some other options) - cuts2010_esd->SetMC(isSim); - cuts2010_aod->SetMC(isSim); - // ----> include or not the ITS standalone (TPC is always in) - cuts2010_esd->SetUseITSTPC(kTRUE); - cuts2010_esd->SetUseITSSA (addITSSA); - //cuts2010_aod->SetUseITSTPC(kTRUE); - //cuts2010_aod->SetUseITSSA (addITSSA); - // ----> require to check PID or not, depending on the label - if (realPID) + // --> second argument in constructor tells if we are working in simulation or not + AliRsnCutESD2010 *cuts2010 = new AliRsnCutESD2010(Form("cuts2010%s", suffix.Data()), isSim); + // --> set the reference particle for PID + cuts2010->SetPID(AliPID::kKaon); + // --> include or not the ITS standalone (TPC is always in) + cuts2010->SetUseITSTPC(kTRUE); + cuts2010->SetUseITSSA (addITSSA); + // --> set the quality cuts using the general macro and using the 'Copy()' method in AliESDtrackCuts + cuts2010->CopyCutsTPC(QualityCutsTPC()); + cuts2010->CopyCutsITS(QualityCutsITS()); + // --> set values for PID flags, depending on the choice expressed in the options + cuts2010->SetCheckITS (addPID); + cuts2010->SetCheckTPC (addPID); + cuts2010->SetCheckTOF (addPID); + // --> set the ITS PID-related variables + cuts2010->SetITSband(3.0); + // --> set the TPC PID-related variables + Double_t bbPar[5]; + if (isSim) { - // if doing realistic PID, it must be activated - cuts2010_esd->SetCheckITS (kTRUE); - cuts2010_esd->SetCheckTPC (kTRUE); - cuts2010_esd->SetCheckTOF (kTRUE); - cuts2010_aod->SetCheckITS (kTRUE); - cuts2010_aod->SetCheckTPC (kTRUE); - cuts2010_aod->SetCheckTOF (kTRUE); + bbPar[0] = 2.15898 / 50.0; + bbPar[1] = 1.75295E1; + bbPar[2] = 3.40030E-9; + bbPar[3] = 1.96178; + bbPar[4] = 3.91720; } else { - // otherwise (both for no pid and perfect PID) - // the PID cuts are deactivated - cuts2010_esd->SetCheckITS (kFALSE); - cuts2010_esd->SetCheckTPC (kFALSE); - cuts2010_esd->SetCheckTOF (kFALSE); - cuts2010_aod->SetCheckITS (kFALSE); - cuts2010_aod->SetCheckTPC (kFALSE); - cuts2010_aod->SetCheckTOF (kFALSE); + bbPar[0] = 1.41543 / 50.0; + bbPar[1] = 2.63394E1; + bbPar[2] = 5.0411E-11; + bbPar[3] = 2.12543; + bbPar[4] = 4.88663; } - // ----> set all other defaults - ConfigESDCutsTPC(cuts2010_esd->GetCutsTPC()); - ConfigESDCutsITS(cuts2010_esd->GetCutsITS()); - - // track cut ----------------------------- - // --> perfect PID for check of PID issues - AliRsnCutPID *cutPID = new AliRsnCutPID("cutPID", AliPID::kKaon, 0.0, kTRUE); + cuts2010->SetTPCrange(3.0, 5.0); + cuts2010->SetTPCpLimit(0.35); + cuts2010->GetESDpid()->GetTPCResponse().SetBetheBlochParameters(bbPar[0], bbPar[1], bbPar[2], bbPar[3], bbPar[4]); + // --> set the TOF PID-related variables + cuts2010->SetTOFrange(-3.0, 3.0); - // pair cut ---------------------- - // --> dip angle between daughters + // pair cut ---------------------------------------- + // --> dip angle between daughters: (it is a cosine) AliRsnCutValue *cutDip = new AliRsnCutValue("cutDip", AliRsnValue::kPairDipAngle, 0.02, 1.01); - // cut set for tracks------------------------ - // --> only common cuts for tracks are needed - // --> standard 2010 cuts are applied always - TString cutSchemeTrack; - if (isESD) - { - pairPM->GetCutManager()->GetCommonDaughterCuts()->AddCut(cuts2010_esd); - truePM->GetCutManager()->GetCommonDaughterCuts()->AddCut(cuts2010_esd); - pairPP->GetCutManager()->GetCommonDaughterCuts()->AddCut(cuts2010_esd); - pairMM->GetCutManager()->GetCommonDaughterCuts()->AddCut(cuts2010_esd); - - cutSchemeTrack += cuts2010_esd->GetName(); - } - else if (isAOD) - { - pairPM->GetCutManager()->GetCommonDaughterCuts()->AddCut(cuts2010_aod); - truePM->GetCutManager()->GetCommonDaughterCuts()->AddCut(cuts2010_aod); - pairPP->GetCutManager()->GetCommonDaughterCuts()->AddCut(cuts2010_aod); - pairMM->GetCutManager()->GetCommonDaughterCuts()->AddCut(cuts2010_aod); - - cutSchemeTrack += cuts2010_aod->GetName(); - } - else - { - Error("Required ESD or AOD"); - return kFALSE; - } - if (perfPID) - { - pairPM->GetCutManager()->GetCommonDaughterCuts()->AddCut(cutPID); - truePM->GetCutManager()->GetCommonDaughterCuts()->AddCut(cutPID); - pairPP->GetCutManager()->GetCommonDaughterCuts()->AddCut(cutPID); - pairMM->GetCutManager()->GetCommonDaughterCuts()->AddCut(cutPID); - - cutSchemeTrack += "&cutPID"; - } - pairPM->GetCutManager()->GetCommonDaughterCuts()->SetCutScheme(cutSchemeTrack.Data()); - truePM->GetCutManager()->GetCommonDaughterCuts()->SetCutScheme(cutSchemeTrack.Data()); - pairPP->GetCutManager()->GetCommonDaughterCuts()->SetCutScheme(cutSchemeTrack.Data()); - pairMM->GetCutManager()->GetCommonDaughterCuts()->SetCutScheme(cutSchemeTrack.Data()); + // setup cut set for tracks------------------------------------------------------------ + // --> in this case, only common cuts are applied, depending if working with ESD or AOD + // --> these cuts are added always + pairPM->GetCutManager()->GetCommonDaughterCuts()->AddCut(cuts2010); + truePM->GetCutManager()->GetCommonDaughterCuts()->AddCut(cuts2010); + pairPP->GetCutManager()->GetCommonDaughterCuts()->AddCut(cuts2010); + pairMM->GetCutManager()->GetCommonDaughterCuts()->AddCut(cuts2010); - // cut set for pairs--------------------------------------- - // --> add dip angle cut (but then include only if required) - AliRsnCutSet *cutSetPair = new AliRsnCutSet("cutsPair", AliRsnCut::kMother); - cutSetPair->AddCut(cutDip); - cutSetPair->SetCutScheme(cutDip->GetName()); - if (dipAngleCut) + pairPM->GetCutManager()->GetCommonDaughterCuts()->SetCutScheme(cuts2010->GetName()); + truePM->GetCutManager()->GetCommonDaughterCuts()->SetCutScheme(cuts2010->GetName()); + pairPP->GetCutManager()->GetCommonDaughterCuts()->SetCutScheme(cuts2010->GetName()); + pairMM->GetCutManager()->GetCommonDaughterCuts()->SetCutScheme(cuts2010->GetName()); + + // cut set for pairs--------------------- + // --> add dip angle cut only if required + if (addDipCut) { pairPM->GetCutManager()->GetMotherCuts()->AddCut(cutDip); truePM->GetCutManager()->GetMotherCuts()->AddCut(cutDip); @@ -192,7 +168,7 @@ Bool_t RsnConfig pairMM->GetCutManager()->GetMotherCuts()->SetCutScheme(cutDip->GetName()); } - // set additional option for true pairs when needed + // set additional option for true pairs truePM->SetOnlyTrue (kTRUE); truePM->SetCheckDecay(kTRUE); @@ -204,31 +180,21 @@ Bool_t RsnConfig // 0) invariant mass // 1) transverse momentum // 2) rapidity - // 3) multiplicity - Double_t mult[] = {0., 6., 10., 15., 23., 10000}; - Int_t nmult = sizeof(mult) / sizeof(mult[0]); - AliRsnValue *axisIM = new AliRsnValue("IM" , AliRsnValue::kPairInvMass , 0.9, 1.4, 0.001); - AliRsnValue *axisPt = new AliRsnValue("PT" , AliRsnValue::kPairPt , 0.0, 10.0, 0.100); - AliRsnValue *axisY = new AliRsnValue("Y" , AliRsnValue::kPairY ,-1.2, 1.2, 0.100); - AliRsnValue *axisMult = new AliRsnValue("Mult", AliRsnValue::kEventMultESDCuts, nmult, mult); - - // add the support cut to the value which computes the multiplicity - AliESDtrackCuts *cuts = new AliESDtrackCuts; - ConfigESDCutsTPC(cuts); - axisMult->SetSupportObject(cuts); + AliRsnValue *axisIM = new AliRsnValue("IM", AliRsnValue::kPairInvMass, 0.9, 1.3, 0.001); + AliRsnValue *axisPt = new AliRsnValue("PT", AliRsnValue::kPairPt , 0.0, 10.0, 0.100); + AliRsnValue *axisY = new AliRsnValue("Y" , AliRsnValue::kPairY , -1.1, 1.1, 0.100); // create function and add axes - AliRsnFunction *fcnImPtY = new AliRsnFunction; - if ( !fcnImPtY->AddAxis(axisIM ) ) return kFALSE; - if ( !fcnImPtY->AddAxis(axisPt ) ) return kFALSE; - if ( !fcnImPtY->AddAxis(axisY ) ) return kFALSE; - //if ( !fcnImPtY->AddAxis(axisMult) ) return kFALSE; + AliRsnFunction *fcn = new AliRsnFunction; + if ( !fcn->AddAxis(axisIM ) ) return kFALSE; + if ( !fcn->AddAxis(axisPt ) ) return kFALSE; + if ( !fcn->AddAxis(axisY ) ) return kFALSE; // add functions to pairs - pairPM->AddFunction(fcnImPtY); - truePM->AddFunction(fcnImPtY); - pairPP->AddFunction(fcnImPtY); - pairMM->AddFunction(fcnImPtY); + pairPM->AddFunction(fcn); + truePM->AddFunction(fcn); + pairPP->AddFunction(fcn); + pairMM->AddFunction(fcn); // // -- Conclusion ---------------------------------------------------------------------------------- @@ -236,9 +202,9 @@ Bool_t RsnConfig // add all created AliRsnPair objects to the AliRsnAnalysisManager in the task task->GetAnalysisManager()->Add(pairPM); - task->GetAnalysisManager()->Add(pairPP); - task->GetAnalysisManager()->Add(pairMM); - if (isSim) task->GetAnalysisManager()->Add(truePM); + //task->GetAnalysisManager()->Add(pairPP); + //task->GetAnalysisManager()->Add(pairMM); + //if (isSim) task->GetAnalysisManager()->Add(truePM); return kTRUE; } diff --git a/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfigDipNoSA.C b/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfigDipNoSA.C index e64407190db..d99d4d98e0f 100644 --- a/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfigDipNoSA.C +++ b/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfigDipNoSA.C @@ -8,5 +8,5 @@ Bool_t RsnConfigDipNoSA(const char *taskName, const char *options, const char *path) { gROOT->LoadMacro("$(ALICE_ROOT)/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfig.C"); - return RsnConfig(taskName, options, "realistic+dip", path); + return RsnConfig(taskName, options, "pid+dip", path); } diff --git a/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfigDipSA.C b/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfigDipSA.C index 9e5e720164b..27c48739fd8 100644 --- a/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfigDipSA.C +++ b/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfigDipSA.C @@ -8,5 +8,5 @@ Bool_t RsnConfigDipSA(const char *taskName, const char *options, const char *path) { gROOT->LoadMacro("$(ALICE_ROOT)/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfig.C"); - return RsnConfig(taskName, options, "realistic+its+dip", path); + return RsnConfig(taskName, options, "pid+its+dip", path); } diff --git a/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfigNoSA.C b/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfigNoSA.C index 553a5b20876..e7229e7295a 100644 --- a/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfigNoSA.C +++ b/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfigNoSA.C @@ -8,5 +8,5 @@ Bool_t RsnConfigNoSA(const char *taskName, const char *options, const char *path) { gROOT->LoadMacro("$(ALICE_ROOT)/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfig.C"); - return RsnConfig(taskName, options, "realistic", path); + return RsnConfig(taskName, options, "pid", path); } diff --git a/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfigSA.C b/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfigSA.C index 84ce64ef3de..40d60c6ffc0 100644 --- a/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfigSA.C +++ b/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfigSA.C @@ -8,5 +8,5 @@ Bool_t RsnConfigSA(const char *taskName, const char *options, const char *path) { gROOT->LoadMacro("$(ALICE_ROOT)/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfig.C"); - return RsnConfig(taskName, options, "realistic+its", path); + return RsnConfig(taskName, options, "pid+its", path); } -- 2.43.0