1 | /*
|
---|
2 | * Delphes: a framework for fast simulation of a generic collider experiment
|
---|
3 | * Copyright (C) 2012-2014 Universite catholique de Louvain (UCL), Belgium
|
---|
4 | *
|
---|
5 | * This program is free software: you can redistribute it and/or modify
|
---|
6 | * it under the terms of the GNU General Public License as published by
|
---|
7 | * the Free Software Foundation, either version 3 of the License, or
|
---|
8 | * (at your option) any later version.
|
---|
9 | *
|
---|
10 | * This program is distributed in the hope that it will be useful,
|
---|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
13 | * GNU General Public License for more details.
|
---|
14 | *
|
---|
15 | * You should have received a copy of the GNU General Public License
|
---|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
---|
17 | */
|
---|
18 |
|
---|
19 | /** \class TreeWriter
|
---|
20 | *
|
---|
21 | * Fills ROOT tree branches.
|
---|
22 | *
|
---|
23 | * \author P. Demin - UCL, Louvain-la-Neuve
|
---|
24 | *
|
---|
25 | */
|
---|
26 |
|
---|
27 | #include "modules/TreeWriter.h"
|
---|
28 |
|
---|
29 | #include "classes/DelphesClasses.h"
|
---|
30 | #include "classes/DelphesFactory.h"
|
---|
31 | #include "classes/DelphesFormula.h"
|
---|
32 |
|
---|
33 | #include "ExRootAnalysis/ExRootClassifier.h"
|
---|
34 | #include "ExRootAnalysis/ExRootFilter.h"
|
---|
35 | #include "ExRootAnalysis/ExRootResult.h"
|
---|
36 | #include "ExRootAnalysis/ExRootTreeBranch.h"
|
---|
37 |
|
---|
38 | #include "TDatabasePDG.h"
|
---|
39 | #include "TFormula.h"
|
---|
40 | #include "TLorentzVector.h"
|
---|
41 | #include "TMath.h"
|
---|
42 | #include "TObjArray.h"
|
---|
43 | #include "TROOT.h"
|
---|
44 | #include "TRandom3.h"
|
---|
45 | #include "TString.h"
|
---|
46 |
|
---|
47 | #include <algorithm>
|
---|
48 | #include <iostream>
|
---|
49 | #include <sstream>
|
---|
50 | #include <stdexcept>
|
---|
51 |
|
---|
52 | using namespace std;
|
---|
53 |
|
---|
54 | //------------------------------------------------------------------------------
|
---|
55 |
|
---|
56 | TreeWriter::TreeWriter()
|
---|
57 | {
|
---|
58 | }
|
---|
59 |
|
---|
60 | //------------------------------------------------------------------------------
|
---|
61 |
|
---|
62 | TreeWriter::~TreeWriter()
|
---|
63 | {
|
---|
64 | }
|
---|
65 |
|
---|
66 | //------------------------------------------------------------------------------
|
---|
67 |
|
---|
68 | void TreeWriter::Init()
|
---|
69 | {
|
---|
70 | fClassMap[GenParticle::Class()] = &TreeWriter::ProcessParticles;
|
---|
71 | fClassMap[Vertex::Class()] = &TreeWriter::ProcessVertices;
|
---|
72 | fClassMap[Track::Class()] = &TreeWriter::ProcessTracks;
|
---|
73 | fClassMap[Tower::Class()] = &TreeWriter::ProcessTowers;
|
---|
74 | fClassMap[ParticleFlowCandidate::Class()] = &TreeWriter::ProcessParticleFlowCandidates;
|
---|
75 | fClassMap[Photon::Class()] = &TreeWriter::ProcessPhotons;
|
---|
76 | fClassMap[Electron::Class()] = &TreeWriter::ProcessElectrons;
|
---|
77 | fClassMap[Muon::Class()] = &TreeWriter::ProcessMuons;
|
---|
78 | fClassMap[Jet::Class()] = &TreeWriter::ProcessJets;
|
---|
79 | fClassMap[MissingET::Class()] = &TreeWriter::ProcessMissingET;
|
---|
80 | fClassMap[ScalarHT::Class()] = &TreeWriter::ProcessScalarHT;
|
---|
81 | fClassMap[Rho::Class()] = &TreeWriter::ProcessRho;
|
---|
82 | fClassMap[Weight::Class()] = &TreeWriter::ProcessWeight;
|
---|
83 | fClassMap[HectorHit::Class()] = &TreeWriter::ProcessHectorHit;
|
---|
84 |
|
---|
85 | TBranchMap::iterator itBranchMap;
|
---|
86 | map<TClass *, TProcessMethod>::iterator itClassMap;
|
---|
87 |
|
---|
88 | // read branch configuration and
|
---|
89 | // import array with output from filter/classifier/jetfinder modules
|
---|
90 |
|
---|
91 | ExRootConfParam param = GetParam("Branch");
|
---|
92 | Long_t i, size;
|
---|
93 | TString branchName, branchClassName, branchInputArray;
|
---|
94 | TClass *branchClass;
|
---|
95 | TObjArray *array;
|
---|
96 | ExRootTreeBranch *branch;
|
---|
97 |
|
---|
98 | size = param.GetSize();
|
---|
99 | for(i = 0; i < size / 3; ++i)
|
---|
100 | {
|
---|
101 | branchInputArray = param[i * 3].GetString();
|
---|
102 | branchName = param[i * 3 + 1].GetString();
|
---|
103 | branchClassName = param[i * 3 + 2].GetString();
|
---|
104 |
|
---|
105 | branchClass = gROOT->GetClass(branchClassName);
|
---|
106 |
|
---|
107 | if(!branchClass)
|
---|
108 | {
|
---|
109 | cout << "** ERROR: cannot find class '" << branchClassName << "'" << endl;
|
---|
110 | continue;
|
---|
111 | }
|
---|
112 |
|
---|
113 | itClassMap = fClassMap.find(branchClass);
|
---|
114 | if(itClassMap == fClassMap.end())
|
---|
115 | {
|
---|
116 | cout << "** ERROR: cannot create branch for class '" << branchClassName << "'" << endl;
|
---|
117 | continue;
|
---|
118 | }
|
---|
119 |
|
---|
120 | array = ImportArray(branchInputArray);
|
---|
121 | branch = NewBranch(branchName, branchClass);
|
---|
122 |
|
---|
123 | fBranchMap.insert(make_pair(branch, make_pair(itClassMap->second, array)));
|
---|
124 | }
|
---|
125 | }
|
---|
126 |
|
---|
127 | //------------------------------------------------------------------------------
|
---|
128 |
|
---|
129 | void TreeWriter::Finish()
|
---|
130 | {
|
---|
131 | }
|
---|
132 |
|
---|
133 | //------------------------------------------------------------------------------
|
---|
134 |
|
---|
135 | void TreeWriter::FillParticles(Candidate *candidate, TRefArray *array)
|
---|
136 | {
|
---|
137 | TIter it1(candidate->GetCandidates());
|
---|
138 | it1.Reset();
|
---|
139 | array->Clear();
|
---|
140 |
|
---|
141 | while((candidate = static_cast<Candidate *>(it1.Next())))
|
---|
142 | {
|
---|
143 | TIter it2(candidate->GetCandidates());
|
---|
144 |
|
---|
145 | // particle
|
---|
146 | if(candidate->GetCandidates()->GetEntriesFast() == 0)
|
---|
147 | {
|
---|
148 | array->Add(candidate);
|
---|
149 | continue;
|
---|
150 | }
|
---|
151 |
|
---|
152 | // track
|
---|
153 | candidate = static_cast<Candidate *>(candidate->GetCandidates()->At(0));
|
---|
154 | if(candidate->GetCandidates()->GetEntriesFast() == 0)
|
---|
155 | {
|
---|
156 | array->Add(candidate);
|
---|
157 | continue;
|
---|
158 | }
|
---|
159 |
|
---|
160 | // tower
|
---|
161 | it2.Reset();
|
---|
162 | while((candidate = static_cast<Candidate *>(it2.Next())))
|
---|
163 | {
|
---|
164 | array->Add(candidate->GetCandidates()->At(0));
|
---|
165 | }
|
---|
166 | }
|
---|
167 | }
|
---|
168 |
|
---|
169 | //------------------------------------------------------------------------------
|
---|
170 |
|
---|
171 | void TreeWriter::ProcessParticles(ExRootTreeBranch *branch, TObjArray *array)
|
---|
172 | {
|
---|
173 | TIter iterator(array);
|
---|
174 | Candidate *candidate = 0;
|
---|
175 | GenParticle *entry = 0;
|
---|
176 | Double_t pt, signPz, cosTheta, eta, rapidity;
|
---|
177 |
|
---|
178 | const Double_t c_light = 2.99792458E8;
|
---|
179 |
|
---|
180 | // loop over all particles
|
---|
181 | iterator.Reset();
|
---|
182 | while((candidate = static_cast<Candidate *>(iterator.Next())))
|
---|
183 | {
|
---|
184 | const TLorentzVector &momentum = candidate->Momentum;
|
---|
185 | const TLorentzVector &position = candidate->Position;
|
---|
186 |
|
---|
187 | entry = static_cast<GenParticle *>(branch->NewEntry());
|
---|
188 |
|
---|
189 | entry->SetBit(kIsReferenced);
|
---|
190 | entry->SetUniqueID(candidate->GetUniqueID());
|
---|
191 |
|
---|
192 | pt = momentum.Pt();
|
---|
193 | cosTheta = TMath::Abs(momentum.CosTheta());
|
---|
194 | signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0;
|
---|
195 | eta = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Eta());
|
---|
196 | rapidity = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Rapidity());
|
---|
197 |
|
---|
198 | entry->PID = candidate->PID;
|
---|
199 |
|
---|
200 | entry->Status = candidate->Status;
|
---|
201 | entry->IsPU = candidate->IsPU;
|
---|
202 |
|
---|
203 | entry->M1 = candidate->M1;
|
---|
204 | entry->M2 = candidate->M2;
|
---|
205 |
|
---|
206 | entry->D1 = candidate->D1;
|
---|
207 | entry->D2 = candidate->D2;
|
---|
208 |
|
---|
209 | entry->Charge = candidate->Charge;
|
---|
210 | entry->Mass = candidate->Mass;
|
---|
211 |
|
---|
212 | entry->E = momentum.E();
|
---|
213 | entry->Px = momentum.Px();
|
---|
214 | entry->Py = momentum.Py();
|
---|
215 | entry->Pz = momentum.Pz();
|
---|
216 |
|
---|
217 | entry->D0 = candidate->D0;
|
---|
218 | entry->DZ = candidate->DZ;
|
---|
219 | entry->P = candidate->P;
|
---|
220 | entry->PT = candidate->PT;
|
---|
221 | entry->CtgTheta = candidate->CtgTheta;
|
---|
222 | entry->Phi = candidate->Phi;
|
---|
223 |
|
---|
224 | entry->Eta = eta;
|
---|
225 | entry->Phi = momentum.Phi();
|
---|
226 | entry->PT = pt;
|
---|
227 |
|
---|
228 | entry->Rapidity = rapidity;
|
---|
229 |
|
---|
230 | entry->X = position.X();
|
---|
231 | entry->Y = position.Y();
|
---|
232 | entry->Z = position.Z();
|
---|
233 | entry->T = position.T() * 1.0E-3 / c_light;
|
---|
234 | }
|
---|
235 | }
|
---|
236 |
|
---|
237 | //------------------------------------------------------------------------------
|
---|
238 |
|
---|
239 | void TreeWriter::ProcessVertices(ExRootTreeBranch *branch, TObjArray *array)
|
---|
240 | {
|
---|
241 | TIter iterator(array);
|
---|
242 | Candidate *candidate = 0, *constituent = 0;
|
---|
243 | Vertex *entry = 0;
|
---|
244 |
|
---|
245 | const Double_t c_light = 2.99792458E8;
|
---|
246 |
|
---|
247 | Double_t x, y, z, t, xError, yError, zError, tError, sigma, sumPT2, btvSumPT2, genDeltaZ, genSumPT2;
|
---|
248 | UInt_t index, ndf;
|
---|
249 |
|
---|
250 | CompBase *compare = Candidate::fgCompare;
|
---|
251 | Candidate::fgCompare = CompSumPT2<Candidate>::Instance();
|
---|
252 | array->Sort();
|
---|
253 | Candidate::fgCompare = compare;
|
---|
254 |
|
---|
255 | // loop over all vertices
|
---|
256 | iterator.Reset();
|
---|
257 | while((candidate = static_cast<Candidate *>(iterator.Next())))
|
---|
258 | {
|
---|
259 |
|
---|
260 | index = candidate->ClusterIndex;
|
---|
261 | ndf = candidate->ClusterNDF;
|
---|
262 | sigma = candidate->ClusterSigma;
|
---|
263 | sumPT2 = candidate->SumPT2;
|
---|
264 | btvSumPT2 = candidate->BTVSumPT2;
|
---|
265 | genDeltaZ = candidate->GenDeltaZ;
|
---|
266 | genSumPT2 = candidate->GenSumPT2;
|
---|
267 |
|
---|
268 | x = candidate->Position.X();
|
---|
269 | y = candidate->Position.Y();
|
---|
270 | z = candidate->Position.Z();
|
---|
271 | t = candidate->Position.T() * 1.0E-3 / c_light;
|
---|
272 |
|
---|
273 | xError = candidate->PositionError.X();
|
---|
274 | yError = candidate->PositionError.Y();
|
---|
275 | zError = candidate->PositionError.Z();
|
---|
276 | tError = candidate->PositionError.T() * 1.0E-3 / c_light;
|
---|
277 |
|
---|
278 | entry = static_cast<Vertex *>(branch->NewEntry());
|
---|
279 |
|
---|
280 | entry->Index = index;
|
---|
281 | entry->NDF = ndf;
|
---|
282 | entry->Sigma = sigma;
|
---|
283 | entry->SumPT2 = sumPT2;
|
---|
284 | entry->BTVSumPT2 = btvSumPT2;
|
---|
285 | entry->GenDeltaZ = genDeltaZ;
|
---|
286 | entry->GenSumPT2 = genSumPT2;
|
---|
287 |
|
---|
288 | entry->X = x;
|
---|
289 | entry->Y = y;
|
---|
290 | entry->Z = z;
|
---|
291 | entry->T = t;
|
---|
292 |
|
---|
293 | entry->ErrorX = xError;
|
---|
294 | entry->ErrorY = yError;
|
---|
295 | entry->ErrorZ = zError;
|
---|
296 | entry->ErrorT = tError;
|
---|
297 |
|
---|
298 | TIter itConstituents(candidate->GetCandidates());
|
---|
299 | itConstituents.Reset();
|
---|
300 | entry->Constituents.Clear();
|
---|
301 | while((constituent = static_cast<Candidate *>(itConstituents.Next())))
|
---|
302 | {
|
---|
303 | entry->Constituents.Add(constituent);
|
---|
304 | }
|
---|
305 | }
|
---|
306 | }
|
---|
307 |
|
---|
308 | //------------------------------------------------------------------------------
|
---|
309 |
|
---|
310 | void TreeWriter::ProcessTracks(ExRootTreeBranch *branch, TObjArray *array)
|
---|
311 | {
|
---|
312 | TIter iterator(array);
|
---|
313 | Candidate *candidate = 0;
|
---|
314 | Candidate *particle = 0;
|
---|
315 | Track *entry = 0;
|
---|
316 | Double_t pt, signz, cosTheta, eta, rapidity, p, ctgTheta, phi;
|
---|
317 | const Double_t c_light = 2.99792458E8;
|
---|
318 |
|
---|
319 | // loop over all tracks
|
---|
320 | iterator.Reset();
|
---|
321 | while((candidate = static_cast<Candidate *>(iterator.Next())))
|
---|
322 | {
|
---|
323 | const TLorentzVector &position = candidate->Position;
|
---|
324 |
|
---|
325 | cosTheta = TMath::Abs(position.CosTheta());
|
---|
326 | signz = (position.Pz() >= 0.0) ? 1.0 : -1.0;
|
---|
327 | eta = (cosTheta == 1.0 ? signz * 999.9 : position.Eta());
|
---|
328 | rapidity = (cosTheta == 1.0 ? signz * 999.9 : position.Rapidity());
|
---|
329 |
|
---|
330 | entry = static_cast<Track *>(branch->NewEntry());
|
---|
331 |
|
---|
332 | entry->SetBit(kIsReferenced);
|
---|
333 | entry->SetUniqueID(candidate->GetUniqueID());
|
---|
334 |
|
---|
335 | entry->PID = candidate->PID;
|
---|
336 |
|
---|
337 | entry->Charge = candidate->Charge;
|
---|
338 |
|
---|
339 | entry->EtaOuter = eta;
|
---|
340 | entry->PhiOuter = position.Phi();
|
---|
341 |
|
---|
342 | entry->XOuter = position.X();
|
---|
343 | entry->YOuter = position.Y();
|
---|
344 | entry->ZOuter = position.Z();
|
---|
345 | entry->TOuter = position.T() * 1.0E-3 / c_light;
|
---|
346 |
|
---|
347 | entry->L = candidate->L;
|
---|
348 |
|
---|
349 | entry->D0 = candidate->D0;
|
---|
350 | entry->DZ = candidate->DZ;
|
---|
351 |
|
---|
352 | entry->ErrorP = candidate->ErrorP;
|
---|
353 | entry->ErrorPT = candidate->ErrorPT;
|
---|
354 |
|
---|
355 | // diagonal covariance matrix terms
|
---|
356 | entry->ErrorD0 = candidate->ErrorD0;
|
---|
357 | entry->ErrorC = candidate->ErrorC;
|
---|
358 | entry->ErrorPhi = candidate->ErrorPhi;
|
---|
359 | entry->ErrorDZ = candidate->ErrorDZ;
|
---|
360 | entry->ErrorCtgTheta = candidate->ErrorCtgTheta;
|
---|
361 |
|
---|
362 | // add some offdiagonal covariance matrix elements
|
---|
363 | entry->ErrorD0Phi = candidate->TrackCovariance(0,1);
|
---|
364 | entry->ErrorD0C = candidate->TrackCovariance(0,2);
|
---|
365 | entry->ErrorD0DZ = candidate->TrackCovariance(0,3);
|
---|
366 | entry->ErrorD0CtgTheta = candidate->TrackCovariance(0,4);
|
---|
367 | entry->ErrorPhiC = candidate->TrackCovariance(1,2);
|
---|
368 | entry->ErrorPhiDZ = candidate->TrackCovariance(1,3);
|
---|
369 | entry->ErrorPhiCtgTheta = candidate->TrackCovariance(1,4);
|
---|
370 | entry->ErrorCDZ = candidate->TrackCovariance(2,3);
|
---|
371 | entry->ErrorCCtgTheta = candidate->TrackCovariance(2,4);
|
---|
372 | entry->ErrorDZCtgTheta = candidate->TrackCovariance(3,4);
|
---|
373 |
|
---|
374 | entry->Xd = candidate->Xd;
|
---|
375 | entry->Yd = candidate->Yd;
|
---|
376 | entry->Zd = candidate->Zd;
|
---|
377 |
|
---|
378 | const TLorentzVector &momentum = candidate->Momentum;
|
---|
379 |
|
---|
380 | pt = momentum.Pt();
|
---|
381 | p = momentum.P();
|
---|
382 | phi = momentum.Phi();
|
---|
383 | ctgTheta = (TMath::Tan(momentum.Theta()) != 0) ? 1 / TMath::Tan(momentum.Theta()) : 1e10;
|
---|
384 |
|
---|
385 | cosTheta = TMath::Abs(momentum.CosTheta());
|
---|
386 | signz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0;
|
---|
387 | eta = (cosTheta == 1.0 ? signz * 999.9 : momentum.Eta());
|
---|
388 | rapidity = (cosTheta == 1.0 ? signz * 999.9 : momentum.Rapidity());
|
---|
389 |
|
---|
390 | entry->P = p;
|
---|
391 | entry->PT = pt;
|
---|
392 | entry->Eta = eta;
|
---|
393 | entry->Phi = phi;
|
---|
394 | entry->CtgTheta = ctgTheta;
|
---|
395 |
|
---|
396 | particle = static_cast<Candidate *>(candidate->GetCandidates()->At(0));
|
---|
397 | const TLorentzVector &initialPosition = particle->Position;
|
---|
398 |
|
---|
399 | entry->X = initialPosition.X();
|
---|
400 | entry->Y = initialPosition.Y();
|
---|
401 | entry->Z = initialPosition.Z();
|
---|
402 | entry->T = initialPosition.T() * 1.0E-3 / c_light;
|
---|
403 |
|
---|
404 | entry->Particle = particle;
|
---|
405 |
|
---|
406 | entry->VertexIndex = candidate->ClusterIndex;
|
---|
407 | }
|
---|
408 | }
|
---|
409 |
|
---|
410 | //------------------------------------------------------------------------------
|
---|
411 |
|
---|
412 | void TreeWriter::ProcessTowers(ExRootTreeBranch *branch, TObjArray *array)
|
---|
413 | {
|
---|
414 | TIter iterator(array);
|
---|
415 | Candidate *candidate = 0;
|
---|
416 | Tower *entry = 0;
|
---|
417 | Double_t pt, signPz, cosTheta, eta, rapidity;
|
---|
418 | const Double_t c_light = 2.99792458E8;
|
---|
419 |
|
---|
420 | // loop over all towers
|
---|
421 | iterator.Reset();
|
---|
422 | while((candidate = static_cast<Candidate *>(iterator.Next())))
|
---|
423 | {
|
---|
424 | const TLorentzVector &momentum = candidate->Momentum;
|
---|
425 | const TLorentzVector &position = candidate->Position;
|
---|
426 |
|
---|
427 | pt = momentum.Pt();
|
---|
428 | cosTheta = TMath::Abs(momentum.CosTheta());
|
---|
429 | signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0;
|
---|
430 | eta = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Eta());
|
---|
431 | rapidity = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Rapidity());
|
---|
432 |
|
---|
433 | entry = static_cast<Tower *>(branch->NewEntry());
|
---|
434 |
|
---|
435 | entry->SetBit(kIsReferenced);
|
---|
436 | entry->SetUniqueID(candidate->GetUniqueID());
|
---|
437 |
|
---|
438 | entry->Eta = eta;
|
---|
439 | entry->Phi = momentum.Phi();
|
---|
440 | entry->ET = pt;
|
---|
441 | entry->E = momentum.E();
|
---|
442 | entry->Eem = candidate->Eem;
|
---|
443 | entry->Ehad = candidate->Ehad;
|
---|
444 | entry->Edges[0] = candidate->Edges[0];
|
---|
445 | entry->Edges[1] = candidate->Edges[1];
|
---|
446 | entry->Edges[2] = candidate->Edges[2];
|
---|
447 | entry->Edges[3] = candidate->Edges[3];
|
---|
448 |
|
---|
449 | entry->T = position.T() * 1.0E-3 / c_light;
|
---|
450 | entry->NTimeHits = candidate->NTimeHits;
|
---|
451 |
|
---|
452 | FillParticles(candidate, &entry->Particles);
|
---|
453 | }
|
---|
454 | }
|
---|
455 |
|
---|
456 | //------------------------------------------------------------------------------
|
---|
457 |
|
---|
458 | void TreeWriter::ProcessParticleFlowCandidates(ExRootTreeBranch *branch, TObjArray *array)
|
---|
459 | {
|
---|
460 |
|
---|
461 | TIter iterator(array);
|
---|
462 | Candidate *candidate = 0;
|
---|
463 | Candidate *particle = 0;
|
---|
464 | ParticleFlowCandidate *entry = 0;
|
---|
465 | Double_t e, pt, signz, cosTheta, eta, rapidity, p, ctgTheta, phi;
|
---|
466 | const Double_t c_light = 2.99792458E8;
|
---|
467 |
|
---|
468 | // loop over all tracks
|
---|
469 | iterator.Reset();
|
---|
470 | while((candidate = static_cast<Candidate *>(iterator.Next())))
|
---|
471 | {
|
---|
472 | const TLorentzVector &position = candidate->Position;
|
---|
473 |
|
---|
474 | cosTheta = TMath::Abs(position.CosTheta());
|
---|
475 | signz = (position.Pz() >= 0.0) ? 1.0 : -1.0;
|
---|
476 | eta = (cosTheta == 1.0 ? signz * 999.9 : position.Eta());
|
---|
477 | rapidity = (cosTheta == 1.0 ? signz * 999.9 : position.Rapidity());
|
---|
478 |
|
---|
479 | entry = static_cast<ParticleFlowCandidate *>(branch->NewEntry());
|
---|
480 |
|
---|
481 | entry->SetBit(kIsReferenced);
|
---|
482 | entry->SetUniqueID(candidate->GetUniqueID());
|
---|
483 |
|
---|
484 | entry->PID = candidate->PID;
|
---|
485 |
|
---|
486 | entry->Charge = candidate->Charge;
|
---|
487 |
|
---|
488 | entry->EtaOuter = eta;
|
---|
489 | entry->PhiOuter = position.Phi();
|
---|
490 |
|
---|
491 | entry->XOuter = position.X();
|
---|
492 | entry->YOuter = position.Y();
|
---|
493 | entry->ZOuter = position.Z();
|
---|
494 | entry->TOuter = position.T() * 1.0E-3 / c_light;
|
---|
495 |
|
---|
496 | entry->L = candidate->L;
|
---|
497 |
|
---|
498 | entry->D0 = candidate->D0;
|
---|
499 | entry->DZ = candidate->DZ;
|
---|
500 |
|
---|
501 | entry->ErrorP = candidate->ErrorP;
|
---|
502 | entry->ErrorPT = candidate->ErrorPT;
|
---|
503 | entry->ErrorCtgTheta = candidate->ErrorCtgTheta;
|
---|
504 |
|
---|
505 |
|
---|
506 | // diagonal covariance matrix terms
|
---|
507 |
|
---|
508 | entry->ErrorD0 = candidate->ErrorD0;
|
---|
509 | entry->ErrorC = candidate->ErrorC;
|
---|
510 | entry->ErrorPhi = candidate->ErrorPhi;
|
---|
511 | entry->ErrorDZ = candidate->ErrorDZ;
|
---|
512 | entry->ErrorCtgTheta = candidate->ErrorCtgTheta;
|
---|
513 |
|
---|
514 | // add some offdiagonal covariance matrix elements
|
---|
515 | entry->ErrorD0Phi = candidate->TrackCovariance(0,1);
|
---|
516 | entry->ErrorD0C = candidate->TrackCovariance(0,2);
|
---|
517 | entry->ErrorD0DZ = candidate->TrackCovariance(0,3);
|
---|
518 | entry->ErrorD0CtgTheta = candidate->TrackCovariance(0,4);
|
---|
519 | entry->ErrorPhiC = candidate->TrackCovariance(1,2);
|
---|
520 | entry->ErrorPhiDZ = candidate->TrackCovariance(1,3);
|
---|
521 | entry->ErrorPhiCtgTheta = candidate->TrackCovariance(1,4);
|
---|
522 | entry->ErrorCDZ = candidate->TrackCovariance(2,3);
|
---|
523 | entry->ErrorCCtgTheta = candidate->TrackCovariance(2,4);
|
---|
524 | entry->ErrorDZCtgTheta = candidate->TrackCovariance(3,4);
|
---|
525 |
|
---|
526 | cout<<entry->ErrorPhiC<<endl;
|
---|
527 |
|
---|
528 | entry->Xd = candidate->Xd;
|
---|
529 | entry->Yd = candidate->Yd;
|
---|
530 | entry->Zd = candidate->Zd;
|
---|
531 |
|
---|
532 | const TLorentzVector &momentum = candidate->Momentum;
|
---|
533 |
|
---|
534 | e = momentum.E();
|
---|
535 | pt = momentum.Pt();
|
---|
536 | p = momentum.P();
|
---|
537 | phi = momentum.Phi();
|
---|
538 | ctgTheta = (TMath::Tan(momentum.Theta()) != 0) ? 1 / TMath::Tan(momentum.Theta()) : 1e10;
|
---|
539 |
|
---|
540 | entry->E = e;
|
---|
541 | entry->P = p;
|
---|
542 | entry->PT = pt;
|
---|
543 | entry->Eta = eta;
|
---|
544 | entry->Phi = phi;
|
---|
545 | entry->CtgTheta = ctgTheta;
|
---|
546 |
|
---|
547 | particle = static_cast<Candidate *>(candidate->GetCandidates()->At(0));
|
---|
548 | const TLorentzVector &initialPosition = particle->Position;
|
---|
549 |
|
---|
550 | entry->X = initialPosition.X();
|
---|
551 | entry->Y = initialPosition.Y();
|
---|
552 | entry->Z = initialPosition.Z();
|
---|
553 | entry->T = initialPosition.T() * 1.0E-3 / c_light;
|
---|
554 |
|
---|
555 | entry->VertexIndex = candidate->ClusterIndex;
|
---|
556 |
|
---|
557 | entry->Eem = candidate->Eem;
|
---|
558 | entry->Ehad = candidate->Ehad;
|
---|
559 | entry->Edges[0] = candidate->Edges[0];
|
---|
560 | entry->Edges[1] = candidate->Edges[1];
|
---|
561 | entry->Edges[2] = candidate->Edges[2];
|
---|
562 | entry->Edges[3] = candidate->Edges[3];
|
---|
563 |
|
---|
564 | entry->T = position.T() * 1.0E-3 / c_light;
|
---|
565 | entry->NTimeHits = candidate->NTimeHits;
|
---|
566 |
|
---|
567 | FillParticles(candidate, &entry->Particles);
|
---|
568 |
|
---|
569 | }
|
---|
570 | }
|
---|
571 |
|
---|
572 | //------------------------------------------------------------------------------
|
---|
573 |
|
---|
574 | void TreeWriter::ProcessPhotons(ExRootTreeBranch *branch, TObjArray *array)
|
---|
575 | {
|
---|
576 | TIter iterator(array);
|
---|
577 | Candidate *candidate = 0;
|
---|
578 | Photon *entry = 0;
|
---|
579 | Double_t pt, signPz, cosTheta, eta, rapidity;
|
---|
580 | const Double_t c_light = 2.99792458E8;
|
---|
581 |
|
---|
582 | array->Sort();
|
---|
583 |
|
---|
584 | // loop over all photons
|
---|
585 | iterator.Reset();
|
---|
586 | while((candidate = static_cast<Candidate *>(iterator.Next())))
|
---|
587 | {
|
---|
588 | TIter it1(candidate->GetCandidates());
|
---|
589 | const TLorentzVector &momentum = candidate->Momentum;
|
---|
590 | const TLorentzVector &position = candidate->Position;
|
---|
591 |
|
---|
592 | pt = momentum.Pt();
|
---|
593 | cosTheta = TMath::Abs(momentum.CosTheta());
|
---|
594 | signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0;
|
---|
595 | eta = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Eta());
|
---|
596 | rapidity = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Rapidity());
|
---|
597 |
|
---|
598 | entry = static_cast<Photon *>(branch->NewEntry());
|
---|
599 |
|
---|
600 | entry->Eta = eta;
|
---|
601 | entry->Phi = momentum.Phi();
|
---|
602 | entry->PT = pt;
|
---|
603 | entry->E = momentum.E();
|
---|
604 | entry->T = position.T() * 1.0E-3 / c_light;
|
---|
605 |
|
---|
606 | // Isolation variables
|
---|
607 |
|
---|
608 | entry->IsolationVar = candidate->IsolationVar;
|
---|
609 | entry->IsolationVarRhoCorr = candidate->IsolationVarRhoCorr;
|
---|
610 | entry->SumPtCharged = candidate->SumPtCharged;
|
---|
611 | entry->SumPtNeutral = candidate->SumPtNeutral;
|
---|
612 | entry->SumPtChargedPU = candidate->SumPtChargedPU;
|
---|
613 | entry->SumPt = candidate->SumPt;
|
---|
614 |
|
---|
615 | entry->EhadOverEem = candidate->Eem > 0.0 ? candidate->Ehad / candidate->Eem : 999.9;
|
---|
616 |
|
---|
617 | // 1: prompt -- 2: non prompt -- 3: fake
|
---|
618 | entry->Status = candidate->Status;
|
---|
619 |
|
---|
620 | FillParticles(candidate, &entry->Particles);
|
---|
621 | }
|
---|
622 | }
|
---|
623 |
|
---|
624 | //------------------------------------------------------------------------------
|
---|
625 |
|
---|
626 | void TreeWriter::ProcessElectrons(ExRootTreeBranch *branch, TObjArray *array)
|
---|
627 | {
|
---|
628 | TIter iterator(array);
|
---|
629 | Candidate *candidate = 0;
|
---|
630 | Electron *entry = 0;
|
---|
631 | Double_t pt, signPz, cosTheta, eta, rapidity;
|
---|
632 | const Double_t c_light = 2.99792458E8;
|
---|
633 |
|
---|
634 | array->Sort();
|
---|
635 |
|
---|
636 | // loop over all electrons
|
---|
637 | iterator.Reset();
|
---|
638 | while((candidate = static_cast<Candidate *>(iterator.Next())))
|
---|
639 | {
|
---|
640 | const TLorentzVector &momentum = candidate->Momentum;
|
---|
641 | const TLorentzVector &position = candidate->Position;
|
---|
642 |
|
---|
643 | pt = momentum.Pt();
|
---|
644 | cosTheta = TMath::Abs(momentum.CosTheta());
|
---|
645 | signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0;
|
---|
646 | eta = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Eta());
|
---|
647 | rapidity = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Rapidity());
|
---|
648 |
|
---|
649 | entry = static_cast<Electron *>(branch->NewEntry());
|
---|
650 |
|
---|
651 | entry->Eta = eta;
|
---|
652 | entry->Phi = momentum.Phi();
|
---|
653 | entry->PT = pt;
|
---|
654 |
|
---|
655 | entry->T = position.T() * 1.0E-3 / c_light;
|
---|
656 |
|
---|
657 | // displacement
|
---|
658 | entry->D0 = candidate->D0;
|
---|
659 | entry->ErrorD0 = candidate->ErrorD0;
|
---|
660 | entry->DZ = candidate->DZ;
|
---|
661 | entry->ErrorDZ = candidate->ErrorDZ;
|
---|
662 |
|
---|
663 | // Isolation variables
|
---|
664 | entry->IsolationVar = candidate->IsolationVar;
|
---|
665 | entry->IsolationVarRhoCorr = candidate->IsolationVarRhoCorr;
|
---|
666 | entry->SumPtCharged = candidate->SumPtCharged;
|
---|
667 | entry->SumPtNeutral = candidate->SumPtNeutral;
|
---|
668 | entry->SumPtChargedPU = candidate->SumPtChargedPU;
|
---|
669 | entry->SumPt = candidate->SumPt;
|
---|
670 |
|
---|
671 | entry->Charge = candidate->Charge;
|
---|
672 |
|
---|
673 | entry->EhadOverEem = 0.0;
|
---|
674 |
|
---|
675 | entry->Particle = candidate->GetCandidates()->At(0);
|
---|
676 | }
|
---|
677 | }
|
---|
678 |
|
---|
679 | //------------------------------------------------------------------------------
|
---|
680 |
|
---|
681 | void TreeWriter::ProcessMuons(ExRootTreeBranch *branch, TObjArray *array)
|
---|
682 | {
|
---|
683 | TIter iterator(array);
|
---|
684 | Candidate *candidate = 0;
|
---|
685 | Muon *entry = 0;
|
---|
686 | Double_t pt, signPz, cosTheta, eta, rapidity;
|
---|
687 |
|
---|
688 | const Double_t c_light = 2.99792458E8;
|
---|
689 |
|
---|
690 | array->Sort();
|
---|
691 |
|
---|
692 | // loop over all muons
|
---|
693 | iterator.Reset();
|
---|
694 | while((candidate = static_cast<Candidate *>(iterator.Next())))
|
---|
695 | {
|
---|
696 | const TLorentzVector &momentum = candidate->Momentum;
|
---|
697 | const TLorentzVector &position = candidate->Position;
|
---|
698 |
|
---|
699 | pt = momentum.Pt();
|
---|
700 | cosTheta = TMath::Abs(momentum.CosTheta());
|
---|
701 | signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0;
|
---|
702 | eta = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Eta());
|
---|
703 | rapidity = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Rapidity());
|
---|
704 |
|
---|
705 | entry = static_cast<Muon *>(branch->NewEntry());
|
---|
706 |
|
---|
707 | entry->SetBit(kIsReferenced);
|
---|
708 | entry->SetUniqueID(candidate->GetUniqueID());
|
---|
709 |
|
---|
710 | entry->Eta = eta;
|
---|
711 | entry->Phi = momentum.Phi();
|
---|
712 | entry->PT = pt;
|
---|
713 |
|
---|
714 | entry->T = position.T() * 1.0E-3 / c_light;
|
---|
715 |
|
---|
716 | // displacement
|
---|
717 | entry->D0 = candidate->D0;
|
---|
718 | entry->ErrorD0 = candidate->ErrorD0;
|
---|
719 | entry->DZ = candidate->DZ;
|
---|
720 | entry->ErrorDZ = candidate->ErrorDZ;
|
---|
721 |
|
---|
722 | // Isolation variables
|
---|
723 |
|
---|
724 | entry->IsolationVar = candidate->IsolationVar;
|
---|
725 | entry->IsolationVarRhoCorr = candidate->IsolationVarRhoCorr;
|
---|
726 | entry->SumPtCharged = candidate->SumPtCharged;
|
---|
727 | entry->SumPtNeutral = candidate->SumPtNeutral;
|
---|
728 | entry->SumPtChargedPU = candidate->SumPtChargedPU;
|
---|
729 | entry->SumPt = candidate->SumPt;
|
---|
730 |
|
---|
731 | entry->Charge = candidate->Charge;
|
---|
732 |
|
---|
733 | entry->Particle = candidate->GetCandidates()->At(0);
|
---|
734 | }
|
---|
735 | }
|
---|
736 |
|
---|
737 | //------------------------------------------------------------------------------
|
---|
738 |
|
---|
739 | void TreeWriter::ProcessJets(ExRootTreeBranch *branch, TObjArray *array)
|
---|
740 | {
|
---|
741 | TIter iterator(array);
|
---|
742 | Candidate *candidate = 0, *constituent = 0;
|
---|
743 | Jet *entry = 0;
|
---|
744 | Double_t pt, signPz, cosTheta, eta, rapidity;
|
---|
745 | Double_t ecalEnergy, hcalEnergy;
|
---|
746 | const Double_t c_light = 2.99792458E8;
|
---|
747 | Int_t i;
|
---|
748 |
|
---|
749 | array->Sort();
|
---|
750 |
|
---|
751 | // loop over all jets
|
---|
752 | iterator.Reset();
|
---|
753 | while((candidate = static_cast<Candidate *>(iterator.Next())))
|
---|
754 | {
|
---|
755 | TIter itConstituents(candidate->GetCandidates());
|
---|
756 |
|
---|
757 | const TLorentzVector &momentum = candidate->Momentum;
|
---|
758 | const TLorentzVector &position = candidate->Position;
|
---|
759 |
|
---|
760 | pt = momentum.Pt();
|
---|
761 | cosTheta = TMath::Abs(momentum.CosTheta());
|
---|
762 | signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0;
|
---|
763 | eta = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Eta());
|
---|
764 | rapidity = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Rapidity());
|
---|
765 |
|
---|
766 | entry = static_cast<Jet *>(branch->NewEntry());
|
---|
767 |
|
---|
768 | entry->Eta = eta;
|
---|
769 | entry->Phi = momentum.Phi();
|
---|
770 | entry->PT = pt;
|
---|
771 |
|
---|
772 | entry->T = position.T() * 1.0E-3 / c_light;
|
---|
773 |
|
---|
774 | entry->Mass = momentum.M();
|
---|
775 |
|
---|
776 | entry->Area = candidate->Area;
|
---|
777 |
|
---|
778 | entry->DeltaEta = candidate->DeltaEta;
|
---|
779 | entry->DeltaPhi = candidate->DeltaPhi;
|
---|
780 |
|
---|
781 | entry->Flavor = candidate->Flavor;
|
---|
782 | entry->FlavorAlgo = candidate->FlavorAlgo;
|
---|
783 | entry->FlavorPhys = candidate->FlavorPhys;
|
---|
784 |
|
---|
785 | entry->BTag = candidate->BTag;
|
---|
786 |
|
---|
787 | entry->BTagAlgo = candidate->BTagAlgo;
|
---|
788 | entry->BTagPhys = candidate->BTagPhys;
|
---|
789 |
|
---|
790 | entry->TauTag = candidate->TauTag;
|
---|
791 | entry->TauWeight = candidate->TauWeight;
|
---|
792 |
|
---|
793 | entry->Charge = candidate->Charge;
|
---|
794 |
|
---|
795 | itConstituents.Reset();
|
---|
796 | entry->Constituents.Clear();
|
---|
797 | ecalEnergy = 0.0;
|
---|
798 | hcalEnergy = 0.0;
|
---|
799 | while((constituent = static_cast<Candidate *>(itConstituents.Next())))
|
---|
800 | {
|
---|
801 | entry->Constituents.Add(constituent);
|
---|
802 | ecalEnergy += constituent->Eem;
|
---|
803 | hcalEnergy += constituent->Ehad;
|
---|
804 | }
|
---|
805 |
|
---|
806 | entry->EhadOverEem = ecalEnergy > 0.0 ? hcalEnergy / ecalEnergy : 999.9;
|
---|
807 |
|
---|
808 | //--- Pile-Up Jet ID variables ----
|
---|
809 |
|
---|
810 | entry->NCharged = candidate->NCharged;
|
---|
811 | entry->NNeutrals = candidate->NNeutrals;
|
---|
812 |
|
---|
813 | entry->NeutralEnergyFraction = candidate->NeutralEnergyFraction;
|
---|
814 | entry->ChargedEnergyFraction = candidate->ChargedEnergyFraction;
|
---|
815 | entry->Beta = candidate->Beta;
|
---|
816 | entry->BetaStar = candidate->BetaStar;
|
---|
817 | entry->MeanSqDeltaR = candidate->MeanSqDeltaR;
|
---|
818 | entry->PTD = candidate->PTD;
|
---|
819 |
|
---|
820 | //--- Sub-structure variables ----
|
---|
821 |
|
---|
822 | entry->NSubJetsTrimmed = candidate->NSubJetsTrimmed;
|
---|
823 | entry->NSubJetsPruned = candidate->NSubJetsPruned;
|
---|
824 | entry->NSubJetsSoftDropped = candidate->NSubJetsSoftDropped;
|
---|
825 |
|
---|
826 | entry->SoftDroppedJet = candidate->SoftDroppedJet;
|
---|
827 | entry->SoftDroppedSubJet1 = candidate->SoftDroppedSubJet1;
|
---|
828 | entry->SoftDroppedSubJet2 = candidate->SoftDroppedSubJet2;
|
---|
829 |
|
---|
830 | for(i = 0; i < 5; i++)
|
---|
831 | {
|
---|
832 | entry->FracPt[i] = candidate->FracPt[i];
|
---|
833 | entry->Tau[i] = candidate->Tau[i];
|
---|
834 | entry->TrimmedP4[i] = candidate->TrimmedP4[i];
|
---|
835 | entry->PrunedP4[i] = candidate->PrunedP4[i];
|
---|
836 | entry->SoftDroppedP4[i] = candidate->SoftDroppedP4[i];
|
---|
837 | }
|
---|
838 |
|
---|
839 | //--- exclusive clustering variables ---
|
---|
840 | entry->ExclYmerge23 = candidate->ExclYmerge23;
|
---|
841 | entry->ExclYmerge34 = candidate->ExclYmerge34;
|
---|
842 | entry->ExclYmerge45 = candidate->ExclYmerge45;
|
---|
843 | entry->ExclYmerge56 = candidate->ExclYmerge56;
|
---|
844 |
|
---|
845 | FillParticles(candidate, &entry->Particles);
|
---|
846 | }
|
---|
847 | }
|
---|
848 |
|
---|
849 | //------------------------------------------------------------------------------
|
---|
850 |
|
---|
851 | void TreeWriter::ProcessMissingET(ExRootTreeBranch *branch, TObjArray *array)
|
---|
852 | {
|
---|
853 | Candidate *candidate = 0;
|
---|
854 | MissingET *entry = 0;
|
---|
855 |
|
---|
856 | // get the first entry
|
---|
857 | if((candidate = static_cast<Candidate *>(array->At(0))))
|
---|
858 | {
|
---|
859 | const TLorentzVector &momentum = candidate->Momentum;
|
---|
860 |
|
---|
861 | entry = static_cast<MissingET *>(branch->NewEntry());
|
---|
862 |
|
---|
863 | entry->Eta = (-momentum).Eta();
|
---|
864 | entry->Phi = (-momentum).Phi();
|
---|
865 | entry->MET = momentum.Pt();
|
---|
866 | }
|
---|
867 | }
|
---|
868 |
|
---|
869 | //------------------------------------------------------------------------------
|
---|
870 |
|
---|
871 | void TreeWriter::ProcessScalarHT(ExRootTreeBranch *branch, TObjArray *array)
|
---|
872 | {
|
---|
873 | Candidate *candidate = 0;
|
---|
874 | ScalarHT *entry = 0;
|
---|
875 |
|
---|
876 | // get the first entry
|
---|
877 | if((candidate = static_cast<Candidate *>(array->At(0))))
|
---|
878 | {
|
---|
879 | const TLorentzVector &momentum = candidate->Momentum;
|
---|
880 |
|
---|
881 | entry = static_cast<ScalarHT *>(branch->NewEntry());
|
---|
882 |
|
---|
883 | entry->HT = momentum.Pt();
|
---|
884 | }
|
---|
885 | }
|
---|
886 |
|
---|
887 | //------------------------------------------------------------------------------
|
---|
888 |
|
---|
889 | void TreeWriter::ProcessRho(ExRootTreeBranch *branch, TObjArray *array)
|
---|
890 | {
|
---|
891 | TIter iterator(array);
|
---|
892 | Candidate *candidate = 0;
|
---|
893 | Rho *entry = 0;
|
---|
894 |
|
---|
895 | // loop over all rho
|
---|
896 | iterator.Reset();
|
---|
897 | while((candidate = static_cast<Candidate *>(iterator.Next())))
|
---|
898 | {
|
---|
899 | const TLorentzVector &momentum = candidate->Momentum;
|
---|
900 |
|
---|
901 | entry = static_cast<Rho *>(branch->NewEntry());
|
---|
902 |
|
---|
903 | entry->Rho = momentum.E();
|
---|
904 | entry->Edges[0] = candidate->Edges[0];
|
---|
905 | entry->Edges[1] = candidate->Edges[1];
|
---|
906 | }
|
---|
907 | }
|
---|
908 |
|
---|
909 | //------------------------------------------------------------------------------
|
---|
910 |
|
---|
911 | void TreeWriter::ProcessWeight(ExRootTreeBranch *branch, TObjArray *array)
|
---|
912 | {
|
---|
913 | Candidate *candidate = 0;
|
---|
914 | Weight *entry = 0;
|
---|
915 |
|
---|
916 | // get the first entry
|
---|
917 | if((candidate = static_cast<Candidate *>(array->At(0))))
|
---|
918 | {
|
---|
919 | const TLorentzVector &momentum = candidate->Momentum;
|
---|
920 |
|
---|
921 | entry = static_cast<Weight *>(branch->NewEntry());
|
---|
922 |
|
---|
923 | entry->Weight = momentum.E();
|
---|
924 | }
|
---|
925 | }
|
---|
926 |
|
---|
927 | //------------------------------------------------------------------------------
|
---|
928 |
|
---|
929 | void TreeWriter::ProcessHectorHit(ExRootTreeBranch *branch, TObjArray *array)
|
---|
930 | {
|
---|
931 | TIter iterator(array);
|
---|
932 | Candidate *candidate = 0;
|
---|
933 | HectorHit *entry = 0;
|
---|
934 |
|
---|
935 | // loop over all roman pot hits
|
---|
936 | iterator.Reset();
|
---|
937 | while((candidate = static_cast<Candidate *>(iterator.Next())))
|
---|
938 | {
|
---|
939 | const TLorentzVector &position = candidate->Position;
|
---|
940 | const TLorentzVector &momentum = candidate->Momentum;
|
---|
941 |
|
---|
942 | entry = static_cast<HectorHit *>(branch->NewEntry());
|
---|
943 |
|
---|
944 | entry->E = momentum.E();
|
---|
945 |
|
---|
946 | entry->Tx = momentum.Px();
|
---|
947 | entry->Ty = momentum.Py();
|
---|
948 |
|
---|
949 | entry->T = position.T();
|
---|
950 |
|
---|
951 | entry->X = position.X();
|
---|
952 | entry->Y = position.Y();
|
---|
953 | entry->S = position.Z();
|
---|
954 |
|
---|
955 | entry->Particle = candidate->GetCandidates()->At(0);
|
---|
956 | }
|
---|
957 | }
|
---|
958 |
|
---|
959 | //------------------------------------------------------------------------------
|
---|
960 |
|
---|
961 | void TreeWriter::Process()
|
---|
962 | {
|
---|
963 | TBranchMap::iterator itBranchMap;
|
---|
964 | ExRootTreeBranch *branch;
|
---|
965 | TProcessMethod method;
|
---|
966 | TObjArray *array;
|
---|
967 |
|
---|
968 | for(itBranchMap = fBranchMap.begin(); itBranchMap != fBranchMap.end(); ++itBranchMap)
|
---|
969 | {
|
---|
970 | branch = itBranchMap->first;
|
---|
971 | method = itBranchMap->second.first;
|
---|
972 | array = itBranchMap->second.second;
|
---|
973 |
|
---|
974 | (this->*method)(branch, array);
|
---|
975 | }
|
---|
976 | }
|
---|
977 |
|
---|
978 | //------------------------------------------------------------------------------
|
---|