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