ATLAS Offline Software
TimingMonitor.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
9 #include "LArSamplesMon/Data.h"
10 #include "LArSamplesMon/OFC.h"
11 #include "LArCafJobs/Geometry.h"
12 
13 #include "TH1I.h"
14 #include "TH2D.h"
15 #include "TF1.h"
16 #include "TPaveText.h"
17 #include "TMath.h"
18 #include <map>
19 #include <vector>
20 
21 #include <iostream>
22 using std::cout;
23 using std::endl;
24 
25 using namespace LArSamples;
26 
27 TH2D** TimingMonitor::timingPlots(PartitionId part, unsigned int tBins, double tMin, double tMax) const
28 {
29  TH2D** hists = new TH2D*[Geo::nFeedThroughs(part)];
30  for (int i = 0; i < Geo::nFeedThroughs(part); i++) hists[i] = nullptr;
31 
32  for (unsigned int i = 0; i < nChannels(); i++) {
33  const History* history = cellHistory(i);
34 
35  if (!history) continue;
36  if (history->cellInfo()->partition() != part) continue;
37  unsigned int fT = history->cellInfo()->feedThrough();
38  if (!hists[fT]) {
39  hists[fT] = new TH2D(Form("timing_%d", fT), Form("Timing for %s FT=%d", Id::str(part).Data(), fT),
40  Geo::nSlots(part), -0.5, Geo::nSlots(part) - 0.5,
41  tBins, tMin, tMax);
42  hists[fT]->GetXaxis()->SetTitle("Slot");
43  hists[fT]->GetYaxis()->SetTitle("Time [ns]");
44  }
45  for (unsigned int j = 0; j < history->nData(); j++)
46  hists[fT]->Fill(history->cellInfo()->slot(), history->data(j)->ofcTime());
47 
48  // cout << history->data(0)->ofcTime() << "time" << endl;
49 
50  // cout << history->nData() << " eventi " << history->cellInfo()->slot() << " slot" << endl;
51 
52  }
53  return hists;
54 }
55 
56 TH1F* TimingMonitor::timing(PartitionId part, unsigned int ft, unsigned int FEB,
57  unsigned int tBins, double tMin, double tMax) const
58 {
59 
60  TH1F* hists;
61  // for (int i = 0; i < Geo::nFeedThroughs(part); i++){
62  // for (int u = 0; u < Geo::nSlots(part); u++){
63  hists= new TH1F(Form("timing_ft_%d,feb_%d",ft,FEB), Form("Timing for FT %d, feb %d", ft,FEB), tBins, tMin, tMax );
64  // }
65  //}
66 
67  for (unsigned int i = 0; i < nChannels(); i++) {
68  const History* history = cellHistory(i);
69  if (!history) continue;
70  if (history->cellInfo()->partition() != part) continue;
71  unsigned int fT = history->cellInfo()->feedThrough();
72  unsigned int feb = history->cellInfo()->slot();
73 
74  for (unsigned int j = 0; j < history->nData(); j++)
75  if (fT==ft && feb==FEB) hists->Fill(history->data(j)->ofcTime());
76  }
77  return hists;
78 }
79 
80 
81 // TH1F** TimingMonitor::time(PartitionId part, unsigned int tBins, double tMin, double tMax) const
82 // {
83 
84 // max=4;
85 
86 // TH1F** hists = new TH1F*[max];
87 
88 
89 // // TH1F* hists[32][14];
90 // for (int i = 0; i < Geo::nFeedThroughs(part); i++){
91 // for (int u = 0; u < Geo::nSlots(part); u++){
92 // hists[i][u]= new TH1F(Form("timing_ft_%d,feb_%d",i,u), Form("Timing for FT %d, feb %d", i,u), tBins, tMin, tMax );
93 // }
94 // }
95 
96 // for (unsigned int i = 0; i < m_interface->nChannels(); i++) {
97 // const History* history = m_interface->cellHistory(i);
98 // if (!history) continue;
99 // if (history->cellInfo()->partition() != part) continue;
100 // unsigned int fT = history->cellInfo()->feedThrough();
101 // unsigned int feb = history->cellInfo()->slot();
102 
103 // for (unsigned int j = 0; j < history->nData(); j++)
104 // hists[fT][feb]->Fill(history->data(j)->ofcTime());
105 // }
106 // return hists;
107 // }
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
PlotCalibFromCool.ft
ft
Definition: PlotCalibFromCool.py:329
LArSamples::CellInfo::slot
short slot() const
Definition: CellInfo.h:68
LArSamples::History::cellInfo
const CellInfo * cellInfo() const
Definition: History.h:61
LArSamples::AbsLArCells::cellHistory
virtual const History * cellHistory(unsigned int i) const
Definition: AbsLArCells.cxx:57
Data
@ Data
Definition: BaseObject.h:11
LArSamples::History
Definition: History.h:40
LArSamples::CellInfo::feedThrough
short feedThrough() const
Definition: CellInfo.h:65
Geometry.h
LArSamples::Id::str
static TString str(CaloId id)
Definition: CaloId.cxx:15
OFC.h
LArSamples
Definition: AbsShape.h:24
LArSamples::Data::ofcTime
double ofcTime() const
Definition: Data.h:116
LArSamples::Geo::nSlots
static short nSlots(PartitionId part)
Definition: Geometry.cxx:59
LArSamples::MonitorBase::nChannels
unsigned int nChannels() const
Definition: LArCalorimeter/LArSamplesMon/src/MonitorBase.cxx:45
LArSamples::History::data
const Data * data(unsigned int i) const
Definition: History.cxx:88
LArSamples::CellInfo::partition
PartitionId partition() const
Definition: CellInfo.cxx:198
lumiFormat.i
int i
Definition: lumiFormat.py:92
MakeTH3DFromTH2Ds.hists
hists
Definition: MakeTH3DFromTH2Ds.py:72
LArSamples::TimingMonitor::timing
TH1F * timing(PartitionId part, unsigned int ft, unsigned int feb, unsigned int tBins=100, double tMin=-50, double tMax=50) const
Definition: TimingMonitor.cxx:56
LArSamples::PartitionId
PartitionId
Definition: CaloId.h:29
LArSamples::History::nData
unsigned int nData() const
Definition: History.h:56
LArSamples::TimingMonitor::timingPlots
TH2D ** timingPlots(PartitionId part, unsigned int tBins=100, double tMin=-50, double tMax=50) const
Definition: TimingMonitor.cxx:27
LArSamples::Geo::nFeedThroughs
static short nFeedThroughs(PartitionId part)
Definition: Geometry.cxx:49
TimingMonitor.h
Data.h
python.TrigEgammaMonitorHelper.TH1F
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:24
History.h
Interface.h