AliRoot Core  da88d91 (da88d91)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliMUONBusPatchEvolution.cxx
Go to the documentation of this file.
2 
19 
23 
24 #include "AliCDBManager.h"
25 #include "AliDAQ.h"
26 #include "AliLog.h"
27 #include "AliMergeableCollection.h"
28 #include "AliMpBusPatch.h"
29 #include "AliMpCDB.h"
30 #include "AliMpDCSNamer.h"
31 #include "AliMpDDL.h"
32 #include "AliMpDDLStore.h"
33 #include "AliMpDEIterator.h"
34 #include "AliMpDEManager.h"
35 #include "AliMpDetElement.h"
36 #include "TH1F.h"
37 #include "TList.h"
38 #include "TMath.h"
39 #include "TObjArray.h"
40 #include "TObjString.h"
41 #include "TString.h"
42 #include <cassert>
43 #include <iostream>
44 #include <set>
45 
46  //_________________________________________________________________________________________________
48  : TObject(), fBPEVO(hc), fNofPads()
49 {
51 }
52 
53 //_________________________________________________________________________________________________
55  const std::map<int, int>& nofPadsPerBusPatch)
56  : TObject(), fBPEVO(hc), fNofPads(nofPadsPerBusPatch)
57 {
58 }
59 
60 //_________________________________________________________________________________________________
62 {
69 
70  if (FillNumberOfPads()) {
71  std::vector<int> timeResolutions;
72 
73  GetTimeResolutions(timeResolutions);
74 
75  AliInfo(Form("Number of time resolutions found : %lu", timeResolutions.size()));
76 
78 
79  for (std::vector<int>::size_type i = 0; i < timeResolutions.size(); ++i) {
80  AliInfo(Form("TimeResolution: %ds", timeResolutions[i]));
81  const int tr = timeResolutions[i];
82  GroupByDE(tr);
83  GroupByDDL(tr);
84  GroupByChamber(tr);
85  GroupByStation(tr);
86  }
87  Normalize();
88  }
89 }
90 
91 //_________________________________________________________________________________________________
93 {
96 
97  if (!fNofPads.empty())
98  return;
99 
100  AliCDBManager* cdbm = AliCDBManager::Instance();
101 
102  if (!cdbm->IsDefaultStorageSet()) {
103  Long_t id, size, flags, modtime;
104  TDatime now;
105 
106  TString testPath;
107 
108  testPath.Form("/cvmfs/alice-ocdb.cern.ch/calibration/data/%d/OCDB", now.GetYear());
109 
110  if (!gSystem->GetPathInfo(testPath.Data(), &id, &size, &flags, &modtime)) {
111  if (flags & 0x1) {
112  cdbm->SetDefaultStorage(Form("local://%s", testPath.Data()));
113  }
114  }
115  else {
116  cdbm->SetDefaultStorage("raw://");
117  }
118  }
119 
120  cdbm->SetRun(0);
121 
123 
124  TIter next(AliMpDDLStore::Instance()->CreateBusPatchIterator());
125  AliMpBusPatch* bp;
126 
127  Int_t total(0);
128 
129  while ((bp = static_cast<AliMpBusPatch*>(next()))) {
130  Int_t npads(0);
131 
132  Int_t detElemId = AliMpDDLStore::Instance()->GetDEfromBus(bp->GetId());
133 
135 
136  for (Int_t i = 0; i < bp->GetNofManus(); ++i) {
137  Int_t manuId = bp->GetManuId(i);
138 
139  npads += de->NofChannelsInManu(manuId);
140  }
141 
142  fNofPads[bp->GetId()] = npads;
143 
144  total += npads;
145  }
146 
147  assert(total == 1064008);
148 }
149 
150 //_________________________________________________________________________________________________
151 TH1* AliMUONBusPatchEvolution::ExpandTimeAxis(const TH1& h, Int_t expansionTime, Int_t timeResolution)
152 {
155 
156  if (timeResolution < 0) {
157  timeResolution = GetTimeResolution(h);
158  }
159 
160  if (timeResolution <= 0)
161  return 0x0;
162 
163  const TAxis* timeAxis = h.GetXaxis();
164 
165  Int_t extraBins = TMath::Nint(TMath::Abs(expansionTime) / timeResolution);
166 
167  Int_t nbins = timeAxis->GetNbins() + extraBins;
168  Double_t xmin = timeAxis->GetXmin();
169  Double_t xmax = timeAxis->GetXmax();
170 
171  TTimeStamp origin;
172  GetTimeOffset(h, origin);
173 
174  Int_t makeRoomBefore = 0;
175 
176  if (expansionTime < 0) {
177  makeRoomBefore = 1;
178  xmin += expansionTime;
179  }
180  else {
181  xmax += expansionTime;
182  }
183 
184  TH1* hnew = new TH1F(h.GetName(), h.GetTitle(), nbins, xmin, xmax);
185  hnew->SetDirectory(0);
186  hnew->GetXaxis()->SetTimeDisplay(1);
187  hnew->GetXaxis()->SetTimeFormat(timeAxis->GetTimeFormat());
188 
189  for (Int_t i = 1; i <= timeAxis->GetNbins(); ++i) {
190  hnew->SetBinContent(i + extraBins*makeRoomBefore, h.GetBinContent(i));
191  hnew->SetBinError(i + extraBins*makeRoomBefore, h.GetBinError(i));
192  }
193 
194  if (expansionTime < 0) {
196  TTimeStamp origin;
197  GetTimeOffset(h, origin);
198  UInt_t ot = origin.GetSec();
199  ot += expansionTime;
200  origin.SetSec(ot);
201  hnew->GetXaxis()->SetTimeOffset(origin.GetSec(), "gmt");
202  GetTimeOffset(*hnew, origin);
203  }
204 
205  return hnew;
206 }
207 
208 //_________________________________________________________________________________________________
210 {
213 
214  assert(fNofPads.size() == 888);
215 
216  if (fBPEVO.Histo("/BUSPATCH/NPADS/BP0001")) {
217  // work already done
218  AliWarning("Already done. Not re-doing it...");
219  return kFALSE;
220  }
221 
222  Int_t total(0);
223 
224  AliMpDCSNamer dcs("TRACKER");
225 
226  std::map<int, int>::const_iterator it;
227 
228  for (it = fNofPads.begin(); it != fNofPads.end(); ++it) {
229  int busPatchId = it->first;
230  int npads = it->second;
231 
232  TH1* h = new TH1F(Form("BP%04d", busPatchId), "number of pads", 1, 0, 1);
233 
234  Int_t detElemId = AliMpDDLStore::Instance()->GetDEfromBus(busPatchId);
235 
237 
238  h->Fill(0.0, 1.0 * npads);
239 
240  TH1* hde = fBPEVO.Histo(Form("/DE/NPADS/DE%04d", detElemId));
241  if (!hde) {
242  hde = new TH1F(Form("DE%04d", detElemId), "number of pads", 1, 0, 1);
243  fBPEVO.Adopt("/DE/NPADS/", hde);
244  }
245  hde->Fill(0.0, 1.0 * npads);
246 
247  Int_t ddlId = de->GetDdlId() + AliDAQ::DdlIDOffset("MUONTRK");
248 
249  TH1* hddl = fBPEVO.Histo(Form("/DDL/NPADS/DDL%d", ddlId));
250  if (!hddl) {
251  hddl = new TH1F(Form("DDL%d", ddlId), "number of pads", 1, 0, 1);
252  fBPEVO.Adopt("/DDL/NPADS/", hddl);
253  }
254  hddl->Fill(0.0, 1.0 * npads);
255 
256  Int_t chamberId = 1 + AliMpDEManager::GetChamberId(detElemId);
257  Int_t stationId = 1 + AliMpDEManager::GetChamberId(detElemId) / 2;
258 
259  TH1* hchamberSide(0x0);
260  TH1* hstationSide(0x0);
261 
262  if (dcs.DCSAliasName(detElemId).Contains("Left")) {
263  hchamberSide = fBPEVO.Histo(Form("/CHAMBER/NPADS/CHAMBER%dLEFT", chamberId));
264  if (!hchamberSide) {
265  hchamberSide = new TH1F(Form("CHAMBER%dLEFT", chamberId), "number of pads", 1, 0, 1);
266  fBPEVO.Adopt("/CHAMBER/NPADS/", hchamberSide);
267  }
268  hstationSide = fBPEVO.Histo(Form("/STATION/NPADS/STATION%dLEFT", stationId));
269  if (!hstationSide) {
270  hstationSide = new TH1F(Form("STATION%dLEFT", stationId), "number of pads", 1, 0, 1);
271  fBPEVO.Adopt("/STATION/NPADS/", hstationSide);
272  }
273  }
274  else {
275  if (dcs.DCSAliasName(detElemId).Contains("Right")) {
276  hchamberSide = fBPEVO.Histo(Form("/CHAMBER/NPADS/CHAMBER%dRIGHT", chamberId));
277  if (!hchamberSide) {
278  hchamberSide = new TH1F(Form("CHAMBER%dRIGHT", chamberId), "number of pads", 1, 0, 1);
279  fBPEVO.Adopt("/CHAMBER/NPADS/", hchamberSide);
280  }
281  hstationSide = fBPEVO.Histo(Form("/STATION/NPADS/STATION%dRIGHT", stationId));
282  if (!hstationSide) {
283  hstationSide = new TH1F(Form("STATION%dRIGHT", stationId), "number of pads", 1, 0, 1);
284  fBPEVO.Adopt("/STATION/NPADS/", hstationSide);
285  }
286  }
287  }
288 
289  hchamberSide->Fill(0.0, 1.0 * npads);
290  hstationSide->Fill(0.0, 1.0 * npads);
291 
292  TH1* hchamber = fBPEVO.Histo(Form("/CHAMBER/NPADS/CHAMBER%d", chamberId));
293  if (!hchamber) {
294  hchamber = new TH1F(Form("CHAMBER%d", chamberId), "number of pads", 1, 0, 1);
295  fBPEVO.Adopt("/CHAMBER/NPADS/", hchamber);
296  }
297  hchamber->Fill(0.0, 1.0 * npads);
298 
299  TH1* hstation = fBPEVO.Histo(Form("/STATION/NPADS/STATION%d", stationId));
300  if (!hstation) {
301  hstation = new TH1F(Form("STATION%d", stationId), "number of pads", 1, 0, 1);
302  fBPEVO.Adopt("/STATION/NPADS/", hstation);
303  }
304  hstation->Fill(0.0, 1.0 * npads);
305 
306  total += npads;
307 
308  fBPEVO.Adopt("/BUSPATCH/NPADS/", h);
309  }
310 
311  return kTRUE;
312 }
313 
314 //_________________________________________________________________________________________________
315 Bool_t AliMUONBusPatchEvolution::GetTimeOffset(const TH1& h, TTimeStamp& origin)
316 {
320 
321  const TAxis* x = h.GetXaxis();
322 
323  if (x->GetTimeDisplay()) {
324  TString tf = x->GetTimeFormat();
325  Int_t ix = tf.Index('F');
326  Int_t year, month, day;
327  Int_t hour, minute, second;
328  sscanf(tf(ix + 1, tf.Length() - ix - 1).Data(), "%4d-%02d-%02d %02d:%02d:%02d", &year, &month, &day, &hour, &minute,
329  &second);
330  origin.Set(year, month, day, hour, minute, second, 0, kTRUE, 0);
331  return kTRUE;
332  }
333  else {
334  return kFALSE;
335  }
336 }
337 
338 //_________________________________________________________________________________________________
340 {
341  // we assume the title ends with "xxx s bins"
342  // and we try to find xxx ...
343 
344  TString title = h.GetTitle();
345 
346  int timeResolution(-1);
347 
348  TObjArray* a = title.Tokenize(" ");
349  TString last = static_cast<TObjString*>(a->Last())->String();
350  TString m = static_cast<TObjString*>(a->At(a->GetLast() - 1))->String();
351 
352  if (last != "bins" || m != "s") {
353  std::cerr << "Histogram title does not match the expected pattern (... xxx s bins) : " << std::endl
354  << h.GetTitle() << std::endl;
355  }
356  else {
357  timeResolution = static_cast<TObjString*>(a->At(a->GetLast() - 2))->String().Atoi();
358  }
359  delete a;
360 
361  return timeResolution;
362 }
363 
364 //_________________________________________________________________________________________________
365 void AliMUONBusPatchEvolution::GetTimeResolutions(std::vector<int>& timeResolutions)
366 {
367  TIter next(fBPEVO.CreateIterator());
368 
369  TH1F* h(0x0);
370 
371  while ((h = static_cast<TH1F*>(next()))) {
372  if (TString(h->GetName()).BeginsWith("Nevents")) {
373  int tr = GetTimeResolution(*h);
374  if (tr > 0) {
375  timeResolutions.push_back(tr);
376  }
377  }
378  }
379 }
380 
381 //______________________________________________________________________________
382 Bool_t AliMUONBusPatchEvolution::GetFaultyBusPatches(int timeResolution, int requiredEvents, float occupancyThreshold,
383  std::map<int, double>& faultyBusPatchOccupancies)
384 {
388 
389  // find how many bins should be considered, by finding in the Nevents histogram
390  // how many of the latest bins are required to get an integral >= requiredEvents
391  TH1* hnevents = fBPEVO.Histo(Form("Nevents%ds", timeResolution));
392 
393  int lastbin(0);
394 
395  for (int i = hnevents->GetXaxis()->GetNbins() - 1; i > 0 && lastbin == 0; --i) {
396  if (hnevents->GetBinContent(i) > 1)
397  lastbin = i;
398  }
399 
400  float nevents(0);
401 
402  int firstbin = lastbin;
403 
404  for (firstbin = lastbin; firstbin > 0; --firstbin) {
405  nevents += hnevents->GetBinContent(firstbin);
406  if (nevents > requiredEvents)
407  break;
408  }
409 
410  if (nevents < requiredEvents) {
411  return kFALSE;
412  }
413 
414  double dnevents = hnevents->Integral(firstbin, lastbin);
415 
416  for (std::map<int, int>::const_iterator it = fNofPads.begin(); it != fNofPads.end(); ++it) {
417  const int& buspatchId = it->first;
418  const int& npads = it->second;
419 
420  TString bpName = Form("BP%04d", buspatchId);
421 
422  TH1* hbp = fBPEVO.Histo(Form("/BUSPATCH/HITS/%ds/%s", timeResolution, bpName.Data()));
423 
424  double occ = hbp->Integral(firstbin, lastbin) / dnevents / npads;
425 
426  if (occ > occupancyThreshold) {
427  faultyBusPatchOccupancies[buspatchId] = occ;
428  }
429  }
430 
431  return kTRUE;
432 }
433 
434 //_________________________________________________________________________________________________
436 {
438 
439  int station(1);
440 
441  for (Int_t ich = 1; ich < 10; ich += 2) {
442  TH1* h = fBPEVO.Histo(Form("/CHAMBER/HITS/%ds/CHAMBER%d", timeResolution, ich));
443  TH1* h1 = fBPEVO.Histo(Form("/CHAMBER/HITS/%ds/CHAMBER%d", timeResolution, ich + 1));
444 
445  TH1* hstation = static_cast<TH1*>(h->Clone(Form("STATION%d", station)));
446 
447  hstation->Add(h1);
448  fBPEVO.Adopt(Form("/STATION/HITS/%ds", timeResolution), hstation);
449 
450  h = fBPEVO.Histo(Form("/CHAMBER/HITS/%ds/CHAMBER%dLEFT", timeResolution, ich));
451  h1 = fBPEVO.Histo(Form("/CHAMBER/HITS/%ds/CHAMBER%dLEFT", timeResolution, ich + 1));
452 
453  hstation = static_cast<TH1*>(h->Clone(Form("STATION%dLEFT", station)));
454 
455  hstation->Add(h1);
456  fBPEVO.Adopt(Form("/STATION/HITS/%ds", timeResolution), hstation);
457 
458  h = fBPEVO.Histo(Form("/CHAMBER/HITS/%ds/CHAMBER%dRIGHT", timeResolution, ich));
459  h1 = fBPEVO.Histo(Form("/CHAMBER/HITS/%ds/CHAMBER%dRIGHT", timeResolution, ich + 1));
460 
461  hstation = static_cast<TH1*>(h->Clone(Form("STATION%dRIGHT", station)));
462 
463  hstation->Add(h1);
464  fBPEVO.Adopt(Form("/STATION/HITS/%ds", timeResolution), hstation);
465 
466  ++station;
467  }
468 }
469 
470 //_________________________________________________________________________________________________
472 {
475 
476  for (Int_t ich = 1; ich <= 10; ++ich) {
477  AliMpDEIterator it;
478 
479  it.First(ich - 1);
480 
481  TH1* hchamberLeft(0x0);
482  TH1* hchamberRight(0x0);
483  TList listLeft;
484  TList listRight;
485  listLeft.SetOwner(kFALSE);
486  listRight.SetOwner(kFALSE);
487 
488  AliMpDCSNamer dcs("TRACKER");
489 
490  while (!it.IsDone()) {
491  Int_t detElemId = it.CurrentDEId();
492 
494 
495  TH1* h = fBPEVO.Histo(Form("/DE/HITS/%ds/DE%04d", timeResolution, detElemId));
496 
497  if (dcs.DCSAliasName(detElemId).Contains("Left")) {
498  if (!hchamberLeft) {
499  hchamberLeft = static_cast<TH1*>(h->Clone(Form("CHAMBER%dLEFT", ich)));
500  }
501  else {
502  listLeft.Add(h);
503  }
504  }
505  else {
506  if (!hchamberRight) {
507  hchamberRight = static_cast<TH1*>(h->Clone(Form("CHAMBER%dRIGHT", ich)));
508  }
509  else {
510  listRight.Add(h);
511  }
512  }
513 
514  it.Next();
515  }
516 
517  hchamberLeft->Merge(&listLeft);
518  hchamberRight->Merge(&listRight);
519 
520  hchamberLeft->SetLineColor(4);
521  hchamberRight->SetLineColor(2);
522 
523  fBPEVO.Adopt(Form("/CHAMBER/HITS/%ds", timeResolution), hchamberLeft);
524  fBPEVO.Adopt(Form("/CHAMBER/HITS/%ds", timeResolution), hchamberRight);
525  TH1* hchamber = static_cast<TH1*>(hchamberLeft->Clone(Form("CHAMBER%d", ich)));
526  hchamber->Add(hchamberRight);
527  hchamber->SetLineColor(1);
528  fBPEVO.Adopt(Form("/CHAMBER/HITS/%ds", timeResolution), hchamber);
529  }
530 }
531 
532 //_________________________________________________________________________________________________
533 void AliMUONBusPatchEvolution::GroupByDDL(int timeResolution)
534 {
536 
537  Int_t nddls = AliDAQ::NumberOfDdls("MUONTRK");
538  Int_t offset = AliDAQ::DdlIDOffset("MUONTRK");
539 
540  for (Int_t i = 0; i < nddls; ++i) {
541  Int_t ddlId = offset + i;
542 
544 
545  TH1* hddl(0x0);
546  TList list;
547  list.SetOwner(kFALSE);
548 
549  for (Int_t ide = 0; ide < ddl->GetNofDEs(); ++ide) {
550  Int_t detElemId = ddl->GetDEId(ide);
551 
552  TH1* h = fBPEVO.Histo(Form("/DE/HITS/%ds/DE%04d", timeResolution, detElemId));
553 
554  if (!hddl) {
555  hddl = static_cast<TH1*>(h->Clone(Form("DDL%d", ddlId)));
556  }
557  else {
558  list.Add(h);
559  }
560  }
561 
562  hddl->Merge(&list);
563  fBPEVO.Adopt(Form("/DDL/HITS/%ds", timeResolution), hddl);
564  }
565 }
566 
567 //_________________________________________________________________________________________________
568 void AliMUONBusPatchEvolution::GroupByDE(int timeResolution)
569 {
572 
573  AliMpDEIterator it;
574 
575  it.First();
576 
577  while (!it.IsDone()) {
578  Int_t detElemId = it.CurrentDEId();
579 
581 
582  TList list;
583  list.SetOwner(kFALSE);
584  TH1* hde(0x0);
585 
586  if (de->GetStationType() != AliMp::kStationTrigger) {
587  for (Int_t i = 0; i < de->GetNofBusPatches(); ++i) {
588  Int_t busPatchId = de->GetBusPatchId(i);
589 
590  TH1* h = fBPEVO.Histo(Form("/BUSPATCH/HITS/%ds/BP%04d", timeResolution, busPatchId));
591 
592  h->SetLineColor(1);
593 
594  if (!hde) {
595  hde = static_cast<TH1*>(h->Clone());
596  hde->SetName(Form("DE%04d", detElemId));
597  }
598  else {
599  list.Add(h);
600  }
601  }
602 
603  hde->Merge(&list);
604  fBPEVO.Adopt(Form("/DE/HITS/%ds", timeResolution), hde);
605  }
606 
607  it.Next();
608  }
609 }
610 
611 //_________________________________________________________________________________________________
613 {
614  TObjArray* a = fBPEVO.SortAllIdentifiers();
615  TIter nextId(a);
616  TObjString* sid;
617 
618  while ((sid = static_cast<TObjString*>(nextId()))) {
619 
620  if (!sid->String().Contains("HITS"))
621  continue;
622 
623  TObjArray* parts = sid->String().Tokenize("/");
624  TString npadsId("/");
625 
626  npadsId += static_cast<TObjString*>(parts->At(0))->String();
627  npadsId += "/NPADS";
628 
629  TString sduration = static_cast<TObjString*>(parts->Last())->String();
630 
631  delete parts;
632 
633  Int_t duration = sduration.Atoi();
634 
635  TList* list = fBPEVO.CreateListOfObjectNames(sid->String().Data());
636  TIter nextObject(list);
637  TObjString* sobject;
638  while ((sobject = static_cast<TObjString*>(nextObject()))) {
639  TString hname;
640 
641  hname.Form("%s%s", sid->String().Data(), sobject->String().Data());
642 
643  TH1* hnhits = fBPEVO.Histo(hname.Data());
644 
645  TString padname;
646 
647  padname.Form("%s/%s", npadsId.Data(), sobject->String().Data());
648 
649  TH1* hnpads = fBPEVO.Histo(padname.Data());
650 
651  Double_t npads = hnpads->GetBinContent(1);
652 
653  TH1* hocchz = static_cast<TH1*>(hnhits->Clone());
654 
655  hocchz->SetDirectory(0);
656 
657  hocchz->SetTitle("Occupancy (Hz)");
658 
659  hocchz->Scale(1.0 / npads / duration);
660 
661  TString occ = sid->String();
662 
663  occ.ReplaceAll("HITS", "OCCHZ");
664 
665  fBPEVO.Adopt(occ.Data(), hocchz);
666 
667  TH1* hocc = static_cast<TH1*>(hnhits->Clone());
668 
669  hocc->SetDirectory(0);
670 
671  hocc->SetTitle("Occupancy");
672 
673  occ.ReplaceAll("HZ", "");
674 
675  TH1* hnevents = fBPEVO.Histo(Form("Nevents%s", sduration.Data()));
676 
677  hocc->GetXaxis()->SetTimeDisplay(0); // to avoid bin inflation in Divide...
678 
679  hocc->Divide(hnhits, hnevents, 1.0 / npads, 1.0);
680 
681  hocc->GetXaxis()->SetTimeDisplay(1);
682 
683  fBPEVO.Adopt(occ.Data(), hocc);
684  }
685 
686  delete list;
687  }
688 
689  delete a;
690 }
691 
692 //_____________________________________________________________________________
694 {
698 
699  TIter next(fBPEVO.CreateIterator());
700 
701  TH1F* h(0x0);
702 
703  std::map<int, int> lastbins;
704  std::map<int, int> firstbins;
705  std::map<int, int> nbins;
706  std::map<int, std::vector<TH1F*> > histos;
707 
708  std::set<int> timeResolutions;
709 
710  // get the upper bin per time resolution (only one in order to stick to a common bin
711  // definition for all histograms
712 
713  while ((h = static_cast<TH1F*>(next()))) {
714 
715  if (!h->GetXaxis()->GetTimeDisplay())
716  continue;
717 
718  int timeResolution = GetTimeResolution(*h);
719 
720  if (timeResolution <= 0)
721  continue;
722 
723  timeResolutions.insert(timeResolution);
724 
725  if (h->GetEntries()) {
726  lastbins[timeResolution] = TMath::Max(lastbins[timeResolution], h->FindLastBinAbove(0.0));
727 
728  if (firstbins.count(timeResolution)) {
729  firstbins[timeResolution] = TMath::Min(firstbins[timeResolution], h->FindFirstBinAbove(0.0));
730  }
731  else {
732  firstbins[timeResolution] = h->FindFirstBinAbove(0.0);
733  }
734  }
735 
736  int nb = h->GetNbinsX();
737 
738  if (nbins.count(timeResolution)) {
739  assert(nbins[timeResolution] = nb);
740  }
741  else {
742  nbins[timeResolution] = nb;
743  }
744 
745  histos[timeResolution].push_back(h);
746  }
747 
748  std::set<int, int>::const_iterator it;
749 
750  TH1::AddDirectory(kFALSE);
751 
752  for (it = timeResolutions.begin(); it != timeResolutions.end(); ++it) {
753 
754  int timeRes = *it;
755  int firstbin = firstbins[timeRes];
756  int lastbin = lastbins[timeRes];
757  int nb = nbins[timeRes];
758  const std::vector<TH1F*>& v = histos[timeRes];
759 
760  std::map<int, std::vector<TH1F*> >::const_iterator hit;
761  for (std::vector<TH1F*>::size_type iv = 0; iv < v.size(); ++iv) {
762  TH1F* hold = static_cast<TH1F*>(v[iv]);
763 
764  TH1F* hnew = new TH1F(hold->GetName(), hold->GetTitle(), lastbin - firstbin + 1, hold->GetBinLowEdge(firstbin),
765  hold->GetBinLowEdge(lastbin) + hold->GetBinWidth(lastbin));
766 
767  Double_t nentries = hold->GetEntries();
768 
769  for (int i = firstbin; i <= lastbin; ++i) {
770  hnew->SetBinContent(i - firstbin + 1, hold->GetBinContent(i));
771  }
772 
773  TString timeFormat = hold->GetXaxis()->GetTimeFormat();
774 
775  hnew->Copy(*hold);
776 
777  hold->SetEntries(nentries);
778 
779  hold->GetXaxis()->SetTimeFormat(timeFormat.Data());
780  hold->GetXaxis()->SetTimeDisplay(1);
781 
782  delete hnew;
783  }
784  }
785 }
786 
Int_t GetNofManus() const
void GetTimeResolutions(std::vector< int > &timeResolutions)
The iterator over detection elements.
void GroupByStation(int timeResolution)
#define TObjArray
Bool_t IsDone() const
AliMp::StationType GetStationType() const
Int_t GetDEfromBus(Int_t busPatchId) const
AliMergeableCollection & fBPEVO
Collection of methods usefull to DCS handling for MUON TRK and TRG.
Definition: AliMpDCSNamer.h:22
Int_t CurrentDEId() const
AliMpDetElement * GetDetElement(Int_t detElemId, Bool_t warn=true) const
Int_t GetManuId(Int_t index) const
void GroupByDDL(int timeResolution)
The class defines the electronics properties of detection element.
The class defined electronics properties of DDL.
Definition: AliMpDDL.h:20
ClassImp(TPCGenInfo)
Definition: AliTPCCmpNG.C:254
static TH1 * ExpandTimeAxis(const TH1 &h, Int_t expansionTime, Int_t timeResolution=-1)
static AliMpDDLStore * Instance(Bool_t warn=true)
static Int_t GetChamberId(Int_t detElemId, Bool_t warn=true)
Bool_t GetFaultyBusPatches(int timeResolution, int requiredEvents, float occupancyThreshold, std::map< int, double > &faultyBusPatchOccupancies)
void GroupByDE(int timeResolution)
AliMpDDL * GetDDL(Int_t ddlId, Bool_t warn=true) const
Int_t GetDEId(Int_t index) const
Definition: AliMpDDL.cxx:162
Int_t GetId() const
Return the unique Id.
Definition: AliMpBusPatch.h:89
static int GetTimeResolution(const TH1 &h)
AliMUONBusPatchEvolution(AliMergeableCollection &hc)
Int_t NofChannelsInManu(Int_t manuId) const
Int_t GetDdlId() const
Return DDL Id.
Int_t GetNofBusPatches() const
The class defines the properties of BusPatch.
Definition: AliMpBusPatch.h:21
trigger stations (slats)
Int_t GetBusPatchId(Int_t index) const
Utility class to massage the output of the MCHBPEVO DA.
static Bool_t GetTimeOffset(const TH1 &h, TTimeStamp &origin)
TString DCSAliasName(Int_t detElemId, Int_t sector=0, Int_t dcsMeasure=0) const
void GroupByChamber(int timeResolution)
static Bool_t LoadAll(Bool_t warn=false)
Definition: AliMpCDB.cxx:196
Int_t GetNofDEs() const
Definition: AliMpDDL.cxx:154
return kTRUE
Definition: AliFMDv1.cxx:97