/************************************************************************** * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. * * * * Author: The ALICE Off-line Project. * * Contributors are mentioned in the code where appropriate. * * * * Permission to use, copy, modify and distribute this software and its * * documentation strictly for non-commercial purposes is hereby granted * * without fee, provided that the above copyright notice appears in all * * copies and that both the copyright notice and this permission notice * * appear in the supporting documentation. The authors make no claims * * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ #include #include "AliITSOnlineSDDCMN.h" #include "AliLog.h" #include #include /////////////////////////////////////////////////////////////////// // // // Implementation of the class used for analysis of SDD noise // // corrected for common mode // // Origin: F.Prino, Torino, prino@to.infn.it // // // /////////////////////////////////////////////////////////////////// ClassImp(AliITSOnlineSDDCMN) //______________________________________________________________________ AliITSOnlineSDDCMN::AliITSOnlineSDDCMN():AliITSOnlineSDD(),fNEvents(0),fLowThreshold(0),fHighThreshold(0),fMinCorrNoise(0.),fMaxCorrNoise(0.),fNSigmaNoise(0.) { // default constructor Reset(); SetMinNoise(); SetMaxNoise(); SetNSigmaNoise(); } //______________________________________________________________________ AliITSOnlineSDDCMN::AliITSOnlineSDDCMN(Int_t nddl, Int_t ncarlos, Int_t sid):AliITSOnlineSDD(nddl,ncarlos,sid),fNEvents(0),fLowThreshold(0),fHighThreshold(0),fMinCorrNoise(0.),fMaxCorrNoise(0.),fNSigmaNoise(0.) { // default constructor Reset(); SetMinNoise(); SetMaxNoise(); SetNSigmaNoise(); } //______________________________________________________________________ AliITSOnlineSDDCMN::~AliITSOnlineSDDCMN(){ // Destructor } //______________________________________________________________________ void AliITSOnlineSDDCMN::Reset(){ // fNEvents=0; for(Int_t i=0;ifMaxCorrNoise || GetAnodeCorrNoise(ian)fNSigmaNoise*CalcMeanNoise()) fGoodAnode[ian]=0; } } //______________________________________________________________________ TH2F* AliITSOnlineSDDCMN::GetCleanEvent(TH2F* hrawd) const { // TH2F* hcorrd=new TH2F("hcorrd","",hrawd->GetNbinsX(),hrawd->GetXaxis()->GetXmin(),hrawd->GetXaxis()->GetXmax(),hrawd->GetNbinsY(),hrawd->GetYaxis()->GetXmin(),hrawd->GetYaxis()->GetXmax()); for(Int_t itb=fFirstGoodTB;itb<=fLastGoodTB;itb++){ Float_t sumEven=0., sumOdd=0.; Int_t countEven=0, countOdd=0; for(Int_t ian=0;ianGetBinContent(itb+1,ian+1)-fBaseline[ian]; countEven++; } for(Int_t ian=1;ianGetBinContent(itb+1,ian+1)-fBaseline[ian]; countOdd++; } for(Int_t ian=0;ianGetBinContent(itb+1,ian+1)-fCMN[ian]*meanN; hcorrd->SetBinContent(itb+1,ian+1,cntCorr); } } return hcorrd; } //______________________________________________________________________ void AliITSOnlineSDDCMN::AddEvent(TH2F* hrawd){ // fNEvents++; TH2F* hcorrd=GetCleanEvent(hrawd); for(Int_t ian=0;ianGetBinContent(itb+1,ian+1)-fBaseline[ian]; sumQ+=cntdiff*cntdiff; cnt++; } fSumCorrNoise[ian]+=TMath::Sqrt(sumQ/(Float_t)cnt); } delete hcorrd; } //______________________________________________________________________ Float_t AliITSOnlineSDDCMN::CalcMeanNoise() const{ // Float_t meanns=0.; Int_t cnt=0; for(Int_t ian=0;ian0) meanns/=(Float_t)cnt; return meanns; } //______________________________________________________________________ void AliITSOnlineSDDCMN::WriteToASCII(){ // TString outfilnam; outfilnam.Form("SDDbase_step2_ddl%02dc%02d_sid%d.data",fDDL,fCarlos,fSide); FILE* outf=fopen(outfilnam.Data(),"w"); fprintf(outf,"%d\n",fHighThreshold); fprintf(outf,"%d\n",fLowThreshold); for(Int_t ian=0;ianSetBinContent(ian+1,GetAnodeBaseline(ian)); } return h; } //______________________________________________________________________ TH1F* AliITSOnlineSDDCMN::GetRawNoiseAnodeHisto() const { // TString hisnam; hisnam.Form("hnois%02dc%02ds%d",fDDL,fCarlos,fSide); TH1F* h=new TH1F(hisnam.Data(),"",256,-0.5,255.5); for(Int_t ian=0;ianSetBinContent(ian+1,GetAnodeRawNoise(ian)); } return h; } //______________________________________________________________________ TH1F* AliITSOnlineSDDCMN::GetCorrNoiseAnodeHisto() const { // TString hisnam; hisnam.Form("hcorn%02dc%02ds%d",fDDL,fCarlos,fSide); TH1F* h=new TH1F(hisnam.Data(),"",256,-0.5,255.5); for(Int_t ian=0;ianSetBinContent(ian+1,GetAnodeCorrNoise(ian)); } return h; } //______________________________________________________________________ TH1F* AliITSOnlineSDDCMN::GetCMNCoefAnodeHisto() const { // TString hisnam; hisnam.Form("hcmn%02dc%02ds%d",fDDL,fCarlos,fSide); TH1F* h=new TH1F(hisnam.Data(),"",256,-0.5,255.5); for(Int_t ian=0;ianSetBinContent(ian+1,GetAnodeCommonMode(ian)); } return h; } //______________________________________________________________________ TH1F* AliITSOnlineSDDCMN::GetStatusAnodeHisto() const { // TString hisnam; hisnam.Form("hgood%02dc%02ds%d",fDDL,fCarlos,fSide); TH1F* h=new TH1F(hisnam.Data(),"",256,-0.5,255.5); for(Int_t ian=0;ianSetBinContent(ian+1,float(IsAnodeGood(ian))); } return h; } //______________________________________________________________________ TH1F* AliITSOnlineSDDCMN::GetBaselineHisto() const { // TString hisnam; hisnam.Form("hdbd%02dc%02ds%d",fDDL,fCarlos,fSide); TH1F* h=new TH1F(hisnam.Data(),"",100,0.,150.); for(Int_t ian=0;ianFill(GetAnodeBaseline(ian)); } return h; } //______________________________________________________________________ TH1F* AliITSOnlineSDDCMN::GetRawNoiseHisto() const { // TString hisnam; hisnam.Form("hdnd%02dc%02ds%d",fDDL,fCarlos,fSide); TH1F* h=new TH1F(hisnam.Data(),"",100,0.,8.); for(Int_t ian=0;ianFill(GetAnodeRawNoise(ian)); } return h; } //______________________________________________________________________ TH1F* AliITSOnlineSDDCMN::GetCorrNoiseHisto() const { // TString hisnam; hisnam.Form("hdcd%02dc%02ds%d",fDDL,fCarlos,fSide); TH1F* h=new TH1F(hisnam.Data(),"",100,0.,8.); for(Int_t ian=0;ianFill(GetAnodeCorrNoise(ian)); } return h; } //______________________________________________________________________ Bool_t AliITSOnlineSDDCMN::WriteToROOT(TFile *fil){ // if(fil==0){ AliWarning("Invalid pointer to ROOT file"); return kFALSE; } TString hisnam; fil->cd(); hisnam.Form("hgood%02dc%02ds%d",fDDL,fCarlos,fSide); TH1F hgood(hisnam.Data(),"",256,-0.5,255.5); hisnam.Form("hbase%02dc%02ds%d",fDDL,fCarlos,fSide); TH1F hbase(hisnam.Data(),"",256,-0.5,255.5); hisnam.Form("hnois%02dc%02ds%d",fDDL,fCarlos,fSide); TH1F hnois(hisnam.Data(),"",256,-0.5,255.5); hisnam.Form("hcmn%02dc%02ds%d",fDDL,fCarlos,fSide); TH1F hcmn(hisnam.Data(),"",256,-0.5,255.5); hisnam.Form("hcorn%02dc%02ds%d",fDDL,fCarlos,fSide); TH1F hcorn(hisnam.Data(),"",256,-0.5,255.5); for(Int_t ian=0;ian