19 #include <boost/ref.hpp>
20 #include <boost/bind.hpp>
21 #include <boost/function.hpp>
22 #include <boost/iterator/transform_iterator.hpp>
29 for (
int i=1;
i<4;
i++)
30 ss << item.
mean(
i) <<
"," << item.
rms(
i) <<
";";
44 return std::accumulate(
60 for (
unsigned int i=0;
i<which.size();
i++) {
62 if ((
unsigned int) (which[
i])< peds.
barrelItems().size())
67 typedef boost::function<void(EcalPedestals const & peds, Quantity q, std::vector<int>
const & which, std::vector<float> &
result)>
PedExtractor;
79 std::vector<int>
const &
which()
const {
return m_which;}
114 std::vector<float> res;
115 extractor(m_what.how())(it,m_what.quantity(),m_what.which(),res);
128 std::stringstream ss;
136 std::cout <<
"***************************************"<< std::endl;
137 std::stringstream ss;
139 <<
object().barrelItems().size() <<
","
140 <<
object().endcapItems().size() <<
";";
150 std::vector<int>
const&,
151 std::vector<float>
const& )
const {
152 gStyle->SetPalette(1);
154 TCanvas
canvas(
"CC map",
"CC map",800,1200);
156 float xmi[3] = {0.0 , 0.22, 0.78};
157 float xma[3] = {0.22, 0.78, 1.00};
158 TPad*** pad =
new TPad**[6];
159 for (
int gId = 0; gId < 6; gId++) {
160 pad[gId] =
new TPad*[3];
162 float yma = 1.- (0.17 * gId);
163 float ymi = yma - 0.15;
164 pad[gId][
obj] =
new TPad(Form(
"p_%i_%i",
obj, gId),Form(
"p_%i_%i",
obj, gId),
165 xmi[
obj], ymi, xma[obj], yma);
166 pad[gId][
obj]->Draw();
170 const int kGains = 3;
171 const int gainValues[3] = {12, 6, 1};
178 TH2F** barrel_m =
new TH2F*[3];
179 TH2F** endc_p_m =
new TH2F*[3];
180 TH2F** endc_m_m =
new TH2F*[3];
181 TH2F** barrel_r =
new TH2F*[3];
182 TH2F** endc_p_r =
new TH2F*[3];
183 TH2F** endc_m_r =
new TH2F*[3];
185 barrel_m[
gainId] =
new TH2F(Form(
"EBm%i",
gainId),Form(
"mean %i EB",gainValues[
gainId]),360,0,360, 170, -85,85);
186 endc_p_m[
gainId] =
new TH2F(Form(
"EE+m%i",gainId),Form(
"mean %i EE+",gainValues[gainId]),100,1,101,100,1,101);
187 endc_m_m[
gainId] =
new TH2F(Form(
"EE-m%i",gainId),Form(
"mean %i EE-",gainValues[gainId]),100,1,101,100,1,101);
188 barrel_r[
gainId] =
new TH2F(Form(
"EBr%i",gainId),Form(
"rms %i EB",gainValues[gainId]),360,0,360, 170, -85,85);
189 endc_p_r[
gainId] =
new TH2F(Form(
"EE+r%i",gainId),Form(
"rms %i EE+",gainValues[gainId]),100,1,101,100,1,101);
190 endc_m_r[
gainId] =
new TH2F(Form(
"EE-r%i",gainId),Form(
"rms %i EE-",gainValues[gainId]),100,1,101,100,1,101);
193 for (
int sign=0; sign <
kSides; sign++) {
194 int thesign = sign==1 ? 1:-1;
200 if(sign == 1) y = ieta;
201 barrel_m[0]->Fill(iphi, y,
object()[
id.rawId()].
mean_x12);
202 barrel_r[0]->Fill(iphi, y,
object()[
id.rawId()].rms_x12);
203 barrel_m[1]->Fill(iphi, y,
object()[
id.rawId()].
mean_x6);
204 barrel_r[1]->Fill(iphi, y,
object()[
id.rawId()].rms_x6);
205 barrel_m[2]->Fill(iphi, y,
object()[
id.rawId()].mean_x1);
206 barrel_r[2]->Fill(iphi, y,
object()[
id.rawId()].rms_x1);
215 endc_p_m[0]->Fill(ix+1,iy+1,
object()[
id.rawId()].
mean_x12);
216 endc_p_r[0]->Fill(ix+1,iy+1,
object()[
id.rawId()].rms_x12);
217 endc_p_m[1]->Fill(ix+1,iy+1,
object()[
id.rawId()].
mean_x6);
218 endc_p_r[1]->Fill(ix+1,iy+1,
object()[
id.rawId()].rms_x6);
219 endc_p_m[2]->Fill(ix+1,iy+1,
object()[
id.rawId()].mean_x1);
220 endc_p_r[2]->Fill(ix+1,iy+1,
object()[
id.rawId()].rms_x1);
223 endc_m_m[0]->Fill(ix+1,iy+1,
object()[
id.rawId()].
mean_x12);
224 endc_m_r[0]->Fill(ix+1,iy+1,
object()[
id.rawId()].rms_x12);
225 endc_m_m[1]->Fill(ix+1,iy+1,
object()[
id.rawId()].
mean_x6);
226 endc_m_r[1]->Fill(ix+1,iy+1,
object()[
id.rawId()].rms_x6);
227 endc_m_m[2]->Fill(ix+1,iy+1,
object()[
id.rawId()].mean_x1);
228 endc_m_r[2]->Fill(ix+1,iy+1,
object()[
id.rawId()].rms_x1);
235 float bmin[3] ={0.7, 0.5, 0.4};
236 float bmax[3] ={1.7, 1.0, 0.8};
237 float emin[3] ={1.5, 0.8, 0.4};
238 float emax[3] ={2.5, 1.5, 0.8};
239 TLine*
l =
new TLine(0., 0., 0., 0.);
241 int ixSectorsEE[202] = {
242 62, 62, 61, 61, 60, 60, 59, 59, 58, 58, 56, 56, 46, 46, 44, 44, 43, 43, 42, 42,
243 41, 41, 40, 40, 41, 41, 42, 42, 43, 43, 44, 44, 46, 46, 56, 56, 58, 58, 59, 59,
244 60, 60, 61, 61, 62, 62, 0,101,101, 98, 98, 96, 96, 93, 93, 88, 88, 86, 86, 81,
245 81, 76, 76, 66, 66, 61, 61, 41, 41, 36, 36, 26, 26, 21, 21, 16, 16, 14, 14, 9,
246 9, 6, 6, 4, 4, 1, 1, 4, 4, 6, 6, 9, 9, 14, 14, 16, 16, 21, 21, 26,
247 26, 36, 36, 41, 41, 61, 61, 66, 66, 76, 76, 81, 81, 86, 86, 88, 88, 93, 93, 96,
248 96, 98, 98,101,101, 0, 62, 66, 66, 71, 71, 81, 81, 91, 91, 93, 0, 62, 66, 66,
249 91, 91, 98, 0, 58, 61, 61, 66, 66, 71, 71, 76, 76, 81, 81, 0, 51, 51, 0, 44,
250 41, 41, 36, 36, 31, 31, 26, 26, 21, 21, 0, 40, 36, 36, 11, 11, 4, 0, 40, 36,
251 36, 31, 31, 21, 21, 11, 11, 9, 0, 46, 46, 41, 41, 36, 36, 0, 56, 56, 61, 61, 66, 66};
253 int iySectorsEE[202] = {
254 51, 56, 56, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 61, 61, 60, 60, 59, 59, 58,
255 58, 56, 56, 46, 46, 44, 44, 43, 43, 42, 42, 41, 41, 40, 40, 41, 41, 42, 42, 43,
256 43, 44, 44, 46, 46, 51, 0, 51, 61, 61, 66, 66, 76, 76, 81, 81, 86, 86, 88, 88,
257 93, 93, 96, 96, 98, 98,101,101, 98, 98, 96, 96, 93, 93, 88, 88, 86, 86, 81, 81,
258 76, 76, 66, 66, 61, 61, 41, 41, 36, 36, 26, 26, 21, 21, 16, 16, 14, 14, 9, 9,
259 6, 6, 4, 4, 1, 1, 4, 4, 6, 6, 9, 9, 14, 14, 16, 16, 21, 21, 26, 26,
260 36, 36, 41, 41, 51, 0, 46, 46, 41, 41, 36, 36, 31, 31, 26, 26, 0, 51, 51, 56,
261 56, 61, 61, 0, 61, 61, 66, 66, 71, 71, 76, 76, 86, 86, 88, 0, 62,101, 0, 61,
262 61, 66, 66, 71, 71, 76, 76, 86, 86, 88, 0, 51, 51, 56, 56, 61, 61, 0, 46, 46,
263 41, 41, 36, 36, 31, 31, 26, 26, 0, 40, 31, 31, 16, 16, 6, 0, 40, 31, 31, 16, 16, 6};
265 for (
int gId = 0; gId < 3; gId++) {
267 endc_m_m[gId]->SetStats(0);
268 endc_m_m[gId]->SetMaximum(225);
269 endc_m_m[gId]->SetMinimum(175);
270 endc_m_m[gId]->Draw(
"colz");
271 for (
int i=0;
i<201;
i=
i+1) {
272 if ( (ixSectorsEE[
i]!=0 || iySectorsEE[
i]!=0) &&
273 (ixSectorsEE[
i+1]!=0 || iySectorsEE[
i+1]!=0) ) {
274 l->DrawLine(ixSectorsEE[
i], iySectorsEE[i],
275 ixSectorsEE[i+1], iySectorsEE[i+1]);
276 l->SetLineWidth(0.2);
279 pad[gId + 3][0]->cd();
280 endc_m_r[gId]->SetStats(0);
281 endc_m_r[gId]->SetMaximum(emax[gId]);
282 endc_m_r[gId]->SetMinimum(emin[gId]);
283 endc_m_r[gId]->Draw(
"colz");
284 for (
int i=0;
i<201;
i=
i+1) {
285 if ( (ixSectorsEE[
i]!=0 || iySectorsEE[
i]!=0) &&
286 (ixSectorsEE[
i+1]!=0 || iySectorsEE[
i+1]!=0) ) {
287 l->DrawLine(ixSectorsEE[
i], iySectorsEE[i],
288 ixSectorsEE[i+1], iySectorsEE[i+1]);
293 barrel_m[gId]->SetStats(0);
294 barrel_m[gId]->SetMaximum(225);
295 barrel_m[gId]->SetMinimum(175);
296 barrel_m[gId]->Draw(
"colz");
297 for(
int i = 0;
i <17;
i++) {
298 Double_t
x = 20.+ (
i *20);
299 l =
new TLine(x,-85.,x,86.);
302 l =
new TLine(0.,0.,360.,0.);
304 pad[gId + 3][1]->cd();
305 barrel_r[gId]->SetStats(0);
306 barrel_r[gId]->SetMaximum(bmax[gId]);
307 barrel_r[gId]->SetMinimum(bmin[gId]);
308 barrel_r[gId]->Draw(
"colz");
309 for(
int i = 0;
i <17;
i++) {
310 Double_t
x = 20.+ (
i *20);
311 l =
new TLine(x,-85.,x,86.);
314 l =
new TLine(0.,0.,360.,0.);
318 endc_p_m[gId]->SetStats(0);
319 endc_p_m[gId]->SetMaximum(225);
320 endc_p_m[gId]->SetMinimum(175);
321 endc_p_m[gId]->Draw(
"colz");
322 for (
int i=0;
i<201;
i=
i+1) {
323 if ( (ixSectorsEE[
i]!=0 || iySectorsEE[
i]!=0) &&
324 (ixSectorsEE[
i+1]!=0 || iySectorsEE[
i+1]!=0) ) {
325 l->DrawLine(ixSectorsEE[
i], iySectorsEE[i],
326 ixSectorsEE[i+1], iySectorsEE[i+1]);
329 pad[gId + 3][2]->cd();
330 endc_p_r[gId]->SetStats(0);
331 endc_p_r[gId]->SetMaximum(emax[gId]);
332 endc_p_r[gId]->SetMinimum(emin[gId]);
333 endc_p_r[gId]->Draw(
"colz");
334 for (
int i=0;
i<201;
i=
i+1) {
335 if ( (ixSectorsEE[
i]!=0 || iySectorsEE[
i]!=0) &&
336 (ixSectorsEE[
i+1]!=0 || iySectorsEE[
i+1]!=0) ) {
337 l->DrawLine(ixSectorsEE[
i], iySectorsEE[i],
338 ixSectorsEE[i+1], iySectorsEE[i+1]);
343 canvas.SaveAs(filename.c_str());
348 namespace condPython {
351 using namespace boost::python;
352 enum_<cond::ecalped::Quantity>(
"Quantity")
357 enum_<cond::ecalped::How>(
"How")
364 class_<What>(
"What",init<>())
365 .def(
"set_quantity",&What::set_quantity)
366 .def(
"set_how",&What::set_how)
367 .def(
"set_which",&What::set_which)
368 .def(
"quantity",&What::quantity, return_value_policy<copy_const_reference>())
369 .def(
"how",&What::how, return_value_policy<copy_const_reference>())
370 .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
#define PYTHON_WRAPPER(_class, _name)
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)
tuple obj
Example code starts here #.
static const int kEndcWedgesX
static const int MAX_IPHI
static const int MAX_IETA
void defineWhat< EcalPedestals >()
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