ATLAS Offline Software
Loading...
Searching...
No Matches
dqm_algorithms::SCTTrackTiming Class Reference

#include <SCTTrackTiming.h>

Inheritance diagram for dqm_algorithms::SCTTrackTiming:
Collaboration diagram for dqm_algorithms::SCTTrackTiming:

Public Member Functions

 SCTTrackTiming ()
virtual ~SCTTrackTiming ()=default
virtual dqm_core::Algorithm * clone ()
virtual dqm_core::Result * execute (const std::string &name, const TObject &data, const dqm_core::AlgorithmConfig &config)
void printDescription (std::ostream &out)

Protected Attributes

std::string m_name
int m_NbinsX

Detailed Description

Definition at line 16 of file SCTTrackTiming.h.

Constructor & Destructor Documentation

◆ SCTTrackTiming()

dqm_algorithms::SCTTrackTiming::SCTTrackTiming ( )

Definition at line 45 of file SCTTrackTiming.cxx.

47 : m_name("SCTTrackTiming")
48 , m_NbinsX(8)
49 {
50 dqm_core::AlgorithmManager::instance().registerAlgorithm( m_name, this );
51 }

◆ ~SCTTrackTiming()

virtual dqm_algorithms::SCTTrackTiming::~SCTTrackTiming ( )
virtualdefault

Member Function Documentation

◆ clone()

dqm_core::Algorithm * dqm_algorithms::SCTTrackTiming::clone ( )
virtual

Definition at line 55 of file SCTTrackTiming.cxx.

57 {
58 return new SCTTrackTiming(*this);
59 }

◆ execute()

dqm_core::Result * dqm_algorithms::SCTTrackTiming::execute ( const std::string & name,
const TObject & data,
const dqm_core::AlgorithmConfig & config )
virtual

Definition at line 63 of file SCTTrackTiming.cxx.

65 {
66 //No status flags are set
67 dqm_core::Result* result = new dqm_core::Result();
68 result->status_ = dqm_core::Result::Undefined;
69
70 const TH1* h;
71 if(data.IsA()->InheritsFrom( "TH1" )) {
72 h = static_cast<const TH1*>(&data);
73 if (h->GetDimension() > 1 ) {
74 throw dqm_core::BadConfig( ERS_HERE, name, "Not SCT Time Bins: Hist. Dimension > 1 " );
75 }
76 if (h->GetNbinsX() != 8) {
77 throw dqm_core::BadConfig( ERS_HERE, name, "Not SCT Time Bins: Hist. NBins != 8 " );
78 }
79 } else {
80 throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TH1");
81 }
82
83 //Histogram is assumed to be SCT Time Bins.
84 m_NbinsX = 8;
85
86 //Get the ratio & average for hit times
87 double Hits010 = 0.;
88 double Hits011 = 0.;
89 double EarlyHits = 0.;
90 double InTimeHits = 0.;
91 double LateHits = 0.;
92 double AllEntries = 0.;
93
94 double TBin = 0.;
95
96 TBin = h->GetBinContent(0+1); //000
97 AllEntries += TBin;
98
99 TBin = h->GetBinContent(1+1); //001
100 LateHits += TBin;
101 AllEntries += TBin;
102
103 TBin = h->GetBinContent(2+1); //010
104 Hits010 += TBin;
105 InTimeHits += TBin;
106 AllEntries += TBin;
107
108 TBin = h->GetBinContent(3+1); //011
109 Hits011 += TBin;
110 InTimeHits += TBin/2;
111 LateHits += TBin/2;
112 AllEntries += TBin;
113
114 TBin = h->GetBinContent(4+1); //100
115 EarlyHits += TBin;
116 AllEntries += TBin;
117
118 TBin = h->GetBinContent(5+1); //101
119 AllEntries += TBin;
120
121 TBin = h->GetBinContent(6+1); //110
122 EarlyHits += TBin/2;
123 InTimeHits += TBin/2;
124 AllEntries += TBin;
125
126 TBin = h->GetBinContent(7+1); //111
127 AllEntries += TBin;
128
129 //NOTE: If some quantity cannot be calculated it should not be printed at all.
130 //Printing a default value will simply skew the scale of history plots.
131
132 if (Hits010 + Hits011 > 0.) { //sufficient entries
133 double HitBin_ratio = Hits010 / (Hits010 + Hits011);
134 std::string HitBin_ratio_name = Form("%s_Ratio_010_over_01X", name.c_str());
135 result->tags_[HitBin_ratio_name.c_str()] = HitBin_ratio;
136 }
137
138 if (AllEntries > 0.) { //sufficient entries
139 double Edge0_ratio = Hits010 / AllEntries;
140 std::string Edge0_name = Form("%s_Ratio_010_over_XXX", name.c_str());
141 result->tags_[Edge0_name.c_str()] = Edge0_ratio;
142 }
143
144 if (AllEntries > 0.) { //sufficient entries
145 double Edge1_ratio = Hits011 / AllEntries;
146 std::string Edge1_name = Form("%s_Ratio_011_over_XXX", name.c_str());
147 result->tags_[Edge1_name.c_str()] = Edge1_ratio;
148 }
149
150 if (AllEntries > 0.) { //sufficient entries
151 double EdgeX_ratio = (Hits010 + Hits011) / AllEntries;
152 std::string EdgeX_name = Form("%s_Ratio_01X_over_XXX", name.c_str());
153 result->tags_[EdgeX_name.c_str()] = EdgeX_ratio;
154 }
155
156 if (LateHits + InTimeHits + EarlyHits > 0.) { //sufficient entries
157 double HitMean_time = (LateHits - EarlyHits) / (LateHits + InTimeHits + EarlyHits);
158 std::string HitMean_name = Form("%s_MeanHitTimeBC", name.c_str());
159 result->tags_[HitMean_name.c_str()] = HitMean_time;
160
161 double HitWidth_time = (LateHits + EarlyHits) / (LateHits + InTimeHits + EarlyHits);
162 HitWidth_time = std::sqrt(HitWidth_time - HitMean_time*HitMean_time);
163 std::string HitWidth_name = Form("%s_VarianceHitTimeBC", name.c_str());
164 result->tags_[HitWidth_name.c_str()] = HitWidth_time;
165 }
166
167 return result;
168 }
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11

◆ printDescription()

void dqm_algorithms::SCTTrackTiming::printDescription ( std::ostream & out)

Definition at line 29 of file SCTTrackTiming.cxx.

31 {
32 std::string message;
33 message += "\n";
34 message += "Algorithm: \"" + m_name + "\"\n";
35 message += "Description: For use with SCT Track Time Bins ONLY!\n";
36 message += " Prints the ratio of 010 : 01X hits.\n";
37 message += " Prints the mean hit time, with 100 as -1 BunchCrossing (early) and 001 as +1 BunchCrossing (late)\n";
38 message += " where 011 would contribute half a hit to 0 BC (timed in) and half a hit to +1 BC (late)\n";
39 message += " and the hit patterns 000, 111, and 101 will be ignored.\n";
40 message += "\n";
41
42 out << message;
43 }

Member Data Documentation

◆ m_name

std::string dqm_algorithms::SCTTrackTiming::m_name
protected

Definition at line 31 of file SCTTrackTiming.h.

◆ m_NbinsX

int dqm_algorithms::SCTTrackTiming::m_NbinsX
protected

Definition at line 33 of file SCTTrackTiming.h.


The documentation for this class was generated from the following files: