#include "TF1.h"
#include "AliStack.h"
#include "AliAODConversionMother.h"
+#include "AliAODConversionPhoton.h"
#include "TObjString.h"
#include "AliAODEvent.h"
#include "AliESDEvent.h"
#include "AliAODMCParticle.h"
#include "AliAODMCHeader.h"
#include "AliPicoTrack.h"
+#include "AliEMCALRecoUtils.h"
+#include "AliTrackerBase.h"
class iostream;
fUseTimeDiff(0),
fMinDistTrackToCluster(0),
fUseDistTrackToCluster(0),
+ fExtendedMatching(kFALSE),
fExoticCell(0),
fUseExoticCell(0),
fMinEnergy(0),
fHistClusterEtavsPhiBeforeAcc(NULL),
fHistClusterEtavsPhiAfterAcc(NULL),
fHistClusterEtavsPhiAfterQA(NULL),
- fHistDistanceToBadChannelBeforeAcc(NULL),
- fHistDistanceToBadChannelAfterAcc(NULL),
+ //fHistDistanceToBadChannelBeforeAcc(NULL),
+ //fHistDistanceToBadChannelAfterAcc(NULL),
fHistClusterTimevsEBeforeQA(NULL),
fHistClusterTimevsEAfterQA(NULL),
- fHistExoticCellBeforeQA(NULL),
- fHistExoticCellAfterQA(NULL),
- fHistNMatchedTracks(NULL),
- fHistDistanceTrackToClusterBeforeQA(NULL),
- fHistDistanceTrackToClusterAfterQA(NULL),
+ //fHistExoticCellBeforeQA(NULL),
+ //fHistExoticCellAfterQA(NULL),
+ //fHistNMatchedTracks(NULL),
fHistEnergyOfClusterBeforeQA(NULL),
fHistEnergyOfClusterAfterQA(NULL),
fHistNCellsBeforeQA(NULL),
fHistM20BeforeQA(NULL),
fHistM20AfterQA(NULL),
fHistDispersionBeforeQA(NULL),
- fHistDispersionAfterQA(NULL),
- fHistNLMBeforeQA(NULL),
- fHistNLMAfterQA(NULL)
+ fHistDispersionAfterQA(NULL),
+ //fHistNLMBeforeQA(NULL),
+ //fHistNLMAfterQA(NULL),
+ fHistClusterRBeforeQA(NULL),
+ fHistClusterRAfterQA(NULL),
+ fHistClusterdEtadPhiBeforeQA(NULL),
+ fHistClusterdEtadPhiAfterQA(NULL),
+ fHistDistanceTrackToClusterBeforeQA(NULL),
+ fHistDistanceTrackToClusterAfterQA(NULL),
+ fHistClusterdEtadPhiPosTracksBeforeQA(NULL),
+ fHistClusterdEtadPhiNegTracksBeforeQA(NULL),
+ fHistClusterdEtadPtBeforeQA(NULL),
+ fHistClusterdPhidPtBeforeQA(NULL),
+ fHistClusterM20Pt_dPhiBeforeQA(NULL),
+ fHistClusterM02Pt_dPhiBeforeQA(NULL),
+ fHistClusterM20M02BeforeQA(NULL),
+ fHistClusterM20M02AfterQA(NULL)
{
for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=0;}
fCutString=new TObjString((GetCutNumber()).Data());
fUseTimeDiff(ref.fUseTimeDiff),
fMinDistTrackToCluster(ref.fMinDistTrackToCluster),
fUseDistTrackToCluster(ref.fUseDistTrackToCluster),
+ fExtendedMatching(ref.fExtendedMatching),
fExoticCell(ref.fExoticCell),
fUseExoticCell(ref.fUseExoticCell),
fMinEnergy(ref.fMinEnergy),
fHistClusterEtavsPhiBeforeAcc(NULL),
fHistClusterEtavsPhiAfterAcc(NULL),
fHistClusterEtavsPhiAfterQA(NULL),
- fHistDistanceToBadChannelBeforeAcc(NULL),
- fHistDistanceToBadChannelAfterAcc(NULL),
+ //fHistDistanceToBadChannelBeforeAcc(NULL),
+ //fHistDistanceToBadChannelAfterAcc(NULL),
fHistClusterTimevsEBeforeQA(NULL),
fHistClusterTimevsEAfterQA(NULL),
- fHistExoticCellBeforeQA(NULL),
- fHistExoticCellAfterQA(NULL),
- fHistNMatchedTracks(NULL),
- fHistDistanceTrackToClusterBeforeQA(NULL),
- fHistDistanceTrackToClusterAfterQA(NULL),
+ //fHistExoticCellBeforeQA(NULL),
+ //fHistExoticCellAfterQA(NULL),
+ //fHistNMatchedTracks(NULL),
fHistEnergyOfClusterBeforeQA(NULL),
fHistEnergyOfClusterAfterQA(NULL),
fHistNCellsBeforeQA(NULL),
fHistM20BeforeQA(NULL),
fHistM20AfterQA(NULL),
fHistDispersionBeforeQA(NULL),
- fHistDispersionAfterQA(NULL),
- fHistNLMBeforeQA(NULL),
- fHistNLMAfterQA(NULL)
+ fHistDispersionAfterQA(NULL),
+ //fHistNLMBeforeQA(NULL),
+ //fHistNLMAfterQA(NULL),
+ fHistClusterRBeforeQA(NULL),
+ fHistClusterRAfterQA(NULL),
+ fHistClusterdEtadPhiBeforeQA(NULL),
+ fHistClusterdEtadPhiAfterQA(NULL),
+ fHistDistanceTrackToClusterBeforeQA(NULL),
+ fHistDistanceTrackToClusterAfterQA(NULL),
+ fHistClusterdEtadPhiPosTracksBeforeQA(NULL),
+ fHistClusterdEtadPhiNegTracksBeforeQA(NULL),
+ fHistClusterdEtadPtBeforeQA(NULL),
+ fHistClusterdPhidPtBeforeQA(NULL),
+ fHistClusterM20Pt_dPhiBeforeQA(NULL),
+ fHistClusterM02Pt_dPhiBeforeQA(NULL),
+ fHistClusterM20M02BeforeQA(NULL),
+ fHistClusterM20M02AfterQA(NULL)
{
// Copy Constructor
for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=ref.fCuts[jj];}
fHistograms->Add(fHistClusterIdentificationCuts);
// Acceptance related histogramms
- fHistClusterEtavsPhiBeforeAcc=new TH2F(Form("EtaPhi_beforeAcceptance %s",GetCutNumber().Data()),"EtaPhi_beforeAcceptance",462,-TMath::Pi(),TMath::Pi(),110,-0.7,0.7);
+ fHistClusterEtavsPhiBeforeAcc=new TH2F(Form("EtaPhi_beforeAcceptance %s",GetCutNumber().Data()),"EtaPhi_beforeAcceptance",430,-TMath::Pi(),TMath::Pi(),96,-0.7,0.7); // 462->430, 110->96
fHistograms->Add(fHistClusterEtavsPhiBeforeAcc);
- fHistClusterEtavsPhiAfterAcc=new TH2F(Form("EtaPhi_afterAcceptance %s",GetCutNumber().Data()),"EtaPhi_afterAcceptance",462,-TMath::Pi(),TMath::Pi(),110,-0.7,0.7);
+ fHistClusterEtavsPhiAfterAcc=new TH2F(Form("EtaPhi_afterAcceptance %s",GetCutNumber().Data()),"EtaPhi_afterAcceptance",430,-TMath::Pi(),TMath::Pi(),96,-0.7,0.7); // 462->430, 110->96
fHistograms->Add(fHistClusterEtavsPhiAfterAcc);
- fHistClusterEtavsPhiAfterQA=new TH2F(Form("EtaPhi_afterClusterQA %s",GetCutNumber().Data()),"EtaPhi_afterClusterQA",462,-TMath::Pi(),TMath::Pi(),110,-0.7,0.7);
+ fHistClusterEtavsPhiAfterQA=new TH2F(Form("EtaPhi_afterClusterQA %s",GetCutNumber().Data()),"EtaPhi_afterClusterQA",430,-TMath::Pi(),TMath::Pi(),96,-0.7,0.7); // 462->430, 110->96
fHistograms->Add(fHistClusterEtavsPhiAfterQA);
- fHistDistanceToBadChannelBeforeAcc = new TH1F(Form("DistanceToBadChannel_beforeAcceptance %s",GetCutNumber().Data()),"DistanceToBadChannel_beforeAcceptance",200,0,40);
- fHistograms->Add(fHistDistanceToBadChannelBeforeAcc);
- fHistDistanceToBadChannelAfterAcc = new TH1F(Form("DistanceToBadChannel_afterAcceptance %s",GetCutNumber().Data()),"DistanceToBadChannel_afterAcceptance",200,0,40);
- fHistograms->Add(fHistDistanceToBadChannelAfterAcc);
+ //fHistDistanceToBadChannelBeforeAcc = new TH1F(Form("DistanceToBadChannel_beforeAcceptance %s",GetCutNumber().Data()),"DistanceToBadChannel_beforeAcceptance",200,0,40);
+ //fHistograms->Add(fHistDistanceToBadChannelBeforeAcc);
+ //fHistDistanceToBadChannelAfterAcc = new TH1F(Form("DistanceToBadChannel_afterAcceptance %s",GetCutNumber().Data()),"DistanceToBadChannel_afterAcceptance",200,0,40);
+ //fHistograms->Add(fHistDistanceToBadChannelAfterAcc);
// Cluster quality related histograms
- fHistClusterTimevsEBeforeQA=new TH2F(Form("ClusterTimeVsE_beforeClusterQA %s",GetCutNumber().Data()),"ClusterTimeVsE_beforeClusterQA",400,-10e-6,10e-6,100,0.,40);
+ Double_t timeMin = -10e-6;
+ Double_t timeMax = 10e-6;
+ fHistClusterTimevsEBeforeQA=new TH2F(Form("ClusterTimeVsE_beforeClusterQA %s",GetCutNumber().Data()),"ClusterTimeVsE_beforeClusterQA",400,timeMin,timeMax,100,0.,40);
fHistograms->Add(fHistClusterTimevsEBeforeQA);
- fHistClusterTimevsEAfterQA=new TH2F(Form("ClusterTimeVsE_afterClusterQA %s",GetCutNumber().Data()),"ClusterTimeVsE_afterClusterQA",400,-10e-6,10e-6,100,0.,40);
+ fHistClusterTimevsEAfterQA=new TH2F(Form("ClusterTimeVsE_afterClusterQA %s",GetCutNumber().Data()),"ClusterTimeVsE_afterClusterQA",400,timeMin,timeMax,100,0.,40);
fHistograms->Add(fHistClusterTimevsEAfterQA);
- fHistExoticCellBeforeQA=new TH2F(Form("ExoticCell_beforeClusterQA %s",GetCutNumber().Data()),"ExoticCell_beforeClusterQA",400,0,40,50,0.75,1);
- fHistograms->Add(fHistExoticCellBeforeQA);
- fHistExoticCellAfterQA=new TH2F(Form("ExoticCell_afterClusterQA %s",GetCutNumber().Data()),"ExoticCell_afterClusterQA",400,0,40,50,0.75,1);
- fHistograms->Add(fHistExoticCellAfterQA);
- fHistNMatchedTracks = new TH1F(Form("NMatchedTracks_%s",GetCutNumber().Data()),"NMatchedTracks",22,-1.5,20.5);
- fHistograms->Add(fHistNMatchedTracks);
- fHistDistanceTrackToClusterBeforeQA = new TH1F(Form("DistanceToTrack_beforeClusterQA %s",GetCutNumber().Data()),"DistanceToTrack_beforeClusterQA",200,0,2);
- fHistograms->Add(fHistDistanceTrackToClusterBeforeQA);
- fHistDistanceTrackToClusterAfterQA = new TH1F(Form("DistanceToTrack_afterClusterQA %s",GetCutNumber().Data()),"DistanceToTrack_afterClusterQA",200,0,2);
- fHistograms->Add(fHistDistanceTrackToClusterAfterQA);
+ //fHistExoticCellBeforeQA=new TH2F(Form("ExoticCell_beforeClusterQA %s",GetCutNumber().Data()),"ExoticCell_beforeClusterQA",400,0,40,50,0.75,1);
+ //fHistograms->Add(fHistExoticCellBeforeQA);
+ //fHistExoticCellAfterQA=new TH2F(Form("ExoticCell_afterClusterQA %s",GetCutNumber().Data()),"ExoticCell_afterClusterQA",400,0,40,50,0.75,1);
+ //fHistograms->Add(fHistExoticCellAfterQA);
+ //fHistNMatchedTracks = new TH1F(Form("NMatchedTracks_%s",GetCutNumber().Data()),"NMatchedTracks",22,-1.5,20.5);
+ //fHistograms->Add(fHistNMatchedTracks);
fHistEnergyOfClusterBeforeQA = new TH1F(Form("EnergyOfCluster_beforeClusterQA %s",GetCutNumber().Data()),"EnergyOfCluster_beforeClusterQA",300,0,30);
fHistograms->Add(fHistEnergyOfClusterBeforeQA);
fHistEnergyOfClusterAfterQA = new TH1F(Form("EnergyOfCluster_afterClusterQA %s",GetCutNumber().Data()),"EnergyOfCluster_afterClusterQA",300,0,30);
fHistograms->Add(fHistNCellsBeforeQA);
fHistNCellsAfterQA = new TH1F(Form("NCellPerCluster_afterClusterQA %s",GetCutNumber().Data()),"NCellPerCluster_afterClusterQA",50,0,50);
fHistograms->Add(fHistNCellsAfterQA);
- fHistM02BeforeQA = new TH1F(Form("M02_beforeClusterQA %s",GetCutNumber().Data()),"M02_beforeClusterQA",100,0,5);
+ fHistM02BeforeQA = new TH1F(Form("M02_beforeClusterQA %s",GetCutNumber().Data()),"M02_beforeClusterQA",400,0,5);
fHistograms->Add(fHistM02BeforeQA);
- fHistM02AfterQA = new TH1F(Form("M02_afterClusterQA %s",GetCutNumber().Data()),"M02_afterClusterQA",100,0,5);
+ fHistM02AfterQA = new TH1F(Form("M02_afterClusterQA %s",GetCutNumber().Data()),"M02_afterClusterQA",400,0,5);
fHistograms->Add(fHistM02AfterQA);
- fHistM20BeforeQA = new TH1F(Form("M20_beforeClusterQA %s",GetCutNumber().Data()),"M20_beforeClusterQA",100,0,2.5);
+ fHistM20BeforeQA = new TH1F(Form("M20_beforeClusterQA %s",GetCutNumber().Data()),"M20_beforeClusterQA",400,0,2.5);
fHistograms->Add(fHistM20BeforeQA);
- fHistM20AfterQA = new TH1F(Form("M20_afterClusterQA %s",GetCutNumber().Data()),"M20_afterClusterQA",100,0,2.5);
+ fHistM20AfterQA = new TH1F(Form("M20_afterClusterQA %s",GetCutNumber().Data()),"M20_afterClusterQA",400,0,2.5);
fHistograms->Add(fHistM20AfterQA);
fHistDispersionBeforeQA = new TH1F(Form("Dispersion_beforeClusterQA %s",GetCutNumber().Data()),"Dispersion_beforeClusterQA",100,0,4);
fHistograms->Add(fHistDispersionBeforeQA);
fHistDispersionAfterQA = new TH1F(Form("Dispersion_afterClusterQA %s",GetCutNumber().Data()),"Dispersion_afterClusterQA",100,0,4);
fHistograms->Add(fHistDispersionAfterQA);
- fHistNLMBeforeQA = new TH1F(Form("NLM_beforeClusterQA %s",GetCutNumber().Data()),"NLM_beforeClusterQA",10,0,10);
- fHistograms->Add(fHistNLMBeforeQA);
- fHistNLMAfterQA = new TH1F(Form("NLM_afterClusterQA %s",GetCutNumber().Data()),"NLM_afterClusterQA",10,0,10);
- fHistograms->Add(fHistNLMAfterQA);
+ //fHistNLMBeforeQA = new TH1F(Form("NLM_beforeClusterQA %s",GetCutNumber().Data()),"NLM_beforeClusterQA",10,0,10);
+ //fHistograms->Add(fHistNLMBeforeQA);
+ //fHistNLMAfterQA = new TH1F(Form("NLM_afterClusterQA %s",GetCutNumber().Data()),"NLM_afterClusterQA",10,0,10);
+ //fHistograms->Add(fHistNLMAfterQA);
+
+ //TrackMatching histograms
+ if(fUseDistTrackToCluster) {
+ fHistClusterRBeforeQA = new TH1F(Form("R_Cluster_beforeClusterQA %s",GetCutNumber().Data()),"R of cluster",200,400,500);
+ fHistograms->Add(fHistClusterRBeforeQA);
+ fHistClusterRAfterQA = new TH1F(Form("R_Cluster_afterClusterQA %s",GetCutNumber().Data()),"R of cluster_matched",200,400,500);
+ fHistograms->Add(fHistClusterRAfterQA);
+ fHistClusterdEtadPhiBeforeQA=new TH2F(Form("dEtaVsdPhi_beforeClusterQA %s",GetCutNumber().Data()),"dEtaVsdPhi_beforeClusterQA",240,-0.3,0.3,240,-0.3,0.3);
+ fHistograms->Add(fHistClusterdEtadPhiBeforeQA);
+ fHistClusterdEtadPhiAfterQA=new TH2F(Form("dEtaVsdPhi_afterClusterQA %s",GetCutNumber().Data()),"dEtaVsdPhi_afterClusterQA",240,-0.3,0.3,240,-0.3,0.3);
+ fHistograms->Add(fHistClusterdEtadPhiAfterQA);
+ fHistDistanceTrackToClusterBeforeQA = new TH1F(Form("DistanceToTrack_beforeClusterQA %s",GetCutNumber().Data()),"DistanceToTrack_beforeClusterQA",200,0,2);
+ fHistograms->Add(fHistDistanceTrackToClusterBeforeQA);
+ fHistDistanceTrackToClusterAfterQA = new TH1F(Form("DistanceToTrack_afterClusterQA %s",GetCutNumber().Data()),"DistanceToTrack_afterClusterQA",200,0,2);
+ fHistograms->Add(fHistDistanceTrackToClusterAfterQA);
+ if(fExtendedMatching){
+ fHistClusterdEtadPhiPosTracksBeforeQA = new TH2F(Form("dEtaVsdPhi_posTracks_beforeClusterQA %s",GetCutNumber().Data()),"dEtaVsdPhi_posTracks_beforeClusterQA",240,-0.3,0.3,240,-0.3,0.3);
+ fHistograms->Add(fHistClusterdEtadPhiPosTracksBeforeQA);
+ fHistClusterdEtadPhiNegTracksBeforeQA = new TH2F(Form("dEtaVsdPhi_negTracks_beforeClusterQA %s",GetCutNumber().Data()),"dEtaVsdPhi_negTracks_beforeClusterQA",240,-0.3,0.3,240,-0.3,0.3);
+ fHistograms->Add(fHistClusterdEtadPhiNegTracksBeforeQA);
+ fHistClusterdEtadPtBeforeQA = new TH2F(Form("dEtaVsPt_beforeClusterQA %s",GetCutNumber().Data()),"dEtaVsPt_beforeClusterQA",240,-0.3,0.3,250,0,25);
+ fHistograms->Add(fHistClusterdEtadPtBeforeQA);
+ fHistClusterdPhidPtBeforeQA = new TH2F(Form("dPhiVsPt_beforeClusterQA %s",GetCutNumber().Data()),"dPhiVsPt_beforeClusterQA",480,-0.6,0.6,250,0,25);
+ fHistograms->Add(fHistClusterdPhidPtBeforeQA);
+ fHistClusterM20Pt_dPhiBeforeQA = new TH2F(Form("M20VsPt_dPhi_beforeClusterQA %s",GetCutNumber().Data()),"M20VsPt_dPhi_beforeClusterQA",200,0,2.5,250,0,25);
+ fHistograms->Add(fHistClusterM20Pt_dPhiBeforeQA);
+ fHistClusterM02Pt_dPhiBeforeQA = new TH2F(Form("M02VsPt_dPhi_beforeClusterQA %s",GetCutNumber().Data()),"M20VsPt_dPhi_beforeClusterQA",400,0,5,250,0,25);
+ fHistograms->Add(fHistClusterM02Pt_dPhiBeforeQA);
+ fHistClusterM20M02BeforeQA = new TH2F(Form("M20VsM02_beforeClusterQA %s",GetCutNumber().Data()),"M20VsM02_beforeClusterQA",200,0,2.5,400,0,5);
+ fHistograms->Add(fHistClusterM20M02BeforeQA);
+ fHistClusterM20M02AfterQA = new TH2F(Form("M20VsM02_afterClusterQA %s",GetCutNumber().Data()),"M20VsM02_afterClusterQA",200,0,2.5,400,0,5);
+ fHistograms->Add(fHistClusterM20M02AfterQA);
+ }
+ }
TH1::AddDirectory(kTRUE);
}
-/*
+
///________________________________________________________________________
-Bool_t AliCaloPhotonCuts::ClusterIsSelectedMC(TParticle *particle,AliStack *fMCStack,Bool_t checkForConvertedGamma){
+Bool_t AliCaloPhotonCuts::ClusterIsSelectedMC(TParticle *particle,AliStack *fMCStack){
// MonteCarlo Photon Selection
- if(!fMCStack)return kFALSE;
-
- if (particle->GetPdgCode() == 22){
-
-
- if( particle->Eta() > (fEtaCut) || particle->Eta() < (-fEtaCut) )
- return kFALSE;
- if(fEtaCutMin>-0.1){
- if( particle->Eta() < (fEtaCutMin) && particle->Eta() > (-fEtaCutMin) )
- return kFALSE;
- }
-
- if(particle->GetMother(0) >-1 && fMCStack->Particle(particle->GetMother(0))->GetPdgCode() == 22){
- return kFALSE; // no photon as mothers!
- }
-
- if(particle->GetMother(0) >= fMCStack->GetNprimary()){
- return kFALSE; // the gamma has a mother, and it is not a primary particle
- }
+ if(!fMCStack)return kFALSE;
- if(!checkForConvertedGamma) return kTRUE; // return in case of accepted gamma
+ if (particle->GetPdgCode() == 22){
- // looking for conversion gammas (electron + positron from pairbuilding (= 5) )
- TParticle* ePos = NULL;
- TParticle* eNeg = NULL;
-
- if(particle->GetNDaughters() >= 2){
- for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
- TParticle *tmpDaughter = fMCStack->Particle(daughterIndex);
- if(tmpDaughter->GetUniqueID() == 5){
- if(tmpDaughter->GetPdgCode() == 11){
- eNeg = tmpDaughter;
- } else if(tmpDaughter->GetPdgCode() == -11){
- ePos = tmpDaughter;
- }
- }
- }
- }
-
- if(ePos == NULL || eNeg == NULL){ // means we do not have two daughters from pair production
- return kFALSE;
- }
-
- if(ePos->Pt()<fSinglePtCut || eNeg->Pt()<fSinglePtCut){
- return kFALSE; // no reconstruction below the Pt cut
- }
-
- if( ePos->Eta() > (fEtaCut) || ePos->Eta() < (-fEtaCut) ||
- eNeg->Eta() > (fEtaCut) || eNeg->Eta() < (-fEtaCut) )
- return kFALSE;
-
- if(fEtaCutMin > -0.1){
- if( (ePos->Eta() < (fEtaCutMin) && ePos->Eta() > (-fEtaCutMin)) ||
- (eNeg->Eta() < (fEtaCutMin) && eNeg->Eta() > (-fEtaCutMin)) )
- return kFALSE;
- }
-
- if(ePos->R()>fMaxR){
- return kFALSE; // cuts on distance from collision point
- }
-
- if(abs(ePos->Vz()) > fMaxZ){
- return kFALSE; // outside material
- }
- if(abs(eNeg->Vz()) > fMaxZ){
- return kFALSE; // outside material
- }
-
- if( ePos->R() <= ((abs(ePos->Vz()) * fLineCutZRSlope) - fLineCutZValue)){
- return kFALSE; // line cut to exclude regions where we do not reconstruct
- } else if ( fEtaCutMin != -0.1 && ePos->R() >= ((abs(ePos->Vz()) * fLineCutZRSlopeMin) - fLineCutZValueMin)){
- return kFALSE;
- }
-
- if( eNeg->R() <= ((abs(eNeg->Vz()) * fLineCutZRSlope) - fLineCutZValue)){
- return kFALSE; // line cut to exclude regions where we do not reconstruct
- } else if ( fEtaCutMin != -0.1 && eNeg->R() >= ((abs(eNeg->Vz()) * fLineCutZRSlopeMin) - fLineCutZValueMin)){
- return kFALSE;
- }
-
- return kTRUE;
- //if(AcceptanceCut(particle,ePos,eNeg))return kTRUE;
- }
- return kFALSE;
+ if ( particle->Eta() < fMinEtaCut || particle->Eta() > fMaxEtaCut ) return kFALSE;
+ if ( particle->Phi() < fMinPhiCut || particle->Phi() > fMaxPhiCut ) return kFALSE;
+
+ if(particle->GetMother(0) >-1 && fMCStack->Particle(particle->GetMother(0))->GetPdgCode() == 22){
+ return kFALSE; // no photon as mothers!
+ }
+ if(particle->GetMother(0) >= fMCStack->GetNprimary()){
+ return kFALSE; // the gamma has a mother, and it is not a primary particle
+ }
+ return kTRUE;
+ }
+ return kFALSE;
}
///________________________________________________________________________
-Bool_t AliCaloPhotonCuts::ClusterIsSelectedAODMC(AliAODMCParticle *particle,TClonesArray *aodmcArray,Bool_t checkForConvertedGamma){
- // MonteCarlo Photon Selection
-
- if(!aodmcArray)return kFALSE;
-
- if (particle->GetPdgCode() == 22){
- if( particle->Eta() > (fEtaCut) || particle->Eta() < (-fEtaCut) )
- return kFALSE;
- if(fEtaCutMin>-0.1){
- if( particle->Eta() < (fEtaCutMin) && particle->Eta() > (-fEtaCutMin) )
- return kFALSE;
- }
-
- if(particle->GetMother() > -1){
- if((static_cast<AliAODMCParticle*>(aodmcArray->At(particle->GetMother())))->GetPdgCode() == 22){
- return kFALSE; // no photon as mothers!
- }
- if(!(static_cast<AliAODMCParticle*>(aodmcArray->At(particle->GetMother()))->IsPrimary())){
- return kFALSE; // the gamma has a mother, and it is not a primary particle
- }
- }
-
- if(!checkForConvertedGamma) return kTRUE; // return in case of accepted gamma
-
- // looking for conversion gammas (electron + positron from pairbuilding (= 5) )
- AliAODMCParticle* ePos = NULL;
- AliAODMCParticle* eNeg = NULL;
-
- if(particle->GetNDaughters() >= 2){
- for(Int_t daughterIndex=particle->GetDaughter(0);daughterIndex<=particle->GetDaughter(1);daughterIndex++){
- AliAODMCParticle *tmpDaughter = static_cast<AliAODMCParticle*>(aodmcArray->At(daughterIndex));
- if(!tmpDaughter) continue;
- if(((tmpDaughter->GetMCProcessCode())) == 5){ // STILL A BUG IN ALIROOT >>8 HAS TPO BE REMOVED AFTER FIX
- if(tmpDaughter->GetPdgCode() == 11){
- eNeg = tmpDaughter;
- } else if(tmpDaughter->GetPdgCode() == -11){
- ePos = tmpDaughter;
- }
- }
- }
- }
-
- if(ePos == NULL || eNeg == NULL){ // means we do not have two daughters from pair production
- return kFALSE;
- }
-
- if(ePos->Pt()<fSinglePtCut || eNeg->Pt()<fSinglePtCut){
- return kFALSE; // no reconstruction below the Pt cut
- }
-
- if( ePos->Eta() > (fEtaCut) || ePos->Eta() < (-fEtaCut) ||
- eNeg->Eta() > (fEtaCut) || eNeg->Eta() < (-fEtaCut) )
- return kFALSE;
-
- if(fEtaCutMin > -0.1){
- if( (ePos->Eta() < (fEtaCutMin) && ePos->Eta() > (-fEtaCutMin)) ||
- (eNeg->Eta() < (fEtaCutMin) && eNeg->Eta() > (-fEtaCutMin)) )
- return kFALSE;
- }
-
- Double_t rPos = sqrt( (ePos->Xv()*ePos->Xv()) + (ePos->Yv()*ePos->Yv()) );
- Double_t rNeg = sqrt( (eNeg->Xv()*eNeg->Xv()) + (eNeg->Yv()*eNeg->Yv()) );
-
- if(rPos>fMaxR){
- return kFALSE; // cuts on distance from collision point
- }
- if(abs(ePos->Zv()) > fMaxZ){
- return kFALSE; // outside material
- }
- if(abs(eNeg->Zv()) > fMaxZ){
- return kFALSE; // outside material
- }
-
- if( rPos <= ((abs(ePos->Zv()) * fLineCutZRSlope) - fLineCutZValue)){
- return kFALSE; // line cut to exclude regions where we do not reconstruct
- } else if ( fEtaCutMin != -0.1 && rPos >= ((abs(ePos->Zv()) * fLineCutZRSlopeMin) - fLineCutZValueMin)){
- return kFALSE;
- }
-
- if( rNeg <= ((abs(eNeg->Zv()) * fLineCutZRSlope) - fLineCutZValue)){
- return kFALSE; // line cut to exclude regions where we do not reconstruct
- } else if ( fEtaCutMin != -0.1 && rNeg >= ((abs(eNeg->Zv()) * fLineCutZRSlopeMin) - fLineCutZValueMin)){
- return kFALSE;
- }
-
- return kTRUE;
- //if(AcceptanceCut(particle,ePos,eNeg))return kTRUE;
- }
- return kFALSE;
-}*/
+Bool_t AliCaloPhotonCuts::ClusterIsSelectedAODMC(AliAODMCParticle *particle,TClonesArray *aodmcArray){
+ // MonteCarlo Photon Selection
+
+ if(!aodmcArray)return kFALSE;
+ if (particle->GetPdgCode() == 22){
+ if ( particle->Eta() < fMinEtaCut || particle->Eta() > fMaxEtaCut ) return kFALSE;
+ if ( particle->Phi() < fMinPhiCut || particle->Phi() > fMaxPhiCut ) return kFALSE;
+ if(particle->GetMother() > -1){
+ if((static_cast<AliAODMCParticle*>(aodmcArray->At(particle->GetMother())))->GetPdgCode() == 22){
+ return kFALSE; // no photon as mothers!
+ }
+ if(!(static_cast<AliAODMCParticle*>(aodmcArray->At(particle->GetMother()))->IsPrimary())){
+ return kFALSE; // the gamma has a mother, and it is not a primary particle
+ }
+ }
+ return kTRUE; // return in case of accepted gamma
+ }
+ return kFALSE;
+}
if(fHistClusterIdentificationCuts)fHistClusterIdentificationCuts->Fill(cutIndex);
cutIndex++;
- Double_t minR = 999.0;
+// Double_t minR = 999.0;
// get the minimum radius of tracks to cluster
- if(fHistDistanceTrackToClusterBeforeQA || fHistDistanceTrackToClusterAfterQA){
+// if(fHistDistanceTrackToClusterBeforeQA || fHistDistanceTrackToClusterAfterQA){
// Float_t pos[3];
// cluster->GetPosition(pos); // Get cluster position
//
// if(dr < minR)
// minR = dr;
// }//loop over tracks
- }
+// }
// Fill Histos before Cuts
if(fHistClusterTimevsEBeforeQA) fHistClusterTimevsEBeforeQA->Fill(cluster->GetTOF(), cluster->E());
// if(fHistExoticCellBeforeQA) fHistExoticCellBeforeQA->Fill(cluster->E(), );
- if(fHistDistanceTrackToClusterBeforeQA) fHistDistanceTrackToClusterBeforeQA->Fill(minR);
+// if(fHistDistanceTrackToClusterBeforeQA) fHistDistanceTrackToClusterBeforeQA->Fill(minR);
if(fHistEnergyOfClusterBeforeQA) fHistEnergyOfClusterBeforeQA->Fill(cluster->E());
if(fHistNCellsBeforeQA) fHistNCellsBeforeQA->Fill(cluster->GetNCells());
if(fHistM02BeforeQA) fHistM02BeforeQA->Fill(cluster->GetM02());
cutIndex++; //2, next cut
// Minimum distance to track
- if (fUseDistTrackToCluster){
- Float_t pos[3];
- cluster->GetPosition(pos); // Get cluster position
- TVector3 cp(pos);
- int NtrMatched = 0;
- NtrMatched = cluster->GetNTracksMatched();
- fHistNMatchedTracks->Fill(NtrMatched);
- if(NtrMatched > 0){
- //loop over tracks for QA
- TList *l = event->GetList();
- TClonesArray *tracks = dynamic_cast<TClonesArray*>(l->FindObject("Tracks"));
-
- Double_t dphi = 999.0;
- Double_t deta = 999.0;
- Double_t dr2 = 999.0;
-
- for(int itrack = 0; itrack < NtrMatched; itrack++){
- AliVTrack *trackcluster = NULL;
- trackcluster = static_cast<AliVTrack*>(tracks->At(itrack));
- if (! trackcluster) {
- AliError(Form("Couldn't get ESD track %d\n", itrack));
- continue;
- }
- AliPicoTrack::GetEtaPhiDiff(trackcluster, cluster, dphi, deta);
- dr2 = dphi*dphi + deta+deta;
- //cout << dr << endl;
- if(dr2 < fMinDistTrackToCluster*fMinDistTrackToCluster){
- // if(dphi < fMinDistTrackToCluster || deta < fMinDistTrackToCluster){
- if(fHistClusterIdentificationCuts)fHistClusterIdentificationCuts->Fill(cutIndex); //2
- return kFALSE;
- }
-
- }//loop over tracks
- }
-// if(cluster->GetEmcCpvDistance() < fMinDistTrackToCluster){
-// if(fHistClusterIdentificationCuts)fHistClusterIdentificationCuts->Fill(cutIndex); //2
-// return kFALSE;
-// }
- }
+// if (fUseDistTrackToCluster){
+// Float_t pos[3];
+// cluster->GetPosition(pos); // Get cluster position
+// TVector3 cp(pos);
+// int NtrMatched = 0;
+// NtrMatched = cluster->GetNTracksMatched();
+// fHistNMatchedTracks->Fill(NtrMatched);
+// if(NtrMatched > 0){
+// //loop over tracks for QA
+// TList *l = event->GetList();
+// TClonesArray *tracks = dynamic_cast<TClonesArray*>(l->FindObject("Tracks"));
+//
+// Double_t dphi = 999.0;
+// Double_t deta = 999.0;
+// Double_t dr2 = 999.0;
+//
+// for(int itrack = 0; itrack < NtrMatched; itrack++){
+// AliVTrack *trackcluster = NULL;
+// trackcluster = static_cast<AliVTrack*>(tracks->At(itrack));
+// if (! trackcluster) {
+// AliError(Form("Couldn't get ESD track %d\n", itrack));
+// continue;
+// }
+// AliPicoTrack::GetEtaPhiDiff(trackcluster, cluster, dphi, deta);
+// dr2 = dphi*dphi + deta+deta;
+// //cout << dr << endl;
+// if(dr2 < fMinDistTrackToCluster*fMinDistTrackToCluster){
+// // if(dphi < fMinDistTrackToCluster || deta < fMinDistTrackToCluster){
+// if(fHistClusterIdentificationCuts)fHistClusterIdentificationCuts->Fill(cutIndex); //2
+// return kFALSE;
+// }
+//
+// }//loop over tracks
+// }
+// // if(cluster->GetEmcCpvDistance() < fMinDistTrackToCluster){
+// // if(fHistClusterIdentificationCuts)fHistClusterIdentificationCuts->Fill(cutIndex); //2
+// // return kFALSE;
+// // }
+// }
cutIndex++;//3, next cut
// exotic cell cut --IMPLEMENT LATER---
if(fHistClusterIdentificationCuts)fHistClusterIdentificationCuts->Fill(cutIndex); //10
// Histos after Cuts
- Double_t vertex[3] = {0};
- event->GetPrimaryVertex()->GetXYZ(vertex);
+ Double_t vertex[3] = {0,0,0};
+// event->GetPrimaryVertex()->GetXYZ(vertex);
// TLorentzvector with cluster
TLorentzVector clusterVector;
cluster->GetMomentum(clusterVector,vertex);
if(fHistClusterEtavsPhiAfterQA) fHistClusterEtavsPhiAfterQA->Fill(phiCluster,etaCluster);
if(fHistClusterTimevsEAfterQA) fHistClusterTimevsEAfterQA->Fill(cluster->GetTOF(), cluster->E());
// if(fHistExoticCellAfterQA) fHistExoticCellAfterQA->Fill(cluster->E(), );
- if(fHistDistanceTrackToClusterAfterQA) fHistDistanceTrackToClusterAfterQA->Fill(minR);
- if(fHistDistanceTrackToClusterAfterQA) fHistDistanceTrackToClusterAfterQA->Fill(cluster->GetEmcCpvDistance());
+// if(fHistDistanceTrackToClusterAfterQA) fHistDistanceTrackToClusterAfterQA->Fill(minR);
if(fHistEnergyOfClusterAfterQA) fHistEnergyOfClusterAfterQA->Fill(cluster->E());
if(fHistNCellsAfterQA) fHistNCellsAfterQA->Fill(cluster->GetNCells());
if(fHistM02AfterQA) fHistM02AfterQA->Fill(cluster->GetM02());
FillClusterCutIndex(kPhotonIn);
- Double_t vertex[3] = {0};
- event->GetPrimaryVertex()->GetXYZ(vertex);
+ Double_t vertex[3] = {0,0,0};
+// event->GetPrimaryVertex()->GetXYZ(vertex);
// TLorentzvector with cluster
TLorentzVector clusterVector;
cluster->GetMomentum(clusterVector,vertex);
cutIndex++;
- Double_t vertex[3] = {0};
- event->GetPrimaryVertex()->GetXYZ(vertex);
+ Double_t vertex[3] = {0,0,0};
+// event->GetPrimaryVertex()->GetXYZ(vertex);
// TLorentzvector with cluster
TLorentzVector clusterVector;
cluster->GetMomentum(clusterVector,vertex);
// check phi range
if (fUsePhiCut ){
- if (phiCluster < fMinPhiCut || phiCluster > fMaxEtaCut){
+ if (phiCluster < fMinPhiCut || phiCluster > fMaxPhiCut){
if(fHistAcceptanceCuts)fHistAcceptanceCuts->Fill(cutIndex);
return kFALSE;
}
return kTRUE;
}
+Bool_t AliCaloPhotonCuts::MatchConvPhotonToCluster(AliAODConversionPhoton* convPhoton, AliVCluster* cluster, AliVEvent* event ){
+
+ if (!fUseDistTrackToCluster) return kFALSE;
+
+ AliESDEvent *esdev = dynamic_cast<AliESDEvent*>(event);
+ AliAODEvent *aodev = 0;
+ if (!esdev) {
+ aodev = dynamic_cast<AliAODEvent*>(event);
+ if (!aodev) {
+ AliError("Task needs AOD or ESD event, returning");
+ return kFALSE;
+ }
+ }
+
+// Double_t vertex[3] = {0,0,0};
+// event->GetPrimaryVertex()->GetXYZ(vertex);
+
+ if(!cluster->IsEMCAL() && !cluster->IsPHOS()){AliError("Cluster is neither EMCAL nor PHOS, returning"); return kFALSE;}
+
+ Float_t clusterPosition[3] = {0,0,0};
+ cluster->GetPosition(clusterPosition);
+ Double_t clusterR = TMath::Sqrt( clusterPosition[0]*clusterPosition[0] + clusterPosition[1]*clusterPosition[1] );
+ if(fHistClusterRBeforeQA) fHistClusterRBeforeQA->Fill(clusterR);
+
+//cout << "+++++++++ Cluster: x, y, z, R" << clusterPosition[0] << ", " << clusterPosition[1] << ", " << clusterPosition[2] << ", " << clusterR << "+++++++++" << endl;
+
+ Bool_t matched = kFALSE;
+ for (Int_t i = 0; i < 2; i++){
+ Int_t tracklabel = convPhoton->GetLabel(i);
+ AliVTrack *inTrack = 0x0;
+ if(esdev) {
+ if(tracklabel > event->GetNumberOfTracks() ) continue;
+ inTrack = esdev->GetTrack(tracklabel);
+ } else {
+ if(((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask("V0ReaderV1"))->AreAODsRelabeled()){
+ inTrack = dynamic_cast<AliVTrack*>(event->GetTrack(tracklabel));
+ } else {
+ for(Int_t ii=0; ii<event->GetNumberOfTracks(); ii++) {
+ inTrack = dynamic_cast<AliVTrack*>(event->GetTrack(ii));
+ if(inTrack){
+ if(inTrack->GetID() == tracklabel) {
+ continue;
+ }
+ }
+ }
+ }
+ }
+
+ AliESDtrack *esdt = dynamic_cast<AliESDtrack*>(inTrack);
+ AliAODTrack *aodt = 0;
+ if (!esdt) {
+ aodt = dynamic_cast<AliAODTrack*>(inTrack);
+ if (!aodt){AliError("Track is neither ESD nor AOD, continue"); continue;}
+ }
+
+ AliExternalTrackParam *trackParam = 0;
+ if (esdt) {
+ const AliExternalTrackParam *in = esdt->GetInnerParam();
+ if (!in){AliError("Could not get InnerParam of Track, continue"); continue;}
+ trackParam = new AliExternalTrackParam(*in);
+ } else {
+ Double_t xyz[3] = {0}, pxpypz[3] = {0}, cv[21] = {0};
+ aodt->PxPyPz(pxpypz);
+ aodt->XvYvZv(xyz);
+ aodt->GetCovarianceXYZPxPyPz(cv);
+ trackParam = new AliExternalTrackParam(xyz,pxpypz,cv,aodt->Charge());
+ }
+ if (!trackParam){AliError("Could not get TrackParameters, continue"); continue;}
+
+ Bool_t propagated = kFALSE;
+ AliExternalTrackParam emcParam(*trackParam);
+ Float_t dPhi = 0;
+ Float_t dEta = 0;
+
+ if(cluster->IsEMCAL()){
+ Float_t eta = 0; Float_t phi = 0; Float_t pt = 0;
+ propagated = AliEMCALRecoUtils::ExtrapolateTrackToEMCalSurface(&emcParam, 430, 0.000510999, 20, eta, phi, pt);
+ if(propagated){
+ propagated = AliEMCALRecoUtils::ExtrapolateTrackToCluster(&emcParam, cluster, 0.000510999, 5, dEta, dPhi);
+ }
+ }
+ if(cluster->IsPHOS()){
+ propagated = AliTrackerBase::PropagateTrackToBxByBz(&emcParam, clusterR, 0.000510999, 20, kTRUE, 0.8, -1);
+ if (propagated){
+ Double_t trkPos[3] = {0,0,0};
+ emcParam.GetXYZ(trkPos);
+ TVector3 trkPosVec(trkPos[0],trkPos[1],trkPos[2]);
+ TVector3 clsPosVec(clusterPosition);
+ dPhi = clsPosVec.DeltaPhi(trkPosVec);
+ dEta = clsPosVec.Eta()-trkPosVec.Eta();
+ }
+ }
+
+ if (propagated){
+ Float_t dR2 = dPhi*dPhi + dEta*dEta;
+ if(fHistDistanceTrackToClusterBeforeQA)fHistDistanceTrackToClusterBeforeQA->Fill(TMath::Sqrt(dR2));
+ if(fHistClusterdEtadPhiBeforeQA) fHistClusterdEtadPhiBeforeQA->Fill(dEta, dPhi);
+
+ Float_t clusM02 = (Float_t)cluster->GetM02();
+ Float_t clusM20 = (Float_t)cluster->GetM20();
+ if(fExtendedMatching){
+ if(inTrack->Charge() > 0) fHistClusterdEtadPhiPosTracksBeforeQA->Fill(dEta, dPhi);
+ if(inTrack->Charge() < 0) fHistClusterdEtadPhiNegTracksBeforeQA->Fill(dEta, dPhi);
+ fHistClusterdEtadPtBeforeQA->Fill(dEta, inTrack->Pt());
+ fHistClusterdPhidPtBeforeQA->Fill(dPhi, inTrack->Pt());
+ if(abs(dPhi) > 0.05) fHistClusterM20Pt_dPhiBeforeQA->Fill(clusM20, inTrack->Pt());
+ if(abs(dPhi) > 0.05) fHistClusterM02Pt_dPhiBeforeQA->Fill(clusM02, inTrack->Pt());
+ fHistClusterM20M02BeforeQA->Fill(clusM20, clusM02);
+ }
+
+ if(dR2 < fMinDistTrackToCluster*fMinDistTrackToCluster){
+ matched = kTRUE;
+ } else {
+ if(fHistDistanceTrackToClusterAfterQA)fHistDistanceTrackToClusterAfterQA->Fill(TMath::Sqrt(dR2));
+ if(fHistClusterdEtadPhiAfterQA) fHistClusterdEtadPhiAfterQA->Fill(dEta, dPhi);
+ if(fHistClusterRAfterQA) fHistClusterRAfterQA->Fill(clusterR);
+ if(fExtendedMatching){
+ fHistClusterM20M02AfterQA->Fill(clusM20, clusM02);
+ }
+ }
+ }
+ delete trackParam;
+ }
+
+ return matched;
+
+}
+
+//____________________________________________________________________________________________
+
+
///________________________________________________________________________
Bool_t AliCaloPhotonCuts::UpdateCutString() {
///Update the cut string (if it has been created yet)
if (fUseDistTrackToCluster) printf("\tmin distance to track > %3.2f\n", fMinDistTrackToCluster );
if (fUseExoticCell)printf("\t min distance to track > %3.2f\n", fMinDistTrackToCluster );
if (fUseMinEnergy)printf("\t E_{cluster} > %3.2f\n", fMinEnergy );
- if (fUseNCells) printf("\t number of cells per cluster > %d\n", fMinNCells );
+ if (fUseNCells) printf("\t number of cells per cluster >= %d\n", fMinNCells );
if (fUseM02) printf("\t %3.2f < M02 < %3.2f\n", fMinM02, fMaxM02 );
if (fUseM20) printf("\t %3.2f < M20 < %3.2f\n", fMinM20, fMaxM20 );
if (fUseDispersion) printf("\t dispersion < %3.2f\n", fMaxDispersion );
break;
case 1:
if (!fUseDistTrackToCluster) fUseDistTrackToCluster=1;
- fMinDistTrackToCluster=5;
+ fMinDistTrackToCluster= 0.03; //0.04;
+ break;
+ case 2:
+ if (!fUseDistTrackToCluster) fUseDistTrackToCluster=1;
+ fMinDistTrackToCluster= 0.035; //0.05;
+ break;
+ case 3:
+ if (!fUseDistTrackToCluster) fUseDistTrackToCluster=1;
+ fMinDistTrackToCluster= 0.04; //0.1;
+ break;
+ case 4:
+ if (!fUseDistTrackToCluster) fUseDistTrackToCluster=1;
+ fMinDistTrackToCluster= 0.045; //0.13;
break;
+ case 5:
+ if (!fUseDistTrackToCluster) fUseDistTrackToCluster=1;
+ fMinDistTrackToCluster= 0.05; //0.15
+ break;
+ case 6:
+ if (!fUseDistTrackToCluster) fUseDistTrackToCluster=1;
+ fMinDistTrackToCluster= 0.055; //0.2;
+ break;
+ case 7:
+ if (!fUseDistTrackToCluster) fUseDistTrackToCluster=1;
+ fMinDistTrackToCluster= 0.06; //0.3;
+ break;
+ case 8:
+ if (!fUseDistTrackToCluster) fUseDistTrackToCluster=1;
+ fMinDistTrackToCluster= 0.07; //0.4;
+ break;
+ case 9:
+ if (!fUseDistTrackToCluster) fUseDistTrackToCluster=1;
+ fMinDistTrackToCluster= 0.1; //0.5;
+ break;
+
default:
AliError(Form("Track Matching Cut not defined %d",trackMatching));
return kFALSE;
break;
case 6:
if (!fUseMinEnergy) fUseMinEnergy=1;
- fMinEnergy=0.5;
+ fMinEnergy=0.4;
break;
case 7:
if (!fUseMinEnergy) fUseMinEnergy=1;
- fMinEnergy=0.75;
+ fMinEnergy=0.5;
break;
case 8:
if (!fUseMinEnergy) fUseMinEnergy=1;
- fMinEnergy=1.;
+ fMinEnergy=0.75;
break;
case 9:
if (!fUseMinEnergy) fUseMinEnergy=1;
- fMinEnergy=1.25;
+ fMinEnergy=1.;
break;
default:
AliError(Form("Minimum Energy Cut not defined %d",minEnergy));
return a;
}
-
\ No newline at end of file
+