#include "AliITSRawStreamSPD.h"
#include <TStyle.h>
#include <TMath.h>
+#include <TLine.h>
#include <TF1.h>
#include <TGraph.h>
#include <TH2F.h>
//Double_t itsSpdErrorfOrig(Double_t *x, Double_t *par){
// return 0.5+0.5*TMath::Erf((x[0]-par[0])/par[1]/sqrt(2.));
//}
+//_________________________________________________________________________
+Double_t itsSpdScurveForMeanTh(Double_t *x, Double_t *par){
+ if (par[2]<0) par[2]=0;
+ Double_t val = 1.- par[2]*(1.-TMath::Erf((x[0]-par[0])/par[1]/sqrt(2.)));
+// Double_t val = par[2]+(0.12*256*32-par[2])*(0.5+0.5*TMath::Erf((x[0]-par[0])/par[1]/sqrt(2.)));
+ return val;
+}
//_________________________________________________________________________
AliITSOnlineSPDscanAnalyzer::AliITSOnlineSPDscanAnalyzer(const Char_t *fileName, AliITSOnlineCalibrationSPDhandler *handler, Bool_t readFromGridFile) :
// UInt_t routerNr = fScanObj->GetRouterNr();
UInt_t rowStart = fScanObj->GetRowStart();
UInt_t rowEnd = fScanObj->GetRowEnd();
- UInt_t NrTriggers = fScanObj->GetTriggers(0)/(rowEnd-rowStart+1);
+ UInt_t nrTriggers = fScanObj->GetTriggers(0)/(rowEnd-rowStart+1);
Float_t pixel100=0;
Float_t zeri=0;
for (UInt_t row=rowStart; row<=rowEnd; row++) {
if (col!=1 && col!=9 && col!=17 && col!=25) { //exclude test columns!!!
- if (fScanObj->GetHits(0,hs,chipNr,col,row)==NrTriggers) {
+ if (fScanObj->GetHits(0,hs,chipNr,col,row)==nrTriggers) {
pixel100++;
pixel100hs++;
pixel100chip++;
zerihs++;
zerichip++;
}
- if (fScanObj->GetHits(0,hs,chipNr,col,row)>NrTriggers) {
+ if (fScanObj->GetHits(0,hs,chipNr,col,row)>nrTriggers) {
pixelN++;
pixelNhs++;
pixelNchip++;
}
}
- Float_t TPeffChip=(pixel100chip/(28*(rowEnd-rowStart+1)))*100;
- fTPeffChip[hs]->Fill(chipNr,TPeffChip);
+ Float_t tPeffChip=(pixel100chip/(28*(rowEnd-rowStart+1)))*100;
+ fTPeffChip[hs]->Fill(chipNr,tPeffChip);
- Float_t DeadPixelChip=(zerichip/(28*(rowEnd-rowStart+1)))*100;
- fDeadPixelChip[hs]->Fill(chipNr,DeadPixelChip);
+ Float_t deadPixelChip=(zerichip/(28*(rowEnd-rowStart+1)))*100;
+ fDeadPixelChip[hs]->Fill(chipNr,deadPixelChip);
- Float_t NoisyPixelChip=(pixelNchip/(28*(rowEnd-rowStart+1)))*100;
- fNoisyPixelChip[hs]->Fill(chipNr,NoisyPixelChip);
+ Float_t noisyPixelChip=(pixelNchip/(28*(rowEnd-rowStart+1)))*100;
+ fNoisyPixelChip[hs]->Fill(chipNr,noisyPixelChip);
}
}
- Float_t TPeffHS=(pixel100hs/(28*numChipsActiveHS*(rowEnd-rowStart+1)))*100;
- fTPeffHS->Fill(hs,TPeffHS);
+ Float_t tPeffHS=(pixel100hs/(28*numChipsActiveHS*(rowEnd-rowStart+1)))*100;
+ fTPeffHS->Fill(hs,tPeffHS);
- Float_t DeadPixelHS=(zerihs/(28*numChipsActiveHS*(rowEnd-rowStart+1)))*100;
- fDeadPixelHS->Fill(hs,DeadPixelHS);
+ Float_t deadPixelHS=(zerihs/(28*numChipsActiveHS*(rowEnd-rowStart+1)))*100;
+ fDeadPixelHS->Fill(hs,deadPixelHS);
- Float_t NoisyPixelHS=(pixelNhs/(28*numChipsActiveHS*(rowEnd-rowStart+1)))*100;
- fNoisyPixelHS->Fill(hs,NoisyPixelHS);
+ Float_t noisyPixelHS=(pixelNhs/(28*numChipsActiveHS*(rowEnd-rowStart+1)))*100;
+ fNoisyPixelHS->Fill(hs,noisyPixelHS);
}
fTPeff=(pixel100/(28*numChipsActive*(rowEnd-rowStart+1)))*100;
return -1;
}
}
+//_________________________________________________________________________
+TArrayI AliITSOnlineSPDscanAnalyzer::GetMeanTh(UInt_t hs, UInt_t chipNr) {
+ // calculates and returns the mean threshold
+ TArrayI fitresults(4);
+ if (hs>=6 || chipNr>10) return fitresults;
+ if (fScanObj==NULL) {
+ Error("AliITSOnlineSPDscanAnalyzer::GetMeanTh","No data!");
+ return fitresults;
+ }
+ // should be type kMEANTH or kDAC with id 39
+ if (fType!=kMEANTH && (fType!=kDAC || fDacId!=105)) {
+ Error("AliITSOnlineSPDscanAnalyzer::GetMeanTh","MeanTh only for scan type %d OR %d with dac_id 105.",kMEANTH,kDAC);
+ return fitresults;
+ }
+ if (fHitEventEfficiency[hs][chipNr]==NULL) {
+ printf("processing hit efficiency \n");
+ if (!ProcessHitEventEfficiency()) {
+ printf("...not processed!!\n");
+ return fitresults;
+ }
+ }
+ Double_t x,y;
+ fHitEventEfficiency[hs][chipNr]->GetPoint(fHitEventEfficiency[hs][chipNr]->GetN()-1,x,y);
+ Double_t min = x;
+ fHitEventEfficiency[hs][chipNr]->GetPoint(0,x,y);
+ Double_t max = x;
+
+ Double_t mean = 0.5*(min+max);
+ TString funcName = Form("Fit meanth func HS%d CHIP%d",hs,chipNr);
+ TF1 *minThFunc = new TF1(funcName.Data(),itsSpdScurveForMeanTh,min,max,3);
+ minThFunc->SetParameter(0,mean);
+ minThFunc->SetParameter(1,264); // 4 (mV) * 66 (el)
+ minThFunc->SetParLimits(1,100,1000); // minimum value is 1 mV (-> 100 in TPAmplitude)
+ minThFunc->SetParameter(2,0.4);
+ minThFunc->SetParName(0,"Mean");
+ minThFunc->SetParName(1,"Sigma");
+ minThFunc->SetParName(2,"Half");
+ minThFunc->SetLineWidth(1);
+
+ fHitEventEfficiency[hs][chipNr]->Fit(funcName,"Q","",min,max);
+
+ fitresults.AddAt((Int_t)minThFunc->GetParameter(0),0);
+ fitresults.AddAt((Int_t)minThFunc->GetParError(0),1);
+ fitresults.AddAt((Int_t)minThFunc->GetParameter(1),2);
+ fitresults.AddAt((Int_t)minThFunc->GetParError(1),3);
+ TLine *ly = new TLine((Double_t)min,0.5,(Double_t)fitresults.At(0),0.5); ly->SetLineStyle(6);
+ ly->Draw("same");
+ TLine *lx = new TLine((Double_t)fitresults.At(0),0.,(Double_t)fitresults.At(0),0.5);
+ lx->SetLineStyle(6);
+ lx->Draw("same");
+ delete minThFunc;
+
+ return fitresults;
+}
+
//_________________________________________________________________________
Bool_t AliITSOnlineSPDscanAnalyzer::ProcessMeanMultiplicity() {
// process mean multiplicity data
fHitEventEfficiency[hs][chipNr] = new TGraph();
}
Float_t efficiency=fScanObj->GetHitEventsEfficiency(step,hs,chipNr);
- if (fType==kMINTH || fType==kMEANTH || fType==kDAC || fType==kDELAY) {
+ if (fType==kMINTH || fType==kDAC || fType==kDELAY) {
fHitEventEfficiency[hs][chipNr]->SetPoint(step,((AliITSOnlineSPDscanMultiple*)fScanObj)->GetDacValue(step),efficiency);
- }
- else {
+ } else if(fType==kMEANTH){
+ fHitEventEfficiency[hs][chipNr]->SetPoint(step,((AliITSOnlineSPDscanMeanTh*)fScanObj)->GetTPAmp(step,hs),efficiency);
+ } else {
fHitEventEfficiency[hs][chipNr]->SetPoint(step,0,efficiency);
}
}
}
return fHitMapTot;
}
+//_________________________________________________________________________
+TH2F* AliITSOnlineSPDscanAnalyzer::GetPhysicalHitMapTot(UInt_t step) {
+ // creates and returns a pointer to a hitmap histo (-> 1 equpment opened up)
+
+ if (fScanObj==NULL) {
+ Error("AliITSOnlineSPDscanAnalyzer::GetHitMapTot","No data!");
+ return NULL;
+ }
+ TString histoname;
+ if (fType==kMINTH || fType==kMEANTH || fType==kDAC) {
+ histoname = Form("Router %d , DAC %d",GetRouterNr(),((AliITSOnlineSPDscanMultiple*)fScanObj)->GetDacValue(step));
+ }
+ else {
+ histoname = Form("Router %d ",GetRouterNr());
+ }
+ TH2F* hPhysicalHitMapTot = new TH2F(histoname.Data(),histoname.Data(),32*10,-0.5,32*10-0.5,256*6,-0.5,256*6-0.5);
+ hPhysicalHitMapTot->SetNdivisions(-10,"X");
+ hPhysicalHitMapTot->SetNdivisions(-006,"Y");
+ hPhysicalHitMapTot->SetTickLength(0,"X");
+ hPhysicalHitMapTot->SetTickLength(0,"Y");
+ hPhysicalHitMapTot->GetXaxis()->SetLabelColor(gStyle->GetCanvasColor());
+ hPhysicalHitMapTot->GetYaxis()->SetLabelColor(gStyle->GetCanvasColor());
+ Int_t correctChip = -1;
+ for (UInt_t hs=0; hs<6; hs++) {
+ for (UInt_t chipNr=0; chipNr<10; chipNr++) {
+ if(GetRouterNr()<10) correctChip = 9-chipNr;
+ else correctChip=chipNr;
+ for (UInt_t col=0; col<32; col++) {
+ for (UInt_t row=0; row<256; row++) {
+ if(hs<2) hPhysicalHitMapTot->Fill(correctChip*32+col,(5-hs)*256+row,fScanObj->GetHits(step,hs,chipNr,col,row));
+ else hPhysicalHitMapTot->Fill(correctChip*32+(31-col),(5-hs)*256+row,fScanObj->GetHits(step,hs,chipNr,col,row));
+ }
+ }
+ }
+ }
+ return hPhysicalHitMapTot;
+}
+
//_________________________________________________________________________
TH2F* AliITSOnlineSPDscanAnalyzer::GetHitMapChip(UInt_t step, UInt_t hs, UInt_t chip) {
// creates and returns a pointer to a hitmap histo (chip style a la spdmood)
TString histoName;
TString histoTitle;
histoName = Form("fChipHisto_%d_%d_%d", GetRouterNr(), hs, chip);
- histoTitle = Form("Eq ID %d, Half Stave %d, Chip %d", GetRouterNr(), hs, chip);
+ histoTitle = Form("Eq ID %d, Half Stave %d, Chip %d ", GetRouterNr(), hs, chip);
TH2F *returnHisto = new TH2F(histoName.Data(), histoTitle.Data(), 32, -0.5, 31.5, 256, -0.5, 255.5);
returnHisto->SetMinimum(0);
for (UInt_t col=0; col<32; col++) {
for (UInt_t row=0; row<256; row++) {
- returnHisto->Fill(col,row,fScanObj->GetHits(step,hs,chip,col,row));
+ if(hs<2) returnHisto->Fill(31-col,row,fScanObj->GetHits(step,hs,chip,col,row));
+ else returnHisto->Fill(col,row,fScanObj->GetHits(step,hs,chip,col,row));
}
}