#include <TFile.h>
//AliRoot includes
+#include "AliLog.h"
#include "AliRawReader.h"
#include "AliRawReaderRoot.h"
#include "AliRawReaderDate.h"
fNbinsRMS(100),
fXminRMS(0.1),
fXmaxRMS(5.1),
+ fPeakMinus(2),
+ fPeakPlus(3),
+ fNoiseThresholdMax(5.),
+ fNoiseThresholdSum(8.),
+ fIsZeroSuppressed(kFALSE),
fLastSector(-1),
fROC(AliTPCROC::Instance()),
fMapping(NULL),
// AliTPCSignal default constructor
//
// fHTime0 = new TH1F("hTime0Event","hTime0Event",(fLastTimeBin-fFirstTimeBin)*10,fFirstTimeBin,fLastTimeBin);
+ fParam->Update();
}
//_____________________________________________________________________
AliTPCCalibCE::AliTPCCalibCE(const AliTPCCalibCE &sig) :
fNbinsRMS(sig.fNbinsRMS),
fXminRMS(sig.fXminRMS),
fXmaxRMS(sig.fXmaxRMS),
+ fPeakMinus(sig.fPeakMinus),
+ fPeakPlus(sig.fPeakPlus),
+ fNoiseThresholdMax(sig.fNoiseThresholdMax),
+ fNoiseThresholdSum(sig.fNoiseThresholdSum),
+ fIsZeroSuppressed(sig.fIsZeroSuppressed),
fLastSector(-1),
fROC(AliTPCROC::Instance()),
fMapping(NULL),
fVEventTime.SetElements(sig.fVEventTime.GetMatrixArray());
fVEventNumber.SetElements(sig.fVEventNumber.GetMatrixArray());
+ fParam->Update();
}
//_____________________________________________________________________
AliTPCCalibCE& AliTPCCalibCE::operator = (const AliTPCCalibCE &source)
// assumes that it is looped over consecutive time bins of one pad
//
+ //temp
+// if (icsector<36) return 0;
+// if (icsector%36>17) return 0;
+
+
if (icRow<0) return 0;
if (icPad<0) return 0;
if (icTimeBin<0) return 0;
}
if ( fPedestalROC&&fPadNoiseROC ){
- fPadPedestal = fPedestalROC->GetValue(fCurrentChannel);
+ fPadPedestal = fPedestalROC->GetValue(fCurrentChannel)*fIsZeroSuppressed;
fPadNoise = fPadNoiseROC->GetValue(fCurrentChannel);
noPedestal = kFALSE;
}
//if we are not running with pedestal database, or for the current sector there is no information
//available, calculate the pedestal and noise on the fly
if ( noPedestal ) {
+ fPadPedestal = 0;
+ fPadNoise = 0;
+ if ( fIsZeroSuppressed ) return;
const Int_t kPedMax = 100; //maximum pedestal value
Float_t max = 0;
Float_t maxPos = 0;
rms +=histo[median+idelta]*(median+idelta)*(median+idelta);
}
}
- fPadPedestal = 0;
- fPadNoise = 0;
if ( count > 0 ) {
mean/=count;
rms = TMath::Sqrt(TMath::Abs(rms/count-mean*mean));
Float_t ceQmax =0, ceQsum=0, ceTime=0, ceRMS=0;
Int_t cemaxpos = 0;
- Float_t ceSumThreshold = 8.*fPadNoise; // threshold for the signal sum
+ Float_t ceSumThreshold = fNoiseThresholdSum*fPadNoise; // threshold for the signal sum
const Int_t kCemin = 4; // range for the analysis of the ce signal +- channels from the peak
const Int_t kCemax = 7;
//
// Find local maxima on the pad signal and Histogram them
//
- Float_t ceThreshold = 5.*TMath::Max(fPadNoise,Float_t(1.)); // threshold for the signal
+ Float_t ceThreshold = fNoiseThresholdMax*TMath::Max(fPadNoise,Float_t(1.)); // threshold for the signal
Int_t count = 0;
- Int_t tminus = 2;
- Int_t tplus = 3;
- for (Int_t i=fLastTimeBin-tplus-1; i>=fFirstTimeBin+tminus; --i){
- if ( (fPadSignal[i]-fPadPedestal)>ceThreshold && IsPeak(i,tminus,tplus) ){
+// Int_t tminus = 2;
+// Int_t tplus = 3;
+ for (Int_t i=fLastTimeBin-fPeakPlus-1; i>=fFirstTimeBin+fPeakMinus; --i){
+ if ( (fPadSignal[i]-fPadPedestal)>ceThreshold && IsPeak(i,fPeakMinus,fPeakPlus) ){
if (count<maxima.GetNrows()){
maxima.GetMatrixArray()[count++]=i;
GetHistoTmean(fCurrentSector,kTRUE)->Fill(i);
FindLocalMaxima(maxima);
if ( (fNevents == 0) || (fOldRunNumber!=fRunNumber) ) return; // return because we don't have Time0 info for the CE yet
+ if ( !GetTMeanEvents(fCurrentSector) ) return; //return if we don't have time 0 info, eg if only one side has laser
+
TVectorD param(3);
Float_t qSum;
FindCESignal(param, qSum, maxima);
//check if last pad has allready been processed, if not do so
if ( fMaxTimeBin>-1 ) ProcessPad();
+// AliDebug(5,
+
TVectorD param(3);
TMatrixD dummy(3,3);
// TVectorF vMeanTime(72);
TH1S *hMeanT = GetHistoTmean(iSec); //histogram with local maxima position information
if ( !hMeanT ) continue;
//continue if not enough data is filled in the meanT histogram. This is the case if we do not have a laser event.
- if ( hMeanT->GetEntries() < fROC->GetNChannels(iSec)*2/3 ){
- hMeanT->Reset();
+ if ( hMeanT->GetEntries() < fROC->GetNChannels(iSec)*2/3 ){
+ hMeanT->Reset();
+ AliDebug(3,Form("Skipping sec. '%02d': Not enough statistics\n",iSec));
continue;
}
ResetEvent();
Bool_t withInput = kFALSE;
while ( rawStreamFast->NextDDL() ){
- while ( rawStreamFast->NextChannel() ){
- Int_t isector = rawStreamFast->GetSector(); // current sector
- Int_t iRow = rawStreamFast->GetRow(); // current row
- Int_t iPad = rawStreamFast->GetPad(); // current pad
-
- while ( rawStreamFast->NextBunch() ){
- Int_t startTbin = (Int_t)rawStreamFast->GetStartTimeBin();
- Int_t endTbin = (Int_t)rawStreamFast->GetEndTimeBin();
- for (Int_t iTimeBin = startTbin; iTimeBin < endTbin; iTimeBin++){
- Float_t signal=(Float_t)rawStreamFast->GetSignals()[iTimeBin-startTbin];
- Update(isector,iRow,iPad,iTimeBin+1,signal);
- withInput = kTRUE;
- }
- }
+ while ( rawStreamFast->NextChannel() ){
+ Int_t isector = rawStreamFast->GetSector(); // current sector
+ Int_t iRow = rawStreamFast->GetRow(); // current row
+ Int_t iPad = rawStreamFast->GetPad(); // current pad
+
+ while ( rawStreamFast->NextBunch() ){
+ Int_t startTbin = (Int_t)rawStreamFast->GetStartTimeBin();
+ Int_t endTbin = (Int_t)rawStreamFast->GetEndTimeBin();
+ for (Int_t iTimeBin = startTbin; iTimeBin < endTbin; iTimeBin++){
+ Float_t signal=(Float_t)rawStreamFast->GetSignals()[iTimeBin-startTbin];
+ Update(isector,iRow,iPad,iTimeBin+1,signal);
+ withInput = kTRUE;
+ }
}
+ }
}
if (withInput){
- EndEvent();
+ EndEvent();
}
return withInput;
}
const Float_t GetMeanQrms() {return fMeanQrms;}
const Float_t GetMeanRMSrms() {return fMeanRMSrms;}
+ const Int_t GetPeakDetectionMinus(){return fPeakMinus;}
+ const Int_t GetPeakDetectionPlus(){return fPeakPlus;}
+ const Float_t GetNnoiseThresholdMax() {return fNoiseThresholdMax;}
+ const Float_t GetNnoiseThresholdSum() {return fNoiseThresholdSum;}
+
TH1S* GetHistoTmean(Int_t sector, Bool_t force=kFALSE); // get refernce histogram
//needed here to merge ClibCE objects
void SetRangeRefT0 (Int_t nBins, Float_t xMin, Float_t xMax){ fNbinsT0 = nBins; fXminT0 = xMin; fXmaxT0 = xMax; } //Set range for T0 reference histograms
void SetRangeRefRMS(Int_t nBins, Float_t xMin, Float_t xMax){ fNbinsRMS = nBins; fXminRMS = xMin; fXmaxRMS = xMax; } //Set range for T0 reference histograms
//
+ void SetRangePeakDetection(Int_t minus, Int_t plus) { fPeakMinus=minus; fPeakPlus=plus;}
+ void SetNnoiseThresholdMax(Float_t n) {fNoiseThresholdMax=n;}
+ void SetNnoiseThresholdSum(Float_t n) {fNoiseThresholdSum=n;}
+ //
void SetTimeStampEvent(Double_t timestamp){ fTimeStamp = timestamp; }
void SetRunNumber(Double_t eventnumber){ fRunNumber = eventnumber; }
void SetPedestalDatabase(AliTPCCalPad *pedestalTPC, AliTPCCalPad *padNoiseTPC) {fPedestalTPC = pedestalTPC; fPadNoiseTPC = padNoiseTPC;}
+ void SetIsZeroSuppressed(Bool_t zs=kTRUE) { fIsZeroSuppressed=zs; }
+
Int_t GetFirstTimeBin() const { return fFirstTimeBin; }
Int_t GetLastTimeBin() const { return fLastTimeBin; }
Int_t GetNeventsProcessed() const { return fNevents; }
+ Bool_t GetIsZeroSuppressed() const { return fIsZeroSuppressed; }
+
+
void Merge(AliTPCCalibCE *ce);
TGraph *MakeGraphTimeCE(Int_t sector, Int_t xVariable=0, Int_t fitType=0, Int_t fitParameter=0);
Int_t fNbinsRMS; // Number of bins for T0 reference histogram
Float_t fXminRMS; // xmin of T0 reference histogram
Float_t fXmaxRMS; // xmax of T0 reference histogram
+ Int_t fPeakMinus; // Consecutive timebins on rising edge to be regarded as a signal
+ Int_t fPeakPlus; // Consecutive timebins on falling edge to be regarded as a signal
+ Float_t fNoiseThresholdMax; // Analysis Treshold for signal finding: Max>fNoiseThresholdMax*PadNoise
+ Float_t fNoiseThresholdSum; // Analysis Treshold for signal finding: Sum>fNoiseThresholdSum*PadNoise
+
+ Bool_t fIsZeroSuppressed; // If data is Zero Suppressed -> Don't subtrakt pedestals!
Int_t fLastSector; //! Last sector processed
TVectorF* GetPadRMSEvent(Int_t sector, Bool_t force=kFALSE);
TVectorF* GetPadPedestalEvent(Int_t sector, Bool_t force=kFALSE);
- ClassDef(AliTPCCalibCE,6) //Implementation of the TPC Central Electrode calibration
+ ClassDef(AliTPCCalibCE,7) //Implementation of the TPC Central Electrode calibration
};
fNbinsRMS(100),
fXminRMS(0.1),
fXmaxRMS(5.1),
+ fIsZeroSuppressed(kFALSE),
fLastSector(-1),
fROC(AliTPCROC::Instance()),
fMapping(NULL),
// AliTPCSignal default constructor
//
+ fParam->Update();
}
//_____________________________________________________________________
AliTPCCalibPulser::AliTPCCalibPulser(const AliTPCCalibPulser &sig) :
fNbinsRMS(sig.fNbinsRMS),
fXminRMS(sig.fXminRMS),
fXmaxRMS(sig.fXmaxRMS),
+ fIsZeroSuppressed(sig.fIsZeroSuppressed),
fLastSector(-1),
fROC(AliTPCROC::Instance()),
fMapping(NULL),
}
}
+ fParam->Update();
}
//_____________________________________________________________________
AliTPCCalibPulser& AliTPCCalibPulser::operator = (const AliTPCCalibPulser &source)
fPadNoise = rms;
}
}
+ fPadPedestal*=(Float_t)(!fIsZeroSuppressed);
}
//_____________________________________________________________________
void AliTPCCalibPulser::FindPulserSignal(TVectorD ¶m, Float_t &qSum)
// Event Processing loop - AliTPCRawStream
//
ResetEvent();
-
Bool_t withInput = kFALSE;
-
while ( rawStreamFast->NextDDL() ){
- while ( rawStreamFast->NextChannel() ){
- Int_t isector = rawStreamFast->GetSector(); // current sector
- Int_t iRow = rawStreamFast->GetRow(); // current row
- Int_t iPad = rawStreamFast->GetPad(); // current pad
-
- while ( rawStreamFast->NextBunch() ){
- Int_t startTbin = (Int_t)rawStreamFast->GetStartTimeBin();
- Int_t endTbin = (Int_t)rawStreamFast->GetEndTimeBin();
- for (Int_t iTimeBin = startTbin; iTimeBin < endTbin; iTimeBin++){
- Float_t signal=(Float_t)rawStreamFast->GetSignals()[iTimeBin-startTbin];
- Update(isector,iRow,iPad,iTimeBin+1,signal);
- withInput = kTRUE;
- }
- }
+ while ( rawStreamFast->NextChannel() ){
+ Int_t isector = rawStreamFast->GetSector(); // current sector
+ Int_t iRow = rawStreamFast->GetRow(); // current row
+ Int_t iPad = rawStreamFast->GetPad(); // current pad
+
+ while ( rawStreamFast->NextBunch() ){
+ Int_t startTbin = (Int_t)rawStreamFast->GetStartTimeBin();
+ Int_t endTbin = (Int_t)rawStreamFast->GetEndTimeBin();
+ for (Int_t iTimeBin = startTbin; iTimeBin < endTbin; iTimeBin++){
+ Float_t signal=(Float_t)rawStreamFast->GetSignals()[iTimeBin-startTbin];
+ Update(isector,iRow,iPad,iTimeBin+1,signal);
+ withInput = kTRUE;
+ }
}
+ }
}
if (withInput){
- EndEvent();
+ EndEvent();
}
return withInput;
}
void SetDebugLevel(Short_t debug=1){ fDebugLevel = debug;}
+ void SetIsZeroSuppressed(Bool_t zs=kTRUE){ fIsZeroSuppressed=zs;}
+
void SetPedestalDatabase(AliTPCCalPad *pedestalTPC, AliTPCCalPad *padNoiseTPC) {fPedestalTPC = pedestalTPC; fPadNoiseTPC = padNoiseTPC;}
void SetOutliers(AliTPCCalPad *outliers) {fOutliers = outliers;}
Int_t GetFirstTimeBin() const { return fFirstTimeBin; }
Int_t GetLastTimeBin() const { return fLastTimeBin; }
+ Bool_t GetIsZeroSupperssed() const { return fIsZeroSuppressed; }
+
void Merge(AliTPCCalibPulser *sig);
void DumpToFile(const Char_t *filename, const Char_t *dir="", Bool_t append=kFALSE);
Float_t fXminRMS; // xmin of T0 reference histogram
Float_t fXmaxRMS; // xmax of T0 reference histogram
+ Bool_t fIsZeroSuppressed; // if data is zero suppressed
+
Int_t fLastSector; //! Last sector processed
TVectorF* GetPadPedestalEvent(Int_t sector, Bool_t force=kFALSE);
- ClassDef(AliTPCCalibPulser,2) //Implementation of the TPC pulser calibration
+ ClassDef(AliTPCCalibPulser,3) //Implementation of the TPC pulser calibration
};
eventPtr = dateform->GetFirstDataPointer();
eventPtrUI = (UInt_t *) eventPtr;
- Int_t payload = dateform->GetPayloadSize();
+ Int_t payload = dateform->GetPayloadSize(); // 40Bit words
if(fVerb)DumpHeader(dateform);
if(fVerb) cout << "Check sector and fEqId " << endl;
if(CheckEqId(secid,fEqId))
{
if(fVerb) cout << " init altro " << endl;
- AliTPCMonitorAltro* altro = new AliTPCMonitorAltro((UInt_t *)eventPtrUI,(payload/4),1);
+ AliTPCMonitorAltro* altro = new AliTPCMonitorAltro((UInt_t *)eventPtrUI,(payload/4),1); //hier
altro->SetWrite10Bit(GetWrite10Bit());
altro->SetActFilename(GetFile());
if(fVerb) cout << " allocated 10bit " << endl;
Double_t hrms = 0.0;
Double_t hmean = 0.0;
Int_t supnextpos = 0;
- TH1D* hbase = new TH1D("hbase","hbase",GetTimeBins(),0.5,(GetTimeBins()+0.5));
+// TH1D* hbase = new TH1D("hbase","hbase",GetTimeBins(),0.5,(GetTimeBins()+0.5));
while(lastpos>0)
{
fPad[fChannelIter][0] = nextHwAddress ;
if(fPadMapHw[nextHwAddress]!=-1 )
- {
+ {
+ return;
//Int_t hw_before1 = fPad[fChannelIter-2][0];
//Int_t hw_before2 = fPad[fChannelIter-3][0];
sum = 0.0;
sumn = 0;
- hbase->Reset();
+// hbase->Reset();
for(Int_t iterwords = 0 ; iterwords< nwords ; iterwords++)
{
samplebins = 0;
timestamp = entries[blockpos-iterwords-1];
iterwords++;
+ sampleiter-=2;
}
else
{
ntime = timestamp-samplebins;
adc = entries[blockpos-iterwords];
fPad[fChannelIter][ntime] = adc;
- if( (adc!=0) && (ntime>=GetRangeBaseMin() ) && (ntime<GetRangeBaseMax() )) {hbase->Fill(adc) ;}
+// if( (adc!=0) && (ntime>=GetRangeBaseMin() ) && (ntime<GetRangeBaseMax() )) {hbase->Fill(adc) ;}
if( (adc>max) && (ntime>=GetRangeMaxAdcMin()) && (ntime<GetRangeMaxAdcMax() )) {max = adc;maxx = ntime ;}
if( (ntime>=GetRangeSumMin()) && (ntime<GetRangeSumMax() )) {sum+=adc; sumn++;}
samplebins++;
+ sampleiter--;
}
}
- hmean = hbase->GetMean();
- hbase->GetXaxis()->SetRangeUser(hmean- hmean/3 , hmean + hmean/3);
- hmean = hbase->GetMean();
- hrms = hbase->GetRMS();
+// hmean = hbase->GetMean();
+// hbase->GetXaxis()->SetRangeUser(hmean- hmean/3 , hmean + hmean/3);
+// hmean = hbase->GetMean();
+// hrms = hbase->GetRMS();
if( GetPedestals()==1) fHistAddrMaxAdc->SetBinContent( nextHwAddress,max- hmean);
else fHistAddrMaxAdc->SetBinContent( nextHwAddress,max );
fChannelIter++;
if(nextpos<0) { AliError("Error : next pos < 0 "); break ;}
}
- delete hbase;
+// delete hbase;
return ;
}
Long64_t* Get40BitArray();
Short_t *Get10BitArray();
- Int_t Get40BitArraySize() const { return fmemory[fsize-1];}
- Int_t Get10BitArraySize() const { return fmemory[fsize-1]*4;}
+ Int_t Get40BitArraySize() const { return fmemory[fsize-GetRCUTrailerSize()];} //hier ändern
+ Int_t Get10BitArraySize() const { return fmemory[fsize-GetRCUTrailerSize()]*4;} //number of 10 bit words from trailer
Char_t* GetActFileName() const { return ffilename;}
static Int_t GetHwMaskFEC() { return fgkHwMaskFEC;}
Int_t GetTrailerBlockPos() const { return fTrailerBlockPos ;}
Int_t GetTrailerPos() const { return fTrailerPos ;}
+ Int_t GetRCUTrailerSize() const { Int_t ts=(fmemory[fsize-1]>>16==0xaaaa)*(fmemory[fsize-1]&0x3F); return (ts>0)?ts:1;}
+
void SetDataOffset(Int_t val){ foffset =val ;}
void SetWrite10Bit(Int_t wr) { fwrite10bit =wr ;}
Int_t fTrailerDataPos; // from Trailer: position of first adc value
Int_t fTrailerBlockPos; // from Trailer: number of 40 bit words for channel
Int_t fTrailerPos; // trailer position
-
+
Int_t fNextPos; // position of next trailer
Char_t* ffilename; // name of processed file