171 std::cout <<
"Empty" << std::endl;
179 auto currIt =
fScalerMap.find(address)->second.lower_bound(time);
181 if(currIt ==
fScalerMap.find(address)->second.end()) {
182 return std::prev(
fScalerMap.find(address)->second.end())->second[index] /
186 if(currIt ==
fScalerMap.find(address)->second.begin()) {
187 return fScalerMap.find(address)->second.begin()->second[index];
190 return (currIt->second[index]) - (std::prev(currIt)->second[index]);
193 for(Long64_t entry = 0; entry <
fEntries; ++entry) {
194 fTree->GetEntry(entry);
198 for(--entry; entry >= 0; --entry) {
207 for(--entry; entry >= 0; --entry) {
211 for(--entry; entry >= 0; --entry) {
260 std::cout <<
"Empty" << std::endl;
266 fHist[address] =
nullptr;
269 if(
fPPG ==
nullptr) {
272 if(
fPPG ==
nullptr) {
277 TString opt = option;
280 Int_t opt_index = opt.Index(
"redraw");
281 if(
fHist[address] ==
nullptr || opt_index >= 0) {
284 if(
fHist[address] ==
nullptr) {
286 fHist[address] =
new TH1D(Form(
"TScalerHist_%04x", address),
287 Form(
"scaler %d vs time in cycle for address 0x%04x; time in cycle [ms]; counts/%.0f ms",
288 static_cast<int>(index), address,
static_cast<double>(
fPPG->
GetCycleLength()) / 1e5 / nofBins),
294 UInt_t previousValue = 0;
295 for(Long64_t entry = 0; entry <
fEntries; ++entry) {
296 fTree->GetEntry(entry);
300 if(previousValue != 0 && previousValue < fScalerData->
GetScaler(index)) {
306 if(entry % 1000 == 0) {
307 std::cout << std::setw(3) << (100 * entry) /
fEntries <<
" % done\r" << std::flush;
310 std::cout <<
"100 % done\r" << std::flush;
314 opt.Remove(opt_index, 6);
317 fHist[address]->Draw(opt);
319 return fHist[address];
322TH1D*
TScaler::Draw(UInt_t lowAddress, UInt_t highAddress,
size_t index, Option_t* option)
329 std::cout <<
"Empty" << std::endl;
334 if(
fPPG ==
nullptr) {
337 if(
fPPG ==
nullptr) {
342 TString opt = option;
345 Int_t draw_index = opt.Index(
"redraw");
346 Int_t single_index = opt.Index(
"single");
348 if(single_index < 0) {
352 fHistRange[std::make_pair(lowAddress, highAddress)] =
nullptr;
354 if(
fHistRange[std::make_pair(lowAddress, highAddress)] ==
nullptr || draw_index >= 0) {
356 fHistRange[std::make_pair(lowAddress, highAddress)] =
357 new TH1D(Form(
"TScalerHist_%04x_%04x", lowAddress, highAddress),
358 Form(
"scaler %d vs time in cycle for address 0x%04x - 0x%04x; time in cycle [ms]; counts/%.0f ms",
359 static_cast<int>(index), lowAddress, highAddress,
static_cast<double>(
fPPG->
GetCycleLength()) / 1e5 / nofBins),
364 std::map<UInt_t, UInt_t> previousValue;
366 for(Long64_t entry = 0; entry <
fEntries; ++entry) {
367 fTree->GetEntry(entry);
373 fHistRange[std::make_pair(lowAddress, highAddress)]->Fill(
379 if(entry % 1000 == 0) {
380 std::cout << std::setw(3) << (100 * entry) /
fEntries <<
" % done\r" << std::flush;
383 std::cout <<
"100 % done\r" << std::flush;
386 if(draw_index >= 0) {
387 opt.Remove(draw_index, 6);
390 if(single_index >= 0) {
391 opt.Remove(single_index, 6);
394 fHistRange[std::make_pair(lowAddress, highAddress)]->Draw(opt);
396 return fHistRange[std::make_pair(lowAddress, highAddress)];
399 for(UInt_t address = lowAddress; address <= highAddress; ++address) {
404 new TH1D(Form(
"TScalerHist_%04x", address),
405 Form(
"scaler %d vs time in cycle for address 0x%04x; time in cycle [ms]; counts/%.0f ms",
406 static_cast<int>(index), address,
static_cast<double>(
fPPG->
GetCycleLength()) / 1e5 / nofBins),
410 fHist[address]->Reset();
412 fHist[address]->SetLineColor(
static_cast<Color_t
>(address - lowAddress + 1));
415 std::map<UInt_t, UInt_t> previousValue;
417 for(Long64_t entry = 0; entry <
fEntries; ++entry) {
418 fTree->GetEntry(entry);
430 if(entry % 1000 == 0) {
431 std::cout << std::setw(3) << (100 * entry) /
fEntries <<
" % done\r" << std::flush;
434 std::cout <<
"100 % done\r" << std::flush;
435 Double_t max =
fHist[lowAddress]->GetMaximum();
436 for(UInt_t address = lowAddress + 1; address <= highAddress; ++address) {
437 if(max <
fHist[address]->GetMaximum()) {
438 max =
fHist[address]->GetMaximum();
441 fHist[lowAddress]->GetYaxis()->SetRangeUser(0., 1.05 * max);
442 fHist[lowAddress]->Draw();
443 for(UInt_t address = lowAddress + 1; address <= highAddress; ++address) {
444 fHist[address]->Draw(
"same");
447 return fHist[lowAddress];
454 std::cout <<
"Empty" << std::endl;
458 TString opt = option;
460 int nofBins = std::abs(
static_cast<int>(1e9 * (hightime - lowtime) /
static_cast<double>(
GetTimePeriod(address))));
461 std::cout << nofBins <<
"nofbins" << std::endl;
464 new TH1D(Form(
"TScalerHistRaw_%04x", address),
465 Form(
"scaler %d vs time for address 0x%04x; time in [ms]; counts/ ms",
static_cast<int>(index), address),
466 nofBins, lowtime, hightime);
469 UInt_t previousValue = 0;
470 for(Long64_t entry = 0; entry <
fEntries; ++entry) {
471 fTree->GetEntry(entry);
475 if(previousValue != 0 && previousValue < fScalerData->
GetScaler(index)) {
480 if(entry % 1000 == 0) {
481 std::cout << std::setw(3) << (100 * entry) /
fEntries <<
" % done\r" << std::flush;
484 std::cout <<
"100 % done\r" << std::flush;