本文整理汇总了C++中TChain::SetAlias方法的典型用法代码示例。如果您正苦于以下问题:C++ TChain::SetAlias方法的具体用法?C++ TChain::SetAlias怎么用?C++ TChain::SetAlias使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TChain
的用法示例。
在下文中一共展示了TChain::SetAlias方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AnalysisWithChain
void AnalysisWithChain()
{
TCanvas* c1 = new TCanvas("c1","");
TChain* chain = GetChainFromRunList("runs_groups12.txt");
chain->SetAlias("Valid_HODO_HORIZONTAL","Sum$(abs(TOWER_CALIB_HODO_HORIZONTAL.energy)>30) > 0");
chain->SetAlias("Valid_HODO_VERTICAL","Sum$(abs(TOWER_CALIB_HODO_VERTICAL.energy)>30) > 0");
chain->Draw("TOWER_CALIB_TILE_MAPPER[4].energy>>h1(100,0,400)","Valid_HODO_VERTICAL && Valid_HODO_HORIZONTAL","");
c1->Print("groups12.png");
}
示例2: plotdjr
void plotdjr(const TString & infile, const TString & outfile) {
gSystem->Load("libFWCoreFWLite.so");
AutoLibraryLoader::enable();
TH1::SetDefaultSumw2();
TChain *tree = new TChain("Events");
tree->Add(infile);
tree->SetAlias("GenEvent","GenEventInfoProduct_generator__GEN.obj");
tree->SetAlias("LHEEvent","LHEEventProduct_externalLHEProducer__LHE.obj");
TCut weight = "GenEvent.weight()";
int nbins = 50.;
double djrmin = -0.5;
double djrmax = 3.;
//typeMC sets the kind of sample we are looking at:
//0 is for NLO with FXFX merging;
//1 is for LO with MLM;
//2 is for LO with MLM (plotting partons after excluding non-matched partons in wbb/vbf type processes)
int typeMC = 2;
TCanvas *c1 = new TCanvas("c1", "c1", 800, 600);
TPad *pad[5];
setcanvas(c1,pad);
pad[0]->cd();
makeplot("djr0",tree,weight,"log10(GenEvent.DJRValues_[0])","DJR 0->1",nbins,djrmin,djrmax,typeMC);
pad[1]->cd();
makeplot("djr1",tree,weight,"log10(GenEvent.DJRValues_[1])","DJR 1->2",nbins,djrmin,djrmax,typeMC);
pad[2]->cd();
makeplot("djr2",tree,weight,"log10(GenEvent.DJRValues_[2])","DJR 2->3",nbins,djrmin,djrmax,typeMC);
pad[3]->cd();
makeplot("djr3",tree,weight,"log10(GenEvent.DJRValues_[3])","DJR 3->4",nbins,djrmin,djrmax,typeMC);
pad[4]->cd();
makeplot("djr4",tree,weight,"log10(GenEvent.DJRValues_[4])","DJR 4->5",nbins,djrmin,djrmax,typeMC);
c1->Print(outfile);
return;
}
示例3: plotdjr
void plotdjr(TString filename, const char* outputbase) {
TH1::SetDefaultSumw2();
TChain *tree = new TChain("Events");
tree->Add(filename);
tree->SetAlias("LHEEvent","LHEEventProduct_source__GEN.obj");
tree->SetAlias("GenEvent","GenEventInfoProduct_generator__GEN.obj");
tree->SetAlias("GenParticles","recoGenParticles_genParticles__GEN.obj");
tree->SetAlias("genJets","recoGenJets_ak4GenJets__GEN.obj");
tree->SetAlias("dr0","sqrt( (genJetsCleaned[0].eta()-promptPhotons[0].eta())^2 + atan2(sin(genJetsCleaned[0].phi()-promptPhotons[0].phi()),cos(genJetsCleaned[0].phi()-promptPhotons[0].phi()))^2 )");
tree->SetAlias("dr1","sqrt( (genJetsCleaned[1].eta()-promptPhotons[0].eta())^2 + atan2(sin(genJetsCleaned[1].phi()-promptPhotons[0].phi()),cos(genJetsCleaned[1].phi()-promptPhotons[0].phi()))^2 )");
tree->SetAlias("dr2","sqrt( (genJetsCleaned[2].eta()-promptPhotons[0].eta())^2 + atan2(sin(genJetsCleaned[2].phi()-promptPhotons[0].phi()),cos(genJetsCleaned[2].phi()-promptPhotons[0].phi()))^2 )");
tree->SetAlias("dr3","sqrt( (genJetsCleaned[3].eta()-promptPhotons[0].eta())^2 + atan2(sin(genJetsCleaned[3].phi()-promptPhotons[0].phi()),cos(genJetsCleaned[3].phi()-promptPhotons[0].phi()))^2 )");
TCut weight = "GenEvent.weight()";
int nbins = 50.;
double djrmin = -0.5;
double djrmax = 4.;
makeplot(TString::Format("%s_%s",outputbase,"djr0"),tree,weight,"log10(GenEvent.DJRValues_[0])","DJR 0->1",nbins,djrmin,djrmax);
makeplot(TString::Format("%s_%s",outputbase,"djr1"),tree,weight,"log10(GenEvent.DJRValues_[1])","DJR 1->2",nbins,djrmin,djrmax);
makeplot(TString::Format("%s_%s",outputbase,"djr2"),tree,weight,"log10(GenEvent.DJRValues_[2])","DJR 2->3",nbins,djrmin,djrmax);
makeplot(TString::Format("%s_%s",outputbase,"djr3"),tree,weight,"log10(GenEvent.DJRValues_[3])","DJR 3->4",nbins,djrmin,djrmax);
return;
}
示例4: anaFragShapePtBinsDR
void anaFragShapePtBinsDR(TString infile1="/net/hisrv0001/home/frankma/scratch01/ana/merge/dj_HCPR-J50U-JSON_hiGoodMergedTrksRuns152562to152643-v1_StdAna1204v2.root",
TString infile2="/net/hisrv0001/home/frankma/scratch01/ana/merge/dj_HCPR-GoodTrk1123_All0.root"
)
{
gStyle->SetMarkerStyle(20);
TChain * djcalo = new TChain("djcalo/djTree");
djcalo->Add(infile1);
djcalo->Add(infile2);
aliases_dijet(djcalo);
TString evtSel("(cent<10 && nljet>120 && abs(nljeta)<2 && aljet>50 && abs(aljeta)<2 && jdphi>2.5 && Aj>0.24)");
TH1::SetDefaultSumw2();
//cones reflected in eta. avoid jets *right* at mid-rapidity to avoid overlap
djcalo->SetAlias("pndrrefl","(sqrt(pndphi*pndphi+(peta+nljeta)*(peta+nljeta)))");
djcalo->SetAlias("padrrefl","(sqrt(padphi*padphi+(peta+aljeta)*(peta+aljeta)))");
TString evtSelNS = evtSel + " && (abs(nljeta)>0.5)";
TString evtSelAS = evtSel + " && (abs(aljeta)>0.5)";
//jet energy imbalance
TCanvas * c0 = new TCanvas("c0","c0",500,500);
djcalo->Draw("Aj>>hAj(20,0,1)",evtSel);
//back-to-back correlation
TCanvas * c2 = new TCanvas("c2","c2",500,500);
TH1D * hJDPhi = new TH1D("hJDPhi","hJDPhi",50,0,3.1416);
TH1D * hJDPhi2 = new TH1D("hJDPhi2","hJDPhi",50,0,3.1416);
Float_t numDJNS = djcalo->Draw("jdphi>>hJDPhi",evtSelNS);
Float_t numDJAS = djcalo->Draw("jdphi>>hJDPhi",evtSelAS,"same");
cout << "num djs: " << numDJNS << " (near-side) \t" << numDJAS << " (away-side)" << endl;
//track energy density by dR in pt bins
TString histtitle = ";R(trk,jet);1/N_{DJ} dp_{T}^{Trk}/dR";
TH1D * hPNDRTrk0 = new TH1D("hPNDRTrk0",histtitle.Data(),10,0,TMath::PiOver2());
TH1D * hPADRTrk0 = new TH1D("hPADRTrk0",histtitle.Data(),10,0,TMath::PiOver2());
djcalo->Draw("pndr>>hPNDRTrk0",Form("(%s&&ppt<1.0)*ppt",evtSelNS.Data()),"goff");
djcalo->Draw("padr>>hPADRTrk0",Form("(%s&&ppt<1.0)*ppt",evtSelAS.Data()),"goff");
TH1D * hPNDRReflTrk0 = new TH1D("hPNDRReflTrk0",histtitle.Data(),10,0,TMath::PiOver2());
TH1D * hPADRReflTrk0 = new TH1D("hPADRReflTrk0",histtitle.Data(),10,0,TMath::PiOver2());
djcalo->Draw("pndrrefl>>hPNDRReflTrk0",Form("(%s&&ppt<1.0)*ppt",evtSelNS.Data()),"goff");
djcalo->Draw("padrrefl>>hPADRReflTrk0",Form("(%s&&ppt<1.0)*ppt",evtSelAS.Data()),"goff");
TH1D * hPNDRTrk1 = new TH1D("hPNDRTrk1",histtitle.Data(),10,0,TMath::PiOver2());
TH1D * hPADRTrk1 = new TH1D("hPADRTrk1",histtitle.Data(),10,0,TMath::PiOver2());
djcalo->Draw("pndr>>hPNDRTrk1",Form("(%s&&ppt<2.0&&ppt>=1.0)*ppt",evtSelNS.Data()),"goff");
djcalo->Draw("padr>>hPADRTrk1",Form("(%s&&ppt<2.0&&ppt>=1.0)*ppt",evtSelAS.Data()),"goff");
TH1D * hPNDRReflTrk1 = new TH1D("hPNDRReflTrk1",histtitle.Data(),10,0,TMath::PiOver2());
TH1D * hPADRReflTrk1 = new TH1D("hPADRReflTrk1",histtitle.Data(),10,0,TMath::PiOver2());
djcalo->Draw("pndrrefl>>hPNDRReflTrk1",Form("(%s&&ppt<2.0&&ppt>=1.0)*ppt",evtSelNS.Data()),"goff");
djcalo->Draw("padrrefl>>hPADRReflTrk1",Form("(%s&&ppt<2.0&&ppt>=1.0)*ppt",evtSelAS.Data()),"goff");
TH1D * hPNDRTrk2 = new TH1D("hPNDRTrk2",histtitle.Data(),10,0,TMath::PiOver2());
TH1D * hPADRTrk2 = new TH1D("hPADRTrk2",histtitle.Data(),10,0,TMath::PiOver2());
djcalo->Draw("pndr>>hPNDRTrk2",Form("(%s&&ppt<4.0&&ppt>=2.0)*ppt",evtSelNS.Data()),"goff");
djcalo->Draw("padr>>hPADRTrk2",Form("(%s&&ppt<4.0&&ppt>=2.0)*ppt",evtSelAS.Data()),"goff");
TH1D * hPNDRReflTrk2 = new TH1D("hPNDRReflTrk2",histtitle.Data(),10,0,TMath::PiOver2());
TH1D * hPADRReflTrk2 = new TH1D("hPADRReflTrk2",histtitle.Data(),10,0,TMath::PiOver2());
djcalo->Draw("pndrrefl>>hPNDRReflTrk2",Form("(%s&&ppt<4.0&&ppt>=2.0)*ppt",evtSelNS.Data()),"goff");
djcalo->Draw("padrrefl>>hPADRReflTrk2",Form("(%s&&ppt<4.0&&ppt>=2.0)*ppt",evtSelAS.Data()),"goff");
TH1D * hPNDRTrk4 = new TH1D("hPNDRTrk4",histtitle.Data(),10,0,TMath::PiOver2());
TH1D * hPADRTrk4 = new TH1D("hPADRTrk4",histtitle.Data(),10,0,TMath::PiOver2());
djcalo->Draw("pndr>>hPNDRTrk4",Form("(%s&&ppt<8.0&&ppt>=4.0)*ppt",evtSelNS.Data()),"goff");
djcalo->Draw("padr>>hPADRTrk4",Form("(%s&&ppt<8.0&&ppt>=4.0)*ppt",evtSelAS.Data()),"goff");
TH1D * hPNDRReflTrk4 = new TH1D("hPNDRReflTrk4",histtitle.Data(),10,0,TMath::PiOver2());
TH1D * hPADRReflTrk4 = new TH1D("hPADRReflTrk4",histtitle.Data(),10,0,TMath::PiOver2());
djcalo->Draw("pndrrefl>>hPNDRReflTrk4",Form("(%s&&ppt<8.0&&ppt>=4.0)*ppt",evtSelNS.Data()),"goff");
djcalo->Draw("padrrefl>>hPADRReflTrk4",Form("(%s&&ppt<8.0&&ppt>=4.0)*ppt",evtSelAS.Data()),"goff");
TH1D * hPNDRTrk8 = new TH1D("hPNDRTrk8",histtitle.Data(),10,0,TMath::PiOver2());
TH1D * hPADRTrk8 = new TH1D("hPADRTrk8",histtitle.Data(),10,0,TMath::PiOver2());
djcalo->Draw("pndr>>hPNDRTrk8",Form("(%s&&ppt>=8.0)*ppt",evtSelNS.Data()),"goff");
djcalo->Draw("padr>>hPADRTrk8",Form("(%s&&ppt>=8.0)*ppt",evtSelAS.Data()),"goff");
TH1D * hPNDRReflTrk8 = new TH1D("hPNDRReflTrk8",histtitle.Data(),10,0,TMath::PiOver2());
TH1D * hPADRReflTrk8 = new TH1D("hPADRReflTrk8",histtitle.Data(),10,0,TMath::PiOver2());
djcalo->Draw("pndrrefl>>hPNDRReflTrk8",Form("(%s&&ppt>=8.0)*ppt",evtSelNS.Data()),"goff");
djcalo->Draw("padrrefl>>hPADRReflTrk8",Form("(%s&&ppt>=8.0)*ppt",evtSelAS.Data()),"goff");
hPNDRTrk0->Scale(1./(numDJNS*hPNDRTrk0->GetBinWidth(1)));
hPADRTrk0->Scale(1./(numDJAS*hPADRTrk0->GetBinWidth(1)));
hPNDRReflTrk0->Scale(1./(numDJNS*hPNDRReflTrk0->GetBinWidth(1)));
hPADRReflTrk0->Scale(1./(numDJAS*hPADRReflTrk0->GetBinWidth(1)));
hPNDRTrk1->Scale(1./(numDJNS*hPNDRTrk1->GetBinWidth(1)));
hPADRTrk1->Scale(1./(numDJAS*hPADRTrk1->GetBinWidth(1)));
hPNDRReflTrk1->Scale(1./(numDJNS*hPNDRReflTrk1->GetBinWidth(1)));
hPADRReflTrk1->Scale(1./(numDJAS*hPADRReflTrk1->GetBinWidth(1)));
hPNDRTrk2->Scale(1./(numDJNS*hPNDRTrk2->GetBinWidth(1)));
hPADRTrk2->Scale(1./(numDJAS*hPADRTrk2->GetBinWidth(1)));
hPNDRReflTrk2->Scale(1./(numDJNS*hPNDRReflTrk2->GetBinWidth(1)));
hPADRReflTrk2->Scale(1./(numDJAS*hPADRReflTrk2->GetBinWidth(1)));
hPNDRTrk4->Scale(1./(numDJNS*hPNDRTrk4->GetBinWidth(1)));
hPADRTrk4->Scale(1./(numDJAS*hPADRTrk4->GetBinWidth(1)));
hPNDRReflTrk4->Scale(1./(numDJNS*hPNDRReflTrk4->GetBinWidth(1)));
hPADRReflTrk4->Scale(1./(numDJAS*hPADRReflTrk4->GetBinWidth(1)));
hPNDRTrk8->Scale(1./(numDJNS*hPNDRTrk8->GetBinWidth(1)));
//.........这里部分代码省略.........
示例5: BkgFluctuation
void BkgFluctuation(TString infname = "../ntv6_datambv3rand_djcalo_c0to30_offset0.root",
TCut myCut = "cent<30", char *title = "",bool drawLegend = false,
bool drawSys = true
)
{
gStyle->SetHistLineWidth(2);
// ===========================================================
// Get Input
// ===========================================================
TChain* t = new TChain("ntjt");
t->Add(infname);
t->AddFriend("tcone",infname);
cout << infname << ": " << t->GetEntries() << endl;
t->SetAlias("cptsub0Merge0","cpt[0][1]+cpt[0][2]-(cptbg[0][1]+cptbg[0][2])");
t->SetAlias("cptsub0Merge1","cpt[0][3]-(cptbg[0][3])");
t->SetAlias("cptsub0Merge2","cpt[0][4]+cpt[0][5]-(cptbg[0][4]+cptbg[0][5])");
t->SetAlias("cptsub0Merge3","(Sum$(cpt[0])-cpt[0][0])-(Sum$(cptbg[0])-cptbg[0][0])");
// ===========================================================
// Analysis Setup
// ===========================================================
TH1::SetDefaultSumw2();
const int nBin = 3;
double bins[nBin+1] = {1.,4,8,160};
TCut evtCut = "nljet>100&&abs(nljetacorr)<1.6&&aljet>50&&abs(aljetacorr)<1.6&&jdphi>2./3*TMath::Pi()&&!maskEvt";
TCut exclusion = "abs(nljetacorr)>0.8"; //&&abs(aljetacorr)>0.8";
evtCut = evtCut&&exclusion;
//Int_t colors[7] = {kBlue, kCyan-3, kYellow+1, kOrange+1, kGreen+2, kMagenta, kRed };
Int_t colors[7] = {kYellow+2, kGreen+2,kRed };
// ===========================================================
// Book Histograms
// ===========================================================
vector<TH1D*> vhBgSub;
for (Int_t i=0; i<nBin+1; ++i) {
vhBgSub.push_back(new TH1D(Form("hBgSub_%d"),";(Sig Cone #Sigma p_{T}) - (Bkg Cone #Sigma p_{T}) (GeV/c);fraction;",50,-300,300));
}
Float_t numEvt = t->GetEntries(evtCut&&myCut);
cout << "Total Sel evt: " << numEvt << endl;
for (Int_t i=0; i<nBin+1; ++i) {
TString var(Form("cptsub0Merge%i",i));
cout << "Sel evt: " << t->GetEntries(evtCut&&myCut&&var) << endl;
cout << "var: " << t->GetAlias(var) << endl;
t->Project(vhBgSub[i]->GetName(),var,(evtCut&&myCut&&var)*"weight");
Float_t mean = vhBgSub[i]->GetMean();
Float_t rms = vhBgSub[i]->GetRMS();
cout << "bgsub mean: " << mean << " rms: " << rms << endl;
vhBgSub[i]->Scale(1./numEvt);
cout << "Bin " << i << " rms/sqrt(250): " << rms/sqrt(250)
<< " r=0: " << rms/sqrt(250.)*sqrt(fracArea(0))
<< " r=0.8: " << rms/sqrt(250.)*sqrt(fracArea(0.8)) << endl;
}
TCanvas * c2 = new TCanvas("c2","c2",600,600);
c2->SetLogy();
vhBgSub[nBin]->SetAxisRange(1e-5,5,"Y");
vhBgSub[nBin]->Draw("E");
for (Int_t i=0; i<nBin; ++i) {
vhBgSub[i]->SetLineColor(colors[i]);
vhBgSub[i]->Draw("same hist");
}
vhBgSub[nBin]->Draw("Esame");
TLegend *leg = new TLegend(0.19,0.70,0.53,0.92);
leg->SetFillStyle(0);
leg->SetBorderSize(0);
leg->SetTextSize(0.035);
leg->AddEntry(vhBgSub[nBin],"CMS 0-30%","");
leg->AddEntry(vhBgSub[nBin],"Random Cone (MB Sample)","");
leg->AddEntry(vhBgSub[nBin],Form("> %.1f GeV/c",bins[0]),"pl");
for (int i=0;i<nBin;++i) {
if (i!=nBin-1){
leg->AddEntry(vhBgSub[i],Form("%.1f - %.1f GeV/c",bins[i],bins[i+1]),"l");
} else {
leg->AddEntry(vhBgSub[i],Form("> %.1f GeV/c",bins[i]),"l");
}
}
leg->Draw();
}
示例6: bambuAliases
void bambuAliases(Int_t type=0){
TChain *ev = new TChain("Events");
//data
//ev->Add("/home/edwenger/123596-merged-emptytarget.root");
//ev->Add("/home/edwenger/123596-merged-targettarget.root");
//if(type==0) ev->Add("/home/edwenger/123596-mergetestv4.root");
//if(type==0) ev->Add("/home/edwenger/123596v5-targettarget.root");
//if(type==0) ev->Add("/home/edwenger/124120-merged.root");
if(type==0) ev->Add("/d100/data/ZeroBias-rereco/124022a3a4_v2_1/bambu*.root");
if(type==1) ev->Add("/home/edwenger/123596v5-emptytarget.root");
//mc
//ev->Add("/home/loizides/bambu-summer09-MinBias-GEN-SIM-RAW-STARTUP3X_V8I_900GeV-v2.root");
//ev->Add("/d101/yetkin/mc/CMSSW_3_3_5/BSC_Tuned_v1/Pythia_MinBias_D6T_900GeV_d20091210/bambu/0024CE3C-56E5-DE11-ABDD-002618943930.root");
if(type==2) ev->Add("/home/edwenger/merge_BSC_Tuned_v1_Pythia_MinBias_D6T_900GeV_d20091210.root");
if(type==3) ev->Add("/home/edwenger/merge_BSC_Tuned_v1_Pythia_MinBias_ATLAS_900GeV_d20091208.root");
// event-wide aliases
ev->SetAlias("run","EventHeader.fRunNum");
ev->SetAlias("evtno","EventHeader.fEvtNum");
ev->SetAlias("bunch","EventHeader.fBunchCrossing");
ev->SetAlias("npix","PixelHits.Entries()");
ev->SetAlias("pxl","PixelHits.fArray");
ev->SetAlias("npix1","Sum$(pxl.fType==1)");
ev->SetAlias("npix2","Sum$(pxl.fType==2)");
ev->SetAlias("npix3","Sum$(pxl.fType==3)");
ev->SetAlias("bpix","Sum$(abs(pxl.fType)<10)");
ev->SetAlias("fpix","Sum$(abs(pxl.fType)>10)");
ev->SetAlias("nvtx","PrimaryVertexes.Entries()");
ev->SetAlias("vtx","PrimaryVertexes.fArray");
ev->SetAlias("avtx","Pixel3Vertexes.fArray");
ev->SetAlias("tvtx","TrackletVertexes.fArray");
ev->SetAlias("ntrk","Tracks.Entries()");
ev->SetAlias("ngoodtrk","Sum$(Tracks.fArray.NHits()>9)");
//ev->SetAlias("ngoodtrk","Sum$(Tracks.fArray.NHits()>3 && abs(Tracks.fArray.D0())<0.5)");
ev->SetAlias("parasite","((bunch>=1830 && bunch<=1833) || bunch==3170)");
ev->SetAlias("collision","(bunch==51 || bunch==2724)");
// HLT bits
ev->SetAlias("hlt","HLTBits.fMask");
ev->SetAlias("hltBSC","hlt.TestBit(66)"); //HLT_MinBiasBSC
ev->SetAlias("hltBSC_OR","hlt.TestBit(67)"); //HLT_MinBiasBSC_OR
ev->SetAlias("hltBakBSC","hlt.TestBit(78)"); //HLT_BackwardBSC
ev->SetAlias("hltForBSC","hlt.TestBit(79)"); //HLT_ForwardBSC
ev->SetAlias("hltCSCHalo","hlt.TestBit(74)"); //HLT_CSCBeamHalo
ev->SetAlias("hltPix1","hlt.TestBit(71)"); //HLT_MinBiasPixel_SingleTrack
ev->SetAlias("hltPix2","hlt.TestBit(72)"); //HLT_MinBiasPixel_DoubleTrack
ev->SetAlias("hltEG1","hlt.TestBit(64)");
// l1 technical bits: https://twiki.cern.ch/twiki/bin/viewauth/CMS/GlobalTriggerMenu_L1Menu_Commissioning2009_v8
ev->SetAlias("l1t","L1TechBitsBeforeMask.fMask");
ev->SetAlias("l1t32","l1t.TestBit(32)"); // th1 (inner)
ev->SetAlias("l1t34","l1t.TestBit(34)"); // OR
ev->SetAlias("l1t40","l1t.TestBit(40)"); // th1 (all)
ev->SetAlias("l1t41","l1t.TestBit(41)"); // th2
ev->SetAlias("l1t36","l1t.TestBit(36)"); // halo bits 36-39
ev->SetAlias("l1t37","l1t.TestBit(37)"); //
ev->SetAlias("l1t38","l1t.TestBit(38)"); //
ev->SetAlias("l1t39","l1t.TestBit(39)"); //
ev->SetAlias("l1t35","l1t.TestBit(35)"); // high mult
ev->SetAlias("l1t0","l1t.TestBit(0)"); // BPTX AND
ev->SetAlias("l1t4","l1t.TestBit(4)"); // BPTX AND (instance 1)
ev->SetAlias("l1a","L1AlgoBitsBeforeMask.fMask");
ev->SetAlias("l1a45","l1a.TestBit(45)");
ev->SetAlias("noHalo","(!l1t36 && !l1t37 && !l1t38 && !l1t39)");
// bx info
ev->SetAlias("bx","L1TechBitsBxs.fArray.fBx");
ev->SetAlias("l1tbx","L1TechBitsBxs.fArray.fMask");
ev->SetAlias("l1t0bx","l1tbx.TestBit(0)"); // BPTX AND
ev->SetAlias("l1t4bx","l1tbx.TestBit(4)"); // prescaled (12x) BPTX AND
ev->SetAlias("l1t34bx","l1tbx.TestBit(34)"); // BSC OR
ev->SetAlias("l1t40bx","l1tbx.TestBit(40)"); // BSC coincidence threshold 1
ev->SetAlias("l1t42bx","l1tbx.TestBit(42)"); // BSC splash beam 1
ev->SetAlias("l1t43bx","l1tbx.TestBit(43)"); // BSC splash beam 2
ev->SetAlias("l1t32bx","l1tbx.TestBit(32)"); // BSC coincidence inner threshold 1
// krisztian's 28 events with good agglomerative pixel vertex
ev->SetAlias("kk1","Entry$==4 || Entry$==5 || Entry$==12 || Entry$==25 || Entry$==28 || Entry$==46 || Entry$==55 || Entry$==77 || Entry$==86 || Entry$==102");
ev->SetAlias("kk2","Entry$==116 || Entry$==126 || Entry$==138 || Entry$==144 || Entry$==168 || Entry$==187 || Entry$==188 || Entry$==189 || Entry$==195 || Entry$==199");
ev->SetAlias("kk3","Entry$==200 || Entry$==226 || Entry$==230 || Entry$==244 || Entry$==247 || Entry$==254 || Entry$==258 || Entry$==261");
// events that are 75ns apart
ev->SetAlias("ev1","evtno==2265620 || evtno==2265621");
ev->SetAlias("ev2","evtno==2991369 || evtno==2991370");
// pixel hit positions
ev->SetAlias("layer","pxl.fType");
ev->SetAlias("x","pxl.X()");
ev->SetAlias("y","pxl.Y()");
ev->SetAlias("z","pxl.Z()");
ev->SetAlias("phi","atan(y/x)");
ev->SetAlias("rho","sqrt(x*x+y*y)*sign(y)");
ev->SetAlias("fpixPLUS","Sum$(pxl.fType>10 )");
ev->SetAlias("fpixMINUS","Sum$(pxl.fType<-10)");
//.........这里部分代码省略.........
示例7: FillHists
void FillHists(rt::TH1Container& hc, TChain& chain, const std::string& sample_name, long num_events = std::numeric_limits<long>::max())
{
// number of events
num_events = (chain.GetEntries() < num_events ? chain.GetEntries() : num_events);
std::cout << "Beginning " << sample_name << " on " << num_events << " of " << chain.GetEntries() << " events..." << std::endl;
// scale the # of events
const float nevts_aod = chain.GetMaximum("evt_nEvts"); // # files in AOD
const float nevts_file = chain.GetEntries(); // # files in this sample
const float nevts_scale = nevts_aod/nevts_file; // scale factor to "fix" evt_scale1fb since we are using a subset of the data
// lumi
static const float lumi = 0.082; //fb^-1
// efficiency scale
float eff_scale = 1.0;
if (sample_name == "data" ) {eff_scale = s_SDEfficiency[ 0];}
if (sample_name == "dyll" ) {eff_scale = s_SDEfficiency[ 1];}
if (sample_name == "wjets" ) {eff_scale = s_SDEfficiency[ 2];}
if (sample_name == "ttdil" ) {eff_scale = s_SDEfficiency[ 3];}
if (sample_name == "ttslq" ) {eff_scale = s_SDEfficiency[ 4];}
if (sample_name == "tthad" ) {eff_scale = s_SDEfficiency[ 5];}
if (sample_name == "qcd" ) {eff_scale = s_SDEfficiency[ 6];}
if (sample_name == "ww" ) {eff_scale = s_SDEfficiency[ 7];}
if (sample_name == "wz2l2q" ) {eff_scale = s_SDEfficiency[ 8];}
if (sample_name == "wz3l" ) {eff_scale = s_SDEfficiency[ 9];}
if (sample_name == "zz2l2q" ) {eff_scale = s_SDEfficiency[10];}
if (sample_name == "zz2l2nu") {eff_scale = s_SDEfficiency[11];}
if (sample_name == "zz4l" ) {eff_scale = s_SDEfficiency[12];}
// overall scale
const float scale = lumi * eff_scale * nevts_scale;
std::cout << "scale factor = " << Form("%f * %f * %f = %f", lumi, eff_scale, nevts_scale, scale) << std::endl;
// book hists
hc.Add(new TH1F(Form("h_count_mm_%s", sample_name.c_str()), Form("Event ee count (%s)" , sample_name.c_str()), 3 , -0.5, 2.5));
hc.Add(new TH1F(Form("h_count_ee_%s", sample_name.c_str()), Form("Event #mu#mu count (%s)" , sample_name.c_str()), 3 , -0.5, 2.5));
hc.Add(new TH1F(Form("h_mee_%s" , sample_name.c_str()), Form("Dimuon Electron (%s);m_{ee}(GeV);# Events Expected", sample_name.c_str()), 60, 60, 120));
hc.Add(new TH1F(Form("h_mmm_%s" , sample_name.c_str()), Form("Dimuon Mass (%s);m_{#mu#mu}(GeV);# Events Expected", sample_name.c_str()), 60, 60, 120));
hc.Sumw2();
// alias for dilepton mass
chain.SetAlias("mass_mm_px", "Sum$(abs(genps_id)==13 && genps_status==3 ? genps_p4.Px() : 0.0)");
chain.SetAlias("mass_mm_py", "Sum$(abs(genps_id)==13 && genps_status==3 ? genps_p4.Py() : 0.0)");
chain.SetAlias("mass_mm_pz", "Sum$(abs(genps_id)==13 && genps_status==3 ? genps_p4.Pz() : 0.0)");
chain.SetAlias("mass_mm_e" , "Sum$(abs(genps_id)==13 && genps_status==3 ? genps_p4.E() : 0.0)");
chain.SetAlias("mass_mm" , "sqrt(mass_mm_e*mass_mm_e - mass_mm_px*mass_mm_px - mass_mm_py*mass_mm_py - mass_mm_pz*mass_mm_pz)");
chain.SetAlias("mass_ee_px", "Sum$(abs(genps_id)==11 && genps_status==3 ? genps_p4.Px() : 0.0)");
chain.SetAlias("mass_ee_py", "Sum$(abs(genps_id)==11 && genps_status==3 ? genps_p4.Py() : 0.0)");
chain.SetAlias("mass_ee_pz", "Sum$(abs(genps_id)==11 && genps_status==3 ? genps_p4.Pz() : 0.0)");
chain.SetAlias("mass_ee_e" , "Sum$(abs(genps_id)==11 && genps_status==3 ? genps_p4.E() : 0.0)");
chain.SetAlias("mass_ee" , "sqrt(mass_ee_e*mass_ee_e - mass_ee_px*mass_ee_px - mass_ee_py*mass_ee_py - mass_ee_pz*mass_ee_pz)");
// fill hist
hc.SetDirectory(gDirectory);
const TCut selection_ee = Form("%1.4f*evt_scale1fb*(Sum$(genps_status==3 && genps_id==11)>=1 && Sum$(genps_status==3 && genps_id==-11)>=1)", scale);
chain.Draw(">>event_list_ee", selection_ee, "goff", num_events);
TEventList * const event_list_ee = dynamic_cast<TEventList*>(gDirectory->Get("event_list_ee"));
chain.SetEventList(event_list_ee);
std::cout << "filling ee hists..." << std::endl;
chain.Draw(Form("1>>h_count_ee_%s" , sample_name.c_str()), selection_ee, "goff", num_events);
chain.Draw(Form("mass_ee>>h_mee_%s", sample_name.c_str()), selection_ee, "goff", num_events);
const TCut selection_mm = Form("%1.4f*evt_scale1fb*(Sum$(genps_status==3 && genps_id==13)>=1 && Sum$(genps_status==3 && genps_id==-13)>=1)", scale);
chain.SetEventList(NULL);
chain.Draw(">>event_list_mm", selection_mm, "goff", num_events);
TEventList * const event_list_mm = dynamic_cast<TEventList*>(gDirectory->Get("event_list_mm"));
chain.SetEventList(event_list_mm);
std::cout << "filling mm hists..." << std::endl;
chain.Draw(Form("1>>h_count_mm_%s" , sample_name.c_str()), selection_mm, "goff", num_events);
chain.Draw(Form("mass_mm>>h_mmm_%s", sample_name.c_str()), selection_mm, "goff", num_events);
hc.SetDirectory(NULL);
std::cout << "Complete " << sample_name << ": ";
std::cout << "mm count = " << rt::Integral(hc["h_count_mm_"+sample_name]) << " (" << hc["h_count_mm_"+sample_name]->GetEntries() << ") : ";
std::cout << "ee count = " << rt::Integral(hc["h_count_ee_"+sample_name]) << " (" << hc["h_count_ee_"+sample_name]->GetEntries() << ")\n" << std::endl;
// done
return;
}