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),
38 fUseOuterParamInESDs(kFALSE),
40 fUpdateClusters(kTRUE),
41 fClusterContainerIndexMap(),
42 fParticleContainerIndexMap(),
50 fMCGenerToAcceptForTrack(1)
52 for(
Int_t icent=0; icent<8; ++icent) {
53 for(
Int_t ipt=0; ipt<9; ++ipt) {
54 for(
Int_t ieta=0; ieta<2; ++ieta) {
87 Bool_t enableFracEMCRecalc = kFALSE;
88 GetProperty(
"enableFracEMCRecalc", enableFracEMCRecalc);
89 Int_t removeNMCGenerators = 0;
90 GetProperty(
"removeNMCGenerators", removeNMCGenerators);
92 std::string removeMcGen1 =
"";
94 TString removeMCGen1 = removeMcGen1.c_str();
95 std::string removeMcGen2 =
"";
97 TString removeMCGen2 = removeMcGen2.c_str();
99 if(enableFracEMCRecalc){
100 if(removeNMCGenerators > 0)
102 printf(
"\t gen1 <%s>, gen2 <%s>, remove tracks %d\n",removeMCGen1.Data(),removeMCGen2.Data(),
fMCGenerToAcceptForTrack);
120 std::string particleContainerNames =
"";
121 bool firstLoop =
true;
124 while ((partCont = static_cast<AliParticleContainer*>(nextPartCont()))) {
125 if (firstLoop !=
true) {
126 particleContainerNames +=
"_";
131 particleContainerNames += partCont->GetArrayName();
134 std::string clusterContainerNames =
"";
138 while ((clusCont = static_cast<AliClusterContainer*>(nextClusCont()))) {
139 if (firstLoop !=
true) {
140 clusterContainerNames +=
"_";
145 clusterContainerNames += clusCont->GetArrayName();
149 fEmcalTracks->SetName(Form(
"EmcalTracks_%s", particleContainerNames.c_str()));
151 fEmcalClusters->SetName(Form(
"EmcalClusters_%s", clusterContainerNames.c_str()));
155 fHistMatchEtaAll =
new TH1F(
"fHistMatchEtaAll",
"fHistMatchEtaAll", 400, -0.2, 0.2);
156 fHistMatchPhiAll =
new TH1F(
"fHistMatchPhiAll",
"fHistMatchPhiAll", 400, -0.2, 0.2);
161 for(
Int_t icent=0; icent<nCentChBins; ++icent) {
162 for(
Int_t ipt=0; ipt<9; ++ipt) {
163 for(
Int_t ieta=0; ieta<2; ++ieta) {
164 TString nameEta(Form(
"fHistMatchEta_%i_%i_%i",icent,ipt,ieta));
165 fHistMatchEta[icent][ipt][ieta] =
new TH1F(nameEta, nameEta, 400, -0.2, 0.2);
167 TString namePhi(Form(
"fHistMatchPhi_%i_%i_%i",icent,ipt,ieta));
168 fHistMatchPhi[icent][ipt][ieta] =
new TH1F(namePhi, namePhi, 400, -0.2, 0.2);
214 else if (p>=0.5 && p<1.0)
216 else if (p>=1.0 && p<1.5)
218 else if (p>=1.5 && p<2.)
220 else if (p>=2. && p<3.)
222 else if (p>=3. && p<4.)
224 else if (p>=4. && p<5.)
226 else if (p>=5. && p<8.)
246 AliVCluster* cluster = 0;
247 AliVTrack* track = 0;
251 while ((clusCont = static_cast<AliClusterContainer*>(nextClusCont()))) {
254 cluster =
static_cast<AliVCluster *
>(clusIterator->second);
257 cluster->SetEmcCpvDistance(-1);
258 cluster->SetTrackDistance(1024, 1024);
259 AliAODCaloCluster *ac =
dynamic_cast<AliAODCaloCluster*
>(cluster);
260 AliESDCaloCluster *ec = 0;
262 const Int_t N = ac->GetNTracksMatched();
263 AliDebug(2, TString::Format(
"Number of matched tracks: %d", N));
264 for (
Int_t i = N - 1; i >= 0; i--) {
265 TObject *ptr = ac->GetTrackMatched(i);
266 ac->RemoveTrackMatched(ptr);
267 AliDebug(2, TString::Format(
"N tracks matched: %i of %i", ac->GetNTracksMatched(), N));
271 ec =
dynamic_cast<AliESDCaloCluster*
>(cluster);
272 TArrayI *arr = ec->GetTracksMatched();
273 if (arr) arr->Set(0);
297 while ((partCont = static_cast<AliParticleContainer*>(nextPartCont()))) {
300 track =
static_cast<AliVTrack *
>(partIterator->second);
303 track->ResetStatus(AliVTrack::kEMCALmatch);
304 track->SetEMCALcluster(-1);
307 Bool_t propthistrack = kFALSE;
309 propthistrack = kTRUE;
311 else if (!track->IsExtrapolatedToEMCAL()) {
313 propthistrack = kTRUE;
316 propthistrack = kTRUE;
322 Int_t mcLabel = TMath::Abs(track->GetLabel());
326 fMCEvent->GetCocktailGenerator(mcLabel,genName);
334 if ( !generOK )
continue;
348 track->SetUniqueID(0);
349 track->ResetBit(TObject::kHasUUID);
350 track->ResetBit(TObject::kIsReferenced);
356 AliDebug(2, Form(
"Now adding track %i (pT = %.3f, eta = %.3f, phi = %.3f)" 357 "Phi, Eta on EMCal = %.3f, %.3f",
359 track->GetTrackEtaOnEMCal(), track->GetTrackPhiOnEMCal()));
375 AliVTrack* track = emcalTrack->
GetTrack();
379 AliVCluster* cluster = emcalCluster->
GetCluster();
384 Double_t d2 = deta * deta + dphi * dphi;
386 if (d2 > maxd2)
continue;
391 AliDebug(2, Form(
"Now matching cluster E = %.3f, pT = %.3f, eta = %.3f, phi = %.3f " 392 "with track pT = %.3f, eta = %.3f, phi = %.3f" 393 "Track eta, phi on EMCal = %.3f, %.3f, d = %.3f",
394 cluster->GetNonLinCorrEnergy(), emcalCluster->
Pt(), emcalCluster->
Eta(), emcalCluster->
Phi(),
395 emcalTrack->
Pt(), emcalTrack->
Eta(), emcalTrack->
Phi(),
396 track->GetTrackEtaOnEMCal(), track->GetTrackPhiOnEMCal(), d));
401 if (track->Charge() < 0) centbinch +=
fNcentBins;
403 if(track->Eta() > 0) etabin = 1;
422 AliVCluster* cluster = emcalCluster->
GetCluster();
423 AliDebug(3, Form(
"Cluster E = %.2f, eta = %.2f, phi = %.2f, Nmatch = %d", cluster->GetNonLinCorrEnergy(), emcalCluster->
Eta(), emcalCluster->
Phi(), N));
425 if (N <= 0)
continue;
430 AliVTrack* trackFirstMatch = emcalTrackFirstMatch->
GetTrack();
434 cluster->SetTrackDistance(dphi, deta);
437 AliAODCaloCluster *ac =
dynamic_cast<AliAODCaloCluster*
>(cluster);
438 AliESDCaloCluster *ec = 0;
439 if (!ac) ec =
dynamic_cast<AliESDCaloCluster*
>(cluster);
443 for (
Int_t i=0; i < N; ++i) {
447 AliDebug(3, Form(
"Pt = %.2f, eta = %.2f, phi = %.2f", emcalTrack->
Pt(), emcalTrack->
Eta(), emcalTrack->
Phi()));
450 ac->AddTrackMatched(obj);
455 for (
Int_t i = 0; i < N; ++i) {
460 ec->AddTracksMatched(arr);
477 AliVTrack* track = emcalTrack->
GetTrack();
479 track->SetStatus(AliVTrack::kEMCALmatch);
494 AliWarning(Form(
"%s - AliAnalysisTaskEmcal::IsTrackInEmcalAcceptance - Geometry is not available!", GetName()));
501 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
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
Bool_t fUseOuterParamInESDs
Use TPC outer parameters instead of inner parameters for track propagation, ESDs only.
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.