本文整理汇总了C++中TH2D::GetName方法的典型用法代码示例。如果您正苦于以下问题:C++ TH2D::GetName方法的具体用法?C++ TH2D::GetName怎么用?C++ TH2D::GetName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TH2D
的用法示例。
在下文中一共展示了TH2D::GetName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MoveTransformMatric
void MoveTransformMatric(TString inFileName, TString matrixName)
{
TFile inFile(inFileName);
TH2D *transform = (TH2D*) inFile.Get(matrixName);
TFile outFile("PreparedTransformMatrices.root","update");
if(transform) {
outFile.cd();
transform->RebinX(4);
transform->RebinY(4);
transform->Write(transform->GetName(), TObject::kOverwrite);
}
else cout<<"Could not find matrix with that name"<<endl;
outFile.Close();
inFile.Close();
}
示例2:
//loads phi-pT efficiency from root file
TH2D *GetEfficiencyPhi(TString effLoc){
TFile *fIn = 0;
TH2D *hPhiPt = 0;
if(!fIn)fIn = TFile::Open(effLoc.Data());
if(!fIn)Printf("%s%d no input data",(char*)__FILE__,__LINE__);
if(!hPhiPt)hPhiPt = (TH2D*)fIn->Get("h2TrackPtPhiNorm");
if(!hPhiPt) cout<<"Could not load h2TrackPtPhiNorm"<<endl;
if(!hPhiPt)Printf("%s%d no phi-pt efficiency spectrum available",(char*)__FILE__,__LINE__);
gROOT->cd();
TH2D *hPhiPtClone = (TH2D*)hPhiPt->Clone(hPhiPt->GetName());
fIn->Close();
return hPhiPtClone;
}
示例3: processSpecies
void pidFitter::processSpecies( string species, int charge, reporter * rp ){
cout << "[pidFitter." << __FUNCTION__ << "]" << endl;
string hName = "nSig_" + sName( species, charge );
// get the pt Binning
vector<double>pBins = config->getDoubleVector( "binning.p" );
string useNode = "";
TH3* h3 = book->get3D( hName );
int nFits = config->getInt( species + "_Fit:nFits", 1 );
cout << "Number of Fit Categories: " << nFits << endl;
for ( int iFit = 1; iFit <= nFits; iFit++ ){
string optPath = species + "_Fit.opt" + config->getString( species + "_Fit.fit"+ts(iFit)+":options");
int fBin = config->getInt( species + "_Fit.fit"+ts(iFit)+":min", 1 );
int lBin = config->getInt( species + "_Fit.fit"+ts(iFit)+":max", pBins.size() );
cout << "Fitting P bins ( " << fBin << " --> " << lBin << " ) " << endl;
for ( int i = fBin; i <= lBin; i ++ ){
// get the Pt range for title etc.
double pLow = h3->GetZaxis()->GetBinLowEdge( i );
double pHi = h3->GetZaxis()->GetBinLowEdge( i + 1 );
// look at one Pt bin at a time
h3->GetZaxis()->SetRange( i, i );
// Get the 2D projection we want
TH2D* proj;
proj = (TH2D*)h3->Project3D( "xy" );
string name = proj->GetName();
TH2D* cut = (TH2D*) proj->Clone( (name + "cut").c_str() );
rp->newPage( 1, 2 );
proj->SetTitle( ( ts( pLow, 4 ) + " #leq " + " P #leq" + ts( pHi, 4 ) ).c_str() );
gPad->SetLogz( 1 );
proj->Draw( "colz" );
//nProj->Draw("colz");
// process the square cuts
makeSquareCuts( cut, optPath + ".squareCut" );
// draw the distribution after square cuts
rp->cd( 1, 2 );
gPad->SetLogz( 1 );
cut->SetTitle( ( "After 1D Cuts : " + ts( pLow, 4 ) + " #leq " + " P #leq" + ts( pHi, 4 ) ).c_str() );
cut->Draw( "colz" );
rp->savePage( );
// fit using the dkl algorithm
if ( config->nodeExists( optPath + ".dkl" ) )
runDkl( cut, rp, optPath );
// runs the 2d gaussian fit
else if ( config->nodeExists( optPath + ".mgf" ) )
runMultiGauss( cut, rp, species, optPath, i );
}
}
}
示例4: readroot
void readroot(char* input="/gpfs/mnt/gpfs02/phenix/mpcex/liankun/Run16/Ana/offline/analysis/mpcexcode/Liankun/macro/offline_monitor/453692/Run16Ana_MinBias_NoCMN_Sub-453692-0.root"){
char input_file[5000];
strcpy(input_file,input);
strtok(input_file, "-");
int runnumber = atoi(strtok(0, "-"));
int segment = atoi(strtok(strtok(0, "-"), "."));
cout<<"Run Number: "<<runnumber<<" segment: "<<segment<<endl;
gSystem->Load("libMyMpcEx.so");
TFile* ifile = new TFile(input,"READONLY");
if(!ifile){
cout<<"Open "<<input<<" failed !"<<endl;
return;
}
TH2D* hkey_adc_high;
TH2D* hkey_adc_low;
TH2D* hkey_rawadc_high;
TH2D* hkey_rawadc_low;
TH2D* hHL_sensor[2][8][24];
TH2D* hHL_sensor_raw[2][8][24];
Exogram* hgrammy_high[2];
Exogram* hgrammy_low[2];
Exogram* hgrammy_combine[2];
TH2D* hadc_mpc_e[2];
TH2D* hlayer_adc_high[2];
TH2D* hlayer_adc_low[2];
TH2D* htower_e;
TH2D* hbbc_adc[2];
TH2D* hbbc_adc_low[2];
TH2D* hbbc_nhits[2];
char hname[500];
vector<TH2D*> h2d_list;
hkey_adc_high = (TH2D*)ifile->Get("hkey_adc_high");
h2d_list.push_back(hkey_adc_high);
hkey_adc_low = (TH2D*)ifile->Get("hkey_adc_low");
h2d_list.push_back(hkey_adc_low);
hkey_rawadc_high = (TH2D*)ifile->Get("hkey_rawadc_high");
h2d_list.push_back(hkey_rawadc_high);
hkey_rawadc_low = (TH2D*)ifile->Get("hkey_rawadc_low");
h2d_list.push_back(hkey_rawadc_low);
hbbc_nhits[0] = (TH2D*)ifile->Get("hbbc_nhits_arm0");
hbbc_nhits[1] = (TH2D*)ifile->Get("hbbc_nhits_arm1");
h2d_list.push_back(hbbc_nhits[0]);
h2d_list.push_back(hbbc_nhits[1]);
hbbc_adc[0] = (TH2D*)ifile->Get("hbbc_adc_arm0");
hbbc_adc[1] = (TH2D*)ifile->Get("hbbc_adc_arm1");
h2d_list.push_back(hbbc_adc[0]);
h2d_list.push_back(hbbc_adc[1]);
hbbc_adc_low[0] = (TH2D*)ifile->Get("hbbc_adc_low_arm0");
hbbc_adc_low[1] = (TH2D*)ifile->Get("hbbc_adc_low_arm1");
h2d_list.push_back(hbbc_adc_low[0]);
h2d_list.push_back(hbbc_adc_low[1]);
hlayer_adc_high[0] = (TH2D*)ifile->Get("hlayer_adc_high_arm0");
hlayer_adc_high[1] = (TH2D*)ifile->Get("hlayer_adc_high_arm1");
h2d_list.push_back(hlayer_adc_high[0]);
h2d_list.push_back(hlayer_adc_high[1]);
hlayer_adc_low[0] = (TH2D*)ifile->Get("hlayer_adc_low_arm0");
hlayer_adc_low[1] = (TH2D*)ifile->Get("hlayer_adc_low_arm1");
h2d_list.push_back(hlayer_adc_low[0]);
h2d_list.push_back(hlayer_adc_low[1]);
htower_e = (TH2D*)ifile->Get("htower_e");
h2d_list.push_back(htower_e);
hadc_mpc_e[0] = (TH2D*)ifile->Get("hadc_mpc_e_arm0");
hadc_mpc_e[1] = (TH2D*)ifile->Get("hadc_mpc_e_arm1");
h2d_list.push_back(hadc_mpc_e[0]);
h2d_list.push_back(hadc_mpc_e[1]);
for(unsigned int i = 0;i < h2d_list.size();i++){
string s = h2d_list[i]->GetName();
stringstream ss("");
ss<<s<<"_"<<runnumber<<"_"<<segment;
s=ss.str();
// cout << s <<endl;
TCanvas* c = new TCanvas(s.c_str(),s.c_str(),1200,800);
c->SetLogz();
h2d_list[i]->Draw("colz");
ss.str("");
ss << runnumber <<"/"<<s<<".gif";
s=ss.str();
c->Print(s.c_str(),"gif");
delete c;
}
vector<Exogram*> hexo_list;
hgrammy_high[0] = (Exogram*)ifile->Get("hgrammy_high0");
hgrammy_high[1] = (Exogram*)ifile->Get("hgrammy_high1");
//.........这里部分代码省略.........
示例5: checkPullTree
//.........这里部分代码省略.........
TCanvas* canvPullSigma = new TCanvas("canvPullSigma", "canvPullSigma", 100,10,1380,800);
canvPullSigma->SetLogx(kTRUE);
canvPullSigma->SetGridx(kTRUE);
canvPullSigma->SetGridy(kTRUE);
TCanvas* canvPullChi2 = new TCanvas("canvPullChi2", "canvPullChi2", 100,10,1380,800);
canvPullChi2->SetLogx(kTRUE);
canvPullChi2->SetGridx(kTRUE);
canvPullChi2->SetGridy(kTRUE);
TCanvas* canvPull[nThetaHistos + 1];
for (Int_t i = 0, j = nThetaHistos; i < nThetaHistos + 1; i++, j--) {
canvPull[i] = new TCanvas(Form("canvPull_%d", i), "canvPull", 100,10,1380,800);
canvPull[i]->cd();
canvPull[i]->SetLogx(kTRUE);
canvPull[i]->SetLogz(kTRUE);
canvPull[i]->SetGrid(kTRUE, kTRUE);
TH2D* hTemp = 0x0;
TString thetaString = "";
if (i == nThetaHistos) {
hTemp = hPull;
thetaString = "tan(#Theta) integrated";
}
else {
hTemp = hPullTheta[i];
thetaString = Form("%.2f #leq |tan(#Theta)| < %.2f", tThetaLow[i], tThetaHigh[i]);
}
normaliseHisto(hTemp);
hTemp->FitSlicesY();
hTemp->GetYaxis()->SetNdivisions(12);
hTemp->GetXaxis()->SetMoreLogLabels(kTRUE);
TH1D* hTempMean = (TH1D*)gDirectory->Get(Form("%s_1", hTemp->GetName()));
hTempMean->SetTitle(Form("mean(pull), %s", thetaString.Data()));
hTempMean->GetXaxis()->SetMoreLogLabels(kTRUE);
hTempMean->SetLineWidth(2);
hTempMean->SetMarkerStyle(20);
TH1D* hTempSigma = (TH1D*)gDirectory->Get(Form("%s_2", hTemp->GetName()));
hTempSigma->SetTitle(Form("#sigma(pull), %s", thetaString.Data()));
hTempSigma->GetXaxis()->SetMoreLogLabels(kTRUE);
hTempSigma->SetLineColor(kMagenta);
hTempSigma->SetMarkerStyle(20);
hTempSigma->SetMarkerColor(kMagenta);
hTempSigma->SetLineWidth(2);
TH1D* hTempChi2 = (TH1D*)gDirectory->Get(Form("%s_chi2", hTemp->GetName()));
hTempChi2->SetTitle(Form("#chi^{2} / NDF (pull), %s", thetaString.Data()));
hTempChi2->GetXaxis()->SetMoreLogLabels(kTRUE);
hTempChi2->SetLineColor(kMagenta + 2);
hTempChi2->SetMarkerStyle(20);
hTempChi2->SetMarkerColor(kMagenta + 2);
hTempChi2->SetLineWidth(2);
hTemp->DrawCopy("colz");
hTempMean->DrawCopy("same");
hTempSigma->DrawCopy("same");
hTempChi2->Scale(-1./10.);
hTempChi2->DrawCopy("same");
hTempChi2->Scale(-10.);
canvPullMean->cd();
hTempMean->SetLineColor(1 + ((j >= 9) ? (39 + 2 * (j - 9)) : j));
hTempMean->SetMarkerColor(1 + ((j >= 9) ? (39 + 2 * (j - 9)) : j));
hTempMean->DrawCopy((i == 0 ? "" : "same"));
canvPullSigma->cd();