本文整理汇总了C++中TObject::Delete方法的典型用法代码示例。如果您正苦于以下问题:C++ TObject::Delete方法的具体用法?C++ TObject::Delete怎么用?C++ TObject::Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TObject
的用法示例。
在下文中一共展示了TObject::Delete方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: makeDescantHisto
// specific function for short vectors
TH1* makeDescantHisto(const vector<short> &v, const char *hisName = "vectorHis")
{
TObject *obj = gROOT->FindObjectAny(hisName);
if (obj) {
obj->Delete();
}
TH1 *his = new TH1S(hisName, hisName, v.size()-8, 0, v.size()-8);
for (Int_t i=0; i < v.size(); i++) {
// reorder so that samples 0-7 are: 7,6,1,0,3,2,5,4
// 0,1,2,3,4,5,6,7
// pairwise swap: 0->1,1->0 => i+1 (1,2) => i+1-(2*i%2) (1,0)
// 67,01,32,45: shift all by +2, except for the last pair which need to be shifted by -6
Int_t reordered = i-2;
reordered = reordered+1-2*(reordered%2);
if(reordered%8 < 6) {
//std::cout<<i<<" => "<<reordered+2<<std::endl;
his->SetBinContent(reordered+3, v.at(i));
} else {
//std::cout<<i<<" => "<<reordered-6<<std::endl;
his->SetBinContent(reordered-5, v.at(i));
}
}
return his;
}
示例2: ProfileX
void KVCanvas::ProfileX(TH2* hh)
{
TObject* pfx = 0;
if ((pfx = FindObject(Form("%s_pfx", hh->GetName())))) pfx->Delete();
hh->ProfileX("_pfx", 1, -1, "i,d,same");
if ((pfx = FindObject(Form("%s_pfx", hh->GetName()))))((TProfile*)pfx)->SetLineColor(kBlack);
Modified();
Update();
}
示例3: makeHistoCommon
U* makeHistoCommon(const vector<T> &v, const char *hisName = "vectorHis")
{
TObject *obj = gROOT->FindObjectAny(hisName);
if (obj) {
obj->Delete();
}
U *his = new U(hisName, hisName, v.size(), 0, v.size());
for (Int_t i=0; i < v.size(); i++) {
his->SetBinContent(i+1, v.at(i));
}
return his;
}
示例4: ProfileY
void KVCanvas::ProfileY(TH2* hh)
{
TObject* obj = 0;
if ((obj = gROOT->FindObject(Form("%s_pfy", hh->GetName())))) obj->Delete();
TProfile* pfy = hh->ProfileY("_pfy", 1, -1, "i");
TGraphErrors* gr = gHistoManipulator->MakeGraphFrom(pfy);
pfy->Delete();
TGraph* gg = gHistoManipulator->PermuteAxis(gr);
gr->Delete();
gg->SetName(Form("%s_pfy", hh->GetName()));
gg->SetLineColor(kBlack);
gg->Draw("PEZ");
Modified();
Update();
}
示例5: makeGraph
TGraph* makeGraph(const vector<T> &v, const char *name = "vectorGraph")
{
TObject *obj = gROOT->FindObjectAny(name);
if (obj) {
obj->Delete();
}
TGraph *graph = new TGraph(v.size());
graph->SetNameTitle(name, name);
for (Int_t i=0; i < v.size(); i++) {
graph->SetPoint(i, i, v.at(i));
}
return graph;
}
示例6: ReducedMET
//.........这里部分代码省略.........
myfile << BOTHfinal_T;
myfile << "\t S/sqrt(B): ";
myfile << sig2ncut3;
myfile << "\t S: ";
myfile << sigcut3;
myfile << "\t B: ";
myfile << bkgd3;
myfile << "\t EFF: ";
myfile << sigEFF3;
myfile << "\t REJ: ";
myfile << bkgdREJ3;
myfile << "\tmax ratio w/ S>3\n\n";
myfile << Local_Max_T;
myfile << "\t S/sqrt(B): ";
myfile << sig2ncut4;
myfile << "\t S: ";
myfile << sigcut4;
myfile << "\t B: ";
myfile << bkgd4;
myfile << "\t EFF: ";
myfile << sigEFF4;
myfile << "\t REJ: ";
myfile << bkgdREJ4;
myfile << "\tmax ratio in specified range\n\n";
int pointstorage_size = pointstorage_signalEFF.size();
for (int sindex = 0; sindex < pointstorage_size; ++sindex){
myfile << "\n\n";
myfile << "Opt: ";
myfile << opt_store[sindex];
myfile << "\tnumberSIGevents:";
myfile << pointstorage_sigcut[sindex];
myfile << "\tSignalEFF: ";
myfile << pointstorage_signalEFF[sindex];
myfile << "\tBackgdREJ: ";
myfile << pointstorage_backgdREJ[sindex];
myfile << "\tSig2Noise: ";
myfile << pointstorage_signal2noise[sindex];
}
myfile.close();
const int vectorsize = signalEFF.size();
float signalEFF_forplot[vectorsize];
float backgdREJ_forplot[vectorsize];
float signal2noise_forplot[vectorsize];
for (int vindex = 0; vindex < vectorsize; ++vindex){
signalEFF_forplot[vindex] = signalEFF[vindex];
backgdREJ_forplot[vindex] = backgdREJ[vindex];
//backgdREJ_forplot[vindex] = 1;
signal2noise_forplot[vindex] = signal2noise[vindex];
}
TCanvas *c1 = new TCanvas("c1","Eff and Rej",200,10,700,500);
zzgr = new TGraph(vectorsize, backgdREJ_forplot, signalEFF_forplot);
//zzgr->SetLineColor(2);
//zzgr->SetLineWidth(4);
zzgr->SetMarkerColor(4);
zzgr->SetMarkerStyle(21);
zzgr->SetMarkerSize(.3);
zzgr->SetTitle("Sig Eff vs Bkgd Rej");
zzgr->GetXaxis()->SetTitle("Background Rejection");
zzgr->GetYaxis()->SetTitle("Signal Efficiency");
//zzgr->GetXaxis()->SetRangeUser(0,80);
//zzgr->GetYaxis()->SetRangeUser(0,0.1);
//zzgr->Draw("ACP");
zzgr->Draw("AP");
c1 -> SaveAs("EFFvsREJ_"+OptimizedVariable+"_"+LEPTON_TYPE+".png");
TCanvas *c2 = new TCanvas("c2","Eff and Sig to Noise",200,10,700,500);
zzgr1 = new TGraph(vectorsize, signal2noise_forplot, signalEFF_forplot);
//zzgr1->SetLineColor(2);
//zzgr1->SetLineWidth(4);
zzgr1->SetMarkerColor(4);
zzgr1->SetMarkerStyle(21);
zzgr1->SetMarkerSize(.3);
zzgr1->SetTitle("Sig Eff vs Sig/sqrt(S+B)");
zzgr1->GetXaxis()->SetTitle("Signal/sqrt(Signal+Bkgd)");
zzgr1->GetYaxis()->SetTitle("Signal Efficiency");
//zzgr1->GetXaxis()->SetRangeUser(0,80);
//zzgr1->GetYaxis()->SetRangeUser(0,0.1);
//zzgr1->Draw("ACP");
zzgr1->Draw("AP");
c2 -> SaveAs("EFFvsSOSB_"+OptimizedVariable+"_"+LEPTON_TYPE+".png");
TIter next(gDirectory->GetList()); //Deletes histograms to avoid memory leaks
TObject* obj;
while(obj= (TObject*)next()){
if(obj->InheritsFrom(TH1::Class())){
obj->Delete();
}
}
}