void ilceve_init_import_macros() { // Put macros in the list of browsables, add a macro browser to // top-level GUI. TString macdir("$(ILC_ROOT)/EVE/ilc-macros"); gSystem->ExpandPathName(macdir); TFolder* f = gEve->GetMacroFolder(); void* dirhandle = gSystem->OpenDirectory(macdir.Data()); if (dirhandle != 0) { char* filename; TPMERegexp re("\\.C$"); TObjArray names; while ((filename = gSystem->GetDirEntry(dirhandle)) != 0) { if (re.Match(filename)) names.AddLast(new TObjString(filename)); } names.Sort(); for (Int_t ii=0; ii<names.GetEntries(); ++ii) { TObjString * si = (TObjString*) names.At(ii); f->Add(new TEveMacro(Form("%s/%s", macdir.Data(), (si->GetString()).Data()))); } } gSystem->FreeDirectory(dirhandle); gROOT->GetListOfBrowsables()->Add(new TSystemDirectory(macdir.Data(), macdir.Data())); { TEveBrowser *br = gEve->GetBrowser(); TGFileBrowser *fb = 0; fb = br->GetFileBrowser(); fb->GotoDir(macdir); { br->StartEmbedding(0); fb = br->MakeFileBrowser(); fb->BrowseObj(f); fb->Show(); br->StopEmbedding(); br->SetTabTitle("Macros", 0); br->SetTab(0, 0); } } }
INT module_init(void) { char name[1024]; char title[1024]; TFolder *folder = (TFolder*) sis3350_slac_module.histo_folder; printf("%s : module_init\n",sis3350_slac_module.name); // Bank size vs. event number for (int iboard=1; iboard<=SIS3350_NUMBER_OF_BOARDS; iboard++) { sprintf(name,"gr_bk_size_board_%02i",iboard); sprintf(title,"Bank size. Board %02i",iboard); gr_bk_size[iboard] = new TGraph(); gr_bk_size[iboard]->SetName(name); gr_bk_size[iboard]->SetTitle(title); if ( folder ) { folder->Add( gr_bk_size[iboard] ); } } t = new TTree("t","t"); char br_str[64]; sprintf(br_str,"timestamp/l:trace[4][%d]/s:is_bad_event/s",vme_trace_length); t->Branch("sis",&br_sis,br_str); for(int iboard=0;iboard<SIS3350_NUMBER_OF_BOARDS; iboard++) for(int ich=0; ich<SIS_3350_CH; ich++){ h2_wf[iboard][ich] = new TH2D(Form("h2_wf_board_%02d_channel_%d",iboard+1,ich+1),Form("board %02d channel %d",iboard+1,ich+1),1024,-0.5,1023.5,4096,-0.5,4095.5); } return SUCCESS; }
//void MergeMetHists(const int Nfiles=0, // const std::string filenamebase="", // const std::string title="", const std::string name="", // const float LoX=-1, const float HiX=-1, const int rebin=1, // const std::string printfile="", bool debug=false) void MergeMetHists(const int Nfiles, const std::string filenamebase, const std::string title, const std::string name, const float LoX=-1, const float HiX=-1, const int rebin=1, const std::string printfile="", const int MetSig=4, bool debug=false, const bool logy=false) { assert (Nfiles>0 && "Number of files must be > 0"); assert (name.length()>0 && "Require hist name!"); assert (filenamebase.length()>0 && "Require base of the file name!"); std::cout << "MetSig=" << MetSig << std::endl; std::cout << "Searching for obj = " << name <<std::endl; std::string data_path, bg_path, def_path; std::string ue1_path, ue2_path, ue3_path, ue4_path, ue5_path, ue6_path; std::string ue7_path, ue8_path, ue9_path; std::string jer1_path, jer2_path, jer3_path, jer4_path, jer5_path; std::string jer6_path, jer7_path, jer8_path, jer9_path, jer10_path; data_path="/Ana/MyJetFilter/Hist/Ana_data/"; bg_path="/Ana/MyJetFilter/Hist/Ana_bckg/"; def_path="/Ana/MyJetFilter/Hist/Ana_def/"; ue1_path="/Ana/MyJetFilter/Hist/Ana_ue1/"; ue2_path="/Ana/MyJetFilter/Hist/Ana_ue2/"; ue3_path="/Ana/MyJetFilter/Hist/Ana_ue3/"; ue4_path="/Ana/MyJetFilter/Hist/Ana_ue4/"; ue5_path="/Ana/MyJetFilter/Hist/Ana_ue5/"; ue6_path="/Ana/MyJetFilter/Hist/Ana_ue6/"; ue7_path="/Ana/MyJetFilter/Hist/Ana_ue7/"; ue8_path="/Ana/MyJetFilter/Hist/Ana_ue8/"; ue9_path="/Ana/MyJetFilter/Hist/Ana_ue9/"; jer1_path="/Ana/MyJetFilter/Hist/Ana_jer1/"; jer2_path="/Ana/MyJetFilter/Hist/Ana_jer2/"; jer3_path="/Ana/MyJetFilter/Hist/Ana_jer3/"; jer4_path="/Ana/MyJetFilter/Hist/Ana_jer4/"; jer5_path="/Ana/MyJetFilter/Hist/Ana_jer5/"; jer6_path="/Ana/MyJetFilter/Hist/Ana_jer6/"; jer7_path="/Ana/MyJetFilter/Hist/Ana_jer7/"; jer8_path="/Ana/MyJetFilter/Hist/Ana_jer8/"; jer9_path="/Ana/MyJetFilter/Hist/Ana_jer9/"; jer10_path="/Ana/MyJetFilter/Hist/Ana_jer10/"; /* data_path="Ana_data"; bg_path="Ana_bckg"; def_path="Ana_def"; ue1_path="Ana_ue1"; ue2_path="Ana_ue2"; ue3_path="Ana_ue3"; ue4_path="Ana_ue4"; ue5_path="Ana_ue5"; ue6_path="Ana_ue6"; ue7_path="Ana_ue7"; ue8_path="Ana_ue8"; ue9_path="Ana_ue9"; jer1_path="Ana_jer1"; jer2_path="Ana_jer2"; jer3_path="Ana_jer3"; jer4_path="Ana_jer4"; jer5_path="Ana_jer5"; jer6_path="Ana_jer6"; jer7_path="Ana_jer7"; jer8_path="Ana_jer8"; jer9_path="Ana_jer9"; jer10_path="Ana_jer10"; */ std::vector<std::string> vPaths; vPaths.push_back(data_path); vPaths.push_back(bg_path); vPaths.push_back(def_path); vPaths.push_back(ue1_path); vPaths.push_back(ue2_path); vPaths.push_back(ue3_path); vPaths.push_back(ue4_path); vPaths.push_back(ue5_path); vPaths.push_back(ue6_path); vPaths.push_back(ue7_path); vPaths.push_back(ue8_path); vPaths.push_back(ue9_path); vPaths.push_back(jer1_path); vPaths.push_back(jer2_path); vPaths.push_back(jer3_path); vPaths.push_back(jer4_path); vPaths.push_back(jer5_path); vPaths.push_back(jer6_path); vPaths.push_back(jer7_path); vPaths.push_back(jer8_path); vPaths.push_back(jer9_path); vPaths.push_back(jer10_path); TFile *f = 0; TH1 *hist_data = 0, *hist_bg = 0; int iNHists = vPaths.size(); std::vector<TH1*> vHist; for (int n= 0; n < iNHists; ++n) { TH1 *temp=0; vHist.push_back(temp); } int NfilesOpened = 0; //for (int i=1; i<=1; ++i) for (int i=1; i<=Nfiles; ++i) { std::stringstream file; file << filenamebase << i; //file << "myhisto_PhoJetAna_Pyth_phojet22_1Njet15_test_040208.root"; f = new TFile (file.str().c_str()); if (f->IsZombie()) { std::cout << "ERROR::File " << file.str() << " did not open! Exiting." << std::endl; exit (1); } else { NfilesOpened++; if (debug) { std::cout << "File Added::"; f->Print(); } } gROOT->ls(); TFolder *fold = (TFolder*) gDirectory->FindObjectAny("Ana"); assert(fold != NULL && "folder null"); TFolder *dir = (TFolder*) fold->FindObjectAny("MyJetFilter"); assert(dir != NULL && "dir null"); TFolder *dir2 = (TFolder*) dir->FindObjectAny("Hist"); assert(dir2 != NULL && "Hist null"); //TH1 *h = dynamic_cast<TH1*> (dir3->FindObjectAny(name.c_str())); //assert (h!=NULL && "hist null"); //h->Draw(); //return; for (unsigned int iPath = 0; iPath < vPaths.size(); ++iPath) { //std::cout << "iPath = " << iPath << std::endl; TFolder *dir3 = (TFolder*) dir2->FindObjectAny(vPaths.at(iPath).c_str()); assert(dir3 != NULL && "data null"); //f->cd(); //gDirectory->pwd(); //f->cd(vPaths.at(iPath).c_str()); //gDirectory->pwd(); //if (iPath<2) f->ls(); //TH1 *hTemp = dynamic_cast<TH1*> (gDirectory->FindObjectAny(name.c_str())); std::stringstream histpath; histpath << vPaths.at(iPath) << name; //TFolder *ana = (TFolder*) gDirectory->FindObjectAny("Ana"); //assert(ana !=NULL && "Ana folder not found"); //std::cout << "histpath = " << histpath.str() << std::endl; TH1 *hTemp = dynamic_cast<TH1*> (dir3->FindObjectAny(name.c_str())); assert(hTemp != NULL && "object not found!"); if (hTemp->GetEntries()) // this has to be done to avoid crashes when adding hists which some how have 'sum=nan' instead of 'sum=0' when they do not have any entries. { if (! vHist.at(iPath)) { std::string name = hTemp->GetName() + std::string ("_Clone"); vHist.at(iPath) = dynamic_cast<TH1*>(hTemp->Clone (name.c_str())); assert(vHist.at(iPath) != NULL && "Data hist cast failed"); vHist.at(iPath)->SetDirectory(0); } else { vHist.at(iPath)->Add(hTemp); } } } delete f; } /* assert(vHist.size() == vPaths.size()); for (int k=0; k < vHist.size(); ++k) { vHist.at(k)->Print(); } */ DoSystematics(vHist); hist_data = vHist.at(0); hist_bg = vHist.at(1); /* std::cout << "NORMALIZING BG TO DATA " << std::endl; double data_int = hist_data->Integral(); double bg_int = hist_bg->Integral(); hist_bg->Scale(data_int/bg_int); std::cout << "SCALE = " << data_int/bg_int << std::endl; */ if (debug) { hist_data->Print("all"); hist_bg->Print("all"); } std::cout << "Total file added = " << NfilesOpened << std::endl; gStyle->SetOptStat(""); if (hist_data->GetEntries()) hist_data->Rebin(rebin); if (hist_bg->GetEntries()) hist_bg->Rebin(rebin); TH1 *hist_err_copy = NULL; std::string bgname = hist_bg->GetName() + std::string ("err_copy"); hist_err_copy = dynamic_cast<TH1*>(hist_bg->Clone (bgname.c_str())); hist_err_copy->SetDirectory(0); TH1 *hist_data_copy = NULL; std::string dataname = hist_data->GetName() + std::string ("data_copy"); hist_data_copy = dynamic_cast<TH1*>(hist_data->Clone (dataname.c_str())); hist_data_copy->SetDirectory(0); float x_loLim, x_hiLim; if (LoX >0) x_loLim = LoX; else x_loLim = hist_data->GetBinLowEdge(1); if (HiX >0) x_hiLim = HiX; else x_hiLim = max(FindUpLimit(hist_data), FindUpLimit(hist_bg)) + hist_data->GetBinWidth(1) * 2; if (debug) { std::cout << "min, max = " << x_loLim << ", " << x_hiLim << std::endl; } float y_hiLim = max(FindUpLimit(hist_data,"Y"), FindUpLimit(hist_bg,"Y")); if (logy) y_hiLim *= 10; else y_hiLim += y_hiLim * 0.1; gStyle->SetCanvasColor (10); gStyle->SetCanvasBorderSize (0); gStyle->SetCanvasBorderMode (0); gStyle->SetPadColor (10); gStyle->SetFillColor (10); gStyle->SetTitleFillColor (10); gStyle->SetTitleBorderSize (0); gStyle->SetStatColor (10); gStyle->SetStatBorderSize (1); gStyle->SetCanvasDefW(1200); gStyle->SetCanvasDefH(600); int labelfont = 10 * 4 + 2; //10 * font ID + precision (2 = scalable) int titlefont = 10 * 4 + 2; //10 * font ID + precision (2 = scalable) gStyle->SetLabelFont(labelfont,"X"); gStyle->SetLabelFont(labelfont,"Y"); gStyle->SetTitleFont(titlefont,"X"); gStyle->SetTitleFont(titlefont,"Y"); gStyle->SetLabelSize(0.04,"X"); gStyle->SetLabelSize(0.027,"Y"); //gStyle->SetLabelOffset(0.9); gStyle->SetTitleSize(0.03,"Y"); gStyle->SetTitleOffset(1.8,"Y"); //TGaxis::SetMaxDigits(3); hist_data->UseCurrentStyle(); hist_bg->UseCurrentStyle(); TCanvas *c1= new TCanvas; c1->Divide(2,1); c1->cd(1); if (logy) { if (hist_data->GetEntries() > 0 && hist_bg->GetEntries() > 0) gPad->SetLogy(); } gPad->SetTickx(); gPad->SetTicky(); gPad->SetGridx(); gPad->SetGridy(); TPaveText *tp = new TPaveText(0.02,0.92,0.98,0.99,"NDC"); tp->SetLineColor(10); tp->SetTextFont(titlefont); std::string tt(hist_data->GetTitle()); // hist_data->SetTitle(""); // hist_bg->SetTitle(""); if (title.length()>0) { //tt += " - "; tt += title; //tt = title; if (debug) { std::cout << tt << std::endl; } tp->AddText(tt.c_str()); } std::stringstream ytitle, xtitle; ytitle << "Events / " << setprecision(3) << hist_data->GetXaxis()->GetBinWidth(1) << " GeV"; if (debug) { std::cout << hist_data->GetBinWidth(1) <<std::endl; } if (name == "MetAll") xtitle << "#slash{E}_{T} (for all events) (GeV)"; else if (name == "Met") xtitle << "#slash{E}_{T} (after cuts) (GeV)"; else if (name == "MetSig") xtitle << "#slash{E}_{T} Significance (for all events)"; else if (name == "Njet15") xtitle << "Njets^{E_{T}>15GeV} (After #slash{E}_{T}-Sig cut)"; else if (name == "Njet20") xtitle << "Njets^{E_{T}>20GeV} (After #slash{E}_{T}-Sig cut)"; else if (name == "Njet25") xtitle << "Njets^{E_{T}>25GeV} (After #slash{E}_{T}-Sig cut)"; else if (name == "Njet30") xtitle << "Njets^{E_{T}>30GeV} (After #slash{E}_{T}-Sig cut)"; else if (name == "Njet35") xtitle << "Njets^{E_{T}>35GeV} (After #slash{E}_{T}-Sig cut)"; if (debug) { std::cout << "xtitle=" << xtitle.str() << std::endl; } if (debug) { hist_data->Print(); std::cout << "bin#\tLoEdge\tdata\tdata_err\tbg_cont\tbg_err"<<std::endl; for (unsigned bin = 0; bin <= (unsigned) hist_data_copy->GetNbinsX() + 1; ++ bin) { float val = hist_data->GetBinContent (bin); float err = hist_data->GetBinError(bin); float val2 = hist_bg->GetBinContent (bin); float err2 = hist_bg->GetBinError(bin); float loEdge = hist_data->GetBinLowEdge(bin); if (val>0 || err>0 || val2>0 || err2>0) std::cout << bin << "\t" << loEdge <<"\t" << val << "\t" << err << "\t\t" << val2 << "\t" << err2 << std::endl; } } hist_data->GetXaxis()->SetTitle(xtitle.str().c_str()); if (name.find("Njet") == std::string::npos) hist_data->GetYaxis()->SetTitle(ytitle.str().c_str()); hist_data->GetXaxis()->CenterTitle(true); hist_data->GetYaxis()->CenterTitle(true); hist_bg->GetXaxis()->SetTitle(xtitle.str().c_str()); if (name.find("Njet") == std::string::npos) hist_bg->GetYaxis()->SetTitle(ytitle.str().c_str()); hist_bg->GetXaxis()->CenterTitle(true); hist_bg->GetYaxis()->CenterTitle(true); //temp x_loLim = 0; x_hiLim = 200; hist_data->GetXaxis()->SetRangeUser(x_loLim, x_hiLim); hist_bg->GetXaxis()->SetRangeUser(x_loLim, x_hiLim); hist_data->SetMinimum(0.1); hist_bg->SetMinimum(0.1); hist_data->SetMaximum(y_hiLim); hist_bg->SetMaximum(y_hiLim); hist_data->SetMarkerStyle(8); hist_data->SetMarkerSize(1.0); hist_data->SetMarkerColor(kBlue); hist_data->SetLineColor(kBlue); hist_bg->SetMarkerColor(kRed); hist_bg->SetLineColor(kRed); hist_bg->SetFillColor(kRed); hist_data->SetTitleSize(0.04); hist_bg->SetTitleSize(0.04); TH1* hist_bg_copy = dynamic_cast<TH1*>(hist_bg->Clone ("hist_bg_BlkLine")); hist_bg_copy->SetLineColor(kBlack); hist_bg_copy->SetLineWidth(2); hist_bg_copy->SetFillColor(0); //hist_bg_copy->Draw("L"); //hist_bg->Draw("sameE2"); // hist_bg->SetFillColor(10); // hist_bg->SetLineColor(10); hist_bg->Draw("E2"); hist_bg_copy->Draw("SAME HIST"); hist_data->Draw("sameP"); //tp->Draw(); TLegend *leg = new TLegend (0.4,0.8,0.90,0.90); leg->SetTextFont(42); leg->SetTextSize(0.025); leg->SetBorderSize (1); leg->SetFillColor (10); //std::stringstream leg_data, leg_bg; //leg_data << "Data (E=" << hist_data->GetEntries() << " M=" << hist_data->GetMean() // << " R=" << hist_data->GetRMS() << ")"; //leg_bg << "Bkg (E=" << hist_bg->GetEntries() << " M=" << hist_bg->GetMean() // << " R=" << hist_bg->GetRMS() << ")"; //leg->AddEntry(hist_data,leg_data.str().c_str()); //leg->AddEntry(hist_bg,leg_bg.str().c_str()); //leg->AddEntry(hist_data,"Data (Measured) (DET Jets) "); //leg->AddEntry(hist_bg, "MC Prediction (HAD Jets, Norm to Data)"); leg->AddEntry(hist_data,"Data (Measured)"); leg->AddEntry(hist_bg, "MC Prediction"); leg->Draw(); // now to make the ratio plots for (unsigned bin = 0; bin <= (unsigned) hist_data_copy->GetNbinsX() + 1; ++ bin) { const float val = hist_err_copy->GetBinContent (bin); const float scale = val ? 1. / val : 0; hist_data_copy->SetBinContent (bin, (hist_data_copy->GetBinContent (bin) - val) * scale); hist_data_copy->SetBinError (bin, hist_data_copy->GetBinError (bin) * scale); }; for (unsigned bin = 0; bin <= (unsigned) hist_err_copy->GetNbinsX() + 1; ++ bin) { float value = hist_err_copy->GetBinContent (bin); float error = hist_err_copy->GetBinError (bin); hist_err_copy->SetBinError (bin, value ? error / value : 0); hist_err_copy->SetBinContent (bin, 0); }; /* TH1 *hist_ratio = NULL; std::string myname = hist_data->GetName() + std::string ("_copy"); hist_ratio = dynamic_cast<TH1*>(hist_data->Clone (myname.c_str())); hist_ratio->Divide(hist_bg); */ hist_data_copy->UseCurrentStyle(); hist_err_copy->UseCurrentStyle(); //new TCanvas(); c1->cd(2); gPad->SetTickx(); gPad->SetTicky(); gPad->SetGridx(); gPad->SetGridy(); hist_data_copy->SetTitle(""); hist_err_copy->SetTitle(""); //hist_data_copy->SetTitle(tt.c_str()); //hist_err_copy->SetTitle(tt.c_str()); hist_data_copy->GetXaxis()->SetTitle(xtitle.str().c_str()); hist_err_copy->GetXaxis()->SetTitle(xtitle.str().c_str()); hist_data_copy->GetXaxis()->SetRangeUser(x_loLim, x_hiLim); hist_err_copy->GetXaxis()->SetRangeUser(x_loLim, x_hiLim); float fRatioHist_ymax = 1.0; float fRatioHist_ymin = -1.0; hist_data_copy->SetMinimum(fRatioHist_ymin); hist_data_copy->SetMaximum(fRatioHist_ymax); hist_err_copy->SetMinimum(fRatioHist_ymin); hist_err_copy->SetMaximum(fRatioHist_ymax); std::stringstream ratio_ytitle; ratio_ytitle << "(Data Measured - MC Prediction) / MC Prediction"; hist_data_copy->GetYaxis()->SetTitle(ratio_ytitle.str().c_str()); hist_err_copy->GetYaxis()->SetTitle(ratio_ytitle.str().c_str()); //hist_data_copy->SetTitle(ratio_ytitle.str().c_str()); //hist_err_copy->SetTitle(ratio_ytitle.str().c_str()); hist_data_copy->GetXaxis()->CenterTitle(true); hist_data_copy->GetYaxis()->CenterTitle(true); hist_err_copy->GetXaxis()->CenterTitle(true); hist_err_copy->GetYaxis()->CenterTitle(true); // hist_data->GetYaxis()->SetRangeUser(; //// hist_bg->SetMinimum(0.1); hist_data_copy->SetLineColor(kBlue); hist_data_copy->SetMarkerColor(kBlue); hist_data_copy->SetMarkerStyle (8); hist_data_copy->SetMarkerSize(1.0); hist_err_copy->SetFillColor(kRed); hist_err_copy->SetFillStyle(3002); hist_data_copy->Draw("P"); hist_err_copy->Draw("same E2"); //tp->Draw(); c1->cd(); if (printfile.length()>0) { c1->Print(printfile.c_str()); } DebugSystError(hist_data,hist_bg, hist_data_copy, hist_err_copy); }
int drawPerformanceTPCQAMatch(const char* inFile = "perf.root") { // // Draw control histograms // and generate output pictures // gSystem->Load("libSTAT"); gSystem->Load("libANALYSIS"); gSystem->Load("libANALYSISalice"); gSystem->Load("libANALYSIScalib"); gSystem->Load("libCORRFW"); gSystem->Load("libTPCcalib"); gSystem->Load("libTRDcalib"); gSystem->Load("libT0calib"); gSystem->Load("libTOFcalib"); gSystem->Load("libANALYSISalice"); gSystem->Load("libANALYSIScalib"); gSystem->Load("libTender"); gSystem->Load("libPWGPP"); gROOT->Reset(); gROOT->SetStyle("Plain"); gStyle->SetPalette(1); gStyle->SetOptStat(0); gStyle->SetTitleSize(0.025); TH1::AddDirectory(kFALSE); // // set criteria // Float_t mineta = -0.8; Float_t maxeta = 0.799; Float_t minNclust = 70.0; Double_t ptMax = 10; // // open input file // TFile *file = TFile::Open(inFile); if(!file) return -9; cout<<"QA file opened"<<endl; file->cd(); // get the TPC list if(gROOT->FindObject("TPC_PerformanceQA")) TPC_PerformanceQA->cd(); cout<<"TPC_PerformanceQA opened"<<endl; TList *TPC = (TList*)gROOT->FindObject("TPCQA"); if(TPC==NULL) TPC = (TList*)gROOT->FindObject("TPCQA_v0_c0"); if(TPC==NULL) TPC = (TList*)gROOT->FindObject("TPCQA_v0_c30"); if(TPC==NULL) TPC = (TList*)gROOT->FindObject("TPCQA_v0_c70"); if(TPC==NULL) TPC = (TList*)gROOT->FindObject("TPC"); if(TPC==NULL) return(0); cout<<"TPCQA list found"<<endl; // get TPC performance object AliPerformanceTPC *obj = (AliPerformanceTPC*)TPC->FindObject("AliPerformanceTPC"); if(obj==NULL) return(0); cout<<"what about here after obj "<<endl; // get folder with histograms TFolder *fold = obj->GetAnalysisFolder(); if(!fold) return(0); cout<<"what about here after folder "<<endl; // // get the HLT list // file->cd(); // if(gROOT->FindObject("HLT_PerformanceQA")) HLT_PerformanceQA->cd(); // TList *HLT = (TList*)gROOT->FindObject("HLTQA"); // // Draw histograms // // // event level // TH1 *h1D = 0; TH2 *h2D = 0; TH3 *h3D = 0; h1D = (TH1*)fold->FindObject("h_tpc_event_1"); Double_t NEvents = h1D->GetEntries(); cout<<"number of events "<<NEvents<<endl; TCanvas *can1 = new TCanvas("can1","TPC event information",1200,800); can1->Divide(3,2); can1->cd(1); fold->FindObject("h_tpc_event_6")->Draw("histe"); can1->cd(2); gPad->SetLogy(); h1D = (TH1*)fold->FindObject("h_tpc_event_recvertex_0"); h1D->GetXaxis()->SetRangeUser(-1.,1.); h1D->Draw("histe"); can1->cd(3); gPad->SetLogy(); h1D = (TH1*)fold->FindObject("h_tpc_event_recvertex_1"); h1D->GetXaxis()->SetRangeUser(-1.,1.); h1D->Draw("histe"); PlotTimestamp(can1); can1->cd(4); gPad->SetLogy(); fold->FindObject("h_tpc_event_recvertex_2")->Draw("histe"); can1->cd(5); gPad->SetLogy(); TH1 *hp = fold->FindObject("h_tpc_event_recvertex_3"); hp->SetTitle("Track.Multi., ncl>70, |dcar|<3 cm, |dcaz|<3 cm"); hp->Draw("histe"); can1->cd(6); gPad->SetLogy(); hp = (TH1*)fold->FindObject("h_tpc_event_recvertex_4"); hp->SetTitle("Pos/neg(red) Track.Multi. ncl>70, |dcar|<3 cm, |dcaz|<3 cm"); hp->Draw("histe"); TH1* he = fold->FindObject("h_tpc_event_recvertex_5"); he->SetLineColor(kRed); he->Draw("histesame"); can1->SaveAs("TPC_event_info.png"); TCanvas *can2 = new TCanvas("can2","#eta , #phi and p_{t}",1200,800); can2->Divide(3,2); can2->cd(1); h3D = (TH3*)fold->FindObject("h_tpc_track_pos_recvertex_0_5_6"); h3D->GetXaxis()->SetRangeUser(minNclust,160); h3D->Project3D("yz")->Draw("colz"); h3D->Project3D("yz")->SetTitle("#eta vs #phi, positive tracks"); can2->Update(); can2->cd(4); h3D = (TH3*)fold->FindObject("h_tpc_track_neg_recvertex_0_5_6"); h3D->GetXaxis()->SetRangeUser(minNclust,160); h3D->Project3D("yz")->Draw("colz"); h3D->Project3D("yz")->SetTitle("#eta vs #phi, negative tracks"); can2->Update(); can2->cd(2); h3D = (TH3*)fold->FindObject("h_tpc_track_pos_recvertex_0_5_6"); h3D->GetXaxis()->SetRangeUser(minNclust,160); h1D = h3D->Project3D("y"); h1D->SetTitle("#eta of pos/neg(red) charged tracks, ncl>70"); h1D->Draw("histe"); h3D = (TH3*)fold->FindObject("h_tpc_track_neg_recvertex_0_5_6"); h3D->GetXaxis()->SetRangeUser(minNclust,160); h1D = h3D->Project3D("y"); h1D->SetLineColor(kRed); h1D->Draw("histesame"); can2->cd(5); gPad->SetLogy(); h3D = (TH3*)fold->FindObject("h_tpc_track_pos_recvertex_0_5_7"); h3D->GetXaxis()->SetRangeUser(minNclust,160); h3D->GetYaxis()->SetRangeUser(mineta,maxeta); h1D = h3D->Project3D("z"); h1D->Scale(1,"width"); h1D->SetTitle("p_{T} of pos/neg(red) charged tracks, ncl>70, |#eta|<0.8"); h1D->Draw("histe"); h3D = (TH3*)fold->FindObject("h_tpc_track_neg_recvertex_0_5_7"); h3D->GetXaxis()->SetRangeUser(minNclust,160); h3D->GetYaxis()->SetRangeUser(mineta,maxeta); h1D = h3D->Project3D("z"); h1D->Scale(1,"width"); h1D->SetLineColor(kRed); h1D->Draw("histesame"); can2->cd(3); h3D = (TH3*)fold->FindObject("h_tpc_track_pos_recvertex_5_6_7"); h3D->GetZaxis()->SetRangeUser(2,20); h3D->GetXaxis()->SetRangeUser(mineta,-0.00001); TH1 *h1D = h3D->Project3D("y"); h1D->SetTitle("#phi of pos/neg(red) charged tracks, pt>1GeV/c, -0.8<#eta<0.0"); h1D->Draw("histe"); h3D = (TH3*)fold->FindObject("h_tpc_track_neg_recvertex_5_6_7"); h3D->GetZaxis()->SetRangeUser(2,20); h3D->GetXaxis()->SetRangeUser(mineta,-0.00001); h1D = h3D->Project3D("y"); h1D->SetLineColor(kRed); h1D->Draw("histesame"); PlotTimestamp(can2); can2->cd(6); h3D = (TH3*)fold->FindObject("h_tpc_track_pos_recvertex_5_6_7"); TH3 *h3D1 = h3D->Clone("h3D1"); h3D1->GetXaxis()->SetRangeUser(0.0,maxeta); h3D1->GetZaxis()->SetRangeUser(2,20); h1D = h3D1->Project3D("y"); h1D->SetTitle("#phi of pos/neg(red) charged tracks, pt>1GeV/c, 0.0<#eta<0.8"); h1D->Draw("histe"); h3D = (TH3*)fold->FindObject("h_tpc_track_neg_recvertex_5_6_7"); TH3 *h3D2 = h3D->Clone("h3D2"); h3D2->GetXaxis()->SetRangeUser(0.0,maxeta); h3D2->GetZaxis()->SetRangeUser(2,20); h1D = h3D2->Project3D("y"); h1D->SetLineColor(kRed); h1D->Draw("histesame"); can2->SaveAs("eta_phi_pt.png"); TCanvas *can3 = new TCanvas("can3","Cluster Occupancy",700,700); can3->Divide(1,2); can3->cd(1); TH3 *h3D_1 = (TH3*)fold->FindObject("h_tpc_clust_0_1_2"); TH3 *h3D_2 = (TH3*) h3D_1->Clone("h3D_2"); h3D_1->GetZaxis()->SetRangeUser(0,0.99); h3D_1->Project3D("xy")->Draw("colz"); h3D_1->Project3D("xy")->SetTitle("Cluster Occupancy A Side"); if(NEvents > 0) h3D_1->Project3D("xy")->Scale(1.0/NEvents); can3->Update(); PlotTimestamp(can3); can3->cd(2); h3D_2->GetZaxis()->SetRangeUser(1,2) ; h3D_2->Project3D("xy")->Draw("colz"); h3D_2->Project3D("xy")->SetTitle("Cluster Occupancy C Side"); if(NEvents>0) h3D_2->Project3D("xy")->Scale(1.0/NEvents); can3->SaveAs("cluster_occupancy.png"); TObjArray *arr1 = new TObjArray(); TObjArray *arr2 = new TObjArray(); TObjArray *arr3 = new TObjArray(); TObjArray *arr4 = new TObjArray(); TObjArray *arr5 = new TObjArray(); TObjArray *arr6 = new TObjArray(); TCanvas *can4 = new TCanvas("can4","Clusters in Detail",1200,800); can4->Divide(3,2); can4->cd(1); h3D = (TH3*)fold->FindObject("h_tpc_track_all_recvertex_0_5_7"); h2D = (TH2*)h3D->Project3D("xy"); h2D->SetTitle("nCluster vs #eta, |dcar|<3 cm, |dcaz|<3 cm"); h2D->FitSlicesY(0,0,-1,0,"QNR",arr1); h2D->Draw("colz"); arr1->At(1)->Draw("same"); can4->cd(4); h3D = (TH3*)fold->FindObject("h_tpc_track_all_recvertex_2_5_7"); h2D = (TH2*)h3D->Project3D("xy"); h2D->SetTitle("Findable clusters, |dcar|<3 cm, |dcaz|<3 cm"); h2D->FitSlicesY(0,0,-1,0,"QNR",arr2); h2D->Draw("colz"); arr2->At(1)->Draw("same"); can4->cd(2); h3D = (TH3*)fold->FindObject("h_tpc_track_pos_recvertex_0_5_6"); TH3 *h3D11 = h3D->Clone("h3D11"); h3D11->Add(((TH3*)fold->FindObject("h_tpc_track_neg_recvertex_0_5_6")),1); h3D11->GetYaxis()->SetRangeUser(mineta,-0.00001); h2D = (TH2*)h3D11->Project3D("xz"); h2D->SetTitle("nCluster vs #phi, -0.8<#eta<0.0, |dcar|<3 cm, |dcaz|<3 cm"); h2D->FitSlicesY(0,0,-1,0,"QNR",arr3); h2D->Draw("colz"); arr3->At(1)->Draw("same"); can4->cd(5); h3D = (TH3*)fold->FindObject("h_tpc_track_pos_recvertex_0_5_6"); TH3 *h3D22 = h3D->Clone("h3D22"); h3D22->Add(((TH3*)fold->FindObject("h_tpc_track_neg_recvertex_0_5_6")),1); h3D22->GetYaxis()->SetRangeUser(0.0,maxeta); h2D = (TH2*)h3D22->Project3D("xz"); h2D->SetTitle("nCluster vs #phi, 0.0<#eta<0.8, |dcar|<3 cm, |dcaz|<3 cm"); h2D->FitSlicesY(0,0,-1,0,"QNR",arr4); h2D->Draw("colz"); arr4->At(1)->Draw("same"); can4->cd(3); h3D = (TH3*)fold->FindObject("h_tpc_track_pos_recvertex_2_5_6"); TH3 *h3D33 = h3D->Clone("h3D33"); h3D33->Add(((TH3*)fold->FindObject("h_tpc_track_neg_recvertex_2_5_6")),1); h3D33->GetYaxis()->SetRangeUser(mineta,-0.00001); h2D = (TH2*)h3D33->Project3D("xz"); h2D->SetTitle("Findable clusters vs #phi, -0.8<#eta<0.0, |dcar|<3 cm, |dcaz|<3 cm"); h2D->FitSlicesY(0,0,-1,0,"QNR",arr5); h2D->Draw("colz"); arr5->At(1)->Draw("same"); PlotTimestamp(can4); can4->cd(6); h3D = (TH3*)fold->FindObject("h_tpc_track_pos_recvertex_2_5_6"); TH3 *h3D44 = h3D->Clone("h3D44"); h3D44->Add(((TH3*)fold->FindObject("h_tpc_track_neg_recvertex_2_5_6")),1); h3D44->GetYaxis()->SetRangeUser(0.0,maxeta); h2D = (TH2*)h3D44->Project3D("xz"); h2D->SetTitle("Findalbe clusters vs #phi, 0.0<#eta<0.8, |dcar|<3 cm, |dcaz|<3 cm"); h2D->FitSlicesY(0,0,-1,0,"QNR",arr6); h2D->Draw("colz"); arr6->At(1)->Draw("same"); can4->SaveAs("cluster_in_detail.png"); can4->Update(); TObjArray *arr7 = new TObjArray(); TObjArray *arr8 = new TObjArray(); TCanvas *can5 = new TCanvas("can5","DCA In Detail",1200,800); can5->Divide(3,2); can5->cd(1); h3D = (TH3*)fold->FindObject("h_tpc_track_all_recvertex_3_5_7"); h3D->GetYaxis()->SetRangeUser(-1,1); h2D = (TH2*)h3D->Project3D("xy"); h2D->FitSlicesY(0,0,-1,0,"QNR",arr7); h2D->SetTitle("DCAR vs #eta"); h2D->Draw("colz"); arr7->At(1)->Draw("same"); can5->cd(2); h3D = (TH3*)fold->FindObject("h_tpc_track_pos_recvertex_3_5_7"); h3D->GetYaxis()->SetRangeUser(-1,1); h3D->Project3D("xy")->Draw("colz"); h3D->Project3D("xy")->SetTitle("DCAR vs #eta of pos. charged tracks"); can5->cd(3); h3D = (TH3*)fold->FindObject("h_tpc_track_neg_recvertex_3_5_7"); h3D->GetYaxis()->SetRangeUser(-1,1); h3D->Project3D("xy")->Draw("colz"); h3D->Project3D("xy")->SetTitle("DCAR vs #eta of neg. charged tracks"); PlotTimestamp(can5); can5->cd(4); h3D = (TH3*)fold->FindObject("h_tpc_track_all_recvertex_4_5_7"); h3D->GetYaxis()->SetRangeUser(-1,1); h2D = (TH2*)h3D->Project3D("xy"); h2D->FitSlicesY(0,0,-1,0,"QNR",arr8); h2D->SetTitle("DCAZ vs #eta"); h2D->Draw("colz"); arr8->At(1)->Draw("same"); can5->cd(5); h3D = (TH3*)fold->FindObject("h_tpc_track_pos_recvertex_4_5_7"); h3D->GetYaxis()->SetRangeUser(-1,1); h3D->Project3D("xy")->Draw("colz"); h3D->Project3D("xy")->SetTitle("DCAZ vs #eta of pos. charged tracks"); can5->cd(6); h3D = (TH3*)fold->FindObject("h_tpc_track_neg_recvertex_4_5_7"); h3D->GetYaxis()->SetRangeUser(-1,1); h3D->Project3D("xy")->Draw("colz"); h3D->Project3D("xy")->SetTitle("DCAZ vs #eta of neg. charged tracks"); can5->SaveAs("dca_in_detail.png"); TCanvas *can51 = new TCanvas("can51","DCAr versus pT",700,800); can51->Divide(2,2); TObjArray *arr9 = new TObjArray(); TObjArray *arr10 = new TObjArray(); TObjArray *arr11 = new TObjArray(); TObjArray *arr12 = new TObjArray(); can51->cd(1); h3D = (TH3*)fold->FindObject("h_tpc_track_pos_recvertex_3_5_7"); TH3 *h3Dp = h3D->Clone("h3Dp"); h3D->SetAxisRange(0.25,ptMax,"Z"); h3D->GetYaxis()->SetRangeUser(0.0,maxeta); h2D = (TH2*)h3D->Project3D("xz"); h2D->Draw("colz"); h2D->SetTitle("DCAR vs pT of pos. charged tracks(A Side)"); h2D->FitSlicesY(0,0,-1,0,"QNR",arr9); TH1 *width1 = (TH1*)arr9->At(2); width1->Draw("same"); width1->SetLineColor(2); arr9->At(1)->Draw("same"); can51->cd(2); //h3D = (TH3*)fold->FindObject("h_tpc_track_pos_recvertex_3_5_7"); h3Dp->SetAxisRange(0.25,ptMax,"Z"); h3Dp->GetYaxis()->SetRangeUser(mineta,-0.00001); h2D = (TH2*)h3Dp->Project3D("xz"); h2D->Draw("colz"); h2D->SetTitle("DCAR vs pT of pos. charged tracks(C Side)"); h2D->FitSlicesY(0,0,-1,0,"QNR",arr10); TH1 *width2 = (TH1*)arr10->At(2); width2->Draw("same"); width2->SetLineColor(2); arr10->At(1)->Draw("same"); PlotTimestamp(can51); can51->cd(3); h3D = (TH3*)fold->FindObject("h_tpc_track_neg_recvertex_3_5_7"); TH3 *h3Dn = h3D->Clone("h3Dn"); h3D->SetAxisRange(0.25,ptMax,"Z"); h3D->GetYaxis()->SetRangeUser(0.0,maxeta); h2D = (TH2*)h3D->Project3D("xz"); h2D->Draw("colz"); h2D->SetTitle("DCAR vs pT of neg. charged tracks(A Side)"); h2D->FitSlicesY(0,0,-1,0,"QNR",arr11); TH1 *width3 = (TH1*)arr11->At(2); width3->Draw("same"); width3->SetLineColor(2); arr11->At(1)->Draw("same"); can51->cd(4); //h3D = (TH3*)fold->FindObject("h_tpc_track_neg_recvertex_3_5_7"); h3Dn->SetAxisRange(0.25,ptMax,"Z"); h3Dn->GetYaxis()->SetRangeUser(mineta,-0.00001); h2D = (TH2*)h3Dn->Project3D("xz"); h2D->Draw("colz"); h2D->SetTitle("DCAR vs pT of neg. charged tracks(C Side)"); h2D->FitSlicesY(0,0,-1,0,"QNR",arr12); TH1 *width4 = (TH1*)arr12->At(2); width4->Draw("same"); width4->SetLineColor(2); arr12->At(1)->Draw("same"); can51->SaveAs("dcar_pT.png"); // get TPC dEdx performance object AliPerformanceDEdx *obj1 = TPC->FindObject("AliPerformanceDEdxTPCInner"); if(obj1==NULL) return(0); // get folder with histograms TFolder *fold1 = obj1->GetAnalysisFolder(); if(!fold1) return(0); TCanvas *can6 = new TCanvas("can6","TPC dEdX",1200,800); can6->Divide(3,2); can6->cd(1); gPad->SetLogz(); fold1->FindObject("h_tpc_dedx_0_1")->Draw("colz"); can6->cd(2); gPad->SetLogz(); fold1->FindObject("h_tpc_dedx_0_5")->Draw("colz"); can6->cd(3); gPad->SetLogz(); fold1->FindObject("h_tpc_dedx_0_6")->Draw("colz"); PlotTimestamp(can6); can6->cd(4); gPad->SetLogx(); gPad->SetLogz(); TH2 *h2 = fold1->FindObject("h_tpc_dedx_0_7"); h2->GetXaxis()->SetRangeUser(0.1,10); h2->Draw("colz"); //////////////////////////////////////////////////////////////////// can6->cd(5); gPad->SetLogz(); //fold1->FindObject("h_tpc_dedx_mips_a_0_1")->Draw("colz"); TH2 *htest = fold1->FindObject("h_tpc_dedx_mips_a_0_1"); htest->GetYaxis()->SetRangeUser(30,60); htest->Draw("colz"); can6->cd(6); gPad->SetLogz(); //fold1->FindObject("h_tpc_dedx_mips_c_0_1")->Draw("colz"); TH2 *htest1 = fold1->FindObject("h_tpc_dedx_mips_c_0_1"); htest1->GetYaxis()->SetRangeUser(30,60); htest1->Draw("colz"); ///////////////////////////////////////////////////////////////////// can6->SaveAs("TPC_dEdx_track_info.png"); TObjArray *arr9 = new TObjArray(); TObjArray *arr10 = new TObjArray(); TCanvas *can7 = new TCanvas("can7","DCA vs #phi",1200,800); can7->Divide(4,2); can7->cd(1); h3D = (TH3*)fold->FindObject("h_tpc_track_pos_recvertex_3_5_6"); TH3 *h3D71 = h3D->Clone("h3D71"); h3D->GetYaxis()->SetRangeUser(0.0,maxeta); h3D->Project3D("xz")->Draw("colz"); h3D->Project3D("xz")->SetTitle("DCAR vs #phi of pos. charged tracks(A)"); can7->cd(2); h3D = (TH3*)fold->FindObject("h_tpc_track_neg_recvertex_3_5_6"); TH3 *h3D72 = h3D->Clone("h3D72"); h3D->GetYaxis()->SetRangeUser(0.0,maxeta); h3D->Project3D("xz")->Draw("colz"); h3D->Project3D("xz")->SetTitle("DCAR vs #phi of neg. charged tracks(A)"); can7->cd(3); h3D = (TH3*)fold->FindObject("h_tpc_track_pos_recvertex_4_5_6"); TH3 *h3D73 = h3D->Clone("h3D73"); h3D->GetYaxis()->SetRangeUser(0.0,maxeta); h3D->Project3D("xz")->Draw("colz"); h3D->Project3D("xz")->SetTitle("DCAZ vs #phi of pos. charged tracks(A)"); can7->cd(4); h3D = (TH3*)fold->FindObject("h_tpc_track_neg_recvertex_4_5_6"); TH3 *h3D74 = h3D->Clone("h3D74"); h3D->GetYaxis()->SetRangeUser(0.0,maxeta); h3D->Project3D("xz")->Draw("colz"); h3D->Project3D("xz")->SetTitle("DCAZ vs #phi of neg. charged tracks(A)"); PlotTimestamp(can7); can7->cd(5); //h3D = (TH3*)fold->FindObject("h_tpc_track_pos_recvertex_3_5_6"); h3D71->GetYaxis()->SetRangeUser(mineta,-0.00001); h3D71->Project3D("xz")->Draw("colz"); h3D71->Project3D("xz")->SetTitle("DCAR vs #phi of pos. charged tracks(C)"); can7->cd(6); //h3D = (TH3*)fold->FindObject("h_tpc_track_neg_recvertex_3_5_6"); h3D72->GetYaxis()->SetRangeUser(mineta,-0.00001); h3D72->Project3D("xz")->Draw("colz"); h3D72->Project3D("xz")->SetTitle("DCAR vs #phi of neg. charged tracks(C)"); can7->cd(7); //h3D = (TH3*)fold->FindObject("h_tpc_track_pos_recvertex_4_5_6"); h3D73->GetYaxis()->SetRangeUser(mineta,-0.00001); h3D73->Project3D("xz")->Draw("colz"); h3D73->Project3D("xz")->SetTitle("DCAZ vs #phi of pos. charged tracks(C)"); can7->cd(8); //h3D = (TH3*)fold->FindObject("h_tpc_track_neg_recvertex_4_5_6"); h3D74->GetYaxis()->SetRangeUser(mineta,-0.00001); h3D74->Project3D("xz")->Draw("colz"); h3D74->Project3D("xz")->SetTitle("DCAZ vs #phi of neg. charged tracks(C)"); can7->SaveAs("dca_and_phi.png"); AliPerformanceMatch *obj2 = (AliPerformanceMatch*)TPC->FindObject("AliPerformanceMatchTPCITS"); TFolder *pMatch = obj2->GetAnalysisFolder(); AliPerformanceMatch *obj3 = (AliPerformanceMatch*)TPC->FindObject("AliPerformanceMatchITSTPC"); TFolder *pPull = obj3->GetAnalysisFolder(); // // event level // TH1 *h1D = 0; TH1 *h1D1 = 0; TH1 *h1D2 = 0; TH1 *h1D3 = 0; TH2 *h2D = 0; TH2 *h2D1 = 0; TCanvas *can8 = new TCanvas("can8","TPC-ITS Matching Efficiency",800,800); can8->Divide(2,2); can8->cd(1); h2D = (TH2*)(pMatch->FindObject("h_tpc_match_trackingeff_all_2_3")); h2D1 = (TH2*)(pMatch->FindObject("h_tpc_match_trackingeff_tpc_2_3")); TH2 *h2D2 = h2D->Clone("h2D2"); TH2 *h2D3 = h2D1->Clone("h2D3"); h2D->GetXaxis()->SetRangeUser(0,1.5); h2D1->GetXaxis()->SetRangeUser(0,1.5); h1D = h2D->ProjectionY(); h1D1 = h2D1->ProjectionY(); h1D1->Divide(h1D); h1D1->GetYaxis()->SetRangeUser(0,1.05); h1D1->SetTitle("TPC-ITS Matching Efficiency (A)"); h1D1->Draw("e0"); can8->cd(2); h2D2->GetXaxis()->SetRangeUser(-1.5,0); h2D3->GetXaxis()->SetRangeUser(-1.5,0); h1D2 = h2D2->ProjectionY(); h1D3 = h2D3->ProjectionY(); h1D3->Divide(h1D2); h1D3->SetLineColor(2); h1D3->GetYaxis()->SetRangeUser(0,1.05); h1D3->SetTitle("TPC-ITS Matching Efficiency (C)"); h1D3->Draw("e0"); PlotTimestamp(can8); can8->cd(3); h2D = (TH2*)(pMatch->FindObject("h_tpc_match_trackingeff_all_1_3")); h2D1 = (TH2*)(pMatch->FindObject("h_tpc_match_trackingeff_tpc_1_3")); TH2 *h2D4 = h2D->Clone("h2D4"); TH2 *h2D5 = h2D1->Clone("h2D5"); h2D->GetXaxis()->SetRangeUser(0,1.5); h2D1->GetXaxis()->SetRangeUser(0,1.5); h1D = h2D->ProjectionY(); h1D1 = h2D1->ProjectionY(); h1D1->Divide(h1D); h1D1->SetTitle("TPC-ITS Matching Efficiency (A)"); h1D1->Draw("e0"); can8->cd(4); h2D4->GetXaxis()->SetRangeUser(-1.5,0); h2D5->GetXaxis()->SetRangeUser(-1.5,0); h1D2 = h2D4->ProjectionY(); h1D3 = h2D5->ProjectionY(); h1D3->Divide(h1D2); h1D3->SetLineColor(2); h1D3->SetTitle("TPC-ITS Matching Efficiency (C)"); h1D3->Draw("e0"); can8->SaveAs("TPC-ITS.png"); // TH2 *h2D = 0; TCanvas *can9 = new TCanvas("can9","Pulls of TPC Tracks vs 1/pT",1200,800); can9->Divide(3,2); TObjArray *arr1 = new TObjArray(); TObjArray *arr2 = new TObjArray(); TObjArray *arr3 = new TObjArray(); TObjArray *arr4 = new TObjArray(); TObjArray *arr5 = new TObjArray(); can9->cd(1); h2D = (TH2*)(pPull->FindObject("h_tpc_match_pull_0_7")); h2D->FitSlicesY(0,0,-1,0,"QNR",arr1); h2D->Draw("colz"); arr1->At(1)->Draw("same"); can9->cd(2); h2D = (TH2*)(pPull->FindObject("h_tpc_match_pull_1_7")); h2D->FitSlicesY(0,0,-1,0,"QNR",arr2); h2D->Draw("colz"); arr2->At(1)->Draw("same"); can9->cd(3); h2D = (TH2*)(pPull->FindObject("h_tpc_match_pull_2_7")); h2D->FitSlicesY(0,0,-1,0,"QNR",arr3); h2D->Draw("colz"); arr3->At(1)->Draw("same"); can9->cd(4); h2D = (TH2*)(pPull->FindObject("h_tpc_match_pull_3_7")); h2D->FitSlicesY(0,0,-1,0,"QNR",arr4); h2D->Draw("colz"); arr4->At(1)->Draw("same"); can9->cd(5); h2D = (TH2*)(pPull->FindObject("h_tpc_match_pull_4_7")); h2D->FitSlicesY(0,0,-1,0,"QNR",arr5); h2D->Draw("colz"); arr5->At(1)->Draw("same"); can9->cd(6); PlotTimestamp(can9); can9->SaveAs("pull-pt.png"); TCanvas *can10 = new TCanvas("can10","Pulls of TPC Tracks vs Eta",1200,800); can10->Divide(3,2); TObjArray *arr6 = new TObjArray(); TObjArray *arr7 = new TObjArray(); TObjArray *arr8 = new TObjArray(); TObjArray *arr9 = new TObjArray(); TObjArray *arr10 = new TObjArray(); can10->cd(1); h2D = (TH2*)(pPull->FindObject("h_tpc_match_pull_0_6")); h2D->FitSlicesY(0,0,-1,0,"QNR",arr6); h2D->Draw("colz"); arr6->At(1)->Draw("same"); can10->cd(2); h2D = (TH2*)(pPull->FindObject("h_tpc_match_pull_1_6")); h2D->FitSlicesY(0,0,-1,0,"QNR",arr7); h2D->Draw("colz"); arr7->At(1)->Draw("same"); can10->cd(3); h2D = (TH2*)(pPull->FindObject("h_tpc_match_pull_2_6")); h2D->FitSlicesY(0,0,-1,0,"QNR",arr8); h2D->Draw("colz"); arr8->At(1)->Draw("same"); can10->cd(4); h2D = (TH2*)(pPull->FindObject("h_tpc_match_pull_3_6")); h2D->FitSlicesY(0,0,-1,0,"QNR",arr9); h2D->Draw("colz"); arr9->At(1)->Draw("same"); can10->cd(5); h2D = (TH2*)(pPull->FindObject("h_tpc_match_pull_4_6")); h2D->FitSlicesY(0,0,-1,0,"QNR",arr10); h2D->Draw("colz"); arr10->At(1)->Draw("same"); can10->cd(6); PlotTimestamp(can10); can10->SaveAs("pull-eta.png"); TCanvas *can11 = new TCanvas("can11","Pulls of TPC Tracks vs Phi",1200,800); can11->Divide(3,2); TObjArray *arr11 = new TObjArray(); TObjArray *arr12 = new TObjArray(); TObjArray *arr13 = new TObjArray(); TObjArray *arr14 = new TObjArray(); TObjArray *arr15 = new TObjArray(); can11->cd(1); h2D = (TH2*)(pPull->FindObject("h_tpc_match_pull_0_5")); h2D->FitSlicesY(0,0,-1,0,"QNR",arr11); h2D->Draw("colz"); arr11->At(1)->Draw("same"); can11->cd(2); h2D = (TH2*)(pPull->FindObject("h_tpc_match_pull_1_5")); h2D->FitSlicesY(0,0,-1,0,"QNR",arr12); h2D->Draw("colz"); arr12->At(1)->Draw("same"); can11->cd(3); h2D = (TH2*)(pPull->FindObject("h_tpc_match_pull_2_5")); h2D->FitSlicesY(0,0,-1,0,"QNR",arr13); h2D->Draw("colz"); arr13->At(1)->Draw("same"); can11->cd(4); h2D = (TH2*)(pPull->FindObject("h_tpc_match_pull_3_5")); h2D->FitSlicesY(0,0,-1,0,"QNR",arr14); h2D->Draw("colz"); arr14->At(1)->Draw("same"); can11->cd(5); h2D = (TH2*)(pPull->FindObject("h_tpc_match_pull_4_5")); h2D->FitSlicesY(0,0,-1,0,"QNR",arr15); h2D->Draw("colz"); arr15->At(1)->Draw("same"); can11->cd(6); PlotTimestamp(can11); can11->SaveAs("pull-phi.png"); AliPerformanceMatch *obj4 = (AliPerformanceMatch*)TPC->FindObject("AliPerformanceMatchTPCConstrain"); TFolder *pConstrain = obj4->GetAnalysisFolder(); TCanvas *can12 = new TCanvas("can12","#delta_{sin#phi}/#sigma_{sin#phi}",800,800); can12->Divide(2,2); h3D = (TH3*)pConstrain->FindObject("h_tpc_constrain_tpc_0_2_3"); TH3 *h31 = h3D->Clone("h31"); can12->cd(1); h3D->GetZaxis()->SetRangeUser(0,maxeta); // h3D->GetYaxis()->SetRangeUser(0.25,10); h2D = (TH2*)h3D->Project3D("xy"); h2D->Draw("colz"); h2D->SetTitle("A Side"); h2D->SetYTitle("(sin#phi_{TPC} - sin#phi_{Global})/#sigma"); h2D->FitSlicesY(0,0,-1,0,"QNR",arr11); arr11->At(1)->Draw("same"); TH1 *width1 = (TH1*)arr11->At(2); width1->Draw("same"); width1->SetLineColor(2); /* h3D->Project3D("xy")->Draw("colz"); h3D->Project3D("xy")->SetTitle("A Side"); h3D->Project3D("xy")->SetYTitle("#delta_{sin#phi}/#sigma_{sin#phi}"); h3D->Project3D("xy")->FitSlicesY(0,0,-1,0,"QNR",arr11); arr11->At(1)->Draw("same"); */ can12->cd(2); h31->GetZaxis()->SetRangeUser(mineta,-0.001); // h31->GetYaxis()->SetRangeUser(0.25,10); h2D = (TH2*)h31->Project3D("xy"); h2D->Draw("colz"); h2D->SetTitle("C Side"); h2D->SetYTitle("(sin#phi_{TPC} - sin#phi_{Global})/#sigma"); h2D->FitSlicesY(0,0,-1,0,"QNR",arr12); arr12->At(1)->Draw("same"); TH1 *width2 = (TH1*)arr12->At(2); width2->Draw("same"); width2->SetLineColor(2); PlotTimestamp(can1); /* h31->Project3D("xy")->Draw("colz"); h31->Project3D("xy")->SetTitle("C Side"); h31->Project3D("xy")->SetYTitle("#delta_{sin#phi}/#sigma_{sin#phi}"); h31->Project3D("xy")->FitSlicesY(0,0,-1,0,"QNR",arr12); arr12->At(1)->Draw("same"); */ can12->cd(3); h3D = (TH3*)pConstrain->FindObject("h_tpc_constrain_tpc_0_1_3"); h3D->GetZaxis()->SetRangeUser(0,maxeta); TH3 *h32 = h3D->Clone("h32"); h2D = (TH2*)h3D->Project3D("xy"); h2D->Draw("colz"); h2D->SetTitle("A Side"); h2D->SetYTitle("(sin#phi_{TPC} - sin#phi_{Global})/#sigma"); h2D->FitSlicesY(0,0,-1,0,"QNR",arr13); arr13->At(1)->Draw("same"); TH1 *width3 = (TH1*)arr13->At(2); width3->Draw("same"); width3->SetLineColor(2); /* h3D->Project3D("xy")->Draw("colz"); h3D->Project3D("xy")->SetTitle("A Side"); h3D->Project3D("xy")->SetYTitle("#delta_{sin#phi}/#sigma_{sin#phi}"); h3D->Project3D("xy")->FitSlicesY(0,0,-1,0,"QNR",arr13); arr13->At(1)->Draw("same"); */ can12->cd(4); h32->GetZaxis()->SetRangeUser(mineta,-0.001); h2D = (TH2*)h32->Project3D("xy"); h2D->Draw("colz"); h2D->SetTitle("C Side"); h2D->SetYTitle("(sin#phi_{TPC} - sin#phi_{Global})/#sigma"); h2D->FitSlicesY(0,0,-1,0,"QNR",arr14); arr14->At(1)->Draw("same"); TH1 *width4 = (TH1*)arr14->At(2); width4->Draw("same"); width4->SetLineColor(2); /* h32->Project3D("xy")->Draw("colz"); h32->Project3D("xy")->SetTitle("C Side"); h32->Project3D("xy")->SetYTitle("#delta_{sin#phi}/#sigma_{sin#phi}"); h32->Project3D("xy")->FitSlicesY(0,0,-1,0,"QNR",arr14); arr14->At(1)->Draw("same"); */ can12->SaveAs("pullPhiConstrain.png"); // // resolution and efficiency plots from David - added by Patrick // /* AliPerformanceRes *objPerfRes = (AliPerformanceRes*) TPC->FindObject("AliPerformanceRes"); if (objPerfRes == NULL) {printf("Error getting AliPerformanceRes\n");} TFolder *folderRes = objPerfRes->GetAnalysisFolder(); TH1F* h_resPt_vs_Pt = (TH1F*)folderRes->FindObject("h_res_4_vs_9"); TH1F* h_mean_resPt_vs_Pt = (TH1F*)folderRes->FindObject("h_mean_res_4_vs_9"); TH1F* h_pullPt_vs_Pt = (TH1F*)folderRes->FindObject("h_pull_4_vs_9"); TH1F* h_mean_pullPt_vs_Pt = (TH1F*)folderRes->FindObject("h_mean_pull_4_vs_9"); TCanvas *can13 = new TCanvas("can13","Resolution p_{T}",800,800); can13->Divide(2,2); can13->cd(1); h_resPt_vs_Pt ->Draw(); can13->cd(2); h_mean_resPt_vs_Pt ->Draw(); can13->cd(3); h_pullPt_vs_Pt ->Draw(); can13->cd(4); h_mean_pullPt_vs_Pt->Draw(); can13->SaveAs("res_pT_1overpT.png"); AliPerformanceEff *objPerfEff = (AliPerformanceEff*) TPC->FindObject("AliPerformanceEff"); if (objPerfEff == NULL) {printf("Error getting AliPerformanceEff\n");} TFolder *folderEff = objPerfEff->GetAnalysisFolder(); TH1F* eta_all = (TH1F*)folderEff->FindObject("etaRecEff"); TH1F* eta_all_neg = (TH1F*)folderEff->FindObject("etaRecEffNeg"); TH1F* eta_all_pos = (TH1F*)folderEff->FindObject("etaRecEffPos"); TH1F* phi_all = (TH1F*)folderEff->FindObject("phiRecEff"); TH1F* phi_all_neg = (TH1F*)folderEff->FindObject("phiRecEffNeg"); TH1F* phi_all_pos = (TH1F*)folderEff->FindObject("phiRecEffPos"); TH1F* pt_all = (TH1F*)folderEff->FindObject("ptRecEff"); TH1F* pt_all_neg = (TH1F*)folderEff->FindObject("ptRecEffNeg"); TH1F* pt_all_pos = (TH1F*)folderEff->FindObject("ptRecEffPos"); TH1F* eta_all_findable = (TH1F*)folderEff->FindObject("etaRecEffF"); TH1F* eta_all_findable_neg = (TH1F*)folderEff->FindObject("etaRecEffFNeg"); TH1F* eta_all_findable_pos = (TH1F*)folderEff->FindObject("etaRecEffFPos"); TH1F* phi_all_findable = (TH1F*)folderEff->FindObject("phiRecEffF"); TH1F* phi_all_findable_neg = (TH1F*)folderEff->FindObject("phiRecEffFNeg"); TH1F* phi_all_findable_pos = (TH1F*)folderEff->FindObject("phiRecEffFPos"); TH1F* pt_all_findable = (TH1F*)folderEff->FindObject("ptRecEffF"); TH1F* pt_all_findable_neg = (TH1F*)folderEff->FindObject("ptRecEffFNeg"); TH1F* pt_all_findable_pos = (TH1F*)folderEff->FindObject("ptRecEffFPos"); TH1F* eta_Pi = (TH1F*)folderEff->FindObject("etaRecEffPi"); TH1F* eta_Pi_neg = (TH1F*)folderEff->FindObject("etaRecEffPiNeg"); TH1F* eta_Pi_pos = (TH1F*)folderEff->FindObject("etaRecEffPiPos"); TH1F* phi_Pi = (TH1F*)folderEff->FindObject("phiRecEffPi"); TH1F* phi_Pi_neg = (TH1F*)folderEff->FindObject("phiRecEffPiNeg"); TH1F* phi_Pi_pos = (TH1F*)folderEff->FindObject("phiRecEffPiPos"); TH1F* pt_Pi = (TH1F*)folderEff->FindObject("ptRecEffPi"); TH1F* pt_Pi_neg = (TH1F*)folderEff->FindObject("ptRecEffPiNeg"); TH1F* pt_Pi_pos = (TH1F*)folderEff->FindObject("ptRecEffPiPos"); TH1F* eta_K = (TH1F*)folderEff->FindObject("etaRecEffK"); TH1F* eta_K_neg = (TH1F*)folderEff->FindObject("etaRecEffKNeg"); TH1F* eta_K_pos = (TH1F*)folderEff->FindObject("etaRecEffKPos"); TH1F* phi_K = (TH1F*)folderEff->FindObject("phiRecEffK"); TH1F* phi_K_neg = (TH1F*)folderEff->FindObject("phiRecEffKNeg"); TH1F* phi_K_pos = (TH1F*)folderEff->FindObject("phiRecEffKPos"); TH1F* pt_K = (TH1F*)folderEff->FindObject("ptRecEffK"); TH1F* pt_K_neg = (TH1F*)folderEff->FindObject("ptRecEffKNeg"); TH1F* pt_K_pos = (TH1F*)folderEff->FindObject("ptRecEffKPos"); TH1F* eta_P = (TH1F*)folderEff->FindObject("etaRecEffP"); TH1F* eta_P_neg = (TH1F*)folderEff->FindObject("etaRecEffPNeg"); TH1F* eta_P_pos = (TH1F*)folderEff->FindObject("etaRecEffPPos"); TH1F* phi_P = (TH1F*)folderEff->FindObject("phiRecEffP"); TH1F* phi_P_neg = (TH1F*)folderEff->FindObject("phiRecEffPNeg"); TH1F* phi_P_pos = (TH1F*)folderEff->FindObject("phiRecEffPPos"); TH1F* pt_P = (TH1F*)folderEff->FindObject("ptRecEffP"); TH1F* pt_P_neg = (TH1F*)folderEff->FindObject("ptRecEffPNeg"); TH1F* pt_P_pos = (TH1F*)folderEff->FindObject("ptRecEffPPos"); eta_all ->SetLineWidth(2); eta_all_neg ->SetLineColor(kRed); eta_all_pos ->SetLineColor(kBlue); phi_all ->SetLineWidth(2); phi_all_neg ->SetLineColor(kRed); phi_all_pos ->SetLineColor(kBlue); pt_all ->SetLineWidth(2); pt_all_neg ->SetLineColor(kRed); pt_all_pos ->SetLineColor(kBlue); eta_all_findable ->SetLineWidth(2); eta_all_findable_neg->SetLineColor(kRed); eta_all_findable_pos->SetLineColor(kBlue); phi_all_findable ->SetLineWidth(2); phi_all_findable_neg->SetLineColor(kRed); phi_all_findable_pos->SetLineColor(kBlue); pt_all_findable ->SetLineWidth(2); pt_all_findable_neg ->SetLineColor(kRed); pt_all_findable_pos ->SetLineColor(kBlue); eta_Pi ->SetLineWidth(2); eta_Pi_neg ->SetLineColor(kRed); eta_Pi_pos ->SetLineColor(kBlue); phi_Pi ->SetLineWidth(2); phi_Pi_neg ->SetLineColor(kRed); phi_Pi_pos ->SetLineColor(kBlue); pt_Pi ->SetLineWidth(2); pt_Pi_neg ->SetLineColor(kRed); pt_Pi_pos ->SetLineColor(kBlue); eta_K ->SetLineWidth(2); eta_K_neg ->SetLineColor(kRed); eta_K_pos ->SetLineColor(kBlue); phi_K ->SetLineWidth(2); phi_K_neg ->SetLineColor(kRed); phi_K_pos ->SetLineColor(kBlue); pt_K ->SetLineWidth(2); pt_K_neg ->SetLineColor(kRed); pt_K_pos ->SetLineColor(kBlue); eta_P ->SetLineWidth(2); eta_P_neg ->SetLineColor(kRed); eta_P_pos ->SetLineColor(kBlue); phi_P ->SetLineWidth(2); phi_P_neg ->SetLineColor(kRed); phi_P_pos ->SetLineColor(kBlue); pt_P ->SetLineWidth(2); pt_P_neg ->SetLineColor(kRed); pt_P_pos ->SetLineColor(kBlue); TCanvas *can14 = new TCanvas("can14","Efficiency All",1000,800); can14->Divide(3, 2); can14->cd(1); eta_all ->Draw(); eta_all_neg ->Draw("same"); eta_all_pos ->Draw("same"); can14->cd(2); phi_all ->Draw(); phi_all_neg ->Draw("same"); phi_all_pos ->Draw("same"); can14->cd(3); pt_all ->Draw(); pt_all_neg ->Draw("same"); pt_all_pos ->Draw("same"); can14->cd(4); eta_all_findable ->Draw(); eta_all_findable_neg->Draw("same"); eta_all_findable_pos->Draw("same"); can14->cd(5); phi_all_findable ->Draw(); phi_all_findable_neg->Draw("same"); phi_all_findable_pos->Draw("same"); can14->cd(6); pt_all_findable ->Draw(); pt_all_findable_neg ->Draw("same"); pt_all_findable_pos ->Draw("same"); can14->SaveAs("eff_all+all_findable.png"); TCanvas *can15 = new TCanvas("can15","Efficiency Pi K P",1000,1000); can15->Divide(3, 3); can15->cd(1); eta_Pi ->Draw(); eta_Pi_neg ->Draw("same"); eta_Pi_pos ->Draw("same"); can15->cd(2); phi_Pi ->Draw(); phi_Pi_neg ->Draw("same"); phi_Pi_pos ->Draw("same"); can15->cd(3); pt_Pi ->Draw(); pt_Pi_neg ->Draw("same"); pt_Pi_pos ->Draw("same"); can15->cd(4); eta_K ->Draw(); eta_K_neg ->Draw("same"); eta_K_pos ->Draw("same"); can15->cd(5); phi_K ->Draw(); phi_K_neg ->Draw("same"); phi_K_pos ->Draw("same"); can15->cd(6); pt_K ->Draw(); pt_K_neg ->Draw("same"); pt_K_pos ->Draw("same"); can15->cd(7); eta_P ->Draw(); eta_P_neg ->Draw("same"); eta_P_pos ->Draw("same"); can15->cd(8); phi_P ->Draw(); phi_P_neg ->Draw("same"); phi_P_pos ->Draw("same"); can15->cd(9); pt_P ->Draw(); pt_P_neg ->Draw("same"); pt_P_pos ->Draw("same"); can15->SaveAs("eff_Pi_K_P.png"); //get more histos from THnSparse... THnSparseF* EffHisto = (THnSparseF*) objPerfEff->GetEffHisto(); //mceta:mcphi:mcpt:pid:recStatus:findable:charge:nclones:nfakes //pid:e-=0,mu-=1,pi+=2,K+=3,p+=4 TH1* h_pid = (TH1*) EffHisto->Projection(3); TH1* h_charge = (TH1*) EffHisto->Projection(6); //TH1* h_find = (TH1*) EffHisto->Projection(5); //TH1* eta_All = (TH1*) EffHisto->Projection(0); cout<<"before setrange"<<endl; EffHisto->GetAxis(5)->SetRangeUser(1, 1.999); //set findable EffHisto->GetAxis(3)->SetRangeUser(2, 2.999); //set pion cout<<"after setrange"<<endl; TH1* h_charge_sel = (TH1*) EffHisto->Projection(6); cout<<"after projection"<<endl; EffHisto->GetAxis(6)->UnZoom(); //set all charges TH1* eta_Pi_findable = (TH1*) EffHisto->Projection(0); TH1* phi_Pi_findable = (TH1*) EffHisto->Projection(1); TH1* pt_Pi_findable = (TH1*) EffHisto->Projection(2); EffHisto->GetAxis(6)->SetRangeUser(-1.5, -0.499); //set negative TH1* eta_Pi_findable_neg = (TH1*) EffHisto->Projection(0); TH1* phi_Pi_findable_neg = (TH1*) EffHisto->Projection(1); TH1* pt_Pi_findable_neg = (TH1*) EffHisto->Projection(2); EffHisto->GetAxis(6)->SetRangeUser(0.5, 1.499); //set positive TH1* eta_Pi_findable_pos = (TH1*) EffHisto->Projection(0); TH1* phi_Pi_findable_pos = (TH1*) EffHisto->Projection(1); TH1* pt_Pi_findable_pos = (TH1*) EffHisto->Projection(2); //EffHisto->GetAxis(3)->SetRangeUser(3, 3.999); //set kaon //EffHisto->GetAxis(6)->UnZoom(); //set all charges //EffHisto->GetAxis(3)->SetRangeUser(4, 4.999); //set proton eta_Pi_findable ->SetLineWidth(2); eta_Pi_findable_neg ->SetLineColor(kRed); eta_Pi_findable_pos ->SetLineColor(kBlue); phi_Pi_findable ->SetLineWidth(2); phi_Pi_findable_neg ->SetLineColor(kRed); phi_Pi_findable_pos ->SetLineColor(kBlue); pt_Pi_findable ->SetLineWidth(2); pt_Pi_findable_neg ->SetLineColor(kRed); pt_Pi_findable_pos ->SetLineColor(kBlue); //eta_K_findable ->SetLineWidth(2); //eta_K_findable_neg ->SetLineColor(kRed); //eta_K_findable_pos ->SetLineColor(kBlue); //phi_K_findable ->SetLineWidth(2); //phi_K_findable_neg ->SetLineColor(kRed); //phi_K_findable_pos ->SetLineColor(kBlue); //pt_K_findable ->SetLineWidth(2); //pt_K_findable_neg ->SetLineColor(kRed); //pt_K_findable_pos ->SetLineColor(kBlue); //eta_P_findable ->SetLineWidth(2); //eta_P_findable_neg ->SetLineColor(kRed); //eta_P_findable_pos ->SetLineColor(kBlue); //phi_P_findable ->SetLineWidth(2); //phi_P_findable_neg ->SetLineColor(kRed); //phi_P_findable_pos ->SetLineColor(kBlue); //pt_P_findable ->SetLineWidth(2); //pt_P_findable_neg ->SetLineColor(kRed); //pt_P_findable_pos ->SetLineColor(kBlue); TCanvas *can16 = new TCanvas("can16","Efficiency Pi K P findable",1000,1000); can16->Divide(3,3); can16->cd(7); h_pid->Draw(); can16->cd(8); h_charge->Draw(); can16->cd(9); h_charge_sel->Draw(); can16->cd(1); eta_Pi_findable->Draw(); eta_Pi_findable_neg->Draw("same"); eta_Pi_findable_pos->Draw("same"); can16->cd(2); phi_Pi_findable->Draw(); phi_Pi_findable_neg->Draw("same"); phi_Pi_findable_pos->Draw("same"); can16->cd(3); pt_Pi_findable->Draw(); pt_Pi_findable_neg->Draw("same"); pt_Pi_findable_pos->Draw("same"); can16->SaveAs("eff_Pi_K_P_findable.png"); */ ofstream fout("runqa_exist"); //if(NEvents>0) fout.precision(10); fout<<NEvents<<endl; fout.close(); }
void AnalyzeClipping(TString inputWaveName = "sum trigger input ch5 960mV", TString outputWaveName = "sum trigger output ch5 - 2V clip - 960mV input", Double_t inputDelay = 1.1E-8, Double_t lowerCut = 16E-9, Double_t upperCut = 23E-9, const char *inFile = "Data.root",const char *WaveformsFile = "Waveforms.root") { //try to access data file and in case of failure return if(gSystem->AccessPathName(inFile,kFileExists)) { cout << "Error: file " << inFile << " does not exsist. Run .x DataParse.C to create it" << endl; return; } TFile *f = TFile::Open(inFile); TFolder *dataSet; TString dataFolderS = "SumTriggerBoardData"; dataFolderS.Append(";1"); dataSet = (TFolder*)f->Get(dataFolderS); cout << dataSet << endl; cout << dataSet->GetName() << endl; Int_t nScope = 150; // number of measurements done by the scope evey time //try to access waveforms file and in case of failure return if(gSystem->AccessPathName(WaveformsFile,kFileExists)) { cout << "Error: file " << WaveformsFile << " does not exsist. Run .x WaveformsFileMaker.C to create it" << endl; return; } TFile *f = TFile::Open(WaveformsFile); TList *listOfKeys = f->GetListOfKeys(); Int_t numberOfKeys = listOfKeys->GetEntries(); TList *listOfGraphs = new TList(); // if the waveform file name begins with the string "comparator" it goes in this list TList *listOfCompWaves = new TList(); // if the waveform file name begins with the string "sum output" it goes in this list TList *listOfAdderWaves = new TList(); for(Int_t i = 0; i < numberOfKeys; i++) { TString *keyName = new TString(listOfKeys->At(i)->GetName()); TTree *tree = (TTree*)f->Get(keyName->Data()); Float_t x = 0; Float_t y = 0; tree->SetBranchAddress("x",&x); tree->SetBranchAddress("y",&y); Int_t nentries = tree->GetEntries(); TString *gName = new TString(keyName->Data()); gName->Append(" graph"); TGraphErrors *gWave = new TGraphErrors(nentries); gWave->SetName(gName->Data()); gWave->SetTitle(gName->Data()); gWave->GetXaxis()->SetTitle("Time"); gWave->GetYaxis()->SetTitle("Voltage"); for (Int_t j = 0; j < nentries; j++) { tree->GetEntry(j); gWave->SetPoint(j,x,y); } listOfGraphs->Add(gWave); } // Global variables Double_t *xInput, *xOutput, *yInput, *yOutput; // V input 960 mV TString path = "Clipping/Output width analysis/Channel 5/V input 960mV/"; TGraphErrors *gClip960mV = TBGraphErrors(dataSet,path,"V clip","Output FWHM",1,nScope); gClip960mV->SetMarkerStyle(20); gClip960mV->SetMarkerSize(0.8); gClip960mV->GetXaxis()->SetTitle("V clipping (mV)"); gClip960mV->GetYaxis()->SetTitle("Output FWHM (ns)"); TCanvas *cClip960mV = new TCanvas("cClip960mV","Output FWHM in function of V clipping",800,600); gClip960mV->Draw("APEL"); // Expected output FWHM TGraphErrors *gInput960mV = listOfGraphs->FindObject("sum trigger input ch5 960mV graph"); Double_t *xClip = gClip960mV->GetX(); Int_t nClip = gClip960mV->GetN(); cout << "nClip = " << nClip << endl; Long64_t graphPoints = gInput960mV->GetN(); yInput = gInput960mV->GetY(); xInput = gInput960mV->GetX(); vector<double> xFirst(nClip); vector<double> xLast(nClip); Double_t half; Int_t flag = 0; vector<double> yConv(graphPoints); for(Int_t i = 0; i < graphPoints; i++) { yConv[i] = -(yInput[i]); yConv[i] *= 1000; if(xInput[i] + inputDelay < lowerCut || xInput[i] + inputDelay > upperCut) yConv[i] = 0; } Double_t yInput960mVMax = TMath::MaxElement(graphPoints,&yConv[0]); for(Int_t i = 0; i < nClip; i++) { if(xClip[i] > yInput960mVMax) half = yInput960mVMax; else half = xClip[i]; half /=2; cout << half << endl; flag = 0; for(Int_t j = 0; j < graphPoints - 3; j++) { if((yConv[j + 1] - half)*(yConv[j] - half) < 0 && flag == 0) { xFirst[i] = xInput[j]; flag = 1; cout << "found first point! " << xFirst[i] << endl; continue; } if((yConv[j + 1] - half)*(yConv[j] - half) < 0 && flag == 1) { xLast[i] = xInput[j]; cout << "found last point! " << xLast[i] << endl; break; } } } vector<double> expectedFWHM960mV(nClip); for(Int_t i = 0; i < expectedFWHM960mV.size(); i++) { expectedFWHM960mV[i] = xLast[i] - xFirst[i]; // convert from seconds to nanoseconds expectedFWHM960mV[i] *= 10E8; cout << "expectedFWHM960mV[" << i << "] = " << expectedFWHM960mV[i] << endl; } // expected FWHM 960 mV graph TGraphErrors *gExpClip960mV = new TGraphErrors(nClip,xClip,&expectedFWHM960mV[0],0,0); gExpClip960mV->SetLineStyle(7); gExpClip960mV->SetMarkerStyle(20); gExpClip960mV->SetMarkerSize(0.8); // V input 1.9 V path = "Clipping/Output width analysis/Channel 5/V input 1.9V/"; TGraphErrors *gClip1Point9V = TBGraphErrors(dataSet,path,"V clip","Output FWHM",1,nScope); gClip1Point9V->SetMarkerStyle(20); gClip1Point9V->SetMarkerSize(0.8); gClip1Point9V->SetLineColor(kRed); gClip1Point9V->GetXaxis()->SetTitle("V clipping (mV)"); gClip1Point9V->GetYaxis()->SetTitle("Output FWHM (ns)"); TCanvas *cClip1Point9V = new TCanvas("cClip1Point9V","Output FWHM in function of V clipping",800,600); gClip1Point9V->Draw("APEL"); // Expected output FWHM TGraphErrors *gInput1Point9V = listOfGraphs->FindObject("sum trigger input ch5 1900mV graph"); xClip = gClip1Point9V->GetX(); nClip = gClip1Point9V->GetN(); cout << "nClip = " << nClip << endl; graphPoints = gInput1Point9V->GetN(); yInput = gInput1Point9V->GetY(); xInput = gInput1Point9V->GetX(); vector<double> xFirst(nClip); vector<double> xLast(nClip); flag = 0; vector<double> yConv(graphPoints); for(Int_t i = 0; i < graphPoints; i++) { yConv[i] = -(yInput[i]); yConv[i] *= 1000; if(xInput[i] + inputDelay < lowerCut || xInput[i] + inputDelay > upperCut) yConv[i] = 0; } Double_t yInput1Point9VMax = TMath::MaxElement(graphPoints,&yConv[0]); for(Int_t i = 0; i < nClip; i++) { if(xClip[i] > yInput1Point9VMax) half = yInput1Point9VMax; else half = xClip[i]; half /= 2; cout << half << endl; flag = 0; for(Int_t j = 0; j < graphPoints - 3; j++) { if((yConv[j + 1] - half)*(yConv[j] - half) < 0 && flag == 0) { xFirst[i] = xInput[j]; flag = 1; cout << "found first point! " << xFirst[i] << endl; continue; } if((yConv[j + 1] - half)*(yConv[j] - half) < 0 && flag == 1) { xLast[i] = xInput[j]; cout << "found last point! " << xLast[i] << endl; break; } } } vector<double> expectedFWHM1Point9V(nClip); for(Int_t i = 0; i < expectedFWHM1Point9V.size(); i++) { expectedFWHM1Point9V[i] = xLast[i] - xFirst[i]; // convert from seconds to nanoseconds expectedFWHM1Point9V[i] *= 10E8; cout << "expectedFWHM1Point9V[" << i << "] = " << expectedFWHM1Point9V[i] << endl; } // expected FWHM 960 mV graph TGraphErrors *gExpClip1Point9V = new TGraphErrors(nClip,xClip,&expectedFWHM1Point9V[0],0,0); gExpClip1Point9V->SetLineStyle(7); gExpClip1Point9V->SetLineColor(kRed); gExpClip1Point9V->SetMarkerStyle(20); gExpClip1Point9V->SetMarkerSize(0.8); // Collection of Output FWHM graphs, 2 amplitudes, serveral V clipping TMultiGraph *mgClipOutputFWHM = new TMultiGraph(); mgClipOutputFWHM->SetTitle("Collection of Output FWHM graphs, 2 amplitudes, serveral V clipping"); mgClipOutputFWHM->Add(gClip1Point9V); mgClipOutputFWHM->Add(gClip960mV); mgClipOutputFWHM->Add(gExpClip960mV); mgClipOutputFWHM->Add(gExpClip1Point9V); TCanvas *cmgClipOutputFWHM = new TCanvas("cmgClipOutputFWHM","Collection of Output FWHM graphs, 2 amplitudes, serveral V clipping"); mgClipOutputFWHM->Draw("APEL"); cmgClipOutputFWHM->Modified(); mgClipOutputFWHM->GetXaxis()->SetTitle("V clipping (mV)"); mgClipOutputFWHM->GetYaxis()->SetTitle("Output FWHM (ns)"); cmgClipOutputFWHM->Update(); legend = new TLegend(0.6,0.67,0.89,0.86,"V input"); legend->AddEntry(gClip1Point9V, "1.9 V", "lp"); legend->AddEntry(gClip960mV, "960 mV", "lp"); legend->AddEntry(gExpClip960mV, "Exp 960 mV", "lp"); legend->AddEntry(gExpClip1Point9V, "Exp 1.9 V", "lp"); legend->SetTextSize(0.04); legend->SetMargin(0.5); legend->Draw(); // Hysteresis plot: V output (t) in function of V input (t) for several clipping values // variables used in the analysis Long64_t iInputMax, iOutputMax; Float_t xInputMax, xOutputMax, xInputHalf, xOutputHalf; Double_t InputMax, OutputMax, InputHalf, OutputHalf; Long64_t firstIndex = 0; Long64_t lastIndex = 0; Long64_t inputGraphPoints = 0; Long64_t outputGraphPoints = 0; // hard coded values to cut the x axis of both waves // Input wave inputWaveName += " graph"; TGraphErrors *gInput = listOfGraphs->FindObject(inputWaveName); gInput->SetLineColor(kRed); gInput->SetLineWidth(2); xInput = gInput->GetX(); yInput = gInput->GetY(); inputGraphPoints = gInput->GetN(); cout << inputGraphPoints << endl; // Invert the input wave for(Int_t i = 0; i < inputGraphPoints; i++) { yInput[i] = -(yInput[i]); } // find the x at which the graph reaches the max value iInputMax = TMath::LocMax(inputGraphPoints, yInput); xInputMax = xInput[iInputMax]; cout << "iInputMax = " << iInputMax << endl; cout << "xInputMax = " << xInputMax << endl; InputMax = gInput->Eval(xInput[iInputMax]); cout << "InputMax = " << InputMax << endl; // Output wave outputWaveName += " graph"; TGraphErrors *gOutput = listOfGraphs->FindObject(outputWaveName); gOutput->SetLineWidth(2); xOutput = gOutput->GetX(); yOutput = gOutput->GetY(); outputGraphPoints = gOutput->GetN(); // find the x at which the graph reaches the max value iOutputMax = TMath::LocMax(outputGraphPoints, yOutput); xOutputMax = xOutput[iOutputMax]; cout << "iOutputMax = " << iOutputMax << endl; cout << "xOutputMax = " << xOutputMax << endl; OutputMax = gOutput->Eval(xOutput[iOutputMax]); cout << "OutputMax = " << OutputMax << endl; // compute x delay between max points Double_t delay = xOutputMax - xInputMax; cout << "delay = " << delay << endl; // Shift the x axis of the input graph and create a new graph with only a portion of the first graph for(Int_t i = 0; i < inputGraphPoints; i++) { xInput[i] += inputDelay; if(xInput[i] >= lowerCut) { if(firstIndex == 0) firstIndex = i; } if(xInput[i] <= upperCut) lastIndex = i; } cout << "firstIndex = " << firstIndex << endl; cout << "lastIndex = " << lastIndex << endl; cout << "xInput[firstIndex] = " << xInput[firstIndex] << endl; cout << lastIndex - firstIndex << endl; Long64_t input2GraphPoints = lastIndex - firstIndex; TGraphErrors *gInput2 = new TGraphErrors(input2GraphPoints); gInput2->SetTitle(inputWaveName); for(Int_t i = firstIndex; i <= lastIndex; i++) { gInput2->SetPoint(i - firstIndex,xInput[i],yInput[i]); } TCanvas *cgInput2 = new TCanvas("cgInput2", "cgInput2", 1200,800); gInput2->Draw("AL"); // create a new graph with only a portion of the first graph firstIndex = 0; lastIndex = 0; for(Int_t i = 0; i < outputGraphPoints; i++) { if(xOutput[i] >= lowerCut) { if(firstIndex == 0) firstIndex = i; } if(xOutput[i] <= upperCut) lastIndex = i; } cout << "firstIndex = " << firstIndex << endl; cout << "lastIndex = " << lastIndex << endl; cout << "xOutput[firstIndex] = " << xOutput[firstIndex] << endl; cout << lastIndex - firstIndex << endl; Long64_t output2GraphPoints = lastIndex - firstIndex; TGraphErrors *gOutput2 = new TGraphErrors(output2GraphPoints); gOutput2->SetTitle(outputWaveName); for(Int_t i = firstIndex; i <= lastIndex; i++) { gOutput2->SetPoint(i - firstIndex,xOutput[i],yOutput[i]); } TCanvas *cgOutput2 = new TCanvas("cgOutput2", "cgOutput2", 1200,800); gOutput2->Draw("AL"); // first hysteresis plot Double_t step; Double_t *xInput2; xInput2 = gInput2->GetX(); cout << "xInput2[input2GraphPoints - 1] = " << xInput2[input2GraphPoints - 1] << endl; cout << "xInput2[0] = " << xInput2[0] << endl; step = (xInput2[input2GraphPoints - 1] - xInput2[0])/output2GraphPoints; cout << "step = " << step << endl; // in case gInput2 and gOutput2 contain a different number of points create the hysteresis plot with gOutput2 points // and modify the yInput2 to match the number of points of yOutput2 vector<double> yInput2; for(Int_t i = 0; i < output2GraphPoints; i++) { yInput2.push_back(gInput2->Eval(xInput2[0] + i*step)); } Double_t *yOutput2; yOutput2 = gOutput2->GetY(); TGraphErrors *gHyst = new TGraphErrors(output2GraphPoints, &yInput2.at(0),yOutput2); gHyst->SetTitle("Hysteresis plot"); gHyst->GetXaxis()->SetTitle("Vin(t) [mV]"); gHyst->GetYaxis()->SetTitle("Vout(t) [mV]"); gHyst->GetYaxis()->SetTitleOffset(1.4); TCanvas *cgHyst = new TCanvas("cgHyst", "cgHyst", 1200,800); cgHyst->SetLeftMargin(0.12); gHyst->Draw("AL"); // collection of graphs TMultiGraph *mgInputOutput = new TMultiGraph(); mgInputOutput->Add(gInput); mgInputOutput->Add(gOutput); mgInputOutput->SetTitle("Input and output"); TCanvas *cmgInputOutput = new TCanvas("cmgInputOutput", "Input and output", 1200,800); mgInputOutput->Draw("AL"); cmgInputOutput->Update(); legend = new TLegend(0.65,0.68,0.86,0.86); legend->AddEntry(gInput, "Input", "lp"); legend->AddEntry(gOutput, "Output", "lp"); legend->SetMargin(0.4); legend->SetTextSize(0.04); legend->Draw(); cmgInputOutput->Modified(); }
void TBDataParser::OnStartElement(const char *element, const TList *attributes) { TXMLAttr *attr; TIter next(attributes); char *name = element; _currentElement = new TString(element); char *method = NULL; while ((attr = (TXMLAttr*) next())) { char *attrName = attr->GetName(); char *attrValue = attr->GetValue(); if(!strcmp(attrName, "name")) { name = attrValue; } if(!strcmp(attrName, "method")) { method = attrValue; _currentMethod = new TString(method); } } TFolder *currentFolder = _foldersStack->Last(); if(!strcmp(element, "vector")) { TString *nameString = new TString(name); vector<float> *values = new vector<float>; _values = values; nameString->ReplaceAll(" ","_"); TObjString *currentVector = new TObjString(nameString->Data()); TObjArray *vectorsStack = _vectorsStack; vectorsStack->AddLast(currentVector); TString *joinedName = new TString(((TObjString *) vectorsStack->First())->GetString().Data()); for(Int_t i = 1; i < vectorsStack->GetEntries(); i++) { joinedName->Append("_"); joinedName->Append(((TObjString *) vectorsStack->At(i))->GetString().Data()); } TObjString *joinedNameObj = new TObjString(joinedName->Data()); TObjArray *joinedNameStack = _joinedNameStack; TNtuple *vector = new TNtuple(joinedName->Data(),joinedName->Data(),"values"); _vector = vector; currentFolder->Add(vector); if(joinedNameStack->Contains(joinedName->Data())) cout << joinedName->Data() << "Error: " << "vector already exists. Be sure that in your XML file every vector has a unique path + name combination" << endl; joinedNameStack->Add(joinedNameObj); return; } _foldersStack->AddLast(currentFolder->AddFolder(name, name)); }
void histobrowser(const char* name="HLT Histos") { TEveManager::Create(); // --- Create special browser gEve->GetBrowser()->StartEmbedding(0); g_hlt_browser = gEve->GetBrowser()->MakeFileBrowser(); gEve->GetBrowser()->StopEmbedding(name); // --- Fill and register some lists/folders/histos gDirectory = 0; TH1F* h; TList* l = new TList; l->SetName("Cilka"); h = new TH1F("Foo", "Bar", 51, 0, 1); for (Int_t i=0; i<500; ++i) h->Fill(gRandom->Gaus(.63, .2)); l->Add(h); g_hlt_browser->Add(l); TFolder* f = new TFolder("Booboayes", "Statisticos"); h = new TH1F("Fooes", "Baros", 51, 0, 1); for (Int_t i=0; i<2000; ++i) { h->Fill(gRandom->Gaus(.7, .1)); h->Fill(gRandom->Gaus(.3, .1)); } f->Add(h); g_hlt_browser->Add(f); h = new TH1F("Fooesoto", "Barosana", 51, 0, 1); for (Int_t i=0; i<4000; ++i) { h->Fill(gRandom->Gaus(.25, .02), 0.04); h->Fill(gRandom->Gaus(.5, .1)); h->Fill(gRandom->Gaus(.75, .02), 0.04); } g_hlt_browser->Add(h); // --- Add some macros. TMacro* m; m = new TMacro; m->AddLine("{ g_hlt_canvas->Clear();" " g_hlt_canvas->cd();" " g_hlt_canvas->Update(); }"); m->SetName("Clear Canvas"); g_hlt_browser->Add(m); m = new TMacro; m->AddLine("{ g_hlt_canvas->Clear();" " g_hlt_canvas->Divide(2,2);" " g_hlt_canvas->cd(1);" " g_hlt_canvas->Update(); }"); m->SetName("Split Canvas"); g_hlt_browser->Add(m); // --- Create an embedded canvas gEve->GetBrowser()->StartEmbedding(1); g_hlt_canvas = new TCanvas; gEve->GetBrowser()->StopEmbedding("HLT Canvas"); }
void run_radius_correction () { TStopwatch timer; timer.Start(); gStyle->SetPalette(1,0); gStyle->SetHistLineWidth(2); // ---- Load libraries ------------------------------------------------- gROOT->LoadMacro("$VMCWORKDIR/gconfig/basiclibs.C"); basiclibs(); gROOT->LoadMacro("$VMCWORKDIR/macro/rich/cbmlibs.C"); cbmlibs(); // gROOT->LoadMacro("$VMCWORKDIR/macro/rich/setstyle.C"); // setphdStyle(); SetStyles(); char fileMC[200], fileRec[200]; sprintf(fileMC,"/d/cbm02/slebedev/rich/JUL09/correction/mc.00.root"); cout<<fileMC<<endl; TFile *f1 = new TFile(fileMC,"R"); TTree* t1 = f1->Get("cbmsim"); TFolder *fd1 = f1->Get("cbmroot"); TClonesArray* fMCTracks = (TClonesArray*) fd1->FindObjectAny("MCTrack"); t1->SetBranchAddress(fMCTracks->GetName(),&fMCTracks); sprintf(fileRec, "/d/cbm02/slebedev/rich/JUL09/correction/reco.00.root"); TFile *f = new TFile(fileRec,"R"); TTree* t = f->Get("cbmsim"); TFolder *fd = f->Get("cbmout"); TClonesArray *fRichRings = (TClonesArray*) fd->FindObjectAny("RichRing"); t->SetBranchAddress(fRichRings->GetName(),&fRichRings); TClonesArray *fRichMatches = (TClonesArray*) fd->FindObjectAny("RichRingMatch"); t->SetBranchAddress(fRichMatches->GetName(),&fRichMatches); //Int_t fNofBinsX = 40; //Int_t fNofBinsY = 50; Int_t fNofBinsX = 25; Int_t fNofBinsY = 25; ///A axis TH2D* fh_axisAXYCount; TH2D* fh_axisAXYW; TH2D* fh_axisAXY; TH2D* fh_axisASigma; TH2D* mapaxisAXY; ///B axis TH2D* fh_axisBXYCount; TH2D* fh_axisBXYW; TH2D* fh_axisBXY; TH2D* fh_axisBSigma; TH2D* mapaxisBXY; mapaxisAXY = new TH2D("fh_mapaxisAXY","dA distribution (x,y);X, [cm];Y, [cm]",fNofBinsX,-200,200,fNofBinsY,-250,250); mapaxisBXY = new TH2D("fh_mapaxisBXY","dB distribution (x,y);X, [cm];Y, [cm]",fNofBinsX,-200,200,fNofBinsY,-250,250); fh_axisAXYCount = new TH2D("fh_axisAXYCount","A Count",fNofBinsX,-200,200,fNofBinsY,-250,250); fh_axisAXYW = new TH2D("fh_axisAXYW","",fNofBinsX,-200,200,fNofBinsY,-250,250); fh_axisBXYCount = new TH2D("fh_axisBXYCount","B Count",fNofBinsX,-200,200,fNofBinsY,-250,250); fh_axisBXYW = new TH2D("fh_axisBXYW","",fNofBinsX,-200,200,fNofBinsY,-250,250); fh_axisAXY = new TH2D("fh_axisAXY","A distribution (x,y);X, [cm];Y, [cm]",fNofBinsX,-200,200,fNofBinsY,-250,250); fh_axisBXY = new TH2D("fh_axisBXY","B distribution (x,y);X, [cm];Y, [cm]",fNofBinsX,-200,200,fNofBinsY,-250,250); Double_t fMinAaxis = 4.5; Double_t fMaxAaxis = 7.5; ///Set Mean value of A and B axeses, Compact RICH //Double_t fMeanAaxis = 5.06; //Double_t fMeanBaxis = 4.65; ///Set Mean value of A and B axeses, Large RICH Double_t fMeanAaxis = 6.17; Double_t fMeanBaxis = 5.6; Int_t nEvents=t->GetEntries(); cout<<" nEvents ="<<nEvents<<endl; for(Int_t ievent=0;ievent<nEvents; ievent++ ) { cout<<"ievent = "<<ievent; CbmRichRing *ring=NULL; CbmRichRingMatch *match=NULL; t->GetEntry(ievent); t1->GetEntry(ievent); Int_t nofRings = fRichRings->GetEntries(); cout<<" nofRings = "<<nofRings; cout<<" nofMatches = "<< fRichMatches->GetEntries() ; cout<<" nofMCTracks = "<<fMCTracks->GetEntries() << endl; for(Int_t iRing=0; iRing < nofRings; iRing++){ ring = (CbmRichRing*)fRichRings->At(iRing); if (!ring) continue; match = (CbmRichRingMatch*)fRichMatches->At(iRing); if (!match) continue; Int_t trackId = match->GetMCTrackID(); if (trackId == -1) continue; if (trackId > fMCTracks->GetEntries()) continue; CbmMCTrack* mcTrack = (CbmMCTrack*)fMCTracks->At(trackId); if (!mcTrack) continue; Int_t pdg = TMath::Abs(mcTrack->GetPdgCode()); Int_t motherId = mcTrack->GetMotherId(); if (pdg != 11) continue; if (motherId != -1) continue; Double_t radius = ring->GetRadius(); Double_t axisA = ring->GetAaxis(); Double_t axisB = ring->GetBaxis(); Double_t centerX = ring->GetCenterX(); Double_t centerY = ring->GetCenterY(); if (axisA > fMaxAaxis || axisB > fMaxAaxis) continue; if (axisA < fMinAaxis || axisB < fMinAaxis) continue; fh_axisAXYW->Fill(centerX, centerY, axisA); fh_axisAXYCount->Fill(centerX, centerY); fh_axisBXYW->Fill(centerX, centerY, axisB); fh_axisBXYCount->Fill(centerX, centerY); } //iRing } //iEvent fh_axisAXY->Divide(fh_axisAXYW,fh_axisAXYCount); fh_axisBXY->Divide(fh_axisBXYW,fh_axisBXYCount); ///create two correction maps for (Int_t iX = 1; iX < mapaxisAXY->GetNbinsX() + 1; iX++){ for (Int_t iY = 1; iY < mapaxisAXY->GetNbinsY() + 1; iY++){ if (fh_axisAXYCount->GetBinContent(iX, iY) != 0){ mapaxisAXY->SetBinContent(iX, iY, fMeanAaxis - fh_axisAXY->GetBinContent(iX, iY) ); } else { mapaxisAXY->SetBinContent(iX, iY, -99999999.); } if (fh_axisBXYCount->GetBinContent(iX, iY) != 0){ mapaxisBXY->SetBinContent(iX, iY, fMeanBaxis - fh_axisBXY->GetBinContent(iX, iY) ); } else { mapaxisBXY->SetBinContent(iX, iY, -99999999.); } } } c1_0 = new TCanvas("c1_0","c1_0",10,10,600,600); c1_0->Divide(1,2); c1_0->cd(1); fh_axisAXYCount->Draw("COLZ"); c1_0->cd(2); fh_axisBXYCount->Draw("COLZ"); c1 = new TCanvas("c1","c1",10,10,600,600); c1->Divide(1,2); c1->cd(1); fh_axisAXY->SetMinimum(5.0); fh_axisAXY->SetMaximum(6.4); fh_axisAXY->Draw("COLZ"); c1->cd(2); fh_axisBXY->SetMinimum(5.0); fh_axisBXY->SetMaximum(6.0); fh_axisBXY->Draw("COLZ"); c2 = new TCanvas("c2","c2",10,10,600,600); c2->Divide(1,2); c2->cd(1); mapaxisAXY->SetMinimum(-0.5); mapaxisAXY->SetMaximum(0.5); mapaxisAXY->Draw("COLZ"); c2->cd(2); mapaxisBXY->SetMinimum(-0.5); mapaxisBXY->SetMaximum(0.5); mapaxisBXY->Draw("COLZ"); ///// Check correction procedure TH1D* fh_Abefore = new TH1D("fh_Abefore","A before;A, [cm];yield", 300, 0., 9.);; TH1D* fh_Bbefore= new TH1D("fh_Bbefore","B before;B, [cm];yield", 300, 0., 9.);; TH1D* fh_A = new TH1D("fh_A","A after;A, [cm];yield", 300, 0., 9.);; TH1D* fh_B = new TH1D("fh_B","B after;B, [cm];yield", 300, 0., 9.);; cout <<"Check correction procedure......" << endl; for(Int_t ievent=0;ievent<nEvents;ievent++ ) { CbmRichRing *ring=NULL; // if (ievent % 100 == 0) cout << ievent << " "; //t1->GetEntry(ievent); t->GetEntry(ievent); t1->GetEntry(ievent); Int_t nofRings = fRichRings->GetEntries(); for(Int_t iRing=0; iRing < nofRings; iRing++){ ring = (CbmRichRing*)fRichRings->At(iRing); if (!ring) continue; match = (CbmRichRingMatch*)fRichMatches->At(iRing); if (!match) continue; Int_t trackId = match->GetMCTrackID(); if (trackId == -1) continue; if (trackId > fMCTracks->GetEntries()) continue; CbmMCTrack* mcTrack = (CbmMCTrack*)fMCTracks->At(trackId); if (!mcTrack) continue; Int_t pdg = TMath::Abs(mcTrack->GetPdgCode()); Int_t motherId = mcTrack->GetMotherId(); if (pdg != 11) continue; if (motherId != -1) continue; Double_t axisA = ring->GetAaxis(); Double_t axisB = ring->GetBaxis(); if (axisA > fMaxAaxis || axisB > fMaxAaxis) continue; if (axisA < fMinAaxis || axisB < fMinAaxis) continue; Double_t radius = ring->GetRadius(); Double_t centerX = ring->GetCenterX(); Double_t centerY = ring->GetCenterY(); Double_t axisAbefore = ring->GetAaxis(); Double_t axisBbefore = ring->GetBaxis(); fh_Abefore->Fill(axisAbefore); fh_Bbefore->Fill(axisBbefore); Double_t axisA = ring->GetAaxis(); Double_t axisB = ring->GetBaxis() ; axisA += mapaxisAXY->GetBinContent(mapaxisAXY->FindBin(centerX,centerY)); axisB += mapaxisBXY->GetBinContent(mapaxisBXY->FindBin(centerX,centerY)); fh_A->Fill(axisA); fh_B->Fill(axisB); } //iRing }//iEvent // gStyle->SetOptStat(0); c3 = new TCanvas("c3","c3",10,10,600,600); c3->Divide(2,2); c3->cd(1); fh_Abefore->Scale(1./fh_Abefore->Integral()); fh_Abefore->SetMaximum(fh_Abefore->GetMaximum()*1.3); fh_Abefore->Draw(); fh_Abefore->SetAxisRange(fMinAaxis, fMaxAaxis); fh_Abefore->Fit("gaus"); Double_t sigmaAb = fh_Abefore->GetFunction("gaus")->GetParameter("Sigma"); char sigmaTxtAb[30]; sprintf(sigmaTxtAb,"sigma = %.3f",sigmaAb); TText* txtAb = new TText(4.3, fh_Abefore->GetMaximum()*0.85, sigmaTxtAb); txtAb->SetTextSize(0.1); txtAb->Draw(); gPad->SetGridx(true); gPad->SetGridy(true); c3->cd(2); fh_Bbefore->Scale(1./fh_Bbefore->Integral()); fh_Bbefore->SetMaximum(fh_Bbefore->GetMaximum()*1.3); fh_Bbefore->Draw(); fh_Bbefore->SetAxisRange(fMinAaxis, fMaxAaxis); fh_Bbefore->Fit("gaus"); Double_t sigmaBb = fh_Bbefore->GetFunction("gaus")->GetParameter("Sigma"); char sigmaTxtBb[30]; sprintf(sigmaTxtBb,"sigma = %.3f",sigmaBb); TText* txtBb = new TText(4.3, fh_Bbefore->GetMaximum()*0.85, sigmaTxtBb); txtBb->SetTextSize(0.1); txtBb->Draw(); gPad->SetGridx(true); gPad->SetGridy(true); c3->cd(3); fh_A->Scale(1./fh_A->Integral()); fh_A->SetMaximum(fh_A->GetMaximum()*1.3); fh_A->SetAxisRange(fMinAaxis, fMaxAaxis); fh_A->Draw(); fh_A->Fit("gaus"); Double_t sigmaA = fh_A->GetFunction("gaus")->GetParameter("Sigma"); char sigmaTxtA[30]; sprintf(sigmaTxtA,"sigma = %.3f",sigmaA); TText* txtA = new TText(4.3, fh_A->GetMaximum()*0.85, sigmaTxtA); txtA->SetTextSize(0.1); txtA->Draw(); gPad->SetGridx(true); gPad->SetGridy(true); c3->cd(4); fh_B->Scale(1./fh_B->Integral()); fh_B->SetMaximum(fh_B->GetMaximum()*1.3); fh_B->SetAxisRange(fMinAaxis, fMaxAaxis); fh_B->Draw(); fh_B->Fit("gaus"); Double_t sigmaB = fh_B->GetFunction("gaus")->GetParameter("Sigma"); char sigmaTxtB[30]; sprintf(sigmaTxtB,"sigma = %.3f",sigmaB); TText* txtB = new TText(4.3, fh_B->GetMaximum()*0.85, sigmaTxtB); txtB->SetTextSize(0.1); txtB->Draw(); gPad->SetGridx(true); gPad->SetGridy(true); /// Write correction map to the file TFile *file = new TFile("radius_correction_map.root", "recreate"); mapaxisAXY->Write(); mapaxisBXY->Write(); file->Close(); }
//=========================================================================== void hTreeBrowser::collectItems(QTreeWidgetItem * wItem, hTreeBrowser::selectedObjectsDef & selectedObjects) { // STDLINE("hTreeBrowser::collectItems()",ACRed); hTreeBrowser::dirPathDef dirPath = this->getFullPath(wItem) ; if(dirPath.size() < 2) return; std::string dir = ""; for(unsigned int i=1; i<dirPath.size()-1; i++) { dir += dirPath[i]; if( i != dirPath.size()-2) dir += "/" ; } if( dirPath[0] == "root") // Selected object is in memory only { TFolder* targetFolder = (TFolder *)(gROOT->GetRootFolder()->FindObjectAny(dir.c_str())) ; TObject* obj = targetFolder->FindObject(wItem->text(0).toStdString().c_str()) ; selectedObjects[dir].push_back(obj) ; } else // Selected object resides on files { // TFile * file = theHManager_->getFileHandle(dirPath[0]) ; TFile* file = file_ ; TObject* obj = file->FindObjectAny(dirPath[1].c_str()) ; if( obj->IsA() == TFolder::Class() ) { for(hTreeBrowser::dirPathDef::iterator ni=dirPath.begin()+2; ni!=dirPath.end(); ++ni) { if( ni == dirPath.end() - 1 ) // Last is the histogram name { selectedObjects[dir].push_back(((TFolder*)obj)->FindObjectAny((*ni).c_str())) ; } else { obj = ((TFolder*)obj)->FindObjectAny((*ni).c_str()) ; } } } else// if(obj->IsA() == TDirectoryFile::Class()) { file->cd(dir.c_str()) ; //STDLINE("Reading obj",ACGreen); // selectedObjects[dir].push_back(gDirectory->GetKey(wItem->text(0).toStdString().c_str())->ReadObj()); selectedObjects[dir].push_back(gDirectory->Get(wItem->text(0).toStdString().c_str())); //STDLINE(gDirectory->Get(wItem->text(0).toStdString().c_str()),ACGreen); // // STDLINE("done Reading dir",ACRed); if(selectedObjects[dir].back()->IsA() == TDirectoryFile::Class()) { for(int i=0; i<wItem->childCount(); ++i) { this->collectItems(wItem->child(i),selectedObjects) ; } } } //else //{ // STDLINE(obj->IsA()->GetImplFileName(),ACYellow); //} } }