19 #include <boost/ref.hpp>
20 #include <boost/bind.hpp>
21 #include <boost/function.hpp>
22 #include <boost/iterator/transform_iterator.hpp>
36 return std::count_if(cont.begin(),cont.end(),
37 boost::bind(std::greater<int>(),
38 boost::bind(&value_type::getStatusCode,_1),0)
61 result.reserve(which.size());
62 for (
unsigned int i=0;
i<which.size();
i++) {
63 result.push_back(cont[which[
i]].getStatusCode());
67 typedef boost::function<void(EcalDQMChannelStatus const & cont, std::vector<int>
const & which, std::vector<float> &
result)>
CondExtractor;
77 std::vector<int>
const &
which()
const {
return m_which;}
109 std::vector<float> res;
110 extractor(m_what.how())(it,m_what.which(),res);
143 std::stringstream ss;
147 "CH_GAIN_ZERO_ERROR ",
148 "CH_GAIN_SWITCH_ERROR ",
151 "PEDESTAL_LOW_GAIN_MEAN_ERROR ",
152 "PEDESTAL_MIDDLE_GAIN_MEAN_ERROR ",
153 "PEDESTAL_HIGH_GAIN_MEAN_ERROR ",
154 "PEDESTAL_LOW_GAIN_RMS_ERROR ",
155 "PEDESTAL_MIDDLE_GAIN_RMS_ERROR ",
156 "PEDESTAL_HIGH_GAIN_RMS_ERROR ",
157 "PEDESTAL_ONLINE_HIGH_GAIN_MEAN_ERROR ",
158 "PEDESTAL_ONLINE_HIGH_GAIN_RMS_ERROR ",
159 "TESTPULSE_LOW_GAIN_MEAN_ERROR ",
160 "TESTPULSE_MIDDLE_GAIN_MEAN_ERROR ",
161 "TESTPULSE_HIGH_GAIN_MEAN_ERROR ",
162 "TESTPULSE_LOW_GAIN_RMS_ERROR ",
163 "TESTPULSE_MIDDLE_GAIN_RMS_ERROR ",
164 "TESTPULSE_HIGH_GAIN_RMS_ERROR ",
167 "LASER_TIMING_MEAN_ERROR ",
168 "LASER_TIMING_RMS_ERROR ",
171 "LED_TIMING_MEAN_ERROR ",
172 "LED_TIMING_RMS_ERROR ",
173 "STATUS_FLAG_ERROR ",
174 "PHYSICS_BAD_CHANNEL_WARNING ",
175 "PHYSICS_BAD_CHANNEL_ERROR "
178 ss.str(
""); ss <<
"[" <<
i <<
"]" << valueNames[
i];
179 vValues[
i].first = ss.str();
180 vValues[
i].second = .0;
184 unsigned int shift = 0, mask = 1;
185 unsigned int statusCode;
186 for(std::vector<EcalObject>::const_iterator iItems = vItems.begin(); iItems != vItems.end(); ++iItems){
188 statusCode = iItems->getStatusCode();
192 if (statusCode & mask){
193 vValues[
shift].second += 1;
203 std::stringstream ss;
213 std::vector<int>
const&,
214 std::vector<float>
const& )
const {
215 gStyle->SetPalette(1);
216 const int TOTAL_IMAGES = 1;
217 const int TOTAL_PADS = 3;
219 const float IMG_SIZE = 1.5;
220 TCanvas
canvas(
"CC map",
"CC map",800*IMG_SIZE, 200 * TOTAL_IMAGES*IMG_SIZE);
222 float xmi[3] = {0.0 , 0.22, 0.78};
223 float xma[3] = {0.22, 0.78, 1.00};
226 TPad*** pad =
new TPad**[TOTAL_IMAGES];
227 for (
int gId = 0; gId < TOTAL_IMAGES; gId++) {
228 pad[gId] =
new TPad*[TOTAL_PADS];
229 for (
int obj = 0;
obj < TOTAL_PADS;
obj++) {
232 pad[gId][
obj] =
new TPad(Form(
"p_%i_%i",
obj, gId),Form(
"p_%i_%i",
obj, gId),
233 xmi[
obj], ymi, xma[obj], yma);
234 pad[gId][
obj]->Draw();
238 const int kGains = 3;
239 const int gainValues[3] = {12, 6, 1};
246 TH2F** barrel_m =
new TH2F*[3];
247 TH2F** endc_p_m =
new TH2F*[3];
248 TH2F** endc_m_m =
new TH2F*[3];
251 barrel_m[
gainId] =
new TH2F(Form((variableName +
" EBm%i").c_str(),
gainId), Form((variableName +
" EB").c_str(),gainValues[
gainId]),360,0,360, 170, -85,85);
252 endc_p_m[
gainId] =
new TH2F(Form((variableName +
" EE+m%i").c_str(),gainId), Form((variableName +
" EE+").c_str(),gainValues[gainId]),100,1,101,100,1,101);
253 endc_m_m[
gainId] =
new TH2F(Form((variableName +
" EE-m%i").c_str(),gainId), Form((variableName +
" EE-").c_str(),gainValues[gainId]),100,1,101,100,1,101);
256 for (
int sign=0; sign <
kSides; sign++) {
257 int thesign = sign==1 ? 1:-1;
261 EBDetId id((ieta+1)*thesign, iphi+1);
263 if(sign == 1) y = ieta;
264 barrel_m[0]->Fill(iphi, y,
object()[
id.rawId()].getStatusCode());
273 endc_p_m[0]->Fill(ix+1,iy+1,
object()[
id.rawId()].getStatusCode());
276 endc_m_m[0]->Fill(ix+1,iy+1,
object()[
id.rawId()].getStatusCode());
283 TLine*
l =
new TLine(0., 0., 0., 0.);
285 int ixSectorsEE[202] = {
286 62, 62, 61, 61, 60, 60, 59, 59, 58, 58, 56, 56, 46, 46, 44, 44, 43, 43, 42, 42,
287 41, 41, 40, 40, 41, 41, 42, 42, 43, 43, 44, 44, 46, 46, 56, 56, 58, 58, 59, 59,
288 60, 60, 61, 61, 62, 62, 0,101,101, 98, 98, 96, 96, 93, 93, 88, 88, 86, 86, 81,
289 81, 76, 76, 66, 66, 61, 61, 41, 41, 36, 36, 26, 26, 21, 21, 16, 16, 14, 14, 9,
290 9, 6, 6, 4, 4, 1, 1, 4, 4, 6, 6, 9, 9, 14, 14, 16, 16, 21, 21, 26,
291 26, 36, 36, 41, 41, 61, 61, 66, 66, 76, 76, 81, 81, 86, 86, 88, 88, 93, 93, 96,
292 96, 98, 98,101,101, 0, 62, 66, 66, 71, 71, 81, 81, 91, 91, 93, 0, 62, 66, 66,
293 91, 91, 98, 0, 58, 61, 61, 66, 66, 71, 71, 76, 76, 81, 81, 0, 51, 51, 0, 44,
294 41, 41, 36, 36, 31, 31, 26, 26, 21, 21, 0, 40, 36, 36, 11, 11, 4, 0, 40, 36,
295 36, 31, 31, 21, 21, 11, 11, 9, 0, 46, 46, 41, 41, 36, 36, 0, 56, 56, 61, 61, 66, 66};
297 int iySectorsEE[202] = {
298 51, 56, 56, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 61, 61, 60, 60, 59, 59, 58,
299 58, 56, 56, 46, 46, 44, 44, 43, 43, 42, 42, 41, 41, 40, 40, 41, 41, 42, 42, 43,
300 43, 44, 44, 46, 46, 51, 0, 51, 61, 61, 66, 66, 76, 76, 81, 81, 86, 86, 88, 88,
301 93, 93, 96, 96, 98, 98,101,101, 98, 98, 96, 96, 93, 93, 88, 88, 86, 86, 81, 81,
302 76, 76, 66, 66, 61, 61, 41, 41, 36, 36, 26, 26, 21, 21, 16, 16, 14, 14, 9, 9,
303 6, 6, 4, 4, 1, 1, 4, 4, 6, 6, 9, 9, 14, 14, 16, 16, 21, 21, 26, 26,
304 36, 36, 41, 41, 51, 0, 46, 46, 41, 41, 36, 36, 31, 31, 26, 26, 0, 51, 51, 56,
305 56, 61, 61, 0, 61, 61, 66, 66, 71, 71, 76, 76, 86, 86, 88, 0, 62,101, 0, 61,
306 61, 66, 66, 71, 71, 76, 76, 86, 86, 88, 0, 51, 51, 56, 56, 61, 61, 0, 46, 46,
307 41, 41, 36, 36, 31, 31, 26, 26, 0, 40, 31, 31, 16, 16, 6, 0, 40, 31, 31, 16, 16, 6};
309 for (
int gId = 0; gId < TOTAL_IMAGES; gId++) {
311 endc_m_m[gId]->SetStats(0);
314 endc_m_m[gId]->Draw(
"colz");
315 for (
int i=0;
i<201;
i=
i+1) {
316 if ( (ixSectorsEE[
i]!=0 || iySectorsEE[
i]!=0) &&
317 (ixSectorsEE[
i+1]!=0 || iySectorsEE[
i+1]!=0) ) {
318 l->DrawLine(ixSectorsEE[
i], iySectorsEE[i],
319 ixSectorsEE[i+1], iySectorsEE[i+1]);
320 l->SetLineWidth(0.2);
326 barrel_m[gId]->SetStats(0);
329 barrel_m[gId]->Draw(
"colz");
330 for(
int i = 0;
i <17;
i++) {
331 Double_t
x = 20.+ (
i *20);
332 l =
new TLine(x,-85.,x,86.);
335 l =
new TLine(0.,0.,360.,0.);
340 endc_p_m[gId]->SetStats(0);
343 endc_p_m[gId]->Draw(
"colz");
344 for (
int i=0;
i<201;
i=
i+1) {
345 if ( (ixSectorsEE[
i]!=0 || iySectorsEE[
i]!=0) &&
346 (ixSectorsEE[
i+1]!=0 || iySectorsEE[
i+1]!=0) ) {
347 l->DrawLine(ixSectorsEE[
i], iySectorsEE[i],
348 ixSectorsEE[i+1], iySectorsEE[i+1]);
353 canvas.SaveAs(filename.c_str());
361 namespace condPython {
364 enum_<cond::ecalcond::How>(
"How")
371 class_<What>(
"What",init<>())
372 .def(
"set_how",&What::set_how)
373 .def(
"set_which",&What::set_which)
374 .def(
"how",&What::how, return_value_policy<copy_const_reference>())
375 .def(
"which",&What::which, return_value_policy<copy_const_reference>())
void extractSuperModules(Container const &cont, std::vector< int > const &which, std::vector< float > &result)
std::string plot(std::string const &, std::string const &, std::vector< int > const &, std::vector< float > const &) const
static const unsigned int STATUS
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
boost::function< void(Container const &cont, std::vector< int > const &which, std::vector< float > &result)> CondExtractor
#define PYTHON_WRAPPER(_class, _name)
unsigned int total_values
int bad(Items const &cont)
static const int kBarlWedges
std::string summary() const
static const int kEndcWedgesX
EcalDQMStatusCode EcalObject
EcalDQMChannelStatusHelper()
Container::value_type value_type
static const int MAX_IPHI
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
static const int MAX_IETA
std::vector< Item > Items
void extractSingleChannel(Container const &cont, std::vector< int > const &which, std::vector< float > &result)
std::string printBarrelsEndcaps(const std::vector< T > &barrelItems, const std::vector< T > &endcapItems)
void defineWhat< EcalDQMChannelStatus >()
static unsigned int const shift
type_vValues getValues(const std::vector< EcalObject > &vItems)
void extractBarrel(Container const &cont, std::vector< int > const &, std::vector< float > &result)
const Items & endcapItems() const
void extractEndcap(Container const &cont, std::vector< int > const &, std::vector< float > &result)
void extractAll(Container const &cont, std::vector< int > const &, std::vector< float > &result)
static const int kEndcWedgesY