Hy,
I am very sorry, because this is not the first time I request help for data frames, but I really would like to be able to definitively adopt data frames, and this is really not straight forward to me.
Please find here a really simple example of few lines reading a TChain with a very basic way. The only ways I have found to write it in data frames are taking 10 times more lines, so I guess I am not doing what I should. Can you please help to convert these few line to have the same result with data frames ?
TChain *fchain = new TChain("TreeMaster");
fchain->Add("Out/Analysis/Tree_0000.root");
int maxHits=36;
Int_t nbHits;
Float_t hitX[maxHits];
Float_t hitY[maxHits];
Float_t hitZ[maxHits];
Int_t hitSg[maxHits];
Int_t hitId[maxHits];
fchain->SetBranchAddress("nbHits",&nbHits);
fchain->SetBranchAddress("hitX",hitX);
fchain->SetBranchAddress("hitY",hitY);
fchain->SetBranchAddress("hitZ",hitZ);
fchain->SetBranchAddress("hitSg",hitSg);
fchain->SetBranchAddress("hitId",hitId);
map<int, array<TH2F*,6>> fHistos;
for(Long64_t entry=0 ; entry<fchain->GetEntries() ; entry++) {
fchain->GetEntry(entry);
for(int mul=0 ; mul<nbHits ; mul++) {
Int_t Det = hitId[mul];
Int_t Seg = hitSg[mul];
Int_t Slice = Seg%6;
if(!fHistos.count(Det)) {
for(int i=0 ; i<6 ; i++) fHistos[Det].at(i) = new TH2F(Form("Det%d_Slice%d",Det,i),Form("Det%d_Slice%d",Det,i),100,-50,50,100,-50,50);
}
fHistos[Det].at(Slice)->Fill(hitX[mul],hitY[mul]);
}
}
Thanks in advance for your help
Jérémie
ROOT Version: 6.26/04
Platform: MacOS