Changeset a5af1df in git for modules/TreeWriter.cc
- Timestamp:
- Dec 9, 2021, 7:38:54 AM (3 years ago)
- Children:
- d612dec
- Parents:
- a5ff49f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/TreeWriter.cc
ra5ff49f ra5af1df 75 75 fClassMap[Electron::Class()] = &TreeWriter::ProcessElectrons; 76 76 fClassMap[Muon::Class()] = &TreeWriter::ProcessMuons; 77 fClassMap[CscCluster::Class()] = &TreeWriter::ProcessCscCluster; 77 78 fClassMap[Jet::Class()] = &TreeWriter::ProcessJets; 78 79 fClassMap[MissingET::Class()] = &TreeWriter::ProcessMissingET; … … 182 183 const TLorentzVector &momentum = candidate->Momentum; 183 184 const TLorentzVector &position = candidate->Position; 185 const TLorentzVector &DecayPosition = candidate->DecayPosition; 184 186 185 187 entry = static_cast<GenParticle *>(branch->NewEntry()); … … 215 217 entry->D0 = candidate->D0; 216 218 entry->DZ = candidate->DZ; 217 entry->P = candidate->P;219 entry->P = momentum.P(); 218 220 entry->PT = candidate->PT; 219 221 entry->CtgTheta = candidate->CtgTheta; … … 230 232 entry->Z = position.Z(); 231 233 entry->T = position.T() * 1.0E-3 / c_light; 234 235 entry->decayX = DecayPosition.X(); 236 entry->decayY = DecayPosition.Y(); 237 entry->decayZ = DecayPosition.Z(); 238 entry->decayT = DecayPosition.T()* 1.0E-3 / c_light; 239 float beta = entry->P/momentum.E(); 240 float gamma = 1./sqrt(1-beta*beta); 241 entry->ctau = sqrt(pow(entry->decayX-entry->X,2)+pow(entry->decayY-entry->Y,2)+pow(entry->decayZ-entry->Z,2))/(beta*gamma);// in millimeter 232 242 } 233 243 } … … 730 740 } 731 741 } 742 //------------------------------------------------------------------------------ 743 744 void TreeWriter::ProcessCscCluster(ExRootTreeBranch *branch, TObjArray *array) 745 { 746 TIter iterator(array); 747 Candidate *candidate = 0; 748 CscCluster *entry = 0; 749 Double_t pt, signPz, cosTheta, eta, rapidity; 750 751 const Double_t c_light = 2.99792458E8; // in unit of m/s 752 753 array->Sort(); 754 755 756 // loop over all clusters 757 iterator.Reset(); 758 while((candidate = static_cast<Candidate *>(iterator.Next()))) 759 { 760 const TLorentzVector &momentum = candidate->Momentum; 761 const TLorentzVector &position = candidate->DecayPosition; 762 763 pt = momentum.Pt(); 764 cosTheta = TMath::Abs(momentum.CosTheta()); 765 signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0; 766 eta = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Eta()); 767 768 entry = static_cast<CscCluster *>(branch->NewEntry()); 769 770 entry->SetBit(kIsReferenced); 771 entry->SetUniqueID(candidate->GetUniqueID()); 772 773 entry->Eta = eta; 774 entry->Phi = momentum.Phi(); 775 776 777 // entry->Eta = position.Eta(); 778 // entry->Phi = position.Phi(); 779 780 entry->PT = momentum.Pt(); // pt of LLP 781 entry->Px = momentum.Px();// px of LLP 782 entry->Py = momentum.Py();// py of LLP 783 entry->Pz = momentum.Pz();// pz of LLP 784 entry->E = momentum.E(); // E of LLP 785 entry->pid = candidate->PID; // LLP pid 786 entry->Eem = candidate->Eem; // LLP pid 787 entry->Ehad = candidate->Ehad; // LLP pid 788 Double_t beta = momentum.P()/momentum.E(); 789 Double_t gamma = 1.0/sqrt(1-beta*beta); 790 Double_t decayDistance = sqrt(pow(position.X(),2)+pow(position.Y(),2)+pow(position.Z(),2)); // mm 791 entry->beta = beta; // LLP pid 792 entry->ctau = decayDistance/(beta * gamma);; // LLP pid 793 794 // entry->T = (position.T()-sqrt(pow(position.X(),2)+pow(position.Y(),2)+pow(position.Z(),2)))* 1.0E-3 / c_light; // LLP decay time-photon travel time 795 796 entry->T = decayDistance*(1./beta-1)* 1.0E-3/c_light*1e9; // ns 797 entry->X = position.X(); // LLP decay x 798 entry->Y = position.Y(); // LLP decay y 799 entry->Z = position.Z(); // LLP decay z 800 // entry->Size = 100; 801 } 802 } 732 803 733 804 //------------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.