ATLAS Offline Software
Loading...
Searching...
No Matches
MdtDeadNoisyUtils.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4
5#ifndef dqutilsMdtDeadNoisy_h
6#define dqutilsMdtDeadNoisy_h
7
8#include <vector>
9#include <string>
10#include <sstream>
11#include <iostream>
12#include <fstream>
13#include <stdio.h>
14
15#include <TString.h>
16#include <TH1F.h>
17#include <TCanvas.h>
18
20 struct TubeRange {
21 TubeRange(int a, int b) {x1 = a; x2 = b;}
22 bool InRange(int x) {
23 if ((x >= x1) && (x <= x2)) return true;
24
25 return false;
26 }
27
28 int x1;
29 int x2;
30 };
31
32 double sqr(double x);
33 void displayList(std::vector<int>& v);
34 void displayList(std::vector<int>& v, std::ofstream& outputfile);
35 void getDeadList(TH1F* h, std::vector<int>& v);
36 bool find(std::vector<int>& v, unsigned int x);
37 void getSurelyDeadList(TH1F* h, std::vector<int>& v, std::vector<int>& betweenlist);
38 void getNotBetweenList(std::vector<int>& v, std::vector<int>& surely_v, std::vector<int>& betweenlist);
39 void getNotMasked(std::vector<int>& v, TH1F* h);
40 void getNotInDeadML(std::vector<int>& v, std::vector<int>& deadML_v, const TString& hardware_name, int totalTubes);
41 void getNotInDeadLayer(std::vector<int>& v, std::vector<int>& deadLayer_v, const TString& hardware_name,
42 int totalTubes);
43 void getNotInDeadMezz(std::vector<int>& v, std::vector<int>& deadMezz_v, const TString& hardware_name,
44 int totalTubes);
45 void getAllBins(TH1F* h, std::vector<int>& v);
46 void getAllBinsInRange(TH1F* h, std::vector<int>& v, int x1, int x2);
47 void getAllBinsInRangeBelowCutoff(TH1F* h, std::vector<int>& v, int crustCutoff, int x1, int x2);
48 void getAllUnmaskedBinsInRangeBelowCrustCutoff(TH1F* h, std::vector<int>& v, int crustCutoff, int x1, int x2);
49 void getBins(TH1F* h, std::vector<int>& indices, std::vector<int>& content);
50 void removeZeros(std::vector<int>& v);
51 void getAllTubes(TH1F* h, std::vector<int>& v);
52 void getNonEmptyBins(TH1F* h, std::vector<int>& v);
53 void getNonEmptyTubes(TH1F* h, std::vector<int>& v);
54 template <class T>
55 double getMean(std::vector<T>& v);
56 double getMean_WithCut(std::vector<int>& v, double cut);
57 void getNoBetweens(TH1F* h, std::vector<int>& no_dead, std::vector<int>& no_betweens, std::vector<int>& betweenlist,
58 float minBinContent);
59 void getNoBetweens_middle(std::vector<int> no_betweens, std::vector<int>& no_betweens_middle);
60 void getNoBetweens_lowmiddle(std::vector<int> no_betweens, std::vector<int>& no_betweens_lowmiddle);
61 void getNoBetweens_middle_aggressive(std::vector<int> no_betweens, std::vector<int>& no_betweens_middle_aggressive);
62 void getNoBetweens_middle_semiaggressive(std::vector<int> no_betweens,
63 std::vector<int>& no_betweens_middle_aggressive);
64 void getNoBetweens_lowmiddle_aggressive(std::vector<int> no_betweens,
65 std::vector<int>& no_betweens_lowmiddle_aggressive);
66 void getNoBetweens_highmiddle_aggressive(std::vector<int> no_betweens,
67 std::vector<int>& no_betweens_lowmiddle_aggressive);
68 double getStandardDevFromMean(std::vector<int>& v, double mean);
69 double getStandardDevFromMean_neg(std::vector<int>& v, double mean);
70 double getStandardDevFromMean_pos(std::vector<int>& v, double mean);
71 void getNoisyList(TH1F* h, std::vector<int>& no_betweens_middle, std::vector<int>& no_betweens_middle_aggressive,
72 double num_std_dev, std::vector<int>& noisylist);
73 void getNoisyList2(TH1F* h, std::vector<int>& no_betweens_middle, std::vector<int>& no_betweens_middle_aggressive,
74 double num_pct, std::vector<int>& noisylist);
75 void getIneffList(TH1F* h, std::vector<int>& no_betweens_middle, std::vector<int>& no_betweens_lowmiddle_aggressive,
76 double num_std_dev, std::vector<int>& inefflist);
77 void getIneffList(TH1F* h, std::vector<int>& no_betweens_middle, std::vector<int>& no_betweens_lowmiddle_aggressive,
78 double num_std_dev_1, double num_std_dev_2, std::vector<int>& inefflist);
79 void getIneffList2(TH1F* h, std::vector<int>& no_betweens_middle, std::vector<int>& no_betweens_lowmiddle_aggressive,
80 double num_pct, std::vector<int>& inefflist);
81 void getIneffList2(TH1F* h, std::vector<int>& no_betweens_middle, std::vector<int>& no_betweens_lowmiddle_aggressive,
82 double num_pct_1, double num_pct_2, std::vector<int>& inefflist);
83 void getIneffList2(std::vector<int>& indices, TH1F* h, std::vector<int>& no_betweens_middle,
84 std::vector<int>& no_betweens_lowmiddle_aggressive, double num_pct, std::vector<int>& inefflist);
85 bool validityCheckDead(std::vector<int>& no_betweens_middle, std::vector<int>& no_betweens_middle_aggressive);
86 bool validityCheckNoise(std::vector<int>& no_betweens_middle,
87 std::vector<int>& no_betweens_middle_aggressive /*, int max*/); //max parameter is not
88 // currently used
89 void getNonEmptyNonNoisyTubes(TH1F* h_tube_fornoise, TH1F* h_tube, std::vector<int>& non_dead_non_noisy);
90 void removeNonContiguous(std::vector<int>& betweenlist, unsigned int sz);
91 void CatalogNoisyEff(TH1F* h_tube_bkd, TH1F* h_tube_fornoise, TH1F* num, TH1F* den, int nTriggers,
92 TH1F* EffVSNoise_num, TH1F* EffVSNoise_den, TH1F* EffVSNoise_ADCCut_num,
93 TH1F* EffVSNoise_ADCCut_den, TH1F* EffVSBkd_num, TH1F* EffVSBkd_den);
94 std::vector<int> GetNoisyTubes(TH1F* h_tube_fornoise, int nTriggers, float frequency);//Simply determine noisy tubes
95 // from freq.
96 std::vector<int> GetNoisyTubes(TH1F* h_tube_fornoise, TH1F* h_tube, TString chamber, int& validity);
97 std::vector<int> GetNoisyTubes_WithoutForNoise(TH1F* h_tube, int& validity, TString chamber);
98 //std::vector<int> GetDeadTubes( TH1F* h_tube_fornoise, TH1F* h_tube, TString chamber);
99 std::vector<int> GetDeadTubes(TH1F* h_tube, int& validity, std::vector<int>& deadML_v, std::vector<int>& deadLayer_v,
100 std::vector<int>& deadMezz_v);
101 //std::vector<int> GetMaskedTubesForDead( TH1F* h_tube_fornoise, TH1F* h_tube, TString chamber);
102 std::vector<int> GetMaskedTubesForDead(TH1F* h_tube);
103 //std::vector<int> GetMaskedTubesForNoisy( TH1F* h_tube_fornoise, TH1F* h_tube, TString chamber);
104 std::vector<int> GetMaskedTubesForNoisy(TH1F* h_tube_fornoise);
105 double GetMeanFromHist(TH1F* h_tube);
106 double GetStandardDevFromHist(TH1F* h_tube, double mean);
107 int getLastTubeInLayer(int& firstTubeInLayer, const TString& hardware_name, int totalTubes);
108 std::vector<TubeRange> getLayerRanges(const TString& hardware_name, int totalTubes);
109 int getLastTubeInML(int& firstTubeInML, const TString& hardware_name, int totalTubes);
110 std::vector<TubeRange> getMLRanges(const TString& hardware_name, int totalTubes);
111 std::vector<TubeRange> getMezzRanges(const TString& hardware_name, int totalTubes, int& groupsPerLayer);
112 int Get_ML_of_Mezz(int& mezz, const TString& hardware_name, int totalTubes);
113 int Get_ML_of_Mezz_degenerate(int& mezz, const TString& hardware_name, int totalTubes);
114 std::vector<int> /*void*/ FindDeadMezz(TH1F* h_tube, const TString& hardware_name, std::vector<int>& deadML_v);
115 std::vector<int> /*void*/ FindDeadLayer(TH1F* h_tube, const TString& hardware_name, std::vector<int>& deadML_v);
116 std::vector<int> /*void*/ FindDeadML(TH1F* h_tube, const TString& hardware_name);
117 int GetNumML(const TString& hardware_name);
118 int GetNumLayersPerML(const TString& hardware_name);
119 int GetNumTubesPerMezz(const TString& hardware_name, int mezz);//For Getting total tube count
120 //global layer i.e. 5 instead of ML2 layer 2
121 int GetNumTubesPerML(const TString& hardware_name, int layer, int TotalTubes);//For Getting total tube count
122 int GetNumTubesPerLayer(const TString& hardware_name, int ML, int TotalTubes);//For Getting total tube count
123 int Get_ML_of_Layer(int& layer, const TString& hardware_name);
124 int Get_ML_of_Tube(int& tubeID, const TString& hardware_name, int totalTubes);
125 int Get_Layer_of_Tube(int& tubeID, const TString& hardware_name, int totalTubes);
126 int Get_Mezz_of_Tube(int& tubeID, const TString& hardware_name /*, int totalTubes*/,
127 std::vector<TubeRange>& tubeRanges, int groupsPerLayer);
128 int GetNumNonMaskedTubes(TH1F* h_tube);
129 int GetNumMezz(TH1F* h_tube);
130 bool AinB(int A, std::vector<int>& B);
131 bool AinB(int A, const std::vector<int>* B);
132
133 //For dumping pdf
134 void FillPDF(const std::string& inFilename, TH1F* hDead, TH1F* hNoise, TCanvas* c,
135 const std::vector<int>* deadTubes, const std::vector<int>* deadASD, const std::vector<int>* deadMEZZ,
136 const std::vector<int>* deadLayer, const std::vector<int>* deadML,
137 const std::vector<int>* noisyTubes, const std::vector<int>* noisyASD, const std::vector<int>* noisyMEZZ,
138 const std::vector<int>* noisyLayer, const std::vector<int>* noisyML,
139 int deadTubesChamberValidity, int noisyTubesChamberValidity,
140 bool draw_Mezz_L_ML_guidlines, bool draw_mean, bool draw_masked_tubes, bool separate_dead_noisy_histos,
141 bool draw_validity_message, bool draw_histo_if_nothing_to_report);
142} // end namespace
143
144#endif
ofstream outputfile
static Double_t sz
static Double_t a
#define sqr(t)
#define x
Header file for AthHistogramAlgorithm.
void mean(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")
int Get_Mezz_of_Tube(int &tubeID, const TString &hardware_name, std::vector< TubeRange > &tubeRanges, int groupsPerLayer)
bool validityCheckNoise(std::vector< int > &no_betweens_middle, std::vector< int > &no_betweens_middle_aggressive)
void removeZeros(std::vector< int > &v)
double GetMeanFromHist(TH1F *h_tube)
std::vector< int > FindDeadML(TH1F *h_tube, const TString &hardware_name)
void getNoisyList2(TH1F *h, std::vector< int > &no_betweens_middle, std::vector< int > &no_betweens_middle_aggressive, double num_pct, std::vector< int > &noisylist)
void getNotMasked(std::vector< int > &v, TH1F *h)
double getMean_WithCut(std::vector< int > &v, double cut)
bool AinB(int A, std::vector< int > &B)
void getNoBetweens_highmiddle_aggressive(std::vector< int > no_betweens, std::vector< int > &no_betweens_lowmiddle_aggressive)
bool validityCheckDead(std::vector< int > &no_betweens_middle, std::vector< int > &no_betweens_middle_aggressive)
std::vector< int > GetMaskedTubesForDead(TH1F *h_tube)
void getNoBetweens_middle(std::vector< int > no_betweens, std::vector< int > &no_betweens_middle)
double getStandardDevFromMean_pos(std::vector< int > &v, double mean)
void getAllUnmaskedBinsInRangeBelowCrustCutoff(TH1F *h, std::vector< int > &v, int crustCutoff, int x1, int x2)
void getSurelyDeadList(TH1F *h, std::vector< int > &v, std::vector< int > &betweenlist)
int GetNumNonMaskedTubes(TH1F *h_tube)
void getNonEmptyTubes(TH1F *h, std::vector< int > &v)
std::vector< int > GetNoisyTubes_WithoutForNoise(TH1F *h_tube, int &validity, TString chamber)
int Get_Layer_of_Tube(int &tubeID, const TString &hardware_name, int totalTubes)
bool find(std::vector< int > &v, unsigned int x)
void getNoBetweens_middle_aggressive(std::vector< int > no_betweens, std::vector< int > &no_betweens_middle_aggressive)
int Get_ML_of_Mezz(int &mezz, const TString &hardware_name, int totalTubes)
std::vector< int > GetDeadTubes(TH1F *h_tube, int &validity, std::vector< int > &deadML_v, std::vector< int > &deadLayer_v, std::vector< int > &deadMezz_v)
void getNotInDeadLayer(std::vector< int > &v, std::vector< int > &deadLayer_v, const TString &hardware_name, int totalTubes)
std::vector< int > FindDeadLayer(TH1F *h_tube, const TString &hardware_name, std::vector< int > &deadML_v)
int GetNumTubesPerMezz(const TString &hardware_name, int mezz)
std::vector< int > GetNoisyTubes(TH1F *h_tube_fornoise, int nTriggers, float frequency)
void getIneffList2(TH1F *h, std::vector< int > &no_betweens_middle, std::vector< int > &no_betweens_lowmiddle_aggressive, double num_pct, std::vector< int > &inefflist)
int GetNumLayersPerML(const TString &hardware_name)
void getAllBinsInRangeBelowCutoff(TH1F *h, std::vector< int > &v, int crustCutoff, int x1, int x2)
void getAllTubes(TH1F *h, std::vector< int > &v)
int getLastTubeInML(int &firstTubeInML, const TString &hardware_name, int totalTubes)
std::vector< TubeRange > getLayerRanges(const TString &hardware_name, int totalTubes)
double GetStandardDevFromHist(TH1F *h_tube, double mean)
void getIneffList(TH1F *h, std::vector< int > &no_betweens_middle, std::vector< int > &no_betweens_lowmiddle_aggressive, double num_std_dev, std::vector< int > &inefflist)
void getNoBetweens_middle_semiaggressive(std::vector< int > no_betweens, std::vector< int > &no_betweens_middle_aggressive)
void getNonEmptyNonNoisyTubes(TH1F *h_tube_fornoise, TH1F *h_tube, std::vector< int > &non_dead_non_noisy)
void displayList(std::vector< int > &v)
int GetNumTubesPerLayer(const TString &hardware_name, int ML, int TotalTubes)
void getDeadList(TH1F *h, std::vector< int > &v)
std::vector< int > FindDeadMezz(TH1F *h_tube, const TString &hardware_name, std::vector< int > &deadML_v)
void getAllBins(TH1F *h, std::vector< int > &v)
double getStandardDevFromMean_neg(std::vector< int > &v, double mean)
void getNonEmptyBins(TH1F *h, std::vector< int > &v)
void getNotInDeadMezz(std::vector< int > &v, std::vector< int > &deadMezz_v, const TString &hardware_name, int totalTubes)
void getNoBetweens_lowmiddle_aggressive(std::vector< int > no_betweens, std::vector< int > &no_betweens_lowmiddle_aggressive)
void CatalogNoisyEff(TH1F *h_tube_bkd, TH1F *h_tube_fornoise, TH1F *num, TH1F *den, int nTriggers, TH1F *EffVSNoise_num, TH1F *EffVSNoise_den, TH1F *EffVSNoise_ADCCut_num, TH1F *EffVSNoise_ADCCut_den, TH1F *EffVSBkd_num, TH1F *EffVSBkd_den)
void getNotBetweenList(std::vector< int > &v, std::vector< int > &surely_v, std::vector< int > &betweenlist)
int GetNumMezz(TH1F *h_tube)
void FillPDF(const std::string &inFilename, TH1F *hDead, TH1F *hNoise, TCanvas *c, const std::vector< int > *deadTubes, const std::vector< int > *deadASD, const std::vector< int > *deadMEZZ, const std::vector< int > *deadLayer, const std::vector< int > *deadML, const std::vector< int > *noisyTubes, const std::vector< int > *noisyASD, const std::vector< int > *noisyMEZZ, const std::vector< int > *noisyLayer, const std::vector< int > *noisyML, int deadTubesChamberValidity, int noisyTubesChamberValidity, bool draw_Mezz_L_ML_guidlines, bool draw_mean, bool draw_masked_tubes, bool separate_dead_noisy_histos, bool draw_validity_message, bool draw_histo_if_nothing_to_report)
void getNoBetweens_lowmiddle(std::vector< int > no_betweens, std::vector< int > &no_betweens_lowmiddle)
std::vector< int > GetMaskedTubesForNoisy(TH1F *h_tube_fornoise)
int GetNumML(const TString &hardware_name)
int Get_ML_of_Tube(int &tubeID, const TString &hardware_name, int totalTubes)
std::vector< TubeRange > getMLRanges(const TString &hardware_name, int totalTubes)
std::vector< TubeRange > getMezzRanges(const TString &hardware_name, int totalTubes, int &groupsPerLayer)
void getAllBinsInRange(TH1F *h, std::vector< int > &v, int x1, int x2)
int getLastTubeInLayer(int &firstTubeInLayer, const TString &hardware_name, int totalTubes)
int Get_ML_of_Layer(int &layer, const TString &hardware_name)
void getBins(TH1F *h, std::vector< int > &indices, std::vector< int > &content)
int GetNumTubesPerML(const TString &hardware_name, int layer, int TotalTubes)
void getNoisyList(TH1F *h, std::vector< int > &no_betweens_middle, std::vector< int > &no_betweens_middle_aggressive, double num_std_dev, std::vector< int > &noisylist)
double getMean(std::vector< T > &v)
void getNotInDeadML(std::vector< int > &v, std::vector< int > &deadML_v, const TString &hardware_name, int totalTubes)
void removeNonContiguous(std::vector< int > &betweenlist, unsigned int sz)
void getNoBetweens(TH1F *h, std::vector< int > &no_dead, std::vector< int > &no_betweens, std::vector< int > &betweenlist, float minBinContent)
double getStandardDevFromMean(std::vector< int > &v, double mean)
int Get_ML_of_Mezz_degenerate(int &mezz, const TString &hardware_name, int totalTubes)
hold the test vectors and ease the comparison