9 MinNumEntriesPerStrip_(0),
12 OutFileName_(
"Occupancy.root"),
13 UseInputDB_(iConfig.getUntrackedParameter<bool>(
"UseInputDB",
false))
20 LogTrace(
"SiStripHotStripAlgorithmFromClusterOccupancy")<<
"[SiStripHotStripAlgorithmFromClusterOccupancy::~SiStripHotStripAlgorithmFromClusterOccupancy] "<<std::endl;
25 LogTrace(
"SiStripHotStripAlgorithmFromClusterOccupancy")<<
"[SiStripHotStripAlgorithmFromClusterOccupancy::extractBadStrips] "<<std::endl;
33 striptree =
new TTree(
"stripOccupancy",
"tree");
60 HistoMap::iterator it=DM.begin();
61 HistoMap::iterator itEnd=DM.end();
62 std::vector<unsigned int> badStripList;
64 for (;it!=itEnd;++it){
72 LogTrace(
"SiStripHotStrip") <<
"Analyzing detid " << detid<< std::endl;
74 int numberAPVs = (int)(it->second.get())->GetNbinsX()/128;
133 std::cout <<
"### Detector does not belong to TIB, TID, TOB or TEC !? ###" << std::endl;
141 badStripList.
clear();
143 for (
int i=0;
i<768;
i++){
153 for (
int apv=0; apv<numberAPVs; apv++){
155 if(InSiStripQuality->IsApvBad(detid,apv) ){
157 LogTrace(
"SiStripHotStrip")<<
"(Module and Apv number) "<<detid<<
" , "<<apv<<
" excluded by input ESetup."<<std::endl;
162 LogTrace(
"SiStripHotStrip")<<
"(Module and Apv number) "<<detid<<
" , "<<apv<<
" good by input ESetup."<<std::endl;
166 phisto.
_th1f =
new TH1F(
"tmp",
"tmp",128,0.5,128.5);
167 int NumberEntriesPerAPV=0;
170 phisto.
_th1f->SetBinContent(
strip+1,(it->second.get())->GetBinContent((apv*128)+
strip+1));
171 NumberEntriesPerAPV += (int)(it->second.get())->GetBinContent((apv*128)+
strip+1);
174 phisto.
_th1f->SetEntries(NumberEntriesPerAPV);
177 LogTrace(
"SiStripHotStrip") <<
"Number of clusters in APV " << apv <<
": " << NumberEntriesPerAPV << std::endl;
209 if (badStripList.begin()==badStripList.end())
212 OutSiStripQuality->
compact(detid,badStripList);
215 if ( ! OutSiStripQuality->
put(detid,range) )
216 edm::LogError(
"SiStripHotStrip")<<
"[SiStripHotStripAlgorithmFromClusterOccupancy::extractBadStrips] detid already exists"<<std::endl;
226 LogTrace(
"SiStripHotStrip") <<
ss.str() << std::endl;
234 size_t startingSize=vect.size();
237 int Nbins = histo.
_th1f->GetNbinsX();
239 int ibinStop = Nbins+1;
240 int MaxEntry = (int)histo.
_th1f->GetMaximum();
242 std::vector<long double> vPoissonProbs(MaxEntry+1,0);
246 for (Int_t
i=ibinStart;
i<ibinStop; ++
i){
247 unsigned int entries= (
unsigned int)histo.
_th1f->GetBinContent(
i);
249 if (
ishot[(apv*128)+
i-1]==0){
258 if(diff<vPoissonProbs[entries]){
262 histo.
_th1f->SetBinContent(
i,0.);
266 LogTrace(
"SiStripHotStrip")<<
" rejecting strip " << (apv*128)+
i-1 <<
" value " << entries <<
" diff " << diff <<
" prob " << vPoissonProbs[entries]<< std::endl;
272 LogTrace(
"SiStripHotStrip") <<
" [SiStripHotStripAlgorithmFromClusterOccupancy::iterativeSearch] Nbins="<< Nbins <<
" MaxEntry="<<MaxEntry <<
" meanVal=" << meanVal <<
" NEmptyBins="<<histo.
_NEmptyBins<<
" NEntries=" << histo.
_NEntries <<
" thEntries " << histo.
_th1f->GetEntries()<<
" startingSize " << startingSize <<
" vector.size " << vect.size() << std::endl;
274 if (vect.size()!=startingSize)
279 for(
size_t i=0;
i<vPoissonProbs.size();++
i){
280 vPoissonProbs[
i]= (
i==0)?TMath::Poisson(
i,meanVal):vPoissonProbs[
i-1]+TMath::Poisson(
i,meanVal);
288 LogTrace(
"SiStripHotStrip")<<
" [SiStripHotStripAlgorithmFromClusterOccupancy::setNumberOfEvents] minNumber of Events per strip used to consider a strip bad" <<
minNevents_ <<
" for occupancy " <<
occupancy_ << std::endl;
unsigned int rodNumber() const
unsigned int petalNumber() const
unsigned int stringNumber() const
void extractBadStrips(SiStripQuality *, HistoMap &, edm::ESHandle< SiStripQuality > &)
unsigned int layer() const
layer id
void evaluatePoissonian(std::vector< long double > &, long double &meanVal)
const TrackerGeometry * TkGeom
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
double stripoccupancy[768]
unsigned int moduleNumber() const
void compact(unsigned int &, std::vector< unsigned int > &)
unsigned int ring() const
ring id
SiStripHotStripAlgorithmFromClusterOccupancy(const edm::ParameterSet &)
unsigned short MinNumEntriesPerStrip_
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
virtual const GeomDet * idToDet(DetId) const
unsigned int moduleNumber() const
void setNumberOfEvents(double Nevents)
Detector identifier class for the strip tracker.
void iterativeSearch(pHisto &, std::vector< unsigned int > &, int)
SiStripQuality * pQuality
unsigned int wheel() const
wheel id
unsigned int layer() const
layer id
std::pair< ContainerIterator, ContainerIterator > Range
SiStrip::QualityHistosMap HistoMap
unsigned int ring() const
ring id
virtual ~SiStripHotStripAlgorithmFromClusterOccupancy()
virtual LocalPoint localPosition(float strip) const =0
bool put(const uint32_t &detID, const InputVector &vect)
unsigned int moduleNumber() const
unsigned int encode(const unsigned short &first, const unsigned short &NconsecutiveBadStrips, const unsigned short &flag=0)
unsigned int moduleNumber() const
unsigned short MinNumEntries_
unsigned int wheel() const
wheel id