本文整理汇总了C++中TNtuple::SetMarkerStyle方法的典型用法代码示例。如果您正苦于以下问题:C++ TNtuple::SetMarkerStyle方法的具体用法?C++ TNtuple::SetMarkerStyle怎么用?C++ TNtuple::SetMarkerStyle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TNtuple
的用法示例。
在下文中一共展示了TNtuple::SetMarkerStyle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fragmentYieldsPlot
//.........这里部分代码省略.........
TString experimentalDataPath = "experimentalData/iaeaBenchmark/yields/TDK" + fragmentName + ".dat";
ifstream in;
//Pull in ascii/exfor-style data
in.open(experimentalDataPath);
Float_t f1,f2;
Int_t nlines = 0;
TFile *f = new TFile("fragmentAngularDistribution.root","RECREATE");
TNtuple *ntuple = new TNtuple("ntuple","Data from ascii file","x:y");
Char_t DATAFLAG[4];
Int_t NDATA;
Char_t n1[15], n2[15];
in >> DATAFLAG >> NDATA ; // Read EXFOR line: 'DATA 6'
in >> n1 >> n2; // Read column titles: 'Energy He B [...]'
cout <<n1<<" "<<n2<<"\n";
while (1) {
in >> f1 >> f2;
if (!in.good()) break;
if (nlines < 500 ) printf("%f %f\n",f1,f2);
ntuple->Fill(f1,f2);
nlines++;
}
std::cout << "Imported " << nlines << " lines from data-file" << endl;
TNtuple *simData = new TNtuple("ntuple","Data from ascii file","depth:H:He:Li:Be:B:C");
// gROOT->SetStyle("clearRetro");
//this will be used as base for pulling the experimental data
TString dir = gSystem->UnixPathName(gInterpreter->GetCurrentMacroName());
dir.ReplaceAll("fragmentAngularDistribution.C","");
dir.ReplaceAll("/./","/");
ifstream in;
simData->Fill(0.0,0.0,0.0,0.0,0.0,0.0,1.0);
for(int j = 1; j <= 40;j=j=j+1){
TString pDepth, fragment, Znum, normToOneAtZeroAngle;
pDepth = Form("%i",j);
/*
cout << "Enter phantom depth (eg. 27.9, see experimentalData directory for choices): ";
cin >> pDepth;
*/
TString simulationDataPath = "IAEA_" + pDepth + ".root";
//Let's pull in the simulation-data
//TFile *MCData = TFile::Open("IAEA_" + pDepth + ".root");
TFile *MCData = TFile::Open(simulationDataPath);
TNtuple *fragments = (TNtuple*) MCData->Get("fragmentNtuple");
//Block bellow pulls out the simulation's metadata from the metadata ntuple.
TNtuple *metadata = (TNtuple*) MCData->Get("metaData");
Float_t events, detectorDistance,waterThickness,beamEnergy,energyError,phantomCenterDistance;
metadata->SetBranchAddress("events",&events);
metadata->SetBranchAddress("waterThickness",&waterThickness);
metadata->SetBranchAddress("detectorDistance",&detectorDistance);
metadata->SetBranchAddress("beamEnergy",&beamEnergy);
metadata->SetBranchAddress("energyError",&energyError);
metadata->SetBranchAddress("phantomCenterDistance",&phantomCenterDistance);
metadata->GetEntry(0); //there is just one row to consider.
//ALL UNITS ARE cm!
Double_t scatteringDistance = detectorDistance - phantomCenterDistance; //temporarily hard-coded, should be distance from target-center to detector
Double_t degrees = 10.0;
Double_t r, rMin, rMax, graphMaximum = 0.0;
Double_t norming = events*.999;
TString rMinString;
TString rMaxString;
rMinString = "0.00";
rMaxString = Form("%f", scatteringDistance*TMath::ATan(degrees*TMath::DegToRad()));
Double_t H = ((Double_t*) fragments->GetEntries("(Z == " + TString::Format("%i",1) + " && sqrt(posY^2 + posZ^2) < " + rMaxString + "&& sqrt(posY*posY + posZ*posZ) > " + rMinString + ")")) / norming;
Double_t He = ((Double_t*) fragments->GetEntries("(Z == " + TString::Format("%i",2) + " && sqrt(posY^2 + posZ^2) < " + rMaxString + "&& sqrt(posY*posY + posZ*posZ) > " + rMinString + ")")) / norming;
Double_t Li = ((Double_t*) fragments->GetEntries("(Z == " + TString::Format("%i",3) + " && sqrt(posY^2 + posZ^2) < " + rMaxString + "&& sqrt(posY*posY + posZ*posZ) > " + rMinString + ")")) / norming;
Double_t Be = ((Double_t*) fragments->GetEntries("(Z == " + TString::Format("%i",4) + " && sqrt(posY^2 + posZ^2) < " + rMaxString + "&& sqrt(posY*posY + posZ*posZ) > " + rMinString + ")")) / norming;
Double_t B = ((Double_t*) fragments->GetEntries("(Z == " + TString::Format("%i",5) + " && sqrt(posY^2 + posZ^2) < " + rMaxString + "&& sqrt(posY*posY + posZ*posZ) > " + rMinString + ")")) / norming;
Double_t C = ((Double_t*) fragments->GetEntries("(Z == " + TString::Format("%i",6) + " && sqrt(posY^2 + posZ^2) < " + rMaxString + "&& sqrt(posY*posY + posZ*posZ) > " + rMinString + ")")) / norming;
simData->Fill(waterThickness,H,He,Li,Be,B,C);
}
simData->Scan();
simData->SetMarkerStyle(2); //filled dot
simData->SetMarkerColor(kBlue);
graphMaximum = TMath::Max(graphMaximum, simData->GetMaximum(fragmentName));
graphMaximum = TMath::Max(graphMaximum, ntuple->GetMaximum("y"));
dummyHisto->SetMaximum(graphMaximum + .05*graphMaximum);
dummyHisto->Draw();
simData->Draw(fragmentName + ":depth","","p,same");
ntuple->SetMarkerStyle(22); //triangle
ntuple->SetMarkerColor(kRed);
ntuple->Draw("y:x","","p,same");
c1->SaveAs("fragmentYieldsFor" + fragmentName + ".png");
}