Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 75759
b: "refs/heads/CMSSW_7_1_X"
c: dc62cab
h: "refs/heads/CMSSW_7_1_X"
i:
  75757: b7b32b5
  75755: ae1c54f
  75751: 139d32d
  75743: fdaac27
v: v3
  • Loading branch information
Giovanni Petrucciani committed Oct 19, 2009
1 parent c1b660e commit 8c189c8
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 55 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
refs/heads/gh-pages: 09c786f70121f131b3715aaf3464996502bbeb7e
"refs/heads/CMSSW_7_1_X": fa7a90af48a60fc7ee04eb084aec0b11682b0c26
"refs/heads/CMSSW_7_1_X": dc62cab3bb5b7b2ed5349439fc0d1e7a480b44b0
13 changes: 13 additions & 0 deletions trunk/RecoTracker/MeasurementDet/interface/TkStripMeasurementDet.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "DataFormats/Common/interface/RefGetter.h"
#include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2D.h"

#include "FWCore/ParameterSet/interface/ParameterSet.h"

class TransientTrackingRecHit;

Expand Down Expand Up @@ -100,9 +101,19 @@ class TkStripMeasurementDet : public MeasurementDet {
/** \brief Sets the status of a block of 128 strips (or all blocks if idx=-1) */
void set128StripStatus(bool good, int idx=-1);

struct BadStripCuts {
BadStripCuts() : maxBad(9999), maxConsecutiveBad(9999) {}
BadStripCuts(const edm::ParameterSet &pset) :
maxBad(pset.getParameter<uint32_t>("maxBad")),
maxConsecutiveBad(pset.getParameter<uint32_t>("maxConsecutiveBad")) {}
uint16_t maxBad, maxConsecutiveBad;
};

/** \brief return true if there are 'enough' good strips in the utraj +/- 3 uerr range.*/
bool testStrips(float utraj, float uerr) const;

void setBadStripCuts(BadStripCuts cuts) { badStripCuts_ = cuts; }

struct BadStripBlock {
short first;
short last;
Expand All @@ -126,6 +137,8 @@ class TkStripMeasurementDet : public MeasurementDet {
bool hasAny128StripBad_, maskBad128StripBlocks_;
std::vector<BadStripBlock> badStripBlocks_;
int totalStrips_;
BadStripCuts badStripCuts_;


// --- regional unpacking
bool isRegional;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
## (UseStripAPVFiberQualityDB must also be true for this to work)
UseStripStripQualityDB = cms.bool(True), ## read Strip status from SiStripQuality
DebugStripStripQualityDB = cms.untracked.bool(False), ## dump out info om module status
badStripCuts = cms.PSet(
TIB = cms.PSet( maxBad = cms.uint32(4), maxConsecutiveBad = cms.uint32(2) ),
TID = cms.PSet( maxBad = cms.uint32(4), maxConsecutiveBad = cms.uint32(2) ),
TOB = cms.PSet( maxBad = cms.uint32(4), maxConsecutiveBad = cms.uint32(2) ),
TEC = cms.PSet( maxBad = cms.uint32(4), maxConsecutiveBad = cms.uint32(2) ),
),

UsePixelModuleQualityDB = cms.bool(True), ## Use DB info at the module level (that is, detid level)
DebugPixelModuleQualityDB = cms.untracked.bool(False), ## dump out info om module status
Expand Down
10 changes: 10 additions & 0 deletions trunk/RecoTracker/MeasurementDet/src/MeasurementTracker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,15 @@ MeasurementTracker::idToDet(const DetId& id) const
}

void MeasurementTracker::initializeStripStatus(const SiStripQuality *quality, int qualityFlags, int qualityDebugFlags) const {
TkStripMeasurementDet::BadStripCuts badStripCuts[4];
if (qualityFlags & BadStrips) {
edm::ParameterSet cutPset = pset_.getParameter<edm::ParameterSet>("badStripCuts");
badStripCuts[SiStripDetId::TIB-3] = TkStripMeasurementDet::BadStripCuts(cutPset.getParameter<edm::ParameterSet>("TIB"));
badStripCuts[SiStripDetId::TOB-3] = TkStripMeasurementDet::BadStripCuts(cutPset.getParameter<edm::ParameterSet>("TOB"));
badStripCuts[SiStripDetId::TID-3] = TkStripMeasurementDet::BadStripCuts(cutPset.getParameter<edm::ParameterSet>("TID"));
badStripCuts[SiStripDetId::TEC-3] = TkStripMeasurementDet::BadStripCuts(cutPset.getParameter<edm::ParameterSet>("TEC"));
}

if ((quality != 0) && (qualityFlags != 0)) {
edm::LogInfo("MeasurementTracker") << "qualityFlags = " << qualityFlags;
unsigned int on = 0, tot = 0;
Expand Down Expand Up @@ -456,6 +465,7 @@ void MeasurementTracker::initializeStripStatus(const SiStripQuality *quality, in
for (SiStripBadStrip::ContainerIterator bit = range.first; bit != range.second; ++bit) {
badStrips.push_back(quality->decode(*bit));
}
(*i)->setBadStripCuts(badStripCuts[SiStripDetId(detid).subdetId()-3]);
}
}
if (qualityDebugFlags & BadModules) {
Expand Down
77 changes: 23 additions & 54 deletions trunk/RecoTracker/MeasurementDet/src/TkStripMeasurementDet.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <typeinfo>
#include "TrackingTools/KalmanUpdators/interface/Chi2MeasurementEstimator.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "DataFormats/SiStripDetId/interface/SiStripDetId.h"

TkStripMeasurementDet::TkStripMeasurementDet( const GeomDet* gdet,
const StripClusterParameterEstimator* cpe,
Expand Down Expand Up @@ -272,8 +273,8 @@ TkStripMeasurementDet::set128StripStatus(bool good, int idx) {

bool
TkStripMeasurementDet::testStrips(float utraj, float uerr) const {
int start = (int) (utraj - 3*uerr); if (start < 0) start = 0;
int end = (int) (utraj + 3*uerr); if (end > totalStrips_) end = totalStrips_;
int16_t start = (int16_t) (utraj - 3*uerr); if (start < 0) start = 0;
int16_t end = (int16_t) (utraj + 3*uerr); if (end > totalStrips_) end = totalStrips_;

if (start >= end) { // which means either end <=0 or start >= totalStrips_
/* LogDebug("TkStripMeasurementDet") << "Testing module " << id_ <<","<<
Expand All @@ -288,59 +289,27 @@ TkStripMeasurementDet::testStrips(float utraj, float uerr) const {
typedef std::vector<BadStripBlock>::const_iterator BSBIT;
BSBIT bsbc = badStripBlocks_.begin(), bsbe = badStripBlocks_.end();

int cur = start, curapv = start >> 7, good = 0;
while (cur < end) {
int nextapv = (cur & ~(127)) + 128;
if (bad128Strip_[curapv]) {
cur = nextapv; continue;
}
int next = std::min(end, nextapv); // all before "next" is good for APVs and fibers
// [*] next > cur by contract.
if (bsbc != bsbe) { // are there any bad strips?
// skip all blocks to our left
while (bsbc->last < cur) { bsbc++; if (bsbc == bsbe) break; }
if ((bsbc != bsbe)) {
if (bsbc->first <= cur) { // in the block
cur = bsbc->last+1; bsbc++; continue;
}
if (bsbc->first < next) { // there are bad strips before "next"
next = bsbc->first; // so we better stop at the beginning of that block
// as we didn't fall in "if (bsbc->first <= cur)" we know
// cur < bsbc->first, so [*] is still true
}
}
}
// because of [*] (next - cur) > 0
good += next - cur; // all strips up to next-1 are good
cur = next; // now reach for the unknown
}

/* LogDebug("TkStripMeasurementDet") << "Testing module " << id_ <<","<<
" U = " << utraj << " +/- " << uerr <<
"; Range [" << (utraj - 3*uerr) << ", " << (utraj + 3*uerr) << "] " <<
"= [" << start << "," << end << "]" <<
" total strips:" << (end-start) << ", good:" << good << ", bad:" << (end-start-good) <<
". " << (good >= 1 ? "OK" : "NO"); */

//#define RecoTracker_MeasurementDet_TkStripMeasurementDet_RECOUNT_IN_SLOW_AND_STUPID_BUT_SAFE_WAY
// I can be dangerous to blindly trust some "supposed-to-be-smart" algorithm ...
// ... expecially if I wrote it (gpetrucc)
#ifdef RecoTracker_MeasurementDet_TkStripMeasurementDet_RECOUNT_IN_SLOW_AND_STUPID_BUT_SAFE_WAY
bsbc = badStripBlocks_.begin();
cur = start;
int safegood = 0;
while (cur < end) {
if (bad128Strip_[cur >> 7]) { cur++; continue; }
// skip all blocks to our left
while ((bsbc != bsbe) && (bsbc->last < cur)) { bsbc++; }
if ((bsbc != bsbe) && (bsbc->first <= cur)) { cur++; continue; }
safegood++; cur++;
int16_t bad = 0, largestBadBlock = 0;
for (BSBIT bsbc = badStripBlocks_.begin(), bsbe = badStripBlocks_.end(); bsbc != bsbe; ++bsbc) {
if (bsbc->last < start) continue;
if (bsbc->first > end) break;
int16_t thisBad = std::min(bsbc->last, end) - std::max(bsbc->first, start);
if (thisBad > largestBadBlock) largestBadBlock = thisBad;
bad += thisBad;
}
//LogDebug("TkStripMeasurementDet") << "Testing module " << id_ <<", "<<
// " safegood = " << safegood << " while good = " << good <<
// "; I am " << (safegood == good ? "safe" : "STUPID"); // no offense to anyone, of course
#endif // of #ifdef RecoTracker_MeasurementDet_TkStripMeasurementDet_RECOUNT_IN_SLOW_AND_STUPID_BUT_SAFE_WAY

return (good >= 1); //to be tuned
bool ok = (bad < (end-start)) &&
(uint16_t(bad) <= badStripCuts_.maxBad) &&
(uint16_t(largestBadBlock) <= badStripCuts_.maxConsecutiveBad);

// if (bad) {
// edm::LogWarning("TkStripMeasurementDet") << "Testing module " << id_ <<" (subdet: "<< SiStripDetId(id_).subdetId() << ")" <<
// " U = " << utraj << " +/- " << uerr <<
// "; Range [" << (utraj - 3*uerr) << ", " << (utraj + 3*uerr) << "] " <<
// "= [" << start << "," << end << "]" <<
// " total strips:" << (end-start) << ", good:" << (end-start-bad) << ", bad:" << bad << ", largestBadBlock: " << largestBadBlock <<
// ". " << (ok ? "OK" : "NO");
// }
return ok;
}

0 comments on commit 8c189c8

Please sign in to comment.