TFile *file = TFile::Open("/Users/emoyse/Documents/MuonTruthSummary.root");
const Int_t nLevels = 3;
TH2F *etaPhi[nLevels];
TH2F *stations[nLevels];
TTreeReaderArray< Int_t >* stationEtas[nLevels];
TTreeReaderArray< Int_t >* stationPhis[nLevels];
TTreeReader myReader("MuonTruthSummaryTree", file);
for (UInt_t level=0 ; level<nLevels ; ++level){
TString levelText = TString::UItoa(level,10);
etaPhi[level] = new TH2F("etaPhi"+levelText,"Missed hits - "+levelText,20,-10,10, 50,0, 50 ); // Will change this once I get eta/phi conversions working.
stations[level] = new TH2F("stations"+levelText,"Missed hits - "+levelText,5,0,5, 8,0, 8 );
stationEtas[level] = new TTreeReaderArray< Int_t >(myReader, "MissedHitStationEtaForLevel"+levelText);
stationPhis[level] = new TTreeReaderArray< Int_t >(myReader, "MissedHitStationPhiForLevel"+levelText);
}
while (myReader.Next()) {
// std::cout<<"size(): "<<stationEtas->size()<<std::endl;
for (UInt_t level=0 ; level<nLevels ; ++level){
for (UInt_t index = 0; index<stationEtas[level]->GetSize() ; ++index){
TTreeReaderArray< Int_t >* test1 = stationEtas[level];
std::cout<<" eta: "<<(*test1)[index]<<std::endl;
}
}
}
I guess I’m doing something wrong though, as when I try to run this I get:
[quote]Error in <CreateContentProxy()>: Cannot determine the type contained in the collection of branch MissedHitStationEtaForLevel0. That’s weird - please report!
[/quote]
I can’t see what the problem is … does anyone have an idea?
I have been having issues with TTreeReader, which I think are related to the issues raised in this post. I have setup TTreeReader to retrieve a branch, and then fill a histogram with the information stored in this branch.
Error in <CreateContentProxy()>: Cannot determine the type contained in the collection of branch jet_akt10LCTopoTrimmedPtFrac5SmallR20_calib_m. That's weird - please report
This is the same error which has been previously reported. I haven’t yet found an adequate solution to this problem. I have also tried the suggestion in this post of changing TTreeReaderArray<Float_T> to TTreeReaderValue<std::vector<Float_t>>, but this isn’t going to work since I need to use an Array to access GetSize() and At(). Does anybody know if there is a fix in TTreeReader which removes this issue, if it is a bug?
The root file is too large to attach, but the content of the CollectionTree is: RunNumber, EventNumber, mu, NPV, ttbarEventCat, zRecoVertex (the types of these leaves are successfully found by the reader), then the remaining leaves are of the form jet_akt10LCTopoTrimmedPtFrac5SmallR20_*, for example * = uncalib_m, uncalib_pt, calib_m, calib_pt, trkmass etc. These are all contain jet information.