AliPhysics  6cf2591 (6cf2591)
 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_inclusive;
165  std::vector<fastjet::PseudoJet> jets_groomed;
166  jets_inclusive = fjw.GetInclusiveJets();
167  Int_t ninc = (Int_t)jets_inclusive.size();
168  jets_groomed = fjw.GetGroomedJets();
169  Int_t ngrmd = (Int_t)jets_groomed.size();
170  if( (ngrmd > 0) && (ij<ngrmd) ) {
171 
172  //do we really need this area stuff here?
173  fastjet::PseudoJet area(fjw.GetJetAreaVector(ij));
174  jet->SetArea(area.perp());
175  jet->SetAreaEta(area.eta());
176  jet->SetAreaPhi(area.phi());
177  jet->SetAreaEmc(area.perp());
178 
179  jet->GetShapeProperties()->SetSoftDropZg(jets_groomed[ij].structure_of<fastjet::contrib::SoftDrop>().symmetry());
180  jet->GetShapeProperties()->SetSoftDropdR(jets_groomed[ij].structure_of<fastjet::contrib::SoftDrop>().delta_R());
181 
182  //getting ungroomed pt
183  unsigned k = jets_groomed[ij].user_index();
184  if ( (k>0) && (k<ninc) ) jet->GetShapeProperties()->SetSoftDropPtfrac( jets_groomed[ij].perp() / jets_inclusive[k].perp() );
185 
186  jet->GetShapeProperties()->SetSoftDropDropCount(jets_groomed[ij].structure_of<fastjet::contrib::SoftDrop>().dropped_count());
187 
188  }
189 
190  #endif
191 }
192 
193 //______________________________________________________________________________
195 {
196  // Run termination of the utility (after each event).
197 
198  if (!fInit) return;
199 
200  if (!fGroomedJets) {
201  AliWarning(Form("No jet branch to write to for subtracted jets. fGroomedJetsName: %s", fGroomedJetsName.Data()));
202  return;
203  }
204 
205 #ifdef FASTJET_VERSION
206 
207 
208 #endif
209 
210 }
211 
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:182
const std::vector< fastjet::PseudoJet > & GetInclusiveJets() const
Definition: AliFJWrapper.h:33
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:183
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:253
void SetAreaPhi(Double_t a)
Definition: AliEmcalJet.h:184
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:186