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(EcalTPGCrystalStatus 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 =
"[0]StatusCode";
151 vValues[0].second = .0;
154 unsigned int shift = 0, mask = 1;
155 unsigned int statusCode;
156 for(std::vector<EcalObject>::const_iterator iItems = vItems.begin(); iItems != vItems.end(); ++iItems){
158 statusCode = iItems->getStatusCode();
162 if (statusCode & mask){
163 vValues[
shift].second += 1;
173 std::stringstream ss;
182 int EB[2] = {0, 0}, EE[2] = {0, 0};
183 for (
int sign=0; sign <
kSides; sign++) {
184 int thesign = sign==1 ? 1:-1;
188 EBDetId id((ieta+1)*thesign, iphi+1);
189 if(
object()[
id.rawId()].getStatusCode() > 0) EB[sign]++;
197 if(
object()[
id.rawId()].getStatusCode() > 0) EE[sign]++;
201 ss <<
" number of masked Crystals EB- " << EB[0] <<
" EB+ " << EB[1]
202 <<
" EE- " << EE[0] <<
" EE+ " << EE[1] << std::endl;
209 std::vector<int>
const&,
210 std::vector<float>
const& )
const {
211 gStyle->SetPalette(1);
212 const int TOTAL_PADS = 3;
217 TCanvas
canvas(
"c",
"c", w, h);
218 canvas.SetWindowSize(w + (w - canvas.GetWw()), h + (h - canvas.GetWh()));
222 float xmi[3] = {0.0, 0.0, 0.5};
223 float xma[3] = {1.0, 0.5, 1.0};
224 float ymi[3] = {0.5, 0.0, 0.0};
225 float yma[3] = {1.0, 0.5, 0.5};
228 TPad** pad =
new TPad*[TOTAL_PADS];
229 for (
int obj = 0;
obj < TOTAL_PADS;
obj++) {
230 pad[
obj] =
new TPad(Form(
"p_%i",
obj),Form(
"p_%i",
obj),
231 xmi[
obj], ymi[obj], xma[obj], yma[obj]);
241 TH2F*
barrel =
new TH2F(
"EB",
"EB TPG Crystal Status", 360,0,360, 170, -85,85);
242 TH2F* endc_m =
new TH2F(
"EEm",
"EE- TPG Crystal Status",100,1,101,100,1,101);
243 TH2F* endc_p =
new TH2F(
"EEp",
"EE+ TPG Crystal Status",100,1,101,100,1,101);
245 for (
int sign=0; sign <
kSides; sign++) {
246 int thesign = sign==1 ? 1:-1;
250 EBDetId id((ieta+1)*thesign, iphi+1);
252 if(sign == 1) y = ieta;
253 barrel->Fill(iphi, y,
object()[
id.rawId()].getStatusCode());
262 endc_p->Fill(ix+1,iy+1,
object()[
id.rawId()].getStatusCode());
265 endc_m->Fill(ix+1,iy+1,
object()[
id.rawId()].getStatusCode());
271 TLine*
l =
new TLine(0., 0., 0., 0.);
273 int ixSectorsEE[202] = {
274 62, 62, 61, 61, 60, 60, 59, 59, 58, 58, 56, 56, 46, 46, 44, 44, 43, 43, 42, 42,
275 41, 41, 40, 40, 41, 41, 42, 42, 43, 43, 44, 44, 46, 46, 56, 56, 58, 58, 59, 59,
276 60, 60, 61, 61, 62, 62, 0,101,101, 98, 98, 96, 96, 93, 93, 88, 88, 86, 86, 81,
277 81, 76, 76, 66, 66, 61, 61, 41, 41, 36, 36, 26, 26, 21, 21, 16, 16, 14, 14, 9,
278 9, 6, 6, 4, 4, 1, 1, 4, 4, 6, 6, 9, 9, 14, 14, 16, 16, 21, 21, 26,
279 26, 36, 36, 41, 41, 61, 61, 66, 66, 76, 76, 81, 81, 86, 86, 88, 88, 93, 93, 96,
280 96, 98, 98,101,101, 0, 62, 66, 66, 71, 71, 81, 81, 91, 91, 93, 0, 62, 66, 66,
281 91, 91, 98, 0, 58, 61, 61, 66, 66, 71, 71, 76, 76, 81, 81, 0, 51, 51, 0, 44,
282 41, 41, 36, 36, 31, 31, 26, 26, 21, 21, 0, 40, 36, 36, 11, 11, 4, 0, 40, 36,
283 36, 31, 31, 21, 21, 11, 11, 9, 0, 46, 46, 41, 41, 36, 36, 0, 56, 56, 61, 61, 66, 66};
285 int iySectorsEE[202] = {
286 51, 56, 56, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 61, 61, 60, 60, 59, 59, 58,
287 58, 56, 56, 46, 46, 44, 44, 43, 43, 42, 42, 41, 41, 40, 40, 41, 41, 42, 42, 43,
288 43, 44, 44, 46, 46, 51, 0, 51, 61, 61, 66, 66, 76, 76, 81, 81, 86, 86, 88, 88,
289 93, 93, 96, 96, 98, 98,101,101, 98, 98, 96, 96, 93, 93, 88, 88, 86, 86, 81, 81,
290 76, 76, 66, 66, 61, 61, 41, 41, 36, 36, 26, 26, 21, 21, 16, 16, 14, 14, 9, 9,
291 6, 6, 4, 4, 1, 1, 4, 4, 6, 6, 9, 9, 14, 14, 16, 16, 21, 21, 26, 26,
292 36, 36, 41, 41, 51, 0, 46, 46, 41, 41, 36, 36, 31, 31, 26, 26, 0, 51, 51, 56,
293 56, 61, 61, 0, 61, 61, 66, 66, 71, 71, 76, 76, 86, 86, 88, 0, 62,101, 0, 61,
294 61, 66, 66, 71, 71, 76, 76, 86, 86, 88, 0, 51, 51, 56, 56, 61, 61, 0, 46, 46,
295 41, 41, 36, 36, 31, 31, 26, 26, 0, 40, 31, 31, 16, 16, 6, 0, 40, 31, 31, 16, 16, 6};
299 barrel->Draw(
"colz");
300 for(
int i = 0;
i <17;
i++) {
301 Double_t
x = 20.+ (
i *20);
302 l =
new TLine(x,-85.,x,86.);
305 l =
new TLine(0.,0.,360.,0.);
311 for (
int i=0;
i<201;
i=
i+1) {
312 if ( (ixSectorsEE[
i]!=0 || iySectorsEE[
i]!=0) &&
313 (ixSectorsEE[
i+1]!=0 || iySectorsEE[
i+1]!=0) ) {
314 l->DrawLine(ixSectorsEE[
i], iySectorsEE[i],
315 ixSectorsEE[i+1], iySectorsEE[i+1]);
316 l->SetLineWidth(0.2);
323 for (
int i=0;
i<201;
i=
i+1) {
324 if ( (ixSectorsEE[
i]!=0 || iySectorsEE[
i]!=0) &&
325 (ixSectorsEE[
i+1]!=0 || iySectorsEE[
i+1]!=0) ) {
326 l->DrawLine(ixSectorsEE[
i], iySectorsEE[i],
327 ixSectorsEE[i+1], iySectorsEE[i+1]);
331 canvas.SaveAs(filename.c_str());
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
static std::string dumpXML(const EcalCondHeader &header, const EcalTPGCrystalStatus &record)
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
EcalTPGCrystalStatusCode EcalObject
int bad(Items const &cont)
static const int kBarlWedges
std::string summary() const
static const int kEndcWedgesX
EcalTPGCrystalStatusHelper()
uint16_t getStatusCode() const
type_vValues getValues(const std::vector< EcalObject > &vItems) override
Container::value_type value_type
static const int MAX_IPHI
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
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)
static unsigned int const shift
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