21 absolute_occupancy_(0),
22 OutFileName_(
"Occupancy.root"),
23 UseInputDB_(iConfig.getUntrackedParameter<bool>(
"UseInputDB",
false))
29 LogTrace(
"SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy")<<
"[SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy::~SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy] "<<std::endl;
34 LogTrace(
"SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy")<<
"[SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy::extractBadAPVs] "<<std::endl;
41 apvtree =
new TTree(
"moduleOccupancy",
"tree");
62 striptree =
new TTree(
"stripOccupancy",
"tree");
88 HistoMap::iterator it=DM.begin();
89 HistoMap::iterator itEnd=DM.end();
90 std::vector<unsigned int> badStripList;
92 for (;it!=itEnd;++it){
96 for (
int apv=0; apv<6; apv++)
116 APV.
th1f[apv] =
new TH1F(
"tmp",
"tmp",128,0.5,128.5);
117 int NumberEntriesPerAPV=0;
124 APV.
th1f[apv]->SetBinContent(
strip+1,(it->second.get())->GetBinContent((apv*128)+
strip+1));
125 NumberEntriesPerAPV += (int)(it->second.get())->GetBinContent((apv*128)+
strip+1);
128 APV.
th1f[apv]->SetEntries(NumberEntriesPerAPV);
141 LogTrace(
"SiStripBadAPV") <<
"Analyzing detid " << detid<< std::endl;
230 std::cout <<
"### Detector does not belong to TIB, TID, TOB or TEC !? ###" << std::endl;
277 badStripList.
clear();
328 LogTrace(
"SiStripBadAPV") <<
ss.str() << std::endl;
334 Double_t tot[7], tot2[7];
337 Double_t
Mean[7] = {0};
338 Double_t Rms[7] = {1000,1000,1000,1000,1000,1000,1000};
342 for (
int i=0;
i<number_iterations;
i++)
344 for (
int j=0;
j<7;
j++)
351 for (uint32_t it=0; it<a.size(); it++)
353 Moduleposition = (a[it].modulePosition)-1;
355 for (
int apv=0; apv<a[it].numberApvs; apv++)
359 if (a[it].apvMedian[apv]<(Mean[Moduleposition]-3*Rms[Moduleposition]) || (a[it].apvMedian[apv]>(Mean[Moduleposition]+5*Rms[Moduleposition])))
364 tot[Moduleposition] += a[it].apvMedian[apv];
365 tot2[Moduleposition] += (a[it].apvMedian[apv])*(a[it].apvMedian[apv]);
370 for (
int j=0;
j<7;
j++)
374 Mean[
j] = tot[
j]/n[
j];
375 Rms[
j] = TMath::Sqrt(TMath::Abs(tot2[
j]/n[
j] -Mean[
j]*Mean[
j]));
380 for (
int j=0;
j<7;
j++)
382 MeanRMS[
j] = std::make_pair(Mean[
j],Rms[j]);
392 for (uint32_t it=0; it<medianValues.size(); it++)
394 Moduleposition = (medianValues[it].modulePosition)-1;
395 Detid = medianValues[it].detrawId;
406 for (
int apv=0; apv<medianValues[it].numberApvs; apv++)
409 for (
int i=0;
i<128;
i++)
432 if(InSiStripQuality->IsApvBad(Detid,apv) )
469 else if (medianValues[it].apvMedian[apv]<(MeanAndRms[Moduleposition].
first-
lowoccupancy_*MeanAndRms[Moduleposition].
second) && (MeanAndRms[Moduleposition].first>2 || medianValues[it].apvabsoluteOccupancy[apv]==0))
506 if (BadStripList.begin()!=BadStripList.end())
508 quality->
compact(Detid,BadStripList);
510 quality->
put(Detid,range);
512 BadStripList.clear();
520 size_t startingSize=vect.size();
523 int Nbins = histo.
th1f[apv]->GetNbinsX();
525 int ibinStop = Nbins+1;
526 int MaxEntry = (int)histo.
th1f[apv]->GetMaximum();
528 std::vector<long double> vPoissonProbs(MaxEntry+1,0);
532 for (Int_t
i=ibinStart;
i<ibinStop; ++
i){
533 unsigned int entries= (
unsigned int)histo.
th1f[apv]->GetBinContent(
i);
544 if(diff<vPoissonProbs[entries]){
548 histo.
th1f[apv]->SetBinContent(
i,0.);
552 LogTrace(
"SiStripHotStrip")<<
" rejecting strip " << (apv*128)+
i-1 <<
" value " << entries <<
" diff " << diff <<
" prob " << vPoissonProbs[entries]<< std::endl;
558 LogTrace(
"SiStripHotStrip") <<
" [SiStripHotStripAlgorithmFromClusterOccupancy::iterativeSearch] Nbins="<< Nbins <<
" MaxEntry="<<MaxEntry <<
" meanVal=" << meanVal <<
" NEmptyBins="<<histo.
NEmptyBins[apv]<<
" NEntries=" << histo.
NEntries[apv] <<
" thEntries " << histo.
th1f[apv]->GetEntries()<<
" startingSize " << startingSize <<
" vector.size " << vect.size() << std::endl;
560 if (vect.size()!=startingSize)
565 for(
size_t i=0;
i<vPoissonProbs.size();++
i){
566 vPoissonProbs[
i]= (
i==0)?TMath::Poisson(
i,meanVal):vPoissonProbs[
i-1]+TMath::Poisson(
i,meanVal);
629 std::cout <<
"### Detector does not belong to TIB, TID, TOB or TEC !? ###" << std::endl;
630 std::cout <<
"### DetRawId: " << detid <<
" ###" << std::endl;
std::pair< double, double > MeanAndRms_TIDMinus_Disc3[7]
std::pair< double, double > MeanAndRms_TECPlus_Disc2[7]
unsigned int rodNumber() const
std::vector< Apv > medianValues_TECMinus_Disc3
std::vector< Apv > medianValues_TECMinus_Disc4
void setBasicTreeParameters(int detid)
unsigned int petalNumber() const
float strip_global_position_z
unsigned int stringNumber() const
std::pair< double, double > MeanAndRms_TIDMinus_Disc1[7]
std::vector< Apv > medianValues_TECPlus_Disc8
unsigned short MinNumEntries_
unsigned int layer() const
layer id
std::pair< double, double > MeanAndRms_TECPlus_Disc4[7]
std::vector< Apv > medianValues_TECPlus_Disc7
std::pair< double, double > MeanAndRms_TECMinus_Disc5[7]
std::vector< Apv > medianValues_TIDMinus_Disc2
const TrackerGeometry * TkGeom
std::vector< Apv > medianValues_TOB_Layer2
std::vector< Apv > medianValues_TECPlus_Disc6
std::pair< double, double > MeanAndRms_TECPlus_Disc7[7]
std::vector< Apv > medianValues_TOB_Layer5
std::pair< double, double > MeanAndRms_TECPlus_Disc5[7]
std::vector< Apv > medianValues_TECPlus_Disc1
std::pair< double, double > MeanAndRms_TECMinus_Disc1[7]
std::vector< Apv > medianValues_TECPlus_Disc2
void CalculateMeanAndRMS(std::vector< Apv >, std::pair< double, double > *, int)
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
std::vector< Apv > medianValues_TIB_Layer2
std::vector< Apv > medianValues_TOB_Layer6
std::vector< Apv > medianValues_TECMinus_Disc1
long double absolute_occupancy_
double singleStripOccupancy
std::vector< Apv > medianValues_TECMinus_Disc5
U second(std::pair< T, U > const &p)
std::vector< Apv > medianValues_TIDMinus_Disc3
std::vector< Apv > medianValues_TECPlus_Disc4
std::vector< Apv > medianValues_TIDMinus_Disc1
std::vector< Apv > medianValues_TECMinus_Disc6
std::pair< double, double > MeanAndRms_TOB_Layer5[7]
std::vector< Apv > medianValues_TECMinus_Disc8
std::vector< Apv > medianValues_TECMinus_Disc7
unsigned int moduleNumber() const
void compact(unsigned int &, std::vector< unsigned int > &)
std::pair< double, double > MeanAndRms_TOB_Layer3[7]
unsigned int ring() const
ring id
std::pair< double, double > MeanAndRms_TIB_Layer3[7]
std::vector< Apv > medianValues_TECMinus_Disc2
std::vector< Apv > medianValues_TIDPlus_Disc3
double stripOccupancy[6][128]
float strip_global_position_x
unsigned short MinNumEntriesPerStrip_
std::vector< Apv > medianValues_TIB_Layer4
double stripWeight[6][128]
virtual ~SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy()
std::vector< Apv > medianValues_TIDPlus_Disc2
std::pair< double, double > MeanAndRms_TECMinus_Disc4[7]
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
long double lowoccupancy_
std::pair< double, double > MeanAndRms_TIB_Layer1[7]
SiStrip::QualityHistosMap HistoMap
virtual const GeomDet * idToDet(DetId) const
std::pair< double, double > MeanAndRms_TECMinus_Disc8[7]
std::vector< Apv > medianValues_TOB_Layer1
unsigned int moduleNumber() const
std::vector< Apv > medianValues_TIDPlus_Disc1
Detector identifier class for the strip tracker.
std::pair< double, double > MeanAndRms_TOB_Layer4[7]
std::pair< double, double > MeanAndRms_TECMinus_Disc9[7]
std::pair< double, double > MeanAndRms_TECMinus_Disc3[7]
std::pair< double, double > MeanAndRms_TIB_Layer2[7]
std::pair< double, double > MeanAndRms_TOB_Layer2[7]
std::pair< double, double > MeanAndRms_TIDPlus_Disc1[7]
std::pair< double, double > MeanAndRms_TOB_Layer6[7]
void iterativeSearch(Apv &, std::vector< unsigned int > &, int)
SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy(const edm::ParameterSet &)
std::pair< double, double > MeanAndRms_TECMinus_Disc6[7]
void AnalyzeOccupancy(SiStripQuality *, std::vector< Apv > &, std::pair< double, double > *, std::vector< unsigned int > &, edm::ESHandle< SiStripQuality > &)
unsigned int wheel() const
wheel id
unsigned int layer() const
layer id
long double highoccupancy_
SiStripQuality * pQuality
std::pair< ContainerIterator, ContainerIterator > Range
std::pair< double, double > MeanAndRms_TECMinus_Disc2[7]
std::pair< double, double > MeanAndRms_TECPlus_Disc6[7]
unsigned int ring() const
ring id
std::pair< double, double > MeanAndRms_TIDMinus_Disc2[7]
virtual LocalPoint localPosition(float strip) const =0
std::pair< double, double > MeanAndRms_TIB_Layer4[7]
std::pair< double, double > MeanAndRms_TECPlus_Disc9[7]
void extractBadAPVSandStrips(SiStripQuality *, HistoMap &, edm::ESHandle< SiStripQuality > &)
std::vector< Apv > medianValues_TIB_Layer3
double apvMedianOccupancy
std::pair< double, double > MeanAndRms_TECPlus_Disc3[7]
std::vector< Apv > medianValues_TECPlus_Disc3
std::vector< Apv > medianValues_TECPlus_Disc5
bool put(const uint32_t &detID, const InputVector &vect)
std::pair< double, double > MeanAndRms_TIDPlus_Disc3[7]
std::vector< Apv > medianValues_TECMinus_Disc9
std::vector< Apv > medianValues_TOB_Layer3
unsigned int moduleNumber() const
std::vector< Apv > medianValues_TIB_Layer1
unsigned int encode(const unsigned short &first, const unsigned short &NconsecutiveBadStrips, const unsigned short &flag=0)
std::pair< double, double > MeanAndRms_TIDPlus_Disc2[7]
void evaluatePoissonian(std::vector< long double > &, long double &meanVal)
std::pair< double, double > MeanAndRms_TOB_Layer1[7]
std::vector< Apv > medianValues_TOB_Layer4
std::pair< double, double > MeanAndRms_TECPlus_Disc1[7]
std::pair< double, double > MeanAndRms_TECMinus_Disc7[7]
unsigned int moduleNumber() const
unsigned int wheel() const
wheel id
float strip_global_position_y
std::pair< double, double > MeanAndRms_TECPlus_Disc8[7]
std::vector< Apv > medianValues_TECPlus_Disc9
int apvabsoluteOccupancy[6]
double stripoccupancy[128]