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) ) {
218 std::vector<uint32_t>::iterator did;
219 std::list<deadIdRegion> didregions;
232 std::vector<uint32_t>::iterator sid;
233 std::list<deadIdRegion> idregions;
246 std::list<deadIdRegion>::iterator curr;
247 std::list<deadIdRegion> list2;
248 unsigned int startSize;
250 startSize = didregions.size();
254 curr = didregions.begin();
255 while (curr != didregions.end()) {
257 curr = didregions.erase(curr);
258 while (curr != didregions.end()) {
261 curr = didregions.erase(curr);
264 list2.push_back(merger);
265 curr = didregions.begin();
269 curr = list2.begin();
270 while (curr != list2.end()) {
272 curr = list2.erase(curr);
273 while (curr != list2.end()) {
276 curr = list2.erase(curr);
279 didregions.push_back(merger);
280 curr = list2.begin();
282 }
while (startSize > didregions.size());
286 std::vector<deadRegion>& regions) {
288 double eMin,eMax,
pMin,pMax;
289 static double const etaStep = 0.087;
290 static double const phiStep =
twopi/72.;
293 double const * maxes;
294 std::list<deadIdRegion>::const_iterator curr;
296 for (curr = idregions.begin(); curr != idregions.end(); ++curr) {
300 if (curr->etaMin == -4) {
302 }
else if (curr->etaMin == 5) {
305 e1 = (
std::abs(curr->etaMin)-1)*etaStep*
306 (-(curr->etaMin<0) + (curr->etaMin>0));
307 e2 =
std::abs(curr->etaMin)*etaStep*
308 (-(curr->etaMin<0) + (curr->etaMin>0));
311 if (curr->etaMax == 4) {
313 }
else if (curr->etaMax == -5) {
316 e1 = (
std::abs(curr->etaMax)-1)*etaStep*
317 (-(curr->etaMax<0) + (curr->etaMax>0));
318 e2 =
std::abs(curr->etaMax)*etaStep*
319 (-(curr->etaMax<0) + (curr->etaMax>0));
325 pMin = (curr->phiMin-1)*phiStep + zero + phiStep*offset;
326 pMax = curr->phiMax*phiStep + zero + phiStep*
offset;
327 while (pMax < mins[0])
329 while (pMax > mins[0]+
twopi)
331 while (pMin < mins[0])
333 while (pMin > mins[0]+
twopi)
336 regions.push_back(
deadRegion(eMin, eMax, pMin, pMax) );
344 TMultiGraph * bounds =
new TMultiGraph(
"bounds",
"bounds");
345 std::vector<deadRegion>::const_iterator
region;
347 for (region = regions.begin(); region != regions.end(); ++
region) {
350 double pMin = region->phiMin;
352 double pMax = region->phiMax;
357 gr->SetLineColor(kRed);
358 gr->SetPoint(0, region->etaMin, pMin);
359 gr->SetPoint(1, region->etaMin, pMax);
360 gr->SetPoint(2, region->etaMax, pMax);
361 gr->SetPoint(3, region->etaMax, pMin);
362 gr->SetPoint(4, region->etaMin, pMin);
363 bounds->Add(gr,
"l");
366 gr->SetLineColor(kRed);
367 gr->SetPoint(0, region->etaMin, pMin);
368 gr->SetPoint(1, region->etaMin,
twopi/2.);
369 gr->SetPoint(2, region->etaMax,
twopi/2.);
370 gr->SetPoint(3, region->etaMax, pMin);
371 gr->SetPoint(4, region->etaMin, pMin);
372 bounds->Add(gr,
"l");
374 gr->SetLineColor(kRed);
375 gr->SetPoint(0, region->etaMin, -
twopi/2.);
376 gr->SetPoint(1, region->etaMin, pMax);
377 gr->SetPoint(2, region->etaMax, pMax);
378 gr->SetPoint(3, region->etaMax, -
twopi/2.);
379 gr->SetPoint(4, region->etaMin, -
twopi/2.);
380 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)
static void buildDeadAreas()
int ieta() const
get the cell ieta
Abs< T >::type abs(const T &t)
bool dropChannel(const uint32_t &mystatus) const
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)