本文整理汇总了C++中TLeaf::GetLen方法的典型用法代码示例。如果您正苦于以下问题:C++ TLeaf::GetLen方法的具体用法?C++ TLeaf::GetLen怎么用?C++ TLeaf::GetLen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TLeaf
的用法示例。
在下文中一共展示了TLeaf::GetLen方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getDataProfile
void DataInterface::getDataProfile(TH2F *hProfile, TH2F *hProjection, Int_t energy) {
if (!existsEnergyFile(energy)) {
cout << "There are no data files with energy " << energy << endl;
return;
}
TString fn = Form("Data/ExperimentalData/DataFrame_%i_MeV.root", energy);
TFile *f = new TFile(fn);
TTree *tree = (TTree*) f->Get("tree");
Int_t nentries = tree->GetEntries();
printf("Found %d frames in the DataFrame.\n", nentries);
TLeaf *lX = tree->GetLeaf("fDataFrame.fX");
TLeaf *lY = tree->GetLeaf("fDataFrame.fY");
TLeaf *lLayer = tree->GetLeaf("fDataFrame.fLayer");
Float_t x, y, layer;
for (Int_t i=0; i<nentries; i++) {
tree->GetEntry(i);
for (Int_t j=0; j<lY->GetLen(); j++) {
x = lX->GetValue(j) + nx/2;
y = lY->GetValue(j) + ny/2;
layer = lLayer->GetValue(j);
hProfile->Fill(y, layer);
hProjection->Fill(x, y);
}
}
}
示例2: getlist
void getlist(ostream& out, TBranch* branch, int depth=0)
{
TObjArray* array = branch->GetListOfBranches();
if ( ! array ) return;
if ( depth > 10 ) return;
string name;
int nitems = array->GetEntries();
for (int i = 0; i < nitems; i++)
{
TBranch* b = (TBranch*)((*array)[i]);
if ( ! b ) continue;
string branchname(b->GetName());
out << SPACE.substr(0,4*depth) << branchname << endl;
TObjArray* a = b->GetListOfLeaves();
if ( a )
{
int n = a->GetEntries();
{
for (int j = 0; j < n; j++)
{
TLeaf* leaf = (TLeaf*)((*a)[j]);
int count = 0;
int ndata = 0;
TLeaf* leafc = leaf->GetLeafCounter(count);
if ( ! leafc)
ndata = leaf->GetLen();
else
ndata = leafc->GetMaximum();
string leafname(leaf->GetName());
out << SPACE.substr(0,4*(depth+1))
<< ndata << " " << leafname << endl;
}
}
// else if ( n == 1 )
// {
// TBranch* bc = (TBranch*)((*a)[j]);
// string leafname(bc->GetName());
// if ( leafname != branchname )
// out << SPACE.substr(0,4*(depth+1)) << leafname << endl;
// }
}
getlist(out, b, depth+1);
}
}
示例3: getDataFrame
void DataInterface::getDataFrame(Int_t runNo, CalorimeterFrame * cf, Int_t energy) {
if (!existsEnergyFile(energy)) {
cout << "There are no data files with energy " << energy << endl;
return;
}
Int_t eventIdFrom = runNo * kEventsPerRun;
Int_t eventIdTo = eventIdFrom + kEventsPerRun;
TString fn = Form("Data/ExperimentalData/DataFrame_%i_MeV.root", energy);
TFile *f = new TFile(fn);
TTree *tree = (TTree*) f->Get("tree");
Int_t nentries = tree->GetEntries();
if (eventIdTo > nentries) {
eventIdTo = nentries;
}
cout << "Found " << nentries << " frames in the DataFrame.\n";
TLeaf *lX = tree->GetLeaf("fDataFrame.fX");
TLeaf *lY = tree->GetLeaf("fDataFrame.fY");
TLeaf *lLayer = tree->GetLeaf("fDataFrame.fLayer");
Int_t counter = 0;
for (Int_t i=eventIdFrom; i<eventIdTo; i++) {
tree->GetEntry(i);
for (Int_t j=0; j<lX->GetLen(); j++) {
Int_t x = lX->GetValue(j) + nx/2;
Int_t y = lY->GetValue(j) + ny/2;
Int_t z = lLayer->GetValue(j);
cf->fillAt(z, x, y);
}
counter++;
}
delete f;
}