#include "AliTPCPIDResponse.h"
#include "AliInputEventHandler.h"
#include "AliAnalysisManager.h"
+#include "AliGenEventHeader.h"
+#include "AliGenCocktailEventHeader.h"
+#include "AliGenHijingEventHeader.h"
//class AliPWG0Helper;
//#include "$ALICE_ROOT/PWG0/AliPWG0Helper.h"
Float_t AliAnalysisHadEtMonteCarlo::fgSmearWidths[4] = {0.005,0.006,0.007,0.008};
AliAnalysisHadEtMonteCarlo::AliAnalysisHadEtMonteCarlo():AliAnalysisHadEt()
+ ,checkLabelForHIJING(kFALSE)
+ ,fNMCProducedMin(0)
+ ,fNMCProducedMax(0)
,fSimPiKPEt(0)
,fSimRawEtTPC(0)
,fSimRawEtITS(0)
return 0;
}
AliStack *stack = mcEvent->Stack();
+
+ if(checkLabelForHIJING) SetGeneratorMinMaxParticles(mcEvent);
fCentBin= -1;
fGoodEvent = kTRUE;//for p+p collisions if we made it this far we have a good event
- if(fDataSet==20100){//If this is Pb+Pb
- AliCentrality *centrality = realEvent->GetCentrality();
- if(fNCentBins<21) fCentBin= centrality->GetCentralityClass10(fCentralityMethod);
- else{ fCentBin= centrality->GetCentralityClass5(fCentralityMethod);}
+ if(fDataSet==20100 ||fDataSet==2011 ){//If this is Pb+Pb
+// AliCentrality *centrality2 = realEvent->GetCentrality();
+// if(fNCentBins<21) fCentBin= centrality2->GetCentralityClass10(fCentralityMethod);
+// else{ fCentBin= centrality2->GetCentralityClass5(fCentralityMethod);}
+// cout<<"centrality "<<fCentBin<<endl;
+ AliCentrality *centrality = realEvent->GetCentrality();
+ fCentBin = GetCentralityBin(fNCentBins, centrality);
if(fCentBin ==-1) fGoodEvent = kFALSE;//but for Pb+Pb events we don't want to count events where we did not find a centrality
}
AnalyseEvent(ev);
if(kDoTriggerChecksOnly) return 1;//If we are only doing trigger checks, don't bother with all of the reconstructed stuff
//for PID
if(kDoTriggerChecks && (!kIsOfflineV0AND ||!kIsOfflineMB ) ){return 1;}//In this case we are just after trigger efficiencies and don't care about the ET reconstructed.
- AliESDpid *pID = new AliESDpid();//This is identified as a memory leak in valgrind but I delete this object so I think it may be a problem with AliESDpid.
+ //AliESDpid *pID = new AliESDpid();//This is identified as a memory leak in valgrind but I delete this object so I think it may be a problem with AliESDpid.
//=============================================
for (Int_t iTrack = 0; iTrack < nGoodTracks; iTrack++)
{
AliESDtrack *track = dynamic_cast<AliESDtrack*> (list->At(iTrack));
+ UInt_t label = (UInt_t)TMath::Abs(track->GetLabel());
+ //if(checkLabelForHIJING && !IsHIJINGLabel(label,mcEvent,stack) ){cout<<"I am rejecting this particle because it is not HIJING"<<endl;}
+ if(checkLabelForHIJING && !IsHIJINGLabel(label,mcEvent,stack) ) continue;
if (!track)
{
Printf("ERROR: Could not get track %d", iTrack);
FillHisto2D(Form("dEdxAll%s",cutName->Data()),track->P(),dEdx,1.0);
- UInt_t label = (UInt_t)TMath::Abs(track->GetLabel());
TParticle *simPart = stack->Particle(label);
if(!simPart) {
Printf("no MC particle\n");
if( !fRunLightweight){
FillHisto2D(Form("EtReconstructed%sPiPlus",cutName->Data()),pT,eta,myEt);
FillHisto2D(Form("EtReconstructed%sChargedHadron",cutName->Data()),pT,eta,myEt);
- FillHisto2D(Form("EtNReconstructed%sPiPlus",cutName->Data()),pT,eta,myEt);
- FillHisto2D(Form("EtNReconstructed%sChargedHadron",cutName->Data()),pT,eta,myEt);
+ FillHisto2D(Form("EtNReconstructed%sPiPlus",cutName->Data()),pT,eta,1.0);
+ FillHisto2D(Form("EtNReconstructed%sChargedHadron",cutName->Data()),pT,eta,1.0);
if(fCentBin>=0){//if a centrality bin was defined
- FillHisto2D(Form("EtNReconstructed%sPiPlusCB%i",cutName->Data(),fCentBin),pT,eta,myEt);
- FillHisto2D(Form("EtNReconstructed%sChargedHadronCB%i",cutName->Data(),fCentBin),pT,eta,myEt);
+ FillHisto2D(Form("EtNReconstructed%sPiPlusCB%i",cutName->Data(),fCentBin),pT,eta,1.0);
+ FillHisto2D(Form("EtNReconstructed%sChargedHadronCB%i",cutName->Data(),fCentBin),pT,eta,1.0);
}
FillHisto2D(Form("EtReconstructed%sChargedHadronAssumingPion",cutName->Data()),pT,eta,myEt);
FillHisto2D(Form("EtReconstructed%sChargedHadronAssumingProton",cutName->Data()),pT,eta,myEtP);
if( !fRunLightweight){
FillHisto2D(Form("EtReconstructed%sPiMinus",cutName->Data()),pT,eta,myEt);
FillHisto2D(Form("EtReconstructed%sChargedHadron",cutName->Data()),pT,eta,myEt);
- FillHisto2D(Form("EtNReconstructed%sPiMinus",cutName->Data()),pT,eta,myEt);
- FillHisto2D(Form("EtNReconstructed%sChargedHadron",cutName->Data()),pT,eta,myEt);
+ FillHisto2D(Form("EtNReconstructed%sPiMinus",cutName->Data()),pT,eta,1.0);
+ FillHisto2D(Form("EtNReconstructed%sChargedHadron",cutName->Data()),pT,eta,1.0);
if(fCentBin>=0){//if a centrality bin was defined
- FillHisto2D(Form("EtNReconstructed%sPiMinusCB%i",cutName->Data(),fCentBin),pT,eta,myEt);
- FillHisto2D(Form("EtNReconstructed%sChargedHadronCB%i",cutName->Data(),fCentBin),pT,eta,myEt);
+ FillHisto2D(Form("EtNReconstructed%sPiMinusCB%i",cutName->Data(),fCentBin),pT,eta,1.0);
+ FillHisto2D(Form("EtNReconstructed%sChargedHadronCB%i",cutName->Data(),fCentBin),pT,eta,1.0);
}
FillHisto2D(Form("EtReconstructed%sChargedHadronAssumingPion",cutName->Data()),pT,eta,myEt);
FillHisto2D(Form("EtReconstructed%sChargedHadronAssumingProton",cutName->Data()),pT,eta,myEtP);
if( !fRunLightweight){
FillHisto2D(Form("EtReconstructed%sKPlus",cutName->Data()),pT,eta,myEt);
FillHisto2D(Form("EtReconstructed%sChargedHadron",cutName->Data()),pT,eta,myEt);
- FillHisto2D(Form("EtNReconstructed%sKPlus",cutName->Data()),pT,eta,myEt);
- FillHisto2D(Form("EtNReconstructed%sChargedHadron",cutName->Data()),pT,eta,myEt);
+ FillHisto2D(Form("EtNReconstructed%sKPlus",cutName->Data()),pT,eta,1.0);
+ FillHisto2D(Form("EtNReconstructed%sChargedHadron",cutName->Data()),pT,eta,1.0);
if(fCentBin>=0){//if a centrality bin was defined
- FillHisto2D(Form("EtNReconstructed%sKPlusCB%i",cutName->Data(),fCentBin),pT,eta,myEt);
- FillHisto2D(Form("EtNReconstructed%sChargedHadronCB%i",cutName->Data(),fCentBin),pT,eta,myEt);
+ FillHisto2D(Form("EtNReconstructed%sKPlusCB%i",cutName->Data(),fCentBin),pT,eta,1.0);
+ FillHisto2D(Form("EtNReconstructed%sChargedHadronCB%i",cutName->Data(),fCentBin),pT,eta,1.0);
}
FillHisto2D(Form("EtReconstructed%sChargedHadronAssumingPion",cutName->Data()),pT,eta,myEtPi);
FillHisto2D(Form("EtReconstructed%sKPlusAssumingPion",cutName->Data()),pT,eta,myEtPi);
if( !fRunLightweight){
FillHisto2D(Form("EtReconstructed%sKMinus",cutName->Data()),pT,eta,myEt);
FillHisto2D(Form("EtReconstructed%sChargedHadron",cutName->Data()),pT,eta,myEt);
- FillHisto2D(Form("EtNReconstructed%sKMinus",cutName->Data()),pT,eta,myEt);
- FillHisto2D(Form("EtNReconstructed%sChargedHadron",cutName->Data()),pT,eta,myEt);
+ FillHisto2D(Form("EtNReconstructed%sKMinus",cutName->Data()),pT,eta,1.0);
+ FillHisto2D(Form("EtNReconstructed%sChargedHadron",cutName->Data()),pT,eta,1.0);
if(fCentBin>=0){//if a centrality bin was defined
- FillHisto2D(Form("EtNReconstructed%sKMinusCB%i",cutName->Data(),fCentBin),pT,eta,myEt);
- FillHisto2D(Form("EtNReconstructed%sChargedHadronCB%i",cutName->Data(),fCentBin),pT,eta,myEt);
+ FillHisto2D(Form("EtNReconstructed%sKMinusCB%i",cutName->Data(),fCentBin),pT,eta,1.0);
+ FillHisto2D(Form("EtNReconstructed%sChargedHadronCB%i",cutName->Data(),fCentBin),pT,eta,1.0);
}
FillHisto2D(Form("EtReconstructed%sChargedHadronAssumingPion",cutName->Data()),pT,eta,myEtPi);
FillHisto2D(Form("EtReconstructed%sKMinusAssumingPion",cutName->Data()),pT,eta,myEtPi);
if( !fRunLightweight){
FillHisto2D(Form("EtReconstructed%sProton",cutName->Data()),pT,eta,myEt);
FillHisto2D(Form("EtReconstructed%sChargedHadron",cutName->Data()),pT,eta,myEt);
- FillHisto2D(Form("EtNReconstructed%sProton",cutName->Data()),pT,eta,myEt);
- FillHisto2D(Form("EtNReconstructed%sChargedHadron",cutName->Data()),pT,eta,myEt);
+ FillHisto2D(Form("EtNReconstructed%sProton",cutName->Data()),pT,eta,1.0);
+ FillHisto2D(Form("EtNReconstructed%sChargedHadron",cutName->Data()),pT,eta,1.0);
if(fCentBin>=0){//if a centrality bin was defined
- FillHisto2D(Form("EtNReconstructed%sProtonCB%i",cutName->Data(),fCentBin),pT,eta,myEt);
- FillHisto2D(Form("EtNReconstructed%sChargedHadronCB%i",cutName->Data(),fCentBin),pT,eta,myEt);
+ FillHisto2D(Form("EtNReconstructed%sProtonCB%i",cutName->Data(),fCentBin),pT,eta,1.0);
+ FillHisto2D(Form("EtNReconstructed%sChargedHadronCB%i",cutName->Data(),fCentBin),pT,eta,1.0);
}
FillHisto2D(Form("EtReconstructed%sChargedHadronAssumingPion",cutName->Data()),pT,eta,myEtPi);
FillHisto2D(Form("EtReconstructed%sProtonAssumingPion",cutName->Data()),pT,eta,myEtPi);
if( !fRunLightweight){
FillHisto2D(Form("EtReconstructed%sAntiProton",cutName->Data()),pT,eta,myEt);
FillHisto2D(Form("EtReconstructed%sChargedHadron",cutName->Data()),pT,eta,myEt);
- FillHisto2D(Form("EtNReconstructed%sAntiProton",cutName->Data()),pT,eta,myEt);
- FillHisto2D(Form("EtNReconstructed%sChargedHadron",cutName->Data()),pT,eta,myEt);
+ FillHisto2D(Form("EtNReconstructed%sAntiProton",cutName->Data()),pT,eta,1.0);
+ FillHisto2D(Form("EtNReconstructed%sChargedHadron",cutName->Data()),pT,eta,1.0);
if(fCentBin>=0){//if a centrality bin was defined
- FillHisto2D(Form("EtNReconstructed%sAntiProtonCB%i",cutName->Data(),fCentBin),pT,eta,myEt);
- FillHisto2D(Form("EtNReconstructed%sChargedHadronCB%i",cutName->Data(),fCentBin),pT,eta,myEt);
+ FillHisto2D(Form("EtNReconstructed%sAntiProtonCB%i",cutName->Data(),fCentBin),pT,eta,1.0);
+ FillHisto2D(Form("EtNReconstructed%sChargedHadronCB%i",cutName->Data(),fCentBin),pT,eta,1.0);
}
FillHisto2D(Form("EtReconstructed%sChargedHadronAssumingPion",cutName->Data()),pT,eta,myEtPi);
FillHisto2D(Form("EtReconstructed%sAntiProtonAssumingPion",cutName->Data()),pT,eta,myEtPi);
if(eTtotalSim>0.0) FillHisto2D("SimPiKPEtMinusSimSmearedMultRecoOnly",nReco,(eTtotalSim-eTtotalReco)/eTtotalSim,1.0);
if(pTtotalSim>0.0) FillHisto2D("SimPiKPPtMinusSimSmearedMultRecoOnly",nReco,(pTtotalSim-pTtotalReco)/pTtotalSim,1.0);
}
- delete pID;
+ // delete pID;
delete strTPC;
delete strITS;
delete strTPCITS;
// Let's play with the stack!
AliStack *stack = mcEvent->Stack();
+
Int_t nPrim = stack->GetNtrack();
Float_t fSimPiKPEtPtSmeared = 0;
TParticle *part = stack->Particle(iPart);//This line is identified as a loss of memory by valgrind, however, the pointer still belongs to the stack, so it's the stack's problem
+ if(checkLabelForHIJING && !IsHIJINGLabel(iPart,mcEvent,stack) ) continue;
+
if (!part)
{
Printf("ERROR: Could not get particle %d", iPart);
FillHisto1D("SimPiKPEt",fSimPiKPEt,1.0);
FillHisto1D("SimRawEtTPC",fSimRawEtTPC,1.0);
FillHisto1D("SimRawEtITS",fSimRawEtITS,1.0);
- if(fDataSet!=20100 && AliPWG0Helper::GetEventProcessType(mcEvent->Header()) == AliPWG0Helper::kND){
+ if((fDataSet!=20100 || fDataSet==2011) && AliPWG0Helper::GetEventProcessType(mcEvent->Header()) == AliPWG0Helper::kND){
FillHisto1D("SimHadEtND",fSimHadEt,1.0);
FillHisto1D("SimTotEtND",fSimTotEt,1.0);
FillHisto1D("NEventsND",0.5,1);
FillHisto1D("SimRawEtNDMBITS",fSimRawEtITS,1.0);
}
}
- if(fDataSet!=20100 && AliPWG0Helper::GetEventProcessType(mcEvent->Header()) == AliPWG0Helper::kSD){
+ if((fDataSet!=20100||fDataSet==2011) && AliPWG0Helper::GetEventProcessType(mcEvent->Header()) == AliPWG0Helper::kSD){
FillHisto1D("SimHadEtSD",fSimHadEt,1.0);
FillHisto1D("SimTotEtSD",fSimTotEt,1.0);
FillHisto1D("NEventsSD",0.5,1);
FillHisto1D("SimRawEtSDMBITS",fSimRawEtITS,1.0);
}
}
- if(fDataSet!=20100 && AliPWG0Helper::GetEventProcessType(mcEvent->Header()) == AliPWG0Helper::kDD){
+ if((fDataSet!=20100 || fDataSet==2011) && AliPWG0Helper::GetEventProcessType(mcEvent->Header()) == AliPWG0Helper::kDD){
FillHisto1D("SimHadEtDD",fSimHadEt,1.0);
FillHisto1D("SimTotEtDD",fSimTotEt,1.0);
FillHisto1D("NEventsDD",0.5,1);
CreateEtaPtHisto2D("EtNSimulatedAntiProtonEnhanced","Number of simulated #bar{p}");
}
CreateEtaPtHisto2D("EtNSimulatedChargedHadron","Number of simulated charged hadrons");
- if(fDataSet==20100){//If this is Pb+Pb
+ if(fDataSet==20100 || fDataSet==2011){//If this is Pb+Pb
Int_t width = 5;
if(fNCentBins<21) width = 10;
for(Int_t i=0;i<fNCentBins;i++){
CreateEtaPtHisto2D(Form("EtNReconstructed%sAntiProtonEnhanced",cutName->Data()),"Reconstructed E_{T} from #bar{p}");
}
CreateEtaPtHisto2D(Form("EtNReconstructed%sChargedHadron",cutName->Data()),"Reconstructed E_{T} from charged hadrons");
- if(fDataSet==20100){//If this is Pb+Pb
+ if(fDataSet==20100||fDataSet==2011){//If this is Pb+Pb
Int_t width = 5;
if(fNCentBins<21) width = 10;
for(Int_t j=0;j<fNCentBins;j++){
Float_t minEt = 0.0;
Float_t maxEt = 100.0;
Float_t minEtPiKP = 0.0;
- Float_t maxEtPiKP = 50.0;
- if(fDataSet==20100){
+ Float_t maxEtPiKP = 100.0;
+ if(fDataSet==20100 || fDataSet==2011){
maxEt=4000.0;
maxEtPiKP = 2500;
}
TString *sPHOS = new TString("PHOS");
float etDiff = 1.5;
float etDiffLow = etDiff;
- if(fDataSet!=20100){//If this is p+p
+ if(fDataSet!=20100 && fDataSet!=2011){//If this is p+p
etDiffLow = 2.5;
}
CreateHisto1D("SimHadEtDDV0AND","Simulated Hadronic E_{T}","Simulated Hadronic E_{T} for doubly diffractive events","Number of events",nbinsEt*4,minEt,maxEt);
CreateHisto1D("SimTotEtDDMB","Simulated Total E_{T}","Simulated Total E_{T} for doubly diffractive events","Number of events",nbinsEt*4,minEt,maxEt);
CreateHisto1D("SimHadEtDDMB","Simulated Hadronic E_{T}","Simulated Hadronic E_{T} for doubly diffractive events","Number of events",nbinsEt*4,minEt,maxEt);
- if(fDataSet==20100){
+ if(fDataSet==20100||fDataSet==2011){
Int_t width = 5;
if(fNCentBins<21) width = 10;
for(Int_t j=0;j<fNCentBins;j++){
CreatePtHisto1D("pTrecITS","p_{T}^{rec}","p_{T}^{rec}","Number of particles");
CreatePtHisto1D("pTrecTPC","p_{T}^{rec}","p_{T}^{rec}","Number of particles");
CreatePtHisto1D("pTrecTPCITS","p_{T}^{rec}","p_{T}^{rec}","Number of particles");
- if(fDataSet==20100){
+ if(fDataSet==20100||fDataSet==2011){
Int_t width = 5;
if(fNCentBins<21) width = 10;
for(Int_t j=0;j<fNCentBins;j++){
}
+void AliAnalysisHadEtMonteCarlo::SetGeneratorMinMaxParticles(AliMCEvent *eventMC){
+ // In case of access only to hijing particles in cocktail
+ // get the min and max labels
+ // TODO: Check when generator is not the first one ...
+
+ fNMCProducedMin = 0;
+ fNMCProducedMax = 0;
+
+ AliGenEventHeader * eventHeader = eventMC->GenEventHeader();
+
+ AliGenCocktailEventHeader *cocktail = dynamic_cast<AliGenCocktailEventHeader *>(eventHeader);
+
+ if(!cocktail) return ;
+
+ TList *genHeaders = cocktail->GetHeaders();
+
+ Int_t nGenerators = genHeaders->GetEntries();
+ //printf("N generators %d \n", nGenerators);
+
+ for(Int_t igen = 0; igen < nGenerators; igen++)
+ {
+ AliGenEventHeader * eventHeader2 = (AliGenEventHeader*)genHeaders->At(igen) ;
+ TString name = eventHeader2->GetName();
+
+ //printf("Generator %d: Class Name %s, Name %s, title %s \n",igen, eventHeader2->ClassName(), name.Data(), eventHeader2->GetTitle());
+
+ fNMCProducedMin = fNMCProducedMax;
+ fNMCProducedMax+= eventHeader2->NProduced();
+
+ if(name.Contains("Hijing",TString::kIgnoreCase)){
+ //cout<<"Found HIJING event and set range "<<fNMCProducedMin<<"-"<<fNMCProducedMax<<endl;
+ return ;
+ }
+ }
+
+}
+AliGenEventHeader* AliAnalysisHadEtMonteCarlo::GetGenEventHeader(AliMCEvent *eventMC) const
+{
+ // Return pointer to Generated event header
+ // If requested and cocktail, search for the hijing generator
+ AliGenEventHeader * eventHeader = eventMC->GenEventHeader();
+ AliGenCocktailEventHeader *cocktail = dynamic_cast<AliGenCocktailEventHeader *>(eventHeader);
+
+ if(!cocktail) return 0x0 ;
+
+ TList *genHeaders = cocktail->GetHeaders();
+
+ Int_t nGenerators = genHeaders->GetEntries();
+ //printf("N generators %d \n", nGenerators);
+
+ for(Int_t igen = 0; igen < nGenerators; igen++)
+ {
+ AliGenEventHeader * eventHeader2 = (AliGenEventHeader*)genHeaders->At(igen) ;
+ TString name = eventHeader2->GetName();
+
+ //printf("Generator %d: Class Name %s, Name %s, title %s \n",igen, eventHeader2->ClassName(), name.Data(), eventHeader2->GetTitle());
+
+ if(name.Contains("Hijing",TString::kIgnoreCase)) return eventHeader2 ;
+ }
+
+ return 0x0;
+
+}
+Bool_t AliAnalysisHadEtMonteCarlo::IsHIJINGLabel(Int_t label,AliMCEvent *eventMC,AliStack *stack)
+{
+
+ // Find if cluster/track was generated by HIJING
+
+ AliGenHijingEventHeader* hijingHeader = dynamic_cast<AliGenHijingEventHeader *> (GetGenEventHeader(eventMC));
+
+ //printf("header %p, label %d\n",hijingHeader,label);
+
+ if(!hijingHeader || label < 0 ) return kFALSE;
+
+
+ //printf("pass a), N produced %d\n",nproduced);
+
+ if(label >= fNMCProducedMin && label < fNMCProducedMax)
+ {
+ //printf(" accept!, label is smaller than produced, N %d\n",nproduced);
+
+ return kTRUE;
+ }
+
+ if(!stack) return kFALSE;
+
+ Int_t nprimaries = stack->GetNtrack();
+
+ if(label > nprimaries) return kFALSE;
+
+ TParticle * mom = stack->Particle(label);
+
+ Int_t iMom = label;
+ Int_t iParent = mom->GetFirstMother();
+ while(iParent!=-1){
+ if(iParent >= fNMCProducedMin && iParent < fNMCProducedMax){
+ return kTRUE;
+ }
+
+ iMom = iParent;
+ mom = stack->Particle(iMom);
+ iParent = mom->GetFirstMother();
+ }
+
+ return kFALSE ;
+
+}
+
+
+
+