AliPhysics  8bb951a (8bb951a)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliJetContainer.cxx
Go to the documentation of this file.
1 //
2 // Container with name, TClonesArray and cuts for jets
3 //
4 // Author: M. Verweij, S. Aiola
5 
6 #include <TClonesArray.h>
7 
8 #include "AliVEvent.h"
9 #include "AliLog.h"
10 #include "AliEMCALGeometry.h"
11 #include "AliParticleContainer.h"
12 #include "AliClusterContainer.h"
13 #include "AliLocalRhoParameter.h"
14 #include "AliTLorentzVector.h"
15 
16 #include "AliJetContainer.h"
17 
19 
20 //________________________________________________________________________
23  fJetAcceptanceType(kUser),
24  fJetRadius(0),
25  fRhoName(),
26  fLocalRhoName(),
27  fRhoMassName(),
28  fFlavourSelection(0),
29  fJetAreaCut(-1),
30  fAreaEmcCut(-1),
31  fMinClusterPt(-1),
32  fMaxClusterPt(1000),
33  fMinTrackPt(-1),
34  fMaxTrackPt(100),
35  fZLeadingEmcCut(10.),
36  fZLeadingChCut(10.),
37  fNEFMinCut(-10.),
38  fNEFMaxCut(10.),
39  fLeadingHadronType(0),
40  fNLeadingJets(1),
41  fMinNConstituents(-1),
42  fJetTrigger(0),
43  fTagStatus(-1),
44  fParticleContainer(0),
45  fClusterContainer(0),
46  fRho(0),
47  fLocalRho(0),
48  fRhoMass(0),
49  fGeom(0),
50  fRunNumber(0)
51 {
52  // Default constructor.
53 
54  fBaseClassName = "AliEmcalJet";
55  SetClassName("AliEmcalJet");
56 }
57 
58 //________________________________________________________________________
61  fJetAcceptanceType(kUser),
62  fJetRadius(0),
63  fRhoName(),
64  fLocalRhoName(),
65  fRhoMassName(),
66  fFlavourSelection(0),
67  fJetAreaCut(-1),
68  fAreaEmcCut(-1),
69  fMinClusterPt(-1),
70  fMaxClusterPt(1000),
71  fMinTrackPt(-1),
72  fMaxTrackPt(100),
73  fZLeadingEmcCut(10.),
74  fZLeadingChCut(10.),
75  fNEFMinCut(-10.),
76  fNEFMaxCut(10.),
77  fLeadingHadronType(0),
78  fNLeadingJets(1),
79  fMinNConstituents(-1),
80  fJetTrigger(0),
81  fTagStatus(-1),
82  fParticleContainer(0),
83  fClusterContainer(0),
84  fRho(0),
85  fLocalRho(0),
86  fRhoMass(0),
87  fGeom(0),
88  fRunNumber(0)
89 {
90  // Standard constructor.
91 
92  fBaseClassName = "AliEmcalJet";
93  SetClassName("AliEmcalJet");
94  SetMinPt(1);
95 }
96 
97 //________________________________________________________________________
98 AliJetContainer::AliJetContainer(EJetType_t jetType, EJetAlgo_t jetAlgo, ERecoScheme_t recoScheme, Double_t radius,
99  AliParticleContainer* partCont, AliClusterContainer* clusCont, TString tag):
100  AliParticleContainer(GenerateJetName(jetType, jetAlgo, recoScheme, radius, partCont, clusCont, tag)),
101  fJetAcceptanceType(kUser),
102  fJetRadius(radius),
103  fRhoName(),
104  fLocalRhoName(),
105  fRhoMassName(),
106  fFlavourSelection(0),
107  fJetAreaCut(-1),
108  fAreaEmcCut(-1),
109  fMinClusterPt(-1),
110  fMaxClusterPt(1000),
111  fMinTrackPt(-1),
112  fMaxTrackPt(100),
113  fZLeadingEmcCut(10.),
114  fZLeadingChCut(10.),
115  fNEFMinCut(-10.),
116  fNEFMaxCut(10.),
117  fLeadingHadronType(0),
118  fNLeadingJets(1),
119  fMinNConstituents(-1),
120  fJetTrigger(0),
121  fTagStatus(-1),
122  fParticleContainer(partCont),
123  fClusterContainer(clusCont),
124  fRho(0),
125  fLocalRho(0),
126  fRhoMass(0),
127  fGeom(0),
128  fRunNumber(0)
129 {
130  // Constructor.
131 
132  fBaseClassName = "AliEmcalJet";
133  SetClassName("AliEmcalJet");
134  SetMinPt(1);
135 }
136 
137 //________________________________________________________________________
138 void AliJetContainer::SetArray(AliVEvent *event)
139 {
140  // Set jet array
141 
143 
145 }
146 
147 //________________________________________________________________________
149 {
150  // Set acceptance
151 
152  switch (fJetAcceptanceType) {
153  case kTPC:
154  AliDebug(2,Form("%s: set TPC acceptance cuts",GetName()));
155  SetJetEtaPhiTPC();
156  break;
157  case kTPCfid:
158  AliDebug(2,Form("%s: set TPC acceptance cuts",GetName()));
160  break;
161  case kEMCAL:
162  AliDebug(2,Form("%s: set EMCAL acceptance cuts",GetName()));
164  case kEMCALfid:
165  AliDebug(2,Form("%s: set EMCAL acceptance cuts",GetName()));
167  break;
168  case kDCALfid:
169  AliDebug(2,Form("%s: set EMCAL acceptance cuts",GetName()));
171  break;
172  case kDCAL:
173  AliDebug(2,Form("%s: set EMCAL acceptance cuts",GetName()));
175  break;
176  case kUser:
177  break;
178  }
179 }
180 
181 
182 //________________________________________________________________________
184 {
185  fGeom = AliEMCALGeometry::GetInstance();
186  if (!fGeom) {
187  AliError(Form("%s: Can not create geometry", GetName()));
188  return;
189  }
190 }
191 
192 //________________________________________________________________________
193 void AliJetContainer::LoadRho(AliVEvent *event)
194 {
195  // Load rho
196 
197  if (!fRhoName.IsNull() && !fRho) {
198  fRho = dynamic_cast<AliRhoParameter*>(event->FindListObject(fRhoName));
199  if (!fRho) {
200  AliError(Form("%s: Could not retrieve rho %s!", GetName(), fRhoName.Data()));
201  return;
202  }
203  }
204 }
205 
206 //________________________________________________________________________
207 void AliJetContainer::LoadLocalRho(AliVEvent *event)
208 {
209  // Load local rho
210 
211  if (!fLocalRhoName.IsNull() && !fLocalRho) {
212  fLocalRho = dynamic_cast<AliLocalRhoParameter*>(event->FindListObject(fLocalRhoName));
213  if (!fLocalRho) {
214  AliError(Form("%s: Could not retrieve rho %s!", GetName(), fLocalRhoName.Data()));
215  return;
216  }
217  }
218 }
219 
220 //________________________________________________________________________
221 void AliJetContainer::LoadRhoMass(AliVEvent *event)
222 {
223  // Load rho
224 
225  if (!fRhoMassName.IsNull() && !fRhoMass) {
226  fRhoMass = dynamic_cast<AliRhoParameter*>(event->FindListObject(fRhoMassName));
227  if (!fRhoMass) {
228  AliError(Form("%s: Could not retrieve rho_mass %s!", GetName(), fRhoMassName.Data()));
229  return;
230  }
231  }
232 }
233 
234 //________________________________________________________________________
236 {
237  // Get the leading jet; if opt contains "rho" the sorting is according to pt-A*rho
238 
239  TString option(opt);
240  option.ToLower();
241 
242  Int_t tempID = fCurrentID;
243  ResetCurrentID();
244 
245  AliEmcalJet *jetMax = GetNextAcceptJet();
246  AliEmcalJet *jet = 0;
247 
248  if (option.Contains("rho")) {
249  while ((jet = GetNextAcceptJet())) {
250  if ( (jet->Pt()-jet->Area()*GetRhoVal()) > (jetMax->Pt()-jetMax->Area()*GetRhoVal()) )
251  jetMax = jet;
252  }
253  }
254  else {
255  while ((jet = GetNextAcceptJet())) {
256  if (jet->Pt() > jetMax->Pt()) jetMax = jet;
257  }
258  }
259 
260  fCurrentID = tempID;
261 
262  return jetMax;
263 }
264 
265 //________________________________________________________________________
267 
268  //Get i^th jet in array
269 
270  if(i<0 || i>fClArray->GetEntriesFast()) return 0;
271  AliEmcalJet *jet = static_cast<AliEmcalJet*>(fClArray->At(i));
272  return jet;
273 
274 }
275 
276 //________________________________________________________________________
278 
279  //Only return jet if is accepted
280 
281  UInt_t rejectionReason = 0;
282  AliEmcalJet *jet = GetJet(i);
283  if(!AcceptJet(jet, rejectionReason)) return 0;
284 
285  return jet;
286 }
287 
288 //________________________________________________________________________
290 
291  //Get particle with label lab in array
292 
293  Int_t i = GetIndexFromLabel(lab);
294  return GetJet(i);
295 }
296 
297 //________________________________________________________________________
299 
300  //Get particle with label lab in array
301 
302  Int_t i = GetIndexFromLabel(lab);
303  return GetAcceptJet(i);
304 }
305 
306 //________________________________________________________________________
308 
309  //Get next accepted jet;
310 
311  const Int_t njets = GetNEntries();
312  AliEmcalJet *jet = 0;
313  do {
314  fCurrentID++;
315  if (fCurrentID >= njets) break;
316  jet = GetAcceptJet(fCurrentID);
317  } while (!jet);
318 
319  return jet;
320 }
321 
322 //________________________________________________________________________
324 
325  //Get next jet;
326 
327  const Int_t njets = GetNEntries();
328  AliEmcalJet *jet = 0;
329  do {
330  fCurrentID++;
331  if (fCurrentID >= njets) break;
332  jet = GetJet(fCurrentID);
333  } while (!jet);
334 
335 
336  return jet;
337 }
338 
339 //________________________________________________________________________
340 Double_t AliJetContainer::GetJetPtCorr(Int_t i) const {
341  AliEmcalJet *jet = GetJet(i);
342 
343  return jet->Pt() - fRho->GetVal()*jet->Area();
344 }
345 
346 //________________________________________________________________________
347 Double_t AliJetContainer::GetJetPtCorrLocal(Int_t i) const {
348  AliEmcalJet *jet = GetJet(i);
349 
350  return jet->Pt() - fLocalRho->GetLocalVal(jet->Phi(), fJetRadius)*jet->Area();
351 }
352 
353 //________________________________________________________________________
354 Bool_t AliJetContainer::GetMomentumFromJet(TLorentzVector &mom, const AliEmcalJet* jet, Double_t mass) const
355 {
356  Double_t p = jet->P();
357  Double_t e = TMath::Sqrt(mass*mass + p*p);
358 
359  mom.SetPtEtaPhiE(jet->Pt(), jet->Eta(), jet->Phi(), e);
360 
361  return kTRUE;
362 }
363 
364 //________________________________________________________________________
365 Bool_t AliJetContainer::GetMomentumFromJet(TLorentzVector &mom, const AliEmcalJet* jet) const
366 {
367  if (jet) {
368  if (fMassHypothesis >= 0) {
370  }
371  else {
372  jet->GetMomentum(mom);
373  }
374  return kTRUE;
375  }
376  else {
377  mom.SetPtEtaPhiM(0, 0, 0, 0);
378  return kFALSE;
379  }
380 }
381 
382 //________________________________________________________________________
383 Bool_t AliJetContainer::GetMomentum(TLorentzVector &mom, Int_t i) const
384 {
385  //Get momentum of the i^th particle in array
386 
387  AliEmcalJet *jet = GetJet(i);
388  return GetMomentumFromJet(mom, jet);
389 }
390 
391 //________________________________________________________________________
392 Bool_t AliJetContainer::GetNextMomentum(TLorentzVector &mom)
393 {
394  //Get momentum of the next jet in array
395 
396  AliEmcalJet *jet = GetNextJet();
397  return GetMomentumFromJet(mom, jet);
398 }
399 
400 //________________________________________________________________________
401 Bool_t AliJetContainer::GetAcceptMomentum(TLorentzVector &mom, Int_t i) const
402 {
403  //Get momentum of the i^th jet in array
404 
405  AliEmcalJet *jet = GetAcceptJet(i);
406  return GetMomentumFromJet(mom, jet);
407 }
408 
409 //________________________________________________________________________
410 Bool_t AliJetContainer::GetNextAcceptMomentum(TLorentzVector &mom)
411 {
412  //Get momentum of the next accepted jet in array
413 
414  AliEmcalJet *jet = GetNextAcceptJet();
415  return GetMomentumFromJet(mom, jet);
416 }
417 
418 //________________________________________________________________________
419 Bool_t AliJetContainer::AcceptJet(const AliEmcalJet *jet, UInt_t &rejectionReason) const
420 {
421  // Return true if jet is accepted.
422 
423  Bool_t r = ApplyJetCuts(jet, rejectionReason);
424  if (!r) return kFALSE;
425 
426  AliTLorentzVector mom;
427  GetMomentumFromJet(mom, jet);
428 
429  return ApplyKinematicCuts(mom, rejectionReason);
430 }
431 
432 //________________________________________________________________________
433 Bool_t AliJetContainer::AcceptJet(Int_t i, UInt_t &rejectionReason) const
434 {
435  // Return true if jet is accepted.
436 
437  Bool_t r = ApplyJetCuts(GetJet(i), rejectionReason);
438  if (!r) return kFALSE;
439 
440  AliTLorentzVector mom;
441  GetMomentum(mom, i);
442 
443  return ApplyKinematicCuts(mom, rejectionReason);
444 }
445 
446 
447 //________________________________________________________________________
448 Bool_t AliJetContainer::ApplyJetCuts(const AliEmcalJet *jet, UInt_t &rejectionReason) const
449 {
450  // Return true if jet is accepted.
451 
452  if (!jet) {
453  AliDebug(11,"No jet found");
454  rejectionReason |= kNullObject;
455  return kFALSE;
456  }
457 
458  if (jet->TestBits(fBitMap) != (Int_t)fBitMap) {
459  AliDebug(11,"Cut rejecting jet: Bit map");
460  rejectionReason |= kBitMapCut;
461  return kFALSE;
462  }
463 
464  if (jet->Area() <= fJetAreaCut) {
465  AliDebug(11,"Cut rejecting jet: Area");
466  rejectionReason |= kAreaCut;
467  return kFALSE;
468  }
469 
470  if (jet->AreaEmc() < fAreaEmcCut) {
471  AliDebug(11,"Cut rejecting jet: AreaEmc");
472  rejectionReason |= kAreaEmcCut;
473  return kFALSE;
474  }
475 
477  AliDebug(11,"Cut rejecting jet: ZLeading");
478  rejectionReason |= kZLeadingChCut;
479  return kFALSE;
480  }
481 
482  if (fZLeadingEmcCut < 1 && GetZLeadingEmc(jet) > fZLeadingEmcCut) {
483  AliDebug(11,"Cut rejecting jet: ZLeadEmc");
484  rejectionReason |= kZLeadingEmcCut;
485  return kFALSE;
486  }
487 
488  if (jet->NEF() < fNEFMinCut || jet->NEF() > fNEFMaxCut) {
489  AliDebug(11,"Cut rejecting jet: NEF");
490  rejectionReason |= kNEFCut;
491  return kFALSE;
492  }
493 
495  AliDebug(11,"Cut rejecting jet: minimum number of constituents");
496  rejectionReason |= kMinNConstituents;
497  return kFALSE;
498  }
499 
500  if (fLeadingHadronType == 0) {
501  if (jet->MaxTrackPt() < fMinTrackPt) {
502  AliDebug(11,"Cut rejecting jet: Bias");
503  rejectionReason |= kMinLeadPtCut;
504  return kFALSE;
505  }
506  }
507  else if (fLeadingHadronType == 1) {
508  if (jet->MaxClusterPt() < fMinClusterPt) {
509  AliDebug(11,"Cut rejecting jet: Bias");
510  rejectionReason |= kMinLeadPtCut;
511  return kFALSE;
512  }
513  }
514  else {
515  if (jet->MaxTrackPt() < fMinTrackPt && jet->MaxClusterPt() < fMinClusterPt) {
516  AliDebug(11,"Cut rejecting jet: Bias");
517  rejectionReason |= kMinLeadPtCut;
518  return kFALSE;
519  }
520  }
521 
522  if (jet->MaxTrackPt() > fMaxTrackPt) {
523  AliDebug(11,"Cut rejecting jet: MaxTrackPt");
524  rejectionReason |= kMaxTrackPtCut;
525  return kFALSE;
526 
527  }
528 
529  if (jet->MaxClusterPt() > fMaxClusterPt) {
530  AliDebug(11,"Cut rejecting jet: MaxClusPt");
531  rejectionReason |= kMaxClusterPtCut;
532  return kFALSE;
533  }
534 
536  AliDebug(11,"Cut rejecting jet: Flavour");
537  rejectionReason |= kFlavourCut;
538  return kFALSE;
539  }
540 
541  if (fTagStatus>-1 && jet->GetTagStatus()!=fTagStatus) {
542  AliDebug(11,"Cut rejecting jet: tag status");
543  rejectionReason |= kTagStatus;
544  return kFALSE;
545  }
546 
547  return kTRUE;
548 }
549 
550 //________________________________________________________________________
552 {
553  if (fLeadingHadronType == 0) // charged leading hadron
554  return jet->MaxTrackPt();
555  else if (fLeadingHadronType == 1) // neutral leading hadron
556  return jet->MaxClusterPt();
557  else // charged or neutral
558  return jet->MaxPartPt();
559 }
560 
561 //________________________________________________________________________
562 void AliJetContainer::GetLeadingHadronMomentum(TLorentzVector &mom, const AliEmcalJet *jet) const
563 {
564  Double_t maxClusterPt = 0;
565  Double_t maxClusterEta = 0;
566  Double_t maxClusterPhi = 0;
567 
568  Double_t maxTrackPt = 0;
569  Double_t maxTrackEta = 0;
570  Double_t maxTrackPhi = 0;
571 
573  AliVCluster *cluster = jet->GetLeadingCluster(fClusterContainer->GetArray());
574  if (cluster) {
575  TLorentzVector nPart;
576  cluster->GetMomentum(nPart, const_cast<Double_t*>(fVertex));
577 
578  maxClusterEta = nPart.Eta();
579  maxClusterPhi = nPart.Phi();
580  maxClusterPt = nPart.Pt();
581  }
582  }
583 
585  AliVParticle *track = jet->GetLeadingTrack(fParticleContainer->GetArray());
586  if (track) {
587  maxTrackEta = track->Eta();
588  maxTrackPhi = track->Phi();
589  maxTrackPt = track->Pt();
590  }
591  }
592 
593  if (maxTrackPt > maxClusterPt)
594  mom.SetPtEtaPhiM(maxTrackPt,maxTrackEta,maxTrackPhi,0.139);
595  else
596  mom.SetPtEtaPhiM(maxClusterPt,maxClusterEta,maxClusterPhi,0.139);
597 }
598 
599 //________________________________________________________________________
601 {
602 
604  TLorentzVector mom;
605 
606  AliVCluster *cluster = jet->GetLeadingCluster(fClusterContainer->GetArray());
607  if (cluster) {
608  cluster->GetMomentum(mom, const_cast<Double_t*>(fVertex));
609 
610  return GetZ(jet,mom);
611  }
612  else
613  return -1;
614  }
615  else
616  return -1;
617 }
618 
619 //________________________________________________________________________
621 {
622 
624  TLorentzVector mom;
625 
626  AliVParticle *track = jet->GetLeadingTrack(fParticleContainer->GetArray());
627  if (track) {
628  mom.SetPtEtaPhiM(track->Pt(),track->Eta(),track->Phi(),0.139);
629 
630  return GetZ(jet,mom);
631  }
632  else
633  return -1;
634  }
635  else
636  return -1;
637 }
638 
639 //________________________________________________________________________
640 Double_t AliJetContainer::GetZ(const AliEmcalJet *jet, TLorentzVector mom) const
641 {
642  Double_t pJetSq = jet->Px()*jet->Px() + jet->Py()*jet->Py() + jet->Pz()*jet->Pz();
643 
644  if (pJetSq < 1e-6) {
645  AliWarning(Form("%s: strange, pjet*pjet seems to be zero pJetSq: %.3f",GetName(), pJetSq));
646  return 0;
647  }
648 
649  Double_t z = (mom.Px()*jet->Px() + mom.Py()*jet->Py() + mom.Pz()*jet->Pz()) / pJetSq;
650 
651  if (z < 0) {
652  AliWarning(Form("%s: z = %.3ff < 0, returning 0...",GetName(), z));
653  z = 0;
654  }
655 
656  return z;
657 }
658 
659 //________________________________________________________________________
661 {
662  //Set default cuts for full jets in EMCal
663 
664  if (!fGeom) SetEMCALGeometry();
665  if (fGeom) {
666  SetEtaLimits(fGeom->GetArm1EtaMin() + r, fGeom->GetArm1EtaMax() - r);
667 
668  if(fRunNumber>=177295 && fRunNumber<=197470) {//small SM masked in 2012 and 2013
669  SetPhiLimits(1.405 + r,3.135 - r);
670  }
671  else {
672  SetPhiLimits(fGeom->GetArm1PhiMin() * TMath::DegToRad() + r, fGeom->GetEMCALPhiMax() * TMath::DegToRad() - r);
673  }
674  }
675  else {
676  AliWarning("Could not get instance of AliEMCALGeometry. Using manual settings for EMCAL year 2011!!");
677  SetEtaLimits(-0.7 + r, 0.7 - r);
678  SetPhiLimits(1.405 + r, 3.135 - r);
679  }
680 }
681 
682 //________________________________________________________________________
684 {
685  //Set default cuts for full jets in DCal
686 
687  if (!fGeom) SetEMCALGeometry();
688  if (fGeom) {
689  SetEtaLimits(fGeom->GetArm1EtaMin() + r, fGeom->GetArm1EtaMax() - r);
690  SetPhiLimits(fGeom->GetDCALPhiMin() * TMath::DegToRad() + r, fGeom->GetDCALPhiMax() * TMath::DegToRad() - r);
691  }
692  else {
693  AliWarning("Could not get instance of AliEMCALGeometry. Using manual settings for DCAL year 2015!!");
694  SetEtaLimits(-0.7 + r, 0.7 - r);
695  SetPhiLimits(4.538 + r, 5.727 - r);
696  }
697 }
698 
699 //________________________________________________________________________
701 {
702  //Set default cuts for charged jets
703 
704  SetEtaLimits(-0.9 + r, 0.9 - r);
705  SetPhiLimits(0, 0); // No cut on phi
706 }
707 
708 //________________________________________________________________________
710 {
711  // Reset cuts to default values
712  TString arrName = GetArrayName();
713  Printf("Print jet cuts for %s",arrName.Data());
714  Printf("PtBiasJetTrack: %f",fMinTrackPt);
715  Printf("PtBiasJetClus: %f",fMinClusterPt);
716  Printf("JetPtCut: %f", fMinPt);
717  Printf("JetPtCutMax: %f", fMaxPt);
718  Printf("JetAreaCut: %f",fJetAreaCut);
719  Printf("AreaEmcCut: %f",fAreaEmcCut);
720  Printf("JetMinEta: %f", fMinEta);
721  Printf("JetMaxEta: %f", fMaxEta);
722  Printf("JetMinPhi: %f", fMinPhi);
723  Printf("JetMaxPhi: %f", fMaxPhi);
724  Printf("MaxClusterPt: %f",fMaxClusterPt);
725  Printf("MaxTrackPt: %f",fMaxTrackPt);
726  Printf("LeadingHadronType: %d",fLeadingHadronType);
727  Printf("ZLeadingEmcCut: %f",fZLeadingEmcCut);
728  Printf("ZLeadingChCut: %f",fZLeadingChCut);
729 
730 }
731 
732 //________________________________________________________________________
734 {
735  // Reset cuts to default values
736 
737  fMinTrackPt = 0;
738  fMinClusterPt = 0;
739  fMinPt = 0;
740  fJetAreaCut = -1;
741  fAreaEmcCut = -1;
742  fMinEta = -0.9;
743  fMaxEta = 0.9;
744  fMinPhi = 0;
745  fMaxPhi = 10;
746  fMaxClusterPt = 1000;
747  fMaxTrackPt = 100;
748  fLeadingHadronType = 0;
749  fZLeadingEmcCut = 10.;
750  fZLeadingChCut = 10.;
751 }
752 
753 //________________________________________________________________________
755 {
756  // Get number of accepted jets
757 
758  Int_t nJet = 0;
759  Int_t tempID = fCurrentID;
760  ResetCurrentID();
761 
762  AliEmcalJet *jet = GetNextAcceptJet();
763  if(jet) nJet = 1;
764  while (GetNextAcceptJet())
765  nJet++;
766 
767  fCurrentID = tempID;
768 
769  return nJet;
770 }
771 
772 //________________________________________________________________________
774 {
775  //
776  // Get fraction of shared pT between matched jets
777  // Uses ClosestJet() jet pT as baseline: fraction = \Sum_{const,jet1} pT,const,i / pT,jet,closest
778  // Only works if tracks array of both jets is the same -> modifying this. if no container is given than is like this, otherwise the geomerical matching is applied
779  //
780 
781  AliEmcalJet *jet2 = jet1->ClosestJet();
782  if(!jet2) return -1;
783 
784  Double_t fraction = 0.;
785  Double_t jetPt2 = jet2->Pt();
786  Int_t bgeom = kTRUE;
787  if(!cont2) bgeom = kFALSE;
788  if(jetPt2>0) {
789  Double_t sumPt = 0.;
790  AliVParticle *vpf = 0x0;
791  Int_t iFound = 0;
792  for(Int_t icc=0; icc<jet2->GetNumberOfTracks(); icc++) {
793  Int_t idx = (Int_t)jet2->TrackAt(icc);
794  //get particle
795  AliVParticle *p2 = 0x0;
796  if(bgeom) p2 = static_cast<AliVParticle*>(jet2->TrackAt(icc, cont2->GetArray()));
797  iFound = 0;
798  for(Int_t icf=0; icf<jet1->GetNumberOfTracks(); icf++) {
799  if(!bgeom && idx == jet1->TrackAt(icf) && iFound==0 ) {
800  iFound=1;
801  vpf = static_cast<AliVParticle*>(jet1->TrackAt(icf, fParticleContainer->GetArray()));
802  if(vpf) sumPt += vpf->Pt();
803  continue;
804  }
805  if(bgeom){
806  vpf = static_cast<AliVParticle*>(jet1->TrackAt(icf, fParticleContainer->GetArray()));
807  if(!vpf) continue;
808  if(!SamePart(vpf, p2, 1.e-4)) continue; //not the same particle
809  sumPt += vpf->Pt();
810  }
811  }
812  }
813  fraction = sumPt/jetPt2;
814  } else
815  fraction = -1;
816  return fraction;
817 }
818 
819 //________________________________________________________________________
820 TString AliJetContainer::GenerateJetName(EJetType_t jetType, EJetAlgo_t jetAlgo, ERecoScheme_t recoScheme, Double_t radius, AliParticleContainer* partCont, AliClusterContainer* clusCont, TString tag)
821 {
822  TString algoString;
823  switch (jetAlgo)
824  {
825  case kt_algorithm:
826  algoString = "KT";
827  break;
828  case antikt_algorithm:
829  algoString = "AKT";
830  break;
831  default:
832  ::Warning("AliJetContainer::GenerateJetName", "Unknown jet finding algorithm '%d'!", jetAlgo);
833  algoString = "";
834  }
835 
836  TString typeString;
837  switch (jetType) {
838  case kFullJet:
839  typeString = "Full";
840  break;
841  case kChargedJet:
842  typeString = "Charged";
843  break;
844  case kNeutralJet:
845  typeString = "Neutral";
846  break;
847  }
848 
849  TString radiusString = TString::Format("R%03.0f", radius*100.0);
850 
851  TString trackString;
852  if (jetType != kNeutralJet && partCont) {
853  trackString = "_" + TString(partCont->GetTitle());
854  }
855 
856  TString clusterString;
857  if (jetType != kChargedJet && clusCont) {
858  clusterString = "_" + TString(clusCont->GetTitle());
859  }
860 
861  TString recombSchemeString;
862  switch (recoScheme) {
863  case E_scheme:
864  recombSchemeString = "E_scheme";
865  break;
866  case pt_scheme:
867  recombSchemeString = "pt_scheme";
868  break;
869  case pt2_scheme:
870  recombSchemeString = "pt2_scheme";
871  break;
872  case Et_scheme:
873  recombSchemeString = "Et_scheme";
874  break;
875  case Et2_scheme:
876  recombSchemeString = "Et2_scheme";
877  break;
878  case BIpt_scheme:
879  recombSchemeString = "BIpt_scheme";
880  break;
881  case BIpt2_scheme:
882  recombSchemeString = "BIpt2_scheme";
883  break;
884  case external_scheme:
885  recombSchemeString = "ext_scheme";
886  break;
887  default:
888  ::Error("AliJetContainer::GenerateJetName", "Recombination %d scheme not recognized.", recoScheme);
889  }
890 
891  TString name = TString::Format("%s_%s%s%s%s%s_%s",
892  tag.Data(), algoString.Data(), typeString.Data(), radiusString.Data(), trackString.Data(), clusterString.Data(), recombSchemeString.Data());
893 
894  return name;
895 }
896 
897 //________________________________________________________________________
898 const char* AliJetContainer::GetTitle() const
899 {
900  static TString jetString;
901 
902  if (GetMinPt() == 0) {
903  jetString = TString::Format("_%s_pT0000", GetArrayName().Data());
904  }
905  else if (GetMinPt() < 1.0) {
906  jetString = TString::Format("_%s_pT0%3.0f", GetArrayName().Data(), GetMinPt()*1000.0);
907  }
908  else {
909  jetString = TString::Format("_%s_pT%4.0f", GetArrayName().Data(), GetMinPt()*1000.0);
910  }
911 
912  return jetString.Data();
913 }
Double_t AreaEmc() const
Definition: AliEmcalJet.h:74
Double_t Area() const
Definition: AliEmcalJet.h:69
const char * GetTitle() const
void SetArray(AliVEvent *event)
Float_t fMinTrackPt
maximum cluster constituent pt to accept the jet
Double_t GetZ(const AliEmcalJet *jet, TLorentzVector mom) const
Float_t fJetAreaCut
selection on jet flavour
Double_t GetRhoVal() const
Float_t fJetRadius
acceptance type
Double_t fMinPhi
Min. cut on particle .
AliEmcalJet * ClosestJet() const
Definition: AliEmcalJet.h:158
Cut on the z of the leading particle in the EMCAL.
AliRhoParameter * fRhoMass
! event rho mass for these jets
Int_t GetTagStatus() const
Definition: AliEmcalJet.h:168
virtual Bool_t ApplyJetCuts(const AliEmcalJet *clus, UInt_t &rejectionReason) const
Double_t Eta() const
Definition: AliEmcalJet.h:60
const char * GetTitle() const
Int_t GetIndexFromLabel(Int_t lab) const
Cut on the jet area in the EMCAL.
void LoadRhoMass(AliVEvent *event)
AliRhoParameter * fRho
cluster container (jet constituents)
Double_t Py() const
Definition: AliEmcalJet.h:45
JetAcceptanceType fJetAcceptanceType
Double_t Phi() const
Definition: AliEmcalJet.h:55
Double_t mass
Double_t GetLocalVal(Double_t phi, Double_t r, Double_t n) const
UInt_t fBitMap
bitmap mask
Float_t fNEFMinCut
maximum z,leading charged
void SetMinPt(Double_t min)
Double_t GetJetPtCorrLocal(Int_t i) const
virtual void SetArray(AliVEvent *event)
virtual Bool_t AcceptJet(Int_t i, UInt_t &rejectionReason) const
void LoadLocalRho(AliVEvent *event)
Double_t fMinPt
Min. cut on particle .
AliParticleContainer * fParticleContainer
jet tag status
void SetEtaLimits(Double_t min, Double_t max)
AliEmcalJet * GetAcceptJetWithLabel(Int_t lab) const
Bool_t GetMomentum(TLorentzVector &mom, Int_t i) const
static TString GenerateJetName(EJetType_t jetType, EJetAlgo_t jetAlgo, ERecoScheme_t recoScheme, Double_t radius, AliParticleContainer *partCont, AliClusterContainer *clusCont, TString tag)
UShort_t GetNumberOfConstituents() const
Definition: AliEmcalJet.h:84
Container for particles within the EMCAL framework.
Cut on flavour content in the jet.
UShort_t GetNumberOfTracks() const
Definition: AliEmcalJet.h:83
AliLocalRhoParameter * fLocalRho
! event local rho for these jets
Double_t Px() const
Definition: AliEmcalJet.h:44
Float_t fAreaEmcCut
cut on jet area
void GetMomentum(TLorentzVector &vec) const
Int_t fLeadingHadronType
maximum NEF in a jet
AliEmcalJet * GetLeadingJet(const char *opt="")
void GetLeadingHadronMomentum(TLorentzVector &mom, const AliEmcalJet *jet) const
Bool_t GetAcceptMomentum(TLorentzVector &mom, Int_t i) const
Int_t fRunNumber
! run number
AliVParticle * GetLeadingTrack(TClonesArray *tracks) const
Double_t GetLeadingHadronPt(const AliEmcalJet *jet) const
void LoadRho(AliVEvent *event)
Double_t GetMinPt() const
Float_t fMaxClusterPt
maximum cluster constituent pt to accept the jet
Bool_t GetNextAcceptMomentum(TLorentzVector &mom)
Cut on the jet area.
const char * GetTitle() const
Double_t fMaxPhi
Max. cut on particle .
Cut on the z of the leading charged constituent.
AliEmcalJet * GetJetWithLabel(Int_t lab) const
Float_t fMinClusterPt
minimum cut on jet emcal area
Double_t MaxTrackPt() const
Definition: AliEmcalJet.h:99
AliVCluster * GetLeadingCluster(TClonesArray *clusters) const
TClonesArray * GetArray() const
TString fLocalRhoName
Name of rho object.
Float_t fZLeadingChCut
maximum z,leading neutral
void SetClassName(const char *clname)
AliEmcalJet * GetNextAcceptJet()
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
void SetJetEtaPhiDCAL(Double_t r=0.)
Double_t Pt() const
Definition: AliEmcalJet.h:47
const TString & GetArrayName() const
Double_t fMassHypothesis
if < 0 it will use a PID mass when available
Cut on jet tag status.
Double_t fVertex[3]
! event vertex array
AliEmcalJet * GetNextJet()
const char * GetName() const
Double_t fMaxPt
Max. cut on particle .
AliEMCALGeometry * fGeom
! emcal geometry
Double_t P() const
Definition: AliEmcalJet.h:48
TString fRhoMassName
Name of local rho object.
Cut on the minimum of the leading particle.
Double_t GetZLeadingCharged(const AliEmcalJet *jet) const
Cut on the neutral energy fraction.
static Bool_t SamePart(const AliVParticle *part1, const AliVParticle *part2, Double_t dist=1.e-4)
Short_t TrackAt(Int_t idx) const
Definition: AliEmcalJet.h:107
Double_t fMinEta
Min. cut on particle .
Bool_t TestFlavourTag(Int_t tag) const
Definition: AliEmcalJet.h:262
Int_t fTagStatus
jet trigger
Float_t fZLeadingEmcCut
maximum track constituent pt to accept the jet
AliEmcalJet * GetAcceptJet(Int_t i) const
TString fBaseClassName
name of the base class that this container can handle
Cut on the minimum number of constituents.
Double_t MaxClusterPt() const
Definition: AliEmcalJet.h:98
Double_t GetZLeadingEmc(const AliEmcalJet *jet) const
Double_t Pz() const
Definition: AliEmcalJet.h:46
Float_t fMaxTrackPt
maximum track constituent pt to accept the jet
void SetJetEtaPhiTPC(Double_t r=0.)
Double_t GetFractionSharedPt(const AliEmcalJet *jet, AliParticleContainer *cont2=0x0) const
Double_t fMaxEta
Max. cut on particle .
void SetJetEtaPhiEMCAL(Double_t r=0.)
virtual Bool_t ApplyKinematicCuts(const AliTLorentzVector &mom, UInt_t &rejectionReason) const
Cut on the maximum cluster .
TClonesArray * fClArray
! Pointer to array in input event
Int_t GetNEntries() const
void SetPhiLimits(Double_t min, Double_t max)
Cut on the maximum track .
Float_t fNEFMaxCut
minimum NEF in a jet
Double_t NEF() const
Definition: AliEmcalJet.h:92
Bool_t GetMomentumFromJet(TLorentzVector &mom, const AliEmcalJet *jet, Double_t mass) const
Int_t fCurrentID
! current ID for automatic loops
AliClusterContainer * fClusterContainer
particle container (jet constituents)
Bool_t GetNextMomentum(TLorentzVector &mom)
Container structure for EMCAL clusters.
void ResetCurrentID(Int_t i=-1)
Int_t fMinNConstituents
how many jets are to be considered the leading jet(s)
Double_t MaxPartPt() const
Definition: AliEmcalJet.h:100
TString fRhoName
jet radius
ClassImp(AliJetContainer) AliJetContainer
AliEmcalJet * GetJet(Int_t i) const
Double_t GetJetPtCorr(Int_t i) const
Int_t fFlavourSelection
Name of rho mass object.