def buildNtuple4l(channel): "Build a tree for storing important values" strToProcess = "struct structSelect_t {" strForBranch = "" strToProcess += "Int_t passTight;" strForBranch += "passTight/I:" strToProcess += "Int_t passLoose;" strForBranch += "passLoose/I:" for ne in range(5): for nm in range(5-ne): strToProcess += "Int_t pass_%i%i;" %(ne,nm) strForBranch += "pass_%i%i/I:" %(ne,nm) strToProcess += "};" strForBranch = strForBranch[:-1] # remove trailing : rt.gROOT.ProcessLine(strToProcess) rt.gROOT.ProcessLine( "struct structEvent_t {\ Int_t evt;\ Int_t run;\ Int_t lumi;\ Int_t nvtx;\ Float_t lep_scale;\ Float_t trig_scale;\ Float_t pu_weight;\ };"); rt.gROOT.ProcessLine( "struct structChannel_t {\ Char_t channel[5];\ };"); rt.gROOT.ProcessLine( "struct struct4l_t {\ Float_t mass;\ Float_t sT;\ Float_t met;\ Float_t metPhi;\ Int_t jetVeto20;\ Int_t jetVeto30;\ Int_t jetVeto40;\ Int_t bjetVeto20;\ Int_t bjetVeto30;\ Int_t muonVeto5;\ Int_t muonVeto10Loose;\ Int_t muonVeto15;\ Int_t elecVeto10;\ };"); rt.gROOT.ProcessLine( "struct structH_t {\ Float_t mass;\ Float_t sT;\ Float_t dPhi;\ Float_t Pt1;\ Float_t Eta1;\ Float_t Phi1;\ Float_t Pt2;\ Float_t Eta2;\ Float_t Phi2;\ Int_t Chg1;\ Int_t Chg2;\ };"); rt.gROOT.ProcessLine( "struct structHChar_t {\ Char_t Flv[3];\ };"); rt.gROOT.ProcessLine( "struct structLepton_t {\ Float_t Pt;\ Float_t Eta;\ Float_t Phi;\ Float_t Iso;\ Int_t Chg;\ };"); rt.gROOT.ProcessLine( "struct structLepChar_t {\ Char_t Flv[2];\ };"); tree = rt.TTree(channel,'H++H-- 4l') structSelect = rt.structSelect_t() structEvent = rt.structEvent_t() structChannel = rt.structChannel_t() struct4l = rt.struct4l_t() structH1 = rt.structH_t() structH2 = rt.structH_t() structH1f = rt.structHChar_t() structH2f = rt.structHChar_t() structZ1 = rt.structH_t() structZ1f = rt.structHChar_t() structZ2 = rt.structH_t() structZ2f = rt.structHChar_t() structTTf = rt.structHChar_t() structL1 = rt.structLepton_t() structL2 = rt.structLepton_t() structL3 = rt.structLepton_t() structL4 = rt.structLepton_t() structL1f = rt.structLepChar_t() structL2f = rt.structLepChar_t() structL3f = rt.structLepChar_t() structL4f = rt.structLepChar_t() tree.Branch('select',structSelect,strForBranch) tree.Branch('event',structEvent,'evt/I:run:lumi:nvtx:lep_scale/F:trig_scale:pu_weight') tree.Branch('channel',rt.AddressOf(structChannel,'channel'),'channel/C') tree.Branch('4l',struct4l,'mass/F:sT:met:metPhi:jetVeto20/I:jetVeto30:jetVeto40:bjetVeto20:bjetVeto30:muonVeto5:muonVeto10Loose:muonVeto15:elecVeto10') tree.Branch('h1',structH1,'mass/F:sT:dPhi:Pt1:Eta1:Phi1:Pt2:Eta2:Phi2:Chg1/I:Chg2') tree.Branch('h2',structH2,'mass/F:sT:dPhi:Pt1:Eta1:Phi1:Pt2:Eta2:Phi2:Chg1/I:Chg2') tree.Branch('h1Flv',rt.AddressOf(structH1f,'Flv'),'Flv/C') tree.Branch('h2Flv',rt.AddressOf(structH2f,'Flv'),'Flv/C') tree.Branch('z1',structZ1,'mass/F:sT:dPhi:Pt1:Eta1:Phi1:Pt2:Eta2:Phi2:Chg1/I:Chg2') tree.Branch('z1Flv',rt.AddressOf(structZ1f,'Flv'),'Flv/C') tree.Branch('z2',structZ2,'mass/F:sT:dPhi:Pt1:Eta1:Phi1:Pt2:Eta2:Phi2:Chg1/I:Chg2') tree.Branch('z2Flv',rt.AddressOf(structZ2f,'Flv'),'Flv/C') tree.Branch('ttFlv',rt.AddressOf(structTTf,'Flv'),'Flv/C') tree.Branch('l1',structL1,'Pt/F:Eta:Phi:Iso:Chg/I') tree.Branch('l2',structL2,'Pt/F:Eta:Phi:Iso:Chg/I') tree.Branch('l3',structL3,'Pt/F:Eta:Phi:Iso:Chg/I') tree.Branch('l4',structL4,'Pt/F:Eta:Phi:Iso:Chg/I') tree.Branch('l1Flv',rt.AddressOf(structL1f,'Flv'),'Flv/C') tree.Branch('l2Flv',rt.AddressOf(structL2f,'Flv'),'Flv/C') tree.Branch('l3Flv',rt.AddressOf(structL3f,'Flv'),'Flv/C') tree.Branch('l4Flv',rt.AddressOf(structL4f,'Flv'),'Flv/C') return tree, structSelect, structEvent, structChannel, struct4l, structH1, structH2, structH1f, structH2f,\ structZ1, structZ1f, structZ2, structZ2f, structTTf, structL1, structL2, structL3, structL4,\ structL1f, structL2f, structL3f, structL4f