18 OutFileName_(
"Occupancy.root"),
19 UseInputDB_(iConfig.getUntrackedParameter<
bool>(
"UseInputDB",
false)),
25 LogTrace(
"SiStripBadAPVAlgorithmFromClusterOccupancy")
26 <<
"[SiStripBadAPVAlgorithmFromClusterOccupancy::~SiStripBadAPVAlgorithmFromClusterOccupancy] " << std::endl;
32 LogTrace(
"SiStripBadAPVAlgorithmFromClusterOccupancy")
33 <<
"[SiStripBadAPVAlgorithmFromClusterOccupancy::extractBadAPVs] " << std::endl;
39 apvtree =
new TTree(
"moduleOccupancy",
"tree");
60 HistoMap::iterator it = DM.begin();
61 HistoMap::iterator itEnd = DM.end();
62 std::vector<unsigned int> badStripList;
64 for (; it != itEnd; ++it) {
67 for (
int apv = 0; apv < 6; apv++) {
78 phisto.
_th1f = it->second.get();
89 phisto.
_th1f->GetBinContent((apv * 128) +
strip + 1);
92 phisto.
_th1f->GetBinContent((apv * 128) +
strip + 1);
104 LogTrace(
"SiStripBadAPV") <<
"Analyzing detid " << detid << std::endl;
258 std::cout <<
"### Detector does not belong to TIB, TID, TOB or TEC !? ###" << std::endl;
324 badStripList.
clear();
398 LogTrace(
"SiStripBadAPV") <<
ss.str() << std::endl;
402 std::pair<double, double>* MeanRMS,
403 int number_iterations) {
404 Double_t tot[7], tot2[7];
407 Double_t
Mean[7] = {0};
408 Double_t Rms[7] = {1000, 1000, 1000, 1000, 1000, 1000, 1000};
412 for (
int i = 0;
i < number_iterations;
i++) {
413 for (
int j = 0; j < 7; j++) {
419 for (uint32_t it = 0; it < a.size(); it++) {
420 Moduleposition = (a[it].modulePosition) - 1;
422 for (
int apv = 0; apv < a[it].numberApvs; apv++) {
424 if (a[it].apvMedian[apv] < (Mean[Moduleposition] - 3 * Rms[Moduleposition]) ||
425 (a[it].apvMedian[apv] > (Mean[Moduleposition] + 5 * Rms[Moduleposition]))) {
429 tot[Moduleposition] += a[it].apvMedian[apv];
430 tot2[Moduleposition] += (a[it].apvMedian[apv]) * (a[it].apvMedian[apv]);
435 for (
int j = 0; j < 7; j++) {
437 Mean[j] = tot[j] / n[j];
438 Rms[j] = TMath::Sqrt(
TMath::Abs(tot2[j] / n[j] - Mean[j] * Mean[j]));
443 for (
int j = 0; j < 7; j++) {
444 MeanRMS[j] = std::make_pair(Mean[j], Rms[j]);
449 std::vector<Apv>& medianValues,
450 std::pair<double, double>* MeanAndRms,
451 std::vector<unsigned int>& BadStripList,
456 for (uint32_t it = 0; it < medianValues.size(); it++) {
457 Moduleposition = (medianValues[it].modulePosition) - 1;
458 Detid = medianValues[it].detrawId;
460 for (
int apv = 0; apv < medianValues[it].numberApvs; apv++) {
462 if (InSiStripQuality->
IsApvBad(Detid, apv)) {
466 if (medianValues[it].apvMedian[apv] >
minNevents_) {
467 if ((medianValues[it].apvMedian[apv] >
471 }
else if (medianValues[it].apvMedian[apv] <
473 (MeanAndRms[Moduleposition].first > 2 || medianValues[it].apvabsoluteOccupancy[apv] == 0)) {
475 std::cout <<
"Dead APV! DetId: " << medianValues[it].detrawId <<
", APV number: " << apv + 1
476 <<
", APVMedian: " << medianValues[it].apvMedian[apv]
477 <<
", Mean: " << MeanAndRms[Moduleposition].first <<
", RMS: " << MeanAndRms[Moduleposition].second
479 << (MeanAndRms[Moduleposition].first -
lowoccupancy_ * MeanAndRms[Moduleposition].second)
483 if (BadStripList.begin() != BadStripList.end()) {
484 quality->
compact(Detid, BadStripList);
486 quality->
put(Detid, range);
488 BadStripList.clear();
std::vector< Apv > medianValues_TECPlus_Disc3
bool IsApvBad(const uint32_t &detid, const short &apvNb) const
std::vector< Apv > medianValues_TECPlus_Disc8
std::vector< Apv > medianValues_TECMinus_Disc4
std::vector< Apv > medianValues_TIDMinus_Disc3
unsigned int tibLayer(const DetId &id) const
unsigned int tibString(const DetId &id) const
unsigned int tidRing(const DetId &id) const
bool tobIsStereo(const DetId &id) const
std::pair< double, double > MeanAndRms_TECMinus_Disc8[7]
void AnalyzeOccupancy(SiStripQuality *, std::vector< Apv > &, std::pair< double, double > *, std::vector< unsigned int > &, edm::ESHandle< SiStripQuality > &)
void CalculateMeanAndRMS(const std::vector< Apv > &, std::pair< double, double > *, int)
unsigned int tecRing(const DetId &id) const
ring id
std::pair< double, double > MeanAndRms_TECPlus_Disc4[7]
std::vector< Apv > medianValues_TIDPlus_Disc3
SiStripBadAPVAlgorithmFromClusterOccupancy(const edm::ParameterSet &, const TrackerTopology *)
const TrackerGeometry * TkGeom
std::pair< double, double > MeanAndRms_TIDPlus_Disc2[7]
std::pair< double, double > MeanAndRms_TIDMinus_Disc2[7]
unsigned int tidWheel(const DetId &id) const
std::pair< double, double > MeanAndRms_TIDMinus_Disc3[7]
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
std::pair< double, double > MeanAndRms_TIB_Layer1[7]
bool tecIsZMinusSide(const DetId &id) const
bool tidIsStereo(const DetId &id) const
std::vector< Apv > medianValues_TECPlus_Disc4
std::pair< double, double > MeanAndRms_TECPlus_Disc8[7]
bool tidIsZMinusSide(const DetId &id) const
SiStripQuality * pQuality
std::pair< double, double > MeanAndRms_TECMinus_Disc7[7]
U second(std::pair< T, U > const &p)
std::vector< Apv > medianValues_TECPlus_Disc1
std::pair< double, double > MeanAndRms_TOB_Layer5[7]
bool tecIsStereo(const DetId &id) const
bool tibIsExternalString(const DetId &id) const
std::pair< double, double > MeanAndRms_TIB_Layer4[7]
std::pair< double, double > MeanAndRms_TECPlus_Disc2[7]
bool tibIsZMinusSide(const DetId &id) const
virtual LocalPoint localPosition(float strip) const =0
std::vector< Apv > medianValues_TIDMinus_Disc2
std::vector< Apv > medianValues_TECMinus_Disc1
std::vector< Apv > medianValues_TIB_Layer1
unsigned int tidModule(const DetId &id) const
bool tidIsBackRing(const DetId &id) const
std::pair< double, double > MeanAndRms_TECMinus_Disc1[7]
void compact(unsigned int &, std::vector< unsigned int > &)
std::pair< double, double > MeanAndRms_TIDPlus_Disc3[7]
std::vector< Apv > medianValues_TECPlus_Disc2
bool tobIsZMinusSide(const DetId &id) const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
double apvabsoluteOccupancy[6]
std::vector< Apv > medianValues_TIDPlus_Disc2
std::pair< double, double > MeanAndRms_TECMinus_Disc2[7]
std::pair< double, double > MeanAndRms_TECMinus_Disc6[7]
std::pair< double, double > MeanAndRms_TECMinus_Disc3[7]
std::pair< double, double > MeanAndRms_TIB_Layer3[7]
std::vector< Apv > medianValues_TOB_Layer5
std::vector< Apv > medianValues_TECPlus_Disc7
long double highoccupancy_
std::pair< double, double > MeanAndRms_TECMinus_Disc9[7]
std::vector< Apv > medianValues_TIDPlus_Disc1
std::pair< double, double > MeanAndRms_TIDMinus_Disc1[7]
std::vector< Apv > medianValues_TECMinus_Disc3
unsigned int tibModule(const DetId &id) const
std::pair< double, double > MeanAndRms_TECMinus_Disc4[7]
std::vector< Apv > medianValues_TIDMinus_Disc1
unsigned int tecModule(const DetId &id) const
std::vector< Apv > medianValues_TECMinus_Disc9
bool tecIsBackPetal(const DetId &id) const
double stripOccupancy[6][128]
virtual ~SiStripBadAPVAlgorithmFromClusterOccupancy()
std::pair< double, double > MeanAndRms_TIB_Layer2[7]
std::vector< Apv > medianValues_TECMinus_Disc8
std::vector< Apv > medianValues_TECPlus_Disc9
std::pair< double, double > MeanAndRms_TECPlus_Disc1[7]
std::vector< Apv > medianValues_TECPlus_Disc5
std::vector< Apv > medianValues_TECMinus_Disc6
std::vector< Apv > medianValues_TIB_Layer4
bool tibIsStereo(const DetId &id) const
const TrackerTopology * tTopo
double apvAbsoluteOccupancy
std::pair< double, double > MeanAndRms_TECPlus_Disc7[7]
std::vector< Apv > medianValues_TOB_Layer4
std::vector< Apv > medianValues_TECPlus_Disc6
unsigned int tobModule(const DetId &id) const
std::pair< double, double > MeanAndRms_TECPlus_Disc6[7]
std::pair< double, double > MeanAndRms_TOB_Layer1[7]
std::vector< Apv > medianValues_TOB_Layer3
std::pair< double, double > MeanAndRms_TECMinus_Disc5[7]
std::vector< Apv > medianValues_TOB_Layer6
std::pair< ContainerIterator, ContainerIterator > Range
std::pair< double, double > MeanAndRms_TOB_Layer4[7]
std::pair< double, double > MeanAndRms_TECPlus_Disc3[7]
const TrackerGeomDet * idToDet(DetId) const override
std::vector< Apv > medianValues_TECMinus_Disc5
void extractBadAPVs(SiStripQuality *, HistoMap &, edm::ESHandle< SiStripQuality > &)
double apvMedianOccupancy
unsigned int tecPetalNumber(const DetId &id) const
std::vector< Apv > medianValues_TIB_Layer3
std::pair< double, double > MeanAndRms_TOB_Layer2[7]
std::pair< double, double > MeanAndRms_TECPlus_Disc9[7]
std::vector< Apv > medianValues_TOB_Layer2
unsigned int tobRod(const DetId &id) const
bool put(const uint32_t &detID, const InputVector &vect)
std::vector< Apv > medianValues_TOB_Layer1
double stripWeight[6][128]
std::pair< double, double > MeanAndRms_TOB_Layer6[7]
std::pair< double, double > MeanAndRms_TECPlus_Disc5[7]
unsigned int tecWheel(const DetId &id) const
long double lowoccupancy_
std::pair< double, double > MeanAndRms_TIDPlus_Disc1[7]
unsigned int encode(const unsigned short &first, const unsigned short &NconsecutiveBadStrips, const unsigned short &flag=0)
SiStrip::QualityHistosMap HistoMap
std::pair< double, double > MeanAndRms_TOB_Layer3[7]
unsigned int tobLayer(const DetId &id) const
std::vector< Apv > medianValues_TIB_Layer2
std::vector< Apv > medianValues_TECMinus_Disc2
std::vector< Apv > medianValues_TECMinus_Disc7