- Timestamp:
- May 26, 2021, 4:46:34 PM (4 years ago)
- Branches:
- master
- Children:
- c1780a5
- Parents:
- db316cd
- Location:
- examples
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
examples/Example7.C
rdb316cd rb03c0d0 30 30 TClonesArray *branchElectron = treeReader->UseBranch("ElectronMedium"); 31 31 TClonesArray *branchWeight = treeReader->UseBranch("Weight"); 32 TClonesArray *branchEvent = treeReader->UseBranch("Event"); 32 33 33 34 // Book histograms … … 40 41 // Load selected branches with data from specified event 41 42 treeReader->ReadEntry(entry); 42 43 Double_t w =1.0; 44 // read MC event weight 43 44 // main MC event weight 45 HepMCEvent *event = (HepMCEvent*) branchEvent -> At(0); 46 Double_t w = event->Weight; 47 48 // read lhe event weights 45 49 if(branchWeight->GetEntries() > 0) 46 50 { 47 51 Weight *weight = (Weight*) branchWeight -> At(0); 48 w = weight->Weight; 52 Double_t lhe_weight = weight->Weight; 53 54 //cout<<lhe_weight<<endl; 55 // do stuff ... 49 56 } 50 57 51 58 // If event contains at least 1 jet 52 59 if(branchJet->GetEntries() > 0) … … 66 73 histJetPT->Fill(jet->PT, w); 67 74 } 68 69 75 70 76 // If event contains at least 1 jet -
examples/Example7.py
rdb316cd rb03c0d0 33 33 34 34 # Get pointers to branches used in this analysis 35 branchJet = treeReader.UseBranch("JetPUPPITight")35 branchJet = treeReader.UseBranch("JetPUPPITight") 36 36 branchElectron = treeReader.UseBranch("ElectronMedium") 37 branchWeight = treeReader.UseBranch("Weight") 37 branchWeight = treeReader.UseBranch("Weight") 38 branchEvent = treeReader.UseBranch("Event") 38 39 39 40 # Book histograms … … 46 47 treeReader.ReadEntry(entry) 47 48 48 w = 1.0 49 ## read MC event weight 50 if branchWeight.GetEntries() > 0: 51 weight = branchWeight.At(0).Weight 49 ## main MC event weight 50 w = branchEvent[0].Weight 52 51 52 ## read lhe event weight 53 for weight in branchWeight: 54 lhe_weight = weight.Weight 55 ## do stuff ... 56 ## print lhe_weight 57 53 58 # If event contains at least 1 jet 54 59 if branchJet.GetEntries() > 0: … … 76 81 eta = abs(electron.Eta) 77 82 83 ## looseCut = 0.3, mediumCut = 0.2, tightCut = 0.1 78 84 IsoCut = 0.2 79 85 IsoOk = electron.IsolationVar < IsoCut
Note:
See TracChangeset
for help on using the changeset viewer.