166 #include <TObjArray.h> 171 #include <TVectorF.h> 174 #include <TDirectory.h> 180 #include "AliRawReader.h" 181 #include "AliRawReaderRoot.h" 182 #include "AliRawReaderDate.h" 216 fIsZeroSuppressed(kFALSE),
227 fCalRocArrayOutliers(72),
231 fHMeanTimeSector(0x0),
232 fVMeanTimeSector(72),
233 fPadTimesArrayEvent(72),
235 fPadRMSArrayEvent(72),
236 fPadPedestalArrayEvent(72),
247 fVTime0OffsetCounter(72)
252 SetNameTitle(
"AliTPCCalibPulser",
"AliTPCCalibPulser");
260 fNbinsT0(sig.fNbinsT0),
261 fXminT0(sig.fXminT0),
262 fXmaxT0(sig.fXmaxT0),
263 fNbinsQ(sig.fNbinsQ),
266 fNbinsRMS(sig.fNbinsRMS),
267 fXminRMS(sig.fXminRMS),
268 fXmaxRMS(sig.fXmaxRMS),
269 fPeakIntMinus(sig.fPeakIntMinus),
270 fPeakIntPlus(sig.fPeakIntPlus),
271 fIsZeroSuppressed(sig.fIsZeroSuppressed),
282 fCalRocArrayOutliers(72),
286 fHMeanTimeSector(0x0),
287 fVMeanTimeSector(72),
288 fPadTimesArrayEvent(72),
290 fPadRMSArrayEvent(72),
291 fPadPedestalArrayEvent(72),
302 fVTime0OffsetCounter(72)
306 for (Int_t iSec = 0; iSec < 72; ++iSec){
312 const TH2S *hQ = (TH2S*)sig.
fHistoQArray.UncheckedAt(iSec);
313 const TH2S *hT0 = (TH2S*)sig.
fHistoT0Array.UncheckedAt(iSec);
322 TH2S *hNew =
new TH2S(*hQ);
323 hNew->SetDirectory(0);
327 TH2S *hNew =
new TH2S(*hT0);
328 hNew->SetDirectory(0);
332 TH2S *hNew =
new TH2S(*hRMS);
333 hNew->SetDirectory(0);
390 SetNameTitle(
"AliTPCCalibPulser",
"AliTPCCalibPulser");
393 if (config->GetValue(
"FirstTimeBin"))
fFirstTimeBin = ((TObjString*)config->GetValue(
"FirstTimeBin"))->GetString().Atoi();
394 if (config->GetValue(
"LastTimeBin"))
fLastTimeBin = ((TObjString*)config->GetValue(
"LastTimeBin"))->GetString().Atoi();
395 if (config->GetValue(
"NbinsT0"))
fNbinsT0 = ((TObjString*)config->GetValue(
"NbinsT0"))->GetString().Atoi();
396 if (config->GetValue(
"XminT0"))
fXminT0 = ((TObjString*)config->GetValue(
"XminT0"))->GetString().Atof();
397 if (config->GetValue(
"XmaxT0"))
fXmaxT0 = ((TObjString*)config->GetValue(
"XmaxT0"))->GetString().Atof();
398 if (config->GetValue(
"NbinsQ"))
fNbinsQ = ((TObjString*)config->GetValue(
"NbinsQ"))->GetString().Atoi();
399 if (config->GetValue(
"XminQ"))
fXminQ = ((TObjString*)config->GetValue(
"XminQ"))->GetString().Atof();
400 if (config->GetValue(
"XmaxQ"))
fXmaxQ = ((TObjString*)config->GetValue(
"XmaxQ"))->GetString().Atof();
401 if (config->GetValue(
"NbinsRMS"))
fNbinsRMS = ((TObjString*)config->GetValue(
"NbinsRMS"))->GetString().Atoi();
402 if (config->GetValue(
"XminRMS"))
fXminRMS = ((TObjString*)config->GetValue(
"XminRMS"))->GetString().Atof();
403 if (config->GetValue(
"XmaxRMS"))
fXmaxRMS = ((TObjString*)config->GetValue(
"XmaxRMS"))->GetString().Atof();
404 if (config->GetValue(
"PeakIntMinus"))
fPeakIntMinus = (Int_t)((TObjString*)config->GetValue(
"PeakIntMinus"))->GetString().Atof();
405 if (config->GetValue(
"PeakIntPlus"))
fPeakIntPlus = (Int_t)((TObjString*)config->GetValue(
"PeakIntPlus"))->GetString().Atof();
406 if (config->GetValue(
"IsZeroSuppressed"))
fIsZeroSuppressed = (Bool_t)((TObjString*)config->GetValue(
"IsZeroSuppressed"))->GetString().Atoi();
415 if (&source ==
this)
return *
this;
452 const Int_t icTimeBin,
453 const Float_t csignal)
459 if (icRow<0)
return 0;
460 if (icPad<0)
return 0;
461 if (icTimeBin<0)
return 0;
464 if ( icRow<0 || icPad<0 ){
465 AliWarning(
"Wrong Pad or Row number, skipping!");
503 Bool_t noPedestal = kTRUE;;
523 const Int_t kPedMax = 100;
531 UShort_t histo[kPedMax];
532 memset(histo,0,kPedMax*
sizeof(UShort_t));
536 if (padSignal<=0)
continue;
537 if (padSignal>max && i>10) {
540 if (padSignal>kPedMax-1)
continue;
541 histo[Int_t(padSignal+0.5)]++;
545 for (Int_t i=1; i<kPedMax; ++i){
546 if (count1<count0*0.5) median=i;
552 Float_t count=histo[median] ,mean=histo[median]*median, rms=histo[median]*median*median ;
554 for (Int_t idelta=1; idelta<10; ++idelta){
555 if (median-idelta<=0)
continue;
556 if (median+idelta>kPedMax)
continue;
557 if (count<part*count1){
558 count+=histo[median-idelta];
559 mean +=histo[median-idelta]*(median-idelta);
560 rms +=histo[median-idelta]*(median-idelta)*(median-idelta);
561 count+=histo[median+idelta];
562 mean +=histo[median+idelta]*(median+idelta);
563 rms +=histo[median+idelta]*(median+idelta)*(median+idelta);
570 rms = TMath::Sqrt(TMath::Abs(rms/count-mean*mean));
584 Float_t ceQmax =0, ceQsum=0, ceTime=0, ceRMS=0;
586 Float_t ceSumThreshold = 10.*TMath::Max(
fPadNoise,Float_t(1.));
587 Float_t ceMaxThreshold = 5.*TMath::Max(
fPadNoise,Float_t(1.));
597 if ( ceQmax<ceMaxThreshold )
return;
598 for (Int_t i=cemaxpos-kCemin; i<=cemaxpos+kCemax; ++i){
601 ceTime+=signal*(i+0.5);
602 ceRMS +=signal*(i+0.5)*(i+0.5);
607 if (ceQsum>ceSumThreshold) {
609 ceRMS = TMath::Sqrt(TMath::Abs(ceRMS/ceQsum-ceTime*ceTime));
632 if ( fCurrentSector<fParam->GetNInnerSector() ) norm*=3./2.;
656 Double_t meanT = param[1];
657 Double_t sigmaT = param[2];
677 (*streamer) <<
"PadSignals" <<
706 for ( Int_t iSec = 0; iSec<72; ++iSec ){
711 Float_t time = (*vTimes).GetMatrixArray()[iChannel];
713 GetHistoT0(iSec,kTRUE)->Fill( time-time0,iChannel );
725 Float_t q = (*
GetPadQEvent(iSec)).GetMatrixArray()[iChannel];
728 UInt_t channel=iChannel;
735 (*streamer) <<
"DataPad" <<
737 "Sector="<< sector <<
741 "PadSec="<< channel <<
756 Int_t nbinsY, Float_t ymin, Float_t ymax,
757 const Char_t *type, Bool_t force)
762 if ( !force || arr->UncheckedAt(sector) )
763 return (TH2S*)arr->UncheckedAt(sector);
767 TH2S* hist =
new TH2S(Form(
"hCalib%s%.2d",type,sector),Form(
"%s calibration histogram sector %.2d",type,sector),
770 hist->SetDirectory(0);
771 arr->AddAt(hist,sector);
819 if ( !force || arr->UncheckedAt(sector) )
820 return (TVectorF*)arr->UncheckedAt(sector);
823 arr->AddAt(vect,sector);
871 if ( !force || arr->UncheckedAt(sector) )
878 arr->AddAt(croc,sector);
936 for ( Int_t i=0; i<72; ++i ){
960 if ( pad == edge1 || pad == edge2 )
return kTRUE;
971 for (Int_t iSec=0; iSec<72; ++iSec){
978 TDirectory *dir = hRefQmerge->GetDirectory(); hRefQmerge->SetDirectory(0);
980 if ( hRefQ ) hRefQ->Add(hRefQmerge);
982 TH2S *hist =
new TH2S(*hRefQmerge);
983 hist->SetDirectory(0);
986 hRefQmerge->SetDirectory(dir);
989 TDirectory *dir = hRefT0merge->GetDirectory(); hRefT0merge->SetDirectory(0);
991 if ( hRefT0 ) hRefT0->Add(hRefT0merge);
993 TH2S *hist =
new TH2S(*hRefT0merge);
994 hist->SetDirectory(0);
997 hRefT0merge->SetDirectory(dir);
1000 TDirectory *dir = hRefRMSmerge->GetDirectory(); hRefRMSmerge->SetDirectory(0);
1002 if ( hRefRMS ) hRefRMS->Add(hRefRMSmerge);
1004 TH2S *hist =
new TH2S(*hRefRMSmerge);
1005 hist->SetDirectory(0);
1008 hRefRMSmerge->SetDirectory(dir);
1035 while ( (o=next()) ){
1059 for (Int_t iSec=0; iSec<72; ++iSec){
1061 if (!hT0 )
continue;
1065 Int_t offset = (nbinsT+2)*(iSec+1);
1068 for ( Int_t i=0; i<nbinsT; i++ ) entries+=(Int_t)arrP[i+1];
1069 hMeanTsec.Set(nbinsT+2,arrP);
1070 hMeanTsec.SetEntries(entries);
1085 Short_t *arrayhQ = hQ->GetArray();
1086 Short_t *arrayhT0 = hT0->GetArray();
1087 Short_t *arrayhRMS = hRMS->GetArray();
1098 for (UInt_t iChannel=0; iChannel<nChannels; ++iChannel){
1100 Float_t cogTime0 = -1000;
1101 Float_t cogQ = -1000;
1102 Float_t cogRMS = -1000;
1105 Int_t offsetQ = (
fNbinsQ+2)*(iChannel+1)+1;
1106 Int_t offsetT0 = (
fNbinsT0+2)*(iChannel+1)+1;
1107 Int_t offsetRMS = (
fNbinsRMS+2)*(iChannel+1)+1;
1130 rocT0->
SetValue(iChannel, cogTime0+meanTsec);
1131 rocRMS->
SetValue(iChannel, cogRMS);
1132 rocOut->
SetValue(iChannel, cogOut);
1135 if (TMath::Abs(cogTime0-
fXminT0)<1e-10){
1149 (*streamer) <<
"DataEnd" <<
1150 "Sector=" << iSec <<
1154 "PadSec=" << iChannel <<
1156 "T0=" << cogTime0 <<
1181 const Char_t *type[] = {
"T0",
"Q",
"RMS"};
1184 for (Int_t itype = 0; itype<3; ++itype){
1185 for (Int_t imode=0; imode<2; ++imode){
1186 Int_t icount = itype*2+imode;
1187 histArray->AddAt(
new TH1F(Form(
"hTestBinning%s%d",type[itype],imode),
1188 Form(
"Test Binning of '%s', mode - %d",type[itype],imode),
1197 for (Int_t itype = 0; itype<3; ++itype){
1198 for (Int_t iSec=0; iSec<72; ++iSec){
1200 if ( itype == 1 ) hRef =
GetHistoQ(iSec);
1202 if ( hRef == 0x0 )
continue;
1203 array = (hRef->GetArray());
1207 for (UInt_t iChannel=0; iChannel<nChannels; ++iChannel){
1209 Int_t offset = (fNbins[itype]+2)*(iChannel+1)+1;
1212 for (Int_t iBin=0; iBin<fNbins[itype]; ++iBin){
1213 if ( array[offset+iBin]>0 ) {
1215 if ( c1 && c2 ) nempty++;
1218 else if ( c1 ) c2 = 1;
1221 ((TH1F*)histArray->At(itype*2))->Fill(nfilled);
1223 ((TH1F*)histArray->At(itype*2+1))->Fill(iSec,nempty);
Float_t fXmaxRMS
xmax of T0 reference histogram
Float_t GetPadPitchLength(Int_t isector=0, Int_t padrow=0) const
Double_t GetL1PhaseTB() const
TObjArray * TestBinning()
Int_t fNbinsT0
Number of bins for T0 reference histogram.
UInt_t GetNPads(UInt_t sector, UInt_t row) const
AliTPCCalROC * GetCalRocRMS(Int_t sector, Bool_t force=kFALSE)
Bool_t fIsZeroSuppressed
if data is zero suppressed
Int_t fCurrentChannel
! current channel processed
AliTPCCalROC * GetCalROC(Int_t sector) const
AliTPCCalROC * GetCalRocOutliers(Int_t sector, Bool_t force=kFALSE)
AliTPCCalROC * fPedestalROC
! Pedestal Information for current ROC
TH2F * fHMeanTimeSector
Timing distribution per sector.
static void TruncatedMean(TH1F *his, TVectorD *param, Float_t down=0, Float_t up=1.0, Bool_t verbose=kFALSE)
Float_t fXmaxQ
xmax of T0 reference histogram
TVectorF * GetPadTimesEvent(Int_t sector, Bool_t force=kFALSE)
Int_t fNevents
Number of processed events.
Float_t fPadPedestal
! Pedestal Value of current pad
TH2S * GetHisto(Int_t sector, TObjArray *arr, Int_t nbinsY, Float_t ymin, Float_t ymax, const Char_t *type, Bool_t force)
Manager and of geomety classes for set: TPC.
TObjArray fHistoQArray
Calibration histograms for Charge distribution.
void MergeBase(const AliTPCCalibRawBase *calib)
Float_t GetValue(UInt_t row, UInt_t pad) const
Float_t fPadNoise
! Noise Value of current pad
Float_t fXminQ
xmin of T0 reference histogram
TObjArray fPadTimesArrayEvent
! Pad Times for the event, before mean Time0 corrections
TObjArray fPadPedestalArrayEvent
! Signal width for the event, only needed for debugging streamer
TH2S * GetHistoQ(Int_t sector, Bool_t force=kFALSE)
UInt_t GetNChannels(UInt_t sector) const
AliTPCCalPad * fPadNoiseTPC
! Pad noise Information whole TPC
Int_t fLastTimeBin
Last Time bin used for analysis.
Float_t GetPadPitchWidth(Int_t isector=0) const
Base class for the calibration algorithms using raw data as input.
AliTPCCalROC * fPadNoiseROC
! Pad noise Information for current ROC
AliTPCParam * fParam
! TPC information
TTreeSRedirector * GetDebugStreamer()
#define AliWarning(message)
Float_t fMaxPadSignal
! maximum bin of current pad
Implementation of the TPC pulser calibration.
AliTPCCalPad * fPedestalTPC
! Pedestal Information
TObjArray fCalRocArrayT0
Array of AliTPCCalROC class for Time0 calibration.
AliTPCROC * fROC
! ROC information
TVectorF fPadSignal
! signal of current Pad
Int_t fFirstTimeBin
First Time bin used for analysis.
Float_t fXminRMS
xmin of T0 reference histogram
AliTPCCalROC * GetCalRocQ(Int_t sector, Bool_t force=kFALSE)
Int_t fCurrentRow
! current row processed
const UInt_t * GetRowIndexes(UInt_t sector) const
AliTPCCalROC * GetCalRocT0(Int_t sector, Bool_t force=kFALSE)
void SetValue(UInt_t row, UInt_t pad, Float_t vd)
Int_t fLastSector
! Last sector processed
virtual Int_t Update(const Int_t isector, const Int_t iRow, const Int_t iPad, const Int_t iTimeBin, const Float_t signal)
TH2S * GetHistoT0(Int_t sector, Bool_t force=kFALSE)
Int_t fPeakIntMinus
Peak integral range for COG determination. Bins used before max bin.
Float_t fXmaxT0
xmax of T0 reference histogram
TObjArray fPadRMSArrayEvent
! Signal width for the event, only needed for debugging streamer
TPC calibration base class for one ROC.
void Merge(AliTPCCalibPulser *const sig)
TVectorF * GetPadRMSEvent(Int_t sector, Bool_t force=kFALSE)
AliTPCCalROC * GetCalRoc(Int_t sector, TObjArray *arr, Bool_t force) const
TVectorF * GetPadPedestalEvent(Int_t sector, Bool_t force=kFALSE)
static Float_t GetCOG(Short_t *arr, Int_t nBins, Float_t xMin, Float_t xMax, Float_t *rms=0, Float_t *sum=0)
virtual ~AliTPCCalibPulser()
TVectorF * GetPadQEvent(Int_t sector, Bool_t force=kFALSE)
TH2S * GetHistoRMS(Int_t sector, Bool_t force=kFALSE)
TVectorF fVTime0Offset
! Time0 Offset from preprocessing for each sector;
Int_t fNbinsRMS
Number of bins for T0 reference histogram.
TObjArray fCalRocArrayRMS
Array of AliTPCCalROC class for signal width calibration.
AliTPCCalibPulser & operator=(const AliTPCCalibPulser &source)
void FindPedestal(Float_t part=.6)
TObjArray fCalRocArrayQ
Array of AliTPCCalROC class for Charge calibration.
TVectorF fVTime0OffsetCounter
! Time0 Offset from preprocessing for each sector;
Int_t fPeakIntPlus
Peak integral range for COG determination. Bins used after max bin.
TObjArray fHistoT0Array
Calibration histograms for Time0 distribution.
Int_t GetStreamLevel() const
TVectorF fVMeanTimeSector
Mean time per sector from analysis of fHMeanTimeSector.
TVectorF * GetPadInfoEvent(Int_t sector, TObjArray *arr, Bool_t force=kFALSE)
Int_t fCurrentSector
! current sector processed
class TVectorT< Double_t > TVectorD
virtual void ResetEvent()
TObjArray fCalRocArrayOutliers
Array of AliTPCCalROC class for signal outliers.
Bool_t IsEdgePad(Int_t sector, Int_t row, Int_t pad)
Int_t fNbinsQ
Number of bins for T0 reference histogram.
TObjArray fPadQArrayEvent
! Charge for the event, only needed for debugging streamer
void FindPulserSignal(TVectorD ¶m, Float_t &qSum)
Float_t fXminT0
xmin of T0 reference histogram
class TMatrixT< Double_t > TMatrixD
AliTPCCalPad * fOutliers
! Outlier information. Those will not be used for calculating the T0
TObjArray fHistoRMSArray
Calibration histograms for signal width distribution.
Int_t fCurrentPad
! current pad processed
Int_t fMaxTimeBin
! time bin with maximum value