12 #include "AliESDCaloCluster.h" 13 #include "AliAODCaloCluster.h" 14 #include "AliVParticle.h" 16 #include "AliEMCALGeometry.h" 17 #include "AliMCEvent.h" 32 fDoPropagation(kFALSE),
34 fAttemptPropMatch(kFALSE),
39 fUpdateClusters(kTRUE),
40 fClusterContainerIndexMap(),
41 fParticleContainerIndexMap(),
49 fMCGenerToAcceptForTrack(1)
51 for(
Int_t icent=0; icent<8; ++icent) {
52 for(
Int_t ipt=0; ipt<9; ++ipt) {
53 for(
Int_t ieta=0; ieta<2; ++ieta) {
85 Bool_t enableFracEMCRecalc = kFALSE;
86 GetProperty(
"enableFracEMCRecalc", enableFracEMCRecalc);
87 Int_t removeNMCGenerators = 0;
88 GetProperty(
"removeNMCGenerators", removeNMCGenerators);
90 std::string removeMcGen1 =
"";
92 TString removeMCGen1 = removeMcGen1.c_str();
93 std::string removeMcGen2 =
"";
95 TString removeMCGen2 = removeMcGen2.c_str();
97 if(enableFracEMCRecalc){
98 if(removeNMCGenerators > 0)
100 printf(
"\t gen1 <%s>, gen2 <%s>, remove tracks %d\n",removeMCGen1.Data(),removeMCGen2.Data(),
fMCGenerToAcceptForTrack);
118 std::string particleContainerNames =
"";
119 bool firstLoop =
true;
122 while ((partCont = static_cast<AliParticleContainer*>(nextPartCont()))) {
123 if (firstLoop !=
true) {
124 particleContainerNames +=
"_";
129 particleContainerNames += partCont->GetArrayName();
132 std::string clusterContainerNames =
"";
136 while ((clusCont = static_cast<AliClusterContainer*>(nextClusCont()))) {
137 if (firstLoop !=
true) {
138 clusterContainerNames +=
"_";
143 clusterContainerNames += clusCont->GetArrayName();
147 fEmcalTracks->SetName(Form(
"EmcalTracks_%s", particleContainerNames.c_str()));
149 fEmcalClusters->SetName(Form(
"EmcalClusters_%s", clusterContainerNames.c_str()));
153 fHistMatchEtaAll =
new TH1F(
"fHistMatchEtaAll",
"fHistMatchEtaAll", 400, -0.2, 0.2);
154 fHistMatchPhiAll =
new TH1F(
"fHistMatchPhiAll",
"fHistMatchPhiAll", 400, -0.2, 0.2);
159 for(
Int_t icent=0; icent<nCentChBins; ++icent) {
160 for(
Int_t ipt=0; ipt<9; ++ipt) {
161 for(
Int_t ieta=0; ieta<2; ++ieta) {
162 TString nameEta(Form(
"fHistMatchEta_%i_%i_%i",icent,ipt,ieta));
163 fHistMatchEta[icent][ipt][ieta] =
new TH1F(nameEta, nameEta, 400, -0.2, 0.2);
165 TString namePhi(Form(
"fHistMatchPhi_%i_%i_%i",icent,ipt,ieta));
166 fHistMatchPhi[icent][ipt][ieta] =
new TH1F(namePhi, namePhi, 400, -0.2, 0.2);
212 else if (p>=0.5 && p<1.0)
214 else if (p>=1.0 && p<1.5)
216 else if (p>=1.5 && p<2.)
218 else if (p>=2. && p<3.)
220 else if (p>=3. && p<4.)
222 else if (p>=4. && p<5.)
224 else if (p>=5. && p<8.)
244 AliVCluster* cluster = 0;
245 AliVTrack* track = 0;
249 while ((clusCont = static_cast<AliClusterContainer*>(nextClusCont()))) {
252 cluster =
static_cast<AliVCluster *
>(clusIterator->second);
255 cluster->SetEmcCpvDistance(-1);
256 cluster->SetTrackDistance(1024, 1024);
257 AliAODCaloCluster *ac =
dynamic_cast<AliAODCaloCluster*
>(cluster);
258 AliESDCaloCluster *ec = 0;
260 const Int_t N = ac->GetNTracksMatched();
261 AliDebug(2, TString::Format(
"Number of matched tracks: %d", N));
262 for (
Int_t i = N - 1; i >= 0; i--) {
263 TObject *ptr = ac->GetTrackMatched(i);
264 ac->RemoveTrackMatched(ptr);
265 AliDebug(2, TString::Format(
"N tracks matched: %i of %i", ac->GetNTracksMatched(), N));
269 ec =
dynamic_cast<AliESDCaloCluster*
>(cluster);
270 TArrayI *arr = ec->GetTracksMatched();
271 if (arr) arr->Set(0);
295 while ((partCont = static_cast<AliParticleContainer*>(nextPartCont()))) {
298 track =
static_cast<AliVTrack *
>(partIterator->second);
301 track->ResetStatus(AliVTrack::kEMCALmatch);
302 track->SetEMCALcluster(-1);
305 Bool_t propthistrack = kFALSE;
307 propthistrack = kTRUE;
309 else if (!track->IsExtrapolatedToEMCAL()) {
311 propthistrack = kTRUE;
314 propthistrack = kTRUE;
320 Int_t mcLabel = TMath::Abs(track->GetLabel());
324 fMCEvent->GetCocktailGenerator(mcLabel,genName);
332 if ( !generOK )
continue;
336 AliEMCALRecoUtils::ExtrapolateTrackToEMCalSurface(track,
fPropDist, mass, 20, 0.35, kFALSE,
fUseDCA);
346 track->SetUniqueID(0);
347 track->ResetBit(TObject::kHasUUID);
348 track->ResetBit(TObject::kIsReferenced);
354 AliDebug(2, Form(
"Now adding track %i (pT = %.3f, eta = %.3f, phi = %.3f)" 355 "Phi, Eta on EMCal = %.3f, %.3f",
357 track->GetTrackEtaOnEMCal(), track->GetTrackPhiOnEMCal()));
373 AliVTrack* track = emcalTrack->
GetTrack();
377 AliVCluster* cluster = emcalCluster->
GetCluster();
382 Double_t d2 = deta * deta + dphi * dphi;
384 if (d2 > maxd2)
continue;
389 AliDebug(2, Form(
"Now matching cluster E = %.3f, pT = %.3f, eta = %.3f, phi = %.3f " 390 "with track pT = %.3f, eta = %.3f, phi = %.3f" 391 "Track eta, phi on EMCal = %.3f, %.3f, d = %.3f",
392 cluster->GetNonLinCorrEnergy(), emcalCluster->
Pt(), emcalCluster->
Eta(), emcalCluster->
Phi(),
393 emcalTrack->
Pt(), emcalTrack->
Eta(), emcalTrack->
Phi(),
394 track->GetTrackEtaOnEMCal(), track->GetTrackPhiOnEMCal(), d));
399 if (track->Charge() < 0) centbinch +=
fNcentBins;
401 if(track->Eta() > 0) etabin = 1;
420 AliVCluster* cluster = emcalCluster->
GetCluster();
421 AliDebug(3, Form(
"Cluster E = %.2f, eta = %.2f, phi = %.2f, Nmatch = %d", cluster->GetNonLinCorrEnergy(), emcalCluster->
Eta(), emcalCluster->
Phi(), N));
423 if (N <= 0)
continue;
428 AliVTrack* trackFirstMatch = emcalTrackFirstMatch->
GetTrack();
432 cluster->SetTrackDistance(dphi, deta);
435 AliAODCaloCluster *ac =
dynamic_cast<AliAODCaloCluster*
>(cluster);
436 AliESDCaloCluster *ec = 0;
437 if (!ac) ec =
dynamic_cast<AliESDCaloCluster*
>(cluster);
441 for (
Int_t i=0; i < N; ++i) {
445 AliDebug(3, Form(
"Pt = %.2f, eta = %.2f, phi = %.2f", emcalTrack->
Pt(), emcalTrack->
Eta(), emcalTrack->
Phi()));
448 ac->AddTrackMatched(obj);
453 for (
Int_t i = 0; i < N; ++i) {
458 ec->AddTracksMatched(arr);
475 AliVTrack* track = emcalTrack->
GetTrack();
477 track->SetStatus(AliVTrack::kEMCALmatch);
492 AliWarning(Form(
"%s - AliAnalysisTaskEmcal::IsTrackInEmcalAcceptance - Geometry is not available!", GetName()));
499 if (part->Phi() > minPhi && part->Phi() < maxPhi) {
Bool_t fUpdateClusters
update clusters with matching info
Int_t fNcentBins
How many centrality bins (this member copied from AliAnalysisTaskEmcal)
void SetNumberOfMCGeneratorsToAccept(Int_t nGen)
Bool_t fEsdMode
flag for ESD
virtual ~AliEmcalCorrectionClusterTrackMatcher()
Bool_t fUseDCA
Use DCA as starting point for track propagation, rather than primary vertex.
Double_t fPropDist
distance to surface (440cm default)
AliEMCALGeometry * fGeom
! Geometry object
Bool_t fAttemptProp
if true then attempt to propagate if not done yet
Bool_t fUpdateTracks
update tracks with matching info
Int_t GetMatchedObjId(UShort_t i=0) const
Int_t fNEmcalClusters
!number of emcal clusters
const AliClusterIterableMomentumContainer accepted_momentum() const
UShort_t GetNumberOfMatchedObj() const
bidirectional stl iterator over the EMCAL iterable container
Bool_t fAttemptPropMatch
if true then attempt to propagate if not done yet but IsEMCAL is true
void SetMatchedPtr(TObjArray *arr)
Bool_t fUsePIDmass
Use PID-based mass hypothesis for track propagation, rather than pion mass hypothesis.
virtual void UserCreateOutputObjects()
AliVTrack * GetTrack() const
Int_t fCentBin
! Event centrality bin
int GlobalIndexFromLocalIndex(const U *inputObject, const int localIndex) const
TString part
use mixed event to constrain combinatorial background
Container for particles within the EMCAL framework.
TH1 * fHistMatchPhi[10][9][2]
!dphi distribution
TObjArray fParticleCollArray
Particle/track collection array.
TObjArray fClusterCollArray
Cluster collection array.
AliEmcalContainerIndexMap< AliClusterContainer, AliVCluster > fClusterContainerIndexMap
! Mapping between index and cluster containers
Cluster-track matcher component in the EMCal correction framework.
TH1 * fHistMatchPhiAll
!dphi distribution
Base class for correction components in the EMCal correction framework.
static const AliEmcalContainerIndexMap< TClonesArray, AliVCluster > & GetEmcalContainerIndexMap()
Get the EMCal container utils associated with particle containers.
Int_t IdInCollection() const
AliMCEvent * fMCEvent
! MC
Bool_t fDoPropagation
if true then propagate all hybrid tracks to EMCal surface
Double_t fVertex[3]
! Event vertex
TString fMCGenerToAccept[5]
List with name of generators that should not be included.
void GenerateEmcalParticles()
Bool_t fMCGenerToAcceptForTrack
Activate the removal of tracks entering the track matching that come from a particular generator...
TList * fOutput
! List of output histograms
Bool_t fCreateHisto
Flag to make some basic histograms.
TH1 * fHistMatchEta[10][9][2]
!deta distribution
Int_t fNEmcalTracks
!number of emcal tracks
Int_t fNMCGenerToAccept
Number of MC generators that should not be included in analysis.
AliVCluster * GetCluster() const
virtual Bool_t Initialize()
const AliParticleIterableMomentumContainer accepted_momentum() const
void CopyMappingFrom(const AliEmcalContainerIndexMap< U2, V > &map, U *cont)
virtual Bool_t CheckIfRunChanged()
void UserCreateOutputObjects()
void AddMatchedObj(Int_t id, Double_t d)
Bool_t IsTrackInEmcalAcceptance(AliVParticle *part, Double_t edges=0.9) const
TH1 * fHistMatchEtaAll
!deta distribution
void GetEtaPhiDiff(const AliVTrack *t, const AliVCluster *v, Double_t &phidiff, Double_t &etadiff)
Int_t GetMomBin(Double_t p) const
void SetNameOfMCGeneratorsToAccept(Int_t ig, TString name)
AliEmcalCorrectionClusterTrackMatcher()
Container structure for EMCAL clusters.
TClonesArray * fEmcalTracks
!emcal tracks
Double_t fMaxDistance
maximum distance to match clusters and tracks
static RegisterCorrectionComponent< AliEmcalCorrectionClusterTrackMatcher > reg
AliEmcalContainerIndexMap< AliParticleContainer, AliVParticle > fParticleContainerIndexMap
! Mapping between index and particle containers
TClonesArray * fEmcalClusters
!emcal clusters
static const AliEmcalContainerIndexMap< TClonesArray, AliVParticle > & GetEmcalContainerIndexMap()
Get the EMCal container utils associated with particle containers.
bool GetProperty(std::string propertyName, T &property, bool requiredProperty=true, std::string correctionName="")
Retrieve property.