ATLAS Offline Software
Loading...
Searching...
No Matches
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
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>
22using std::cout;
23using std::endl;
24
25using namespace LArSamples;
26
27TH2D** 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
56TH1F* 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// }
@ Data
Definition BaseObject.h:11
virtual const History * cellHistory(unsigned int i) const
short slot() const
Definition CellInfo.h:68
short feedThrough() const
Definition CellInfo.h:65
PartitionId partition() const
Definition CellInfo.cxx:198
double ofcTime() const
Definition Data.h:111
static short nSlots(PartitionId part)
Definition Geometry.cxx:59
static short nFeedThroughs(PartitionId part)
Definition Geometry.cxx:49
const CellInfo * cellInfo() const
Definition History.h:56
const Data * data(unsigned int i) const
Definition History.cxx:91
unsigned int nData() const
Definition History.h:51
static TString str(CaloId id)
Definition CaloId.cxx:15
TH2D ** timingPlots(PartitionId part, unsigned int tBins=100, double tMin=-50, double tMax=50) const
TH1F * timing(PartitionId part, unsigned int ft, unsigned int feb, unsigned int tBins=100, double tMin=-50, double tMax=50) const