Changes between Version 13 and Version 14 of WorkBook/QuickTour
- Timestamp:
- Feb 25, 2013, 1:08:55 AM (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
WorkBook/QuickTour
v13 v14 98 98 void Example1(const char *inputFile) 99 99 { 100 gSystem->Load("libDelphes"); 101 100 102 // Create chain of root trees 101 103 TChain chain("Delphes"); … … 117 119 for(Int_t entry = 0; entry < numberOfEntries; ++entry) 118 120 { 119 120 121 // Load selected branches with data from specified event 121 122 treeReader->ReadEntry(entry); … … 124 125 if(branchJet->GetEntries() > 0) 125 126 { 126 127 127 // Take first jet 128 TRootJet *jet = (TRootJet*) branchJet->At(0);128 Jet *jet = (Jet*) branchJet->At(0); 129 129 130 130 // Plot jet transverse momentum … … 135 135 } 136 136 137 TRootElectron *elec1, *elec2; 138 TLorentzVector vec1, vec2; 137 Electron *elec1, *elec2; 139 138 140 139 // If event contains at least 2 electrons 141 140 if(branchElectron->GetEntries() > 1) 142 141 { 143 144 142 // Take first two electrons 145 elec1 = (TRootElectron *) branchElectron->At(0); 146 elec2 = (TRootElectron *) branchElectron->At(1); 147 148 // Create two 4-vectors for the electrons 149 vec1.SetPtEtaPhiM(elec1->PT, elec1->Eta, elec1->Phi, 0.0); 150 vec2.SetPtEtaPhiM(elec2->PT, elec2->Eta, elec2->Phi, 0.0); 143 elec1 = (Electron *) branchElectron->At(0); 144 elec2 = (Electron *) branchElectron->At(1); 151 145 152 146 // Plot their invariant mass 153 histMass->Fill(( vec1 + vec2).M());147 histMass->Fill(((elec1->P4()) + (elec2->P4())).M()); 154 148 } 155 149 }