2 #include "/nova/app/users/jcoelho/SetupHistos.C" 14 double GetX(
int ndb=14,
int db=1,
int feb=0,
int pix=0);
17 TH2F*
GetHist(TString omFileName,
int htype = 0);
23 TString omDir =
"/nova/data/nearline-OnMon/FarDet/";
24 TString omRel[5] = {
"S15-02-05",
"FA14-09-23",
"S14-08-01",
"S14-02-05",
"S13-09-17"};
36 while(!gotfile && ntries < 5){
38 omFileName = omDir + omRel[ntries] + omForm[ntries];
40 if(!gSystem->AccessPathName(omFileName)){
49 cout <<
"No file " + omFileName <<
endl;
53 cout <<
"Found file " + omFileName <<
endl;
57 c1->SetRightMargin(0.17);
59 TH2F *hDraw =
GetHist(omFileName, ptype);
62 cout <<
"Failed to get histogram" <<
endl;
69 hDraw->SetTitle(
";;;");
71 hDraw->GetZaxis()->SetRangeUser(1,3);
72 hDraw->GetZaxis()->SetNdivisions(3);
74 hDraw->GetXaxis()->SetTickLength(0);
75 hDraw->GetXaxis()->SetLabelColor(0);
76 hDraw->GetYaxis()->SetTickLength(0);
77 hDraw->GetYaxis()->SetLabelColor(0);
78 hDraw->GetZaxis()->SetTickLength(0);
79 hDraw->GetZaxis()->SetLabelColor(0);
83 const Int_t
NRGBs = 6;
84 const Int_t
NCont = 255;
85 Double_t
stops[
NRGBs] = { 0.00, 0.33, 0.34, 0.66, 0.67, 1.00 };
86 Double_t
red[
NRGBs] = { 0.00, 0.00, 0.00, 0.00, 1.00, 1.00 };
87 Double_t
green[
NRGBs] = { 0.00, 0.00, 1.00, 1.00, 0.00, 0.00 };
88 Double_t
blue[
NRGBs] = { 1.00, 1.00, 0.00, 0.00, 0.00, 0.00 };
89 TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
90 gStyle->SetNumberContours(NCont);
97 ltx =
MiscText(0.9,0.90,0.05,
"Hot / Bad");
98 ltx->SetTextAngle(-90);
99 ltx =
MiscText(0.9,0.58,0.05,
"Good");
100 ltx->SetTextAngle(-90);
101 ltx =
MiscText(0.9,0.30,0.05,
"Cold");
102 ltx->SetTextAngle(-90);
104 MiscText(0.12,0.08,0.025,omFileName.Data());
113 double x = (ndb-
db)*16*4 + (feb%16)*4 + pix%4 + 1;
121 double y = (12-
dcm)*4*8 +
int(feb/16)*8 +
int(pix/4) + 1;
131 if(gSystem->AccessPathName(omFileName)){
132 cout <<
"No file " + omFileName <<
endl;
137 Double_t PixelsPerFEB = 26;
138 Double_t FEBsPerDCM = 56;
139 Double_t DCMsPerDB = 12;
140 Double_t MaxTopSideAsym = 0.5;
141 Double_t MinTopSideAsym = 0.1;
143 float lowpixmip[7] = {13, 5, 4, 4, 2, 2, 1.5};
144 float highpixmip[7] = {31, 45, 36, 30, 26, 23, 20.};
146 float lowfebmip[7] = {400, 300, 200, 200, 100, 100, 100};
147 float highfebmip[7] = {1000, 1200, 1000, 850, 700, 600, 550};
149 TFile omFile(omFileName,
"read");
154 TH1F *RecordedTime = (TH1F*)omFile.Get(
"RecordedTime");
156 if(RecordedTime) setlivetime = RecordedTime->Integral()*500
e-9;
159 cout << omFileName +
" has no valid RecordedTime histogram." <<
endl;
171 if(htype==0) hDraw = (TH2F*)omFile.Get(
"PixelHitRateMap")->Clone(
"");
172 if(htype==1) hDraw = (TH2F*)omFile.Get(
"FEBHitRateMap")->Clone(
"");
173 if(htype==2) hDraw = (TH2F*)omFile.Get(
"DCMHitRateMap")->Clone(
"");
177 int ndb = hDraw->GetXaxis()->GetXmax() / 16 / 4;
180 for(
int db=1;
db<=14;
db++){
182 int nGoodDCMMipInDB = 0;
184 vector<float> pixMipHitsTop;
185 vector<float> pixMipHitsSide;
190 if(!PixelHitMapMip)
continue;
193 if(!PixelRate)
continue;
195 int nGoodFEBMipInDCM = 0;
199 int nGoodPixMipInFEB = 0;
201 double febmiphits = 0;
203 for(
int pix=0;pix<32;pix++){
205 int ix = (
feb%16)*4 + pix%4 + 1;
208 if( PixelHitMapMip->GetBinContent(ix,iy)==0 )
continue;
211 double pixhitrate = PixelRate->GetBinContent(ix,iy);
212 double pixmiphits = PixelHitMapMip->GetBinContent(ix,iy);
214 febmiphits += TMath::Min(pixmiphits, highpixmip[TMath::Max(
dcm-6,0)] * setlivetime * 4);
216 if(
dcm<7) pixMipHitsTop.push_back(pixmiphits);
217 else pixMipHitsSide.push_back(pixmiphits);
219 if(pixhitrate<
pow(10,3.5) && pixhitrate>
pow(10,0.5) &&
220 TMath::Gamma(lowpixmip[TMath::Max(
dcm-6,0)] * setlivetime , pixmiphits) > 0.1 &&
221 TMath::Gamma(highpixmip[TMath::Max(
dcm-6,0)] * setlivetime , pixmiphits) < 0.9 ){
227 else if(pixhitrate<=
pow(10,0.5) ||
TMath::Gamma(lowpixmip[TMath::Max(
dcm-6,0)] * setlivetime , pixmiphits) <= 0.1){
240 if(nGoodPixMipInFEB >= PixelsPerFEB &&
241 TMath::Gamma(lowfebmip[TMath::Max(
dcm-6,0)] * setlivetime , febmiphits) > 0.1 &&
242 TMath::Gamma(highfebmip[TMath::Max(
dcm-6,0)] * setlivetime , febmiphits) < 0.9 ){
248 else if(
TMath::Gamma(lowfebmip[TMath::Max(
dcm-6,0)] * setlivetime , febmiphits) <= 0.1 &&
254 else if(febmiphits > 0){
263 if(nGoodFEBMipInDCM >= FEBsPerDCM){
279 delete PixelHitMapMip;
283 double medianTop =
GetMedian(pixMipHitsTop);
284 double medianSide =
GetMedian(pixMipHitsSide);
286 if(medianTop + medianSide != 0) medianTop = (medianTop - medianSide) / (medianTop + medianSide);
292 if(medianTop >= MaxTopSideAsym ||
293 medianTop <= MinTopSideAsym ){
296 if(medianTop > -999)
cout <<
"DB " <<
db <<
" has bad Top/Side asymmetry: " << medianTop <<
endl;
312 size_t size = scores.size();
314 if(size==0)
return 0;
316 sort(scores.begin(), scores.end());
320 median = (scores[size / 2 - 1] + scores[size / 2]) / 2;
324 median = scores[size / 2];
void SetHist(TH1 *hist, int col=1, bool fill=false)
TLatex * MiscText(float x, float y, float size, TString text)
TH2F * GetHist(TString omFileName, int htype=0)
TCanvas * MakeLongCanvas()
void PlotOnMon(int run=13260, int subrun=0, int ptype=1)
float GetMedian(vector< float > scores)
double GetY(int dcm=1, int feb=0, int pix=0)
void Format(TGraph *gr, int lcol, int lsty, int lwid, int mcol, int msty, double msiz)
void Config(const TH1 *h)
double GetX(int ndb=14, int db=1, int feb=0, int pix=0)