+// -*- mode: c++ -*-
/**************************************************************************
* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
* *
// Signal shape parameters
Int_t AliEMCALRawUtils::fgTimeBins = 256; // number of sampling bins of the raw RO signal (we typically use 15-50; theoretical max is 1k+)
Double_t AliEMCALRawUtils::fgTimeBinWidth = 100E-9 ; // each sample is 100 ns
-Double_t AliEMCALRawUtils::fgTimeTrigger = 0.6E-6 ; // 15 time bins ~ 1.5 musec
+Double_t AliEMCALRawUtils::fgTimeTrigger = 600E-9 ; // the time of the trigger as approximately seen in the data
// some digitization constants
Int_t AliEMCALRawUtils::fgThreshold = 1;
Int_t AliEMCALRawUtils::fgPedestalValue = 0; // pedestal value for digits2raw, default generate ZS data
Double_t AliEMCALRawUtils::fgFEENoise = 3.; // 3 ADC channels of noise (sampled)
-AliEMCALRawUtils::AliEMCALRawUtils(fitAlgorithm fitAlgo)
+AliEMCALRawUtils::AliEMCALRawUtils( Algo::fitAlgorithm fitAlgo)
: fHighLowGainFactor(0.), fOrder(0), fTau(0.), fNoiseThreshold(0),
fNPedSamples(0), fGeom(0), fOption(""),
fRemoveBadChannels(kTRUE),fFittingAlgorithm(0),
}
//____________________________________________________________________________
-AliEMCALRawUtils::AliEMCALRawUtils(AliEMCALGeometry *pGeometry, fitAlgorithm fitAlgo)
+AliEMCALRawUtils::AliEMCALRawUtils(AliEMCALGeometry *pGeometry, Algo::fitAlgorithm fitAlgo)
: fHighLowGainFactor(0.), fOrder(0), fTau(0.), fNoiseThreshold(0),
fNPedSamples(0), fGeom(pGeometry), fOption(""),
fRemoveBadChannels(kTRUE),fFittingAlgorithm(0),
//Which DDL?
Int_t iDDL = fgDDLPerSuperModule* nSM + iRCU;
- if (iDDL >= nDDL)
+ if (iDDL < 0 || iDDL >= nDDL){
Fatal("Digits2Raw()","Non-existent DDL board number: %d", iDDL);
-
- if (buffers[iDDL] == 0) {
- // open new file and write dummy header
- TString fileName = AliDAQ::DdlFileName("EMCAL",iDDL);
- //Select mapping file RCU0A, RCU0C, RCU1A, RCU1C
- Int_t iRCUside=iRCU+(nSM%2)*2;
- //iRCU=0 and even (0) SM -> RCU0A.data 0
- //iRCU=1 and even (0) SM -> RCU1A.data 1
- //iRCU=0 and odd (1) SM -> RCU0C.data 2
- //iRCU=1 and odd (1) SM -> RCU1C.data 3
- //cout<<" nSM "<<nSM<<"; iRCU "<<iRCU<<"; iRCUside "<<iRCUside<<endl;
- buffers[iDDL] = new AliAltroBuffer(fileName.Data(),fMapping[iRCUside]);
- buffers[iDDL]->WriteDataHeader(kTRUE, kFALSE); //Dummy;
- }
-
- // out of time range signal (?)
- if (digit->GetTimeR() > GetRawFormatTimeMax() ) {
- AliInfo("Signal is out of time range.\n");
- buffers[iDDL]->FillBuffer((Int_t)digit->GetAmplitude());
- buffers[iDDL]->FillBuffer(GetRawFormatTimeBins() ); // time bin
- buffers[iDDL]->FillBuffer(3); // bunch length
- buffers[iDDL]->WriteTrailer(3, ieta, iphi, nSM); // trailer
- // calculate the time response function
- } else {
- Bool_t lowgain = RawSampledResponse(digit->GetTimeR(), digit->GetAmplitude(), adcValuesHigh.GetArray(), adcValuesLow.GetArray()) ;
- if (lowgain)
- buffers[iDDL]->WriteChannel(ieta, iphi, 0, GetRawFormatTimeBins(), adcValuesLow.GetArray(), fgThreshold);
- else
- buffers[iDDL]->WriteChannel(ieta,iphi, 1, GetRawFormatTimeBins(), adcValuesHigh.GetArray(), fgThreshold);
}
+ else{
+ if (buffers[iDDL] == 0) {
+ // open new file and write dummy header
+ TString fileName = AliDAQ::DdlFileName("EMCAL",iDDL);
+ //Select mapping file RCU0A, RCU0C, RCU1A, RCU1C
+ Int_t iRCUside=iRCU+(nSM%2)*2;
+ //iRCU=0 and even (0) SM -> RCU0A.data 0
+ //iRCU=1 and even (0) SM -> RCU1A.data 1
+ //iRCU=0 and odd (1) SM -> RCU0C.data 2
+ //iRCU=1 and odd (1) SM -> RCU1C.data 3
+ //cout<<" nSM "<<nSM<<"; iRCU "<<iRCU<<"; iRCUside "<<iRCUside<<endl;
+ buffers[iDDL] = new AliAltroBuffer(fileName.Data(),fMapping[iRCUside]);
+ buffers[iDDL]->WriteDataHeader(kTRUE, kFALSE); //Dummy;
+ }
+
+ // out of time range signal (?)
+ if (digit->GetTimeR() > GetRawFormatTimeMax() ) {
+ AliInfo("Signal is out of time range.\n");
+ buffers[iDDL]->FillBuffer((Int_t)digit->GetAmplitude());
+ buffers[iDDL]->FillBuffer(GetRawFormatTimeBins() ); // time bin
+ buffers[iDDL]->FillBuffer(3); // bunch length
+ buffers[iDDL]->WriteTrailer(3, ieta, iphi, nSM); // trailer
+ // calculate the time response function
+ } else {
+ Bool_t lowgain = RawSampledResponse(digit->GetTimeR(), digit->GetAmplitude(), adcValuesHigh.GetArray(), adcValuesLow.GetArray()) ;
+ if (lowgain)
+ buffers[iDDL]->WriteChannel(ieta, iphi, 0, GetRawFormatTimeBins(), adcValuesLow.GetArray(), fgThreshold);
+ else
+ buffers[iDDL]->WriteChannel(ieta,iphi, 1, GetRawFormatTimeBins(), adcValuesHigh.GetArray(), fgThreshold);
+ }
+ }// iDDL under the limits
}//digit exists
}//Digit loop
while (in.NextBunch()) {
bunchlist.push_back( AliCaloBunchInfo(in.GetStartTimeBin(), in.GetBunchLength(), in.GetSignals() ) );
} // loop over bunches
-
-
- if ( caloFlag < 2 ){ // ALTRO
-
- Float_t time = 0;
- Float_t amp = 0;
- short timeEstimate = 0;
- Float_t ampEstimate = 0;
- Bool_t fitDone = kFALSE;
- Float_t chi2 = 0;
- Int_t ndf = 0;
-
- if ( fFittingAlgorithm == kFastFit || fFittingAlgorithm == kNeuralNet || fFittingAlgorithm == kLMS || fFittingAlgorithm == kPeakFinder || fFittingAlgorithm == kCrude) {
+ if (bunchlist.size() == 0) continue;
+ if ( caloFlag < 2 )
+ { // ALTRO
+ Float_t time = 0;
+ Float_t amp = 0;
+ short timeEstimate = 0;
+ Float_t ampEstimate = 0;
+ Bool_t fitDone = kFALSE;
+ Float_t chi2 = 0;
+ Int_t ndf = 0;
+
+ if ( fFittingAlgorithm == Algo::kFastFit || fFittingAlgorithm == Algo::kNeuralNet ||
+ fFittingAlgorithm == Algo::kLMS || fFittingAlgorithm == Algo::kPeakFinder ||
+ fFittingAlgorithm == Algo::kCrude) {
// all functionality to determine amp and time etc is encapsulated inside the Evaluate call for these methods
AliCaloFitResults fitResults = fRawAnalyzer->Evaluate( bunchlist, in.GetAltroCFG1(), in.GetAltroCFG2());
ampEstimate = fitResults.GetMaxSig();
chi2 = fitResults.GetChi2();
ndf = fitResults.GetNdf();
- if (fitResults.GetStatus() == AliCaloFitResults::kFitPar) {
+ if (fitResults.GetStatus() == Ret::kFitPar) {
fitDone = kTRUE;
}
}
time += timebinOffset;
timeEstimate += timebinOffset;
ndf = nsamples - 2;
- printf("time offset %d\n",timebinOffset);
}
} // ampEstimate check
} // method selection
- printf("b) amp %f, time %f, chi2 %f \n", amp,time, chi2 );
if ( fitDone ) { // brief sanity check of fit results
Float_t ampAsymm = (amp - ampEstimate)/(amp + ampEstimate);
// go from time-bin units to physical time fgtimetrigger
time = time * GetRawFormatTimeBinWidth(); // skip subtraction of fgTimeTrigger?
// subtract RCU L1 phase (L1Phase is in seconds) w.r.t. L0:
- printf("L1 PHASE %e \n",in.GetL1Phase());
time -= in.GetL1Phase();
AliDebug(2,Form("id %d lowGain %d amp %g", id, lowGain, amp));
// printf("Added tower: SM %d, row %d, column %d, amp %3.2f\n",in.GetModule(), in.GetRow(), in.GetColumn(),amp);
- printf("c) amp %f, time %e, chi2 %f \n", amp,time, chi2);
AddDigit(digitsArr, id, lowGain, amp, time, chi2, ndf);
}
Int_t nDigits = digitsArr->GetEntriesFast();
TIter nextdigit(digitsArr);
while ((digit = (AliEMCALDigit*) nextdigit())) {
- printf("TRIM: time %e, min %e, max %e\n",digit->GetTime(),fTimeMin, fTimeMax);
//Check if only LG existed, remove if so
if (digit->GetType() == AliEMCALDigit::kLGnoHG) {
fitDone = kFALSE;
switch(fFittingAlgorithm) {
- case kStandard:
+ case Algo::kStandard:
{
if (nsamples < 3) { return; } // nothing much to fit
//printf("Standard fitter \n");
- printf("---------------------------------\n");
// Create Graph to hold data we will fit
TGraph *gSig = new TGraph( nsamples);
for (int i=0; i<nsamples; i++) {
Int_t timebin = firstTimeBin + i;
gSig->SetPoint(i, timebin, fRawAnalyzer->GetReversed(timebin));
- if(fRawAnalyzer->GetReversed(timebin)>0.001)printf("signal %f, timebin %d\n",fRawAnalyzer->GetReversed(timebin),timebin);
}
TF1 * signalF = new TF1("signal", RawResponseFunction, 0, GetRawFormatTimeBins(), 5);
amp = signalF->GetParameter(0);
time = signalF->GetParameter(1);
chi2 = signalF->GetChisquare();
- printf("amp %f, time %f, chi2 %f \n", amp,time, chi2);
fitDone = kTRUE;
}
catch (const std::exception & e) {
break;
}//kStandard Fitter
//----------------------------
- case kLogFit:
+ case Algo::kLogFit:
{
if (nsamples < 3) { return; } // nothing much to fit
//printf("LogFit \n");
{
// for a start time dtime and an amplitude damp given by digit,
// calculates the raw sampled response AliEMCAL::RawResponseFunction
- printf("---------------------------------\n");
Bool_t lowGain = kFALSE ;
// A: par[0] // Amplitude = peak value
TF1 signalF("signal", RawResponseFunction, 0, GetRawFormatTimeBins(), 5);
signalF.SetParameter(0, damp) ;
- printf("amp %f, time %e, trigger time %e, bin %f\n",damp,dtime,fgTimeTrigger,(dtime + fgTimeTrigger)/fgTimeBinWidth);
signalF.SetParameter(1, (dtime + fgTimeTrigger)/fgTimeBinWidth) ;
signalF.SetParameter(2, fTau) ;
signalF.SetParameter(3, fOrder);
Double_t signal=0.0, noise=0.0;
for (Int_t iTime = 0; iTime < GetRawFormatTimeBins(); iTime++) {
signal = signalF.Eval(iTime) ;
- if(signal>0.001)printf("iTime %d, signal %f \n",iTime,signal);
// Next lines commeted for the moment but in principle it is not necessary to add
// extra noise since noise already added at the digits level.
adcL[iTime] = static_cast<Int_t>(signal + 0.5) ;
if ( adcL[iTime] > fgkRawSignalOverflow) // larger than 10 bits
adcL[iTime] = fgkRawSignalOverflow ;
-
- if(adcH[iTime] || adcL[iTime])printf("\t high gain %d, low gain %d, bool %d\n", adcH[iTime],adcL[iTime], lowGain);
-
+
}
return lowGain ;
f = RawResponseFunction(&x, par);
dy = y[i] - f;
chi2 += dy*dy;
- printf(" AliEMCALRawUtils::CalculateChi2 : %i : y %f -> f %f : dy %f \n", i, y[i], f, dy);
+ //printf(" AliEMCALRawUtils::CalculateChi2 : %i : y %f -> f %f : dy %f \n", i, y[i], f, dy);
}
if(sig>0.0) chi2 /= (sig*sig);
}
fFittingAlgorithm = fitAlgo;
if (fRawAnalyzer) delete fRawAnalyzer; // delete prev. analyzer if existed.
- if (fitAlgo == kFastFit) {
+ if (fitAlgo == Algo::kFastFit) {
fRawAnalyzer = new AliCaloRawAnalyzerFastFit();
}
- else if (fitAlgo == kNeuralNet) {
+ else if (fitAlgo == Algo::kNeuralNet) {
fRawAnalyzer = new AliCaloRawAnalyzerNN();
}
- else if (fitAlgo == kLMS) {
+ else if (fitAlgo == Algo::kLMS) {
fRawAnalyzer = new AliCaloRawAnalyzerLMS();
}
- else if (fitAlgo == kPeakFinder) {
+ else if (fitAlgo == Algo::kPeakFinder) {
fRawAnalyzer = new AliCaloRawAnalyzerPeakFinder();
}
- else if (fitAlgo == kCrude) {
+ else if (fitAlgo == Algo::kCrude) {
fRawAnalyzer = new AliCaloRawAnalyzerCrude();
}
else {
- fRawAnalyzer = new AliCaloRawAnalyzer();
+ // fRawAnalyzer = new AliCaloRawAnalyzer();
+ fRawAnalyzer = 0;
}
}