AliPhysics  a34469b (a34469b)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliEmcalJetUtilitySoftDrop.cxx
Go to the documentation of this file.
2 #include "AliEmcalJet.h"
3 #include "AliRhoParameter.h"
4 #include "AliEmcalJetTask.h"
5 
7 
8 //______________________________________________________________________________
11  fGroomedJetsName(""),
12  fGroomedJetParticlesName(""),
13  fUseExternalBkg(kFALSE),
14  fRhoName(""),
15  fRhomName(""),
16  fRho(1e-6),
17  fRhom(1e-6),
18  fGroomedJets(0x0),
19  fGroomedJetParticles(0x0),
20  fRhoParam(0),
21  fRhomParam(0)
22 {
23  // Dummy constructor.
24 
25 }
26 
27 //______________________________________________________________________________
29  AliEmcalJetUtility(name),
30  fGroomedJetsName(""),
31  fGroomedJetParticlesName(""),
32  fUseExternalBkg(kFALSE),
33  fRhoName(""),
34  fRhomName(""),
35  fRho(1e-6),
36  fRhom(1e-6),
37  fGroomedJets(0x0),
38  fGroomedJetParticles(0x0),
39  fRhoParam(0),
40  fRhomParam(0)
41 {
42  // Default constructor.
43 }
44 
45 //______________________________________________________________________________
47  AliEmcalJetUtility(other),
48  fGroomedJetsName(other.fGroomedJetsName),
49  fGroomedJetParticlesName(other.fGroomedJetParticlesName),
50  fUseExternalBkg(other.fUseExternalBkg),
51  fRhoName(other.fRhoName),
52  fRhomName(other.fRhomName),
53  fRho(other.fRho),
54  fRhom(other.fRhom),
55  fGroomedJets(other.fGroomedJets),
56  fGroomedJetParticles(other.fGroomedJetParticles),
57  fRhoParam(other.fRhoParam),
58  fRhomParam(other.fRhomParam)
59 {
60  // Copy constructor.
61 }
62 
63 //______________________________________________________________________________
65 {
66  // Assignment.
67 
68  if (&other == this) return *this;
73  fRhoName = other.fRhoName;
74  fRhomName = other.fRhomName;
75  fRho = other.fRho;
76  fRhom = other.fRhom;
77  fGroomedJets = other.fGroomedJets;
79  fRhoParam = other.fRhoParam;
80  fRhomParam = other.fRhomParam;
81  return *this;
82 }
83 
84 //______________________________________________________________________________
86 {
87  // Initialize the utility.
88 
89  // Add constituent subtracted jets to event
90  if (!fGroomedJetsName.IsNull()) {
91  if (!(fJetTask->InputEvent()->FindListObject(fGroomedJetsName)) ) {
92  fGroomedJets = new TClonesArray("AliEmcalJet");
94  fJetTask->InputEvent()->AddObject(fGroomedJets);
95  }
96  else {
97  AliError(Form("%s: Object for subtracted jet branch with name %s already in event! Returning", GetName(), fGroomedJetsName.Data()));
98  return;
99  }
100  }
101 
102  // Add tracks from constituent subtracted jets to event
103  if (!fGroomedJetParticlesName.IsNull()) {
104  if (!(fJetTask->InputEvent()->FindListObject(fGroomedJetParticlesName))) {
105  fGroomedJetParticles = new TClonesArray("AliEmcalParticle");
107  fJetTask->InputEvent()->AddObject(fGroomedJetParticles);
108  } else {
109  AliError(Form("%s: Object with name %s already in event! Returning", GetName(), fGroomedJetParticlesName.Data()));
110  return;
111  }
112  }
113 
114  if (!fRhoName.IsNull() && !fRhoParam) { // get rho from the event
115  fRhoParam = dynamic_cast<AliRhoParameter*>(fJetTask->InputEvent()->FindListObject(fRhoName));
116  if (!fRhoParam) {
117  AliError(Form("%s: Could not retrieve rho %s!", GetName(), fRhoName.Data()));
118  return;
119  }
120  }
121 
122  if (!fRhomName.IsNull() && !fRhomParam) { // get rhom from the event
123  fRhomParam = dynamic_cast<AliRhoParameter*>(fJetTask->InputEvent()->FindListObject(fRhomName));
124  if (!fRhomParam) {
125  AliError(Form("%s: Could not retrieve rho_m %s!", GetName(), fRhomName.Data()));
126  return;
127  }
128  }
129 
130  fInit = kTRUE;
131 }
132 
133 //______________________________________________________________________________
135 {
136  // Prepare the utility.
137 
138  if (!fInit) return;
139 
140  if (fRhoParam) fRho = fRhoParam->GetVal();
141  if (fRhomParam) fRhom = fRhomParam->GetVal();
142 
143  if(fRho < 1e-6) {
144  fRho = 1e-6;
145  }
146  if(fRhom < 1e-6) {
147  fRhom = 1e-6;
148  }
149 
150  if (fGroomedJets) fGroomedJets->Delete();
151 
153  fjw.DoSoftDrop();
154 
155 }
156 
158 {
159  // Process each jet.
160  if (!fInit) return;
161 
162  #ifdef FASTJET_VERSION
163 
164  std::vector<fastjet::PseudoJet> jets_groomed;
165  jets_groomed = fjw.GetGroomedJets();
166  Int_t ngrmd = (Int_t)jets_groomed.size();
167  if( (ngrmd > 0) && (ij<ngrmd) ) {
168 
169  //do we really need this area stuff here?
170  fastjet::PseudoJet area(fjw.GetJetAreaVector(ij));
171  jet->SetArea(area.perp());
172  jet->SetAreaEta(area.eta());
173  jet->SetAreaPhi(area.phi());
174  jet->SetAreaEmc(area.perp());
175 
176  jet->GetShapeProperties()->SetSoftDropZg(jets_groomed[ij].structure_of<fastjet::contrib::SoftDrop>().symmetry());
177  jet->GetShapeProperties()->SetSoftDropdR(jets_groomed[ij].structure_of<fastjet::contrib::SoftDrop>().delta_R());
178  }
179 
180  #endif
181 }
182 
183 //______________________________________________________________________________
185 {
186  // Run termination of the utility (after each event).
187 
188  if (!fInit) return;
189 
190  if (!fGroomedJets) {
191  AliWarning(Form("No jet branch to write to for subtracted jets. fGroomedJetsName: %s", fGroomedJetsName.Data()));
192  return;
193  }
194 
195 #ifdef FASTJET_VERSION
196 
197 
198 #endif
199 
200 }
201 
fastjet::PseudoJet GetJetAreaVector(UInt_t idx) const
TClonesArray * fGroomedJetParticles
! groomed particle collection
void SetUseExternalBkg(Bool_t b, Double_t rho, Double_t rhom)
Definition: AliFJWrapper.h:113
void ProcessJet(AliEmcalJet *jet, Int_t ij, AliFJWrapper &fjw)
AliEmcalJetUtility & operator=(const AliEmcalJetUtility &jet)
virtual Int_t DoSoftDrop()
void SetArea(Double_t a)
Definition: AliEmcalJet.h:176
TString fGroomedJetParticlesName
name of groomed particle collection
int Int_t
Definition: External.C:63
Bool_t fUseExternalBkg
use external background for generic subtractor
AliEmcalJetTask * fJetTask
void SetAreaEta(Double_t a)
Definition: AliEmcalJet.h:177
AliRhoParameter * fRhoParam
! event rho
AliEmcalJetUtilitySoftDrop & operator=(const AliEmcalJetUtilitySoftDrop &jet)
Represent a jet reconstructed using the EMCal jet framework.
Definition: AliEmcalJet.h:44
AliRhoParameter * fRhomParam
! event rhom
TString fGroomedJetsName
name of groomed jet collection
AliEmcalJetShapeProperties * GetShapeProperties() const
Definition: AliEmcalJet.h:247
void SetAreaPhi(Double_t a)
Definition: AliEmcalJet.h:178
TClonesArray * fGroomedJets
! groomed jet collection
Double_t fRho
pT background density
ClassImp(AliEmcalJetUtilitySoftDrop) AliEmcalJetUtilitySoftDrop
Double_t fRhom
mT background density
void SetAreaEmc(Double_t a)
Definition: AliEmcalJet.h:180