本文整理汇总了C++中Projection::MakeProjections方法的典型用法代码示例。如果您正苦于以下问题:C++ Projection::MakeProjections方法的具体用法?C++ Projection::MakeProjections怎么用?C++ Projection::MakeProjections使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Projection
的用法示例。
在下文中一共展示了Projection::MakeProjections方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoWalkStuff
void DoWalkStuff(TTree*tree,Projection myProjection){
vector <Corrections> WalkCorrections;
stringstream name;
stringstream arg;
stringstream conditions;
TH2F * temp;
for (int j=0;j<numComparisons;j++){
for (int i=0;i<numChannels;i++){
int chan=-1;
name.str("");
arg.str("");
conditions.str("");
name<<"WalkChannel_"<<i<<ListOfWalkNames[j];
if (i % 2 == 0){//if even channel
conditions<<"channels["<<0<<"]=="<<i<<"&&abs(CorGOE)<0.5&&channels[2]==8&&abs("<<ListOfWalkComparisons[j]<<")<200";
arg<<"energiesCor["<<0<<"]:"<<ListOfWalkComparisons[j];
chan=i;
}else{ // odd chanel
conditions<<"channels["<<1<<"]=="<<i<<"&&abs(CorGOE)<0.5&&channels[2]==8&&abs("<<ListOfWalkComparisons[j]<<")<200";
arg<<"energiesCor["<<1<<"]:"<<ListOfWalkComparisons[j];
chan=i;
}
cout<<arg.str()<<" "<<conditions.str()<<endl;
temp = new TH2F(name.str().c_str(),"title",1000,x_start,x_end,1000,0,1500);
tree->Project(name.str().c_str(),arg.str().c_str(),conditions.str().c_str());
Corrections c;
c.histo=temp;
c.channel=chan;
if (temp->GetEntries()!=0){
c.bit=1;
c.name=ListOfWalkNames[j];
}else
c.bit=0;
WalkCorrections.push_back(c);
}
}
cout<<"Size "<<WalkCorrections.size()<<endl;
// delete temp;
TFile * out =new TFile("WalkOut.root","recreate");
int count=0;
for (int i=0;i<WalkCorrections.size();i++){
cout<<"*******************************************"<<endl;
if (WalkCorrections[i].bit==1){
myProjection.SetData(WalkCorrections[i].histo);
myProjection.SetRange("auto");
myProjection.MakeProjections();
vector<double> coef=myProjection.GetGraphCoef();
cout<<"This is "<<WalkCorrections[i].name<<" the channel is "<<WalkCorrections[i].channel<<endl;
for(int k=0;k<coef.size();k++)
cout<<"walk"<<WalkCorrections[i].channel<<"cor walk"<<WalkCorrections[i].channel<<"_"<<k+1<<" "<<coef[k]<<endl;
vector <TH1D*>v =myProjection.getProjections();
for (int i=0;i<v.size();i++)
v[i]->Write();
TGraphErrors *gr = myProjection.getGraph();
gr->Write();
count++;
myProjection.Reset();
}
}
out->Close();
}
示例2: DoPosStuff
void DoPosStuff(TTree*tree,Projection myProjection){
vector <Corrections> PosCorrections;
stringstream name;
stringstream arg;
stringstream conditions;
TH2F * temp;
for (int j=0;j<numComparisons-1;j++){
for (int i=0;i<numChannels;i++){
name.str("");
arg.str("");
conditions.str("");
name<<"PosChannel_"<<i<<ListOfPosNames[j];
conditions<<"channels["<<0<<"]=="<<i<<"&&abs(CorGOE)<0.5&&channels[2]==8";
arg<<"CorGOE:"<<ListOfPosComparisons[j];
cout<<arg.str()<<" "<<conditions.str()<<endl;
temp = new TH2F(name.str().c_str(),"title",1000,x_start,x_end,1000,-1,1);
tree->Project(name.str().c_str(),arg.str().c_str(),conditions.str().c_str());
Corrections c;
c.histo=temp;
c.channel=i;
if (temp->GetEntries()!=0){
c.bit=1;
c.name =ListOfPosNames[j];
}else{
c.bit=0;
}
PosCorrections.push_back(c);
}
}
// delete temp;
TFile * out =new TFile("PosOut.root","recreate");
int count=0;//counter for the corrections that have bit=1
for (int i=0;i<PosCorrections.size();i++){
cout<<"*******************************************"<<endl;
if (PosCorrections[i].bit==1){
myProjection.SetData(PosCorrections[i].histo);
myProjection.SetRange("auto");
myProjection.MakeProjections();
vector<double> coef=myProjection.GetGraphCoef();
cout<<"This is "<<PosCorrections[i].name<<" the channel is "<<PosCorrections[i].channel<<endl;
for(int k=0;k<coef.size();k++)
cout<<"pos"<<PosCorrections[i].channel<<"cor goe"<<PosCorrections[i].channel<<"_"<<k+1<<" "<<coef[k]<<endl;
vector <TH1D*>v =myProjection.getProjections();
for (int i=0;i<v.size();i++)
v[i]->Write();
TGraphErrors *gr = myProjection.getGraph();
gr->Write();
count++;
myProjection.Reset();
}else{
cout<<"Filler line for "<<i<<endl;
}
}
out->Close();
}