8 #include "TMultiGraph.h"
29 {-1.2544, -0.8542, -0.3017, 0.3425, 0.8796};
32 {-0.8796, -0.3425, 0.3017, 0.8542, 1.2544};
86 std::vector<uint32_t>::const_iterator
found =
88 if ((found !=
deadIds.end()) && (*found ==
id))
return true;
94 std::vector<uint32_t>::const_iterator
found =
96 if ((found !=
SiPMIds.end()) && (*found ==
id))
return true;
103 for (
int ieta = 0; ieta<
etaBounds; ++ieta) {
104 if ( (eta >
etaMin[ieta]+delta_eta) &&
105 (eta <
etaMax[ieta]-delta_eta) ) {
109 while (phi < mins[0])
111 while (phi > mins[0]+
twopi)
113 if ( ( phi > mins[iphi] + delta_phi ) &&
127 int ieta = int(eta/0.087) + ((eta>0) ? 1 : -1);
129 while (phi < mins[0])
131 while (phi > mins[0]+
twopi)
133 std::vector<deadRegion>::const_iterator region;
135 if ( (phi < region->phiMax + delta_phi) &&
137 (eta < region->
etaMax + delta_eta) &&
146 if (!
inited)
return false;
147 int ieta = int(eta/0.087) + ((eta>0) ? 1 : -1);
149 while (phi < mins[0])
151 while (phi > mins[0]+
twopi)
153 std::vector<deadRegion>::const_iterator region;
155 if ( (phi < region->phiMax - delta_phi) &&
157 (eta < region->
etaMax - delta_eta) &&
185 for (ieta=-15; ieta <= 15; ieta++) {
187 for (iphi = 1; iphi <= 72; iphi++) {
198 if ( (ieta>=5) && (ieta<=10) && (iphi >= 47) && (iphi <= 58) ) {
202 if ( (ieta>=11) && (ieta<=15) && (iphi >= 59) && (iphi <= 70) ) {
219 std::vector<uint32_t>::iterator did;
220 std::list<deadIdRegion> didregions;
233 std::vector<uint32_t>::iterator sid;
234 std::list<deadIdRegion> idregions;
247 std::list<deadIdRegion>::iterator curr;
248 std::list<deadIdRegion> list2;
249 unsigned int startSize;
251 startSize = didregions.size();
255 curr = didregions.begin();
256 while (curr != didregions.end()) {
258 curr = didregions.erase(curr);
259 while (curr != didregions.end()) {
262 curr = didregions.erase(curr);
265 list2.push_back(merger);
266 curr = didregions.begin();
270 curr = list2.begin();
271 while (curr != list2.end()) {
273 curr = list2.erase(curr);
274 while (curr != list2.end()) {
277 curr = list2.erase(curr);
280 didregions.push_back(merger);
281 curr = list2.begin();
283 }
while (startSize > didregions.size());
287 std::vector<deadRegion>& regions) {
289 double eMin,eMax,pMin,pMax;
290 static double const etaStep = 0.087;
291 static double const phiStep =
twopi/72.;
294 double const * maxes;
295 std::list<deadIdRegion>::const_iterator curr;
297 for (curr = idregions.begin(); curr != idregions.end(); ++curr) {
301 if (curr->etaMin == -4) {
303 }
else if (curr->etaMin == 5) {
306 e1 = (
std::abs(curr->etaMin)-1)*etaStep*
307 (-(curr->etaMin<0) + (curr->etaMin>0));
308 e2 =
std::abs(curr->etaMin)*etaStep*
309 (-(curr->etaMin<0) + (curr->etaMin>0));
312 if (curr->etaMax == 4) {
314 }
else if (curr->etaMax == -5) {
317 e1 = (
std::abs(curr->etaMax)-1)*etaStep*
318 (-(curr->etaMax<0) + (curr->etaMax>0));
319 e2 =
std::abs(curr->etaMax)*etaStep*
320 (-(curr->etaMax<0) + (curr->etaMax>0));
326 pMin = (curr->phiMin-1)*phiStep + zero + phiStep*offset;
327 pMax = curr->phiMax*phiStep + zero + phiStep*
offset;
328 while (pMax < mins[0])
330 while (pMax > mins[0]+
twopi)
332 while (pMin < mins[0])
334 while (pMin > mins[0]+
twopi)
337 regions.push_back(
deadRegion(eMin, eMax, pMin, pMax) );
345 TMultiGraph * bounds =
new TMultiGraph(
"bounds",
"bounds");
346 std::vector<deadRegion>::const_iterator region;
348 for (region = regions.begin(); region != regions.end(); ++region) {
351 double pMin = region->phiMin;
353 double pMax = region->phiMax;
358 gr->SetLineColor(kRed);
359 gr->SetPoint(0, region->etaMin, pMin);
360 gr->SetPoint(1, region->etaMin, pMax);
361 gr->SetPoint(2, region->etaMax, pMax);
362 gr->SetPoint(3, region->etaMax, pMin);
363 gr->SetPoint(4, region->etaMin, pMin);
364 bounds->Add(gr,
"l");
367 gr->SetLineColor(kRed);
368 gr->SetPoint(0, region->etaMin, pMin);
369 gr->SetPoint(1, region->etaMin,
twopi/2.);
370 gr->SetPoint(2, region->etaMax,
twopi/2.);
371 gr->SetPoint(3, region->etaMax, pMin);
372 gr->SetPoint(4, region->etaMin, pMin);
373 bounds->Add(gr,
"l");
375 gr->SetLineColor(kRed);
376 gr->SetPoint(0, region->etaMin, -
twopi/2.);
377 gr->SetPoint(1, region->etaMin, pMax);
378 gr->SetPoint(2, region->etaMax, pMax);
379 gr->SetPoint(3, region->etaMax, -
twopi/2.);
380 gr->SetPoint(4, region->etaMin, -
twopi/2.);
381 bounds->Add(gr,
"l");
bool adjacentPhi(deadIdRegion const &other)
static double const twopi
static bool inSiPMGeom(double eta, double phi, double delta_eta=0., double delta_phi=0.)
double delta_eta(double eta1, double eta2)
bool sameEta(deadIdRegion const &other)
static TMultiGraph * graphRegions(std::vector< deadRegion > const ®ions)
static void mergeRegionLists(std::list< deadIdRegion > &didregions)
static std::vector< uint32_t > deadIds
static double const phiMaxR0[]
static double const phiMinR12[]
const Item * getValues(DetId fId, bool throwOnFail=true) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
uint32_t rawId() const
get the raw id
static void initIds(edm::EventSetup const &eSetup)
static int const etaBounds
static double const phiMinR0[]
bool samePhi(deadIdRegion const &other)
const T & max(const T &a, const T &b)
static void buildDeadAreas()
int ieta() const
get the cell ieta
Abs< T >::type abs(const T &t)
bool dropChannel(const uint32_t &mystatus) const
unsigned int offset(bool)
static double const etaMax[]
static bool inNotDeadGeom(double eta, double phi, double delta_eta=0., double delta_phi=0.)
double delta_phi(double ph11, double phi2)
bool adjacentEta(deadIdRegion const &other)
int iphi() const
get the cell iphi
static void buildSiPMAreas()
static std::vector< deadRegion > deadRegions
static double const etaMin[]
static double const phiMaxR12[]
static bool isChannelDead(uint32_t id)
T const * product() const
static bool inGeomAccept(double eta, double phi, double delta_eta=0., double delta_phi=0.)
static int const phiSectors
static std::vector< uint32_t > SiPMIds
static void convertRegions(std::list< deadIdRegion > const &idregions, std::vector< deadRegion > ®ions)
void merge(deadIdRegion const &other)
uint32_t getValue() const
static std::vector< deadRegion > SiPMRegions
static bool isChannelSiPM(uint32_t id)