message: Fix extraction of PYTHIA event properties for the case of a cocktail generator in ESD
diff: #include <TChain.h>
  #include <TKey.h>
  +#include "AliGenCocktailEventHeader.h"
  #include "AliStack.h"
  #include "AliAODEvent.h"
  #include "AliAnalysisManager.h"
  @@ -1032,28 +1033,25 @@ Bool_t AliAnalysisTaskEmcalLight::RetrieveEventObjects()
  if (fIsPythia) {
  if (MCEvent()) {
  - fPythiaHeader = dynamic_cast<AliGenPythiaEventHeader*>(MCEvent()->GenEventHeader());
  -
  - if (fDataType == kAOD) {
  - AliAODMCHeader* aodMCH = dynamic_cast<AliAODMCHeader*>(InputEvent()->FindListObject(AliAODMCHeader::StdBranchName()));
  - if (aodMCH) {
  - if (!fPythiaHeader) {
  - for (UInt_t i = 0;i<aodMCH->GetNCocktailHeaders();i++) {
  - fPythiaHeader = dynamic_cast<AliGenPythiaEventHeader*>(aodMCH->GetCocktailHeader(i));
  + AliGenEventHeader* header = MCEvent()->GenEventHeader();
  + if (header->InheritsFrom("AliGenPythiaEventHeader")) {
  + fPythiaHeader = static_cast<AliGenPythiaEventHeader*>(header);
  + }
  + else if (header->InheritsFrom("AliGenCocktailEventHeader")) {
  + AliGenCocktailEventHeader* cocktailHeader = static_cast<AliGenCocktailEventHeader*>(header);
  + TList* headers = cocktailHeader->GetHeaders();
  + for (auto obj : *headers) {
  + fPythiaHeader = dynamic_cast<AliGenPythiaEventHeader*>(obj);
  if (fPythiaHeader) break;
  }
  }
  - fGeneratorName = aodMCH->GetGeneratorName();
  }
  - }
  -
  if (fPythiaHeader) {
  fPtHard = fPythiaHeader->GetPtHard();
  fXsection = fPythiaHeader->GetXsection();
  fNTrials = fPythiaHeader->Trials();
  }
  }
  - }
  for (auto cont_it : fParticleCollArray) cont_it.second->NextEvent(InputEvent());
  for (auto cont_it : fClusterCollArray) cont_it.second->NextEvent(InputEvent());
  