UInt_t GetListOfKeys( TList& keys, TString inherits, TDirectory *dir=0 ) { // get a list of keys with a given inheritance // the list contains TKey objects if (dir==0) dir = gDirectory; TIter mnext(dir->GetListOfKeys()); TKey *mkey; keys.Clear(); keys.SetOwner(kFALSE); UInt_t ni=0; while ((mkey = (TKey*)mnext())) { // make sure, that we only look at TDirectory with name Method_<xxx> TClass *cl = gROOT->GetClass(mkey->GetClassName()); if (cl->InheritsFrom(inherits)) { keys.Add(mkey); ni++; } } return ni; }
UInt_t GetListOfTitles( TString & methodName, TList & titles, TDirectory *dir=0 ) { // get the list of all titles for a given method // if the input dir is 0, gDirectory is used // returns a list of keys UInt_t ni=0; if (dir==0) dir = gDirectory; TDirectory* rfdir = (TDirectory*)dir->Get( methodName ); if (rfdir==0) { cout << "+++ Could not locate directory '" << methodName << endl; return 0; } return GetListOfTitles( rfdir, titles ); TList *keys = rfdir->GetListOfKeys(); if (keys==0) { cout << "+++ Directory '" << methodName << "' contains no keys" << endl; return 0; } // TIter rfnext(rfdir->GetListOfKeys()); TKey *rfkey; titles.Clear(); titles.SetOwner(kFALSE); while ((rfkey = (TKey*)rfnext())) { // make sure, that we only look at histograms TClass *cl = gROOT->GetClass(rfkey->GetClassName()); if (cl->InheritsFrom("TDirectory")) { titles.Add(rfkey); ni++; } } cout << "--- Found " << ni << " instance(s) of the method " << methodName << endl; return ni; }
UInt_t GetListOfMethods( TList & methods, TDirectory *dir=0 ) { // get a list of methods // the list contains TKey objects if (dir==0) dir = gDirectory; TIter mnext(dir->GetListOfKeys()); TKey *mkey; methods.Clear(); methods.SetOwner(kFALSE); UInt_t ni=0; while ((mkey = (TKey*)mnext())) { // make sure, that we only look at TDirectory with name Method_<xxx> TString name = mkey->GetClassName(); TClass *cl = gROOT->GetClass(name); if (cl->InheritsFrom("TDirectory")) { if (TString(mkey->GetName()).BeginsWith("Method_")) { methods.Add(mkey); ni++; } } } cout << "--- Found " << ni << " classifier types" << endl; return ni; }
//================================================ void embed(int save = 0) { char *run_config = "Embed.fix."; TString fileName; if(year==2013) fileName = Form("Run13.pp500.jpsi.%sroot",run_config); f = TFile::Open(Form("./output/%s",fileName.Data()),"read"); THnSparseF *hnDtof = (THnSparseF*)f->Get("mhMcTofQA_di_mu"); // dtof vs pt TH2F *hTofVsPt = (TH2F*)hnDtof->Projection(0,3); hTofVsPt->SetName("Embed_dTof_vs_pt"); hTofVsPt->SetTitle("Embedding: tof_{mc} - tof_{exp} vs p_{T}"); hTofVsPt->GetXaxis()->SetRangeUser(0,12); hTofVsPt->GetYaxis()->SetRangeUser(-1,1); c = draw2D(hTofVsPt); if(save) { c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/qa_dTof/%sdTof_vs_pt.pdf",run_type,run_config)); c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/qa_dTof/%sdTof_vs_pt.png",run_type,run_config)); } // dtof vs mctof TH2F *hTofVsMcTof = (TH2F*)hnDtof->Projection(0,1); hTofVsMcTof->SetName("Embed_dTof_vs_mc_tof"); hTofVsMcTof->SetTitle("Embedding: tof_{mc} - tof_{exp} vs tof_{mc}"); hTofVsMcTof->GetXaxis()->SetRangeUser(13,17); hTofVsMcTof->GetYaxis()->SetRangeUser(-1,1); c = draw2D(hTofVsMcTof); if(save) { c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/qa_dTof/%sdTof_vs_mctof.pdf",run_type,run_config)); c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/qa_dTof/%sdTof_vs_mctof.png",run_type,run_config)); } // dtof vs exptof TH2F *hTofVsExpTof = (TH2F*)hnDtof->Projection(0,2); hTofVsExpTof->SetName("Embed_dTof_vs_exp_tof"); hTofVsExpTof->SetTitle("Embedding: tof_{mc} - tof_{exp} vs tof_{exp}"); hTofVsExpTof->GetXaxis()->SetRangeUser(13,17); hTofVsExpTof->GetYaxis()->SetRangeUser(-1,1); c = draw2D(hTofVsExpTof); if(save) { c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/qa_dTof/%sdTof_vs_exptof.pdf",run_type,run_config)); c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/qa_dTof/%sdTof_vs_exptof.png",run_type,run_config)); } // dtof vs module TH2F *hTofVsMod = (TH2F*)hnDtof->Projection(0,4); hTofVsMod->SetName("Embed_dTof_vs_module"); hTofVsMod->SetTitle("Embedding: tof_{mc} - tof_{exp} vs backleg"); hTofVsMod->GetYaxis()->SetRangeUser(-1,1); c = draw2D(hTofVsMod); if(save) { c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/qa_dTof/%sdTof_vs_backleg.pdf",run_type,run_config)); c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/qa_dTof/%sdTof_vs_backleg.png",run_type,run_config)); } // dtof intervals TList *list = new TList; TString legName[3]; TH1F *histo[3][3]; double low_bounds[3] = {-5, 0.15, -0.16}; double up_bounds[3] = {5, 0.16, -0.15}; char *name[3] = {"mc_tof","exp_tof","pt"}; double scale[3] = {2,2.5,1.5}; double min[3] = {12,12,0}; double max[3]= {18,18,12}; for(int i=0; i<3; i++) { list->Clear(); for(int j=0; j<3; j++) { hnDtof->GetAxis(0)->SetRangeUser(low_bounds[j]+0.001,up_bounds[j]-0.001); histo[i][j] = (TH1F*)hnDtof->Projection(i+1); histo[i][j]->SetName(Form("%s_dTofBin%d",name[i],j)); histo[i][j]->Scale(1./histo[i][j]->Integral()); histo[i][j]->SetLineWidth(2); histo[i][j]->SetMaximum(scale[i]*histo[i][j]->GetMaximum()); legName[j] = Form("%2.2f #leq #Deltatof #leq %2.2f ns",low_bounds[j],up_bounds[j]); list->Add(histo[i][j]); } c = drawHistos(list,name[i],Form("Embedding: %s distributions",name[i]),kTRUE,min[i],max[i],kFALSE,0.1,10,kFALSE,kTRUE,legName,kTRUE,"",0.5,0.7,0.6,0.85,kFALSE); if(save) { c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/qa_dTof/%s%s_in_dTofBin.pdf",run_type,run_config,name[i])); c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/qa_dTof/%s%s_in_dTofBin.png",run_type,run_config,name[i])); } } hnDtof->GetAxis(0)->SetRange(0,-1); // dtof in module TH1F *hTofInMod[5]; TH2F *hTofVsProjMod[5]; for(int i=0; i<5; i++) { hnDtof->GetAxis(5)->SetRange(i+1,i+1); hTofInMod[i] = (TH1F*)hnDtof->Projection(0); hTofInMod[i]->SetName(Form("hTof_Mod%d",i+1)); hTofVsProjMod[i] = (TH2F*)hnDtof->Projection(0,6); hTofVsProjMod[i]->SetName(Form("hTofVsProjMod_Mod%d",i+1)); } hnDtof->GetAxis(5)->SetRange(0,-1); TCanvas *c = new TCanvas("hTof_in_mod","hTof_in_mod",1100,750); c->Divide(3,2); for(int i=0; i<5; i++) { c->cd(i+1); gPad->SetLogy(); hTofInMod[i]->Draw(); hTofInMod[i]->SetTitle(""); hTofInMod[i]->GetXaxis()->SetRangeUser(-1,2); TPaveText *t1 = GetTitleText(Form("Module %d",i+1),0.05); t1->Draw(); } if(save) { c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/qa_dTof/%sdTof_in_module.pdf",run_type,run_config)); c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/qa_dTof/%sdTof_in_module.png",run_type,run_config)); } TCanvas *c = new TCanvas("hTofVsProjMod_in_mod","hTofVsProjMod_in_mod",1100,750); c->Divide(3,2); for(int i=0; i<5; i++) { c->cd(i+1); gPad->SetLogz(); hTofVsProjMod[i]->SetTitle(";track module"); hTofVsProjMod[i]->GetYaxis()->SetRangeUser(-0.5,0.5); hTofVsProjMod[i]->Draw("colz"); TPaveText *t1 = GetTitleText(Form("Hit in module %d",i+1),0.05); t1->Draw(); } if(save) { c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/qa_dTof/%sdTofVsProjMod_in_module.pdf",run_type,run_config)); c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/qa_dTof/%sdTofVsProjMod_in_module.png",run_type,run_config)); } }
//================================================ void fitDzInMod(const int save = 0) { TFile *fin = TFile::Open(Form("Rootfiles/%s%s.TrkMthResidual.root",run_cfg_name.Data(),run_type)); TH2F *hDzVsModBL = (TH2F*)fin->Get(Form("hTrkDzVsModBL_%s",trigName[kTrigType])); c = draw2D(hDzVsModBL,Form("%s: #Deltaz of matched track-hit pairs;module;#Deltaz (cm)",trigName[kTrigType])); if(save) { c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_Match/%sDeltaZ_vs_ModInBL_%s.pdf",run_type,run_cfg_name.Data(),trigName[kTrigType])); c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_Match/%sDeltaZ_vs_ModInBL_%s.png",run_type,run_cfg_name.Data(),trigName[kTrigType])); } TCanvas *canvas[3]; for(int i=0; i<3; i++) { canvas[i] = new TCanvas(Form("canvas_%d",i),Form("canvas_%d",i),1100,800); canvas[i]->Divide(5,5); } Int_t counter=0; TH1F *hDz[30][5]; TH1F *hDzMean[5]; TH1F *hDzSigma[5]; for(int j=0; j<5; j++) { hDzMean[j] = new TH1F(Form("hTrkDzMean_Mod%d_%s",j+1,trigName[kTrigType]),Form("%s: mean of #Deltaz from fit;module;<#Deltaz> (cm)",trigName[kTrigType]),150,0,150); hDzSigma[j] = new TH1F(Form("hDzSigma_Mod%d_%s",j+1,trigName[kTrigType]),Form("%s: sigma of #Deltaz from fit;module;#sigma(#Deltaz) (cm)",trigName[kTrigType]),150,0,150); } for(int i=0; i<30; i++) { for(int j=0; j<5; j++) { hDz[i][j] = (TH1F*)fin->Get(Form("hTrkDz_BL%d_Mod%d_%s",i+1,j+1,trigName[kTrigType])); if(i==6 && j==4) counter++; if(hDz[i][j]->GetEntries()<=0) continue; canvas[counter/25]->cd(counter%25+1); hDz[i][j]->GetXaxis()->SetRangeUser(-60,100); hDz[i][j]->SetTitle(""); hDz[i][j]->SetLineColor(1); hDz[i][j]->SetLineWidth(2); hDz[i][j]->Draw(); TF1 *func = new TF1(Form("Fit_%s",hDz[i][j]->GetName()),"gaus",-20,25); hDz[i][j]->Fit(func,"IRQ0"); func->SetLineColor(2); func->SetLineStyle(2); func->Draw("sames"); TPaveText *t1 = GetPaveText(0.15,0.35,0.6,0.8,0.1); t1->AddText(Form("BL %d",i+1)); t1->AddText(Form("Mod %d",j+1)); t1->Draw(); counter++; hDzMean[j]->SetBinContent(i*5+j+1,func->GetParameter(1)); hDzMean[j]->SetBinError(i*5+j+1,func->GetParError(1)); hDzSigma[j]->SetBinContent(i*5+j+1,func->GetParameter(2)); hDzSigma[j]->SetBinError(i*5+j+1,func->GetParError(2)); } } if(save) { for(int i=0; i<3; i++) { canvas[i]->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_Match/%sFitDz_vs_Mod_%d_%s.pdf",run_type,run_cfg_name.Data(),i,trigName[kTrigType])); canvas[i]->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_Match/%sFitDz_vs_Mod_%d_%s.png",run_type,run_cfg_name.Data(),i,trigName[kTrigType])); } } TList *list = new TList; list->Clear(); TString legName[5]; for(Int_t j=0; j<5; j++) { legName[j] = Form("Module %d",j+1); list->Add(hDzMean[j]); } c = drawHistos(list,"TrkDzMean","",kTRUE,0,150,kTRUE,-4,14,kFALSE,kTRUE,legName,kTRUE,"",0.45,0.6,0.6,0.88,kTRUE); TLine *line = GetLine(0,0,150,0,1); line->Draw(); if(save) { c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_Match/%sFitDzMean_vs_Mod_%s.pdf",run_type,run_cfg_name.Data(),trigName[kTrigType])); c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_Match/%sFitDzMean_vs_Mod_%s.png",run_type,run_cfg_name.Data(),trigName[kTrigType])); } list->Clear(); for(Int_t j=0; j<5; j++) { list->Add(hDzSigma[j]); } c = drawHistos(list,"TrkDzSigma","",kTRUE,0,150,kTRUE,6,19,kFALSE,kTRUE,legName,kTRUE,"",0.2,0.35,0.18,0.42,kTRUE); if(save) { c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_Match/%sFitDzSigma_vs_Mod_%s.pdf",run_type,run_cfg_name.Data(),trigName[kTrigType])); c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_Match/%sFitDzSigma_vs_Mod_%s.png",run_type,run_cfg_name.Data(),trigName[kTrigType])); } }
//================================================ void DeltaZVsPos(const Int_t save = 0) { THnSparseF *hn = (THnSparseF*)f->Get(Form("mhTrkDzDy_%s",trigName[kTrigType])); TList *list = new TList; // dz vs BL TH2F *hTrkDzVsBL = (TH2F*)hn->Projection(1,3); c = draw2D(hTrkDzVsBL,Form("%s: #Deltaz of matched track-hit pairs",trigName[kTrigType])); if(save) { c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_Match/%sDeltaZ_vs_BL_%s.pdf",run_type,run_cfg_name.Data(),trigName[kTrigType])); c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_Match/%sDeltaZ_vs_BL_%s.png",run_type,run_cfg_name.Data(),trigName[kTrigType])); } list->Clear(); TString legName[30]; TH1F *hTrkDzInBL[30]; Int_t counter = 0; for(Int_t i=0; i<30; i++) { hTrkDzInBL[i] = (TH1F*)hTrkDzVsBL->ProjectionY(Form("hDeltaZ_BL%d",i+1),i+1,i+1); if(hTrkDzInBL[i]->GetEntries()>0) { legName[counter] = Form("Module %d",i+1); hTrkDzInBL[i]->SetLineColor(color[counter]); list->Add(hTrkDzInBL[i]); counter ++; } } c = drawHistos(list,"TrkDzInBL",Form("%s: #Deltaz of matched track-hit pairs in backleg;#Deltaz (cm)",trigName[kTrigType]),kTRUE,-100,100,kTRUE,0,1.2*hTrkDzInBL[1]->GetMaximum(),kFALSE,kTRUE,legName,kTRUE,"",0.15,0.25,0.2,0.88,kFALSE,0.04,0.04,kFALSE,1,kTRUE,kFALSE); TLine *line = GetLine(0,0,0,1.1*hTrkDzInBL[1]->GetMaximum(),1); line->Draw(); if(save) { c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_Match/%sDeltaZ_in_BL_%s.pdf",run_type,run_cfg_name.Data(),trigName[kTrigType])); c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_Match/%sDeltaZ_in_BL_%s.png",run_type,run_cfg_name.Data(),trigName[kTrigType])); } // dz vs Mod TH2F *hTrkDzVsMod = (TH2F*)hn->Projection(1,4); c = draw2D(hTrkDzVsMod,Form("%s: #Deltaz of matched track-hit pairs",trigName[kTrigType])); if(save) { c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_Match/%sDeltaZ_vs_Mod_%s.pdf",run_type,run_cfg_name.Data(),trigName[kTrigType])); c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_Match/%sDeltaZ_vs_Mod_%s.png",run_type,run_cfg_name.Data(),trigName[kTrigType])); } TH1F *hMthMod = (TH1F*)hTrkDzVsMod->ProjectionX("hMthMod"); hMthMod->Sumw2(); hMthMod->Scale(1./hMthMod->Integral()); TH2F *hMtdHitMap = (TH2F*)f->Get(Form("mhMtdHitMap_%s",trigName[kTrigType])); TH1F *htmp = (TH1F*)hMtdHitMap->ProjectionY("hHitMod_finebin"); htmp->Rebin(12); TH1F *hMtdHitMod = new TH1F(Form("hMtdHitMod_%s",trigName[kTrigType]),"# of MTD hits per module;module",5,1,6); for(int i=0; i<hMtdHitMod->GetNbinsX(); i++) { hMtdHitMod->SetBinContent(i+1,htmp->GetBinContent(i+1)); hMtdHitMod->SetBinError(i+1,htmp->GetBinError(i+1)); } hMtdHitMod->Scale(1./hMtdHitMod->Integral()); list->Clear(); list->Add(hMthMod); list->Add(hMtdHitMod); TString legName3[2] = {"Matched good hits","All good hits"}; c = drawHistos(list,"MtdHitMod",Form("%s: MTD hits per module;module;probability",trigName[kTrigType]),kFALSE,0,5,kTRUE,0,0.5,kFALSE,kTRUE,legName3,kTRUE,"",0.15,0.25,0.6,0.88,kTRUE); if(save) { c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_Match/%sCompMtdHitMod_%s.pdf",run_type,run_cfg_name.Data(),trigName[kTrigType])); c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_Match/%sCompMtdHitMod_%s.png",run_type,run_cfg_name.Data(),trigName[kTrigType])); } list->Clear(); TString legName2[5]; TH1F *hTrkDzInMod[5]; for(Int_t i=0; i<5; i++) { hTrkDzInMod[i] = (TH1F*)hTrkDzVsMod->ProjectionY(Form("hDeltaZ_Mod%d",i+1),i+1,i+1); legName2[i] = Form("Module %d",i+1); list->Add(hTrkDzInMod[i]); } c = drawHistos(list,"TrkDzInMod",Form("%s: #Deltaz of matched track-hit pairs in module;#Deltaz (cm)",trigName[kTrigType]),kTRUE,-100,100,kTRUE,0,1.2*hTrkDzInMod[3]->GetMaximum(),kFALSE,kTRUE,legName2,kTRUE,"",0.15,0.25,0.6,0.88,kTRUE); TLine *line = GetLine(0,0,0,hTrkDzInMod[3]->GetMaximum()*1.05,1); line->Draw(); if(save) { c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_Match/%sDeltaZ_in_Mod_%s.pdf",run_type,run_cfg_name.Data(),trigName[kTrigType])); c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_Match/%sDeltaZ_in_Mod_%s.png",run_type,run_cfg_name.Data(),trigName[kTrigType])); } }
int TTrdItf_DDABOSS::QryStocks() { if (FFix == NULL) return -1; char buffer[512]; char temp[20]; int nResult; FDll.FixCreate(FFix, FUNC_JY_CCCX); FDll.FixSet(FFix, FID_KHH, FKHH); if( FRequest.QryStocks.Market != mtNo) { FDll.FixSet(FFix, FID_JYS, ConvertMarketType( FRequest.QryStocks.Market )); FDll.FixSet(FFix, FID_GDH, GetStockAccountByMarket(FRequest.QryStocks.Market)); } if (FDll.FixWrite(FFix) < 0) {SetError();return -2; } TList * lstAns = new TList(); try { while (1) { nResult = FDll.FixReadEx(FFix, 1000); FDll.FixGetBuffer(FFix, buffer, sizeof(buffer)-1); if (nResult <= 0) break; if (FDll.FixGetRecNo(FFix) < 0) break; TStockInfo *si = new TStockInfo; memset(si, 0, sizeof(TStockInfo)); strncpy(si->SecuID , FDll.FixGet(FFix, FID_ZQDM, buffer, 0), sizeof(si->SecuID)); strncpy(si->Account, FDll.FixGet(FFix, FID_GDH, buffer, 0), sizeof(si->Account)); si->PosDir = ConvertPosDir(""); si->Market = ConvertMarketType(FDll.FixGet(FFix,FID_JYS,buffer,0)); si->Balance= FDll.FixGetInt(FFix, FID_ZQSL); si->Available = FDll.FixGetInt(FFix, FID_KMCSL); si->CostPrice = FDll.FixGetDouble(FFix, FID_MRJJ); si->CurPrice = FDll.FixGetDouble(FFix, FID_ZXJ); si->PosNum = si->Balance + +FDll.FixGetInt(FFix, FID_FLTSL) //表示当天赎回的数量(股票)或当天申购的数量(ETF) +FDll.FixGetInt(FFix, FID_DRMRCJSL) //当日买入成交数量 -FDll.FixGetInt(FFix, FID_DRMCCJSL) //当日卖出成交数量 +FDll.FixGetInt(FFix, FID_PGSL) //配股未上市数量 ; lstAns->Add(si); } if (lstAns->Count > 0) { NewAns(lstAns->Count); for (int i = 0; i < lstAns->Count; i++) { TStockInfo *si = (TStockInfo *)lstAns->Items[i]; memcpy(&(*FAnswer)[i].QryStocks.StockInfo, si, sizeof(TStockInfo)); } } for (int i = 0; i < lstAns->Count; i++) { TStockInfo *si = (TStockInfo *)lstAns->Items[i]; delete si; } lstAns->Clear(); } __finally { delete lstAns; } return 0; }
int TTrdItf_DDABOSS::QryCurTrd() { if (FFix == NULL) return -1; char buffer[512]; char temp[20]; int nResult; FDll.FixCreate(FFix, FUNC_JY_FBCJCX); FDll.FixSet(FFix, FID_KHH, FKHH); if( FRequest.QryCurTrd.OrderID[0] != 0 ) { FDll.FixSet(FFix, FID_WTH, FRequest.QryCurTrd.OrderID); } if (FDll.FixWrite(FFix) < 0){SetError(); return -2;} TList * lstAns = new TList(); try { while (1) { nResult = FDll.FixReadEx(FFix, 1000); FDll.FixGetBuffer(FFix, buffer, sizeof(buffer)-1); if (nResult <= 0) break; if (FDll.FixGetRecNo(FFix) < 0) break; TTradeInfo *ti = new TTradeInfo; memset(ti, 0, sizeof(TTradeInfo)); strncpy(ti->SecuID, FDll.FixGet(FFix, FID_ZQDM, buffer, 0), CODE_LEN); strncpy(ti->ContractID ,FDll.FixGet(FFix,FID_WTH,buffer,0),SEQ_LEN); strncpy(ti->TrdID, FDll.FixGet(FFix, FID_CJBH, buffer, 0), SEQ_LEN); ti->Time = ConvertTimeToInt(FDll.FixGet(FFix, FID_CJSJ, buffer, 0)); ti->Date = ConvertDateToInt(FDll.FixGet(FFix, FID_RQ, buffer, 0)); ti->Type = ConvertOrderType(FDll.FixGet(FFix, FID_WTLB, buffer, 0)); ti->Market = ConvertMarketType(FDll.FixGet(FFix, FID_JYS, buffer, 0)); ti->Vol = FDll.FixGetInt(FFix, FID_CJSL); FDll.FixGet(FFix,FID_CXBZ,buffer,0); if( buffer[0] == 'W' ) ti->Vol = -abs(ti->Vol); ti->Price = FDll.FixGetDouble(FFix, FID_CJJG); strncpy(ti->Account , FDll.FixGet(FFix,FID_GDH,buffer,0),sizeof(ti->Account)); lstAns->Add(ti); } if (lstAns->Count > 0) { NewAns(lstAns->Count); for (int i = 0; i < lstAns->Count; i++) { TTradeInfo *ti = (TTradeInfo *)lstAns->Items[i]; memcpy(&(*FAnswer)[i].QryCurTrd.TrdInfo, ti, sizeof(TTradeInfo)); } } for (int i = 0; i < lstAns->Count; i++) { TTradeInfo *ti = (TTradeInfo *)lstAns->Items[i]; delete ti; } lstAns->Clear(); } __finally { delete lstAns; } return 0; }
/* int TTrdItf_DDABOSS::QryDetail() { if(FRequest.QryDetail.ContractID[0]==0) return -1; if (FFix == NULL) return -1; char buffer[512]; FDll.FixCreate(FFix, 14100); FDll.FixSet(FFix, FID_WTH, FRequest.QryDetail.ContractID); int nResult = FDll.FixWrite(FFix); if (nResult >= 0) { nResult = FDll.FixReadEx(FFix, 1000); FDll.FixGetBuffer(FFix, buffer, sizeof(buffer)-1); if (nResult > 0) { NewAns(1); (*FAnswer)[0].QryDetail.Num = FDll.FixGetInt(FFix, FID_CJSL); (*FAnswer)[0].QryDetail.Price = FDll.FixGetDouble(FFix, FID_CJJG); (*FAnswer)[0].QryDetail.UndoNum = -FDll.FixGetInt(FFix, FID_CDSL); } else { return -3; } } else { return -2; } return 0; } */ int TTrdItf_DDABOSS::QryCurCsn() { if (FFix == NULL) return -1; char buffer[512]; int nResult; FDll.FixCreate(FFix, FUNC_JY_DRWTCX); FDll.FixSet(FFix, FID_KHH, FKHH); if( FRequest.QryCurCsn.OrderID[0] != 0 ) { FDll.FixSet(FFix, FID_WTH, FRequest.QryCurCsn.OrderID); } if (FDll.FixWrite(FFix) < 0) { SetError(); return -2; } TList * lstAns = new TList(); try { while (1) { nResult = FDll.FixReadEx(FFix, 1000); FDll.FixGetBuffer(FFix, buffer, sizeof(buffer)-1); if (nResult <= 0) break; if (FDll.FixGetRecNo(FFix) < 0) break; TOrderInfo *ci = new TOrderInfo; memset(ci, 0, sizeof(TOrderInfo)); lstrcpyn(ci->ContractID, FDll.FixGet(FFix, FID_WTH, buffer, 0), sizeof(ci->ContractID)); lstrcpyn(ci->SecuID, FDll.FixGet(FFix, FID_ZQDM, buffer, 0), sizeof(ci->SecuID)); ci->Market = ConvertMarketType( FDll.FixGet(FFix,FID_JYS,buffer,0)); ci->Time = ConvertTimeToInt( FDll.FixGet(FFix, FID_WTSJ, buffer, 0)); ci->Date = ConvertDateToInt( FDll.FixGet(FFix, FID_RQ, buffer, 0)); ci->Type = ConvertOrderType( FDll.FixGet(FFix, FID_WTLB, buffer, 0)); //ci->State= ConvertOrderState(FDll.FixGet(FFix, FID_SBJG, buffer,0)); ci->State= ConvertOrderState(FDll.FixGet(FFix, FID_SBJGSM, buffer,0)); ci->CsnVol = FDll.FixGetInt(FFix, FID_WTSL); ci->TrdVol = FDll.FixGetInt(FFix, FID_CJSL); ci->CancelVol = FDll.FixGetInt(FFix, FID_CDSL); ci->CsnPrice = FDll.FixGetDouble(FFix, FID_WTJG); ci->TrdPrice = FDll.FixGetDouble(FFix, FID_CJJG); lstrcpyn(ci->Account, FDll.FixGet(FFix, FID_GDH, buffer, 0), sizeof(ci->Account)); lstAns->Add(ci); } if (lstAns->Count > 0) { NewAns(lstAns->Count); for (int i = 0; i < lstAns->Count; i++) { TOrderInfo *ci = (TOrderInfo *)lstAns->Items[i]; memcpy(&(*FAnswer)[i].QryCurCsn.OrderInfo, ci, sizeof(TOrderInfo)); } } for (int i = 0; i < lstAns->Count; i++) { TOrderInfo *ci = (TOrderInfo *)lstAns->Items[i]; delete ci; } lstAns->Clear(); } __finally { delete lstAns; } return 0; }
//================================================ void All(const int compCount = 1, const int compEff = 1, const int compRef = 1, const int savePlot = 1) { const char* dataType[2] = {"New","Old"}; // Jpsi efficiency vs. pT const int nPtBins = nPtBins_pt; const double* ptBins_low = ptBins_low_pt; const double* ptBins_high = ptBins_high_pt; const char** ptName = pt_Name_pt; const int nCentBins = nCentBins_pt; const int* centBins_low = centBins_low_pt; const int* centBins_high = centBins_high_pt; const char** cent_Name = cent_Name_pt; const char** cent_Title = cent_Title_pt; const int kNCent = nCentBins_npart[0]; const int nbins = nPtBins -1; double xbins[nbins+1]; for(int i=0; i<nbins; i++) xbins[i] = ptBins_low[i+1]; xbins[nbins] = ptBins_high[nbins]; TList *list = new TList; if(compCount) { TFile *fSig[2]; fSig[0] = TFile::Open(Form("Rootfiles/%s.JpsiYield.pt%1.1f.pt%1.1f.root",run_type,pt1_cut,pt2_cut),"read"); fSig[1] = TFile::Open(Form("Rootfiles/old.%s.JpsiYield.pt%1.1f.pt%1.1f.root",run_type,pt1_cut,pt2_cut),"read"); TH1F *hJpsiCounts[2][7]; TCanvas *c = new TCanvas("comp_JpsiCounts", "comp_JpsiCounts", 1100, 500); c->Divide(4,2); TLegend *leg = new TLegend(0.3,0.3,0.6,0.6); leg->SetBorderSize(0); leg->SetFillColor(0); leg->SetTextFont(62); leg->SetTextSize(0.08); for(int k=0; k<7; k++) { for(int j=0; j<2; j++) { if(k<5) hJpsiCounts[j][k] = (TH1F*)fSig[j]->Get(Form("Jpsi_FitYield_cent%s_weight",cent_Title[k])); else hJpsiCounts[j][k] = (TH1F*)fSig[j]->Get(Form("Jpsi_FitYield_pt%s_weight",pt_Name_npart[k-5])); hJpsiCounts[j][k]->SetName(Form("%s_%d",hJpsiCounts[j][k]->GetName(),j)); hJpsiCounts[j][k]->SetMarkerStyle(21+j*4); hJpsiCounts[j][k]->SetMarkerColor(j+1); hJpsiCounts[j][k]->SetLineColor(j+1); c->cd(k+1); gPad->SetLogy(); if(k==2 || k==3) hJpsiCounts[j][k]->GetXaxis()->SetRangeUser(0.5,10); if(k==4) hJpsiCounts[j][k]->GetXaxis()->SetRangeUser(0.5,6); hJpsiCounts[j][k]->SetTitle(";;Counts"); if(k<5) hJpsiCounts[j][k]->SetXTitle("p_{T} [GeV/c]"); if(j==0) hJpsiCounts[j][k]->Draw(); else hJpsiCounts[j][k]->Draw("sames"); if(k==0) leg->AddEntry(hJpsiCounts[j][k], dataType[j], "P"); } if(k<5) TPaveText *t1 = GetTitleText(Form("%s: %s%%",run_type,cent_Name[k]),0.06); else TPaveText *t1 = GetTitleText(Form("%s: %s",run_type,pt_Title_npart[k-5]),0.06); t1->Draw(); } c->cd(8); leg->Draw(); if(savePlot) c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_CompAll/Compare_JpsiCounts.pdf",run_type)); } if(compEff) { const char *trkEffType[6] = {"MC","Tpc","MtdMth","MuonPid","MtdTrig","TrigUnit"}; TFile *fEff[2]; fEff[0] = TFile::Open(Form("Rootfiles/%s.EmbJpsiEff.pt%1.1f.pt%1.1f.root",run_type,pt1_cut,pt2_cut),"read"); fEff[1] = TFile::Open(Form("Rootfiles/old.%s.EmbJpsiEff.pt%1.1f.pt%1.1f.root",run_type,pt1_cut,pt2_cut),"read"); const int nHistos = 6; TH1F *hJpsiPt[2][nHistos][nCentBins]; TH1F *hJpsiPtEffs[2][nHistos][nCentBins]; for(int j=0; j<2; j++) { for(int i=0; i<nHistos; i++) { for(int k=0; k<nCentBins; k++) { hJpsiPt[j][i][k] = (TH1F*)fEff[j]->Get(Form("hJpsiPt_%s_cent%s",trkEffType[i],cent_Title[k])); hJpsiPt[j][i][k]->SetName(Form("%s_file%d",hJpsiPt[j][i][k]->GetName(),j)); hJpsiPt[j][i][k]->Rebin(4); int index = i-1; if(i==0) index = 0; hJpsiPtEffs[j][i][k] = DivideTH1ForEff(hJpsiPt[j][i][k],hJpsiPt[j][index][k],Form("hJpsiPtEff_%s_cent%s_file%d",trkEffType[i],cent_Title[k],j)); } } } // various efficiency const int kcent = 0; for(int i=1; i<nHistos; i++) { hJpsiPtEffs[0][i][kcent]->Divide(hJpsiPtEffs[1][i][kcent]); list->Add(hJpsiPtEffs[0][i][kcent]); } TString legName2[5] = {"TPC tracking + p_{T,#mu} cut","MTD acceptance & response","Muon PID","MTD triggering","Trigger unit"}; c = drawHistos(list,"JpsiEff_AllEffs",Form("%s: efficiencies for J/#psi ;p_{T} (GeV/c);New/Old",run_type),true,0,15,true,0.8,1.2,false,kTRUE,legName2,true,Form("%s%%",cent_Name[kcent]),0.2,0.4,0.63,0.88,kTRUE,0.04,0.035); if(savePlot) c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_CompAll/Compare_JpsiEff_AllTypes.pdf",run_type)); list->Clear(); } if(compRef) { TFile *fpp[2]; fpp[0] = TFile::Open(Form("Rootfiles/Paper.%s.Jpsi.root",run_type),"read"); fpp[1] = TFile::Open(Form("Rootfiles/Comb2.Paper.%s.Jpsi.root",run_type),"read"); TGraphAsymmErrors *hppJpsiVsPt[2]; TGraphAsymmErrors *hppJpsiVsCent[2]; double x, y, x1, y1; for(int j=0; j<2; j++) { hppJpsiVsPt[j] = (TGraphAsymmErrors*)fpp[j]->Get("hpp200JpsiVsPtFinalSys"); hppJpsiVsPt[j]->SetName(Form("%s_%d",hppJpsiVsPt[j]->GetName(),j)); hppJpsiVsPt[j]->SetMarkerStyle(21+j*4); hppJpsiVsPt[j]->SetMarkerColor(j+1); hppJpsiVsPt[j]->SetLineColor(j+1); offset_x(hppJpsiVsPt[j], 0.1*j); hppJpsiVsCent[j] = (TGraphAsymmErrors*)fpp[j]->Get("hpp200JpsiVsCentFinalSys"); hppJpsiVsCent[j]->SetName(Form("%s_%d",hppJpsiVsCent[j]->GetName(),j)); hppJpsiVsCent[j]->SetMarkerStyle(21+j*4); hppJpsiVsCent[j]->SetMarkerColor(j+1); hppJpsiVsCent[j]->SetLineColor(j+1); offset_x(hppJpsiVsCent[j], 0.1*j); } for(int j=0; j<2; j++) { for(int ipoint=0; ipoint<hppJpsiVsPt[j]->GetN(); ipoint++) { hppJpsiVsPt[1]->GetPoint(ipoint, x, y); hppJpsiVsPt[j]->GetPoint(ipoint, x1, y1); hppJpsiVsPt[j]->SetPoint(ipoint, x1, y1/y); hppJpsiVsPt[j]->SetPointError(ipoint, hppJpsiVsPt[j]->GetErrorXlow(ipoint), hppJpsiVsPt[j]->GetErrorXhigh(ipoint), hppJpsiVsPt[j]->GetErrorYlow(ipoint)/y, hppJpsiVsPt[j]->GetErrorYhigh(ipoint)/y); } for(int ipoint=0; ipoint<hppJpsiVsCent[j]->GetN(); ipoint++) { hppJpsiVsCent[1]->GetPoint(ipoint, x, y); hppJpsiVsCent[j]->GetPoint(ipoint, x1, y1); hppJpsiVsCent[j]->SetPoint(ipoint, x1, y1/y); hppJpsiVsCent[j]->SetPointError(ipoint, hppJpsiVsCent[j]->GetErrorXlow(ipoint), hppJpsiVsCent[j]->GetErrorXhigh(ipoint), hppJpsiVsCent[j]->GetErrorYlow(ipoint)/y, hppJpsiVsCent[j]->GetErrorYhigh(ipoint)/y); } } hppJpsiVsPt[1]->GetYaxis()->SetRangeUser(0.5,1.5); c = drawGraph(hppJpsiVsPt[1],"Ratio of pp reference;p_{T} [GeV/c];Ratio"); hppJpsiVsPt[0]->Draw("samesPEZ"); TLegend *leg = new TLegend(0.6,0.7,0.8,0.85); leg->SetBorderSize(0); leg->SetFillColor(0); leg->SetTextFont(62); leg->SetTextSize(0.035); leg->AddEntry(hppJpsiVsPt[0], "(STAR+PHENIX)/STAR", "P"); leg->AddEntry(hppJpsiVsPt[1], "STAR/STAR", "P"); leg->Draw(); if(savePlot) c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_CompAll/Compare_ppRefVsPt.pdf",run_type)); hppJpsiVsCent[1]->GetXaxis()->SetRangeUser(-0.5,6.5); hppJpsiVsCent[1]->GetYaxis()->SetRangeUser(0.5,1.5); c = drawGraph(hppJpsiVsCent[1],"Ratio of pp reference;;Ratio"); hppJpsiVsCent[0]->Draw("samesPEZ"); leg->Draw(); if(savePlot) c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_CompAll/Compare_ppRefVsCent.pdf",run_type)); } }
//================================================ void SignalShape(const int savePlot = 1) { const int icent = 0; const int nfiles = 2; const char *filename[nfiles] = {"Pico.Run13.pp500.jpsi.pt1.5.pt1.0.yield.root","Pico.Run13.pp500.jpsi.VtxCut.pt1.5.pt1.0.yield.root"}; const TString legName[nfiles] = {"W/o vtx cut","W/ vtx cut"}; const char *saveTitle = "Run13_VtxCut"; TFile *file[nfiles]; TH1F *hInvMass[nfiles][nPtBins]; TH1F *hMean[nfiles]; TH1F *hSigma[nfiles]; TH1F *hYield[nfiles]; for(int i=0; i<nfiles; i++) { file[i] = TFile::Open(Form("Rootfiles/%s",filename[i]),"read"); hMean[i] = (TH1F*)file[i]->Get(Form("Jpsi_FitMean_cent%s",cent_Title[icent])); hMean[i]->SetName(Form("%s_%d",hMean[i]->GetName(),i)); hSigma[i] = (TH1F*)file[i]->Get(Form("Jpsi_FitSigma_cent%s",cent_Title[icent])); hSigma[i]->SetName(Form("%s_%d",hSigma[i]->GetName(),i)); hYield[i] = (TH1F*)file[i]->Get(Form("Jpsi_BinCountYield_cent%s",cent_Title[icent])); hYield[i]->SetName(Form("%s_%d",hYield[i]->GetName(),i)); for(int ipt=0; ipt<nPtBins; ipt++) { hInvMass[i][ipt] = (TH1F*)file[i]->Get(Form("Jpsi_Signal_cent%s_pt%s_save",cent_Title[icent],pt_Name[ipt])); hInvMass[i][ipt]->SetName(Form("%s_%d",hInvMass[i][ipt]->GetName(),i)); } } // invariant mass distribution TCanvas *c = new TCanvas("InvMass","InvMass",1200,700); c->Divide(nPtBins/2+nPtBins%2,2); TLegend *leg = new TLegend(0.6,0.65,0.85,0.85); leg->SetBorderSize(0); leg->SetFillColor(0); leg->SetTextSize(0.05); for(int ipt=0; ipt<nPtBins; ipt++) { c->cd(ipt+1); SetPadMargin(gPad,0.13, 0.13, 0.03, 0.1); for(int i=0; i<nfiles; i++) { int bin = hInvMass[i][ipt]->FindFixBin(3.09); hInvMass[i][ipt]->Scale(1./hInvMass[i][ipt]->GetBinContent(bin)); hInvMass[i][ipt]->SetMaximum(1.5); hInvMass[i][ipt]->SetMarkerStyle(21+i*4); hInvMass[i][ipt]->SetMarkerColor(color[i]); hInvMass[i][ipt]->SetLineColor(color[i]); hInvMass[i][ipt]->SetYTitle("a.u."); ScaleHistoTitle(hInvMass[i][ipt],0.05,1,0.035,0.05,1.4,0.035,62); if(i==0) hInvMass[i][ipt]->Draw(); else hInvMass[i][ipt]->Draw("sames"); if(ipt==0) leg->AddEntry(hInvMass[i][ipt],legName[i].Data(),"PL"); } TPaveText *t1 = GetTitleText(Form("%1.0f < p_{T,#mu#mu} < %1.0f GeV/c",ptBins_low[ipt],ptBins_high[ipt]),0.06); t1->Draw(); } c->cd(1); leg->Draw(); if(savePlot) c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/comp_JpsiSig/%s_InvMass_cent%s.pdf",run_type,saveTitle,cent_Title[icent])); // mean & sigma TList *list = new TList; for(int i=0; i<nfiles; i++) { hMean[i]->SetMarkerStyle(21+i*4); hMean[i]->SetMarkerColor(color[i]); hMean[i]->SetLineColor(color[i]); list->Add(hMean[i]); } c = drawHistos(list,"mean","Mean of J/#Psi mass peak",false,0,10,false,2.5,3.5,false,true,legName,true,"",0.5,0.7,0.3,0.5,true,0.04,0.04,false,1,false,false); if(savePlot) c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/comp_JpsiSig/%s_JpsiMean_cent%s.pdf",run_type,saveTitle,cent_Title[icent])); list->Clear(); for(int i=0; i<nfiles; i++) { hSigma[i]->SetMarkerStyle(21+i*4); hSigma[i]->SetMarkerColor(color[i]); hSigma[i]->SetLineColor(color[i]); list->Add(hSigma[i]); } c = drawHistos(list,"sigma","Width of J/#Psi mass peak",false,0,10,false,2.5,3.5,false,true,legName,true,"",0.55,0.75,0.2,0.4,true,0.04,0.04,false,1,false,false); if(savePlot) c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/comp_JpsiSig/%s_JpsiSigma_cent%s.pdf",run_type,saveTitle,cent_Title[icent])); list->Clear(); for(int i=0; i<nfiles; i++) { hYield[i]->Scale(1./hYield[i]->Integral()); hYield[i]->SetMarkerStyle(21+i*4); hYield[i]->SetMarkerColor(color[i]); hYield[i]->SetLineColor(color[i]); list->Add(hYield[i]); } c = drawHistos(list,"yield","Raw distribution of J/#Psi signal;p_{T} (GeV/c);Prob.",false,0,10,true,0,0.4,false,true,legName,true,"",0.55,0.75,0.6,0.8,true,0.04,0.04,false,1,false,false); if(savePlot) c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/comp_JpsiSig/%s_RawCounts_cent%s.pdf",run_type,saveTitle,cent_Title[icent])); }
int merging() { Long_t NUMBER_OF_ENTRIES = 100; TTree* newResult = new TTree("xxx", "Argument"); static Double_t x, y; newResult->Branch("x", &x, "x/D"); newResult->Branch("y", &y, "y/D"); for(Long_t i=0; i<NUMBER_OF_ENTRIES; ++i) { x = i; y = i*i; //fprintf(stderr,"res %lf %lf %d\n",x,y,i<NUMBER_OF_ENTRIES); newResult->Fill(); }// end of for // newResult->Scan("x:y"); // ====================================== TMessage message(kMESS_OBJECT); message.Reset(); message.SetWriteMode(); message.WriteObject(newResult); message.Reset(); message.SetReadMode(); TTree* readResult = 0; readResult = ((TTree*)message.ReadObject(message.GetClass())); readResult->SetName("yyy"); // ====================================== TTree* result = 0; result = readResult->CloneTree(0); result->SetName("zzz"); result->Print(); result->Show(19); readResult->Print(); readResult->Show(29); cout<< "Result has " << result->GetEntries()<< " entries." << endl; TList newResultCollection; newResultCollection.SetOwner(kFALSE); newResultCollection.Add(readResult); cerr<<"Hello 1\n"; result->Merge(&newResultCollection); cerr<<"Hello 2\n"; cout<<result->GetEntries()<<endl; printf("result entries = %lld\n",result->GetEntries()); // ====================================== newResultCollection.Clear(); delete newResult; delete readResult; return 0; } // end of main
//================================================ void acceptance(TString fileName, const Int_t save = 0) { TFile *fin = TFile::Open(Form("Rootfiles/%s",fileName.Data()),"read"); Double_t pt_cuts_1[2] = {1.0,1.5}; Double_t pt_cuts_2[2] = {1.0,1.0}; TList *list = new TList; // charge dependence TString legName[2] = {"Like-sign: ++","Like-sign: --"}; const char *title[2] = {"positive","negative"}; TH2F *hLSpair[2][2]; for(int i=0; i<2; i++) { hLSpair[0][i] = (TH2F*)fin->Get(Form("LSpos_pt_vs_InvMass_pt1_%1.1f_pt2_%1.1f_%s",pt_cuts_1[i],pt_cuts_2[i],trigName[kTrigType])); hLSpair[1][i] = (TH2F*)fin->Get(Form("LSneg_pt_vs_InvMass_pt1_%1.1f_pt2_%1.1f_%s",pt_cuts_1[i],pt_cuts_2[i],trigName[kTrigType])); for(int j=0; j<2; j++) { hLSpair[j][i]->GetXaxis()->SetRangeUser(0,8); c = draw2D(hLSpair[j][i],Form("Mixed event: %s like-sign pairs (p_{T,1}>%1.1f, p_{T,2}>%1.1f GeV/c)",title[j],pt_cuts_1[i],pt_cuts_2[i])); if(save) { c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_EventMixing/%sInvMass_vs_pt_LS_%s_pt1_%1.0f_pt2_%1.0f.pdf",run_type,run_cfg_name.Data(),title[j],pt_cuts_1[i]*10,pt_cuts_2[i]*10)); c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_EventMixing/%sInvMass_vs_pt_LS_%s_pt1_%1.0f_pt2_%1.0f.png",run_type,run_cfg_name.Data(),title[j],pt_cuts_1[i]*10,pt_cuts_2[i]*10)); } } list->Clear(); for(int j=0; j<2; j++) { hLSpair[j][i]->GetXaxis()->SetRangeUser(0,8); TH1F *h1 = (TH1F*)hLSpair[j][i]->ProjectionX(Form("%s_prox",hLSpair[j][i]->GetName())); h1->Rebin(2); list->Add(h1); } c = sysCompare(list,Form("Charge_pt1_%1.1f_pt2_%1.1f",pt_cuts_1[i],pt_cuts_2[i]),Form("Mixed event: di-muon pairs"),"Charge dependece;M_{#mu#mu} (GeV/c^{2});--/++",kFALSE,0,15,kFALSE,0.1,10,kTRUE,0.7,1.3,kTRUE,kTRUE,legName,kTRUE,"Mixed events",0.25,0.4,0.35,0.55,kFALSE); c->cd(1); TPaveText *t1 = GetPaveText(0.7,0.8,0.7,0.85,0.04,62); t1->AddText(Form("p_{T,1}>%1.1f GeV/c",pt_cuts_1[i])); t1->AddText(Form("p_{T,2}>%1.1f GeV/c",pt_cuts_2[i])); t1->Draw(); if(save) { c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_EventMixing/%sInvMass_LS_ChargeDep_pt1_%1.0f_pt2_%1.0f.pdf",run_type,run_cfg_name.Data(),pt_cuts_1[i]*10,pt_cuts_2[i]*10)); c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_EventMixing/%sInvMass_LS_ChargeDep_pt1_%1.0f_pt2_%1.0f.png",run_type,run_cfg_name.Data(),pt_cuts_1[i]*10,pt_cuts_2[i]*10)); } } // acceptance TString legName1[2] = {"Unlike-sign","Like-sign: (--)+(++)"}; TH2F *hLS[2], *hUL[2]; for(int i=0; i<2; i++) { hUL[i] = (TH2F*)fin->Get(Form("US_pt_vs_InvMass_pt1_%1.1f_pt2_%1.1f_%s",pt_cuts_1[i],pt_cuts_2[i],trigName[kTrigType])); hUL[i]->Sumw2(); hUL[i]->GetXaxis()->SetRangeUser(0,8); c = draw2D(hUL[i],Form("Mixed event: unlike-sign pairs (p_{T,1}>%1.1f, p_{T,2}>%1.1f GeV/c)",pt_cuts_1[i],pt_cuts_2[i])); if(save) { c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_EventMixing/%sInvMass_vs_pt_UL_pt1_%1.0f_pt2_%1.0f.pdf",run_type,run_cfg_name.Data(),pt_cuts_1[i]*10,pt_cuts_2[i]*10)); c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_EventMixing/%sInvMass_vs_pt_UL_pt1_%1.0f_pt2_%1.0f.png",run_type,run_cfg_name.Data(),pt_cuts_1[i]*10,pt_cuts_2[i]*10)); } hLS[i] = (TH2F*)fin->Get(Form("LS_pt_vs_InvMass_pt1_%1.1f_pt2_%1.1f_%s",pt_cuts_1[i],pt_cuts_2[i],trigName[kTrigType])); hLS[i]->Sumw2(); hLS[i]->GetXaxis()->SetRangeUser(0,8); c = draw2D(hLS[i],Form("Mixed event: like-sign pairs (--)+(++) (p_{T,1}>%1.1f, p_{T,2}>%1.1f GeV/c)",pt_cuts_1[i],pt_cuts_2[i])); if(save) { c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_EventMixing/%sInvMass_vs_pt_LS_pt1_%1.0f_pt2_%1.0f.pdf",run_type,run_cfg_name.Data(),pt_cuts_1[i]*10,pt_cuts_2[i]*10)); c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_EventMixing/%sInvMass_vs_pt_LS_pt1_%1.0f_pt2_%1.0f.png",run_type,run_cfg_name.Data(),pt_cuts_1[i]*10,pt_cuts_2[i]*10)); } list->Clear(); h1 = (TH1F*)hUL[i]->ProjectionX(Form("%s_prox",hUL[i]->GetName())); h1->Rebin(2); list->Add(h1); h1 = (TH1F*)hLS[i]->ProjectionX(Form("%s_prox",hLS[i]->GetName())); h1->Rebin(2); list->Add(h1); c = sysCompare(list,Form("Acceptance_pt1_%1.1f_pt2_%1.1f",pt_cuts_1[i],pt_cuts_2[i]),Form("Mixed event: di-muon pairs"),"Acceptance effect;M_{#mu#mu} (GeV/c^{2});LS/UL",kFALSE,0,15,kFALSE,0.1,10,kTRUE,0.7,1.3,kTRUE,kTRUE,legName1,kTRUE,"Mixed events",0.25,0.4,0.35,0.55,kFALSE); c->cd(1); TPaveText *t1 = GetPaveText(0.7,0.8,0.7,0.85,0.04,62); t1->AddText(Form("p_{T,1}>%1.1f GeV/c",pt_cuts_1[i])); t1->AddText(Form("p_{T,2}>%1.1f GeV/c",pt_cuts_2[i])); t1->Draw(); if(save) { c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_EventMixing/%sInvMass_Acceptance_pt1_%1.0f_pt2_%1.0f.pdf",run_type,run_cfg_name.Data(),pt_cuts_1[i]*10,pt_cuts_2[i]*10)); c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_EventMixing/%sInvMass_Acceptance_pt1_%1.0f_pt2_%1.0f.png",run_type,run_cfg_name.Data(),pt_cuts_1[i]*10,pt_cuts_2[i]*10)); } c = sysCompare(list,Form("Acceptance_pt1_%1.1f_pt2_%1.1f_zoom",pt_cuts_1[i],pt_cuts_2[i]),Form("Mixed event: di-muon pairs"),"Acceptance effect;M_{#mu#mu} (GeV/c^{2});LS/UL",kTRUE,0,4,kFALSE,0.1,10,kTRUE,0.7,1.3,kFALSE,kTRUE,legName1,kTRUE,"Mixed events",0.25,0.4,0.25,0.45,kFALSE); c->cd(1); TPaveText *t1 = GetPaveText(0.3,0.4,0.7,0.85,0.04,62); t1->AddText(Form("p_{T,1}>%1.1f GeV/c",pt_cuts_1[i])); t1->AddText(Form("p_{T,2}>%1.1f GeV/c",pt_cuts_2[i])); t1->Draw(); if(save) { c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_EventMixing/%sInvMass_Acceptance_pt1_%1.0f_pt2_%1.0f_zoomin.pdf",run_type,run_cfg_name.Data(),pt_cuts_1[i]*10,pt_cuts_2[i]*10)); c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_EventMixing/%sInvMass_Acceptance_pt1_%1.0f_pt2_%1.0f_zoomin.png",run_type,run_cfg_name.Data(),pt_cuts_1[i]*10,pt_cuts_2[i]*10)); } } // Geometry mean TString legName2[2] = {"N_{++}+N_{--}", "2#sqrt{N_{++}*N_{--}}"}; TH2F *hLSGeom[2]; for(int i=0; i<2; i++) { hLSGeom[i] = (TH2F*)fin->Get(Form("LS_Geom_pt_vs_InvMass_pt1_%1.1f_pt2_%1.1f_%s",pt_cuts_1[i],pt_cuts_2[i],trigName[kTrigType])); list->Clear(); TH1F *htmp = (TH1F*)hLS[i]->ProjectionX(Form("%s_prox2",hLS[i]->GetName())); TH1F *h1 = (TH1F*)htmp->Rebin(nSpecMBins,Form("htmp_rebin",htmp->GetName()),specM); scaleHisto(h1, 1, 1,kTRUE,kFALSE, kTRUE); list->Add(h1); TH1F *h1 = (TH1F*)hLSGeom[i]->ProjectionX(Form("%s_prox",hLSGeom[i]->GetName())); scaleHisto(h1, 1, 1,kTRUE,kFALSE, kTRUE); list->Add(h1); c = sysCompare(list,Form("GeometricalMean_pt1_%1.1f_pt2_%1.1f",pt_cuts_1[i],pt_cuts_2[i]),Form("Mixed event: like-sign di-muon pairs (p_{T,1}>%1.1f, p_{T,2}>%1.1f GeV/c)",pt_cuts_1[i],pt_cuts_2[i]),"Geometric/Arithmetic;M_{#mu#mu} (GeV/c^{2});",kTRUE,0,4,kFALSE,0.1,10,kTRUE,0.99,1.01,kFALSE,kTRUE,legName2,kTRUE,"Like-sign",0.25,0.4,0.25,0.45,kFALSE); if(save) { c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_EventMixing/%sInvMass_Geom_pt1_%1.0f_pt2_%1.0f.pdf",run_type,run_cfg_name.Data(),pt_cuts_1[i]*10,pt_cuts_2[i]*10)); c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_EventMixing/%sInvMass_Geom_pt1_%1.0f_pt2_%1.0f.png",run_type,run_cfg_name.Data(),pt_cuts_1[i]*10,pt_cuts_2[i]*10)); } } }