163 char speciesName[500];
168 TTree*
tree = (TTree*)file->Get(
"species");
169 tree->SetBranchAddress(
"speciesID", &speciesID);
170 tree->SetBranchAddress(
"number", &number);
171 tree->SetBranchAddress(
"nEvent", &nEvent);
172 tree->SetBranchAddress(
"speciesName", &speciesName);
173 tree->SetBranchAddress(
"time", &time);
174 tree->SetBranchAddress(
"sumG", &sumG);
175 tree->SetBranchAddress(
"sumG2", &sumG2);
177 Long64_t nentries = tree->GetEntries();
182 cout <<
"No entries found in the tree species contained in the file "
183 << file->GetPath() << endl;
191 std::map<int, std::map<double, SpeciesInfoAOS>> speciesTimeInfo;
193 for (
int j=0; j < nentries; j++)
201 infoAOS.
fG2 += sumG2;
203 infoAOS.
fName = speciesName;
208 std::map<int, SpeciesInfoSOA> speciesInfo;
210 auto it_SOA = speciesTimeInfo.begin();
211 auto end_SOA = speciesTimeInfo.end();
213 for (; it_SOA!=end_SOA ; ++it_SOA)
215 const int _speciesID = it_SOA->first;
218 auto it2 = it_SOA->second.begin();
219 auto end2 = it_SOA->second.end();
221 info.
fName = it2->second.fName;
222 const size_t size2 = it_SOA->second.size();
223 info.
fG.resize(size2);
224 info.
fGerr.resize(size2);
225 info.
fTime.resize(size2);
227 for(
int i2 = 0 ;it2!=end2;++it2, ++i2)
231 double _SumG2 = infoAOS.
fG2;
232 double _MeanG = infoAOS.
fG/infoAOS.
fNEvent;
233 double _Gerr = sqrt((_SumG2/infoAOS.
fNEvent - pow(_MeanG,2))
236 info.
fG[i2] = _MeanG;
237 info.
fGerr[i2] = _Gerr;
238 info.
fTime[i2] = it2->first;
239 info.
fRelatErr += _Gerr/(_MeanG + 1e-30);
245 #ifdef USE_CANVASINTAB
250 std::map<int, SpeciesInfoSOA>::iterator it = speciesInfo.begin();
251 std::map<int, SpeciesInfoSOA>::iterator end = speciesInfo.end();
253 for (; it != end; ++it)
255 speciesID = it->first;
259 if(info.
fG.empty())
continue;
261 TGraphErrors* gSpecies =
new TGraphErrors(info.
fG.size(),
267 #ifdef USE_CANVASINTAB
270 TCanvas* cSpecies = myFrame->
GetCanvas(nCanvas);
272 TCanvas* cSpecies =
new TCanvas(info.
fName.c_str(),
277 int color = (2+speciesID)%TColor::GetNumberOfColors();
278 if(color == 5 || color==10 || color==0) ++color;
282 gSpecies->SetMarkerStyle(20+speciesID);
283 gSpecies->SetMarkerColor(color);
286 gSpecies->SetTitle((info.
fName
288 + std::to_string(speciesID)+
" rel. Err. "
289 + std::to_string(info.
fRelatErr)).c_str() );
290 gSpecies->GetXaxis()->SetTitle(
"Time [ns]");
291 gSpecies->GetYaxis()->SetTitle(
"G [molecules/100 eV]");
292 gSpecies->Draw(
"ap");
296 #ifdef USE_CANVASINTAB
298 for(
int i = 0 ; i < nCanvas ; ++i)
const XML_Char XML_Encoding * info
std::vector< double > fTime
TCanvas * GetCanvas(int i)
std::vector< double > fGerr
size_t GetNCanvas() const
size_t AddCanvas(const char *name="New tab")