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