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(EcalDCSTowerStatus 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);
125 std::stringstream
ss;
148 vValues[0].first =
"LVSTATUS(0)";
149 vValues[1].first =
"LVNOMINALSTATUS(1)";
150 vValues[2].first =
"HVSTATUS(2)";
151 vValues[3].first =
"HVNOMINALSTATUS(3)";
152 vValues[4].first =
"HVEEDSTATUS(4)";
153 vValues[5].first =
"HVEEDNOMINALSTATUS(5)";
156 vValues[0].second = .0;
157 vValues[1].second = .0;
158 vValues[2].second = .0;
159 vValues[3].second = .0;
160 vValues[4].second = .0;
161 vValues[5].second = .0;
164 unsigned int shift = 0, mask = 1;
165 unsigned int statusCode;
166 for(std::vector<EcalObject>::const_iterator iItems = vItems.begin(); iItems != vItems.end(); ++iItems){
168 statusCode = iItems->getStatusCode();
172 if (statusCode & mask){
173 vValues[
shift].second += 1;
183 std::stringstream
ss;
194 std::vector<int>
const&,
195 std::vector<float>
const& )
const {
201 gStyle->SetPalette(1);
203 const Int_t NRGBs = 5;
204 const Int_t NCont = 255;
206 Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
207 Double_t
red[NRGBs] = { 0.00, 0.00, 0.87, 1.00, 0.51 };
208 Double_t
green[NRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 };
209 Double_t blue[NRGBs] = { 0.51, 1.00, 0.12, 0.00, 0.00 };
210 TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
211 gStyle->SetNumberContours(NCont);
213 TCanvas
canvas(
"CC map",
"CC map",800,800);
214 TPad* padb =
new TPad(
"padb",
"padb", 0., 0.55, 1., 1.);
216 TPad* padem =
new TPad(
"padem",
"padem", 0., 0., 0.45, 0.45);
218 TPad* padep =
new TPad(
"padep",
"padep", 0.55, 0., 1., 0.45);
222 TH2F*
barrel =
new TH2F(
"EB",
"EB Tower Status", 72, 0, 72, 34, -17, 17);
223 TH2F* endc_p =
new TH2F(
"EE+",
"EE+ Tower Status",22, 0, 22, 22, 0, 22);
224 TH2F* endc_m =
new TH2F(
"EE-",
"EE- Tower Status",22, 0, 22, 22, 0, 22);
229 if (
object().
find(rawid) ==
object().
end())
continue;
230 int ieta = rawid.
ieta();
232 int iphi = rawid.
iphi() - 1;
233 barrel->Fill(iphi, ieta,
object()[rawid].getStatusCode());
242 int side = rawid.
zside();
244 endc_m->Fill(ix, iy,
object()[rawid].getStatusCode());
246 endc_p->Fill(ix, iy,
object()[rawid].getStatusCode());
249 TLine*
l =
new TLine(0., 0., 0., 0.);
253 barrel->SetMaximum(14);
254 barrel->SetMinimum(0);
255 barrel->Draw(
"colz");
257 for(
int i = 0;
i <17;
i++) {
258 Double_t
x = 4.+ (
i * 4);
259 l =
new TLine(x, -17., x, 17.);
262 l =
new TLine(0., 0., 72., 0.);
265 int ixSectorsEE[133] = {
266 8,14,14,17,17,18,18,19,19,20,20,21,21,20,20,19,19,18,18,17,
267 17,14,14, 8, 8, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 2, 2, 3, 3, 4,
268 4, 5, 5, 8, 8, 8, 9, 9,10,10,12,12,13,13,12,12,10,10, 9, 9,
269 10,10, 0,11,11, 0,10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 0,12,13,
270 13,14,14,15,15,16,16,17,17, 0, 9, 8, 8, 3, 3, 1, 0,13,14,14,
271 19,19,21, 0, 9, 8, 8, 7, 7, 5, 5, 3, 3, 2, 0,13,14,14,15,15,
272 17,17,19,19,20, 0,14,14,13,13,12,12,0};
273 int iySectorsEE[133] = {
274 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 8, 8,14,14,17,17,18,18,19,19,
275 20,20,21,21,20,20,19,19,18,18,17,17,14,14, 8, 8, 5, 5, 4, 4,
276 3, 3, 2, 2, 1, 4, 4, 7, 7, 9, 9,10,10,12,12,13,13,12,12,10,
277 10, 9, 0,13,21, 0,13,13,14,14,15,15,16,16,18,18,19, 0,13,13,
278 14,14,15,15,16,16,18,18,19, 0,11,11,12,12,13,13, 0,11,11,12,
279 12,13,13, 0,10,10, 9, 9, 8, 8, 7, 7, 6, 6, 0,10,10, 9, 9, 8,
280 8, 7, 7, 6, 6, 0, 2, 4, 4, 7, 7, 9, 0} ;
283 endc_m->SetMaximum(14);
284 endc_m->SetMinimum(0);
285 endc_m->Draw(
"colz");
286 for (
int i = 0;
i < 132;
i=
i+1) {
287 if ( (ixSectorsEE[
i]!=0 || iySectorsEE[
i]!=0) &&
288 (ixSectorsEE[
i+1]!=0 || iySectorsEE[
i+1]!=0) ) {
289 l->DrawLine(ixSectorsEE[
i], iySectorsEE[i],
290 ixSectorsEE[i+1], iySectorsEE[i+1]);
296 endc_p->SetMaximum(14);
297 endc_p->SetMinimum(0);
298 endc_p->Draw(
"colz");
299 for (
int i = 0;
i < 132;
i=
i+1) {
300 if ( (ixSectorsEE[
i]!=0 || iySectorsEE[
i]!=0) &&
301 (ixSectorsEE[
i+1]!=0 || iySectorsEE[
i+1]!=0) ) {
302 l->DrawLine(ixSectorsEE[
i], iySectorsEE[i],
303 ixSectorsEE[i+1], iySectorsEE[i+1]);
307 canvas.SaveAs(filename.c_str());
313 namespace condPython {
316 using namespace boost::python;
317 enum_<cond::ecalcond::How>(
"How")
324 class_<What>(
"What",init<>())
325 .def(
"set_how",&What::set_how)
326 .def(
"set_which",&What::set_which)
327 .def(
"how",&What::how, return_value_policy<copy_const_reference>())
328 .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
tuple cont
load Luminosity info ##
EcalDCSTowerStatusHelper()
static const unsigned int STATUS
std::vector< Item > Items
std::vector< std::pair< std::string, float > > type_vValues
Code getStatusCode() const
return decoded status
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)
T x() const
Cartesian x coordinate.
std::string summary() const
const Items & barrelItems() const
EcalChannelStatusCode EcalObject
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Container::value_type value_type
type_vValues getValues(const std::vector< EcalObject > &vItems) override
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
void defineWhat< EcalDCSTowerStatus >()
static std::string dumpXML(const EcalCondHeader &header, const EcalDCSTowerStatus &record)
void extractBarrel(Container const &cont, std::vector< int > const &, std::vector< float > &result)
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)