Changeset d612dec in git for modules/TreeWriter.cc
- Timestamp:
- Dec 9, 2021, 7:52:15 AM (3 years ago)
- Children:
- 29b722a
- Parents:
- a5af1df (diff), 0c0c9af (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/TreeWriter.cc
ra5af1df rd612dec 72 72 fClassMap[Track::Class()] = &TreeWriter::ProcessTracks; 73 73 fClassMap[Tower::Class()] = &TreeWriter::ProcessTowers; 74 fClassMap[ParticleFlowCandidate::Class()] = &TreeWriter::ProcessParticleFlowCandidates; 74 75 fClassMap[Photon::Class()] = &TreeWriter::ProcessPhotons; 75 76 fClassMap[Electron::Class()] = &TreeWriter::ProcessElectrons; … … 123 124 fBranchMap.insert(make_pair(branch, make_pair(itClassMap->second, array))); 124 125 } 126 127 param = GetParam("Info"); 128 TString infoName; 129 Double_t infoValue; 130 131 size = param.GetSize(); 132 for(i = 0; i < size / 2; ++i) 133 { 134 infoName = param[i * 2].GetString(); 135 infoValue = param[i * 2 + 1].GetDouble(); 136 137 AddInfo(infoName, infoValue); 138 } 125 139 } 126 140 … … 138 152 it1.Reset(); 139 153 array->Clear(); 154 140 155 while((candidate = static_cast<Candidate *>(it1.Next()))) 141 156 { … … 215 230 entry->Pz = momentum.Pz(); 216 231 217 entry->D0 = candidate->D0;218 entry->DZ = candidate->DZ;219 entry->P = momentum.P();220 entry->PT = candidate->PT;221 entry->CtgTheta = candidate->CtgTheta;222 entry->Phi = candidate->Phi;223 224 232 entry->Eta = eta; 225 233 entry->Phi = momentum.Phi(); … … 322 330 Candidate *particle = 0; 323 331 Track *entry = 0; 324 Double_t pt, signz, cosTheta, eta, rapidity, p, ctgTheta, phi ;332 Double_t pt, signz, cosTheta, eta, rapidity, p, ctgTheta, phi, m; 325 333 const Double_t c_light = 2.99792458E8; 326 334 … … 356 364 357 365 entry->D0 = candidate->D0; 358 entry->ErrorD0 = candidate->ErrorD0;359 366 entry->DZ = candidate->DZ; 360 entry->ErrorDZ = candidate->ErrorDZ; 367 entry->Nclusters = candidate->Nclusters; 368 entry->dNdx = candidate->dNdx; 361 369 362 370 entry->ErrorP = candidate->ErrorP; 363 371 entry->ErrorPT = candidate->ErrorPT; 372 373 // diagonal covariance matrix terms 374 entry->ErrorD0 = candidate->ErrorD0; 375 entry->ErrorC = candidate->ErrorC; 376 entry->ErrorPhi = candidate->ErrorPhi; 377 entry->ErrorDZ = candidate->ErrorDZ; 364 378 entry->ErrorCtgTheta = candidate->ErrorCtgTheta; 365 entry->ErrorPhi = candidate->ErrorPhi; 379 380 // add some offdiagonal covariance matrix elements 381 entry->ErrorD0Phi = candidate->TrackCovariance(0,1); 382 entry->ErrorD0C = candidate->TrackCovariance(0,2); 383 entry->ErrorD0DZ = candidate->TrackCovariance(0,3); 384 entry->ErrorD0CtgTheta = candidate->TrackCovariance(0,4); 385 entry->ErrorPhiC = candidate->TrackCovariance(1,2); 386 entry->ErrorPhiDZ = candidate->TrackCovariance(1,3); 387 entry->ErrorPhiCtgTheta = candidate->TrackCovariance(1,4); 388 entry->ErrorCDZ = candidate->TrackCovariance(2,3); 389 entry->ErrorCCtgTheta = candidate->TrackCovariance(2,4); 390 entry->ErrorDZCtgTheta = candidate->TrackCovariance(3,4); 366 391 367 392 entry->Xd = candidate->Xd; … … 374 399 p = momentum.P(); 375 400 phi = momentum.Phi(); 401 m = momentum.M(); 376 402 ctgTheta = (TMath::Tan(momentum.Theta()) != 0) ? 1 / TMath::Tan(momentum.Theta()) : 1e10; 377 403 … … 386 412 entry->Phi = phi; 387 413 entry->CtgTheta = ctgTheta; 414 entry->C = candidate->C; 415 entry->Mass = m; 388 416 389 417 particle = static_cast<Candidate *>(candidate->GetCandidates()->At(0)); 390 const TLorentzVector &initialPosition = particle->Position; 418 //const TLorentzVector &initialPosition = particle->Position; 419 const TLorentzVector &initialPosition = candidate->InitialPosition; 391 420 392 421 entry->X = initialPosition.X(); … … 394 423 entry->Z = initialPosition.Z(); 395 424 entry->T = initialPosition.T() * 1.0E-3 / c_light; 425 entry->ErrorT =candidate-> ErrorT * 1.0E-3 / c_light; 396 426 397 427 entry->Particle = particle; … … 435 465 entry->Eem = candidate->Eem; 436 466 entry->Ehad = candidate->Ehad; 467 entry->Etrk = candidate->Etrk; 437 468 entry->Edges[0] = candidate->Edges[0]; 438 469 entry->Edges[1] = candidate->Edges[1]; … … 444 475 445 476 FillParticles(candidate, &entry->Particles); 477 } 478 } 479 480 //------------------------------------------------------------------------------ 481 482 void TreeWriter::ProcessParticleFlowCandidates(ExRootTreeBranch *branch, TObjArray *array) 483 { 484 485 TIter iterator(array); 486 Candidate *candidate = 0; 487 Candidate *particle = 0; 488 ParticleFlowCandidate *entry = 0; 489 Double_t e, pt, signz, cosTheta, eta, rapidity, p, ctgTheta, phi, m; 490 const Double_t c_light = 2.99792458E8; 491 492 // loop over all tracks 493 iterator.Reset(); 494 while((candidate = static_cast<Candidate *>(iterator.Next()))) 495 { 496 const TLorentzVector &position = candidate->Position; 497 498 cosTheta = TMath::Abs(position.CosTheta()); 499 signz = (position.Pz() >= 0.0) ? 1.0 : -1.0; 500 eta = (cosTheta == 1.0 ? signz * 999.9 : position.Eta()); 501 rapidity = (cosTheta == 1.0 ? signz * 999.9 : position.Rapidity()); 502 503 entry = static_cast<ParticleFlowCandidate *>(branch->NewEntry()); 504 505 entry->SetBit(kIsReferenced); 506 entry->SetUniqueID(candidate->GetUniqueID()); 507 508 entry->PID = candidate->PID; 509 510 entry->Charge = candidate->Charge; 511 512 entry->EtaOuter = eta; 513 entry->PhiOuter = position.Phi(); 514 515 entry->XOuter = position.X(); 516 entry->YOuter = position.Y(); 517 entry->ZOuter = position.Z(); 518 entry->TOuter = position.T() * 1.0E-3 / c_light; 519 520 entry->L = candidate->L; 521 522 entry->D0 = candidate->D0; 523 entry->DZ = candidate->DZ; 524 entry->Nclusters = candidate->Nclusters; 525 entry->dNdx = candidate->dNdx; 526 527 entry->ErrorP = candidate->ErrorP; 528 entry->ErrorPT = candidate->ErrorPT; 529 entry->ErrorCtgTheta = candidate->ErrorCtgTheta; 530 531 532 // diagonal covariance matrix terms 533 534 entry->ErrorD0 = candidate->ErrorD0; 535 entry->ErrorC = candidate->ErrorC; 536 entry->ErrorPhi = candidate->ErrorPhi; 537 entry->ErrorDZ = candidate->ErrorDZ; 538 entry->ErrorCtgTheta = candidate->ErrorCtgTheta; 539 540 // add some offdiagonal covariance matrix elements 541 entry->ErrorD0Phi = candidate->TrackCovariance(0,1); 542 entry->ErrorD0C = candidate->TrackCovariance(0,2); 543 entry->ErrorD0DZ = candidate->TrackCovariance(0,3); 544 entry->ErrorD0CtgTheta = candidate->TrackCovariance(0,4); 545 entry->ErrorPhiC = candidate->TrackCovariance(1,2); 546 entry->ErrorPhiDZ = candidate->TrackCovariance(1,3); 547 entry->ErrorPhiCtgTheta = candidate->TrackCovariance(1,4); 548 entry->ErrorCDZ = candidate->TrackCovariance(2,3); 549 entry->ErrorCCtgTheta = candidate->TrackCovariance(2,4); 550 entry->ErrorDZCtgTheta = candidate->TrackCovariance(3,4); 551 552 entry->Xd = candidate->Xd; 553 entry->Yd = candidate->Yd; 554 entry->Zd = candidate->Zd; 555 556 const TLorentzVector &momentum = candidate->Momentum; 557 558 e = momentum.E(); 559 pt = momentum.Pt(); 560 p = momentum.P(); 561 phi = momentum.Phi(); 562 m = momentum.M(); 563 ctgTheta = (TMath::Tan(momentum.Theta()) != 0) ? 1 / TMath::Tan(momentum.Theta()) : 1e10; 564 565 entry->E = e; 566 entry->P = p; 567 entry->PT = pt; 568 entry->Eta = eta; 569 entry->Phi = phi; 570 entry->CtgTheta = ctgTheta; 571 entry->C = candidate->C; 572 entry->Mass = m; 573 574 particle = static_cast<Candidate *>(candidate->GetCandidates()->At(0)); 575 //const TLorentzVector &initialPosition = particle->Position; 576 const TLorentzVector &initialPosition = candidate->InitialPosition; 577 578 entry->X = initialPosition.X(); 579 entry->Y = initialPosition.Y(); 580 entry->Z = initialPosition.Z(); 581 entry->T = initialPosition.T() * 1.0E-3 / c_light; 582 entry->ErrorT = candidate-> ErrorT * 1.0E-3 / c_light; 583 584 entry->VertexIndex = candidate->ClusterIndex; 585 586 entry->Eem = candidate->Eem; 587 entry->Ehad = candidate->Ehad; 588 entry->Etrk = candidate->Etrk; 589 entry->Edges[0] = candidate->Edges[0]; 590 entry->Edges[1] = candidate->Edges[1]; 591 entry->Edges[2] = candidate->Edges[2]; 592 entry->Edges[3] = candidate->Edges[3]; 593 594 //entry->T = position.T() * 1.0E-3 / c_light; 595 entry->NTimeHits = candidate->NTimeHits; 596 597 FillParticles(candidate, &entry->Particles); 598 446 599 } 447 600 } … … 687 840 entry->NCharged = candidate->NCharged; 688 841 entry->NNeutrals = candidate->NNeutrals; 842 843 entry->NeutralEnergyFraction = candidate->NeutralEnergyFraction; 844 entry->ChargedEnergyFraction = candidate->ChargedEnergyFraction; 689 845 entry->Beta = candidate->Beta; 690 846 entry->BetaStar = candidate->BetaStar;
Note:
See TracChangeset
for help on using the changeset viewer.