static intgen_t subtreelist_parse_cb( void *arg1, jdm_fshandle_t *fshandlep, intgen_t fsfd, xfs_bstat_t *statp, char *name ) { intgen_t cbrval = 0; /* arg1 is used to carry the tail of the subtree path */ char *subpath = ( char * )arg1; /* temporarily terminate the subpath at the next slash */ char *nextslash = strchr( subpath, '/' ); if ( nextslash ) { *nextslash = 0; } /* if the first element of the subpath doesn't match this * directory entry, try the next entry. */ if ( strcmp( subpath, name )) { if ( nextslash ) { *nextslash = '/'; } return 0; } /* it matches, so add ino to list and continue down the path */ cb_add( NULL, fshandlep, fsfd, statp ); if ( nextslash ) { /* if we're not at the end of the path, yet the current * path element is not a directory, complain and abort the * iteration in a way which terminates the application */ if ( ( statp->bs_mode & S_IFMT ) != S_IFDIR ) { *nextslash = '/'; return 2; } /* repair the subpath */ *nextslash = '/'; /* peel the first element of the subpath and recurse */ ( void )diriter( fshandlep, fsfd, statp, subtreelist_parse_cb, ( void * )( nextslash + 1 ), &cbrval, NULL, 0 ); return cbrval; } else { /* we've reached the specified subpath, so if we're * at a directory, recurse down and add all children * to the inomap. */ if ( ( statp->bs_mode & S_IFMT ) != S_IFDIR ) { return 1; } ( void )diriter( fshandlep, fsfd, statp, subtree_descend_cb, NULL, &cbrval, 0, 0 ); return 1; } }
/* ARGSUSED */ static bool_t /* false, used as diriter callback */ supprt_prune( void *arg1, /* ancestors marked as changed? */ jdm_fshandle_t *fshandlep, intgen_t fsfd, xfs_bstat_t *statp, char *name ) { static bool_t cbrval = BOOL_FALSE; intgen_t state; if ( ( statp->bs_mode & S_IFMT ) == S_IFDIR ) { bool_t changed_below = BOOL_FALSE; state = inomap_get_state( cb_inomap_contextp, statp->bs_ino ); if ( state != MAP_DIR_CHANGE && state != MAP_DIR_NOCHNG && state != MAP_DIR_SUPPRT) { /* * if file is now a dir then it has * certainly changed. */ state = MAP_DIR_CHANGE; inomap_set_state( cb_inomap_contextp, statp->bs_ino, state ); } ( void )diriter( fshandlep, fsfd, statp, supprt_prune, (void *)&changed_below, &cbrval, NULL, 0 ); if ( state == MAP_DIR_SUPPRT ) { if ( changed_below == BOOL_FALSE ) { inomap_set_state( cb_inomap_contextp, statp->bs_ino, MAP_DIR_NOCHNG ); cb_dircnt--; /* dump size just changed! */ } else { /* Directory entries back up the hierarchy */ /* to be dumped - as either MAP_DIR_SUPPRT */ /* or as MAP_DIR_CHANGE in inode state map */ *( bool_t * )arg1 = BOOL_TRUE; } } else if ( state == MAP_DIR_CHANGE ) { /* Directory entries back up the hierarchy must get */ /* dumped - as either MAP_DIR_SUPPRT/MAP_DIR_CHANGE */ *( bool_t * )arg1 = BOOL_TRUE; } return cbrval; } if ( *(bool_t *)arg1 == BOOL_TRUE ) { /* shortcut, sibling changed */ return cbrval; } state = inomap_get_state( cb_inomap_contextp, statp->bs_ino ); if ( state != MAP_NDR_CHANGE && state != MAP_NDR_NOCHNG ) { /* * if dir is now a file then it has * certainly changed. */ state = MAP_NDR_CHANGE; inomap_set_state( cb_inomap_contextp, statp->bs_ino, state ); } if ( state == MAP_NDR_CHANGE ) { /* Directory entries back up the hierarchy must get */ /* dumped - as either MAP_DIR_SUPPRT/MAP_DIR_CHANGE */ *( bool_t * )arg1 = BOOL_TRUE; } return cbrval; }
/* * this script takes 2 TStrings as root filenames as a parameters * basic functionality: * loop through all directories (the mass bins) in the root file * -> create difference plots * -> create global plots * -> create 2D diff vs mass plots * -> etc... */ void plotGlobalWeightedEvts_Kpipi(TString input_filename, TString output_filename) { setupBookies(); gROOT->SetStyle("Plain"); gStyle->SetTitleFont(10*13+2,"xyz"); gStyle->SetTitleSize(0.06, "xyz"); gStyle->SetTitleOffset(1.3,"y"); gStyle->SetTitleOffset(1.3,"z"); gStyle->SetLabelFont(10*13+2,"xyz"); gStyle->SetLabelSize(0.06,"xyz"); gStyle->SetLabelOffset(0.009,"xyz"); gStyle->SetPadBottomMargin(0.16); gStyle->SetPadTopMargin(0.16); gStyle->SetPadLeftMargin(0.16); gStyle->SetPadRightMargin(0.16); gStyle->SetOptTitle(0); gStyle->SetOptStat(0); gROOT->ForceStyle(); gStyle->SetFrameFillColor(0); gStyle->SetFrameFillStyle(0); TGaxis::SetMaxDigits(3); //IsPhDStyle = true; int massbins =0; double mass= 0.0, massstart =1000.0, massend=0.0; std::map<std::string, std::pair<double, std::pair<double, double> > > diffbounds; TFile* infile = TFile::Open(input_filename, "READ"); TFile* outfile = new TFile(output_filename, "RECREATE"); outfile->mkdir("global"); TList *dirlist = infile->GetListOfKeys(); massbins = dirlist->GetSize(); infile->cd(); TIter diriter(dirlist); TDirectory *dir; std::cout<< "scanning directories and creating overview canvases..." <<std::endl; while ((dir = (TDirectory *)diriter())) { std::string dirname = dir->GetName(); // check if directory is mass bin dir unsigned int pointpos = dirname.find("."); if(pointpos == 0 || pointpos == dirname.size()) continue; std::string masslow = dirname.substr(0, pointpos+1); std::string masshigh = dirname.substr(pointpos+1); double massstarttemp = atof(masslow.c_str())/1000; double massendtemp = atof(masshigh.c_str())/1000; if((int)(massendtemp - massstarttemp) != massbinwidth) massbinwidth = (int)(massendtemp - massstarttemp); mass = (massstarttemp + massendtemp)/2; if(massstart > massstarttemp) massstart = massstarttemp; if(massend < massendtemp) massend = massendtemp; outfile->cd(); outfile->mkdir(dir->GetName()); infile->cd(dir->GetName()); // make list of MC Histograms TList mclist; TList *histlist = gDirectory->GetListOfKeys(); TIter histiter(histlist); TObject *obj; while ((obj = histiter())) { TString s(obj->GetName()); if(s.EndsWith("MC")) mclist.Add(obj); else if(s.Contains("MC_")) mclist.Add(obj); } make1DOverviewCanvas(infile, outfile, &mclist, dirname); histiter = TIter(&mclist); TH1D *diffhist, *mchist; while ((mchist = (TH1D*)histiter())) { // generate difference histograms std::string hnamemc(mchist->GetName()); // create new string with MC exchanged for Diff std::string hnamediff(hnamemc); int pos = hnamemc.find("MC"); hnamediff.erase(pos, 2); hnamediff.insert(pos, "Diff"); infile->GetObject((std::string(dir->GetName())+"/"+hnamediff).c_str(), diffhist); if (diffhist) { // get diff min max values std::pair<double, std::pair<double, double> > p; bool change =false; double maxdiff = diffhist->GetMaximum(); double maxdifftemp = diffhist->GetMinimum(); if(abs(maxdifftemp) > maxdiff) maxdiff = maxdifftemp; double diffmintemp = diffhist->GetXaxis()->GetXmin(); double diffmaxtemp = diffhist->GetXaxis()->GetXmax(); std::map<std::string, std::pair<double, std::pair<double, double> > >::iterator iter = diffbounds.find( diffhist->GetName()); if (iter != diffbounds.end()) { p.first = iter->second.first; p.second.first = iter->second.second.first; p.second.second = iter->second.second.second; if (iter->second.first < maxdiff) { change = true; p.first = maxdiff; } if (iter->second.second.first > diffmintemp) { change = true; p.second.first = diffmintemp; } if (iter->second.second.second < diffmaxtemp) { change = true; p.second.second = diffmaxtemp; } if (change) { diffbounds[diffhist->GetName()] = p; } } else { p.first = maxdiff; p.second.first = diffmintemp; p.second.second = diffmaxtemp; diffbounds.insert(std::pair<std::string, std::pair<double, std::pair<double, double> > >(diffhist->GetName(), p)); } } } histiter = TIter(&mclist); TH2D *reldiffhist2d, *diffhist2d, *mchist2d, *datahist2d; while ((mchist2d = (TH2D*) histiter())) { // generate difference histograms std::string hnamemc(mchist2d->GetName()); // create new string with MC exchanged for Diff std::string hnamediff(hnamemc); int pos = hnamemc.find("MC"); hnamediff.erase(pos, 2); hnamediff.insert(pos, "Diff"); // create new string with MC exchanged for RelDiff std::string hnamereldiff(hnamemc); hnamereldiff.erase(pos, 2); hnamereldiff.insert(pos, "RelDiff"); // create new string with MC exchanged for Data std::string hnamedata(hnamemc); hnamedata.erase(pos, 2); hnamedata.insert(pos, "Data"); infile->GetObject((std::string(dir->GetName()) + "/" + hnamereldiff).c_str(), reldiffhist2d); infile->GetObject((std::string(dir->GetName()) + "/" + hnamediff).c_str(), diffhist2d); infile->GetObject((std::string(dir->GetName()) + "/" + hnamedata).c_str(), datahist2d); infile->GetObject((std::string(dir->GetName()) + "/" + hnamemc).c_str(), mchist2d); outfile->cd(dir->GetName()); make2DOverviewCanvas(mchist2d, datahist2d, diffhist2d, reldiffhist2d, mass); } } dirlist = infile->GetListOfKeys(); infile->cd(); diriter = TIter(dirlist); std::cout << "creating global histograms and 2D diff vs mass plots..." << std::endl; while ((dir = (TDirectory *) diriter())) { std::string dirname = dir->GetName(); // check if directory is mass bin dir unsigned int pointpos = dirname.find("."); if (pointpos == 0 || pointpos == dirname.size()) continue; infile->cd(dir->GetName()); // make list of MC Histograms TList mclist; TList *histlist = gDirectory->GetListOfKeys(); TIter histiter(histlist); TObject *obj; while ((obj = histiter())) { TString s(obj->GetName()); if (s.EndsWith("MC")) mclist.Add(obj); else if (s.Contains("MC_")) mclist.Add(obj); } histiter = TIter(&mclist); TH1D *hist; TH1D *diffhist, *mchist, *datahist; while ((hist = (TH1D*) histiter())) { // generate difference histograms std::string hnamemc(hist->GetName()); // create new string with MC exchanged for Diff std::string hname(hnamemc); int pos = hnamemc.find("MC"); hname.erase(pos, 2); hname.insert(pos, "Diff"); // create new string with MC exchanged for Data std::string hnamedata(hnamemc); hnamedata.erase(pos, 2); hnamedata.insert(pos, "Data"); // create new string for MC Global Histogram std::string hnamemcglob(hnamemc); hnamemcglob.insert(pos + 2, "Global"); // create new string for MC Global Histogram std::string hnamedataglob(hnamemc); hnamedataglob.erase(pos, 2); hnamedataglob.insert(pos, "DataGlobal"); infile->GetObject((std::string(dir->GetName()) + "/" + hname + ";1").c_str(), diffhist); infile->GetObject((std::string(dir->GetName()) + "/" + hnamedata + ";1").c_str(), datahist); infile->GetObject((std::string(dir->GetName()) + "/" + hnamemc + ";1").c_str(), mchist); if (datahist) { // make global histograms in global folder outfile->cd("global"); TH1D* hmcglob = (TH1D*) outfile->Get(std::string("global/"+hnamemcglob).c_str()); if (hmcglob == NULL) hmcglob = new TH1D(hnamemcglob.c_str(), mchist->GetTitle(), mchist->GetNbinsX(), mchist->GetXaxis()->GetXmin(), mchist->GetXaxis()->GetXmax()); hmcglob->Add(mchist); TH1D* hdataglob = (TH1D*) outfile->Get(std::string("global/"+hnamedataglob).c_str()); if (hdataglob == NULL) hdataglob = new TH1D(hnamedataglob.c_str(), datahist->GetTitle(), datahist->GetNbinsX(), datahist->GetXaxis()->GetXmin(), datahist->GetXaxis()->GetXmax()); hdataglob->Add(datahist); // make diff vs. mass plots fillDiffvsMassPlot(diffhist, dir->GetName(), massbins, massstart, massend, diffbounds, outfile); } } histiter = TIter(&mclist); TH2D *mchist2d, *datahist2d; while ((mchist2d = (TH2D*) histiter())) { // generate difference histograms std::string hnamemc(mchist2d->GetName()); // create new string with MC exchanged for Diff std::string hnamediff(hnamemc); int pos = hnamemc.find("MC"); hnamediff.erase(pos, 2); hnamediff.insert(pos, "Diff"); // create new string with MC exchanged for Data std::string hnamedata(hnamemc); hnamedata.erase(pos, 2); hnamedata.insert(pos, "Data"); // create new string for MC Global Histogram std::string hnamemcglob(hnamemc); hnamemcglob.insert(pos + 2, "Global"); // create new string for MC Global Histogram std::string hnamedataglob(hnamemc); hnamedataglob.erase(pos, 2); hnamedataglob.insert(pos, "DataGlobal"); infile->GetObject((std::string(dir->GetName()) + "/" + hnamedata + ";1").c_str(), datahist2d); infile->GetObject((std::string(dir->GetName()) + "/" + hnamemc + ";1").c_str(), mchist2d); if (datahist2d) { // make global histograms in global folder outfile->cd("global"); TH2D* hmcglob = (TH2D*) outfile->Get(std::string("global/" + hnamemcglob).c_str()); if (hmcglob == NULL) { hmcglob = new TH2D(hnamemcglob.c_str(), mchist2d->GetTitle(), mchist->GetNbinsX(), mchist2d->GetXaxis()->GetXmin(), mchist2d->GetXaxis()->GetXmax(), mchist2d->GetNbinsY(), mchist2d->GetYaxis()->GetXmin(), mchist2d->GetYaxis()->GetXmax()); hmcglob->SetXTitle(mchist2d->GetXaxis()->GetTitle()); hmcglob->SetYTitle(mchist2d->GetYaxis()->GetTitle()); } hmcglob->Add(mchist2d); TH2D* hdataglob = (TH2D*) outfile->Get(std::string("global/" + hnamedataglob).c_str()); if (hdataglob == NULL) { hdataglob = new TH2D(hnamedataglob.c_str(), datahist2d->GetTitle(), datahist2d->GetNbinsX(), datahist2d->GetXaxis()->GetXmin(), datahist2d->GetXaxis()->GetXmax(), datahist2d->GetNbinsY(), datahist2d->GetYaxis()->GetXmin(), datahist2d->GetYaxis()->GetXmax()); hdataglob->SetXTitle(datahist2d->GetXaxis()->GetTitle()); hdataglob->SetYTitle(datahist2d->GetYaxis()->GetTitle()); } hdataglob->Add(datahist2d); } } } makeBookies(); std::cout<< "saving to disk..." <<std::endl; outfile->Write(); std::cout<< "done!" <<std::endl; /*// ok lets make a canvas and plug some plots into it -> add to booky TCanvas* c = new TCanvas("KineValidate" + massbin, "Weighted Events", 10, 10, 600, 800); c->Divide(4, 4); // first column contains neutral isobar histograms c->cd(1); double totMC = GJHB_neutral_isobar.isobar_mass[0]->Integral(); double totDATA = GJHB_neutral_isobar.isobar_mass[1]->Integral(); if (totMC != 0) GJHB_neutral_isobar.isobar_mass[0]->Scale(totDATA / totMC); GJHB_neutral_isobar.isobar_mass[0]->SetLineColor(kRed); GJHB_neutral_isobar.isobar_mass[0]->SetFillColor(kRed); GJHB_neutral_isobar.isobar_mass[0]->Draw("E4"); TH1D* hDiffMIsobar = new TH1D(*GJHB_neutral_isobar.isobar_mass[0]); hDiffMIsobar->Add(GJHB_neutral_isobar.isobar_mass[1], -1.); GJHB_neutral_isobar.isobar_mass[1]->Draw("same"); hDiffMIsobar->SetLineColor(kOrange - 3); hDiffMIsobar->Draw("same"); GJHB_neutral_isobar.isobar_mass[0]->GetYaxis()->SetRangeUser(hDiffMIsobar->GetMinimum() * 1.5, GJHB_neutral_isobar.isobar_mass[0]->GetMaximum() * 1.2); gPad->Update(); c->cd(5); totMC = GJHB_neutral_isobar.costheta_GJF[0]->Integral(); totDATA = GJHB_neutral_isobar.costheta_GJF[1]->Integral(); if (totMC != 0) GJHB_neutral_isobar.costheta_GJF[0]->Scale(totDATA / totMC); GJHB_neutral_isobar.costheta_GJF[0]->SetLineColor(kRed); GJHB_neutral_isobar.costheta_GJF[0]->SetFillColor(kRed); GJHB_neutral_isobar.costheta_GJF[0]->Draw("E4"); GJHB_neutral_isobar.costheta_GJF[1]->Draw("same E"); totMC = GJHB_neutral_isobar.costheta_GJF_MC_raw->Integral(); GJHB_neutral_isobar.costheta_GJF_MC_raw->Scale(totDATA / totMC); GJHB_neutral_isobar.costheta_GJF_MC_raw->Draw("same"); GJHB_neutral_isobar.costheta_GJF[0]->GetYaxis()->SetRangeUser(0, GJHB_neutral_isobar.costheta_GJF[0]->GetMaximum() * 1.5); gPad->Update(); c->cd(9); totMC = GJHB_neutral_isobar.phi_GJF[0]->Integral(); totDATA = GJHB_neutral_isobar.phi_GJF[1]->Integral(); GJHB_neutral_isobar.phi_GJF[0]->Sumw2(); if (totMC != 0) GJHB_neutral_isobar.phi_GJF[0]->Scale(totDATA / totMC); GJHB_neutral_isobar.phi_GJF[0]->SetLineColor(kRed); GJHB_neutral_isobar.phi_GJF[0]->SetFillColor(kRed); GJHB_neutral_isobar.phi_GJF[0]->Draw("E4"); GJHB_neutral_isobar.phi_GJF[1]->Draw("same E"); GJHB_neutral_isobar.phi_GJF[0]->GetYaxis()->SetRangeUser(0, GJHB_neutral_isobar.phi_GJF[0]->GetMaximum() * 1.5); gPad->Update(); c->cd(13); totMC = HHB_neutral_isobar.costheta_HF[0]->Integral(); totDATA = HHB_neutral_isobar.costheta_HF[1]->Integral(); HHB_neutral_isobar.costheta_HF[0]->Sumw2(); if (totMC != 0) HHB_neutral_isobar.costheta_HF[0]->Scale(totDATA / totMC); HHB_neutral_isobar.costheta_HF[0]->SetLineColor(kRed); HHB_neutral_isobar.costheta_HF[0]->SetFillColor(kRed); HHB_neutral_isobar.costheta_HF[0]->Draw("E4"); HHB_neutral_isobar.costheta_HF[1]->Draw("same E"); HHB_neutral_isobar.costheta_HF[0]->GetYaxis()->SetRangeUser(0, HHB_neutral_isobar.costheta_HF[0]->GetMaximum() * 1.5); gPad->Update(); c->cd(15); totMC = HHB_neutral_isobar.phi_HF[0]->Integral(); totDATA = HHB_neutral_isobar.phi_HF[1]->Integral(); HHB_neutral_isobar.phi_HF[0]->Sumw2(); if (totMC != 0) HHB_neutral_isobar.phi_HF[0]->Scale(totDATA / totMC); HHB_neutral_isobar.phi_HF[0]->SetLineColor(kRed); HHB_neutral_isobar.phi_HF[0]->SetFillColor(kRed); HHB_neutral_isobar.phi_HF[0]->Draw("E4"); HHB_neutral_isobar.phi_HF[1]->Draw("same E"); HHB_neutral_isobar.phi_HF[0]->GetYaxis()->SetRangeUser(0, HHB_neutral_isobar.phi_HF[0]->GetMaximum() * 1.5); gPad->Update(); c->cd(2); totMC = GJHB_charged_isobar.isobar_mass[0]->Integral(); totDATA = GJHB_charged_isobar.isobar_mass[1]->Integral(); if (totMC != 0) GJHB_charged_isobar.isobar_mass[0]->Scale(totDATA / totMC); GJHB_charged_isobar.isobar_mass[0]->SetLineColor(kRed); GJHB_charged_isobar.isobar_mass[0]->SetFillColor(kRed); GJHB_charged_isobar.isobar_mass[0]->Draw("E4"); TH1D* hDiffMIsobar2 = new TH1D(*GJHB_charged_isobar.isobar_mass[0]); hDiffMIsobar2->Add(GJHB_charged_isobar.isobar_mass[1], -1.); GJHB_charged_isobar.isobar_mass[1]->Draw("same"); hDiffMIsobar2->SetLineColor(kOrange - 3); hDiffMIsobar2->Draw("same"); GJHB_charged_isobar.isobar_mass[0]->GetYaxis()->SetRangeUser(hDiffMIsobar->GetMinimum() * 1.5, GJHB_charged_isobar.isobar_mass[0]->GetMaximum() * 1.2); gPad->Update(); c->cd(6); totMC = GJHB_charged_isobar.costheta_GJF[0]->Integral(); totDATA = GJHB_charged_isobar.costheta_GJF[1]->Integral(); //hGJ[0]->Sumw2(); if (totMC != 0) GJHB_charged_isobar.costheta_GJF[0]->Scale(totDATA / totMC); GJHB_charged_isobar.costheta_GJF[0]->SetLineColor(kRed); GJHB_charged_isobar.costheta_GJF[0]->SetFillColor(kRed); GJHB_charged_isobar.costheta_GJF[0]->Draw("E4"); GJHB_charged_isobar.costheta_GJF[1]->Draw("same E"); totMC = GJHB_charged_isobar.costheta_GJF_MC_raw->Integral(); GJHB_charged_isobar.costheta_GJF_MC_raw->Scale(totDATA / totMC); GJHB_charged_isobar.costheta_GJF_MC_raw->Draw("same"); GJHB_charged_isobar.costheta_GJF[0]->GetYaxis()->SetRangeUser(0, GJHB_charged_isobar.costheta_GJF[0]->GetMaximum() * 1.5); gPad->Update(); c->cd(10); totMC = GJHB_charged_isobar.phi_GJF[0]->Integral(); totDATA = GJHB_charged_isobar.phi_GJF[1]->Integral(); GJHB_charged_isobar.phi_GJF[0]->Sumw2(); if (totMC != 0) GJHB_charged_isobar.phi_GJF[0]->Scale(totDATA / totMC); GJHB_charged_isobar.phi_GJF[0]->SetLineColor(kRed); GJHB_charged_isobar.phi_GJF[0]->SetFillColor(kRed); GJHB_charged_isobar.phi_GJF[0]->Draw("E4"); GJHB_charged_isobar.phi_GJF[1]->Draw("same E"); GJHB_charged_isobar.phi_GJF[0]->GetYaxis()->SetRangeUser(0, GJHB_charged_isobar.phi_GJF[0]->GetMaximum() * 1.5); gPad->Update(); c->cd(14); totMC = HHB_charged_isobar.costheta_HF[0]->Integral(); totDATA = HHB_charged_isobar.costheta_HF[1]->Integral(); HHB_charged_isobar.costheta_HF[0]->Sumw2(); if (totMC != 0) HHB_charged_isobar.costheta_HF[0]->Scale(totDATA / totMC); HHB_charged_isobar.costheta_HF[0]->SetLineColor(kRed); HHB_charged_isobar.costheta_HF[0]->SetFillColor(kRed); HHB_charged_isobar.costheta_HF[0]->Draw("E4"); HHB_charged_isobar.costheta_HF[1]->Draw("same E"); HHB_charged_isobar.costheta_HF[0]->GetYaxis()->SetRangeUser(0, HHB_charged_isobar.costheta_HF[0]->GetMaximum() * 1.5); gPad->Update(); c->cd(16); totMC = HHB_charged_isobar.phi_HF[0]->Integral(); totDATA = HHB_charged_isobar.phi_HF[1]->Integral(); HHB_charged_isobar.phi_HF[0]->Sumw2(); if (totMC != 0) HHB_charged_isobar.phi_HF[0]->Scale(totDATA / totMC); HHB_charged_isobar.phi_HF[0]->SetLineColor(kRed); HHB_charged_isobar.phi_HF[0]->SetFillColor(kRed); HHB_charged_isobar.phi_HF[0]->Draw("E4"); HHB_charged_isobar.phi_HF[1]->Draw("same E"); HHB_charged_isobar.phi_HF[0]->GetYaxis()->SetRangeUser(0, HHB_charged_isobar.phi_HF[0]->GetMaximum() * 1.5); gPad->Update(); // add global diagrams c->cd(1); TLatex* Label = new TLatex(); Label->PaintLatex(2, GJHB_neutral_isobar.isobar_mass[0]->GetMaximum() * 0.8, 0, 0.1, massbin.Data()); c->Update(); TList* Hlist = gDirectory->GetList(); Hlist->Remove(mctr); Hlist->Remove(datatr); //Hlist->Remove("hWeights"); TFile* outfile = TFile::Open(outfilename, "UPDATE"); TString psFileName = outfilename; psFileName.ReplaceAll(".root", massbin); psFileName.Append(".ps"); if (totMC != 0) { // get mass-integrated plots (or create them if not there) // neutral isobar TH1D* hMIsobarMCGlob = (TH1D*) outfile->Get("hMIsobarMCGlob"); if (hMIsobarMCGlob == NULL) hMIsobarMCGlob = new TH1D("hMIsobarMCGlob", "2#pi neutral Isobar Mass (MC)", nbninsm, 0.2, 2.5); hMIsobarMCGlob->Add(GJHB_neutral_isobar.isobar_mass[0]); hMIsobarMCGlob->Write(); TH1D* hMIsobarDataGlob = (TH1D*) outfile->Get("hMIsobarDataGlob"); if (hMIsobarDataGlob == NULL) hMIsobarDataGlob = new TH1D("hMIsobarDataGlob", "2#pi neutral Isobar Mass (DATA)", nbninsm, 0.2, 2.5); hMIsobarDataGlob->Add(GJHB_neutral_isobar.isobar_mass[1]); hMIsobarDataGlob->Write(); TH1D* hGJMCGlob = (TH1D*) outfile->Get("hGJMCGlob"); if (hGJMCGlob == NULL) hGJMCGlob = new TH1D("hGJMCGlob", "Gottfried-Jackson Theta (MC)", nbinsang, -1, 1); hGJMCGlob->Add(GJHB_neutral_isobar.costheta_GJF[0]); hGJMCGlob->Write(); TH1D* hGJDataGlob = (TH1D*) outfile->Get("hGJDataGlob"); if (hGJDataGlob == NULL) hGJDataGlob = new TH1D("hGJDataGlob", "Gottfried-Jackson Theta (Data)", nbinsang, -1, 1); hGJDataGlob->Add(GJHB_neutral_isobar.costheta_GJF[1]); hGJDataGlob->Write(); TH1D* hTYMCGlob = (TH1D*) outfile->Get("hTYMCGlob"); if (hTYMCGlob == NULL) hTYMCGlob = new TH1D("hTYMCGlob", "Treiman-Yang Phi (MC)", nbinsang, -TMath::Pi(),TMath::Pi()); hTYMCGlob->Add(GJHB_neutral_isobar.phi_GJF[0]); hTYMCGlob->Write(); TH1D* hTYDataGlob = (TH1D*) outfile->Get("hTYDataGlob"); if (hTYDataGlob == NULL) hTYDataGlob = new TH1D("hTYDataGlob", "Treiman-Yang Phi (Data)", nbinsang, -TMath::Pi(),TMath::Pi()); hTYDataGlob->Add(GJHB_neutral_isobar.phi_GJF[1]); hTYDataGlob->Write(); c->cd(3); hMIsobarMCGlob->SetLineColor(kRed); hMIsobarMCGlob->SetFillColor(kRed); hMIsobarMCGlob->Draw("E4"); hMIsobarDataGlob->Draw("E SAME"); c->cd(7); hGJMCGlob->SetLineColor(kRed); hGJMCGlob->SetFillColor(kRed); hGJMCGlob->Draw("E4"); hGJDataGlob->Draw("E SAME"); c->cd(11); hTYMCGlob->SetLineColor(kRed); hTYMCGlob->SetFillColor(kRed); hTYMCGlob->Draw("E4"); hTYDataGlob->Draw("E SAME"); // charged isobar TH1D* hMIsobarMCGlob2 = (TH1D*) outfile->Get("hMIsobarMCGlob2"); if (hMIsobarMCGlob2 == NULL) hMIsobarMCGlob2 = new TH1D("hMIsobarMCGlob2", "2#pi charged Isobar Mass (MC)", nbninsm, 0.2, 2.5); hMIsobarMCGlob2->Add(GJHB_charged_isobar.isobar_mass[0]); hMIsobarMCGlob2->Write(); TH1D* hMIsobarDataGlob2 = (TH1D*) outfile->Get("hMIsobarDataGlob2"); if (hMIsobarDataGlob2 == NULL) hMIsobarDataGlob2 = new TH1D("hMIsobarDataGlob2", "2#pi charged Isobar mass (DATA)", nbninsm, 0.2, 2.5); hMIsobarDataGlob2->Add(GJHB_charged_isobar.isobar_mass[1]); hMIsobarDataGlob2->Write(); TH1D* hGJMCGlob2 = (TH1D*) outfile->Get("hGJMCGlob2"); if (hGJMCGlob2 == NULL) hGJMCGlob2 = new TH1D("hGJMCGlob2", "Gottfried-Jackson Theta (MC)", nbinsang, -1, 1); hGJMCGlob2->Add(GJHB_charged_isobar.costheta_GJF[0]); hGJMCGlob2->Write(); TH1D* hGJDataGlob2 = (TH1D*) outfile->Get("hGJDataGlob2"); if (hGJDataGlob2 == NULL) hGJDataGlob2 = new TH1D("hGJDataGlob2", "Gottfried-Jackson Theta (Data)", nbinsang, -1, 1); hGJDataGlob2->Add(GJHB_charged_isobar.costheta_GJF[1]); hGJDataGlob2->Write(); TH1D* hTYMCGlob2 = (TH1D*) outfile->Get("hTYMCGlob2"); if (hTYMCGlob2 == NULL) hTYMCGlob2 = new TH1D("hTYMCGlob2", "Treiman-Yang Phi (MC)", nbinsang, -TMath::Pi(),TMath::Pi()); hTYMCGlob2->Add(GJHB_charged_isobar.phi_GJF[0]); hTYMCGlob2->Write(); TH1D* hTYDataGlob2 = (TH1D*) outfile->Get("hTYDataGlob2"); if (hTYDataGlob2 == NULL) hTYDataGlob2 = new TH1D("hTYDataGlob2", "Treiman-Yang Phi (Data)", nbinsang, -TMath::Pi(),TMath::Pi()); hTYDataGlob2->Add(GJHB_charged_isobar.phi_GJF[1]); hTYDataGlob2->Write(); c->cd(4); hMIsobarMCGlob2->SetLineColor(kRed); hMIsobarMCGlob2->SetFillColor(kRed); hMIsobarMCGlob2->Draw("E4"); hMIsobarDataGlob2->Draw("E SAME"); c->cd(8); hGJMCGlob2->SetLineColor(kRed); hGJMCGlob2->SetFillColor(kRed); hGJMCGlob2->Draw("E4"); hGJDataGlob2->Draw("E SAME"); c->cd(12); hTYMCGlob2->SetLineColor(kRed); hTYMCGlob2->SetFillColor(kRed); hTYMCGlob2->Draw("E4"); hTYDataGlob2->Draw("E SAME"); } c->Write(); TCanvas dummyCanv("dummy", "dummy"); c->Print((psFileName));*/ }