Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions Detectors/TOF/prototyping/convertTreeTo02object.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
void convertTreeTo02object(){

TFile* fout = TFile::Open("TOFcalibTreeOut.root", "RECREATE");
TTree* tout = new TTree("calibTOF", "Calib TOF infos");

TFile* f = TFile::Open("TOFcalibTree.root");
TTree* t = (TTree*)f->Get("aodTree");
std::vector<o2::dataformats::CalibInfoTOF> mCalibInfoTOF;
tout->Branch("TOFCalibInfo", &mCalibInfoTOF);

Printf("The tree has %lld entries", t->GetEntries());
for (int ientry = 1; ientry <= t->GetEntries(); ientry++){
if (ientry % 100 == 0) Printf("processing event %d", ientry);
//for (int ientry = 1; ientry <= 3; ientry++){
t->GetEntry(ientry);
for (int i = 0; i < t->GetLeaf("nhits")->GetValue(); i++){
mCalibInfoTOF.emplace_back(t->GetLeaf("index")->GetValue(i), t->GetLeaf("time")->GetValue(i) - t->GetLeaf("texp")->GetValue(i), t->GetLeaf("tot")->GetValue(i) );
}
tout->Fill();
mCalibInfoTOF.clear();
}


fout->cd();
tout->Write();
}