From 5e55d806fc5bde663b4fd3afa910f27ede4a55ea Mon Sep 17 00:00:00 2001 From: kaamodt Date: Thu, 14 Jan 2010 13:08:35 +0000 Subject: [PATCH] Added new background scheeme, did some cleanup. added new bethe block parameters. New class for handling background events. --- .../AliAnalysisTaskGammaConversion.cxx | 142 +++++++------- .../GammaConv/AliGammaConversionBGHandler.cxx | 176 ++++++++++++++++++ PWG4/GammaConv/AliGammaConversionBGHandler.h | 83 +++++++++ PWG4/GammaConv/AliV0Reader.cxx | 94 +++++++--- PWG4/GammaConv/AliV0Reader.h | 17 +- PWG4/PWG4GammaConvLinkDef.h | 1 + PWG4/libPWG4GammaConv.pkg | 2 +- PWG4/macros/ConfigGammaConversion.C | 9 +- 8 files changed, 405 insertions(+), 119 deletions(-) create mode 100644 PWG4/GammaConv/AliGammaConversionBGHandler.cxx create mode 100644 PWG4/GammaConv/AliGammaConversionBGHandler.h diff --git a/PWG4/GammaConv/AliAnalysisTaskGammaConversion.cxx b/PWG4/GammaConv/AliAnalysisTaskGammaConversion.cxx index f1d2c14a674..95584cba3e6 100644 --- a/PWG4/GammaConv/AliAnalysisTaskGammaConversion.cxx +++ b/PWG4/GammaConv/AliAnalysisTaskGammaConversion.cxx @@ -31,6 +31,7 @@ //#include "AliCFManager.h" // for CF //#include "AliCFContainer.h" // for CF #include "AliGammaConversionAODObject.h" +#include "AliGammaConversionBGHandler.h" class AliCFContainer; class AliCFManager; @@ -291,33 +292,24 @@ void AliAnalysisTaskGammaConversion::Exec(Option_t */*option*/) fKFReconstructedGammasCutTClone->Delete(); fPreviousEventTLVNegElectronTClone->Delete(); fPreviousEventTLVPosElectronTClone->Delete(); - //fKFReconstructedGammasTClone->Clear(); - //fCurrentEventPosElectronTClone->Clear(); - //fCurrentEventNegElectronTClone->Clear(); - //fKFReconstructedGammasCutTClone->Clear(); - //fPreviousEventTLVNegElectronTClone->Clear(); - //fPreviousEventTLVPosElectronTClone->Clear(); - + //clear vectors - // fKFReconstructedGammas.clear(); fElectronv1.clear(); fElectronv2.clear(); - // fCurrentEventPosElectron.clear(); - // fCurrentEventNegElectron.clear(); - // fKFReconstructedGammasCut.clear(); fChargedParticles->Delete(); - //fChargedParticles->Clear(); + fChargedParticlesId.clear(); //Clear the data in the v0Reader - fV0Reader->UpdateEventByEventData(); + // fV0Reader->UpdateEventByEventData(); //Take Only events with proper trigger + /* if(fTriggerCINT1B){ if(!fV0Reader->GetESDEvent()->IsTriggerClassFired("CINT1B-ABCE-NOPF-ALL")) return; } - + */ // Process the MC information if(fDoMCTruth){ @@ -330,14 +322,10 @@ void AliAnalysisTaskGammaConversion::Exec(Option_t */*option*/) // Process the v0 information ProcessV0s(); + //Fill Gamma AOD FillAODWithConversionGammas() ; - //calculate background if flag is set - if(fCalculateBackground){ - CalculateBackground(); - } - // Process reconstructed gammas if(fDoNeutralMeson == kTRUE){ ProcessGammasForNeutralMesonAnalysis(); @@ -355,6 +343,14 @@ void AliAnalysisTaskGammaConversion::Exec(Option_t */*option*/) ProcessGammasForGammaJetAnalysis(); } + //calculate background if flag is set + if(fCalculateBackground){ + CalculateBackground(); + } + + //Clear the data in the v0Reader + fV0Reader->UpdateEventByEventData(); + PostData(1, fOutputContainer); PostData(2, fCFManager->GetParticleContainer()); // for CF @@ -1357,69 +1353,71 @@ void AliAnalysisTaskGammaConversion::ProcessGammasForNeutralMesonAnalysis(){ void AliAnalysisTaskGammaConversion::CalculateBackground(){ // see header file for documentation + + + TClonesArray * currentEventV0s = fV0Reader->GetCurrentEventGoodV0s(); + + for(Int_t nEventsInBG=0;nEventsInBG GetNBGEvents();nEventsInBG++){ + AliGammaConversionKFVector * previousEventV0s = fV0Reader->GetBGGoodV0s(nEventsInBG); + for(Int_t iCurrent=0;iCurrentGetEntriesFast();iCurrent++){ + AliKFParticle currentEventGoodV0 = *(AliKFParticle *)(currentEventV0s->At(iCurrent)); + for(UInt_t iPrevious=0;iPrevioussize();iPrevious++){ + AliKFParticle previousGoodV0 = (AliKFParticle)(*(previousEventV0s->at(iPrevious))); + + AliKFParticle *backgroundCandidate = new AliKFParticle(currentEventGoodV0,previousGoodV0); - vector vectorCurrentEventGoodV0s = fV0Reader->GetCurrentEventGoodV0s(); - vector vectorPreviousEventGoodV0s = fV0Reader->GetPreviousEventGoodV0s(); - - for(UInt_t iCurrent=0;iCurrentGetMass(massBG,widthBG); - if(backgroundCandidate->GetNDF()>0){ - chi2BG = backgroundCandidate->GetChi2()/backgroundCandidate->GetNDF(); - if(chi2BG>0 && chi2BGGetChi2CutMeson()){ + Double_t massBG =0.; + Double_t widthBG = 0.; + Double_t chi2BG =10000.; + backgroundCandidate->GetMass(massBG,widthBG); + if(backgroundCandidate->GetNDF()>0){ + chi2BG = backgroundCandidate->GetChi2()/backgroundCandidate->GetNDF(); + if(chi2BG>0 && chi2BGGetChi2CutMeson()){ - TVector3 momentumVectorbackgroundCandidate(backgroundCandidate->GetPx(),backgroundCandidate->GetPy(),backgroundCandidate->GetPz()); - TVector3 spaceVectorbackgroundCandidate(backgroundCandidate->GetX(),backgroundCandidate->GetY(),backgroundCandidate->GetZ()); + TVector3 momentumVectorbackgroundCandidate(backgroundCandidate->GetPx(),backgroundCandidate->GetPy(),backgroundCandidate->GetPz()); + TVector3 spaceVectorbackgroundCandidate(backgroundCandidate->GetX(),backgroundCandidate->GetY(),backgroundCandidate->GetZ()); - Double_t openingAngleBG = currentEventGoodV0->GetAngle(*previousGoodV0); + Double_t openingAngleBG = currentEventGoodV0.GetAngle(previousGoodV0); - Double_t rapidity; - if(backgroundCandidate->GetE() - backgroundCandidate->GetPz() == 0 || backgroundCandidate->GetE() + backgroundCandidate->GetPz() == 0) rapidity=0; - else rapidity = 0.5*(TMath::Log((backgroundCandidate->GetE() +backgroundCandidate->GetPz()) / (backgroundCandidate->GetE()-backgroundCandidate->GetPz()))); + Double_t rapidity; + if(backgroundCandidate->GetE() - backgroundCandidate->GetPz() == 0 || backgroundCandidate->GetE() + backgroundCandidate->GetPz() == 0) rapidity=0; + else rapidity = 0.5*(TMath::Log((backgroundCandidate->GetE() +backgroundCandidate->GetPz()) / (backgroundCandidate->GetE()-backgroundCandidate->GetPz()))); - if(openingAngleBG < fMinOpeningAngleGhostCut ){ - delete backgroundCandidate; - continue; // minimum opening angle to avoid using ghosttracks - } + if(openingAngleBG < fMinOpeningAngleGhostCut ){ + delete backgroundCandidate; + continue; // minimum opening angle to avoid using ghosttracks + } - fHistograms->FillHistogram("ESD_Background_GammaDaughter_OpeningAngle", openingAngleBG); - fHistograms->FillHistogram("ESD_Background_Energy", backgroundCandidate->GetE()); - fHistograms->FillHistogram("ESD_Background_Pt", momentumVectorbackgroundCandidate.Pt()); - fHistograms->FillHistogram("ESD_Background_Eta", momentumVectorbackgroundCandidate.Eta()); - fHistograms->FillHistogram("ESD_Background_Rapidity", rapidity); - fHistograms->FillHistogram("ESD_Background_Phi", spaceVectorbackgroundCandidate.Phi()); - fHistograms->FillHistogram("ESD_Background_Mass", massBG); - fHistograms->FillHistogram("ESD_Background_R", spaceVectorbackgroundCandidate.Pt()); // Pt in Space == R!!!! - fHistograms->FillHistogram("ESD_Background_ZR", backgroundCandidate->GetZ(), spaceVectorbackgroundCandidate.Pt()); - fHistograms->FillHistogram("ESD_Background_XY", backgroundCandidate->GetX(), backgroundCandidate->GetY()); - fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt",massBG,momentumVectorbackgroundCandidate.Pt()); - fHistograms->FillHistogram("ESD_Background_InvMass",massBG); - - if ( TMath::Abs(currentEventGoodV0->GetEta())<0.9 && TMath::Abs(previousGoodV0->GetEta())<0.9 ){ - fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt_Fiducial",massBG,momentumVectorbackgroundCandidate.Pt()); - fHistograms->FillHistogram("ESD_Background_InvMass_Fiducial",massBG); - } + fHistograms->FillHistogram("ESD_Background_GammaDaughter_OpeningAngle", openingAngleBG); + fHistograms->FillHistogram("ESD_Background_Energy", backgroundCandidate->GetE()); + fHistograms->FillHistogram("ESD_Background_Pt", momentumVectorbackgroundCandidate.Pt()); + fHistograms->FillHistogram("ESD_Background_Eta", momentumVectorbackgroundCandidate.Eta()); + fHistograms->FillHistogram("ESD_Background_Rapidity", rapidity); + fHistograms->FillHistogram("ESD_Background_Phi", spaceVectorbackgroundCandidate.Phi()); + fHistograms->FillHistogram("ESD_Background_Mass", massBG); + fHistograms->FillHistogram("ESD_Background_R", spaceVectorbackgroundCandidate.Pt()); // Pt in Space == R!!!! + fHistograms->FillHistogram("ESD_Background_ZR", backgroundCandidate->GetZ(), spaceVectorbackgroundCandidate.Pt()); + fHistograms->FillHistogram("ESD_Background_XY", backgroundCandidate->GetX(), backgroundCandidate->GetY()); + fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt",massBG,momentumVectorbackgroundCandidate.Pt()); + fHistograms->FillHistogram("ESD_Background_InvMass",massBG); + + if ( TMath::Abs(currentEventGoodV0.GetEta())<0.9 && TMath::Abs(previousGoodV0.GetEta())<0.9 ){ + fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt_Fiducial",massBG,momentumVectorbackgroundCandidate.Pt()); + fHistograms->FillHistogram("ESD_Background_InvMass_Fiducial",massBG); + } + } } + delete backgroundCandidate; } - delete backgroundCandidate; } } } - void AliAnalysisTaskGammaConversion::ProcessGammasForGammaJetAnalysis(){ //ProcessGammasForGammaJetAnalysis @@ -1668,7 +1666,7 @@ Double_t AliAnalysisTaskGammaConversion::GetMCOpeningAngle(TParticle* const daug void AliAnalysisTaskGammaConversion::CheckV0Efficiency(){ // see header file for documentation - + vector indexOfGammaParticle; fStack = fV0Reader->GetMCStack(); @@ -1889,14 +1887,7 @@ void AliAnalysisTaskGammaConversion::ProcessGammaElectronsForChicAnalysis(){ } else { - // vESDxNegTemp.push_back(curTrack); - /* if(vESDxNegTemp == NULL){ - cout<<"TCloes is zero"<GetEntriesFast()]) AliESDtrack(*curTrack); if( pid == 0){ @@ -1904,9 +1895,6 @@ void AliAnalysisTaskGammaConversion::ProcessGammaElectronsForChicAnalysis(){ fHistograms->FillHistogram("ESD_ElectronPosNegPt",curElec.Pt()); fHistograms->FillHistogram("ESD_ElectronNegPt",curElec.Pt()); fHistograms->FillHistogram("ESD_ElectronPosNegEta",curElec.Eta()); - // fHistograms->FillHistogram("MC_ElectronPosNegPt",curParticle->Pt()); - // fHistograms->FillHistogram("MC_ElectronPosNegEta",curParticle->Eta()); - //vESDeNegTemp.push_back(curTrack); new((*vESDeNegTemp)[vESDeNegTemp->GetEntriesFast()]) AliESDtrack(*curTrack); } diff --git a/PWG4/GammaConv/AliGammaConversionBGHandler.cxx b/PWG4/GammaConv/AliGammaConversionBGHandler.cxx new file mode 100644 index 00000000000..2b35c6af11b --- /dev/null +++ b/PWG4/GammaConv/AliGammaConversionBGHandler.cxx @@ -0,0 +1,176 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: Ana Marin, Kathrin Koch, Kenneth Aamodt * + * Version 1.0 * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +//////////////////////////////////////////////// +//--------------------------------------------- +// Class for handling of background calculation +//--------------------------------------------- +//////////////////////////////////////////////// + +#include "AliGammaConversionBGHandler.h" +#include "AliKFParticle.h" +#include "AliAnalysisTaskGammaConversion.h" + +using namespace std; + +ClassImp(AliGammaConversionBGHandler) + +AliGammaConversionBGHandler::AliGammaConversionBGHandler() : + TObject(), + fNEvents(10), + fBGEventCounter(NULL), + fNBinsZ(0), + fNBinsMultiplicity(0), + fBinLimitsArrayZ(NULL), + fBinLimitsArrayMultiplicity(NULL), + fBGEvents() +{ + // constructor +} + +AliGammaConversionBGHandler::AliGammaConversionBGHandler(UInt_t binsZ,UInt_t binsMultiplicity,UInt_t nEvents) : + TObject(), + fNEvents(nEvents), + fBGEventCounter(NULL), + fNBinsZ(binsZ), + fNBinsMultiplicity(binsMultiplicity), + fBinLimitsArrayZ(NULL), + fBinLimitsArrayMultiplicity(NULL), + fBGEvents(binsZ,AliGammaConversionMultipicityVector(binsMultiplicity,AliGammaConversionBGEventVector(nEvents))) +{ + // constructor +} + +AliGammaConversionBGHandler::AliGammaConversionBGHandler(const AliGammaConversionBGHandler & original) : + TObject(original), + fNEvents(original.fNEvents), + fBGEventCounter(original.fBGEventCounter), + fNBinsZ(original.fNBinsZ), + fNBinsMultiplicity(original.fNBinsMultiplicity), + fBinLimitsArrayZ(original.fBinLimitsArrayZ), + fBinLimitsArrayMultiplicity(original.fBinLimitsArrayMultiplicity), + fBGEvents(original.fBGEvents) +{ + //copy constructor +} + +AliGammaConversionBGHandler & AliGammaConversionBGHandler::operator = (const AliGammaConversionBGHandler & /*source*/) +{ + // assignment operator + return *this; +} + +AliGammaConversionBGHandler::~AliGammaConversionBGHandler(){ + + //Kenneth remember to clear memory!!!!!!!!!!!!!!!!!!!!! + if(fBGEventCounter){ + for(Int_t z=0;z= fBinLimitsArrayZ[i] && zvalue <= fBinLimitsArrayZ[i+1]){ + return i; + } + } + return fNBinsZ-1; +} + +Int_t AliGammaConversionBGHandler::GetMultiplicityBinIndex(Int_t multiplicity){ + // see header file for documantation + if(fNBinsMultiplicity<2){ + return 0; + } + + for(Int_t i=0; i fBinLimitsArrayMultiplicity[i] && multiplicity < fBinLimitsArrayMultiplicity[i+1]){ + return i; + } + } + return fNBinsMultiplicity-1; +} + +void AliGammaConversionBGHandler::AddEvent(TClonesArray * eventGammas, Double_t zvalue, Int_t multiplicity){ + // see header file for documantation + + Int_t z = GetZBinIndex(zvalue); + Int_t m = GetMultiplicityBinIndex(multiplicity); + + if(fBGEventCounter[z][m] >= fNEvents -1){ + fBGEventCounter[z][m]=0; + } + Int_t eventCounter=fBGEventCounter[z][m]; + + //first clear the vector which is present for any gammas + fBGEvents[z][m][eventCounter].fReconstructedGammas.clear(); + + // add the gammas to the vector + for(Int_t i=0; i< eventGammas->GetEntriesFast();i++){ + + fBGEvents[z][m][eventCounter].fReconstructedGammas.push_back((AliKFParticle*)(eventGammas->At(i))); + } + + //set the z and multiplicity numbers + fBGEvents[z][m][eventCounter].fZVertexPosition = zvalue; + fBGEvents[z][m][eventCounter].fChargedTrackMultiplicity = multiplicity; +} + +AliGammaConversionKFVector* AliGammaConversionBGHandler::GetBGGoodV0s(Int_t event, Double_t zvalue, Int_t multiplicity){ + + Int_t z = GetZBinIndex(zvalue); + Int_t m = GetMultiplicityBinIndex(multiplicity); + + return &(fBGEvents[z][m][event].fReconstructedGammas); +} diff --git a/PWG4/GammaConv/AliGammaConversionBGHandler.h b/PWG4/GammaConv/AliGammaConversionBGHandler.h new file mode 100644 index 00000000000..974aff4d950 --- /dev/null +++ b/PWG4/GammaConv/AliGammaConversionBGHandler.h @@ -0,0 +1,83 @@ +//-*- Mode: C++ -*- +#ifndef ALIGAMMACONVERSIONBGHANDLER_H +#define ALIGAMMACONVERSIONBGHANDLER_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +//////////////////////////////////////////////// +//--------------------------------------------- +// Class for handling of background calculation +//--------------------------------------------- +//////////////////////////////////////////////// + +#include + + +// --- ROOT system --- +#include +#include "AliKFParticle.h" +#include "TClonesArray.h" + +#if __GNUC__ >= 3 +using namespace std; +#endif + +typedef vector AliGammaConversionKFVector; + + +class AliGammaConversionBGHandler : public TObject { + + public: +struct AliGammaConversionBGEvent +{ + AliGammaConversionBGEvent() : + fReconstructedGammas(), + fChargedTrackMultiplicity(0), + fZVertexPosition(0.) + { + } + AliGammaConversionKFVector fReconstructedGammas; + UInt_t fChargedTrackMultiplicity; + Double_t fZVertexPosition; +}; typedef struct AliGammaConversionBGEvent AliGammaConversionBGEvent; //! + + + typedef vector AliGammaConversionBGEventVector; + // typedef vector AliGammaConversionBGEventVector; + typedef vector AliGammaConversionMultipicityVector; + typedef vector AliGammaConversionBGVector; + + + + AliGammaConversionBGHandler(); //constructor + AliGammaConversionBGHandler(UInt_t binsZ,UInt_t binsMultiplicity,UInt_t fNEvents); //constructor + AliGammaConversionBGHandler(const AliGammaConversionBGHandler & g); //copy constructor + AliGammaConversionBGHandler & operator = (const AliGammaConversionBGHandler & g); //assignment operator + virtual ~AliGammaConversionBGHandler(); //virtual destructor + + void Initialize(Double_t *zBinLimitsArray, Double_t *multiplicityBinLimitsArray); + + Int_t GetZBinIndex(Double_t z); + + Int_t GetMultiplicityBinIndex(Int_t mult); + + void AddEvent(TClonesArray * eventGammas, Double_t zvalue, Int_t multiplicity); + + Int_t GetNBGEvents(){return fNEvents;} + + AliGammaConversionKFVector* GetBGGoodV0s(Int_t event, Double_t zvalue, Int_t multiplicity); + + private: + + Int_t fNEvents; + Int_t ** fBGEventCounter; + + Int_t fNBinsZ; + Int_t fNBinsMultiplicity; + Double_t *fBinLimitsArrayZ; + Double_t *fBinLimitsArrayMultiplicity; + AliGammaConversionBGVector fBGEvents; + + ClassDef(AliGammaConversionBGHandler,0) +}; +#endif diff --git a/PWG4/GammaConv/AliV0Reader.cxx b/PWG4/GammaConv/AliV0Reader.cxx index 3d981ea7367..a9e829f6371 100644 --- a/PWG4/GammaConv/AliV0Reader.cxx +++ b/PWG4/GammaConv/AliV0Reader.cxx @@ -33,6 +33,7 @@ #include "AliStack.h" #include "AliMCEventHandler.h" #include "AliTPCpidESD.h" +#include "AliGammaConversionBGHandler.h" class iostream; class AliESDv0; @@ -102,8 +103,10 @@ AliV0Reader::AliV0Reader() : fDoCF(kFALSE), fUseOnFlyV0Finder(kTRUE), fUpdateV0AlreadyCalled(kFALSE), - fCurrentEventGoodV0s(), - fPreviousEventGoodV0s() + fCurrentEventGoodV0s(NULL), +// fPreviousEventGoodV0s(), + fBGEventHandler(NULL), + fBGEventInitialized(kFALSE) { fTPCpid = new AliTPCpidESD; } @@ -168,7 +171,9 @@ AliV0Reader::AliV0Reader(const AliV0Reader & original) : fUseOnFlyV0Finder(original.fUseOnFlyV0Finder), fUpdateV0AlreadyCalled(original.fUpdateV0AlreadyCalled), fCurrentEventGoodV0s(original.fCurrentEventGoodV0s), - fPreviousEventGoodV0s(original.fPreviousEventGoodV0s) + // fPreviousEventGoodV0s(original.fPreviousEventGoodV0s), + fBGEventHandler(original.fBGEventHandler), + fBGEventInitialized(original.fBGEventInitialized) { } @@ -188,6 +193,7 @@ AliV0Reader::~AliV0Reader() void AliV0Reader::Initialize(){ //see header file for documentation + fUpdateV0AlreadyCalled = kFALSE; // Get the input handler from the manager fESDHandler = (AliESDInputHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()); @@ -214,6 +220,20 @@ void AliV0Reader::Initialize(){ if(fMCStack == NULL){ //print warning here } + // Better parameters for MonteCarlo from A. Kalweit 2010/01/8 + fTPCpid->SetBetheBlochParameters( 2.15898e+00/50., + 1.75295e+01, + 3.40030e-09, + 1.96178e+00, + 3.91720e+00); + } + else{ + // Better parameters for data from A. Kalweit 2010/01/8 + fTPCpid->SetBetheBlochParameters(0.0283086, + 2.63394e+01, + 5.04114e-11, + 2.12543e+00, + 4.88663e+00); } // for CF @@ -225,9 +245,38 @@ void AliV0Reader::Initialize(){ fDoCF = kFALSE; } } + + + AliKFParticle::SetField(fESDEvent->GetMagneticField()); - + + // fCurrentEventGoodV0s = new TClonesArray("TClonesArray", 0); + fCurrentEventGoodV0s = new TClonesArray("AliKFParticle", 0); + + if(fBGEventInitialized == kFALSE){ + Double_t *zBinLimitsArray = new Double_t[8];//{-7,-5,-3,-1,1,3,5,7}; + zBinLimitsArray[0] = -7; + zBinLimitsArray[1] = -5; + zBinLimitsArray[2] = -3; + zBinLimitsArray[3] = -1; + zBinLimitsArray[4] = 1; + zBinLimitsArray[5] = 3; + zBinLimitsArray[6] = 5; + zBinLimitsArray[7] = 7; + + Double_t *multiplicityBinLimitsArray= new Double_t[4];//={0,10,20,500}; + multiplicityBinLimitsArray[0] = 0; + multiplicityBinLimitsArray[1] = 10; + multiplicityBinLimitsArray[2] = 20; + multiplicityBinLimitsArray[3] = 500; + + + fBGEventHandler = new AliGammaConversionBGHandler(8,4,10); + + fBGEventHandler->Initialize(zBinLimitsArray, multiplicityBinLimitsArray); + fBGEventInitialized = kTRUE; + } } AliESDv0* AliV0Reader::GetV0(Int_t index){ @@ -413,8 +462,10 @@ Bool_t AliV0Reader::NextV0(){ fHistograms->FillHistogram("ESD_GoodV0s_InvMass",GetMotherCandidateMass()); } - fCurrentEventGoodV0s.push_back(*fCurrentMotherKFCandidate); - + // fCurrentEventGoodV0s.push_back(*fCurrentMotherKFCandidate); + + new((*fCurrentEventGoodV0s)[fCurrentEventGoodV0s->GetEntriesFast()]) AliKFParticle(*fCurrentMotherKFCandidate); + iResult=kTRUE;//means we have a v0 who survived all the cuts applied fCurrentV0IndexNumber++; @@ -679,30 +730,10 @@ void AliV0Reader::GetPIDProbability(Double_t &negPIDProb,Double_t & posPIDProb){ void AliV0Reader::UpdateEventByEventData(){ //see header file for documentation - - if(fCurrentEventGoodV0s.size() >0 ){ - // fPreviousEventGoodV0s.clear(); - // fPreviousEventGoodV0s = fCurrentEventGoodV0s; - if(fPreviousEventGoodV0s.size()>19){ - for(UInt_t nCurrent=0;nCurrentGetEntriesFast() >0 ){ + fBGEventHandler->AddEvent(fCurrentEventGoodV0s,fESDEvent->GetPrimaryVertex()->GetZ(),fESDEvent->GetNumberOfTracks()); } - fCurrentEventGoodV0s.clear(); - + fCurrentEventGoodV0s->Delete(); fCurrentV0IndexNumber=0; } @@ -977,3 +1008,8 @@ Double_t AliV0Reader::GetConvPosZ(AliESDtrack* ptrack,AliESDtrack* ntrack, Doubl return convposz; } + +AliGammaConversionKFVector* AliV0Reader::GetBGGoodV0s(Int_t event){ + + return fBGEventHandler->GetBGGoodV0s(event,fESDEvent->GetPrimaryVertex()->GetZ(),fESDEvent->GetNumberOfTracks()); +} diff --git a/PWG4/GammaConv/AliV0Reader.h b/PWG4/GammaConv/AliV0Reader.h index 34c2b5aed69..c937e14dd2a 100644 --- a/PWG4/GammaConv/AliV0Reader.h +++ b/PWG4/GammaConv/AliV0Reader.h @@ -19,7 +19,7 @@ #include "AliGammaConversionHistograms.h" #include #include "AliCFManager.h" - +#include "AliGammaConversionBGHandler.h" class TClonesArray; class TFormula; @@ -577,12 +577,13 @@ class AliV0Reader : public TObject { /* * Gets a vector of good v0s. */ - vector GetCurrentEventGoodV0s() const{return fCurrentEventGoodV0s;} + TClonesArray* GetCurrentEventGoodV0s() const{return fCurrentEventGoodV0s;} /* * Gets the vector of previous events v0s (for bacground analysis) */ - vector GetPreviousEventGoodV0s() const{return fPreviousEventGoodV0s;} + AliGammaConversionKFVector* GetBGGoodV0s(Int_t event); + // vector GetPreviousEventGoodV0s() const{return fPreviousEventGoodV0s;} void SetUseOwnXYZCalculation(Bool_t flag){fUseOwnXYZCalculation=flag;} @@ -598,6 +599,7 @@ class AliV0Reader : public TObject { void SetOnFlyFlag(Bool_t flag){fUseOnFlyV0Finder = flag;} + Int_t GetNBGEvents(){return fBGEventHandler->GetNBGEvents();} private: AliStack * fMCStack; // pointer to MonteCarlo particle stack @@ -681,10 +683,13 @@ class AliV0Reader : public TObject { Bool_t fUpdateV0AlreadyCalled; //flag - vector fCurrentEventGoodV0s; //vector of good v0s - vector fPreviousEventGoodV0s; // vector of good v0s from prevous events + TClonesArray* fCurrentEventGoodV0s; //vector of good v0s + // vector fPreviousEventGoodV0s; // vector of good v0s from prevous events + + AliGammaConversionBGHandler *fBGEventHandler; + Bool_t fBGEventInitialized; - ClassDef(AliV0Reader,7) + ClassDef(AliV0Reader,8) }; #endif diff --git a/PWG4/PWG4GammaConvLinkDef.h b/PWG4/PWG4GammaConvLinkDef.h index 7a7bd22ac5b..2263b181eaa 100644 --- a/PWG4/PWG4GammaConvLinkDef.h +++ b/PWG4/PWG4GammaConvLinkDef.h @@ -8,5 +8,6 @@ #pragma link C++ class AliV0Reader+; #pragma link C++ class AliGammaConversionHistograms+; #pragma link C++ class AliGammaConversionAODObject+; +#pragma link C++ class AliGammaConversionBGHandler+; #endif diff --git a/PWG4/libPWG4GammaConv.pkg b/PWG4/libPWG4GammaConv.pkg index 6c8187db195..e7ea9c1e805 100644 --- a/PWG4/libPWG4GammaConv.pkg +++ b/PWG4/libPWG4GammaConv.pkg @@ -1,6 +1,6 @@ #-*- Mode: Makefile -*- -SRCS = GammaConv/AliV0Reader.cxx GammaConv/AliAnalysisTaskGammaConversion.cxx GammaConv/AliGammaConversionHistograms.cxx GammaConv/AliGammaConversionAODObject.cxx +SRCS = GammaConv/AliV0Reader.cxx GammaConv/AliAnalysisTaskGammaConversion.cxx GammaConv/AliGammaConversionHistograms.cxx GammaConv/AliGammaConversionAODObject.cxx GammaConv/AliGammaConversionBGHandler.cxx HDRS:= $(SRCS:.cxx=.h) diff --git a/PWG4/macros/ConfigGammaConversion.C b/PWG4/macros/ConfigGammaConversion.C index c90a248d237..47505a324dc 100644 --- a/PWG4/macros/ConfigGammaConversion.C +++ b/PWG4/macros/ConfigGammaConversion.C @@ -744,6 +744,9 @@ Bool_t scanArguments(TString arguments){ cout<<"Setting output file name to: "<GetCommonInputContainer(); // added by kenneth to avoid writing the standard AOD - } - else{ //CKB if and else do the same here - // cinput = cin_esd; cinput1 = mgr->GetCommonInputContainer(); - } } // Common Output Tree in common ‘default’ output file -- 2.31.1