本文整理汇总了C++中TClonesArray::Expand方法的典型用法代码示例。如果您正苦于以下问题:C++ TClonesArray::Expand方法的具体用法?C++ TClonesArray::Expand怎么用?C++ TClonesArray::Expand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TClonesArray
的用法示例。
在下文中一共展示了TClonesArray::Expand方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IlcAODEvent
addObjectDuringAODCreation() {
// add an object to an aod and write it
TFile *aodFile = TFile::Open("addAOD.root", "RECREATE");
// create an IlcAOD object
IlcAODEvent *aod = new IlcAODEvent();
aod->CreateStdContent();
// add new information, we use IlcESDtracks for now
TClonesArray *tracks = new TClonesArray("IlcESDtrack", 0);
aod->AddObject(tracks);
// go to the file
aodFile->cd();
// create the tree
TTree *aodTree = new TTree("aodTree", "IlcAOD tree");
aodTree->Branch(aod->GetList());
for (Int_t iEvent = 0; iEvent < 10; ++iEvent) {
// add (part of) standard information
IlcAODHeader *header = aod->GetHeader();
tracks->Delete(); // delete old objects
tracks->Expand(iEvent+5/* just to make it a different number each time*/); // expand container (just for speed)
// fill TClonesArray
TClonesArray &rTracks = *tracks;
for (Int_t i = 0; i< iEvent+5; i++) {
new(rTracks[i]) IlcESDtrack();
}
// fill the tree for this event
aodTree->Fill();
} // end of event loop
aodTree->GetUserInfo()->Add(aod);
// write the tree to the specified file
aodFile = aodTree->GetCurrentFile();
aodFile->cd();
aodTree->Write();
}