本文整理汇总了C++中TFile::GetDirectory方法的典型用法代码示例。如果您正苦于以下问题:C++ TFile::GetDirectory方法的具体用法?C++ TFile::GetDirectory怎么用?C++ TFile::GetDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TFile
的用法示例。
在下文中一共展示了TFile::GetDirectory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: store
void store(){
if (!TClass::GetDict("NBD")) {
gROOT->ProcessLine(".L /afs/cern.ch/user/q/qixu/CMSSW_6_2_5/src/Centrality/NBD_Glauber_fit/NBD/NBDclass.C+");
}
TH1::AddDirectory(kFALSE);
int Gth=atoi(getenv("GTH"));
int sth=atoi(getenv("STH"));
NBD *l;
struct para1 var;
if(sth==0){TString dirname = "std"; var = var1; if(Gth<nGlau) l = new NBD(datafile,stdGlaulist[Gth],histoname);else l = new NBD(datafile,stdGlaulist[0],histoname);}
else if(sth==1){TString dirname ="Gri055"; var = var2; if(Gth<nGlau) l = new NBD(datafile,Gri055Glaulist[Gth],histoname);else l = new NBD(datafile,Gri055Glaulist[0],histoname);}
else {TString dirname ="Gri101"; var = var3; if(Gth<nGlau) l = new NBD(datafile,Gri101Glaulist[Gth],histoname);else l = new NBD(datafile,Gri101Glaulist[0],histoname);}
l->initmu(var.mumin,var.mumax,var.mustep);
l->initk(var.kmin,var.kmax,var.kstep);
if(Gth<nGlau)
l->initx(var.xmin,var.xmax);
else if(Gth-nGlau==0)
l->initx(var.xmin-binshift,var.xmax);
else
l->initx(var.xmin+binshift,var.xmax);
// l->fit();
if(sth==0) l->assign(bestlist1[Gth].mubest,bestlist1[Gth].kbest);
else if(sth==1) l->assign(bestlist2[Gth].mubest,bestlist2[Gth].kbest);
else l->assign(bestlist3[Gth].mubest,bestlist3[Gth].kbest);
l->initN(bin,N,method);
l->calcvar();
TFile *outfile = new TFile(outG,"Update");
if(Gth==0 && sth==0){
l->dataname.Write("dataname",TObject::kOverwrite);
l->histoname.Write("histoname",TObject::kOverwrite);
}
TDirectory *dir = outfile->GetDirectory(dirname);
if (!dir) {outfile->mkdir(dirname); TDirectory *dir = outfile->GetDirectory(dirname);}
dir->cd();
TString name;
if(Gth==0)
name = "G0";
else if(Gth<nGlau)
name = Form("Glau_%d",Gth);
else
name = Form("bin_%d",Gth-nGlau+1);
TDirectory *subdir = dir->GetDirectory(name);
if(!subdir) {dir->mkdir(name); TDirectory *subdir = dir->GetDirectory(name);}
subdir->cd();
l->method.Write("method",TObject::kOverwrite);
l->Glaubername.Write("Glaubername",TObject::kOverwrite);
l->xmin.Write("xmin",TObject::kOverwrite);l->xmax.Write("xmax",TObject::kOverwrite);
l->mubest.Write("mubest",TObject::kOverwrite);l->kbest.Write("kbest",TObject::kOverwrite);
l->chis.Write("chis",TObject::kOverwrite);l->Ndf.Write("Ndf",TObject::kOverwrite);
l->NcollAver.Write("NcollAver",TObject::kOverwrite);l->NpartAver.Write("NpartAver",TObject::kOverwrite);l->BAver.Write("BAver",TObject::kOverwrite);
l->centbin.Write("centbin",TObject::kOverwrite); l->kpoint.Write("kpoint",TObject::kOverwrite);
l->centbin_.Write("centbin_",TObject::kOverwrite); l->kpoint_.Write("kpoint_",TObject::kOverwrite);
l->Npartdis->Write();
l->Grgrid->Write("Grgrid",TObject::kOverwrite);
outfile->Close();
}
示例2: compareHistos
void compareHistos( char *Current, char *Reference=0 ) {
TText* te = new TText();
te->SetTextSize(0.1);
TFile * curfile = new TFile( TString(Current)+".root" );
TFile * reffile = curfile;
if (Reference) reffile = new TFile(TString(Reference)+".root");
char * prefix="DQMData/MixingV/Mixing";
//1-Dimension Histogram
TDirectory * refDir=reffile->GetDirectory(prefix);
TDirectory * curDir=curfile->GetDirectory(prefix);
TList* list = refDir->GetListOfKeys();
TObject* object = list->First();
int iHisto = 0;
char title[50];
while (object) {
// find histo objects
std::cout << " object :" << object->GetName() << std::endl;
TProfile * h1 = dynamic_cast<TProfile*>( refDir->Get(object->GetName()));
TProfile * h2 = dynamic_cast<TProfile*>( curDir->Get(object->GetName()));
bool isHisto = (refDir->Get(object->GetName()))->InheritsFrom("TProfile");
std::cout << " isHisto = " << isHisto << std::endl;
if (isHisto && h1 && h2 && *h1->GetName()== *h2->GetName()) {
iHisto++;
char title[50];
// draw and compare
std::cout << " Start draw and compare" << std::endl;
TCanvas c1;
TProfile htemp2;
h2->Copy(htemp2);// to keep 2 distinct histos
h1->SetLineColor(2);
htemp2.SetLineColor(3);
h1->SetLineStyle(3);
h1->SetMarkerColor(3);
htemp2.SetLineStyle(5);
htemp2.SetMarkerColor(5);
TLegend leg(0.1, 0.15, 0.2, 0.25);
leg.AddEntry(h1, "Reference", "l");
leg.AddEntry(&htemp2, "New ", "l");
h1->Draw();
htemp2.Draw("Same");
leg.Draw();
sprintf(title,"%s%s", object->GetName(),".gif");
c1.Print(title);
}
// go to next object
object = list->After(object);
}
}
示例3: DoCompare
void DoCompare( char *Current, char *Reference=0 ){
TText* te = new TText();
te->SetTextSize(0.1);
gROOT->ProcessLine(".x HistoCompare.C");
HistoCompare * myPV = new HistoCompare();
TFile * curfile = new TFile( TString(Current)+".root" );
TFile * reffile = curfile;
if (Reference) reffile = new TFile(TString(Reference)+".root");
char * prefix="DQMData/MixingV/";
//1-Dimension Histogram
TDirectory * refDir=reffile->GetDirectory(prefix);
TDirectory * curDir=curfile->GetDirectory(prefix);
TList* list = refDir->GetListOfKeys();
TObject* object = list->First();
int iHisto = 0; char title[50];
while (object) {
// find histo objects
TH1F * h1 = dynamic_cast<TH1F*>( refDir->Get(object->GetName()));
TH1F * h2 = dynamic_cast<TH1F*>( curDir->Get(object->GetName()));
bool isHisto = (refDir->Get(object->GetName()))->InheritsFrom("TH1F");
if (isHisto && h1 && h2 && *h1->GetName()== *h2->GetName()) {
iHisto++;
char title[50];
// draw and compare
TCanvas c1;
TH1F htemp2;
h2->Copy(htemp2);// to keep 2 distinct histos
h1->SetLineColor(2);
htemp2.SetLineColor(3);
h1->SetLineStyle(3);
htemp2.SetLineStyle(5);
TLegend leg(0.1, 0.15, 0.2, 0.25);
leg.AddEntry(h1, "Reference", "l");
leg.AddEntry(&htemp2, "New ", "l");
h1->Draw();
htemp2.Draw("Same");
leg.Draw();
myPV->PVCompute(h1,&htemp2, te);
sprintf(title,"%s%s", object->GetName(),".eps");
c1.Print(title);
}
// go to next object
object = list->After(object);
}
}
示例4: writeObjsInFolder
void FileSaver::writeObjsInFolder(string folder, bool recreate)
{
cout<<"*** Updating "<<filename.c_str()<<" file in "<< folder << endl;
TFile * fileFinalPlots;
if(recreate) fileFinalPlots=TFile::Open(filename.c_str(), "RECREATE");
else fileFinalPlots=TFile::Open(filename.c_str(), "UPDATE");
if (!fileFinalPlots->GetDirectory(folder.c_str()))
fileFinalPlots->mkdir(folder.c_str());
fileFinalPlots->cd (folder.c_str());
cout<<"vrce: "<<fArr->At(0)<<endl;
if(fArr->At(0)){
cout<<fArr->At(0)->GetName()<<endl;
for (int i = 0; i <= fArr->GetLast(); i++){
cout<<fArr->At(i)<<" "<<fArr->At(i)->GetName()<<endl;
fArr->At(i)->Write(fArr->At(i)->GetName(),2);
cout<<"Object saved ..."<<endl;
}
}
fileFinalPlots->Flush();
fileFinalPlots->Write();
fileFinalPlots->Close();
fArr->Clear();
return;
}
示例5: create_module_info
void create_module_info(TString dir = "/castor/cern.ch/user/r/rougny/vcalH2L_7/GainRun_173484"){
ofstream t;
t.open("module_info.txt");
if(! t.is_open()){
cout << "[create_module_info] Could not open output txt file. Exiting ..." << endl;
exit(1);
}
for(int i=0 ; i<40 ; ++i){
ostringstream f_str("");
f_str << "rfio://" << dir << "/" << i << ".root";
cout << "Opening file : " << f_str.str() << endl;
TFile* f = TFile::Open(f_str.str().c_str() , "READ");
vector<TString> dir_list = makedirlist(f , "Module");
for(int m = 0 ; m < dir_list.size() ; ++m){
TDirectory* dir = f->GetDirectory(dir_list[m]);
int detid = getDetId(((TH1*) dir->Get(((TKey*) dir->GetListOfKeys()->At(0))->GetName()))->GetName());
t << detid << " " << i << " " << dir_list[m].Remove(0,dir_list[m].First('y')+2) << endl;
}
f->Close();
}
t.close();
}
示例6: FitOmega_OneTarget
void FitOmega_OneTarget(char *rootFile, char* fDir="ReconCuts", Int_t iRun=0, Int_t iTgt=0, Int_t iCut=0, Int_t iFit=3, Int_t iClose=1)
{
Int_t i;
Float_t yield;
TH1D *hist; // original histogram
char hname[50];
char plotFilePrefix[100];
// data files contain the trees
printf("Analyzing file %s\n",rootFile);
TFile *fd = new TFile(rootFile,"READ"); // open up the ROOT file
TDirectory *tmp = fd->GetDirectory(fDir);
sprintf(hname,"%s",HistName[iCut]);
cout << hname << endl;
hist = (TH1D*)tmp->Get(hname); // get the histogram from the ROOT file
sprintf(plotFilePrefix,"FitOmega_%s_%s",RunName[iRun],hname);
yield = FitOmega(hist,plotFilePrefix);//, iFit, iClose);
// open text file for the yields
char OutFile[100];
sprintf(OutFile,"%s.yld",plotFilePrefix);
ofstream fout(OutFile);
fout<<RunName[iRun]<<"\t"<<TgtName[iTgt]<<"\t"<<yield<<"\t"<<sqrt(yield)<<endl;
fout.close(); // close the text file
// fd->Close(); // close ROOT file
}
示例7: next
std::pair<TH3F*,TH3F*> getEffHists(const char *file, const char *dirC,
const char *histN, const char *histD){
TFile *efile = new TFile(file,"read");
TDirectoryFile *efileDIR = (TDirectoryFile*) efile->GetDirectory(dirC);
TIter next(efileDIR->GetListOfKeys());
TKey *key;
Char_t name[100];
TH3F *hpneff3d=0;
TH3F *hpdeff3d=0;
while ((key=(TKey*)next())) {
sprintf(name,"%s",key->GetName());
if(strcmp((key->GetName()),(histN))==0){
//cout<<"[getEffHists] Your numerator for Eff "<<name<<endl;
hpneff3d = (TH3F*) efileDIR->Get(name);
}
if(strcmp((key->GetName()),(histD))==0){
//cout<<"[getEffHists] Your denominator for Eff "<<name<<endl;
hpdeff3d = (TH3F*) efileDIR->Get(name);
}
}
//efileDIR->Close();
//efile->Close();
return std::pair<TH3F*,TH3F*>(hpneff3d,hpdeff3d);
}
示例8: produceEnergyHistos
int produceEnergyHistos(CSPrereqs& csp)
{
cout << endl << "Mapping " << csp.name << " TOF histogram to energy domain..." << endl;
// open input file
TFile* inputFile = new TFile(inputFileName.c_str(),"READ");
if(!inputFile->IsOpen())
{
cerr << "Error: failed to open " << inputFileName << " to fill histos." << endl;
return 1;
}
// create output file
TFile* outputFile = new TFile(outputFileName.c_str(),"RECREATE");
for(auto& channelName : config.cs.DETECTOR_NAMES)
{
TDirectory* detectorDirectory = inputFile->GetDirectory(channelName.c_str());
if(!detectorDirectory)
{
cerr << "Error: failed to find " << channelName << " directory in " << inputFileName << "." << endl;
return 1;
}
TDirectory* outputDirectory = outputFile->mkdir(channelName.c_str(),channelName.c_str());
// find TOF histograms in input file
for(int i=0; i<config.target.TARGET_ORDER.size(); i++)
{
string targetName = config.target.TARGET_ORDER[i];
string TOFHistoName = targetName + "TOFCorrected";
detectorDirectory->cd();
TH1D* TOF = (TH1D*)detectorDirectory->Get(TOFHistoName.c_str());
if(!TOF)
{
cerr << "Error: failed to open " << TOFHistoName << " in " << inputFileName << endl;
return 1;
}
outputDirectory->cd();
TH1D* correctedEnergy = convertTOFtoEnergy(TOF, targetName + "Energy");
TOF->Write();
correctedEnergy->Write();
}
}
outputFile->Close();
inputFile->Close();
return 0;
}
示例9: write_histograms
void Histogrammer::write_histograms(std::string folderS, std::vector<TH1F*> histVector){
TFile* outFile = new TFile((folderS+"/hist_"+title+".root").c_str(), "RECREATE");
for( std::map< std::string, TH1F* >::iterator it = hists.begin(); it != hists.end(); ++it){
it->second->SetDirectory(outFile->GetDirectory(""));
it->second->Write();
it->second->SetDirectory(0);
}
for( std::vector<TH1F*>::iterator it = histVector.begin(); it != histVector.end(); ++it){
(*it)->SetDirectory(outFile->GetDirectory(""));
(*it)->Write();
(*it)->SetDirectory(0);
}
for( std::map< std::string, TH2F* >::iterator it = hists2d.begin(); it != hists2d.end(); ++it){
it->second->SetDirectory(outFile->GetDirectory(""));
it->second->Write();
it->second->SetDirectory(0);
}
outFile->Close();
}
示例10: CompareCFLADiffCuts
void CompareCFLADiffCuts()
{
TFile newFile("~/Analysis/lambda/AliAnalysisLambda/Results/2016-01/15-NoOppChargeCut/All/CFs.root");
TDirectory *newDir = newFile.GetDirectory("Merged");
vector<TH1D*> newCFs;
newCFs.push_back((TH1D*)newDir->Get("CFLamALam010"));
newCFs.push_back((TH1D*)newDir->Get("CFLamALam1030"));
newCFs.push_back((TH1D*)newDir->Get("CFLamALam3050"));
TFile oldFile("~/Analysis/lambda/AliAnalysisLambda/Results/2016-01/08-NewAvgSepCuts/All/CFs.root");
TDirectory *oldDir = oldFile.GetDirectory("Merged");
vector<TH1D*> oldCFs;
oldCFs.push_back((TH1D*)oldDir->Get("CFLamALam010"));
oldCFs.push_back((TH1D*)oldDir->Get("CFLamALam1030"));
oldCFs.push_back((TH1D*)oldDir->Get("CFLamALam3050"));
TFile *compareFile = new TFile("Compare.root","update");
TDirectory *dir = compareFile->GetDirectory("Delta");
if(!dir) dir = compareFile->mkdir("Delta");
for(UInt_t i = 0; i < newCFs.size(); i++) {
// TH1D *ratio = (TH1D*)newCFs[i]->Clone();
// TString name = ratio->GetName();
// ratio->SetName(name + "Ratio");
// ratio->SetTitle(name + "Ratio");
// ratio->Divide(oldCFs[i]);
// TH1D *barlowRatio = ComputeRogerBarlowRatio(newCFs[i], oldCFs[i]);
// barlowRatio->SetName(name + "BarlowRatio");
// barlowRatio->SetTitle(name + "BarlowRatio");
TString name = newCFs[i]->GetName();
TH1D *barlowDifference = ComputeRogerBarlowDifference(newCFs[i], oldCFs[i]);
barlowDifference->SetName(name + "BarlowDifference");
barlowDifference->SetTitle(name + "BarlowDifference");
dir->cd();
// ratio->Write();
// barlowRatio->Write();
barlowDifference->Write(barlowDifference->GetName(), TObject::kOverwrite);
Chi2TestWithZero(barlowDifference);
FitWithConstant(barlowDifference, compareFile);
// LookAtMean(barlowDifference);
RebinHist(barlowDifference, compareFile);
ManuallyRebin(barlowDifference, compareFile);
}
compareFile->Close();
}
示例11: getSummaries
void CalibrationScanAnalysis::getSummaries(FileList::const_iterator file) {
std::cout << "." << std::flush;
std::vector<TH1*> result;
TFile* input = file->second;
TDirectory* directory = input->GetDirectory(HISTOPATH);
TList* histograms = directory->GetListOfKeys();
TIter next(histograms);
TKey* key = NULL;
while ((key = (TKey*)next())) {
if(TClass(key->GetClassName()).InheritsFrom("TH1")) {
TH1* h = (TH1*)key->ReadObj();
result.push_back(h);
}
}
summaries_[file->first] = result;
}
示例12: OverlayEC_xy_local
//
// OverlayEC_xy_local - overlay histogram of EC x vs y
//
// fAna = output from eg2a DMS
// fDir = ROOT directory
// HistName1 = 1st histogram name
// HistName2 = 2nd histogram name
// target = target name
//
void OverlayEC_xy_local(char *fAna="Ana.root", char *fDir, char *HistName1, char *HistName2, char *target)
{
Int_t i;
TH2D *hist1[6];
TH2D *hist2[6];
// Canvas to plot histogram
TCanvas *c1 = new TCanvas("c1","c1",0,0,1200,800);
c1->SetBorderMode(1); //Bordermode (-1=down, 0 = no border, 1=up)
c1->SetBorderSize(5);
gStyle->SetOptStat(1111);
c1->SetFillStyle(4000);
c1->Divide(3,2);
// data files contain the trees
printf("Analyzing file %s\n",fAna);
TFile *fm = new TFile(fAna,"READ");
TDirectory *tmp = fm->GetDirectory(fDir);
for(i=0; i<NSECTORS; i++){
gPad->SetLeftMargin(Lmar);
gPad->SetRightMargin(Rmar);
gPad->SetFillColor(0);
c1->cd(i+1);
sprintf(hname,"EC_XvsY_local_%s%i",HistName1,i+1);
hist1[i] = (TH2D*)tmp->Get(hname);
sprintf(htitle,"Sector %i, %s",i+1,target);
hist1[i]->SetTitle(htitle);
hist1[i]->GetXaxis()->CenterTitle();
hist1[i]->GetYaxis()->CenterTitle();
hist1[i]->GetYaxis()->SetTitleOffset(yoff);
hist1[i]->Draw("colz");
sprintf(hname,"EC_XvsY_local_%s%i",HistName2,i+1);
hist2[i] = (TH2D*)tmp->Get(hname);
hist2[i]->SetMarkerColor(1);
hist2[i]->Draw("same");
}
sprintf(OutCan,"OL_EC_XvsY_local_%s_VS_%s_%s.gif",HistName1,HistName2,target);
c1->Print(OutCan);
sprintf(OutCan,"OL_EC_XvsY_local_%s_VS_%s_%s.eps",HistName1,HistName2,target);
c1->Print(OutCan);
}
示例13: addAndWeight
void addAndWeight(TString directory, TString plot, TFile& outputfile, double scalingFactor)
{
// get the histograms, erase existing at the beginning
hists_.clear();
loadingHists(directory+"/"+plot);
// normalize to luminosity (and add samples)
combineFiles(scalingFactor);
// define output plot
TH1F* weightedPlot=(TH1F*)hists_[files_.size()]->Clone();
// write output to directory
if(outputfile.GetDirectory(directory)==0){
outputfile.mkdir(directory);
outputfile.cd(directory);
}
weightedPlot->Write(plot);
std::cout << " " << plot;
}
示例14: merge
void merge(){
if (!TClass::GetDict("NBD")) {
gROOT->ProcessLine(".L /afs/cern.ch/user/q/qixu/CMSSW_6_2_5/src/Centrality/NBD_Glauber_fit/NBD/NBDclass.C++");
}
TFile *f;
f=TFile::Open(Form("G.root"),"ReadOnly");
TFile *fg = new TFile("graph.root","Update");
TDirectory *dir;
TList *def, *tl;
TKey *key;
TString dirname;
for(int sth=0; sth<3; sth++){
if(sth==0) dirname = "std";
else if(sth==1) dirname ="Gri055";
else dirname ="Gri101";
dir = f->GetDirectory(dirname);
def = new TList();
int iGlau=0;
//int iGlau=atoi(getenv("GTH"));
tl = dir->GetListOfKeys();
for(iGlau=0; iGlau<nGlau; iGlau++){
key = ((TKey*) tl->At(iGlau));
NBD* temp = (NBD*)key->ReadObj();
def->Add(temp);
}
NBD *n0 = (NBD*)def->At(0);
n0->calcsys(def);
TString op;
for(int option=0;option<3;option++){
if(option==0) op=Form("%s_Ncoll",dirname.Data());
else if(option==1) op=Form("%s_Npart",dirname.Data());
else op=Form("%s_B",dirname.Data());
TGraphErrors* gr = n0->DrawGraph(option);
gr->Write(op);
}
}
fg->Close();
f->Close();
}
示例15: rescale2SM4
void rescale2SM4(bool armed, const char* filename, double ecms=7., double mass=-1)
{
unsigned int debug = 1;
std::vector<std::string> histnames; histnames.clear();
if( debug>0 ){
std::cout << "file = " << filename << std::setw(10);
std::cout << "mass = " << mass << std::setw(10);
std::cout << "armed = " << armed << std::endl;
}
TFile* file = new TFile(filename, "update");
TIter nextDirectory(file->GetListOfKeys());
std::vector<std::string> buffer; TKey* idir;
while((idir = (TKey*)nextDirectory())){
buffer.clear();
if( idir->IsFolder() ){
file->cd(); // make sure to start in directory head
if( debug>1 ){ std::cout << "Found directory: " << idir->GetName() << std::endl; }
if( file->GetDirectory(idir->GetName()) ){
file->cd(idir->GetName()); // change to sub-directory
buffer = signalList(idir->GetName(), "", debug);
}
// append to the vector of histograms to be rescaled
for(std::vector<std::string>::const_iterator elem=buffer.begin(); elem!=buffer.end(); ++elem){
histnames.push_back(*elem);
}
if(debug>1){
std::cout << "added " << buffer.size() << " elements to histnames [" << histnames.size() << "] for directory " << idir->GetName() << std::endl;
}
}
}
// pick up histograms which are not kept in an extra folder
file->cd(); buffer.clear();
buffer = signalList("", "", debug);
// append to the vector of histograms to be rescaled
for(std::vector<std::string>::const_iterator elem=buffer.begin(); elem!=buffer.end(); ++elem){
histnames.push_back(*elem);
}
if(debug>1){
std::cout << "added " << buffer.size() << " elements to histnames [" << histnames.size() << "] for file head" << std::endl;
}
HiggsCSandWidth smx; HiggsCSandWidthSM4 sm4;
for(std::vector<std::string>::const_iterator hist=histnames.begin(); hist!=histnames.end(); ++hist){
int type = 0;
// determine mass from hostogram name
std::string strippedName = (hist->find("/")!=std::string::npos ? hist->substr(hist->find("/")+1) : *hist);
std::string massName;
if(strippedName.find("ggH")!=std::string::npos) {
massName = strippedName.substr(3, 3); type = 1;
}
if(strippedName.find("qqH")!=std::string::npos) {
massName = strippedName.substr(3, 3); type = 2;
}
if(strippedName.find("VH" )!=std::string::npos) {
massName = strippedName.substr(2, 3); type = 3;
}
if( type==0 ) {
std::cout << "not supported process" << std::endl;
continue;
}
else {
file->cd();
float mdx = atof(massName.c_str());
TH1F* h = (TH1F*)file->Get(hist->c_str());
float smxXS = type==1 ? smx.HiggsCS(type, mdx, ecms, true) : 0.; float smxBR = smx.HiggsBR(2, mdx, true);
float sm4XS = type==1 ? sm4.HiggsCS(type, mdx, ecms, true) : 0.; float sm4BR = sm4.HiggsBR(2, mdx, true);
if( debug>1 ){
std::cout << " -- hist = " << std::setw(10) << h->GetName() << std::endl
<< " -- type = " << std::setw(10) << type << std::endl
<< " -- mass = " << std::setw(10) << mdx << std::endl
<< " -- SM = " << std::setw(10) << smxXS*smxBR << " (BR = " << smxBR << ")" << std::endl
<< " -- SM4 = " << std::setw(10) << sm4XS*sm4BR << " (BR = " << sm4BR << ")" << std::endl
<< " -- scale = " << std::setw(10) << (type==1 ? sm4XS*sm4BR/(smxXS*smxBR) : 0) << std::endl
<< std::endl;
}
if( type==1 ){ h->Scale(sm4XS*sm4BR/(smxXS*smxBR)); }
//scaling old style
//if( type==2 ){ h->Scale(sm4BR/smxBR); }
//if( type==3 ){ h->Scale(sm4BR/smxBR); }
// scaling new style
if( type==2 ){ h->Scale(0.); }
if( type==3 ){ h->Scale(0.); }
if(armed){
if(hist->find("/")!=std::string::npos){
file->cd(hist->substr(0, hist->find("/")).c_str());
}
else{
file->cd();
}
h->Write(strippedName.c_str(), TObject::kOverwrite);
}
}
}
file->Close();
return;
}