#include <TList.h>
#include <TH1F.h>
+#include "AliAnalysisManager.h"
+#include "AliAODHandler.h"
#include "AliAODEvent.h"
#include "AliAODVertex.h"
#include "AliAODTrack.h"
AliAODEvent *aod = dynamic_cast<AliAODEvent*> (InputEvent());
- // load heavy flavour vertices
- TClonesArray *arrayVerticesHF =
- (TClonesArray*)aod->GetList()->FindObject("VerticesHF");
- if(!arrayVerticesHF) {
- printf("AliAnalysisTaskSEBkgLikeSignJPSI::UserExec: VerticesHF branch not found!\n");
- return;
+ TClonesArray *arrayJPSItoEle = 0;
+ TClonesArray *arrayLikeSign = 0;
+
+ if(!aod && AODEvent() && IsStandardAOD()) {
+ // In case there is an AOD handler writing a standard AOD, use the AOD
+ // event in memory rather than the input (ESD) event.
+ aod = dynamic_cast<AliAODEvent*> (AODEvent());
+ // in this case the braches in the deltaAOD (AliAOD.VertexingHF.root)
+ // have to taken from the AOD event hold by the AliAODExtension
+ AliAODHandler* aodHandler = (AliAODHandler*)
+ ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
+ if(aodHandler->GetExtensions()) {
+ AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject("AliAOD.VertexingHF.root");
+ AliAODEvent *aodFromExt = ext->GetAOD();
+ // load Jpsi candidates
+ arrayJPSItoEle=(TClonesArray*)aodFromExt->GetList()->FindObject("JPSItoEle");
+ // load like sign candidates
+ arrayLikeSign=(TClonesArray*)aodFromExt->GetList()->FindObject("LikeSign2Prong");
+ }
+ } else {
+ // load Jpsi candidates
+ arrayJPSItoEle=(TClonesArray*)aod->GetList()->FindObject("JPSItoEle");
+ // load like sign candidates
+ arrayLikeSign=(TClonesArray*)aod->GetList()->FindObject("LikeSign2Prong");
}
- // load JPSI->ee candidates
- TClonesArray *arrayJPSItoEle =
- (TClonesArray*)aod->GetList()->FindObject("JPSItoEle");
+
if(!arrayJPSItoEle) {
printf("AliAnalysisTaskSEBkgLikeSignJPSI::UserExec: JPSItoEle branch not found!\n");
return;
}
-
- // load like sign candidates
- TClonesArray *arrayLikeSign =
- (TClonesArray*)aod->GetList()->FindObject("LikeSign2Prong");
if(!arrayLikeSign) {
printf("AliAnalysisTaskSEBkgLikeSignJPSI::UserExec: LikeSign2Prong branch not found!\n");
return;
}
+ // fix for temporary bug in ESDfilter
+ // the AODs with null vertex pointer didn't pass the PhysSel
+ if(!aod->GetPrimaryVertex() || TMath::Abs(aod->GetMagneticField())<0.001) return;
+
// AOD primary vertex
AliAODVertex *vtx1 = (AliAODVertex*)aod->GetPrimaryVertex();
// loop over Like sign candidates
Int_t nPosPairs=0,nNegPairs=0;
Int_t nLikeSign = arrayLikeSign->GetEntriesFast();
- printf("+++\n+++Number of like sign pairs ---> %d \n+++\n", nLikeSign);
+ if(fDebug>1) printf("+++\n+++Number of like sign pairs ---> %d \n+++\n", nLikeSign);
for(Int_t iLikeSign = 0; iLikeSign < nLikeSign; iLikeSign++) {
AliAODRecoDecayHF2Prong *d = (AliAODRecoDecayHF2Prong*)arrayLikeSign->UncheckedAt(iLikeSign);
d->SetOwnPrimaryVtx(vtx1); // needed to compute all variables
unsetvtx=kTRUE;
}
- Int_t okBtoJPSIls=0;
- if(d->SelectBtoJPSI(fVHF->GetBtoJPSICuts(),okBtoJPSIls)) {
+ //Int_t okBtoJPSIls=0;
+ //if(d->SelectBtoJPSI(fVHF->GetBtoJPSICuts(),okBtoJPSIls)) {
+ if(d) {
+ AliAODTrack *trk0 = (AliAODTrack*)d->GetDaughter(0);
fHistMassLS->Fill(d->InvMassJPSIee());
fHistCPtaLS->Fill(d->CosPointingAngle());
fHistd0d0LS->Fill(1e8*d->Prodd0d0());
- fHistCtsLS->Fill(d->CosThetaStarJPSI());
fHistDCALS->Fill(100*d->GetDCA());
- PostData(1,fOutput);
- AliAODTrack *trk0 = (AliAODTrack*)d->GetDaughter(0);
+ //PostData(1,fOutput);
if(!trk0) {
trk0=aod->GetTrack(trkIDtoEntry[d->GetProngID(0)]);
printf("references to standard AOD not available \n");
}
if((trk0->Charge())==1) {
nPosPairs++;
- fHistCtsLSpos->Fill(d->CosThetaStarJPSI());
- PostData(1,fOutput);
+ fHistCtsLS->Fill(d->CosThetaStar(0,443,11,11));
+ fHistCtsLSpos->Fill(d->CosThetaStar(0,443,11,11));
+ //PostData(1,fOutput);
} else {
nNegPairs++;
+ fHistCtsLS->Fill(d->CosThetaStarJPSI());
fHistCtsLSneg->Fill(d->CosThetaStarJPSI());
- PostData(1,fOutput);
+ //PostData(1,fOutput);
}
PostData(1,fOutput);
}
if(unsetvtx) d->UnsetOwnPrimaryVtx();
}
- printf("------------ N. of positive pairs in Event ----- %d \n", nPosPairs);
- printf("------------ N. of negative pairs in Event ----- %d \n", nNegPairs);
+ if(fDebug>1) printf("------------ N. of positive pairs in Event ----- %d \n", nPosPairs);
+ if(fDebug>1) printf("------------ N. of negative pairs in Event ----- %d \n", nNegPairs);
fTotPosPairs += nPosPairs;
fTotNegPairs += nNegPairs;
// loop over JPSI candidates
Int_t nBtoJpsiToEle = arrayJPSItoEle->GetEntriesFast();
- printf("Number of like JPSI -> ee candidates ---> %d \n", nBtoJpsiToEle);
+ if(fDebug>1) printf("Number of like JPSI -> ee candidates ---> %d \n", nBtoJpsiToEle);
for (Int_t iBtoJpsiToEle = 0; iBtoJpsiToEle < nBtoJpsiToEle; iBtoJpsiToEle++) {
AliAODRecoDecayHF2Prong *d = (AliAODRecoDecayHF2Prong*)arrayJPSItoEle->UncheckedAt(iBtoJpsiToEle);
d->SetOwnPrimaryVtx(vtx1); // needed to compute all variables
unsetvtx=kTRUE;
}
- Int_t okBtoJPSI=0;
- if(d->SelectBtoJPSI(fVHF->GetBtoJPSICuts(),okBtoJPSI)) {
+ ///Int_t okBtoJPSI=0;
+ //if(d->SelectBtoJPSI(fVHF->GetBtoJPSICuts(),okBtoJPSI)) {
+ if(d) {
fHistMassJPSI->Fill(d->InvMassJPSIee());
fHistCtsJPSI->Fill(d->CosThetaStarJPSI());
fHistd0d0JPSI->Fill(1e8*d->Prodd0d0());