21 #include <boost/ref.hpp>
22 #include <boost/bind.hpp>
23 #include <boost/function.hpp>
24 #include <boost/iterator/transform_iterator.hpp>
40 return std::count_if(cont.begin(),cont.end(),
41 boost::bind(std::greater<int>(),
65 result.reserve(which.size());
66 for (
unsigned int i=0;
i<which.size();
i++) {
67 result.push_back(cont[which[
i]].getStatusCode());
71 typedef boost::function<void(EcalDQMTowerStatus const & cont, std::vector<int>
const & which, std::vector<float> &
result)>
CondExtractor;
81 std::vector<int>
const &
which()
const {
return m_which;}
113 std::vector<float> res;
114 extractor(m_what.how())(it,m_what.which(),res);
147 std::stringstream ss;
151 "CH_GAIN_ZERO_ERROR ",
152 "CH_GAIN_SWITCH_ERROR ",
155 "PEDESTAL_LOW_GAIN_MEAN_ERROR ",
156 "PEDESTAL_MIDDLE_GAIN_MEAN_ERROR ",
157 "PEDESTAL_HIGH_GAIN_MEAN_ERROR ",
158 "PEDESTAL_LOW_GAIN_RMS_ERROR ",
159 "PEDESTAL_MIDDLE_GAIN_RMS_ERROR ",
160 "PEDESTAL_HIGH_GAIN_RMS_ERROR ",
161 "PEDESTAL_ONLINE_HIGH_GAIN_MEAN_ERROR ",
162 "PEDESTAL_ONLINE_HIGH_GAIN_RMS_ERROR ",
163 "TESTPULSE_LOW_GAIN_MEAN_ERROR ",
164 "TESTPULSE_MIDDLE_GAIN_MEAN_ERROR ",
165 "TESTPULSE_HIGH_GAIN_MEAN_ERROR ",
166 "TESTPULSE_LOW_GAIN_RMS_ERROR ",
167 "TESTPULSE_MIDDLE_GAIN_RMS_ERROR ",
168 "TESTPULSE_HIGH_GAIN_RMS_ERROR ",
171 "LASER_TIMING_MEAN_ERROR ",
172 "LASER_TIMING_RMS_ERROR ",
175 "LED_TIMING_MEAN_ERROR ",
176 "LED_TIMING_RMS_ERROR ",
177 "STATUS_FLAG_ERROR ",
178 "PHYSICS_BAD_CHANNEL_WARNING ",
179 "PHYSICS_BAD_CHANNEL_ERROR "
182 ss.str(
""); ss <<
"[" <<
i <<
"]" << valueNames[
i];
183 vValues[
i].first = ss.str();
184 vValues[
i].second = .0;
188 unsigned int shift = 0, mask = 1;
189 unsigned int statusCode;
190 for(std::vector<EcalObject>::const_iterator iItems = vItems.begin(); iItems != vItems.end(); ++iItems){
192 statusCode = iItems->getStatusCode();
196 if (statusCode & mask){
197 vValues[
shift].second += 1;
207 std::stringstream ss;
217 std::vector<int>
const&,
218 std::vector<float>
const& )
const {
222 TCanvas
canvas(
"CC map",
"CC map",800,800);
223 TPad* padb =
new TPad(
"padb",
"padb", 0., 0.55, 1., 1.);
225 TPad* padem =
new TPad(
"padem",
"padem", 0., 0., 0.45, 0.45);
227 TPad* padep =
new TPad(
"padep",
"padep", 0.55, 0., 1., 0.45);
230 TH2F*
barrel =
new TH2F(
"EB",
"EB Tower Status", 72, 0, 72, 34, -17, 17);
231 TH2F* endc_p =
new TH2F(
"EE+",
"EE+ Tower Status",22, 0, 22, 22, 0, 22);
232 TH2F* endc_m =
new TH2F(
"EE-",
"EE- Tower Status",22, 0, 22, 22, 0, 22);
237 if (
object().
find(rawid) ==
object().
end())
continue;
238 int ieta = rawid.
ieta();
240 int iphi = rawid.
iphi() - 1;
241 barrel->Fill(iphi, ieta,
object()[rawid].getStatusCode());
250 int side = rawid.
zside();
252 endc_m->Fill(ix, iy,
object()[rawid].getStatusCode());
254 endc_p->Fill(ix, iy,
object()[rawid].getStatusCode());
257 TLine*
l =
new TLine(0., 0., 0., 0.);
265 for(
int i = 0;
i <17;
i++) {
266 Double_t
x = 4.+ (
i * 4);
267 l =
new TLine(x, -17., x, 17.);
270 l =
new TLine(0., 0., 72., 0.);
273 int ixSectorsEE[136] = {
274 8,14,14,17,17,18,18,19,19,20,20,21,21,20,20,19,19,18,18,17,
275 17,14,14, 8, 8, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 2, 2, 3, 3, 4,
276 4, 5, 5, 8, 8, 8, 9, 9,10,10,12,12,13,13,12,12,10,10, 9, 9,
277 10,10, 0,11,11, 0,10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 0,12,13,
278 13,14,14,15,15,16,16,17,17, 0, 9, 8, 8, 3, 3, 1, 0,13,14,14,
279 19,19,21, 0, 9, 8, 8, 7, 7, 5, 5, 3, 3, 2, 0,13,14,14,15,15,
280 17,17,19,19,20, 0,14,14,13,13,12,12,0};
281 int iySectorsEE[136] = {
282 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 8, 8,14,14,17,17,18,18,19,19,
283 20,20,21,21,20,20,19,19,18,18,17,17,14,14, 8, 8, 5, 5, 4, 4,
284 3, 3, 2, 2, 1, 4, 4, 7, 7, 9, 9,10,10,12,12,13,13,12,12,10,
285 10, 9, 0,13,21, 0,13,13,14,14,15,15,16,16,18,18,19, 0,13,13,
286 14,14,15,15,16,16,18,18,19, 0,11,11,12,12,13,13, 0,11,11,12,
287 12,13,13, 0,10,10, 9, 9, 8, 8, 7, 7, 6, 6, 0,10,10, 9, 9, 8,
288 8, 7, 7, 6, 6, 0, 2, 4, 4, 7, 7, 9, 0} ;
292 for (
int i = 0;
i < 136;
i=
i+1) {
293 if ( (ixSectorsEE[
i]!=0 || iySectorsEE[
i]!=0) &&
294 (ixSectorsEE[
i+1]!=0 || iySectorsEE[
i+1]!=0) ) {
295 l->DrawLine(ixSectorsEE[
i], iySectorsEE[i],
296 ixSectorsEE[i+1], iySectorsEE[i+1]);
303 for (
int i = 0;
i < 136;
i=
i+1) {
304 if ( (ixSectorsEE[
i]!=0 || iySectorsEE[
i]!=0) &&
305 (ixSectorsEE[
i+1]!=0 || iySectorsEE[
i+1]!=0) ) {
306 l->DrawLine(ixSectorsEE[
i], iySectorsEE[i],
307 ixSectorsEE[i+1], iySectorsEE[i+1]);
311 canvas.SaveAs(filename.c_str());
317 namespace condPython {
320 enum_<cond::ecalcond::How>(
"How")
327 class_<What>(
"What",init<>())
328 .def(
"set_how",&What::set_how)
329 .def(
"set_which",&What::set_which)
330 .def(
"how",&What::how, return_value_policy<copy_const_reference>())
331 .def(
"which",&What::which, return_value_policy<copy_const_reference>())
void extractSuperModules(Container const &cont, std::vector< int > const &which, std::vector< float > &result)
static EcalTrigTowerDetId detIdFromDenseIndex(uint32_t di)
std::string plot(std::string const &, std::string const &, std::vector< int > const &, std::vector< float > const &) const
EcalDQMStatusCode EcalObject
static const unsigned int STATUS
std::vector< Item > Items
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
static EcalScDetId unhashIndex(int hi)
#define PYTHON_WRAPPER(_class, _name)
unsigned int total_values
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
const Items & endcapItems() const
int ieta() const
get the tower ieta
int bad(Items const &cont)
std::string summary() const
uint16_t getStatusCode() const
const Items & barrelItems() const
Container::value_type value_type
int iphi() const
get the tower iphi
static bool validHashIndex(int hi)
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)
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)
void defineWhat< EcalDQMTowerStatus >()
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)
EcalDQMTowerStatusHelper()