21 #include "AliAltroBuffer.h" 22 #include "AliRawReader.h" 23 #include "AliCaloRawStreamV3.h" 43 using namespace EMCAL;
59 fRemoveBadChannels(kFALSE),
60 fFittingAlgorithm(fitAlgo),
66 fTriggerRawDigitMaker(0x0)
72 if(!maps)
AliFatal(
"Cannot retrieve ALTRO mappings!!");
74 for(Int_t i = 0; i < 4; i++)
76 fMapping[i] = (AliAltroMapping*)maps->At(i);
89 AliDebug(1, Form(
"Using default geometry in raw reco"));
95 AliDebug(1, Form(
"Using default geometry in raw reco"));
123 TClonesArray* digits = loader->
Digits() ;
131 static const Int_t nDDL = 20*2;
133 AliAltroBuffer* buffers[nDDL];
134 for (Int_t i=0; i < nDDL; i++)
141 for (Int_t iDigit = 0; iDigit < digits->GetEntries(); iDigit++)
186 if ( 0<=iphi&&iphi< 8 ) iRCU=0;
187 else if ( 8<=iphi&&iphi<16 && 0<=ieta&&ieta<24 ) iRCU=0;
188 else if ( 8<=iphi&&iphi<16 && 24<=ieta&&ieta<48 ) iRCU=1;
189 else if ( 16<=iphi&&iphi<24 ) iRCU=1;
191 if (nSM%2==1) iRCU = 1 - iRCU;
194 Fatal(
"Digits2Raw()",
"Non-existent RCU/DDL number: %d", iRCU);
199 if (iDDL < 0 || iDDL >= nDDL)
201 Fatal(
"Digits2Raw()",
"Non-existent DDL board number: %d", iDDL);
205 if (buffers[iDDL] == 0)
210 Int_t iRCUside=iRCU+(nSM%2)*2;
215 buffers[iDDL] =
new AliAltroBuffer(fileName.Data(),
fMapping[iRCUside]);
216 buffers[iDDL]->WriteDataHeader(kTRUE, kFALSE);
222 AliInfo(
"Signal is out of time range.\n");
223 buffers[iDDL]->FillBuffer((Int_t)digit->
GetAmplitude());
224 buffers[iDDL]->FillBuffer(
TIMEBINS );
225 buffers[iDDL]->FillBuffer(3);
226 buffers[iDDL]->WriteTrailer(3, ieta, iphi, nSM);
232 adcValuesHigh.GetArray(), adcValuesLow.GetArray()) ;
245 for (Int_t i=0; i < nDDL; i++)
250 buffers[i]->WriteDataHeader(kFALSE, kFALSE);
262 Float_t amp, Float_t time, Float_t
chi2, Int_t ndf)
265 TIter nextdigit(digitsArr);
267 while (digit == 0 && (tmpdigit = (
AliEMCALDigit*) nextdigit()))
269 if (tmpdigit->GetId() == id) digit = tmpdigit;
283 Int_t idigit = digitsArr->GetEntries();
285 new((*digitsArr)[idigit])
AliEMCALDigit( -1, -1,
id, amp, time, type, idigit, chi2, ndf);
287 AliDebug(2,Form(
"Add digit Id %d for the first time, type %d",
id, type));
304 AliDebug(2,Form(
"Add LG digit ID %d for the second time, type %d", digit->
GetId(), digit->
GetType()));
317 AliDebug(2,Form(
"Add HG digit ID %d for the second time, type %d", digit->
GetId(), digit->
GetType()));
334 TClonesArray *digitsTRG, TClonesArray *trgData)
336 if ( digitsArr) digitsArr->Clear(
"C");
338 if (!digitsArr) { Error(
"Raw2Digits",
"no digits found !") ;
return ; }
340 if (!reader) { Error(
"Raw2Digits",
"no raw reader found !");
return ; }
344 AliCaloRawStreamV3 in(reader,
"EMCAL",
fMapping);
356 Float_t bcTimePhaseCorr = 0;
357 Int_t bcMod4 = (reader->GetBCID() % 4);
362 Int_t
runNumber = reader->GetRunNumber();
365 if ((runNumber > 130850 && runNumber < 200000) && (bcMod4==0 || bcMod4==1))
366 bcTimePhaseCorr = -1e-7;
370 while (in.NextChannel())
372 caloFlag = in.GetCaloFlag();
374 if ( caloFlag > 2 )
continue;
377 Int_t sm = in.GetModule() ;
378 Int_t row = in.GetRow () ;
379 Int_t column = in.GetColumn() ;
397 if ( caloFlag < 2 && fRemoveBadChannels && pedbadmap->IsBadChannel(sm, column, row) )
402 vector<AliCaloBunchInfo> bunchlist;
404 while (in.NextBunch())
406 bunchlist.push_back(
AliCaloBunchInfo(in.GetStartTimeBin(), in.GetBunchLength(), in.GetSignals() ) );
409 if (bunchlist.size() == 0)
continue;
417 lowGain = in.IsLowGain();
451 Int_t nDigits = digitsArr->GetEntriesFast();
453 TIter nextdigit(digitsArr);
459 AliDebug(1,Form(
"Remove digit with id %d, LGnoHG",digit->
GetId()));
460 digitsArr->Remove(digit);
464 digitsArr->Remove(digit);
469 digitsArr->Remove(digit);
479 digitsArr->Compress();
481 AliDebug(1,Form(
"N Digits before trimming : %d; after array compression %d",nDigits,digitsArr->GetEntriesFast()));
static const char * DdlFileName(const char *detectorName, Int_t ddlIndex)
static AliRunLoader * Instance()
provides access to EMCAL/DCAL STU DDL raw data.
virtual void Reset()
Reset.
void AddDigit(TClonesArray *digitsArr, Int_t id, Int_t lowGain, Float_t amp, Float_t time, Float_t chi2, Int_t ndf)
virtual void PostProcess()
Post process digits.
Bool_t fUseL1Phase
Use L1Phase time shift.
Int_t GetAbsCellIdFromCellIndexes(Int_t nSupMod, Int_t iphi, Int_t ieta) const
static Int_t GetFirstSTUDDL()
Float_t fTimeMin
Minimum threshold for the time of the signal.
void ShiftOnlineToOfflineCellIndexes(Int_t sm, Int_t &iphi, Int_t &ieta) const
Float_t GetTime(void) const
static const Char_t * GetDefaultGeometryName()
virtual ~AliEMCALRawUtils()
void SetNsampleCut(Int_t cut)
Float_t GetChi2(void) const
AliLoader * GetDetectorLoader(const char *detname)
AliEMCALRawUtils(Algo::fitAlgorithm fitAlgo=Algo::kStandard)
AliEMCALGeometry * fGeom
Geometry.
void SetOverflowCut(Int_t cut)
void SetAmpCut(Float_t cut)
void TrimDigits(TClonesArray *digitsArr)
TString fileName(const char *dir, int runNumber, const char *da, int i, const char *type)
Container class to hold results from fitting.
#define AliWarning(message)
Container of ALTRO information.
Give access to hits, digits, recpoints arrays and OCDB.
void GetCellPhiEtaIndexInSModule(Int_t nSupMod, Int_t nModule, Int_t nIphi, Int_t nIeta, Int_t &iphi, Int_t &ieta) const
static Int_t GetRawFormatThreshold()
void SetTime(Float_t time)
AliCaloRawAnalyzer * fRawAnalyzer
e.g. for sample selection for fits.
virtual void SetIO(AliRawReader *reader, AliCaloRawStreamV3 &in, AliEMCALTriggerSTURawStream &inSTU, TClonesArray *digits, TClonesArray *data)
Connect I/O.
void SetL1Phase(Double_t phase)
static AliCaloRawAnalyzer * CreateAnalyzer(const int algo)
void UnloadDigits() const
Int_t fNoiseThreshold
Threshold to consider signal or noise.
virtual void Add(const std::vector< AliCaloBunchInfo > &bunchlist)
Add bunch list of type AliCaloBunchInfo.
const double HGLGFACTOR
energy transion low/high gaing
Bool_t GetCellIndex(Int_t absId, Int_t &nSupMod, Int_t &nModule, Int_t &nIphi, Int_t &nIeta) const
AliAltroMapping * fMapping[4]
What is the array size?
virtual AliCaloFitResults Evaluate(const std::vector< AliCaloBunchInfo > &, UInt_t, UInt_t)=0
void SetFitArrayCut(Int_t cut)
virtual AliEMCALGeometry * GetGeometry() const
Base Class for EMCAL description.
pedestal/bad map monitoring and calibration tools
void SetIndexInList(Int_t val)
#define AliFatal(message)
void Raw2Digits(AliRawReader *reader, TClonesArray *digitsArr, const AliCaloCalibPedestal *pedbadmap, TClonesArray *digitsTRG=0x0, TClonesArray *trgData=0x0)
void SetFittingAlgorithm(Int_t val)
const double TIMEBINMAX
maximum bin in time sample
static Bool_t RawSampledResponse(Double_t dtime, Double_t damp, Int_t *adcH, Int_t *adcL, Int_t keyErr=0)
const int NRCUSPERMODULE
Number of RCUs per Module.
#define AliDebug(logLevel, message)
AliEMCALTriggerRawDigitMaker * fTriggerRawDigitMaker
Trigger raw digit info.
const int TIMEBINS
number of sampling bins of the raw RO signal (we typically use 15-50; max is 1k+) ...
AliDetector * GetDetector(const char *name) const
static AliEMCALGeometry * GetInstance()
Int_t LoadDigits(Option_t *opt="")
void ShiftOfflineToOnlineCellIndexes(Int_t sm, Int_t &iphi, Int_t &ieta) const
void SetIsZeroSuppressed(bool iszs=true)
Float_t GetAmplitude() const
fitAlgorithm
< fitting alorithms tag numbers
const int OVERFLOWCUT
sample overflow
EMCal trigger raw digits maker.
static const TObjArray * GetMappings()
Bool_t fUseFALTRO
Use FALTRO and pass it to the digits.
AliRun * GetAliRun() const
Float_t fTimeMax
Maximum threshold for the time of the signal.
void SetAmplitude(Float_t amp)