* about the suitability of this software for any purpose. It is *
* provided "as is" without express or implied warranty. *
**************************************************************************/
-/**************************************************************************
- * *
- * QA class of primary vertex study for Heavy Flavor electrons *
- * *
- * Authors: *
- * MinJung Kweon <minjung@physi.uni-heidelberg.de> *
- * *
- **************************************************************************/
+
+/* $Id$ */
+
+//
+// QA class of primary vertex study for Heavy Flavor electrons
+// this has functionality to reject electrons from primary vertex
+// and check primary vertex characteristics
+//
+// Authors:
+// MinJung Kweon <minjung@physi.uni-heidelberg.de>
+//
-#include <iostream>
#include <TH2F.h>
-#include <TH3F.h>
-#include "TLorentzVector.h"
-#include <TNtuple.h>
#include <TParticle.h>
#include "AliESDEvent.h"
#include <AliESDtrack.h>
-#include <AliStack.h>
+#include <AliMCEvent.h>
#include <AliLog.h>
#include <AliKFParticle.h>
//_______________________________________________________________________________________________
AliHFEpriVtx::AliHFEpriVtx():
fESD1(0x0)
- ,fStack(0x0)
+ ,fMCEvent(0x0)
,fNtrackswoPid(0)
,fHNtrackswoPid(0x0)
,fNESDprimVtxContributor(0x0)
,fNESDprimVtxIndices(0x0)
,fDiffDCAvsPt(0x0)
,fDiffDCAvsNt(0x0)
+ ,fNsectrk2prim(0)
+ ,fPVxRe(-999.)
+ ,fPVyRe(-999.)
+ ,fPVzRe(-999.)
{
//
// Default constructor
AliHFEpriVtx::AliHFEpriVtx(const AliHFEpriVtx &p):
TObject(p)
,fESD1(0x0)
- ,fStack(0x0)
+ ,fMCEvent(0x0)
,fNtrackswoPid(p.fNtrackswoPid)
,fHNtrackswoPid(0x0)
,fNESDprimVtxContributor(0x0)
,fNESDprimVtxIndices(0x0)
,fDiffDCAvsPt(0x0)
,fDiffDCAvsNt(0x0)
+ ,fNsectrk2prim(p.fNsectrk2prim)
+ ,fPVxRe(p.fPVxRe)
+ ,fPVyRe(p.fPVyRe)
+ ,fPVzRe(p.fPVzRe)
{
//
// Copy constructor
hname=hnopt+"nPrimVtxContributor_"+fkSourceLabel[isource];
fPrimVtx[isource].fNprimVtxContributor = new TH1F(hname,hname,100,0,100);
hname=hnopt+"PtElec_"+fkSourceLabel[isource];
- fPrimVtx[isource].fPtElec = new TH1F(hname,hname,150,0,30);
+ fPrimVtx[isource].fPtElec = new TH1F(hname,hname,250,0,50);
hname=hnopt+"PtElecContributor_"+fkSourceLabel[isource];
- fPrimVtx[isource].fPtElecContributor = new TH1F(hname,hname,150,0,30);
+ fPrimVtx[isource].fPtElecContributor = new TH1F(hname,hname,250,0,50);
}
hname=hnopt+"nESDprimVtxIndices";
fNESDprimVtxIndices= new TH1I(hname,hname,100,0,100);
hname=hnopt+"diffDCAvsPt";
- fDiffDCAvsPt = new TH2F(hname,hname,150,0,30,500,0,1);
+ fDiffDCAvsPt = new TH2F(hname,hname,250,0,50,500,0,1);
hname=hnopt+"diffDCAvsNt";
fDiffDCAvsNt = new TH2F(hname,hname,100,0,100,500,0,1);
}
//_______________________________________________________________________________________________
-Int_t AliHFEpriVtx::GetMCPID(AliESDtrack *track)
+Int_t AliHFEpriVtx::GetMCPID(AliESDtrack const *track)
{
//
// get MC pid
//
- Int_t label = TMath::Abs(track->GetLabel());
- TParticle* mcpart = fStack->Particle(label);
+ AliMCParticle *mctrack = NULL;
+ if(!(mctrack = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(TMath::Abs(track->GetLabel()))))) return 0;
+ TParticle *mcpart = mctrack->Particle();
+
if ( !mcpart ) return 0;
Int_t pdgCode = mcpart->GetPdgCode();
// get track id of our selected electron
Int_t elecTrkID = ESDelectron->GetID();
- Int_t label = TMath::Abs(ESDelectron->GetLabel());
- TParticle* mcpart = fStack->Particle(label);
+ AliMCParticle *mctrack = NULL;
+ if(!(mctrack = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(TMath::Abs(ESDelectron->GetLabel()))))) return;
+ TParticle *mcpart = mctrack->Particle();
+
+
+ if(!mcpart){
+ AliDebug(1, "no mc particle, return\n");
+ return;
+ }
AliKFParticle::SetField(fESD1->GetMagneticField());
AliKFParticle kfElectron(*ESDelectron,11);
}
//_______________________________________________________________________________________________
-void AliHFEpriVtx::FillNprimVtxContributor()
+void AliHFEpriVtx::FillNprimVtxContributor() const
{
//
// Fill histogram with number of electrons contributing to the primary vertex
}
}
+
+//_______________________________________________________________________________________________
+Double_t AliHFEpriVtx::GetDistanceFromRecalVertexXY(AliESDtrack * const ESDelectron)
+{
+ //
+ // return recalculated DCA after removing input track from the primary vertex
+ //
+
+ // get track id of our selected electron
+ Int_t elecTrkID = ESDelectron->GetID();
+
+ AliKFParticle::SetField(fESD1->GetMagneticField());
+ AliKFParticle kfElectron(*ESDelectron,11);
+
+ // prepare kfprimary vertex
+ AliKFVertex kfESDprimary;
+
+ // Reconstructed Primary Vertex (with ESD tracks)
+ const AliESDVertex *primvtx = fESD1->GetPrimaryVertex();
+ Int_t n=primvtx->GetNIndices();
+
+ if (n>0 && primvtx->GetStatus()){
+
+ kfESDprimary = AliKFVertex(*primvtx);
+ UShort_t *priIndex = primvtx->GetIndices();
+
+ for (Int_t i=0;i<n;i++){
+
+ Int_t idx = Int_t(priIndex[i]);
+ if (idx == elecTrkID){
+ kfESDprimary -= kfElectron;
+ Double_t dcaAFrmElec = kfElectron.GetDistanceFromVertexXY(kfESDprimary);
+
+ return dcaAFrmElec;
+ }
+ }
+ }
+ return -1;
+
+}
+
+void AliHFEpriVtx::RecalcPrimvtx(Int_t nkftrk, const Int_t * const trkid, const AliKFParticle * const kftrk)
+{
+ //
+ // recalculate primary vertex after removing the input track
+ //
+
+ const AliESDVertex *primvtx = fESD1->GetPrimaryVertex();
+
+ AliKFVertex kfESDprimary;
+ Int_t n = primvtx->GetNIndices();
+ fNsectrk2prim = 0;
+ fPVxRe = -999.;
+ fPVyRe = -999.;
+ fPVyRe = -999.;
+
+ if (n>0 && primvtx->GetStatus()){
+ kfESDprimary = AliKFVertex(*primvtx);
+ UShort_t *priIndex = primvtx->GetIndices();
+ for (Int_t j=0; j<nkftrk; j++){
+ for (Int_t i=0;i<n;i++){
+ Int_t idx = Int_t(priIndex[i]);
+ if (idx == trkid[j]){
+ kfESDprimary -= kftrk[j];
+ fNsectrk2prim++;
+ }
+ }
+ }
+ }
+
+ fPVxRe = kfESDprimary.GetX();
+ fPVyRe = kfESDprimary.GetY();
+ fPVzRe = kfESDprimary.GetZ();
+
+}
+
+
+//_______________________________________________________________________________________________
+void AliHFEpriVtx::RecalcPrimvtx(AliESDtrack * const ESDelectron)
+{
+ //
+ // recalculate primary vertex after removing the input track
+ //
+
+ // get track id of our selected electron
+ Int_t elecTrkID = ESDelectron->GetID();
+
+ AliKFParticle::SetField(fESD1->GetMagneticField());
+ AliKFParticle kfElectron(*ESDelectron,11);
+
+ const AliESDVertex *primvtx = fESD1->GetPrimaryVertex();
+
+ AliKFVertex kfESDprimary;
+ Int_t n = primvtx->GetNIndices();
+ fPVxRe = -999.;
+ fPVyRe = -999.;
+ fPVyRe = -999.;
+
+ if (n>0 && primvtx->GetStatus()){
+ kfESDprimary = AliKFVertex(*primvtx);
+ UShort_t *priIndex = primvtx->GetIndices();
+ for (Int_t i=0;i<n;i++){
+ Int_t idx = Int_t(priIndex[i]);
+ if (idx == elecTrkID){
+ kfESDprimary -= kfElectron;
+ }
+ }
+ }
+
+ fPVxRe = kfESDprimary.GetX();
+ fPVyRe = kfESDprimary.GetY();
+ fPVzRe = kfESDprimary.GetZ();
+
+}