本文整理汇总了C++中TF1::Delete方法的典型用法代码示例。如果您正苦于以下问题:C++ TF1::Delete方法的具体用法?C++ TF1::Delete怎么用?C++ TF1::Delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TF1
的用法示例。
在下文中一共展示了TF1::Delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mk_sigaccanplots
//.........这里部分代码省略.........
tex4->SetNDC();
tex4->SetTextAlign(12);
tex4->SetTextFont(42);
tex4->SetTextSize(textsiz);
tex4->SetLineWidth(2);
}
float legx = 0.65;
if (tdrstyle == false) {
legx = 0.56;
}
TLegend *leg = new TLegend(legx, 0.2, legx + 0.3, 0.4);
leg->SetBorderSize(1);
leg->SetTextFont(62);
leg->SetLineColor(kBlack);
leg->SetLineStyle(1);
leg->SetLineWidth(1);
leg->SetFillColor(0);
leg->SetFillStyle(1001);
//leg->SetHeader();
// leg->AddEntry(h_GluinoHist_Fit, "#splitline{Acceptance as function}{of gluino mass}","l");
h_GluinoHist_Fit->SetMarkerStyle(1);
h_GluinoHist_Fit->SetMarkerColor(kWhite);
// h_GluinoHist_Fit->SetMarkerColor(kGreen + 3);
h_GluinoHist_Fit->SetMarkerSize(0.004);
// h_GluinoHist_Fit->SetTitleSize(0.01);
TF1 *fitfunc = h_GluinoHist_Fit->GetFunction("GausWidth");
string fitnamew = "fitcopy" + ptcut;
TF1* fitfunccopy = (TF1 *) fitfunc->Clone(fitnamew.c_str());
if (fitfunc == NULL)
cout << "Can't get fit func\n";
else {
fitfunc->Delete();
fitfunccopy->SetLineWidth(3);
fitfunccopy->SetLineColor(kGreen + 3);
// fitfunc->SetLineStyle(3); // Dotted
}
float labsiz = 0.055;
h_GluinoHist_Fit->GetXaxis()->SetLabelFont(62);
h_GluinoHist_Fit->GetXaxis()->SetTitleFont(62);
h_GluinoHist_Fit->GetYaxis()->SetLabelFont(62);
h_GluinoHist_Fit->GetYaxis()->SetTitleFont(62);
h_GluinoHist_Fit->GetYaxis()->SetTitle("Gaussian width [GeV]");
float offset = 0.8;
if (tdrstyle == false) {
h_GluinoHist_Fit->GetXaxis()->SetTitleOffset(offset);
h_GluinoHist_Fit->GetYaxis()->SetTitleOffset(offset);
}
h_GluinoHist_Fit->GetXaxis()->SetTitle("Gluino mass [GeV]");
h_GluinoHist_Fit->GetXaxis()->SetTitleSize(labsiz);
h_GluinoHist_Fit->GetYaxis()->SetTitleSize(labsiz);
if (tdrstyle == false) {
float axsize = 0.04;
h_GluinoHist_Fit->GetXaxis()->SetLabelSize(axsize);
h_GluinoHist_Fit->GetYaxis()->SetLabelSize(axsize);
}
if (flavor.compare("113_223") == 0 && ptcut == "60")
h_GluinoHist_Fit->GetYaxis()->SetRangeUser(14.0, 50.0);
h_GluinoHist_Fit->Draw("APX"); // X eliminates error bars
// h_GluinoHist_Fit->Draw("AP");
// TH1 *fithist = (TH1 *) fitfunccopy->GetHistogram()->Clone(fitnamew.c_str());
TH1 *fithist = (TH1 *) fitfunccopy->GetHistogram()->Clone();
int fillcolor = kGreen + 2;
int fillstyle = 3013;
if (fithist != NULL) {
示例2: if
//.........这里部分代码省略.........
nextReferencePartition = yCoordinate;
int firstRef = vectorOfReferenceChambers.at(0);
int lastRef = vectorOfReferenceChambers.at(vectorOfReferenceChambers.size() - 1);
int ccham = currentChNumber+1;
if(! (lastRef > ccham && firstRef < ccham) ){
// all partitions are possible, chambers are out of the reference scope
prevReferencePartition = this->getChamberNumber(1)->getClones();
nextReferencePartition = 1; // 3 in case of ecap chamber
}
}
if (positive){ startCounter = prevReferencePartition; endCounter = nextReferencePartition; }
else { startCounter = nextReferencePartition ; endCounter = prevReferencePartition ; }
for (int currentCounter = startCounter ; currentCounter <= endCounter; currentCounter ++ ){
assert(currentCounter > 0 && currentCounter < 4);
vectorOfpartitionsAndHit.push_back(currentCounter);
}
}
else{
vectorOfpartitionsAndHit.push_back(this->getChamberNumber(currentChNumber+1)->getXYCoordinatesOfCluster(clusterNum[referenceChambersIncrementor]).at(1));
referenceChambersIncrementor ++;
}
prevReference = 0 ; nextReference = 0 ; prevReferencePartition = 0 ; nextReferencePartition = 0; currentChamberIsReference = false;
//cout << "Chamber " << l+1 << " " << coordinates.at(1) << " " << fitfunc->Eval(l+1) << " " << endl;
int channelNumberToStore = channelNum;
if (channelNumberToStore < 96/this->getChamberNumber(1)->getClones()){
channelNumberToStore += 1;
} // add one to represent the fired channel, or none if the channel is on the right border
vectorOfpartitionsAndHit.push_back(channelNumberToStore); // the last element is the number of the channel
// Debug lines
/**
cout << "Chamber is " << currentChNumber+1 << " partitions " ;
for (int thesize = 0 ; thesize < vectorOfpartitionsAndHit.size() - 1; thesize++){
cout << vectorOfpartitionsAndHit.at(thesize) << " " ;
}
cout << "channel " << vectorOfpartitionsAndHit.at(vectorOfpartitionsAndHit.size()-1) << endl;
*/
mapOfHits[currentChNumber+1] = vectorOfpartitionsAndHit;
}
// ---------- scintilators coordinates estimate
for (int scintNum = 0 ; scintNum < 31 ; scintNum++){
if(this->getTriggerObjectNumber(1)->getChannel(scintNum+1)->hasHit() && vectorOfClusterNumberCombinations.size() == 1 ) {
if (scintNum < 10) { scintilatorsCoordinates[scintNum+1] = graphXZ->Eval(0); topScintToString = boost::lexical_cast<string>(scintNum+1); }
else { scintilatorsCoordinates[scintNum+1] = graphXZ->Eval(lastFitPoint+1); botScintToString = boost::lexical_cast<string>(scintNum+1); }
}
}
}
// get only vertical tracks from the A partition if there are only two scint hits
if (keepRecoTrack && isVerticalTrack && !mapOfHits.empty() && scintilatorsCoordinates.size() == 2){
graphXZ->SetName(boost::lexical_cast<string>(eventNum).c_str());
string partition;
if (mapOfHits.find(vectorOfReferenceChambers.at(0))->second.at(0) == 1) partition = "A";
else if (mapOfHits.find(vectorOfReferenceChambers.at(0))->second.at(0) == 2) partition = "B";
else partition = "C";
graphXZ->SetTitle(("Correlation factor is "+boost::lexical_cast<string>(graphXZ->GetCorrelationFactor()) + " trigger channels top: " + topScintToString + " bottom: " + botScintToString ).c_str());
if(abs(graphXZ->GetCorrelationFactor()) >= correlationFactor) {
string scintCombination="_"+topScintToString+"_"+botScintToString+"_"+partition;
TDirectory * dir = fileForRecoTracks->GetDirectory(scintCombination.c_str(),true);
if(!dir) {
//fileForRecoTracks->ls();
fileForRecoTracks->mkdir(scintCombination.c_str()) ;
fileForRecoTracks->cd("");
}
fileForRecoTracks->cd(scintCombination.c_str());
//cout << fileForRecoTracks->GetPath() << endl;
}
else{ fileForRecoTracks->cd("") ; fileForRecoTracks->cd("badTracks") ; }
graphXZ->Write(graphXZ->GetName(),TObject::kOverwrite);
fileForRecoTracks->cd("");
//fileForRecoTracks->Write(graphXZ->GetName(),TObject::kOverwrite);
}
fitfunc->Delete();
//histXZ->Delete();
graphXZ->Delete();
}
return mapOfHits;
}
示例3: DoTDeriMax1090Correction
//.........这里部分代码省略.........
FitFuncSlices->SetParLimits(2,0,10);
FitFuncSlices->SetParLimits(3,0,100);
hProfileY->Fit(FitFuncSlices,"RNQ");
cout <<MaxValue<<" " << FitFuncSlices->GetParameter(1) << " " << FitFuncSlices->GetParError(1) <<endl;
hSpectrumTDeriMax1090Rel_EnergyChannel_MaxPosManually->SetBinContent(binX, FitFuncSlices->GetParameter(1));
hSpectrumTDeriMax1090Rel_EnergyChannel_MaxPosManually->SetBinError(binX, FitFuncSlices->GetParError(1));
}
hSpectrumTDeriMax1090Rel_EnergyChannel_MaxPosManually->GetYaxis()->SetRangeUser(ChannelPeakPos-100,ChannelPeakPos+50);
hSpectrumTDeriMax1090Rel_EnergyChannel_MaxPosManually->GetXaxis()->SetRangeUser(-0.05,0.9);
TF1 * funcCorrConst = new TF1("funcCorrConst","pol0",-0.03,0.03);
funcCorrConst->SetLineColor(kRed);
TF1 * funcCorrPol = new TF1("funcCorrPol",PolPiecewise,-0.05,0.9,6);
funcCorrPol->SetLineColor(kBlue);
funcCorrPol->SetParameter(0,0.04);
funcCorrPol->SetParameter(1,ChannelPeakPos);
hSpectrumTDeriMax1090Rel_EnergyChannel_MaxPosManually->Fit(funcCorrConst,"R");
hSpectrumTDeriMax1090Rel_EnergyChannel_MaxPosManually->Fit(funcCorrPol,"R+");
TCanvas* can2=new TCanvas();
gPad->SetLogz();
hSpectrumTDeriMax1090Rel_EnergyChannel->Draw("colz");
funcCorrPol->DrawCopy("same");
for(int i = 7;i>0;i--)
funcCorrPol->SetParameter(i,funcCorrPol->GetParameter(i)/funcCorrPol->GetParameter(1));
funcCorrPol->Print();
char buf[20];
sprintf(buf, "funcCorrNorm_%d",ki);
funcCorrPol->Write(buf,TObject::kOverwrite);
funcCorrConst->Delete();
funcCorrPol->Delete();
//second correction via T1090 (after first)
hSpectrumT1090_EnergyChannelCorr1->GetYaxis()->SetRangeUser(ChannelRangeMin,ChannelRangeMax);
//TF1* FitFuncSlices = new TF1("FitFuncSlices","gaus(0)+pol0(3)",ChannelRangeMin,ChannelRangeMax);
//FitFuncSlices->SetParameters(1000,ChannelPeakPos-10,4,10);
//FitFuncSlices->SetParLimits(1,ChannelRangeMin,ChannelRangeMax);
//FitFuncSlices->SetParLimits(2,0,10);
//FitFuncSlices->SetParLimits(3,0,100);
//gDirectory->ls();
TH1D *hSpectrumT1090_EnergyChannelCorr1_MaxPosManually=new TH1D("hSpectrumT1090_EnergyChannelCorr1_MaxPosManually","",hSpectrumT1090_EnergyChannelCorr1->GetNbinsX(),0,1000);
//cout <<hSpectrumTDeriMax1090_EnergyChannel_MaxPos->GetEntries()<< endl;
for(int binX = hSpectrumT1090_EnergyChannelCorr1->GetXaxis()->FindBin(30);binX <= hSpectrumT1090_EnergyChannelCorr1->GetXaxis()->FindBin(500);binX++)
{
cout << "binx " << binX << endl;
TH1D *hProfileY =hSpectrumT1090_EnergyChannelCorr1->ProjectionY("_py",binX,binX);
//hProfileY->Draw();
//return 0;
double MaxValue=hProfileY->GetBinCenter(hProfileY->GetMaximumBin());
FitFuncSlices = new TF1("FitFuncSlices","gaus(0)+[3]",MaxValue-20,MaxValue+20);
FitFuncGausSlices = new TF1("FitFuncGausSlices","gaus(0)",MaxValue-20,MaxValue+20);
FitFuncGausSlices->SetParameters(hProfileY->GetBinContent(hProfileY->GetMaximumBin()),MaxValue,4);
hProfileY->Fit(FitFuncGausSlices,"RNQ");
FitFuncSlices->SetParameters(FitFuncGausSlices->GetParameter(0),FitFuncGausSlices->GetParameter(1),FitFuncGausSlices->GetParameter(2),10);