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 | param = GetParam("Info");
|
---|
127 | TString infoName;
|
---|
128 | Double_t infoValue;
|
---|
129 |
|
---|
130 | size = param.GetSize();
|
---|
131 | for(i = 0; i < size / 2; ++i)
|
---|
132 | {
|
---|
133 | infoName = param[i * 2].GetString();
|
---|
134 | infoValue = param[i * 2 + 1].GetDouble();
|
---|
135 |
|
---|
136 | AddInfo(infoName, infoValue);
|
---|
137 | }
|
---|
138 | }
|
---|
139 |
|
---|
140 | //------------------------------------------------------------------------------
|
---|
141 |
|
---|
142 | void TreeWriter::Finish()
|
---|
143 | {
|
---|
144 | }
|
---|
145 |
|
---|
146 | //------------------------------------------------------------------------------
|
---|
147 |
|
---|
148 | void TreeWriter::FillParticles(Candidate *candidate, TRefArray *array)
|
---|
149 | {
|
---|
150 | TIter it1(candidate->GetCandidates());
|
---|
151 | it1.Reset();
|
---|
152 | array->Clear();
|
---|
153 |
|
---|
154 | while((candidate = static_cast<Candidate *>(it1.Next())))
|
---|
155 | {
|
---|
156 | TIter it2(candidate->GetCandidates());
|
---|
157 |
|
---|
158 | // particle
|
---|
159 | if(candidate->GetCandidates()->GetEntriesFast() == 0)
|
---|
160 | {
|
---|
161 | array->Add(candidate);
|
---|
162 | continue;
|
---|
163 | }
|
---|
164 |
|
---|
165 | // track
|
---|
166 | candidate = static_cast<Candidate *>(candidate->GetCandidates()->At(0));
|
---|
167 | if(candidate->GetCandidates()->GetEntriesFast() == 0)
|
---|
168 | {
|
---|
169 | array->Add(candidate);
|
---|
170 | continue;
|
---|
171 | }
|
---|
172 |
|
---|
173 | // tower
|
---|
174 | it2.Reset();
|
---|
175 | while((candidate = static_cast<Candidate *>(it2.Next())))
|
---|
176 | {
|
---|
177 | array->Add(candidate->GetCandidates()->At(0));
|
---|
178 | }
|
---|
179 | }
|
---|
180 | }
|
---|
181 |
|
---|
182 | //------------------------------------------------------------------------------
|
---|
183 |
|
---|
184 | void TreeWriter::ProcessParticles(ExRootTreeBranch *branch, TObjArray *array)
|
---|
185 | {
|
---|
186 | TIter iterator(array);
|
---|
187 | Candidate *candidate = 0;
|
---|
188 | GenParticle *entry = 0;
|
---|
189 | Double_t pt, signPz, cosTheta, eta, rapidity;
|
---|
190 |
|
---|
191 | const Double_t c_light = 2.99792458E8;
|
---|
192 |
|
---|
193 | // loop over all particles
|
---|
194 | iterator.Reset();
|
---|
195 | while((candidate = static_cast<Candidate *>(iterator.Next())))
|
---|
196 | {
|
---|
197 | const TLorentzVector &momentum = candidate->Momentum;
|
---|
198 | const TLorentzVector &position = candidate->Position;
|
---|
199 |
|
---|
200 | entry = static_cast<GenParticle *>(branch->NewEntry());
|
---|
201 |
|
---|
202 | entry->SetBit(kIsReferenced);
|
---|
203 | entry->SetUniqueID(candidate->GetUniqueID());
|
---|
204 |
|
---|
205 | pt = momentum.Pt();
|
---|
206 | cosTheta = TMath::Abs(momentum.CosTheta());
|
---|
207 | signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0;
|
---|
208 | eta = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Eta());
|
---|
209 | rapidity = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Rapidity());
|
---|
210 |
|
---|
211 | entry->PID = candidate->PID;
|
---|
212 |
|
---|
213 | entry->Status = candidate->Status;
|
---|
214 | entry->IsPU = candidate->IsPU;
|
---|
215 |
|
---|
216 | entry->M1 = candidate->M1;
|
---|
217 | entry->M2 = candidate->M2;
|
---|
218 |
|
---|
219 | entry->D1 = candidate->D1;
|
---|
220 | entry->D2 = candidate->D2;
|
---|
221 |
|
---|
222 | entry->Charge = candidate->Charge;
|
---|
223 | entry->Mass = candidate->Mass;
|
---|
224 |
|
---|
225 | entry->E = momentum.E();
|
---|
226 | entry->Px = momentum.Px();
|
---|
227 | entry->Py = momentum.Py();
|
---|
228 | entry->Pz = momentum.Pz();
|
---|
229 |
|
---|
230 | entry->Eta = eta;
|
---|
231 | entry->Phi = momentum.Phi();
|
---|
232 | entry->PT = pt;
|
---|
233 |
|
---|
234 | entry->Rapidity = rapidity;
|
---|
235 |
|
---|
236 | entry->X = position.X();
|
---|
237 | entry->Y = position.Y();
|
---|
238 | entry->Z = position.Z();
|
---|
239 | entry->T = position.T() * 1.0E-3 / c_light;
|
---|
240 | }
|
---|
241 | }
|
---|
242 |
|
---|
243 | //------------------------------------------------------------------------------
|
---|
244 |
|
---|
245 | void TreeWriter::ProcessVertices(ExRootTreeBranch *branch, TObjArray *array)
|
---|
246 | {
|
---|
247 | TIter iterator(array);
|
---|
248 | Candidate *candidate = 0, *constituent = 0;
|
---|
249 | Vertex *entry = 0;
|
---|
250 |
|
---|
251 | const Double_t c_light = 2.99792458E8;
|
---|
252 |
|
---|
253 | Double_t x, y, z, t, xError, yError, zError, tError, sigma, sumPT2, btvSumPT2, genDeltaZ, genSumPT2;
|
---|
254 | UInt_t index, ndf;
|
---|
255 |
|
---|
256 | CompBase *compare = Candidate::fgCompare;
|
---|
257 | Candidate::fgCompare = CompSumPT2<Candidate>::Instance();
|
---|
258 | array->Sort();
|
---|
259 | Candidate::fgCompare = compare;
|
---|
260 |
|
---|
261 | // loop over all vertices
|
---|
262 | iterator.Reset();
|
---|
263 | while((candidate = static_cast<Candidate *>(iterator.Next())))
|
---|
264 | {
|
---|
265 |
|
---|
266 | index = candidate->ClusterIndex;
|
---|
267 | ndf = candidate->ClusterNDF;
|
---|
268 | sigma = candidate->ClusterSigma;
|
---|
269 | sumPT2 = candidate->SumPT2;
|
---|
270 | btvSumPT2 = candidate->BTVSumPT2;
|
---|
271 | genDeltaZ = candidate->GenDeltaZ;
|
---|
272 | genSumPT2 = candidate->GenSumPT2;
|
---|
273 |
|
---|
274 | x = candidate->Position.X();
|
---|
275 | y = candidate->Position.Y();
|
---|
276 | z = candidate->Position.Z();
|
---|
277 | t = candidate->Position.T() * 1.0E-3 / c_light;
|
---|
278 |
|
---|
279 | xError = candidate->PositionError.X();
|
---|
280 | yError = candidate->PositionError.Y();
|
---|
281 | zError = candidate->PositionError.Z();
|
---|
282 | tError = candidate->PositionError.T() * 1.0E-3 / c_light;
|
---|
283 |
|
---|
284 | entry = static_cast<Vertex *>(branch->NewEntry());
|
---|
285 |
|
---|
286 | entry->Index = index;
|
---|
287 | entry->NDF = ndf;
|
---|
288 | entry->Sigma = sigma;
|
---|
289 | entry->SumPT2 = sumPT2;
|
---|
290 | entry->BTVSumPT2 = btvSumPT2;
|
---|
291 | entry->GenDeltaZ = genDeltaZ;
|
---|
292 | entry->GenSumPT2 = genSumPT2;
|
---|
293 |
|
---|
294 | entry->X = x;
|
---|
295 | entry->Y = y;
|
---|
296 | entry->Z = z;
|
---|
297 | entry->T = t;
|
---|
298 |
|
---|
299 | entry->ErrorX = xError;
|
---|
300 | entry->ErrorY = yError;
|
---|
301 | entry->ErrorZ = zError;
|
---|
302 | entry->ErrorT = tError;
|
---|
303 |
|
---|
304 | TIter itConstituents(candidate->GetCandidates());
|
---|
305 | itConstituents.Reset();
|
---|
306 | entry->Constituents.Clear();
|
---|
307 | while((constituent = static_cast<Candidate *>(itConstituents.Next())))
|
---|
308 | {
|
---|
309 | entry->Constituents.Add(constituent);
|
---|
310 | }
|
---|
311 | }
|
---|
312 | }
|
---|
313 |
|
---|
314 | //------------------------------------------------------------------------------
|
---|
315 |
|
---|
316 | void TreeWriter::ProcessTracks(ExRootTreeBranch *branch, TObjArray *array)
|
---|
317 | {
|
---|
318 | TIter iterator(array);
|
---|
319 | Candidate *candidate = 0;
|
---|
320 | Candidate *particle = 0;
|
---|
321 | Track *entry = 0;
|
---|
322 | Double_t pt, signz, cosTheta, eta, rapidity, p, ctgTheta, phi, m;
|
---|
323 | const Double_t c_light = 2.99792458E8;
|
---|
324 |
|
---|
325 | // loop over all tracks
|
---|
326 | iterator.Reset();
|
---|
327 | while((candidate = static_cast<Candidate *>(iterator.Next())))
|
---|
328 | {
|
---|
329 | const TLorentzVector &position = candidate->Position;
|
---|
330 |
|
---|
331 | cosTheta = TMath::Abs(position.CosTheta());
|
---|
332 | signz = (position.Pz() >= 0.0) ? 1.0 : -1.0;
|
---|
333 | eta = (cosTheta == 1.0 ? signz * 999.9 : position.Eta());
|
---|
334 | rapidity = (cosTheta == 1.0 ? signz * 999.9 : position.Rapidity());
|
---|
335 |
|
---|
336 | entry = static_cast<Track *>(branch->NewEntry());
|
---|
337 |
|
---|
338 | entry->SetBit(kIsReferenced);
|
---|
339 | entry->SetUniqueID(candidate->GetUniqueID());
|
---|
340 |
|
---|
341 | entry->PID = candidate->PID;
|
---|
342 |
|
---|
343 | entry->Charge = candidate->Charge;
|
---|
344 |
|
---|
345 | entry->EtaOuter = eta;
|
---|
346 | entry->PhiOuter = position.Phi();
|
---|
347 |
|
---|
348 | entry->XOuter = position.X();
|
---|
349 | entry->YOuter = position.Y();
|
---|
350 | entry->ZOuter = position.Z();
|
---|
351 | entry->TOuter = position.T() * 1.0E-3 / c_light;
|
---|
352 |
|
---|
353 | entry->L = candidate->L;
|
---|
354 |
|
---|
355 | entry->D0 = candidate->D0;
|
---|
356 | entry->DZ = candidate->DZ;
|
---|
357 | entry->Nclusters = candidate->Nclusters;
|
---|
358 |
|
---|
359 | entry->ErrorP = candidate->ErrorP;
|
---|
360 | entry->ErrorPT = candidate->ErrorPT;
|
---|
361 |
|
---|
362 | // diagonal covariance matrix terms
|
---|
363 | entry->ErrorD0 = candidate->ErrorD0;
|
---|
364 | entry->ErrorC = candidate->ErrorC;
|
---|
365 | entry->ErrorPhi = candidate->ErrorPhi;
|
---|
366 | entry->ErrorDZ = candidate->ErrorDZ;
|
---|
367 | entry->ErrorCtgTheta = candidate->ErrorCtgTheta;
|
---|
368 |
|
---|
369 | // add some offdiagonal covariance matrix elements
|
---|
370 | entry->ErrorD0Phi = candidate->TrackCovariance(0,1);
|
---|
371 | entry->ErrorD0C = candidate->TrackCovariance(0,2);
|
---|
372 | entry->ErrorD0DZ = candidate->TrackCovariance(0,3);
|
---|
373 | entry->ErrorD0CtgTheta = candidate->TrackCovariance(0,4);
|
---|
374 | entry->ErrorPhiC = candidate->TrackCovariance(1,2);
|
---|
375 | entry->ErrorPhiDZ = candidate->TrackCovariance(1,3);
|
---|
376 | entry->ErrorPhiCtgTheta = candidate->TrackCovariance(1,4);
|
---|
377 | entry->ErrorCDZ = candidate->TrackCovariance(2,3);
|
---|
378 | entry->ErrorCCtgTheta = candidate->TrackCovariance(2,4);
|
---|
379 | entry->ErrorDZCtgTheta = candidate->TrackCovariance(3,4);
|
---|
380 |
|
---|
381 | entry->Xd = candidate->Xd;
|
---|
382 | entry->Yd = candidate->Yd;
|
---|
383 | entry->Zd = candidate->Zd;
|
---|
384 |
|
---|
385 | const TLorentzVector &momentum = candidate->Momentum;
|
---|
386 |
|
---|
387 | pt = momentum.Pt();
|
---|
388 | p = momentum.P();
|
---|
389 | phi = momentum.Phi();
|
---|
390 | m = momentum.M();
|
---|
391 | ctgTheta = (TMath::Tan(momentum.Theta()) != 0) ? 1 / TMath::Tan(momentum.Theta()) : 1e10;
|
---|
392 |
|
---|
393 | cosTheta = TMath::Abs(momentum.CosTheta());
|
---|
394 | signz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0;
|
---|
395 | eta = (cosTheta == 1.0 ? signz * 999.9 : momentum.Eta());
|
---|
396 | rapidity = (cosTheta == 1.0 ? signz * 999.9 : momentum.Rapidity());
|
---|
397 |
|
---|
398 | entry->P = p;
|
---|
399 | entry->PT = pt;
|
---|
400 | entry->Eta = eta;
|
---|
401 | entry->Phi = phi;
|
---|
402 | entry->CtgTheta = ctgTheta;
|
---|
403 | entry->C = candidate->C;
|
---|
404 | entry->Mass = m;
|
---|
405 |
|
---|
406 | particle = static_cast<Candidate *>(candidate->GetCandidates()->At(0));
|
---|
407 | const TLorentzVector &initialPosition = particle->Position;
|
---|
408 |
|
---|
409 | entry->X = initialPosition.X();
|
---|
410 | entry->Y = initialPosition.Y();
|
---|
411 | entry->Z = initialPosition.Z();
|
---|
412 | entry->T = initialPosition.T() * 1.0E-3 / c_light;
|
---|
413 |
|
---|
414 | entry->Particle = particle;
|
---|
415 |
|
---|
416 | entry->VertexIndex = candidate->ClusterIndex;
|
---|
417 | }
|
---|
418 | }
|
---|
419 |
|
---|
420 | //------------------------------------------------------------------------------
|
---|
421 |
|
---|
422 | void TreeWriter::ProcessTowers(ExRootTreeBranch *branch, TObjArray *array)
|
---|
423 | {
|
---|
424 | TIter iterator(array);
|
---|
425 | Candidate *candidate = 0;
|
---|
426 | Tower *entry = 0;
|
---|
427 | Double_t pt, signPz, cosTheta, eta, rapidity;
|
---|
428 | const Double_t c_light = 2.99792458E8;
|
---|
429 |
|
---|
430 | // loop over all towers
|
---|
431 | iterator.Reset();
|
---|
432 | while((candidate = static_cast<Candidate *>(iterator.Next())))
|
---|
433 | {
|
---|
434 | const TLorentzVector &momentum = candidate->Momentum;
|
---|
435 | const TLorentzVector &position = candidate->Position;
|
---|
436 |
|
---|
437 | pt = momentum.Pt();
|
---|
438 | cosTheta = TMath::Abs(momentum.CosTheta());
|
---|
439 | signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0;
|
---|
440 | eta = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Eta());
|
---|
441 | rapidity = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Rapidity());
|
---|
442 |
|
---|
443 | entry = static_cast<Tower *>(branch->NewEntry());
|
---|
444 |
|
---|
445 | entry->SetBit(kIsReferenced);
|
---|
446 | entry->SetUniqueID(candidate->GetUniqueID());
|
---|
447 |
|
---|
448 | entry->Eta = eta;
|
---|
449 | entry->Phi = momentum.Phi();
|
---|
450 | entry->ET = pt;
|
---|
451 | entry->E = momentum.E();
|
---|
452 | entry->Eem = candidate->Eem;
|
---|
453 | entry->Ehad = candidate->Ehad;
|
---|
454 | entry->Edges[0] = candidate->Edges[0];
|
---|
455 | entry->Edges[1] = candidate->Edges[1];
|
---|
456 | entry->Edges[2] = candidate->Edges[2];
|
---|
457 | entry->Edges[3] = candidate->Edges[3];
|
---|
458 |
|
---|
459 | entry->T = position.T() * 1.0E-3 / c_light;
|
---|
460 | entry->NTimeHits = candidate->NTimeHits;
|
---|
461 |
|
---|
462 | FillParticles(candidate, &entry->Particles);
|
---|
463 | }
|
---|
464 | }
|
---|
465 |
|
---|
466 | //------------------------------------------------------------------------------
|
---|
467 |
|
---|
468 | void TreeWriter::ProcessParticleFlowCandidates(ExRootTreeBranch *branch, TObjArray *array)
|
---|
469 | {
|
---|
470 |
|
---|
471 | TIter iterator(array);
|
---|
472 | Candidate *candidate = 0;
|
---|
473 | Candidate *particle = 0;
|
---|
474 | ParticleFlowCandidate *entry = 0;
|
---|
475 | Double_t e, pt, signz, cosTheta, eta, rapidity, p, ctgTheta, phi, m;
|
---|
476 | const Double_t c_light = 2.99792458E8;
|
---|
477 |
|
---|
478 | // loop over all tracks
|
---|
479 | iterator.Reset();
|
---|
480 | while((candidate = static_cast<Candidate *>(iterator.Next())))
|
---|
481 | {
|
---|
482 | const TLorentzVector &position = candidate->Position;
|
---|
483 |
|
---|
484 | cosTheta = TMath::Abs(position.CosTheta());
|
---|
485 | signz = (position.Pz() >= 0.0) ? 1.0 : -1.0;
|
---|
486 | eta = (cosTheta == 1.0 ? signz * 999.9 : position.Eta());
|
---|
487 | rapidity = (cosTheta == 1.0 ? signz * 999.9 : position.Rapidity());
|
---|
488 |
|
---|
489 | entry = static_cast<ParticleFlowCandidate *>(branch->NewEntry());
|
---|
490 |
|
---|
491 | entry->SetBit(kIsReferenced);
|
---|
492 | entry->SetUniqueID(candidate->GetUniqueID());
|
---|
493 |
|
---|
494 | entry->PID = candidate->PID;
|
---|
495 |
|
---|
496 | entry->Charge = candidate->Charge;
|
---|
497 |
|
---|
498 | entry->EtaOuter = eta;
|
---|
499 | entry->PhiOuter = position.Phi();
|
---|
500 |
|
---|
501 | entry->XOuter = position.X();
|
---|
502 | entry->YOuter = position.Y();
|
---|
503 | entry->ZOuter = position.Z();
|
---|
504 | entry->TOuter = position.T() * 1.0E-3 / c_light;
|
---|
505 |
|
---|
506 | entry->L = candidate->L;
|
---|
507 |
|
---|
508 | entry->D0 = candidate->D0;
|
---|
509 | entry->DZ = candidate->DZ;
|
---|
510 | entry->Nclusters = candidate->Nclusters;
|
---|
511 |
|
---|
512 | entry->ErrorP = candidate->ErrorP;
|
---|
513 | entry->ErrorPT = candidate->ErrorPT;
|
---|
514 | entry->ErrorCtgTheta = candidate->ErrorCtgTheta;
|
---|
515 |
|
---|
516 |
|
---|
517 | // diagonal covariance matrix terms
|
---|
518 |
|
---|
519 | entry->ErrorD0 = candidate->ErrorD0;
|
---|
520 | entry->ErrorC = candidate->ErrorC;
|
---|
521 | entry->ErrorPhi = candidate->ErrorPhi;
|
---|
522 | entry->ErrorDZ = candidate->ErrorDZ;
|
---|
523 | entry->ErrorCtgTheta = candidate->ErrorCtgTheta;
|
---|
524 |
|
---|
525 | // add some offdiagonal covariance matrix elements
|
---|
526 | entry->ErrorD0Phi = candidate->TrackCovariance(0,1);
|
---|
527 | entry->ErrorD0C = candidate->TrackCovariance(0,2);
|
---|
528 | entry->ErrorD0DZ = candidate->TrackCovariance(0,3);
|
---|
529 | entry->ErrorD0CtgTheta = candidate->TrackCovariance(0,4);
|
---|
530 | entry->ErrorPhiC = candidate->TrackCovariance(1,2);
|
---|
531 | entry->ErrorPhiDZ = candidate->TrackCovariance(1,3);
|
---|
532 | entry->ErrorPhiCtgTheta = candidate->TrackCovariance(1,4);
|
---|
533 | entry->ErrorCDZ = candidate->TrackCovariance(2,3);
|
---|
534 | entry->ErrorCCtgTheta = candidate->TrackCovariance(2,4);
|
---|
535 | entry->ErrorDZCtgTheta = candidate->TrackCovariance(3,4);
|
---|
536 |
|
---|
537 | entry->Xd = candidate->Xd;
|
---|
538 | entry->Yd = candidate->Yd;
|
---|
539 | entry->Zd = candidate->Zd;
|
---|
540 |
|
---|
541 | const TLorentzVector &momentum = candidate->Momentum;
|
---|
542 |
|
---|
543 | e = momentum.E();
|
---|
544 | pt = momentum.Pt();
|
---|
545 | p = momentum.P();
|
---|
546 | phi = momentum.Phi();
|
---|
547 | m = momentum.M();
|
---|
548 | ctgTheta = (TMath::Tan(momentum.Theta()) != 0) ? 1 / TMath::Tan(momentum.Theta()) : 1e10;
|
---|
549 |
|
---|
550 | entry->E = e;
|
---|
551 | entry->P = p;
|
---|
552 | entry->PT = pt;
|
---|
553 | entry->Eta = eta;
|
---|
554 | entry->Phi = phi;
|
---|
555 | entry->CtgTheta = ctgTheta;
|
---|
556 | entry->C = candidate->C;
|
---|
557 | entry->Mass = m;
|
---|
558 |
|
---|
559 | particle = static_cast<Candidate *>(candidate->GetCandidates()->At(0));
|
---|
560 | const TLorentzVector &initialPosition = particle->Position;
|
---|
561 |
|
---|
562 | entry->X = initialPosition.X();
|
---|
563 | entry->Y = initialPosition.Y();
|
---|
564 | entry->Z = initialPosition.Z();
|
---|
565 | entry->T = initialPosition.T() * 1.0E-3 / c_light;
|
---|
566 |
|
---|
567 | entry->VertexIndex = candidate->ClusterIndex;
|
---|
568 |
|
---|
569 | entry->Eem = candidate->Eem;
|
---|
570 | entry->Ehad = candidate->Ehad;
|
---|
571 | entry->Edges[0] = candidate->Edges[0];
|
---|
572 | entry->Edges[1] = candidate->Edges[1];
|
---|
573 | entry->Edges[2] = candidate->Edges[2];
|
---|
574 | entry->Edges[3] = candidate->Edges[3];
|
---|
575 |
|
---|
576 | entry->T = position.T() * 1.0E-3 / c_light;
|
---|
577 | entry->NTimeHits = candidate->NTimeHits;
|
---|
578 |
|
---|
579 | FillParticles(candidate, &entry->Particles);
|
---|
580 |
|
---|
581 | }
|
---|
582 | }
|
---|
583 |
|
---|
584 | //------------------------------------------------------------------------------
|
---|
585 |
|
---|
586 | void TreeWriter::ProcessPhotons(ExRootTreeBranch *branch, TObjArray *array)
|
---|
587 | {
|
---|
588 | TIter iterator(array);
|
---|
589 | Candidate *candidate = 0;
|
---|
590 | Photon *entry = 0;
|
---|
591 | Double_t pt, signPz, cosTheta, eta, rapidity;
|
---|
592 | const Double_t c_light = 2.99792458E8;
|
---|
593 |
|
---|
594 | array->Sort();
|
---|
595 |
|
---|
596 | // loop over all photons
|
---|
597 | iterator.Reset();
|
---|
598 | while((candidate = static_cast<Candidate *>(iterator.Next())))
|
---|
599 | {
|
---|
600 | TIter it1(candidate->GetCandidates());
|
---|
601 | const TLorentzVector &momentum = candidate->Momentum;
|
---|
602 | const TLorentzVector &position = candidate->Position;
|
---|
603 |
|
---|
604 | pt = momentum.Pt();
|
---|
605 | cosTheta = TMath::Abs(momentum.CosTheta());
|
---|
606 | signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0;
|
---|
607 | eta = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Eta());
|
---|
608 | rapidity = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Rapidity());
|
---|
609 |
|
---|
610 | entry = static_cast<Photon *>(branch->NewEntry());
|
---|
611 |
|
---|
612 | entry->Eta = eta;
|
---|
613 | entry->Phi = momentum.Phi();
|
---|
614 | entry->PT = pt;
|
---|
615 | entry->E = momentum.E();
|
---|
616 | entry->T = position.T() * 1.0E-3 / c_light;
|
---|
617 |
|
---|
618 | // Isolation variables
|
---|
619 |
|
---|
620 | entry->IsolationVar = candidate->IsolationVar;
|
---|
621 | entry->IsolationVarRhoCorr = candidate->IsolationVarRhoCorr;
|
---|
622 | entry->SumPtCharged = candidate->SumPtCharged;
|
---|
623 | entry->SumPtNeutral = candidate->SumPtNeutral;
|
---|
624 | entry->SumPtChargedPU = candidate->SumPtChargedPU;
|
---|
625 | entry->SumPt = candidate->SumPt;
|
---|
626 |
|
---|
627 | entry->EhadOverEem = candidate->Eem > 0.0 ? candidate->Ehad / candidate->Eem : 999.9;
|
---|
628 |
|
---|
629 | // 1: prompt -- 2: non prompt -- 3: fake
|
---|
630 | entry->Status = candidate->Status;
|
---|
631 |
|
---|
632 | FillParticles(candidate, &entry->Particles);
|
---|
633 | }
|
---|
634 | }
|
---|
635 |
|
---|
636 | //------------------------------------------------------------------------------
|
---|
637 |
|
---|
638 | void TreeWriter::ProcessElectrons(ExRootTreeBranch *branch, TObjArray *array)
|
---|
639 | {
|
---|
640 | TIter iterator(array);
|
---|
641 | Candidate *candidate = 0;
|
---|
642 | Electron *entry = 0;
|
---|
643 | Double_t pt, signPz, cosTheta, eta, rapidity;
|
---|
644 | const Double_t c_light = 2.99792458E8;
|
---|
645 |
|
---|
646 | array->Sort();
|
---|
647 |
|
---|
648 | // loop over all electrons
|
---|
649 | iterator.Reset();
|
---|
650 | while((candidate = static_cast<Candidate *>(iterator.Next())))
|
---|
651 | {
|
---|
652 | const TLorentzVector &momentum = candidate->Momentum;
|
---|
653 | const TLorentzVector &position = candidate->Position;
|
---|
654 |
|
---|
655 | pt = momentum.Pt();
|
---|
656 | cosTheta = TMath::Abs(momentum.CosTheta());
|
---|
657 | signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0;
|
---|
658 | eta = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Eta());
|
---|
659 | rapidity = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Rapidity());
|
---|
660 |
|
---|
661 | entry = static_cast<Electron *>(branch->NewEntry());
|
---|
662 |
|
---|
663 | entry->Eta = eta;
|
---|
664 | entry->Phi = momentum.Phi();
|
---|
665 | entry->PT = pt;
|
---|
666 |
|
---|
667 | entry->T = position.T() * 1.0E-3 / c_light;
|
---|
668 |
|
---|
669 | // displacement
|
---|
670 | entry->D0 = candidate->D0;
|
---|
671 | entry->ErrorD0 = candidate->ErrorD0;
|
---|
672 | entry->DZ = candidate->DZ;
|
---|
673 | entry->ErrorDZ = candidate->ErrorDZ;
|
---|
674 |
|
---|
675 | // Isolation variables
|
---|
676 | entry->IsolationVar = candidate->IsolationVar;
|
---|
677 | entry->IsolationVarRhoCorr = candidate->IsolationVarRhoCorr;
|
---|
678 | entry->SumPtCharged = candidate->SumPtCharged;
|
---|
679 | entry->SumPtNeutral = candidate->SumPtNeutral;
|
---|
680 | entry->SumPtChargedPU = candidate->SumPtChargedPU;
|
---|
681 | entry->SumPt = candidate->SumPt;
|
---|
682 |
|
---|
683 | entry->Charge = candidate->Charge;
|
---|
684 |
|
---|
685 | entry->EhadOverEem = 0.0;
|
---|
686 |
|
---|
687 | entry->Particle = candidate->GetCandidates()->At(0);
|
---|
688 | }
|
---|
689 | }
|
---|
690 |
|
---|
691 | //------------------------------------------------------------------------------
|
---|
692 |
|
---|
693 | void TreeWriter::ProcessMuons(ExRootTreeBranch *branch, TObjArray *array)
|
---|
694 | {
|
---|
695 | TIter iterator(array);
|
---|
696 | Candidate *candidate = 0;
|
---|
697 | Muon *entry = 0;
|
---|
698 | Double_t pt, signPz, cosTheta, eta, rapidity;
|
---|
699 |
|
---|
700 | const Double_t c_light = 2.99792458E8;
|
---|
701 |
|
---|
702 | array->Sort();
|
---|
703 |
|
---|
704 | // loop over all muons
|
---|
705 | iterator.Reset();
|
---|
706 | while((candidate = static_cast<Candidate *>(iterator.Next())))
|
---|
707 | {
|
---|
708 | const TLorentzVector &momentum = candidate->Momentum;
|
---|
709 | const TLorentzVector &position = candidate->Position;
|
---|
710 |
|
---|
711 | pt = momentum.Pt();
|
---|
712 | cosTheta = TMath::Abs(momentum.CosTheta());
|
---|
713 | signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0;
|
---|
714 | eta = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Eta());
|
---|
715 | rapidity = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Rapidity());
|
---|
716 |
|
---|
717 | entry = static_cast<Muon *>(branch->NewEntry());
|
---|
718 |
|
---|
719 | entry->SetBit(kIsReferenced);
|
---|
720 | entry->SetUniqueID(candidate->GetUniqueID());
|
---|
721 |
|
---|
722 | entry->Eta = eta;
|
---|
723 | entry->Phi = momentum.Phi();
|
---|
724 | entry->PT = pt;
|
---|
725 |
|
---|
726 | entry->T = position.T() * 1.0E-3 / c_light;
|
---|
727 |
|
---|
728 | // displacement
|
---|
729 | entry->D0 = candidate->D0;
|
---|
730 | entry->ErrorD0 = candidate->ErrorD0;
|
---|
731 | entry->DZ = candidate->DZ;
|
---|
732 | entry->ErrorDZ = candidate->ErrorDZ;
|
---|
733 |
|
---|
734 | // Isolation variables
|
---|
735 |
|
---|
736 | entry->IsolationVar = candidate->IsolationVar;
|
---|
737 | entry->IsolationVarRhoCorr = candidate->IsolationVarRhoCorr;
|
---|
738 | entry->SumPtCharged = candidate->SumPtCharged;
|
---|
739 | entry->SumPtNeutral = candidate->SumPtNeutral;
|
---|
740 | entry->SumPtChargedPU = candidate->SumPtChargedPU;
|
---|
741 | entry->SumPt = candidate->SumPt;
|
---|
742 |
|
---|
743 | entry->Charge = candidate->Charge;
|
---|
744 |
|
---|
745 | entry->Particle = candidate->GetCandidates()->At(0);
|
---|
746 | }
|
---|
747 | }
|
---|
748 |
|
---|
749 | //------------------------------------------------------------------------------
|
---|
750 |
|
---|
751 | void TreeWriter::ProcessJets(ExRootTreeBranch *branch, TObjArray *array)
|
---|
752 | {
|
---|
753 | TIter iterator(array);
|
---|
754 | Candidate *candidate = 0, *constituent = 0;
|
---|
755 | Jet *entry = 0;
|
---|
756 | Double_t pt, signPz, cosTheta, eta, rapidity;
|
---|
757 | Double_t ecalEnergy, hcalEnergy;
|
---|
758 | const Double_t c_light = 2.99792458E8;
|
---|
759 | Int_t i;
|
---|
760 |
|
---|
761 | array->Sort();
|
---|
762 |
|
---|
763 | // loop over all jets
|
---|
764 | iterator.Reset();
|
---|
765 | while((candidate = static_cast<Candidate *>(iterator.Next())))
|
---|
766 | {
|
---|
767 | TIter itConstituents(candidate->GetCandidates());
|
---|
768 |
|
---|
769 | const TLorentzVector &momentum = candidate->Momentum;
|
---|
770 | const TLorentzVector &position = candidate->Position;
|
---|
771 |
|
---|
772 | pt = momentum.Pt();
|
---|
773 | cosTheta = TMath::Abs(momentum.CosTheta());
|
---|
774 | signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0;
|
---|
775 | eta = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Eta());
|
---|
776 | rapidity = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Rapidity());
|
---|
777 |
|
---|
778 | entry = static_cast<Jet *>(branch->NewEntry());
|
---|
779 |
|
---|
780 | entry->Eta = eta;
|
---|
781 | entry->Phi = momentum.Phi();
|
---|
782 | entry->PT = pt;
|
---|
783 |
|
---|
784 | entry->T = position.T() * 1.0E-3 / c_light;
|
---|
785 |
|
---|
786 | entry->Mass = momentum.M();
|
---|
787 |
|
---|
788 | entry->Area = candidate->Area;
|
---|
789 |
|
---|
790 | entry->DeltaEta = candidate->DeltaEta;
|
---|
791 | entry->DeltaPhi = candidate->DeltaPhi;
|
---|
792 |
|
---|
793 | entry->Flavor = candidate->Flavor;
|
---|
794 | entry->FlavorAlgo = candidate->FlavorAlgo;
|
---|
795 | entry->FlavorPhys = candidate->FlavorPhys;
|
---|
796 |
|
---|
797 | entry->BTag = candidate->BTag;
|
---|
798 |
|
---|
799 | entry->BTagAlgo = candidate->BTagAlgo;
|
---|
800 | entry->BTagPhys = candidate->BTagPhys;
|
---|
801 |
|
---|
802 | entry->TauTag = candidate->TauTag;
|
---|
803 | entry->TauWeight = candidate->TauWeight;
|
---|
804 |
|
---|
805 | entry->Charge = candidate->Charge;
|
---|
806 |
|
---|
807 | itConstituents.Reset();
|
---|
808 | entry->Constituents.Clear();
|
---|
809 | ecalEnergy = 0.0;
|
---|
810 | hcalEnergy = 0.0;
|
---|
811 | while((constituent = static_cast<Candidate *>(itConstituents.Next())))
|
---|
812 | {
|
---|
813 | entry->Constituents.Add(constituent);
|
---|
814 | ecalEnergy += constituent->Eem;
|
---|
815 | hcalEnergy += constituent->Ehad;
|
---|
816 | }
|
---|
817 |
|
---|
818 | entry->EhadOverEem = ecalEnergy > 0.0 ? hcalEnergy / ecalEnergy : 999.9;
|
---|
819 |
|
---|
820 | //--- Pile-Up Jet ID variables ----
|
---|
821 |
|
---|
822 | entry->NCharged = candidate->NCharged;
|
---|
823 | entry->NNeutrals = candidate->NNeutrals;
|
---|
824 |
|
---|
825 | entry->NeutralEnergyFraction = candidate->NeutralEnergyFraction;
|
---|
826 | entry->ChargedEnergyFraction = candidate->ChargedEnergyFraction;
|
---|
827 | entry->Beta = candidate->Beta;
|
---|
828 | entry->BetaStar = candidate->BetaStar;
|
---|
829 | entry->MeanSqDeltaR = candidate->MeanSqDeltaR;
|
---|
830 | entry->PTD = candidate->PTD;
|
---|
831 |
|
---|
832 | //--- Sub-structure variables ----
|
---|
833 |
|
---|
834 | entry->NSubJetsTrimmed = candidate->NSubJetsTrimmed;
|
---|
835 | entry->NSubJetsPruned = candidate->NSubJetsPruned;
|
---|
836 | entry->NSubJetsSoftDropped = candidate->NSubJetsSoftDropped;
|
---|
837 |
|
---|
838 | entry->SoftDroppedJet = candidate->SoftDroppedJet;
|
---|
839 | entry->SoftDroppedSubJet1 = candidate->SoftDroppedSubJet1;
|
---|
840 | entry->SoftDroppedSubJet2 = candidate->SoftDroppedSubJet2;
|
---|
841 |
|
---|
842 | for(i = 0; i < 5; i++)
|
---|
843 | {
|
---|
844 | entry->FracPt[i] = candidate->FracPt[i];
|
---|
845 | entry->Tau[i] = candidate->Tau[i];
|
---|
846 | entry->TrimmedP4[i] = candidate->TrimmedP4[i];
|
---|
847 | entry->PrunedP4[i] = candidate->PrunedP4[i];
|
---|
848 | entry->SoftDroppedP4[i] = candidate->SoftDroppedP4[i];
|
---|
849 | }
|
---|
850 |
|
---|
851 | //--- exclusive clustering variables ---
|
---|
852 | entry->ExclYmerge23 = candidate->ExclYmerge23;
|
---|
853 | entry->ExclYmerge34 = candidate->ExclYmerge34;
|
---|
854 | entry->ExclYmerge45 = candidate->ExclYmerge45;
|
---|
855 | entry->ExclYmerge56 = candidate->ExclYmerge56;
|
---|
856 |
|
---|
857 | FillParticles(candidate, &entry->Particles);
|
---|
858 | }
|
---|
859 | }
|
---|
860 |
|
---|
861 | //------------------------------------------------------------------------------
|
---|
862 |
|
---|
863 | void TreeWriter::ProcessMissingET(ExRootTreeBranch *branch, TObjArray *array)
|
---|
864 | {
|
---|
865 | Candidate *candidate = 0;
|
---|
866 | MissingET *entry = 0;
|
---|
867 |
|
---|
868 | // get the first entry
|
---|
869 | if((candidate = static_cast<Candidate *>(array->At(0))))
|
---|
870 | {
|
---|
871 | const TLorentzVector &momentum = candidate->Momentum;
|
---|
872 |
|
---|
873 | entry = static_cast<MissingET *>(branch->NewEntry());
|
---|
874 |
|
---|
875 | entry->Eta = (-momentum).Eta();
|
---|
876 | entry->Phi = (-momentum).Phi();
|
---|
877 | entry->MET = momentum.Pt();
|
---|
878 | }
|
---|
879 | }
|
---|
880 |
|
---|
881 | //------------------------------------------------------------------------------
|
---|
882 |
|
---|
883 | void TreeWriter::ProcessScalarHT(ExRootTreeBranch *branch, TObjArray *array)
|
---|
884 | {
|
---|
885 | Candidate *candidate = 0;
|
---|
886 | ScalarHT *entry = 0;
|
---|
887 |
|
---|
888 | // get the first entry
|
---|
889 | if((candidate = static_cast<Candidate *>(array->At(0))))
|
---|
890 | {
|
---|
891 | const TLorentzVector &momentum = candidate->Momentum;
|
---|
892 |
|
---|
893 | entry = static_cast<ScalarHT *>(branch->NewEntry());
|
---|
894 |
|
---|
895 | entry->HT = momentum.Pt();
|
---|
896 | }
|
---|
897 | }
|
---|
898 |
|
---|
899 | //------------------------------------------------------------------------------
|
---|
900 |
|
---|
901 | void TreeWriter::ProcessRho(ExRootTreeBranch *branch, TObjArray *array)
|
---|
902 | {
|
---|
903 | TIter iterator(array);
|
---|
904 | Candidate *candidate = 0;
|
---|
905 | Rho *entry = 0;
|
---|
906 |
|
---|
907 | // loop over all rho
|
---|
908 | iterator.Reset();
|
---|
909 | while((candidate = static_cast<Candidate *>(iterator.Next())))
|
---|
910 | {
|
---|
911 | const TLorentzVector &momentum = candidate->Momentum;
|
---|
912 |
|
---|
913 | entry = static_cast<Rho *>(branch->NewEntry());
|
---|
914 |
|
---|
915 | entry->Rho = momentum.E();
|
---|
916 | entry->Edges[0] = candidate->Edges[0];
|
---|
917 | entry->Edges[1] = candidate->Edges[1];
|
---|
918 | }
|
---|
919 | }
|
---|
920 |
|
---|
921 | //------------------------------------------------------------------------------
|
---|
922 |
|
---|
923 | void TreeWriter::ProcessWeight(ExRootTreeBranch *branch, TObjArray *array)
|
---|
924 | {
|
---|
925 | Candidate *candidate = 0;
|
---|
926 | Weight *entry = 0;
|
---|
927 |
|
---|
928 | // get the first entry
|
---|
929 | if((candidate = static_cast<Candidate *>(array->At(0))))
|
---|
930 | {
|
---|
931 | const TLorentzVector &momentum = candidate->Momentum;
|
---|
932 |
|
---|
933 | entry = static_cast<Weight *>(branch->NewEntry());
|
---|
934 |
|
---|
935 | entry->Weight = momentum.E();
|
---|
936 | }
|
---|
937 | }
|
---|
938 |
|
---|
939 | //------------------------------------------------------------------------------
|
---|
940 |
|
---|
941 | void TreeWriter::ProcessHectorHit(ExRootTreeBranch *branch, TObjArray *array)
|
---|
942 | {
|
---|
943 | TIter iterator(array);
|
---|
944 | Candidate *candidate = 0;
|
---|
945 | HectorHit *entry = 0;
|
---|
946 |
|
---|
947 | // loop over all roman pot hits
|
---|
948 | iterator.Reset();
|
---|
949 | while((candidate = static_cast<Candidate *>(iterator.Next())))
|
---|
950 | {
|
---|
951 | const TLorentzVector &position = candidate->Position;
|
---|
952 | const TLorentzVector &momentum = candidate->Momentum;
|
---|
953 |
|
---|
954 | entry = static_cast<HectorHit *>(branch->NewEntry());
|
---|
955 |
|
---|
956 | entry->E = momentum.E();
|
---|
957 |
|
---|
958 | entry->Tx = momentum.Px();
|
---|
959 | entry->Ty = momentum.Py();
|
---|
960 |
|
---|
961 | entry->T = position.T();
|
---|
962 |
|
---|
963 | entry->X = position.X();
|
---|
964 | entry->Y = position.Y();
|
---|
965 | entry->S = position.Z();
|
---|
966 |
|
---|
967 | entry->Particle = candidate->GetCandidates()->At(0);
|
---|
968 | }
|
---|
969 | }
|
---|
970 |
|
---|
971 | //------------------------------------------------------------------------------
|
---|
972 |
|
---|
973 | void TreeWriter::Process()
|
---|
974 | {
|
---|
975 | TBranchMap::iterator itBranchMap;
|
---|
976 | ExRootTreeBranch *branch;
|
---|
977 | TProcessMethod method;
|
---|
978 | TObjArray *array;
|
---|
979 |
|
---|
980 | for(itBranchMap = fBranchMap.begin(); itBranchMap != fBranchMap.end(); ++itBranchMap)
|
---|
981 | {
|
---|
982 | branch = itBranchMap->first;
|
---|
983 | method = itBranchMap->second.first;
|
---|
984 | array = itBranchMap->second.second;
|
---|
985 |
|
---|
986 | (this->*method)(branch, array);
|
---|
987 | }
|
---|
988 | }
|
---|
989 |
|
---|
990 | //------------------------------------------------------------------------------
|
---|