19 #include <boost/ref.hpp>
20 #include <boost/bind.hpp>
21 #include <boost/function.hpp>
22 #include <boost/iterator/transform_iterator.hpp>
30 for (
int i=1;
i<4;
i++)
31 ss << item.
mean(
i) <<
"," << item.
rms(
i) <<
";";
45 return std::accumulate(
61 for (
unsigned int i=0;
i<which.size();
i++) {
63 if ((
unsigned int) (which[
i])< peds.
barrelItems().size())
68 typedef boost::function<void(EcalPedestals const & peds, Quantity q, std::vector<int>
const & which, std::vector<float> &
result)>
PedExtractor;
80 std::vector<int>
const &
which()
const {
return m_which;}
115 std::vector<float> res;
116 extractor(m_what.how())(it,m_what.quantity(),m_what.which(),res);
129 std::stringstream ss;
146 vValues[0].first =
"mean_x12";
147 vValues[1].first =
"rms_x12";
148 vValues[2].first =
"mean_x6";
149 vValues[3].first =
"rms_x6";
150 vValues[4].first =
"mean_x1";
151 vValues[5].first =
"rms_x1";
153 vValues[0].second = .0;
154 vValues[1].second = .0;
155 vValues[2].second = .0;
156 vValues[3].second = .0;
157 vValues[4].second = .0;
158 vValues[5].second = .0;
161 for(std::vector<EcalPedestal>::const_iterator iItems = vItems.begin(); iItems != vItems.end(); ++iItems){
162 vValues[0].second += iItems->mean(1);
163 vValues[1].second += iItems->rms(1);
164 vValues[2].second += iItems->mean(2);
165 vValues[3].second += iItems->rms(2);
166 vValues[4].second += iItems->mean(3);
167 vValues[5].second += iItems->rms(3);
175 std::stringstream ss;
186 std::vector<int>
const&,
187 std::vector<float>
const& )
const {
188 gStyle->SetPalette(1);
190 TCanvas
canvas(
"CC map",
"CC map",800,1200);
192 float xmi[3] = {0.0 , 0.22, 0.78};
193 float xma[3] = {0.22, 0.78, 1.00};
194 TPad***
pad =
new TPad**[6];
195 for (
int gId = 0; gId < 6; gId++) {
196 pad[gId] =
new TPad*[3];
198 float yma = 1.- (0.17 * gId);
199 float ymi = yma - 0.15;
200 pad[gId][
obj] =
new TPad(Form(
"p_%i_%i",
obj, gId),Form(
"p_%i_%i",
obj, gId),
201 xmi[
obj], ymi, xma[obj], yma);
202 pad[gId][
obj]->Draw();
206 const int kGains = 3;
207 const int gainValues[3] = {12, 6, 1};
214 TH2F** barrel_m =
new TH2F*[3];
215 TH2F** endc_p_m =
new TH2F*[3];
216 TH2F** endc_m_m =
new TH2F*[3];
217 TH2F** barrel_r =
new TH2F*[3];
218 TH2F** endc_p_r =
new TH2F*[3];
219 TH2F** endc_m_r =
new TH2F*[3];
221 barrel_m[
gainId] =
new TH2F(Form(
"EBm%i",
gainId),Form(
"mean %i EB",gainValues[
gainId]),360,0,360, 170, -85,85);
222 endc_p_m[
gainId] =
new TH2F(Form(
"EE+m%i",gainId),Form(
"mean %i EE+",gainValues[gainId]),100,1,101,100,1,101);
223 endc_m_m[
gainId] =
new TH2F(Form(
"EE-m%i",gainId),Form(
"mean %i EE-",gainValues[gainId]),100,1,101,100,1,101);
224 barrel_r[
gainId] =
new TH2F(Form(
"EBr%i",gainId),Form(
"rms %i EB",gainValues[gainId]),360,0,360, 170, -85,85);
225 endc_p_r[
gainId] =
new TH2F(Form(
"EE+r%i",gainId),Form(
"rms %i EE+",gainValues[gainId]),100,1,101,100,1,101);
226 endc_m_r[
gainId] =
new TH2F(Form(
"EE-r%i",gainId),Form(
"rms %i EE-",gainValues[gainId]),100,1,101,100,1,101);
229 for (
int sign=0; sign <
kSides; sign++) {
230 int thesign = sign==1 ? 1:-1;
236 if(sign == 1) y = ieta;
237 barrel_m[0]->Fill(iphi, y,
object()[
id.rawId()].
mean_x12);
238 barrel_r[0]->Fill(iphi, y,
object()[
id.rawId()].rms_x12);
239 barrel_m[1]->Fill(iphi, y,
object()[
id.rawId()].
mean_x6);
240 barrel_r[1]->Fill(iphi, y,
object()[
id.rawId()].rms_x6);
241 barrel_m[2]->Fill(iphi, y,
object()[
id.rawId()].mean_x1);
242 barrel_r[2]->Fill(iphi, y,
object()[
id.rawId()].rms_x1);
251 endc_p_m[0]->Fill(ix+1,iy+1,
object()[
id.rawId()].
mean_x12);
252 endc_p_r[0]->Fill(ix+1,iy+1,
object()[
id.rawId()].rms_x12);
253 endc_p_m[1]->Fill(ix+1,iy+1,
object()[
id.rawId()].
mean_x6);
254 endc_p_r[1]->Fill(ix+1,iy+1,
object()[
id.rawId()].rms_x6);
255 endc_p_m[2]->Fill(ix+1,iy+1,
object()[
id.rawId()].mean_x1);
256 endc_p_r[2]->Fill(ix+1,iy+1,
object()[
id.rawId()].rms_x1);
259 endc_m_m[0]->Fill(ix+1,iy+1,
object()[
id.rawId()].
mean_x12);
260 endc_m_r[0]->Fill(ix+1,iy+1,
object()[
id.rawId()].rms_x12);
261 endc_m_m[1]->Fill(ix+1,iy+1,
object()[
id.rawId()].
mean_x6);
262 endc_m_r[1]->Fill(ix+1,iy+1,
object()[
id.rawId()].rms_x6);
263 endc_m_m[2]->Fill(ix+1,iy+1,
object()[
id.rawId()].mean_x1);
264 endc_m_r[2]->Fill(ix+1,iy+1,
object()[
id.rawId()].rms_x1);
271 float bmin[3] ={0.7, 0.5, 0.4};
272 float bmax[3] ={1.7, 1.0, 0.8};
273 float emin[3] ={1.5, 0.8, 0.4};
274 float emax[3] ={2.5, 1.5, 0.8};
275 TLine*
l =
new TLine(0., 0., 0., 0.);
277 int ixSectorsEE[202] = {
278 62, 62, 61, 61, 60, 60, 59, 59, 58, 58, 56, 56, 46, 46, 44, 44, 43, 43, 42, 42,
279 41, 41, 40, 40, 41, 41, 42, 42, 43, 43, 44, 44, 46, 46, 56, 56, 58, 58, 59, 59,
280 60, 60, 61, 61, 62, 62, 0,101,101, 98, 98, 96, 96, 93, 93, 88, 88, 86, 86, 81,
281 81, 76, 76, 66, 66, 61, 61, 41, 41, 36, 36, 26, 26, 21, 21, 16, 16, 14, 14, 9,
282 9, 6, 6, 4, 4, 1, 1, 4, 4, 6, 6, 9, 9, 14, 14, 16, 16, 21, 21, 26,
283 26, 36, 36, 41, 41, 61, 61, 66, 66, 76, 76, 81, 81, 86, 86, 88, 88, 93, 93, 96,
284 96, 98, 98,101,101, 0, 62, 66, 66, 71, 71, 81, 81, 91, 91, 93, 0, 62, 66, 66,
285 91, 91, 98, 0, 58, 61, 61, 66, 66, 71, 71, 76, 76, 81, 81, 0, 51, 51, 0, 44,
286 41, 41, 36, 36, 31, 31, 26, 26, 21, 21, 0, 40, 36, 36, 11, 11, 4, 0, 40, 36,
287 36, 31, 31, 21, 21, 11, 11, 9, 0, 46, 46, 41, 41, 36, 36, 0, 56, 56, 61, 61, 66, 66};
289 int iySectorsEE[202] = {
290 51, 56, 56, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 61, 61, 60, 60, 59, 59, 58,
291 58, 56, 56, 46, 46, 44, 44, 43, 43, 42, 42, 41, 41, 40, 40, 41, 41, 42, 42, 43,
292 43, 44, 44, 46, 46, 51, 0, 51, 61, 61, 66, 66, 76, 76, 81, 81, 86, 86, 88, 88,
293 93, 93, 96, 96, 98, 98,101,101, 98, 98, 96, 96, 93, 93, 88, 88, 86, 86, 81, 81,
294 76, 76, 66, 66, 61, 61, 41, 41, 36, 36, 26, 26, 21, 21, 16, 16, 14, 14, 9, 9,
295 6, 6, 4, 4, 1, 1, 4, 4, 6, 6, 9, 9, 14, 14, 16, 16, 21, 21, 26, 26,
296 36, 36, 41, 41, 51, 0, 46, 46, 41, 41, 36, 36, 31, 31, 26, 26, 0, 51, 51, 56,
297 56, 61, 61, 0, 61, 61, 66, 66, 71, 71, 76, 76, 86, 86, 88, 0, 62,101, 0, 61,
298 61, 66, 66, 71, 71, 76, 76, 86, 86, 88, 0, 51, 51, 56, 56, 61, 61, 0, 46, 46,
299 41, 41, 36, 36, 31, 31, 26, 26, 0, 40, 31, 31, 16, 16, 6, 0, 40, 31, 31, 16, 16, 6};
301 for (
int gId = 0; gId < 3; gId++) {
303 endc_m_m[gId]->SetStats(0);
304 endc_m_m[gId]->SetMaximum(225);
305 endc_m_m[gId]->SetMinimum(175);
306 endc_m_m[gId]->Draw(
"colz");
307 for (
int i=0;
i<201;
i=
i+1) {
308 if ( (ixSectorsEE[
i]!=0 || iySectorsEE[
i]!=0) &&
309 (ixSectorsEE[
i+1]!=0 || iySectorsEE[
i+1]!=0) ) {
310 l->DrawLine(ixSectorsEE[
i], iySectorsEE[i],
311 ixSectorsEE[i+1], iySectorsEE[i+1]);
312 l->SetLineWidth(0.2);
315 pad[gId + 3][0]->cd();
316 endc_m_r[gId]->SetStats(0);
317 endc_m_r[gId]->SetMaximum(emax[gId]);
318 endc_m_r[gId]->SetMinimum(emin[gId]);
319 endc_m_r[gId]->Draw(
"colz");
320 for (
int i=0;
i<201;
i=
i+1) {
321 if ( (ixSectorsEE[
i]!=0 || iySectorsEE[
i]!=0) &&
322 (ixSectorsEE[
i+1]!=0 || iySectorsEE[
i+1]!=0) ) {
323 l->DrawLine(ixSectorsEE[
i], iySectorsEE[i],
324 ixSectorsEE[i+1], iySectorsEE[i+1]);
329 barrel_m[gId]->SetStats(0);
330 barrel_m[gId]->SetMaximum(225);
331 barrel_m[gId]->SetMinimum(175);
332 barrel_m[gId]->Draw(
"colz");
333 for(
int i = 0;
i <17;
i++) {
334 Double_t
x = 20.+ (
i *20);
335 l =
new TLine(x,-85.,x,86.);
338 l =
new TLine(0.,0.,360.,0.);
340 pad[gId + 3][1]->cd();
341 barrel_r[gId]->SetStats(0);
342 barrel_r[gId]->SetMaximum(bmax[gId]);
343 barrel_r[gId]->SetMinimum(bmin[gId]);
344 barrel_r[gId]->Draw(
"colz");
345 for(
int i = 0;
i <17;
i++) {
346 Double_t
x = 20.+ (
i *20);
347 l =
new TLine(x,-85.,x,86.);
350 l =
new TLine(0.,0.,360.,0.);
354 endc_p_m[gId]->SetStats(0);
355 endc_p_m[gId]->SetMaximum(225);
356 endc_p_m[gId]->SetMinimum(175);
357 endc_p_m[gId]->Draw(
"colz");
358 for (
int i=0;
i<201;
i=
i+1) {
359 if ( (ixSectorsEE[
i]!=0 || iySectorsEE[
i]!=0) &&
360 (ixSectorsEE[
i+1]!=0 || iySectorsEE[
i+1]!=0) ) {
361 l->DrawLine(ixSectorsEE[
i], iySectorsEE[i],
362 ixSectorsEE[i+1], iySectorsEE[i+1]);
365 pad[gId + 3][2]->cd();
366 endc_p_r[gId]->SetStats(0);
367 endc_p_r[gId]->SetMaximum(emax[gId]);
368 endc_p_r[gId]->SetMinimum(emin[gId]);
369 endc_p_r[gId]->Draw(
"colz");
370 for (
int i=0;
i<201;
i=
i+1) {
371 if ( (ixSectorsEE[
i]!=0 || iySectorsEE[
i]!=0) &&
372 (ixSectorsEE[
i+1]!=0 || iySectorsEE[
i+1]!=0) ) {
373 l->DrawLine(ixSectorsEE[
i], iySectorsEE[i],
374 ixSectorsEE[i+1], iySectorsEE[i+1]);
379 canvas.SaveAs(filename.c_str());
384 namespace condPython {
387 using namespace boost::python;
388 enum_<cond::ecalped::Quantity>(
"Quantity")
393 enum_<cond::ecalped::How>(
"How")
400 class_<What>(
"What",init<>())
401 .def(
"set_quantity",&What::set_quantity)
402 .def(
"set_how",&What::set_how)
403 .def(
"set_which",&What::set_which)
404 .def(
"quantity",&What::quantity, return_value_policy<copy_const_reference>())
405 .def(
"how",&What::how, return_value_policy<copy_const_reference>())
406 .def(
"which",&What::which, return_value_policy<copy_const_reference>())
std::string plot(std::string const &, std::string const &, std::vector< int > const &, std::vector< float > const &) const
float average(EcalPedestals const &peds, Quantity q)
int gainId(sample_type sample)
get the gainId (2 bits)
static const int kBarlRings
const Items & barrelItems() const
std::vector< std::pair< std::string, float > > type_vValues
type_vValues getValues(const std::vector< EcalPedestal > &vItems)
#define PYTHON_WRAPPER(_class, _name)
unsigned int total_values
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
boost::function< void(EcalPedestals const &peds, Quantity q, std::vector< int > const &which, std::vector< float > &result)> PedExtractor
static std::string dumpXML(const EcalCondHeader &header, const EcalPedestals &record)
static const int kBarlWedges
std::string summary() const
void extractAverage(EcalPedestals const &peds, Quantity q, std::vector< int > const &, std::vector< float > &result)
static const int kEndcWedgesX
static const int MAX_IPHI
static const int MAX_IETA
void defineWhat< EcalPedestals >()
std::string printBarrelsEndcaps(const std::vector< T > &barrelItems, const std::vector< T > &endcapItems)
void extractSingleChannel(EcalPedestals const &peds, Quantity q, std::vector< int > const &which, std::vector< float > &result)
void extractSuperModules(EcalPedestals const &peds, Quantity q, std::vector< int > const &which, std::vector< float > &result)
static const int kEndcWedgesY