From: fbellini Date: Thu, 24 Nov 2011 00:18:47 +0000 (+0000) Subject: Fix MC info for pairs + printing of mixing in mini task + added monitoring values... X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=commitdiff_plain;h=52e6652d44387ef8f5ac1c2af213e6fcc57818fd Fix MC info for pairs + printing of mixing in mini task + added monitoring values for daughters (M.Vala) --- diff --git a/PWG2/RESONANCES/AliRsnCutPID.cxx b/PWG2/RESONANCES/AliRsnCutPID.cxx index db19945dc79..b13b0231903 100644 --- a/PWG2/RESONANCES/AliRsnCutPID.cxx +++ b/PWG2/RESONANCES/AliRsnCutPID.cxx @@ -232,7 +232,7 @@ Int_t AliRsnCutPID::PerfectPID(AliRsnDaughter * const daughter) // loop over all species listed in AliPID to find the match Int_t i; for (i = 0; i < AliPID::kSPECIES; i++) { - if (AliPID::ParticleCode(i) == pdg) return i; + if (AliPID::ParticleCode(i) == TMath::Abs(pdg)) return i; } return AliPID::kUnknown; diff --git a/PWG2/RESONANCES/AliRsnLoopDaughter.cxx b/PWG2/RESONANCES/AliRsnLoopDaughter.cxx index 7ea5ae5b164..e97fc3f7c37 100644 --- a/PWG2/RESONANCES/AliRsnLoopDaughter.cxx +++ b/PWG2/RESONANCES/AliRsnLoopDaughter.cxx @@ -24,6 +24,7 @@ AliRsnLoopDaughter::AliRsnLoopDaughter(const char *name, Int_t listID, AliRsnDau AliRsnLoop(name), fTrueMC(kFALSE), fOnlyTrue(kFALSE), + fUseMCRef(kFALSE), fListID(listID), fDef(def), fDaughter() @@ -38,6 +39,7 @@ AliRsnLoopDaughter::AliRsnLoopDaughter(const AliRsnLoopDaughter& copy) : AliRsnLoop(copy), fTrueMC(copy.fTrueMC), fOnlyTrue(copy.fOnlyTrue), + fUseMCRef(copy.fUseMCRef), fListID(copy.fListID), fDef(copy.fDef), fDaughter(copy.fDaughter) @@ -57,6 +59,7 @@ AliRsnLoopDaughter& AliRsnLoopDaughter::operator=(const AliRsnLoopDaughter& copy AliRsnLoop::operator=(copy); fTrueMC = copy.fTrueMC; fOnlyTrue = copy.fOnlyTrue; + fUseMCRef = copy.fUseMCRef; fListID = copy.fListID; fDaughter = copy.fDaughter; fDef = copy.fDef; diff --git a/PWG2/RESONANCES/AliRsnLoopDaughter.h b/PWG2/RESONANCES/AliRsnLoopDaughter.h index 94b09d0e99b..af64a2e9ea9 100644 --- a/PWG2/RESONANCES/AliRsnLoopDaughter.h +++ b/PWG2/RESONANCES/AliRsnLoopDaughter.h @@ -27,6 +27,7 @@ public: void SetTrueMC(Bool_t yn = kTRUE) {fTrueMC = yn;} void SetOnlyTrue(Bool_t yn = kTRUE) {fOnlyTrue = yn;} + void SetMCRefInfo(Bool_t b = kTRUE) {fUseMCRef = b;} void SetListID(Int_t i) {fListID = i;} void SetDef(AliRsnDaughterDef *def) {fDef = def;} @@ -40,13 +41,14 @@ protected: Bool_t fTrueMC; // if this flag is TRUE, scan the MC for all true resonances from MC Bool_t fOnlyTrue; // for selecting only true particles + Bool_t fUseMCRef; // uses MC ref instead of REC Int_t fListID; // index of entry list to use AliRsnDaughterDef *fDef; // definition for selection AliRsnDaughter fDaughter; //! daughter temporary member private: - ClassDef(AliRsnLoopDaughter, 3) + ClassDef(AliRsnLoopDaughter, 4) }; #endif diff --git a/PWG2/RESONANCES/AliRsnLoopPair.cxx b/PWG2/RESONANCES/AliRsnLoopPair.cxx index a1106471d61..aa4295f076f 100644 --- a/PWG2/RESONANCES/AliRsnLoopPair.cxx +++ b/PWG2/RESONANCES/AliRsnLoopPair.cxx @@ -33,6 +33,7 @@ AliRsnLoopPair::AliRsnLoopPair(const char *name, AliRsnPairDef *def, Bool_t isMi AliRsnLoop(name, isMixed), fTrueMC(kFALSE), fOnlyTrue(kFALSE), + fUseMCRef(kFALSE), fCheckDecay(kFALSE), fRangeY(1E20), fPairDef(def), @@ -48,10 +49,11 @@ AliRsnLoopPair::AliRsnLoopPair(const char *name, AliRsnPairDef *def, Bool_t isMi } //_____________________________________________________________________________ -AliRsnLoopPair::AliRsnLoopPair(const AliRsnLoopPair& copy) : +AliRsnLoopPair::AliRsnLoopPair(const AliRsnLoopPair ©) : AliRsnLoop(copy), fTrueMC(copy.fTrueMC), fOnlyTrue(copy.fOnlyTrue), + fUseMCRef(copy.fUseMCRef), fCheckDecay(copy.fCheckDecay), fRangeY(copy.fRangeY), fPairDef(copy.fPairDef), @@ -67,16 +69,17 @@ AliRsnLoopPair::AliRsnLoopPair(const AliRsnLoopPair& copy) : } //_____________________________________________________________________________ -AliRsnLoopPair& AliRsnLoopPair::operator=(const AliRsnLoopPair& copy) +AliRsnLoopPair &AliRsnLoopPair::operator=(const AliRsnLoopPair ©) { // // Assignment operator // AliRsnLoop::operator=(copy); - + fTrueMC = copy.fTrueMC; fOnlyTrue = copy.fOnlyTrue; + fUseMCRef = copy.fUseMCRef; fCheckDecay = copy.fCheckDecay; fRangeY = copy.fRangeY; fPairDef = copy.fPairDef; @@ -118,12 +121,13 @@ Bool_t AliRsnLoopPair::Init(const char *prefix, TList *list) fMother.SetDaughter(0, &fDaughter[0]); fMother.SetDaughter(1, &fDaughter[1]); AliInfo(Form("[%s] Initialization", GetName())); - + TString name(prefix); name += '_'; name += GetName(); - if (IsMixed()) name.Prepend("mix_"); - +// if (IsMixed()) name.Prepend("mix_"); + if (IsMixed()) name.Append("_mix"); + return AliRsnLoop::Init(name.Data(), list); } @@ -149,7 +153,7 @@ Int_t AliRsnLoopPair::DoLoop selMix = selMain; } fMother.SetRefEvent(evMain); - + // check cuts if (!OkEvent(evMain)) { AliDebugClass(3, Form("[%s]: main event not accepted", GetName())); @@ -159,35 +163,38 @@ Int_t AliRsnLoopPair::DoLoop AliDebugClass(3, Form("[%s]: mixed event not accepted", GetName())); return 0; } - + // if it is required to loop over True MC, do this here and skip the rest of the method if (fTrueMC) return LoopTrueMC(evMain); - + Int_t i0, i1, start, npairs = 0; - + TEntryList *list0 = selMain->GetSelected(fListID[0], fPairDef->GetDef1().GetChargeC()); TEntryList *list1 = selMix ->GetSelected(fListID[1], fPairDef->GetDef2().GetChargeC()); if (!list0 || !list1) { AliError("Can't process NULL lists"); return 0; } - AliDebugClass(3, Form("[%s]: list counts: %d, %d", GetName(), (Int_t)list0->GetN(), (Int_t)list1->GetN())); + AliDebugClass(3, Form("[%s]: list counts: %lld, %lld", GetName(), list0->GetN(), list1->GetN())); if (!list0->GetN() || !list1->GetN()) { AliDebugClass(3, Form("[%s]: at least one list is empty", GetName())); return 0; } - + TObjArrayIter next(&fOutputs); AliRsnListOutput *out = 0x0; - + Long64_t iEntry1,iEntry2; for (i0 = 0; i0 < list0->GetN(); i0++) { - evMain->SetDaughter(fDaughter[0], (Int_t)list0->GetEntry(i0)); + iEntry1 = list0->GetEntry(i0); + evMain->SetDaughter(fDaughter[0], iEntry1,fUseMCRef); fDaughter[0].FillP(fPairDef->GetDef1().GetMass()); start = 0; if (!fIsMixed && list0 == list1) start = i0 + 1; for (i1 = start; i1 < list1->GetN(); i1++) { - AliDebugClass(4, Form("Checking entries pair: %d (%d) with %d (%d)", (Int_t)i0, (Int_t)list0->GetEntry(i0), (Int_t)i1, (Int_t)list1->GetEntry(i1))); - evMix->SetDaughter(fDaughter[1], (Int_t)list1->GetEntry(i1)); + iEntry2 = list1->GetEntry(i1); + if (iEntry1 == iEntry2) continue; + AliDebugClass(4, Form("Checking entries pair: %d (%lld) with %d (%lld)", i0, iEntry1, i1, iEntry2)); + evMix->SetDaughter(fDaughter[1], iEntry2,fUseMCRef); fDaughter[1].FillP(fPairDef->GetDef2().GetMass()); fMother.Sum(0) = fDaughter[0].Prec() + fDaughter[1].Prec(); fMother.Sum(1) = fDaughter[0].Psim() + fDaughter[1].Psim(); @@ -214,7 +221,7 @@ Int_t AliRsnLoopPair::DoLoop } // fill outputs next.Reset(); - while ( (out = (AliRsnListOutput*)next()) ) { + while ( (out = (AliRsnListOutput *)next()) ) { if (out->Fill(&fMother)) npairs++; else AliDebugClass(3, Form("[%s]: failed computation", GetName())); } @@ -231,13 +238,13 @@ Bool_t AliRsnLoopPair::IsTrueMother() // Checks to see if the mother comes from a true resonance. // It is triggered by the 'SetOnlyTrue()' function // - + // check #1: // daughters have same mother with the right PDG code Int_t commonPDG = fMother.CommonMother(); if (commonPDG != fPairDef->GetMotherPDG()) return kFALSE; AliDebugClass(1, "Found a true mother"); - + // check #2: // checks if daughter have the right particle type // (activated by fCheckDecay) @@ -248,7 +255,7 @@ Bool_t AliRsnLoopPair::IsTrueMother() if (!def2.MatchesPID(&fDaughter[1])) return kFALSE; } AliDebugClass(1, "Decay products match"); - + return kTRUE; } @@ -290,17 +297,17 @@ Bool_t AliRsnLoopPair::AssignMotherAndDaughtersESD(AliRsnEvent *rsnEvent, Int_t AliMCEvent *mc = rsnEvent->GetRefMCESD(); AliStack *stack = mc->Stack(); - AliMCParticle *mother = (AliMCParticle*)mc->GetTrack(ipart); + AliMCParticle *mother = (AliMCParticle *)mc->GetTrack(ipart); TParticle *motherP = mother->Particle(); Int_t ntracks = stack->GetNtrack(); - + // check PDG code and exit if it is wrong if (TMath::Abs(motherP->GetPdgCode()) != fPairDef->GetMotherPDG()) return kFALSE; - + // check number of daughters and exit if it is not 2 if (motherP->GetNDaughters() < 2) return kFALSE; //if (!stack->IsPhysicalPrimary(ipart)) return kFALSE; - + /* // check distance from primary vertex TLorentzVector vprod; @@ -310,9 +317,9 @@ Bool_t AliRsnLoopPair::AssignMotherAndDaughtersESD(AliRsnEvent *rsnEvent, Int_t return kFALSE; } */ - + // get the daughters and check their PDG code and charge: - // if they match one of the pair daughter definitions, + // if they match one of the pair daughter definitions, // assign them as MC reference of the 'fDaughter' objects fDaughter[0].Reset(); fDaughter[1].Reset(); @@ -327,7 +334,7 @@ Bool_t AliRsnLoopPair::AssignMotherAndDaughtersESD(AliRsnEvent *rsnEvent, Int_t return kFALSE; } // get daughter and its PDG and charge - daughter = (AliMCParticle*)mc->GetTrack(index[i]); + daughter = (AliMCParticle *)mc->GetTrack(index[i]); pdg = TMath::Abs(daughter->Particle()->GetPdgCode()); charge = (Short_t)(daughter->Particle()->GetPDG()->Charge() / 3); // check if it matches one definition @@ -341,7 +348,7 @@ Bool_t AliRsnLoopPair::AssignMotherAndDaughtersESD(AliRsnEvent *rsnEvent, Int_t fDaughter[1].SetLabel(index[i]); } } - + // return success if both daughters were assigned if (fDaughter[0].IsOK() && fDaughter[1].IsOK()) { return kTRUE; @@ -365,16 +372,16 @@ Bool_t AliRsnLoopPair::AssignMotherAndDaughtersAOD(AliRsnEvent *rsnEvent, Int_t // AliAODEvent *aod = rsnEvent->GetRefAOD(); - TClonesArray *listAOD = (TClonesArray*)(aod->GetList()->FindObject(AliAODMCParticle::StdBranchName())); - AliAODMCParticle *mother = (AliAODMCParticle*)listAOD->At(ipart); - + TClonesArray *listAOD = (TClonesArray *)(aod->GetList()->FindObject(AliAODMCParticle::StdBranchName())); + AliAODMCParticle *mother = (AliAODMCParticle *)listAOD->At(ipart); + // check PDG code and exit if it is wrong if (TMath::Abs(mother->GetPdgCode()) != fPairDef->GetMotherPDG()) return kFALSE; - + // check number of daughters and exit if it is not 2 if (mother->GetNDaughters() < 2) return kFALSE; if (!mother->IsPrimary()) return kFALSE; - + /* // check distance from primary vertex Double_t vprod[3] = {(Double_t)mother->Xv(), (Double_t)mother->Yv(), (Double_t)mother->Zv()}; @@ -384,9 +391,9 @@ Bool_t AliRsnLoopPair::AssignMotherAndDaughtersAOD(AliRsnEvent *rsnEvent, Int_t return kFALSE; } */ - + // get the daughters and check their PDG code and charge: - // if they match one of the pair daughter definitions, + // if they match one of the pair daughter definitions, // assign them as MC reference of the 'fDaughter' objects fDaughter[0].Reset(); fDaughter[1].Reset(); @@ -402,7 +409,7 @@ Bool_t AliRsnLoopPair::AssignMotherAndDaughtersAOD(AliRsnEvent *rsnEvent, Int_t return kFALSE; } // get daughter and its PDG and charge - daughter = (AliAODMCParticle*)listAOD->At(index[i]); + daughter = (AliAODMCParticle *)listAOD->At(index[i]); pdg = TMath::Abs(daughter->GetPdgCode()); charge = (Short_t)(daughter->Charge() / 3); // check if it matches one definition @@ -416,7 +423,7 @@ Bool_t AliRsnLoopPair::AssignMotherAndDaughtersAOD(AliRsnEvent *rsnEvent, Int_t fDaughter[1].SetLabel(index[i]); } } - + // return success if both daughters were assigned if (fDaughter[0].IsOK() && fDaughter[1].IsOK()) { return kTRUE; @@ -439,14 +446,14 @@ Int_t AliRsnLoopPair::LoopTrueMC(AliRsnEvent *rsn) AliError("Need a MC to compute efficiency"); return 0; } - + // check event type: // must be ESD or AOD, and then use a bool to know in the rest if (!rsn->IsESD() && !rsn->IsAOD()) { AliError("Need to process ESD or AOD input"); return 0; } - + // retrieve the MC primary vertex position // and do some additional coherence checks //Double_t fVertex[3] = {0.0, 0.0, 0.0}; @@ -460,25 +467,25 @@ Int_t AliRsnLoopPair::LoopTrueMC(AliRsnEvent *rsn) } else { //for (i = 0; i < 3; i++) fVertex[i] = 0.0; AliAODEvent *aod = rsn->GetRefMCAOD(); - TClonesArray *listAOD = (TClonesArray*)(aod->GetList()->FindObject(AliAODMCParticle::StdBranchName())); + TClonesArray *listAOD = (TClonesArray *)(aod->GetList()->FindObject(AliAODMCParticle::StdBranchName())); if (listAOD) npart = listAOD->GetEntries(); //AliAODMCHeader *mcH = static_cast(aod->FindListObject(AliAODMCHeader::StdBranchName())); //if (mcH) mcH->GetVertex(fVertex); } - + // check number of particles if (!npart) { AliInfo("Empty event"); return 0; } - + // utility variables Int_t ipart, count = 0; AliRsnDaughter check; - + TObjArrayIter next(&fOutputs); AliRsnListOutput *out = 0x0; - + // loop over particles for (ipart = 0; ipart < npart; ipart++) { // check i-th particle @@ -495,11 +502,12 @@ Int_t AliRsnLoopPair::LoopTrueMC(AliRsnEvent *rsn) } // fill outputs next.Reset(); - while ( (out = (AliRsnListOutput*)next()) ) { + while ( (out = (AliRsnListOutput *)next()) ) { if (out->Fill(&fMother)) count++; else AliDebugClass(3, Form("[%s]: failed computation", GetName())); } } - + return count; } + diff --git a/PWG2/RESONANCES/AliRsnLoopPair.h b/PWG2/RESONANCES/AliRsnLoopPair.h index 812ccea6090..3574fef3352 100644 --- a/PWG2/RESONANCES/AliRsnLoopPair.h +++ b/PWG2/RESONANCES/AliRsnLoopPair.h @@ -33,6 +33,7 @@ public: void SetPairCuts(AliRsnCutSet *cuts) {fPairCuts = cuts;} void SetTrueMC(Bool_t yn = kTRUE) {fTrueMC = yn;} void SetOnlyTrue(Bool_t onlyTrue = kTRUE) {fOnlyTrue = onlyTrue;} + void SetMCRefInfo(Bool_t b = kTRUE) {fUseMCRef = b;} void SetCheckDecay(Bool_t check = kTRUE) {fCheckDecay = check;} void SetListID(Int_t i, Int_t val) {if (i==0||i==1) fListID[i] = val;} void SetRangeY(Double_t range) {fRangeY = range;} @@ -52,6 +53,7 @@ protected: Bool_t fTrueMC; // if this flag is TRUE, scan the MC for all true resonances from MC Bool_t fOnlyTrue; // select true pairs only? + Bool_t fUseMCRef; // uses MC ref instead of REC Bool_t fCheckDecay; // is the decay channel correct in a true pair? Int_t fListID[2]; // indexes of the two entry lists to be used Double_t fRangeY; // range in rapidity (serves always) @@ -63,7 +65,7 @@ protected: private: - ClassDef(AliRsnLoopPair, 3) + ClassDef(AliRsnLoopPair, 4) }; #endif diff --git a/PWG2/RESONANCES/AliRsnMiniAnalysisTask.cxx b/PWG2/RESONANCES/AliRsnMiniAnalysisTask.cxx index 033aae60bd5..cd3a39d29dd 100644 --- a/PWG2/RESONANCES/AliRsnMiniAnalysisTask.cxx +++ b/PWG2/RESONANCES/AliRsnMiniAnalysisTask.cxx @@ -15,6 +15,7 @@ #include #include #include +#include #include "AliLog.h" #include "AliEventplane.h" @@ -36,6 +37,7 @@ #include "AliRsnMiniAnalysisTask.h" + ClassImp(AliRsnMiniAnalysisTask) //__________________________________________________________________________________________________ @@ -104,7 +106,7 @@ AliRsnMiniAnalysisTask::AliRsnMiniAnalysisTask(const char *name, Bool_t useMC) : } //__________________________________________________________________________________________________ -AliRsnMiniAnalysisTask::AliRsnMiniAnalysisTask(const AliRsnMiniAnalysisTask& copy) : +AliRsnMiniAnalysisTask::AliRsnMiniAnalysisTask(const AliRsnMiniAnalysisTask ©) : AliAnalysisTaskSE(copy), fUseMC(copy.fUseMC), fEvNum(0), @@ -136,7 +138,7 @@ AliRsnMiniAnalysisTask::AliRsnMiniAnalysisTask(const AliRsnMiniAnalysisTask& cop } //__________________________________________________________________________________________________ -AliRsnMiniAnalysisTask& AliRsnMiniAnalysisTask::operator=(const AliRsnMiniAnalysisTask& copy) +AliRsnMiniAnalysisTask &AliRsnMiniAnalysisTask::operator=(const AliRsnMiniAnalysisTask ©) { // // Assignment operator. @@ -145,7 +147,7 @@ AliRsnMiniAnalysisTask& AliRsnMiniAnalysisTask::operator=(const AliRsnMiniAnalys // AliAnalysisTaskSE::operator=(copy); - + fUseMC = copy.fUseMC; fUseCentrality = copy.fUseCentrality; fCentralityType = copy.fCentralityType; @@ -161,7 +163,7 @@ AliRsnMiniAnalysisTask& AliRsnMiniAnalysisTask::operator=(const AliRsnMiniAnalys fTriggerAna = copy.fTriggerAna; fESDtrackCuts = copy.fESDtrackCuts; fBigOutput = copy.fBigOutput; - + return (*this); } @@ -169,7 +171,7 @@ AliRsnMiniAnalysisTask& AliRsnMiniAnalysisTask::operator=(const AliRsnMiniAnalys AliRsnMiniAnalysisTask::~AliRsnMiniAnalysisTask() { // -// Destructor. +// Destructor. // Clean-up the output list, but not the histograms that are put inside // (the list is owner and will clean-up these histograms). Protect in PROOF case. // @@ -194,7 +196,7 @@ Int_t AliRsnMiniAnalysisTask::AddTrackCuts(AliRsnCutSet *cuts) // TObject *obj = fTrackCuts.FindObject(cuts->GetName()); - + if (obj) { AliInfo(Form("A cut set named '%s' already exists", cuts->GetName())); return fTrackCuts.IndexOf(obj); @@ -214,14 +216,14 @@ void AliRsnMiniAnalysisTask::UserCreateOutputObjects() // reset counter fEvNum = -1; - + // message AliInfo(Form("Selected event characterization: %s (%s)", (fUseCentrality ? "centrality" : "multiplicity"), fCentralityType.Data())); // initialize trigger analysis if (fTriggerAna) delete fTriggerAna; fTriggerAna = new AliTriggerAnalysis; - + // initialize ESD quality cuts if (fESDtrackCuts) delete fESDtrackCuts; fESDtrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(); @@ -230,7 +232,7 @@ void AliRsnMiniAnalysisTask::UserCreateOutputObjects() if (fBigOutput) OpenFile(1); fOutput = new TList(); fOutput->SetOwner(); - + // initialize event statistics counter fHEventStat = new TH1F("hEventStat", "Event statistics", 4, 0.0, 4.0); fHEventStat->GetXaxis()->SetBinLabel(1, "CINT1B"); @@ -238,24 +240,24 @@ void AliRsnMiniAnalysisTask::UserCreateOutputObjects() fHEventStat->GetXaxis()->SetBinLabel(3, "Candle"); fHEventStat->GetXaxis()->SetBinLabel(4, "Accepted"); fOutput->Add(fHEventStat); - + // create temporary tree for filtered events if (fMiniEvent) delete fMiniEvent; fEvBuffer = new TTree("EventBuffer", "Temporary buffer for mini events"); fEvBuffer->Branch("events", "AliRsnMiniEvent", &fMiniEvent); - + // create one histogram per each stored definition (event histograms) Int_t i, ndef = fHistograms.GetEntries(); AliRsnMiniOutput *def = 0x0; for (i = 0; i < ndef; i++) { - def = (AliRsnMiniOutput*)fHistograms[i]; + def = (AliRsnMiniOutput *)fHistograms[i]; if (!def) continue; if (!def->Init(GetName(), fOutput)) { AliError(Form("Def '%s': failed initialization", def->GetName())); continue; } } - + // post data for ALL output slots >0 here, to get at least an empty histogram PostData(1, fOutput); } @@ -276,16 +278,16 @@ void AliRsnMiniAnalysisTask::UserExec(Option_t *) // check current event Char_t check = CheckCurrentEvent(); if (!check) return; - + // setup PID response - AliAnalysisManager *man = AliAnalysisManager::GetAnalysisManager(); - AliInputEventHandler *inputHandler = (AliInputEventHandler*)man->GetInputEventHandler(); - fRsnEvent.SetPIDResponse(inputHandler->GetPIDResponse()); - + AliAnalysisManager *man = AliAnalysisManager::GetAnalysisManager(); + AliInputEventHandler *inputHandler = (AliInputEventHandler *)man->GetInputEventHandler(); + fRsnEvent.SetPIDResponse(inputHandler->GetPIDResponse()); + // fill a mini-event from current // and skip this event if no tracks were accepted FillMiniEvent(check); - + // fill MC based histograms on mothers, // which do need the original event if (fUseMC) { @@ -294,7 +296,7 @@ void AliRsnMiniAnalysisTask::UserExec(Option_t *) else if (fRsnEvent.IsAOD() && fRsnEvent.GetAODList()) FillTrueMotherAOD(fMiniEvent); } - + // if the event is not empty, store it if (fMiniEvent->IsEmpty()) { AliDebugClass(2, Form("Rejecting empty event #%d", fEvNum)); @@ -304,7 +306,7 @@ void AliRsnMiniAnalysisTask::UserExec(Option_t *) fMiniEvent->ID() = id; fEvBuffer->Fill(); } - + // post data for computed stuff PostData(1, fOutput); } @@ -321,24 +323,33 @@ void AliRsnMiniAnalysisTask::FinishTaskOutput() // security code: reassign the buffer to the mini-event cursor fEvBuffer->SetBranchAddress("events", &fMiniEvent); - + TStopwatch timer; // prepare variables Int_t ievt, nEvents = (Int_t)fEvBuffer->GetEntries(); Int_t idef, nDefs = fHistograms.GetEntries(); Int_t imix, iloop, ifill; AliRsnMiniOutput *def = 0x0; AliRsnMiniOutput::EComputation compType; + + Int_t printNum = 0; + if (nEvents>1e5) printNum=nEvents/100; + if (nEvents>1e4) printNum=nEvents/10; // loop on events, and for each one fill all outputs // using the appropriate procedure depending on its type // only mother-related histograms are filled in UserExec, // since they require direct access to MC event + timer.Start(); for (ievt = 0; ievt < nEvents; ievt++) { // get next entry fEvBuffer->GetEntry(ievt); + if (printNum&&(ievt%printNum==0)) { + AliInfo(Form("[%s] Std.Event %d/%d",GetName(), ievt,nEvents)); + timer.Stop(); timer.Print();fflush(stdout); timer.Start(kFALSE); + } // fill for (idef = 0; idef < nDefs; idef++) { - def = (AliRsnMiniOutput*)fHistograms[idef]; + def = (AliRsnMiniOutput *)fHistograms[idef]; if (!def) continue; compType = def->GetComputation(); // execute computation in the appropriate way @@ -373,14 +384,14 @@ void AliRsnMiniAnalysisTask::FinishTaskOutput() AliDebugClass(1, Form("Event %6d: def = '%15s' -- fills = %5d", ievt, def->GetName(), ifill)); } } - + // if no mixing is required, stop here and post the output if (fNMix < 1) { AliDebugClass(2, "Stopping here, since no mixing is required"); PostData(1, fOutput); return; } - + // initialize mixing counter Int_t nmatched[nEvents]; TString *smatched = new TString[nEvents]; @@ -389,8 +400,16 @@ void AliRsnMiniAnalysisTask::FinishTaskOutput() nmatched[ievt] = 0; } + + AliInfo(Form("[%s] Std.Event %d/%d",GetName(), nEvents,nEvents)); + timer.Stop(); timer.Print(); timer.Start();fflush(stdout); + // search for good matchings for (ievt = 0; ievt < nEvents; ievt++) { + if (printNum&&(ievt%printNum==0)) { + AliInfo(Form("[%s] EventMixing searching %d/%d",GetName(),ievt,nEvents)); + timer.Stop(); timer.Print(); timer.Start(kFALSE); fflush(stdout); + } if (nmatched[ievt] >= fNMix) continue; fEvBuffer->GetEntry(ievt); AliRsnMiniEvent evMain(*fMiniEvent); @@ -415,20 +434,27 @@ void AliRsnMiniAnalysisTask::FinishTaskOutput() AliDebugClass(1, Form("Matches for event %5d = %d [%s] (missing are declared above)", evMain.ID(), nmatched[ievt], smatched[ievt].Data())); } + AliInfo(Form("[%s] EventMixing searching %d/%d",GetName(),nEvents,nEvents)); + timer.Stop(); timer.Print();fflush(stdout); timer.Start(); + // perform mixing TObjArray *list = 0x0; TObjString *os = 0x0; for (ievt = 0; ievt < nEvents; ievt++) { + if (printNum&&(ievt%printNum==0)) { + AliInfo(Form("[%s] EventMixing %d/%d",GetName(),ievt,nEvents)); + timer.Stop(); timer.Print(); timer.Start(kFALSE); fflush(stdout); + } ifill = 0; fEvBuffer->GetEntry(ievt); AliRsnMiniEvent evMain(*fMiniEvent); list = smatched[ievt].Tokenize("|"); TObjArrayIter next(list); - while ( (os = (TObjString*)next()) ) { + while ( (os = (TObjString *)next()) ) { imix = os->GetString().Atoi(); fEvBuffer->GetEntry(imix); for (idef = 0; idef < nDefs; idef++) { - def = (AliRsnMiniOutput*)fHistograms[idef]; + def = (AliRsnMiniOutput *)fHistograms[idef]; if (!def) continue; if (!def->IsTrackPairMix()) continue; ifill += def->FillPair(&evMain, fMiniEvent, &fValues, kTRUE); @@ -440,11 +466,14 @@ void AliRsnMiniAnalysisTask::FinishTaskOutput() } delete list; } - + delete [] smatched; - + + AliInfo(Form("[%s] EventMixing %d/%d",GetName(),nEvents,nEvents)); + timer.Stop();timer.Print();fflush(stdout); + /* - OLD + OLD ifill = 0; for (iloop = 1; iloop < nEvents; iloop++) { imix = ievt + iloop; @@ -469,13 +498,13 @@ void AliRsnMiniAnalysisTask::FinishTaskOutput() // stop if mixed enough times if (fNMixed[ievt] >= fNMix) break; } - break; + break; // print number of mixings done with each event for (ievt = 0; ievt < nEvents; ievt++) { AliDebugClass(2, Form("Event %6d: mixed %2d times", ievt, fNMixed[ievt])); } */ - + // post computed data PostData(1, fOutput); } @@ -488,10 +517,10 @@ void AliRsnMiniAnalysisTask::Terminate(Option_t *) // Called once at the end of the query // - fOutput = dynamic_cast(GetOutputData(1)); - if (!fOutput) { - AliError("Could not retrieve TList fOutput"); - return; + fOutput = dynamic_cast(GetOutputData(1)); + if (!fOutput) { + AliError("Could not retrieve TList fOutput"); + return; } } @@ -517,7 +546,7 @@ Char_t AliRsnMiniAnalysisTask::CheckCurrentEvent() // string to sum messages TString msg(""); - + // check input type // exit points are provided in all cases an event is bad // if this block is passed, an event can be rejected only @@ -529,7 +558,7 @@ Char_t AliRsnMiniAnalysisTask::CheckCurrentEvent() output = 'E'; // ESD specific check: Physics Selection // --> if this is failed, the event is rejected - isSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kMB); + isSelected = (((AliInputEventHandler *)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kMB); if (!isSelected) { AliDebugClass(2, "Event does not pass physics selections"); fRsnEvent.SetRef(0x0); @@ -540,7 +569,7 @@ Char_t AliRsnMiniAnalysisTask::CheckCurrentEvent() fRsnEvent.SetRef(fInputEvent); // add MC if requested and available if (fUseMC) { - if (fMCEvent) + if (fMCEvent) fRsnEvent.SetRefMC(fMCEvent); else { AliWarning("MC event requested but not available"); @@ -567,29 +596,29 @@ Char_t AliRsnMiniAnalysisTask::CheckCurrentEvent() fRsnEvent.SetRefMC(0x0); return 0; } - + // fill counter of accepted events fHEventStat->Fill(0.1); - + // check if it is V0AND // --> uses a cast to AliESDEvent even if the input is an AliAODEvent - Bool_t v0A = fTriggerAna->IsOfflineTriggerFired((AliESDEvent*)fInputEvent, AliTriggerAnalysis::kV0A); - Bool_t v0C = fTriggerAna->IsOfflineTriggerFired((AliESDEvent*)fInputEvent, AliTriggerAnalysis::kV0C); + Bool_t v0A = fTriggerAna->IsOfflineTriggerFired((AliESDEvent *)fInputEvent, AliTriggerAnalysis::kV0A); + Bool_t v0C = fTriggerAna->IsOfflineTriggerFired((AliESDEvent *)fInputEvent, AliTriggerAnalysis::kV0C); if (v0A && v0C) { msg += " -- VOAND = YES"; fHEventStat->Fill(1.1); } else { msg += " -- VOAND = NO "; } - + // check candle // --> requires at least one good quality track with Pt > 0.5 and |eta| <= 0.8 Int_t iTrack, ntracksLoop = fInputEvent->GetNumberOfTracks(); Bool_t candle = kFALSE; - for (iTrack = 0; iTrack < ntracksLoop; iTrack++) { - AliVTrack *track = (AliVTrack*)fInputEvent->GetTrack(iTrack); - AliESDtrack *esdt = dynamic_cast(track); - AliAODTrack *aodt = dynamic_cast(track); + for (iTrack = 0; iTrack < ntracksLoop; iTrack++) { + AliVTrack *track = (AliVTrack *)fInputEvent->GetTrack(iTrack); + AliESDtrack *esdt = dynamic_cast(track); + AliAODTrack *aodt = dynamic_cast(track); if (track->Pt() < 0.5) continue; if(TMath::Abs(track->Eta()) > 0.8) continue; if (esdt) if (!fESDtrackCuts->AcceptTrack(esdt)) continue; @@ -598,12 +627,12 @@ Char_t AliRsnMiniAnalysisTask::CheckCurrentEvent() break; } if (candle) { - msg += " -- CANDLE = YES"; + msg += " -- CANDLE = YES"; fHEventStat->Fill(2.1); } else { - msg += " -- CANDLE = NO "; + msg += " -- CANDLE = NO "; } - + // if event cuts are defined, they are checked here // final decision on the event depends on this isSelected = kTRUE; @@ -619,7 +648,7 @@ Char_t AliRsnMiniAnalysisTask::CheckCurrentEvent() msg += " -- Local cuts = NONE"; isSelected = kTRUE; } - + // if the above exit point is not taken, the event is accepted AliDebugClass(2, Form("Stats: %s", msg.Data())); if (isSelected) { @@ -645,7 +674,7 @@ void AliRsnMiniAnalysisTask::FillMiniEvent(Char_t evType) fMiniEvent->Angle() = ComputeAngle(); fMiniEvent->Mult() = ComputeCentrality((evType == 'E')); AliDebugClass(2, Form("Event %d: type = %c -- vz = %f -- mult = %f -- angle = %f", fEvNum, evType, fMiniEvent->Vz(), fMiniEvent->Mult(), fMiniEvent->Angle())); - + // loop on daughters and assign track-related values Int_t ic, ncuts = fTrackCuts.GetEntries(); Int_t ip, npart = fRsnEvent.GetAbsoluteSum(); @@ -660,7 +689,7 @@ void AliRsnMiniAnalysisTask::FillMiniEvent(Char_t evType) miniParticle.Index() = ip; // switch on the bits corresponding to passed cuts for (ic = 0; ic < ncuts; ic++) { - AliRsnCutSet *cuts = (AliRsnCutSet*)fTrackCuts[ic]; + AliRsnCutSet *cuts = (AliRsnCutSet *)fTrackCuts[ic]; if (cuts->IsSelected(&cursor)) miniParticle.SetCutBit(ic); } // if a track passes at least one track cut, it is added to the pool @@ -671,7 +700,7 @@ void AliRsnMiniAnalysisTask::FillMiniEvent(Char_t evType) else nneu++; } } - + // get number of accepted tracks AliDebugClass(1, Form("Event %6d: total = %5d, accepted = %4d (pos %4d, neg %4d, neu %4d)", fEvNum, npart, (Int_t)fMiniEvent->Particles().GetEntriesFast(), npos, nneg, nneu)); } @@ -684,15 +713,15 @@ Double_t AliRsnMiniAnalysisTask::ComputeAngle() // AliEventplane *plane = 0x0; - + if (fInputEvent->InheritsFrom(AliESDEvent::Class())) plane = fInputEvent->GetEventplane(); else if (fInputEvent->InheritsFrom(AliAODEvent::Class())) { - AliAODEvent *aodEvent = (AliAODEvent*)fInputEvent; + AliAODEvent *aodEvent = (AliAODEvent *)fInputEvent; plane = aodEvent->GetHeader()->GetEventplaneP(); } - if (plane) + if (plane) return plane->GetEventplane("Q"); else { AliWarning("No event plane defined"); @@ -721,13 +750,13 @@ Double_t AliRsnMiniAnalysisTask::ComputeCentrality(Bool_t isESD) return fInputEvent->GetNumberOfTracks(); else if (!fCentralityType.CompareTo("QUALITY")) if (isESD) - return AliESDtrackCuts::GetReferenceMultiplicity((AliESDEvent*)fInputEvent, kTRUE); + return AliESDtrackCuts::GetReferenceMultiplicity((AliESDEvent *)fInputEvent, kTRUE); else { Double_t count = 0.; Int_t iTrack, ntracksLoop = fInputEvent->GetNumberOfTracks(); - for (iTrack = 0; iTrack < ntracksLoop; iTrack++) { - AliVTrack *track = (AliVTrack*)fInputEvent->GetTrack(iTrack); - AliAODTrack *aodt = dynamic_cast(track); + for (iTrack = 0; iTrack < ntracksLoop; iTrack++) { + AliVTrack *track = (AliVTrack *)fInputEvent->GetTrack(iTrack); + AliAODTrack *aodt = dynamic_cast(track); if (!aodt) continue; if (!aodt->TestFilterBit(5)) continue; count++; @@ -736,7 +765,7 @@ Double_t AliRsnMiniAnalysisTask::ComputeCentrality(Bool_t isESD) } else if (!fCentralityType.CompareTo("TRACKLETS")) { if (isESD) { - const AliMultiplicity *mult = ((AliESDEvent*)fInputEvent)->GetMultiplicity(); + const AliMultiplicity *mult = ((AliESDEvent *)fInputEvent)->GetMultiplicity(); Float_t nClusters[6] = {0.0,0.0,0.0,0.0,0.0,0.0}; for(Int_t ilay = 0; ilay < 6; ilay++) nClusters[ilay] = (Float_t)mult->GetNumberOfITSClusters(ilay); return AliESDUtils::GetCorrSPD2(nClusters[1], fInputEvent->GetPrimaryVertex()->GetZ()); @@ -765,20 +794,20 @@ void AliRsnMiniAnalysisTask::FillTrueMotherESD(AliRsnMiniEvent *miniEvent) AliMCParticle *daughter1, *daughter2; TLorentzVector p1, p2; AliRsnMiniOutput *def = 0x0; - + for (id = 0; id < ndef; id++) { - def = (AliRsnMiniOutput*)fHistograms[id]; + def = (AliRsnMiniOutput *)fHistograms[id]; if (!def) continue; if (!def->IsMother()) continue; for (ip = 0; ip < npart; ip++) { - AliMCParticle *part = (AliMCParticle*)fMCEvent->GetTrack(ip); + AliMCParticle *part = (AliMCParticle *)fMCEvent->GetTrack(ip); if (part->Particle()->GetPdgCode() != def->GetMotherPDG()) continue; // check that daughters match expected species if (part->Particle()->GetNDaughters() < 2) continue; label1 = part->Particle()->GetDaughter(0); label2 = part->Particle()->GetDaughter(1); - daughter1 = (AliMCParticle*)fMCEvent->GetTrack(label1); - daughter2 = (AliMCParticle*)fMCEvent->GetTrack(label2); + daughter1 = (AliMCParticle *)fMCEvent->GetTrack(label1); + daughter2 = (AliMCParticle *)fMCEvent->GetTrack(label2); okMatch = kFALSE; if (TMath::Abs(daughter1->Particle()->GetPdgCode()) == def->GetPDG(0) && TMath::Abs(daughter2->Particle()->GetPdgCode()) == def->GetPDG(1)) { okMatch = kTRUE; @@ -814,20 +843,20 @@ void AliRsnMiniAnalysisTask::FillTrueMotherAOD(AliRsnMiniEvent *miniEvent) AliAODMCParticle *daughter1, *daughter2; TLorentzVector p1, p2; AliRsnMiniOutput *def = 0x0; - + for (id = 0; id < ndef; id++) { - def = (AliRsnMiniOutput*)fHistograms[id]; + def = (AliRsnMiniOutput *)fHistograms[id]; if (!def) continue; if (!def->IsMother()) continue; for (ip = 0; ip < npart; ip++) { - AliAODMCParticle *part = (AliAODMCParticle*)list->At(ip); + AliAODMCParticle *part = (AliAODMCParticle *)list->At(ip); if (part->GetPdgCode() != def->GetMotherPDG()) continue; // check that daughters match expected species if (part->GetNDaughters() < 2) continue; label1 = part->GetDaughter(0); label2 = part->GetDaughter(1); - daughter1 = (AliAODMCParticle*)list->At(label1); - daughter2 = (AliAODMCParticle*)list->At(label2); + daughter1 = (AliAODMCParticle *)list->At(label1); + daughter2 = (AliAODMCParticle *)list->At(label2); okMatch = kFALSE; if (TMath::Abs(daughter1->GetPdgCode()) == def->GetPDG(0) && TMath::Abs(daughter2->GetPdgCode()) == def->GetPDG(1)) { okMatch = kTRUE; @@ -854,14 +883,14 @@ Bool_t AliRsnMiniAnalysisTask::EventsMatch(AliRsnMiniEvent *event1, AliRsnMiniEv // // Check if two events are compatible. // If the mixing is continuous, this is true if differences in vz, mult and angle are smaller than -// the specified values. +// the specified values. // If the mixing is binned, this is true if the events are in the same bin. // if (!event1 || !event2) return kFALSE; Int_t ivz1, ivz2, imult1, imult2, iangle1, iangle2; Double_t dv, dm, da; - + if (fContinuousMix) { dv = TMath::Abs(event1->Vz() - event2->Vz() ); dm = TMath::Abs(event1->Mult() - event2->Mult() ); @@ -893,4 +922,4 @@ Bool_t AliRsnMiniAnalysisTask::EventsMatch(AliRsnMiniEvent *event1, AliRsnMiniEv } } - + diff --git a/PWG2/RESONANCES/AliRsnValueDaughter.cxx b/PWG2/RESONANCES/AliRsnValueDaughter.cxx index d7887b7f230..270000391c6 100644 --- a/PWG2/RESONANCES/AliRsnValueDaughter.cxx +++ b/PWG2/RESONANCES/AliRsnValueDaughter.cxx @@ -107,6 +107,9 @@ const char* AliRsnValueDaughter::GetTypeName() const case kITSsignal: return "SingleTrackITSsignal"; case kTPCsignal: return "SingleTrackTPCsignal"; case kTOFsignal: return "SingleTrackTOFsignal"; + case kTPCnsigmaPi: return "SingleTrackTPCnsigmaPion"; + case kTPCnsigmaK: return "SingleTrackTPCnsigmaKaon"; + case kTPCnsigmaP: return "SingleTrackTPCnsigmaProton"; case kTOFnsigmaPi: return "SingleTrackTOFnsigmaPion"; case kTOFnsigmaK: return "SingleTrackTOFnsigmaKaon"; case kTOFnsigmaP: return "SingleTrackTOFnsigmaProton"; @@ -194,6 +197,36 @@ Bool_t AliRsnValueDaughter::Eval(TObject *object) fComputedValue = 0.0; return kFALSE; } + case kTPCnsigmaPi: + if (track) { + AliPIDResponse *pid = fEvent->GetPIDResponse(); + fComputedValue = pid->NumberOfSigmasTPC(track, AliPID::kPion); + return kTRUE; + } else { + AliWarning("Cannot get TOF signal for non-track object"); + fComputedValue = 0.0; + return kFALSE; + } + case kTPCnsigmaK: + if (track) { + AliPIDResponse *pid = fEvent->GetPIDResponse(); + fComputedValue = pid->NumberOfSigmasTPC(track, AliPID::kKaon); + return kTRUE; + } else { + AliWarning("Cannot get TOF signal for non-track object"); + fComputedValue = 0.0; + return kFALSE; + } + case kTPCnsigmaP: + if (track) { + AliPIDResponse *pid = fEvent->GetPIDResponse(); + fComputedValue = pid->NumberOfSigmasTPC(track, AliPID::kProton); + return kTRUE; + } else { + AliWarning("Cannot get TOF signal for non-track object"); + fComputedValue = 0.0; + return kFALSE; + } case kTOFnsigmaPi: if (track) { AliPIDResponse *pid = fEvent->GetPIDResponse();