ClassImp(AliAnalysisTaskSpectraBoth)
//________________________________________________________________________
-AliAnalysisTaskSpectraBoth::AliAnalysisTaskSpectraBoth(const char *name) : AliAnalysisTaskSE(name), fAOD(0), fHistMan(0), fTrackCuts(0), fEventCuts(0), fPID(0), fIsMC(0), fNRebin(0),fUseMinSigma(0),fCuts(0),fdotheMCLoopAfterEventCuts(0)
+AliAnalysisTaskSpectraBoth::AliAnalysisTaskSpectraBoth(const char *name) : AliAnalysisTaskSE(name), fAOD(0), fHistMan(0), fTrackCuts(0), fEventCuts(0), fPID(0), fIsMC(0), fNRebin(0),fUseMinSigma(0),fCuts(0),fdotheMCLoopAfterEventCuts(0),fmakePIDQAhisto(1),fMotherWDPDGcode(-1)
+
{
// Default constructor
void AliAnalysisTaskSpectraBoth::UserCreateOutputObjects()
{
// create output objects
- fHistMan = new AliSpectraBothHistoManager("SpectraHistos",fNRebin);
+ fHistMan = new AliSpectraBothHistoManager("SpectraHistos",fNRebin,fmakePIDQAhisto);
if (!fTrackCuts) AliFatal("Track Cuts should be set in the steering macro");
if (!fEventCuts) AliFatal("Event Cuts should be set in the steering macro");
}
else
AliFatal("Not processing AODs or ESDS") ;
+ if(fIsMC)
+ {
+ if(!fEventCuts->CheckMCProcessType(MCEvent()))
+ return ;
+ }
+
+
if(fdotheMCLoopAfterEventCuts)
- if(!fEventCuts->IsSelected(fAOD,fTrackCuts))return;//event selection
+ if(!fEventCuts->IsSelected(fAOD,fTrackCuts,fIsMC,-100,fHistMan->GetEventStatHist()))
+ return;//event selection
TClonesArray *arrayMC = 0;
Int_t npar=0;
AliStack* stack=0x0;
}
}
if(!fdotheMCLoopAfterEventCuts)
- if(!fEventCuts->IsSelected(fAOD,fTrackCuts,fIsMC,mcZ))return;//event selection
+ if(!fEventCuts->IsSelected(fAOD,fTrackCuts,fIsMC,mcZ,fHistMan->GetEventStatHist()))
+ return;//event selection
//main loop on tracks
Int_t ntracks=0;
//cout<<fAOD->GetNumberOfTracks()<<endl;
else
continue;
if (!fTrackCuts->IsSelected(track,kTRUE))
- continue;
+ continue;
+
ntracks++;
- fPID->FillQAHistos(fHistMan, track, fTrackCuts);
+ if(fmakePIDQAhisto)
+ fPID->FillQAHistos(fHistMan, track, fTrackCuts);
//calculate DCA for AOD track
if(dca==-999.)
fHistMan->GetPtHistogram(kHistPtRec)->Fill(track->Pt(),dca); // PT histo
// get identity and charge
Bool_t rec[3]={false,false,false};
+ Bool_t sel[3]={false,false,false};
Int_t idRec = fPID->GetParticleSpecie(fHistMan,track, fTrackCuts,rec);
for(int irec=kSpPion;irec<kNSpecies;irec++)
{
if(idRec != kSpUndefined && fTrackCuts->CheckYCut ((BothParticleSpecies_t)idRec))
{
fHistMan->GetHistogram2D(kHistPtRecSigma,idRec,charge)->Fill(track->Pt(),dca);
- fTrackCuts->GetHistoDCAzQA()->Fill(idRec,track->Pt(),dcaz);
- fTrackCuts->GetHistoNclustersQA()->Fill(idRec,track->Pt(),ncls);
- fTrackCuts->GetHistochi2perNDFQA()->Fill(idRec,track->Pt(),chi2perndf);
+ if(fTrackCuts->GetMakeQAhisto())
+ {
+ fTrackCuts->GetHistoDCAzQA()->Fill(idRec,track->Pt(),dcaz);
+ fTrackCuts->GetHistoNclustersQA()->Fill(idRec,track->Pt(),ncls);
+ fTrackCuts->GetHistochi2perNDFQA()->Fill(idRec,track->Pt(),chi2perndf);
+ }
+ sel[idRec]=true;
}
//can't put a continue because we still have to fill allcharged primaries, done later
Bool_t isSecondaryWeak = kFALSE;
Int_t idGen =kSpUndefined;
Int_t pdgcode=0;
+ Int_t motherpdg=-1;
if (ifAODEvent==AliSpectraBothTrackCuts::kAODobject)
{
AliAODMCParticle *partMC = (AliAODMCParticle*) arrayMC->At(TMath::Abs(track->GetLabel()));
isSecondaryMaterial = partMC->IsSecondaryFromMaterial();
//cout<<"AOD tagging "<<isPrimary<<" "<<isSecondaryWeak<<isSecondaryMaterial<<" "<<partMC->GetMCProcessCode()<<endl;
- if(!isPrimary&&!isSecondaryWeak&&!isSecondaryMaterial)
+ if(!isPrimary&&!isSecondaryWeak&&!isSecondaryMaterial)//old tagging for old AODs
{
AliError("old tagging");
Int_t mfl=-999,codemoth=-999;
isSecondaryMaterial = kTRUE;
}
//cout<<"AOD 2 tagging "<<isPrimary<<" "<<isSecondaryWeak<<isSecondaryMaterial<<" "<<partMC->GetMCProcessCode()<<endl;
-
+ if(isSecondaryWeak)
+ {
+ Int_t indexMoth=partMC->GetMother(); // FIXME ignore fakes? TO BE CHECKED, on ESD is GetFirstMother()
+ if(indexMoth>=0)
+ {
+ AliAODMCParticle* moth = (AliAODMCParticle*) arrayMC->At(indexMoth);
+ if(moth)
+ motherpdg=TMath::Abs(moth->GetPdgCode());
+ }
+ }
idGen = fPID->GetParticleSpecie(partMC);
pdgcode=partMC->GetPdgCode();
isSecondaryMaterial = stack->IsSecondaryFromMaterial(TMath::Abs(track->GetLabel()));
//cout<<"ESD tagging "<<isPrimary<<" "<<isSecondaryWeak<<isSecondaryMaterial<<endl;
+ if(isSecondaryWeak)
+ {
+
+ TParticle* moth=stack->Particle(TMath::Abs(partMC->GetFirstMother()));
+ if(moth)
+ motherpdg = TMath::Abs(moth->GetPdgCode());
+
+ }
+
+
idGen = fPID->GetParticleSpecie(partMC);
pdgcode=partMC->GetPdgCode();
}
if(!fTrackCuts->CheckYCut ((BothParticleSpecies_t)idRec)) continue;
// Get true ID
-
+
if (idRec == idGen) fHistMan->GetHistogram2D(kHistPtRecTrue, idGen, charge)->Fill(track->Pt(),dca);
///..... END FIXME
// Fill secondaries
- if(isSecondaryWeak )
- fHistMan->GetHistogram2D(kHistPtRecSigmaSecondaryWeakDecay, idRec, charge)->Fill(track->Pt(),dca);
+ if(isSecondaryWeak)
+ {
+ if(fMotherWDPDGcode>0)
+ {
+ if(motherpdg==fMotherWDPDGcode)
+ fHistMan->GetHistogram2D(kHistPtRecSigmaSecondaryWeakDecay, idRec, charge)->Fill(track->Pt(),dca);
+ }
+ else
+ fHistMan->GetHistogram2D(kHistPtRecSigmaSecondaryWeakDecay, idRec, charge)->Fill(track->Pt(),dca);
+ }
if(isSecondaryMaterial)
fHistMan->GetHistogram2D(kHistPtRecSigmaSecondaryMaterial , idRec, charge)->Fill(track->Pt(),dca);
}//end if(arrayMC)
}
+ if(sel[0]&&sel[1]&&sel[2])//pi+k+p
+ fHistMan->GetPtHistogram("hHistDoubleCounts")->Fill(track->Pt(),0);
+ else if(sel[0]&&sel[1]) //pi+k
+ fHistMan->GetPtHistogram("hHistDoubleCounts")->Fill(track->Pt(),1);
+ else if(sel[0]&&sel[2]) //pi+k
+ fHistMan->GetPtHistogram("hHistDoubleCounts")->Fill(track->Pt(),2);
+ else if(sel[1]&&sel[2]) //p+k
+ fHistMan->GetPtHistogram("hHistDoubleCounts")->Fill(track->Pt(),3);
+
} // end loop on tracks