62 {
63
64 bool badCompare = false;
65 const EventContext& ctx = getContext();
66
67 SG::ReadHandle<CaloCellContainer>
cells{
m_key,ctx};
68
69 const unsigned evt=ctx.eventID().event_number();
70 m_outfile <<
"Event " <<
evt <<
" contains " <<
cells->size() <<
" CaloCells" << std::endl;
71 m_outfile <<
"ID\tEnergy\tTime\tQual\tprov" << std::endl;
72
75 size_t evt_in, cells_size_in;
77 if (!
m_reffile.good() || evt_in != evt || cells_size_in !=
cells->size())
78 {
80 Event <<
" " << evt_in <<
" " <<
contains <<
" "
81 << cells_size_in << " " << CaloCells <<
82 "; expected event number " << evt << " and cell count " <<
84 badCompare = true;
85 }
86
87 std::string
ID,
Energy, Time, Qual, prov;
91 ID <<
" " <<
Energy <<
" " << Time <<
" " <<
92 Qual << " " << prov);
93 badCompare = true;
94 }
95 }
96
97 double remainingEne=0;
98 unsigned nRemaining=0;
99
100 for (const auto *cell : *cells) {
102 std::stringstream
id;
104 const CaloDetDescrElement* dde=
cell->caloDDE();
106 id << "LAr Bar";
107 }
109 id << "LAR ECI";
110 }
112 id << "LAR ECO";
113 }
115 id << "LAr_HEC";
116 }
118 id << "LAr_FCAL";
119 }
121 id << "TILE ";
122 }
123 else {
124 id << "UNKNOWN";
125 }
127 }
128
129 m_outfile <<
id.str() <<
"0x" << std::hex <<
cell->ID().get_identifier32().get_compact() << std::dec
130
131 <<
"\t" <<
cell->e() <<
"\t" <<
cell->time() <<
"\t" <<
cell->gain()
132 <<
"\t" <<
cell->quality() <<
"\t0x" << std::hex <<
cell->provenance() << std::dec << std::endl;
134 unsigned id_in;
135 float energy_in, time_in;
136 int quality_in, provenance_in, gain_in;
138 std::string
id, samp;
140 }
141 m_reffile >> std::hex >> id_in >> std::dec >> energy_in >> time_in >>
142 gain_in >> quality_in >> std::hex >> provenance_in >> std::dec;
146 id_in !=
cell->ID().get_identifier32().get_compact() ||
147 gain_in !=
cell->gain() ||
148 quality_in !=
cell->quality() ||
149 provenance_in !=
cell->provenance())
150 {
152 std::hex << "0x" << id_in << " " << std::dec <<
153 energy_in << " "
154 << time_in << " " <<
155 gain_in << " " << quality_in << " " <<
156 std::hex << "0x" << provenance_in << std::dec);
158 cell->ID().get_identifier32().get_compact() << std::dec <<
" " <<
159 cell->e() <<
" " <<
cell->time() <<
" "
160 <<
cell->gain() <<
" " <<
161 cell->quality() <<
" 0x" << std::hex <<
cell->provenance() << std::dec);
162 badCompare = true;
163 }
164 }
165 }
166 else {
167 ++nRemaining;
168 remainingEne+=
cell->e();
169 }
170 }
171 if (nRemaining) {
172 m_outfile <<
"Sum of " << nRemaining <<
" cell energies: " << remainingEne << std::endl;
174 std::string Sum, Of, Cell,
Energies;
175 unsigned nRemaining_in;
176 float remainingEne_in;
178 remainingEne_in;
180 nRemaining_in != nRemaining ||
181 !
isEqual (remainingEne_in, remainingEne))
182 {
184 Sum << Of << nRemaining_in << Cell << Energies <<
185 remainingEne_in);
187 "Sum of " << nRemaining << " cell energies: " << remainingEne);
188 badCompare = true;
189 }
190 }
191 }
192 if (badCompare) {
194 return StatusCode::FAILURE;
195 }
196 return StatusCode::SUCCESS;
197}
std::vector< Identifier > ID
std::vector< double > Energy
Gaudi::Property< bool > m_compact
Gaudi::Property< float > m_eCut
SG::ReadHandleKey< CaloCellContainer > m_key
bool is_tile() const
cell belongs to Tile
CaloCell_ID::CaloSample getSampling() const
cell sampling
bool is_lar_em_endcap_outer() const
cell belongs to the outer wheel of EM end cap
bool is_lar_hec() const
cell belongs to HEC
bool is_lar_em_barrel() const
cell belongs to EM barrel
bool is_lar_em_endcap_inner() const
cell belongs to the inner wheel of EM end cap
bool is_lar_fcal() const
cell belongs to FCAL
bool contains(const std::string &s, const std::string ®x)
does a string contain the substring
bool isEqual(double x1, double x2, double thresh=1e-6)