本文整理汇总了C++中TFile::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ TFile::Add方法的具体用法?C++ TFile::Add怎么用?C++ TFile::Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TFile
的用法示例。
在下文中一共展示了TFile::Add方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoEtaCorrection
//.........这里部分代码省略.........
Float_t deltaY = predictedStripPositionY-stripMiddleY;
// cout<<nEvent<<": "<<subjectPlane<<"Fill "<<deltaX<<" "<<deltaY<<endl;
histoStripDistribution.at(subjectPlane*2)->Fill(deltaX);
histoStripDistribution.at(subjectPlane*2+1)->Fill(deltaY);
chi2Distribution();
}
}
saveHistos();
vector<UInt_t> vecMinEntries;
cout<<"Minimal Entries in a bin of historgram:"<<endl;
for(UInt_t det=0;det<TPlaneProperties::getNSiliconDetectors();det++){
TH1F* histo=histoStripDistribution.at(det);
Int_t minBin = histo->GetMinimumBin();
Int_t nMinEntries = histo->GetBinContent(minBin);
cout<<endl<< det<< ": "<<minBin<<" "<<nMinEntries<<"\t";
vecMinEntries.push_back(nMinEntries);
}
cout<<"\n\n"<<endl;
vector<UInt_t>vecEventNo[9];
cout<<"create flattened strip hit histo "<<eventReader->GetEntries()<<endl;
for( nEvent=0;nEvent<eventReader->GetEntries();nEvent++){
TRawEventSaver::showStatusBar(nEvent,eventReader->GetEntries());
eventReader->LoadEvent(nEvent);
if(!eventReader->useForAnalysis()&&!eventReader->useForAlignment())
continue;
for(UInt_t subjectPlane=0; subjectPlane<TPlaneProperties::getNSiliconPlanes();subjectPlane++){
// if(!eventReader->useForAlignment()&&!eventReader->useForAnalysis())
// continue;
vector<UInt_t>refPlanes;
for(UInt_t refPlane=0;refPlane<TPlaneProperties::getNSiliconPlanes();refPlane++)
if(subjectPlane!=refPlane)refPlanes.push_back(refPlane);
TPositionPrediction* pred = eventReader->predictPosition(subjectPlane,refPlanes,false);
Float_t predictedStripPositionX = eventReader->getPositionInDetSystem(subjectPlane*2,pred->getPositionX(),pred->getPositionY());
Float_t predictedStripPositionY = eventReader->getPositionInDetSystem(subjectPlane*2+1,pred->getPositionX(),pred->getPositionY());
UInt_t stripMiddleX=(UInt_t) (predictedStripPositionX+0.5);
Float_t deltaX = predictedStripPositionX-stripMiddleX;
// histoStripDistribution.at(subjectPlane*2)->Fill(deltaX);
UInt_t stripMiddleY=(UInt_t) (predictedStripPositionY+0.5);
Float_t deltaY = predictedStripPositionY-stripMiddleY;
// histoStripDistribution.at(subjectPlane*2)->Fill(deltaY);
Int_t binX=histoStripDistributionFlattned.at(subjectPlane)->FindBin(deltaX);
Int_t binY=histoStripDistributionFlattned.at(subjectPlane)->FindBin(deltaY);
if(histoStripDistributionFlattned.at(subjectPlane*2)->GetBinContent(binX)<vecMinEntries.at(subjectPlane*2)){
vecEventNo[subjectPlane*2].push_back(nEvent);
histoStripDistributionFlattned.at(subjectPlane*2)->Fill(deltaX);
}
if(histoStripDistributionFlattned.at(subjectPlane*2+1)->GetBinContent(binY)<vecMinEntries.at(subjectPlane*2+1)){
vecEventNo[subjectPlane*2+1].push_back(nEvent);
histoStripDistributionFlattned.at(subjectPlane*2+1)->Fill(deltaY);
}
}
}
for(UInt_t det =0; det<TPlaneProperties::getNSiliconDetectors();det++){
cout<<"save histogram: "<<det<<" "<<histoStripDistributionFlattned.at(det)->GetTitle()<<" "<<histoStripDistribution.at(det)->GetTitle()<<endl;
histSaver->SaveHistogram(histoStripDistributionFlattned.at(det));
correctedEtaFile->Add(histoStripDistributionFlattned.at(det));
histSaver->SaveHistogram(histoStripDistribution.at(det));
correctedEtaFile->Add(histoStripDistribution.at(det));
}
cout<<"\n\ncreate eta correction histo"<<endl;
for(UInt_t det =0; det<TPlaneProperties::getNSiliconDetectors();det++){
for(UInt_t i=0;i<vecEventNo[det].size();i++){
nEvent= vecEventNo[det].at(i);
eventReader->LoadEvent(nEvent);
if(!eventReader->useForAlignment()&&!eventReader->useForAnalysis())
continue;
Float_t eta = eventReader->getCluster(det,0).getEta();
vecHEta.at(det)->Fill(eta);
}
stringstream histName;
histName<<"hEtaIntegral"<<"_step"<<correctionStep<<"_"<<TPlaneProperties::getStringForDetector(det);;
// UInt_t nBins = vecHEta.at(det)->GetNbinsX();
TH1F *histo= TClustering::createEtaIntegral(vecHEta.at(det),histName.str());
cout<<"save "<<vecHEta.at(det)->GetTitle()<<" "<<vecHEta.at(det)->GetEntries()<<endl;
histSaver->SaveHistogram(vecHEta.at(det));
correctedEtaFile->Add(vecHEta.at(det));
cout<<"save "<<histo->GetTitle()<<" "<<histo->GetEntries()<<endl;
histSaver->SaveHistogram(histo);
correctedEtaFile->Add((TH1F*)histo->Clone());
}
correctedEtaFile->Write();
cout<<"Closing "<<correctedEtaFile->GetName()<<endl;
for(UInt_t i=0;i<histoStripDistribution.size();i++)
cout<<histoStripDistribution.at(i)<<" "<<flush;
cout<<endl;
for(UInt_t i =0;i<histoStripDistribution.size();i++)
cout<<histoStripDistributionFlattned.at(i)<<" "<<flush;
cout<<endl;
for(UInt_t i =0;i<histoStripDistribution.size();i++)
cout<<vecHEta.at(i)<<" "<<flush;
}