|
|
Go to the documentation of this file.
10 MinNumEntriesPerStrip_(0),
13 OutFileName_(
"Occupancy.root"),
15 UseInputDB_(iConfig.getUntrackedParameter<
bool>(
"UseInputDB",
false)) {
20 LogTrace(
"SiStripHotStripAlgorithmFromClusterOccupancy")
21 <<
"[SiStripHotStripAlgorithmFromClusterOccupancy::~SiStripHotStripAlgorithmFromClusterOccupancy] " << std::endl;
27 LogTrace(
"SiStripHotStripAlgorithmFromClusterOccupancy")
28 <<
"[SiStripHotStripAlgorithmFromClusterOccupancy::extractBadStrips] " << std::endl;
34 striptree =
new TTree(
"stripOccupancy",
"tree");
62 HistoMap::iterator it = DM.begin();
63 HistoMap::iterator itEnd = DM.end();
64 std::vector<unsigned int> badStripList;
66 for (; it != itEnd; ++it) {
74 LogTrace(
"SiStripHotStrip") <<
"Analyzing detid " << detid << std::endl;
76 int numberAPVs = (
int)(it->second.get())->GetNbinsX() / 128;
150 std::cout <<
"### Detector does not belong to TIB, TID, TOB or TEC !? ###" << std::endl;
157 badStripList.
clear();
159 for (
int i = 0;
i < 768;
i++) {
169 for (
int apv = 0; apv < numberAPVs; apv++) {
171 if (InSiStripQuality->
IsApvBad(detid, apv)) {
173 LogTrace(
"SiStripHotStrip") <<
"(Module and Apv number) " << detid <<
" , " << apv
174 <<
" excluded by input ESetup." << std::endl;
178 LogTrace(
"SiStripHotStrip") <<
"(Module and Apv number) " << detid <<
" , " << apv
179 <<
" good by input ESetup." << std::endl;
183 phisto.
_th1f =
new TH1F(
"tmp",
"tmp", 128, 0.5, 128.5);
184 int NumberEntriesPerAPV = 0;
187 phisto.
_th1f->SetBinContent(
strip + 1, (it->second.get())->GetBinContent((apv * 128) +
strip + 1));
188 NumberEntriesPerAPV += (
int)(it->second.get())->GetBinContent((apv * 128) +
strip + 1);
191 phisto.
_th1f->SetEntries(NumberEntriesPerAPV);
195 LogTrace(
"SiStripHotStrip") <<
"Number of clusters in APV " << apv <<
": " << NumberEntriesPerAPV << std::endl;
229 if (badStripList.begin() == badStripList.end())
232 OutSiStripQuality->
compact(detid, badStripList);
235 if (!OutSiStripQuality->
put(detid,
range))
237 <<
"[SiStripHotStripAlgorithmFromClusterOccupancy::extractBadStrips] detid already exists" << std::endl;
247 LogTrace(
"SiStripHotStrip") <<
ss.str() << std::endl;
251 std::vector<unsigned int>& vect,
256 size_t startingSize = vect.size();
260 size_t ibinStart = 1;
261 size_t ibinStop =
Nbins + 1;
262 int MaxEntry = (
int)
histo._th1f->GetMaximum();
264 std::vector<long double> vPoissonProbs(MaxEntry + 1, 0);
265 long double meanVal = 1. *
histo._NEntries / (1. *
Nbins -
histo._NEmptyBins);
269 unsigned int goodstripentries[128];
271 for (
size_t i = ibinStart;
i < ibinStop; ++
i) {
272 if (
ishot[(apv * 128) +
i - 1] == 0) {
273 goodstripentries[nGoodStrips] = (
unsigned int)
histo._th1f->GetBinContent(
i);
277 double median = TMath::Median(nGoodStrips, goodstripentries);
279 for (
size_t i = ibinStart;
i < ibinStop; ++
i) {
280 unsigned int entries = (
unsigned int)
histo._th1f->GetBinContent(
i);
282 if (
ishot[(apv * 128) +
i - 1] == 0) {
285 poissonprob[(apv * 128) +
i - 1] = 1 - vPoissonProbs[entries];
292 if (
diff < vPoissonProbs[entries]) {
293 ishot[(apv * 128) +
i - 1] = 1;
296 histo._th1f->SetBinContent(
i, 0.);
297 histo._NEntries -= entries;
300 LogTrace(
"SiStripHotStrip") <<
" rejecting strip " << (apv * 128) +
i - 1 <<
" value " << entries <<
" diff "
301 <<
diff <<
" prob " << vPoissonProbs[entries] << std::endl;
306 LogTrace(
"SiStripHotStrip") <<
" [SiStripHotStripAlgorithmFromClusterOccupancy::iterativeSearch] Nbins=" <<
Nbins
307 <<
" MaxEntry=" << MaxEntry <<
" meanVal=" << meanVal
308 <<
" NEmptyBins=" <<
histo._NEmptyBins <<
" NEntries=" <<
histo._NEntries
309 <<
" thEntries " <<
histo._th1f->GetEntries() <<
" startingSize " << startingSize
310 <<
" vector.size " << vect.size() << std::endl;
312 if (vect.size() != startingSize)
317 long double& meanVal) {
318 for (
size_t i = 0;
i < vPoissonProbs.size(); ++
i) {
319 vPoissonProbs[
i] = (
i == 0) ? TMath::Poisson(
i, meanVal) : vPoissonProbs[
i - 1] + TMath::Poisson(
i, meanVal);
327 LogTrace(
"SiStripHotStrip") <<
" [SiStripHotStripAlgorithmFromClusterOccupancy::setNumberOfEvents] minNumber of "
328 "Events per strip used to consider a strip bad"
const TrackerGeomDet * idToDet(DetId) const override
bool tidIsZMinusSide(const DetId &id) const
bool tibIsExternalString(const DetId &id) const
bool tobIsStereo(const DetId &id) const
bool tecIsZMinusSide(const DetId &id) const
void setNumberOfEvents(double Nevents)
virtual LocalPoint localPosition(float strip) const =0
bool tecIsStereo(const DetId &id) const
bool put(const uint32_t &detID, const InputVector &vect)
unsigned int tidModule(const DetId &id) const
unsigned int tidRing(const DetId &id) const
unsigned int tobRod(const DetId &id) const
unsigned int tidWheel(const DetId &id) const
void iterativeSearch(pHisto &, std::vector< unsigned int > &, int)
bool tidIsStereo(const DetId &id) const
std::pair< ContainerIterator, ContainerIterator > Range
void compact(unsigned int &, std::vector< unsigned int > &)
double stripoccupancy[768]
bool tibIsStereo(const DetId &id) const
static constexpr auto TIB
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
unsigned int tibString(const DetId &id) const
unsigned int tecPetalNumber(const DetId &id) const
bool tobIsZMinusSide(const DetId &id) const
unsigned short MinNumEntriesPerStrip_
unsigned int tibModule(const DetId &id) const
SiStripQuality * pQuality
unsigned int tecRing(const DetId &id) const
ring id
SiStrip::QualityHistosMap HistoMap
const TrackerTopology * tTopo
virtual ~SiStripHotStripAlgorithmFromClusterOccupancy()
void evaluatePoissonian(std::vector< long double > &, long double &meanVal)
bool IsApvBad(const uint32_t &detid, const short &apvNb) const
unsigned int tobLayer(const DetId &id) const
bool tidIsBackRing(const DetId &id) const
static constexpr auto TEC
unsigned int tobModule(const DetId &id) const
static constexpr auto TOB
unsigned int tecModule(const DetId &id) const
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
const TrackerGeometry * TkGeom
bool tecIsBackPetal(const DetId &id) const
unsigned int encode(const unsigned short &first, const unsigned short &NconsecutiveBadStrips, const unsigned short &flag=0)
bool tibIsZMinusSide(const DetId &id) const
unsigned int tecWheel(const DetId &id) const
static constexpr auto TID
SiStripHotStripAlgorithmFromClusterOccupancy(const edm::ParameterSet &, const TrackerTopology *)
void extractBadStrips(SiStripQuality *, HistoMap &, edm::ESHandle< SiStripQuality > &)
unsigned short MinNumEntries_
unsigned int tibLayer(const DetId &id) const