42 #include "AliVCluster.h" 52 fLocalInitialized(kFALSE),
56 fV0ReaderName("V0ReaderV1"),
57 fClusterContainer(
nullptr),
62 fConvPhotonCuts(
nullptr),
63 fCaloPhotonCuts(
nullptr),
64 fPi0CutsConvConv(
nullptr),
65 fPi0CutsCaloCalo(
nullptr),
66 fPi0CutsConvCalo(
nullptr),
68 fSamePCMHandler(
nullptr),
69 fSameEMCALHandler(
nullptr),
70 fMixedHandler(
nullptr),
79 fLocalInitialized(kFALSE),
83 fV0ReaderName(
"V0ReaderV1"),
101 DefineOutput(1, TList::Class());
116 TLinearBinning massBinningK0(800, 0.0, 0.8),massBinningPi0(500, 0., 0.5), ptBinning(300, 0.3, 30.), openingAngleBinning(100, 0., 1.), candidateBinning( 101, -0.5, 100.5), alphaBinning(200, -1., 1.);
123 AliFatal(
"Error: No V0 Reader");
132 AliDebug(2,
"************* Defining Event Counter Histograms ********************");
136 fHistos->CreateTH1(
"hEventQualityBefore",
"V0 reader Event Quality (0 = good)", 13, -0.5, 12.5);
137 fHistos->CreateTH1(
"hEventQualityAfter",
"V0 reader Event Quality (0 = good)", 13, -0.5, 12.5);
138 fHistos->CreateTH1(
"hEventSelectionStatusBefore",
"Event selection status (0 = good)", 14, -0.5, 13.5);
139 fHistos->CreateTH1(
"hEventSelectionStatusAfter",
"Event selection status (0 = good)", 14, -0.5, 13.5 );
140 fHistos->CreateTH1(
"hVertexZ",
"z-component of the primary vertex; z (cm); Number of events", 1000, -40., 40.);
141 fHistos->CreateTH1(
"hCaloPhotonsBefore",
"Number of Events", 13, -0.5, 12.5);
142 fHistos->CreateTH1(
"hCaloPhotonsAfter",
"Number of Events", 13, -0.5, 12.5);
143 fHistos->CreateTH1(
"hConvPhotonsBefore",
"Number of Events", 13, -0.5, 12.5);
144 fHistos->CreateTH1(
"hConvPhotonsAfter",
"Number of Events", 13, -0.5, 12.5);
146 AliDebug(2,
"************* Defining Photon QA Histograms ********************");
149 fHistos->CreateTH1(
"hCaloPhotonPt",
"p_{t}-distribution of the conversion photons; p_{t} (GeV); Yield", ptBinning);
150 fHistos->CreateTH1(
"hConvPhotonPt",
"p_{t}-distribution of the conversion photons; p_{t} (GeV); Yield", ptBinning);
151 fHistos->CreateTH2(
"hConvPhotonEtaR",
"#eta vs conversion radius of conversion photons; #eta; R (cm)", 200, -1.5, 1.5, 300, 0., 300);
153 AliDebug(2,
"************* Defining Pi0 Histograms ********************");
156 const std::array<TString, 3> pi0rec = {
"ConvConv",
"ConvCalo",
"CaloCalo"};
157 for(
const auto &reccase : pi0rec){
160 fHistos->CreateTH1(
"hNPi0CandidatesPerEventBefore" + reccase,
"Number of pi0 candidates in event before selection",candidateBinning);
161 fHistos->CreateTH2(
"hMassvsPtPi0Before" + reccase +
"All",
"inv. mass vs. p_{t} for all #pi^{0} (" + reccase +
") candidates; inv. mass (GeV/c^{2}); p_{t} (GeV/c)", massBinningPi0, ptBinning);
163 fHistos->CreateTH2(
"hMassvsPtPi0Before" + reccase +
"Sel",
"inv. mass vs. p_{t} for selected #pi^{0} (" + reccase +
") candidates; inv. mass (GeV/c^{2}); p_{t} (GeV/c)", massBinningPi0, ptBinning);
164 fHistos->CreateTH2(
"hAlphavsPtPi0Before" + reccase,
"#alpha vs p_{t} for selected #p^i{0} (" + reccase +
") candidates; #alpha; p_{t}", alphaBinning, ptBinning);
165 fHistos->CreateTH2(
"hOpeningAnglevsPtPi0Before" + reccase,
"Opening angle vs. p_{t} for selected #pi^{0} (" + reccase +
") candidates; opening angle; p_{t} (GeV/c)", openingAngleBinning, ptBinning);
167 fHistos->CreateTH1(
"hPi0Selection" + reccase,
"Pi0 selection status bit for reconstruction case " + reccase, 2, -0.5, 1.5);
169 fHistos->CreateTH1(
"hNPi0CandidatesPerEventAfter" + reccase,
"Number of pi0 candidates in event before selection", candidateBinning);
170 fHistos->CreateTH2(
"hMassvsPtPi0After" + reccase +
"All",
"inv. mass vs. p_{t} for all #pi^{0} (" + reccase +
") candidates; inv. mass (GeV/c^{2}); p_{t} (GeV/c)", massBinningPi0, ptBinning);
173 fHistos->CreateTH2(
"hMassvsPtPi0After" + reccase +
"Sel",
"inv. mass vs. p_{t} for selected #pi^{0} (" + reccase +
") candidates; inv. mass (GeV/c^{2}); p_{t} (GeV/c)", massBinningPi0, ptBinning);
174 fHistos->CreateTH2(
"hAlphavsPtPi0After" + reccase,
"#alpha vs p_{t} for selected #p^i{0} (" + reccase +
") candidates; #alpha; p_{t}", alphaBinning, ptBinning);
175 fHistos->CreateTH2(
"hOpeningAnglevsPtPi0After" + reccase,
"Opening angle vs. p_{t} for selected #pi^{0} (" + reccase +
") candidates; opening angle; p_{t} (GeV/c)", openingAngleBinning, ptBinning);
179 AliDebug(2,
"************* Defining K0 Histograms ********************");
182 const std::array<TString, 6> k0Shortrec = {
"AllConv",
"AllCalo",
"DiffMixed",
"SameMixed",
"ConvoCalo",
"CaloConvo" };
183 for(
const auto &reccase1 : k0Shortrec){
185 fHistos->CreateTH1(
"hNK0CandidatesPerEventBefore" + reccase1,
"Number of K0 candidates in event before selection", candidateBinning);
186 fHistos->CreateTH2(
"hMassvsPtK0ShortBefore" + reccase1,
"inv. mass vs. p_{t} for #k^{0}s (" + reccase1 +
") candidates; inv. mass (GeV/c^{2}); p_{t} (GeV/c)", massBinningK0, ptBinning);
187 fHistos->CreateTH2(
"hOpeningAnglevsPtK0ShortBefore"+ reccase1,
"Opening angle vs. p_{t} for k0Short (" + reccase1 +
") candidates; opening angle; p_{t} (GeV/c)", openingAngleBinning, ptBinning);
189 fHistos->CreateTH1(
"hK0Selection" + reccase1,
"Pi0 selection status bit for reconstruction case " + reccase1, 2, -0.5, 1.5);
192 fHistos->CreateTH1(
"hNK0CandidatesPerEventAfter" + reccase1,
"Number of K0 candidates in event after selection", candidateBinning);
193 fHistos->CreateTH2(
"hMassvsPtK0ShortAfter" + reccase1,
"Inv. mass vs. p_{t} for #k^{0}s (" + reccase1 +
") candidates; inv. mass (GeV/c^{2}); p_{t} (GeV/c)", massBinningK0, ptBinning);
194 fHistos->CreateTH2(
"hOpeningAnglevsPtK0ShortAfter"+ reccase1,
"Opening angle vs. p_{t} for k0Short (" + reccase1 +
") candidates; opening angle; p_{t} (GeV/c)", openingAngleBinning, ptBinning);
198 fHistos->CreateTH2(
"hMassvsPtK0ShortBKG" + reccase1,
" Background: Inv. mass vs. p_{t} for #k^{0}s (" + reccase1 +
") candidates; inv. mass (GeV/c^{2}); p_{t} (GeV/c)", massBinningK0, ptBinning);
199 fHistos->CreateTH2(
"hOpeningAnglevsPtK0ShortBKG"+ reccase1,
"Background: Opening angle vs. p_{t} for k0Short (" + reccase1 +
") candidates; opening angle; p_{t} (GeV/c)", openingAngleBinning, ptBinning);
203 for(
auto hist : *(fHistos->GetListOfHistograms()))
fOutput->Add(hist);
207 qaV0reader->SetName(
"QA_V0reader");
208 qaV0reader->SetOwner(kTRUE);
219 TString histname =
"Pi0CutsConvConv_" +
TString(histlist->GetName());
220 histlist->SetName(histname);
223 histname =
"Pi0CutsCalo_" +
TString(histlist->GetName());
224 histlist->SetName(histname);
227 histname =
"Pi0CutsConvCalo_" +
TString(histlist->GetName());
228 histlist->SetName(histname);
231 histname =
"K0cuts_" +
TString(histlist->GetName());
232 histlist->SetName(histname);
271 if(selectionStatus || eventQuality)
return;
274 fHistos->
FillTH1(
"hVertexZ", fInputEvent->GetPrimaryVertex()->GetZ());
281 Int_t numPhotons = conversionPhotons.size();
287 Int_t numCaloPhotons = caloPhotons.size();
290 AliDebug(2,
"************************** Initializing Pi0 candidates *************************\n" );
315 Double_t primVtxX = fInputEvent->GetPrimaryVertex()->GetX();
316 Double_t primVtxY = fInputEvent->GetPrimaryVertex()->GetY();
317 Double_t primVtxZ = fInputEvent->GetPrimaryVertex()->GetZ();
322 AliDebug(1,
"New event - make Pi0 candidates");
323 MakePi0QA(samePi0PCM,
"ConvConv",
"Before");
324 MakePi0QA(samePi0EMCAL,
"CaloCalo",
"Before");
325 MakePi0QA(mixedPi0,
"ConvCalo",
"Before");
326 AliDebug(1,
"New event - finished pi0 candidates");
335 MakePi0QA(samePi0PCMSelection,
"ConvConv",
"After");
336 MakePi0QA(samePi0EMCALSelection,
"CaloCalo",
"After");
337 MakePi0QA(mixedPi0Selection,
"ConvCalo",
"After");
383 std::vector<AliAODConversionMother> PCMEMCSelection =
SelectMeson(PCMEMC, *
fK0Cuts,
kK0,
"ConvoCalo");
384 std::vector<AliAODConversionMother> EMCPCMSelection =
SelectMeson(EMCPCM,*
fK0Cuts,
kK0,
"CaloConvo");
385 std::vector<AliAODConversionMother> mixedSameSelection =
SelectMeson(mixedSame, *
fK0Cuts,
kK0,
"SameMixed");
386 std::vector<AliAODConversionMother> mixedDiffSelection =
SelectMeson(mixedDiff, *
fK0Cuts,
kK0,
"DiffMixed");
396 if(samePi0PCMSelection.size() ){
400 if (samePi0EMCALSelection.size()){
404 if(mixedPi0Selection.size()){
417 std::vector<AliAODConversionPhoton> candidates;
422 InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
424 int clusterindex = 0;
425 for(
auto c : inputcont.
all()) {
430 TLorentzVector clusterVector;
431 c->GetMomentum(clusterVector,vertex);
443 for (
UInt_t k = 0; k <
c->GetNLabels(); k++){
448 candidates.push_back(photonCandidate);
456 std::vector<AliAODConversionPhoton> candidates;
458 std::vector<AliAODConversionPhoton *> GammaCandidatesStepOne;
459 TList GammaCandidatesStepTwo;
462 for(
auto photon : reader){
466 candidates.push_back(*(static_cast<AliAODConversionPhoton *>(photon)));
470 GammaCandidatesStepOne.push_back(static_cast<AliAODConversionPhoton *>(photon));
472 GammaCandidatesStepTwo.Add(static_cast<AliAODConversionPhoton *>(photon));
478 for(
auto photon : GammaCandidatesStepOne){
481 candidates.push_back(*photon);
482 }
else GammaCandidatesStepTwo.Add(photon);
488 for(
int i = 0; i < GammaCandidatesStepTwo.GetEntries(); i++){
491 candidates.push_back(*photon);
500 std::vector<AliAODConversionMother> selectedCandidates;
503 case kPi0: mesonName =
"Pi0";
break;
504 case kK0: mesonName =
"K0";
break;
506 TString qaname =
"h" + mesonName +
"Selection" + reccase;
507 for(
auto candidate: candidates){
510 if(!selectionStatus)
continue;
511 selectedCandidates.push_back(candidate);
514 return selectedCandidates;
521 const std::vector<AliAODConversionPhoton> *secondaryLeg,
524 AliDebug(1, Form(
"Make Pi0 candidates: Number of photons in first leg: %lu, second leg: %lu", primaryLeg->size(), secondaryLeg ? secondaryLeg->size() : 0));
525 std::vector<AliAODConversionMother> candidates;
528 for(
auto primphoton : *primaryLeg){
529 for(
auto secphoton : *secondaryLeg) {
532 if(candidate.M() < 1e-4 || candidate.M() > 0.2)
continue;
533 AliDebug(2,
"Candidate in mass window");
534 candidates.push_back(candidate);
539 for(
auto primiter = primaryLeg->begin(); primiter != primaryLeg->end(); ++primiter){
540 for(
auto seciter = primiter + 1; seciter != primaryLeg->end(); ++seciter){
543 if(candidate.M() < 1e-4 || candidate.M() > 0.2)
continue;
544 AliDebug(2,
"Candidate in mass window");
545 candidates.push_back(candidate);
549 AliDebug(1, Form(
"Found %lu pi0 candidates in event\n", candidates.size()));
555 const std::vector<AliAODConversionMother> *secondaryLeg,
557 std::vector<AliAODConversionMother> candidates;
560 for(
const auto &primpi0 : *primaryLeg) {
561 for(
const auto &secpi0 : *secondaryLeg) {
563 candidates.push_back(candidate);
568 for(
auto primpi0 = primaryLeg->begin(); primpi0 != primaryLeg->end(); ++primpi0) {
569 for(
auto secpi0 = primpi0 + 1; secpi0 != primaryLeg->end(); ++secpi0) {
571 candidates.push_back(candidate);
581 const std::vector<AliAODConversionMother *> *mixedEvent,
583 std::vector<AliAODConversionMother> candidates;
585 for(
const auto &primpi0 : *sameEvent) {
586 for(
const auto secpi0 : *mixedEvent) {
588 candidates.push_back(candidate);
595 for(
const auto &photon : photons) {
602 for(
const auto &photon : photons) {
604 fHistos->
FillTH2(
"hConvPhotonEtaR", photon.Eta(), photon.GetConversionRadius());
610 TString reccaseString = reccase;
611 fHistos->
FillTH1(
"hNPi0CandidatesPerEvent" + selectionStatus + reccaseString, pi0s.size());
612 for(
const auto &pi0 : pi0s) {
613 fHistos->
FillTH2(
"hMassvsPtPi0" + selectionStatus + reccaseString +
"All", pi0.M(), pi0.Pt());
615 if((1e-4 <=pi0.M()) && (pi0.M()<= 0.2)){
616 fHistos->
FillTH2(
"hMassvsPtPi0" + selectionStatus + reccaseString +
"Sel", pi0.M(),pi0.Pt());
617 fHistos->
FillTH2(
"hAlphavsPtPi0" + selectionStatus + reccaseString, pi0.GetAlpha(), pi0.Pt());
618 fHistos->
FillTH2(
"hOpeningAnglevsPtPi0" + selectionStatus + reccaseString, pi0.GetOpeningAngle(), pi0.Pt());
625 TString reccaseString = reccase;
626 if (selectionStatus !=
"BKG"){
627 fHistos->
FillTH1(
"hNK0CandidatesPerEvent" + selectionStatus + reccaseString, k0s.size());
630 for(
const auto &k0: k0s) {
631 fHistos->
FillTH2(
"hMassvsPtK0Short" + selectionStatus + reccaseString, k0.M(), k0.Pt());
632 fHistos->
FillTH2(
"hOpeningAnglevsPtK0Short" + selectionStatus + reccaseString, k0.GetOpeningAngle(), k0.Pt());
Bool_t fIsMC
Switch whether we run over data or MC.
AliClusterContainer * AddClusterContainer(const char *name)
void MakePi0QA(const std::vector< AliAODConversionMother > &pi0s, const char *reccase, TString selectionStatus)
void SetCaloClusterRef(Long_t ref)
Bool_t RejectSharedElectronV0s(AliAODConversionPhoton *photon, Int_t nV0, Int_t nV0s)
AliGammaConversionAODBGHandler * fSameEMCALHandler
! Background Handler for same EMC
Int_t GetNReconstructedGammas() const
Class creating a linear binning, used in the histogram manager.
Bool_t UseElecSharingCut()
TList * GetCutHistograms()
Bool_t UseToCloseV0sCut()
TList * GetCutHistograms()
AliCaloPhotonCuts * fCaloPhotonCuts
Calo photon cuts.
Int_t GetNumberOfPrimaryTracks()
Bool_t ClusterIsSelected(AliVCluster *cluster, AliVEvent *event, AliMCEvent *mcEvent, Int_t isMC, Double_t weight=1., Long_t clusterID=-1)
void FillTH2(const char *hname, double x, double y, double weight=1., Option_t *opt="")
Fill a 2D histogram within the container.
TList * GetEventCutHistograms()
void AddMesonEvent(TList *const eventMothers, Double_t xvalue, Double_t yvalue, Double_t zvalue, Int_t multiplicity, Double_t epvalue=-100)
virtual ~AliAnalysisTaskK0toPi0Pi0()
TList * GetCutHistograms()
AliGammaConversionAODBGHandler * fMixedHandler
! Background Handler for mixed case
AliClusterContainer * fClusterContainer
Cluster container.
void SetCaloPhotonMCLabel(Int_t i, Int_t labelCaloPhoton)
Double_t fEventPlaneAngle
Event Plane Angle.
void FillElectonLabelArray(AliAODConversionPhoton *photon, Int_t nV0)
std::vector< AliAODConversionPhoton > MakeConversionPhotonCandidates(const AliV0ReaderV1 &reader, AliConversionPhotonCuts &cuts)
TList * fOutput
Global output container.
AliConversionMesonCuts * fPi0CutsCaloCalo
Cuts on the pi0 for the calo calo case.
AliConversionMesonCuts * fPi0CutsConvConv
Cuts on the pi0 for the conv conv case.
const AliClusterIterableContainer all() const
Bool_t RejectToCloseV0s(AliAODConversionPhoton *photon, TList *photons, Int_t nV0)
virtual void UserExec(Option_t *)
void MakePhotonQACalo(const std::vector< AliAODConversionPhoton > &photons, AliConvEventCuts &cuts)
Bool_t InPlaneOutOfPlaneCut(Double_t photonPhi, Double_t eventPlaneAngle=-100, Bool_t fill=kTRUE)
Int_t IsEventAcceptedByCut(AliConvEventCuts *ReaderCuts, AliVEvent *event, AliMCEvent *mcEvent, Int_t isHeavyIon, Bool_t isEMCALAnalysis)
Bool_t fLocalInitialized
Check whether the task was initialized (triggers ExecOnce)
Class handling all kinds of selection cuts for Gamma Calo analysis.
AliAnalysisTaskK0toPi0Pi0()
void FillHistogramsExtendedQA(AliVEvent *event, Int_t isMC)
THistManager * fHistos
Container for Histograms.
AliConversionMesonCuts * fPi0CutsConvCalo
Cuts on the pi0 for the conv calo case.
virtual void UserCreateOutputObjects()
Double_t GetSelectionLow() const
AliConversionPhotonCuts * fConvPhotonCuts
Cuts on conversion photons.
Class handling all kinds of selection cuts for Gamma Conversion analysis.
virtual void RunChanged()
void MakeK0ShortQA(const std::vector< AliAODConversionMother > &k0s, const char *reccase, TString selectionStatus)
void FillTH1(const char *hname, double x, double weight=1., Option_t *opt="")
Fill a 1D histogram within the container.
std::vector< AliAODConversionMother > MakeK0ShortCandidates(const std::vector< AliAODConversionMother > *primaryLeg, const std::vector< AliAODConversionMother > *secondaryLeg, AliConversionMesonCuts &cuts)
Int_t GetNumberOfBGEvents()
Double_t GetSelectionHigh() const
Class handling analysis of K0s decay into two pi0s.
Int_t GetNBGEvents() const
Int_t GetZBinIndex(Double_t z) const
AliV0ReaderV1 * fV0Reader
! V0 reader
void MakePhotonQAConv(const std::vector< AliAODConversionPhoton > &photons, AliConvEventCuts &cuts)
AliGammaConversionMotherAODVector * GetBGGoodMesons(Int_t zbin, Int_t mbin, Int_t event)
TString fV0ReaderName
Name of the V0 reader.
Class handling all kinds of selection cuts for Gamma Conversion analysis.
Bool_t MesonIsSelected(AliAODConversionMother *pi0, Bool_t IsSignal=kTRUE, Double_t fRapidityShift=0., Int_t leadingCellID1=0, Int_t leadingCellID2=0)
std::vector< AliAODConversionMother > MakePi0Candidates(const std::vector< AliAODConversionPhoton > *primaryLeg, const std::vector< AliAODConversionPhoton > *secondaryLeg, AliConversionMesonCuts &cuts)
std::vector< AliAODConversionPhoton > MakeCaloPhotonCandidates(const AliClusterContainer &inputcont, AliCaloPhotonCuts &cuts)
void SetNCaloPhotonMCLabels(Int_t nLabels)
std::vector< AliAODConversionMother > MakeK0ShortCandidatesMixed(const std::vector< AliAODConversionMother > *sameEvent, const std::vector< AliAODConversionMother * > *mixedEvent, AliConversionMesonCuts &cuts)
Container class for histograms.
Class handling all kinds of selection cuts for Gamma Conversion analysis.
std::vector< AliAODConversionMother > SelectMeson(std::vector< AliAODConversionMother > &candidates, AliConversionMesonCuts &cuts, MesonType_t meson, const char *reccase)
void SetArray(const AliVEvent *event)
AliConvEventCuts * GetEventCuts()
Int_t GetMultiplicityBinIndex(Int_t mult) const
Int_t fCurrentRun
Current run number (triggers RunChanged)
TList * GetCutHistograms()
AliGammaConversionAODBGHandler * fSamePCMHandler
! Background Handler for same PCM
Container structure for EMCAL clusters.
AliConversionMesonCuts * fK0Cuts
Cuts on the K0.
Bool_t PhotonIsSelected(AliConversionPhotonBase *photon, AliVEvent *event)
TList * GetCutHistograms()
AliConvEventCuts * fEventCuts
Event cuts.