AliPhysics  3b4a69f (3b4a69f)
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),
51  fRhoName(other.fRhoName),
52  fRhomName(other.fRhomName),
53  fRho(other.fRho),
54  fRhom(other.fRhom),
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 
134 //______________________________________________________________________________
136 {
137  // Prepare the utility.
138 
139 }
140 
141 //______________________________________________________________________________
143 {
144  // Prepare the utility.
145 
146  if (!fInit) return;
147 
148  if (fRhoParam) fRho = fRhoParam->GetVal();
149  if (fRhomParam) fRhom = fRhomParam->GetVal();
150 
151  if(fRho < 1e-6) {
152  fRho = 1e-6;
153  }
154  if(fRhom < 1e-6) {
155  fRhom = 1e-6;
156  }
157 
158  if (fGroomedJets) fGroomedJets->Delete();
159 
161  fjw.DoSoftDrop();
162 
163 }
164 
166 {
167  // Process each jet.
168  if (!fInit) return;
169 
170  #ifdef FASTJET_VERSION
171 
172  std::vector<fastjet::PseudoJet> jets_inclusive;
173  std::vector<fastjet::PseudoJet> jets_groomed;
174  jets_inclusive = fjw.GetInclusiveJets();
175  Int_t ninc = (Int_t)jets_inclusive.size();
176  jets_groomed = fjw.GetGroomedJets();
177  Int_t ngrmd = (Int_t)jets_groomed.size();
178  if( (ngrmd > 0) && (ij<ngrmd) ) {
179 
180  //do we really need this area stuff here?
181  fastjet::PseudoJet area(fjw.GetJetAreaVector(ij));
182  jet->SetArea(area.perp());
183  jet->SetAreaEta(area.eta());
184  jet->SetAreaPhi(area.phi());
185  jet->SetAreaEmc(area.perp());
186 
187  jet->GetShapeProperties()->SetSoftDropZg(jets_groomed[ij].structure_of<fastjet::contrib::SoftDrop>().symmetry());
188  jet->GetShapeProperties()->SetSoftDropdR(jets_groomed[ij].structure_of<fastjet::contrib::SoftDrop>().delta_R());
189 
190  //getting ungroomed pt
191  unsigned k = jets_groomed[ij].user_index();
192  if ( (k>0) && (k<ninc) ) jet->GetShapeProperties()->SetSoftDropPtfrac( jets_groomed[ij].perp() / jets_inclusive[k].perp() );
193 
194  jet->GetShapeProperties()->SetSoftDropDropCount(jets_groomed[ij].structure_of<fastjet::contrib::SoftDrop>().dropped_count());
195 
196  }
197 
198  #endif
199 }
200 
201 //______________________________________________________________________________
203 {
204  // Run termination of the utility (after each event).
205 
206  if (!fInit) return;
207 
208  if (!fGroomedJets) {
209  AliWarning(Form("No jet branch to write to for subtracted jets. fGroomedJetsName: %s", fGroomedJetsName.Data()));
210  return;
211  }
212 
213 #ifdef FASTJET_VERSION
214 
215 
216 #endif
217 
218 }
219 
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:139
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:256
const std::vector< fastjet::PseudoJet > & GetInclusiveJets() const
Definition: AliFJWrapper.h:34
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:257
AliRhoParameter * fRhoParam
! event rho
AliEmcalJetUtilitySoftDrop & operator=(const AliEmcalJetUtilitySoftDrop &jet)
Represent a jet reconstructed using the EMCal jet framework.
Definition: AliEmcalJet.h:51
AliRhoParameter * fRhomParam
! event rhom
TString fGroomedJetsName
name of groomed jet collection
AliEmcalJetShapeProperties * GetShapeProperties() const
Definition: AliEmcalJet.h:361
void SetAreaPhi(Double_t a)
Definition: AliEmcalJet.h:258
TClonesArray * fGroomedJets
! groomed jet collection
Double_t fRho
pT background density
Double_t fRhom
mT background density
void SetAreaEmc(Double_t a)
Definition: AliEmcalJet.h:260