fFillUEBandSubtractHistograms(1), fFillCellHistograms(0),
fFillHighMultHistograms(0), fFillTaggedDecayHistograms(0),
fFillNLMHistograms(0),
+fLeadingOnly(0), fCheckLeadingWithNeutralClusters(0),
// Several IC
fNCones(0), fNPtThresFrac(0),
fConeSizes(), fPtThresholds(),
if(!GetReader()->IsCTSSwitchedOn() && GetIsolationCut()->GetParticleTypeInCone()!=AliIsolationCut::kOnlyNeutral)
AliFatal("STOP!: You want to use CTS tracks in analysis but not read!! \n!!Check the configuration file!!\n");
-
}
//____________________________________________
fReMakeIC = kFALSE ;
fMakeSeveralIC = kFALSE ;
+ fLeadingOnly = kTRUE;
+ fCheckLeadingWithNeutralClusters = kTRUE;
+
//----------- Several IC-----------------
fNCones = 5 ;
fNPtThresFrac = 5 ;
}
+//_________________________________________________________________________________________
+Bool_t AliAnaParticleIsolation::IsTriggerTheNearSideEventLeadingParticle(Int_t & idLeading)
+{
+ // Check if the what of the selected isolation candidates is leading particle in the same hemisphere
+ // comparing with all the candidates, all the tracks or all the clusters.
+
+ Double_t ptTrig = GetMinPt();
+ Double_t phiTrig = 0 ;
+ Int_t index =-1 ;
+ AliAODPWG4ParticleCorrelation* pLeading = 0;
+
+ // Loop on stored AOD particles, find leading trigger on the selected list, with at least min pT.
+
+ for(Int_t iaod = 0; iaod < GetInputAODBranch()->GetEntriesFast() ; iaod++)
+ {
+ AliAODPWG4ParticleCorrelation* particle = (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->At(iaod));
+ particle->SetLeadingParticle(kFALSE); // set it later
+
+ // Vertex cut in case of mixing
+ if(GetMixedEvent())
+ {
+ Int_t check = CheckMixedEventVertex(particle->GetCaloLabel(0), particle->GetTrackLabel(0));
+ if(check == 0) continue;
+ if(check == -1) return kFALSE; // not sure if it is correct.
+ }
+
+ //check if it is low pt trigger particle
+ if((particle->Pt() < GetIsolationCut()->GetPtThreshold() ||
+ particle->Pt() < GetIsolationCut()->GetSumPtThreshold()) &&
+ !fMakeSeveralIC)
+ {
+ continue ; //trigger should not come from underlying event
+ }
+
+ // find the leading particles with highest momentum
+ if (particle->Pt() > ptTrig)
+ {
+ ptTrig = particle->Pt() ;
+ phiTrig = particle->Phi();
+ index = iaod ;
+ pLeading = particle ;
+ }
+ }// finish search of leading trigger particle on the AOD branch.
+
+ if(index < 0) return kFALSE;
+
+ idLeading = index;
+
+ //printf("AOD leading pT %2.2f, ID %d\n", pLeading->Pt(),pLeading->GetCaloLabel(0));
+
+ if(phiTrig < 0 ) phiTrig += TMath::TwoPi();
+
+ // Compare if it is the leading of all tracks
+
+ TVector3 p3;
+ for(Int_t ipr = 0;ipr < GetCTSTracks()->GetEntriesFast() ; ipr ++ )
+ {
+ AliVTrack * track = (AliVTrack *) (GetCTSTracks()->At(ipr)) ;
+
+ if(track->GetID() == pLeading->GetTrackLabel(0) || track->GetID() == pLeading->GetTrackLabel(1) ||
+ track->GetID() == pLeading->GetTrackLabel(2) || track->GetID() == pLeading->GetTrackLabel(3) ) continue ;
+
+ Double_t mom[3] = {track->Px(),track->Py(),track->Pz()};
+ p3.SetXYZ(mom[0],mom[1],mom[2]);
+ Float_t pt = p3.Pt();
+ Float_t phi = p3.Phi() ;
+ if(phi < 0) phi+=TMath::TwoPi();
+
+ //skip this event if near side associated particle pt larger than trigger
+
+ if(pt > ptTrig && TMath::Abs(phi-phiTrig) < TMath::PiOver2()) return kFALSE;
+
+ }// track loop
+
+ // Compare if it is leading of all calorimeter clusters
+
+ if(fCheckLeadingWithNeutralClusters)
+ {
+ // Select the calorimeter cluster list
+ TObjArray * nePl = 0x0;
+ if (pLeading->GetDetector() == "PHOS" )
+ nePl = GetPHOSClusters();
+ else
+ nePl = GetEMCALClusters();
+
+ if(!nePl) return kTRUE; // Do the selection just with the tracks if no calorimeter is available.
+
+ TLorentzVector lv;
+ for(Int_t ipr = 0;ipr < nePl->GetEntriesFast() ; ipr ++ )
+ {
+ AliVCluster * cluster = (AliVCluster *) (nePl->At(ipr)) ;
+
+ if(cluster->GetID() == pLeading->GetCaloLabel(0) || cluster->GetID() == pLeading->GetCaloLabel(1) ) continue ;
+
+ cluster->GetMomentum(lv,GetVertex(0));
+
+ Float_t pt = lv.Pt();
+ Float_t phi = lv.Phi() ;
+ if(phi < 0) phi+=TMath::TwoPi();
+
+ if(IsTrackMatched(cluster,GetReader()->GetInputEvent())) continue ; // avoid charged clusters, already covered by tracks, or cluster merging with track.
+
+ // skip this event if near side associated particle pt larger than trigger
+ // not really needed for calorimeter, unless DCal is included
+
+ if(pt > ptTrig && TMath::Abs(phi-phiTrig) < TMath::PiOver2()) return kFALSE ;
+
+ }// cluster loop
+ } // check neutral clusters
+
+ idLeading = index ;
+ pLeading->SetLeadingParticle(kTRUE);
+
+ if( GetDebug() > 1 )
+ printf("AliAnaParticleIsolation::IsTriggerTheNearSideEventLeadingParticle() - Particle AOD with index %d is leading with pT %2.2f\n",
+ idLeading, pLeading->Pt());
+
+ return kTRUE;
+
+}
+
//__________________________________________________
void AliAnaParticleIsolation::MakeAnalysisFillAOD()
{
- //Do analysis and fill aods
- //Search for the isolated photon in fCalorimeter with pt > GetMinPt()
+ // Do analysis and fill aods
+ // Search for the isolated photon in fCalorimeter with GetMinPt() < pt < GetMaxPt()
+ // and if the particle is leading in the near side (if requested)
if(!GetInputAODBranch())
AliFatal(Form("No input particles in AOD with name branch < %s >, STOP",GetInputAODName().Data()));
pl = GetEMCALClusters();
//Loop on AOD branch, filled previously in AliAnaPhoton, find leading particle to do isolation only with it
- Double_t ptLeading = 0. ;
- Int_t idLeading = -1 ;
TLorentzVector mom ;
- Int_t naod = GetInputAODBranch()->GetEntriesFast();
+ Int_t idLeading = -1 ;
+ Int_t iaod0 = 0;
+ Int_t naod = GetInputAODBranch()->GetEntriesFast();
+
if(GetDebug() > 0)
printf("AliAnaParticleIsolation::MakeAnalysisFillAOD() - Input aod branch entries %d\n", naod);
- for(Int_t iaod = 0; iaod < naod; iaod++)
+ if(IsLeadingOnlyOn())
+ {
+ Bool_t leading = IsTriggerTheNearSideEventLeadingParticle(idLeading);
+ if(!leading)
+ {
+ if(GetDebug() > 1) printf("AliAnaParticleIsolation::MakeAnalysisFillAOD() - Not leading; End fill AODs \n");
+ return;
+ }
+ iaod0 = idLeading ; // first entry in particle loop
+ naod = idLeading+1; // last entry in particle loop
+ }
+
+ // Check isolation of list of candidate particles or leading particle
+
+ for(Int_t iaod = iaod0; iaod < naod; iaod++)
{
AliAODPWG4ParticleCorrelation * aodinput = (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->At(iaod));
- //If too small or too large pt, skip
- if(aodinput->Pt() < GetMinPt() || aodinput->Pt() > GetMaxPt() ) continue ;
+ if(IsLeadingOnlyOn()) aodinput->SetLeadingParticle(kTRUE);
+
+ // Check isolation only of clusters in fiducial region
+ if(IsFiducialCutOn())
+ {
+ Bool_t in = GetFiducialCut()->IsInFiducialCut(*aodinput->Momentum(),aodinput->GetDetector()) ;
+ if(! in ) return ;
+ }
+ //If too small or too large pt, skip
+ Float_t pt = aodinput->Pt();
+ if(pt < GetMinPt() || pt > GetMaxPt() ) continue ;
+
//check if it is low pt trigger particle
- if((aodinput->Pt() < GetIsolationCut()->GetPtThreshold() ||
- aodinput->Pt() < GetIsolationCut()->GetSumPtThreshold()) &&
+ if( ( pt < GetIsolationCut()->GetPtThreshold() || pt < GetIsolationCut()->GetSumPtThreshold() ) &&
!fMakeSeveralIC)
{
continue ; //trigger should not come from underlying event
}
- //vertex cut in case of mixing
- Int_t check = CheckMixedEventVertex(aodinput->GetCaloLabel(0), aodinput->GetTrackLabel(0));
- if(check == 0) continue;
- if(check == -1) return;
+ //After cuts, study isolation
+ n=0; nfrac = 0; isolated = kFALSE; coneptsum = 0;
+ GetIsolationCut()->MakeIsolationCut(GetCTSTracks(),pl,
+ GetReader(), GetCaloPID(),
+ kTRUE, aodinput, GetAODObjArrayName(),
+ n,nfrac,coneptsum, isolated);
- //find the leading particles with highest momentum
- if ( aodinput->Pt() > ptLeading )
- {
- ptLeading = aodinput->Pt() ;
- idLeading = iaod ;
- }
-
- aodinput->SetLeadingParticle(kFALSE);
-
- }//finish searching for leading trigger particle
-
- // Check isolation of leading particle
- if(idLeading < 0) return;
-
- AliAODPWG4ParticleCorrelation * aodinput = (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->At(idLeading));
- aodinput->SetLeadingParticle(kTRUE);
-
- // Check isolation only of clusters in fiducial region
- if(IsFiducialCutOn())
- {
- Bool_t in = GetFiducialCut()->IsInFiducialCut(*aodinput->Momentum(),aodinput->GetDetector()) ;
- if(! in ) return ;
- }
-
- //After cuts, study isolation
- n=0; nfrac = 0; isolated = kFALSE; coneptsum = 0;
- GetIsolationCut()->MakeIsolationCut(GetCTSTracks(),pl,
- GetReader(), GetCaloPID(),
- kTRUE, aodinput, GetAODObjArrayName(),
- n,nfrac,coneptsum, isolated);
-
- if(!fMakeSeveralIC) aodinput->SetIsolated(isolated);
+ if(!fMakeSeveralIC) aodinput->SetIsolated(isolated);
+ } // particle isolationloop
if(GetDebug() > 1)
{
- if(isolated)printf("AliAnaParticleIsolation::MakeAnalysisFillAOD() : Particle %d IS ISOLATED \n",idLeading);
+ if(isolated) printf("AliAnaParticleIsolation::MakeAnalysisFillAOD() : Particle %d IS ISOLATED \n",idLeading);
printf("AliAnaParticleIsolation::MakeAnalysisFillAOD() - End fill AODs \n");
}
//_________________________________________________________
void AliAnaParticleIsolation::MakeAnalysisFillHistograms()
{
- //Do analysis and fill histograms
+ // Do analysis and fill histograms
// In case of simulated data, fill acceptance histograms
// Not ready for multiple case analysis.
{
AliAODPWG4ParticleCorrelation* aod = (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->At(iaod));
- if(!aod->IsLeadingParticle()) continue; // Try to isolate only leading cluster or track
+ if(IsLeadingOnlyOn() && !aod->IsLeadingParticle()) continue; // Try to isolate only leading cluster or track
// Check isolation only of clusters in fiducial region
if(IsFiducialCutOn())