rdig->GetMaximum(a, t);
rdig->GetL0Times(times);
-
- trgESD->Add(px, py, a, t, times, rdig->GetNL0Times(), rdig->GetL1TimeSum());
+
+ trgESD->Add(px, py, a, t, times, rdig->GetNL0Times(), rdig->GetL1TimeSum(), rdig->GetTriggerBits());
}
}
trgESD->SetL1Threshold(0, fTriggerData->GetL1GammaThreshold());
trgESD->SetL1Threshold(1, fTriggerData->GetL1JetThreshold() );
-
- for (Int_t i = 0; i < kTriggerTypeEnd; i++)
- {
- for (Int_t j = 0; j < 2; j++)
- {
- TClonesArray* patches = fTriggerData->GetPatches((TriggerType_t)i, j);
-
- TIter NextPatch(patches);
- while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)NextPatch())
- {
- TVector2 pos; p->Position(pos);
- trgESD->SetTriggerBits((Int_t) pos.X(), (Int_t) pos.Y(), i, j);
- }
- }
- }
}
// Resetting
}
//_______________
-void AliEMCALTriggerBoard::SlidingWindow(TriggerType_t /*type*/, Int_t thres, Int_t time)
+void AliEMCALTriggerBoard::SlidingWindow(TriggerType_t type, Int_t thres, Int_t time)
{
//
Int_t ipatch = 0;
}
}
+ if ( type == kL1Jet ) sum /= 4; // truncate patch sum for jet case
+
if ( sum > thres )
{
- //if ( type == kJet ) sum /= 4; // truncate patch sum for jet case
-
new((*fPatches)[fPatches->GetLast()+1])
AliEMCALTriggerPatch(int(i/fSubRegionSize->X()), int(j/fSubRegionSize->Y()), int(sum), time);
}
#include "AliEMCALTriggerData.h"
#include "AliEMCALTriggerPatch.h"
#include "AliLog.h"
+#include "TIterator.h"
#include "Riostream.h"
ClassImp(AliEMCALTriggerData)
void AliEMCALTriggerData::Scan() const
{
//
+ TIterator* nP;
+
printf("L0:\n");
- printf("\tFound (%2d , %2d) patches\n", fL0Patches[0]->GetEntriesFast(), fL0Patches[1]->GetEntriesFast());
+ printf("\tFound (%2d,%2d) patches\n", fL0Patches[1]->GetEntriesFast(), fL0Patches[0]->GetEntriesFast());
+ printf("\tRAW:\n");
+ nP = fL0Patches[1]->MakeIterator();
+ while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)nP->Next()) {printf("\t"); p->Print("");}
+ printf("\tREC:\n");
+ nP = fL0Patches[0]->MakeIterator();
+ while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)nP->Next()) {printf("\t"); p->Print("");}
printf("L1:\n");
- printf("\tFound (%4d,%4d) gamma patches\n",fL1GammaPatches[0]->GetEntriesFast(), fL1GammaPatches[1]->GetEntriesFast());
- printf("\tFound (%4d,%4d) jet patches\n",fL1JetPatches[0]->GetEntriesFast(), fL1JetPatches[1]->GetEntriesFast());
+ printf("\tFound (%4d,%4d) gamma patches\n",fL1GammaPatches[1]->GetEntriesFast(), fL1GammaPatches[0]->GetEntriesFast());
+ printf("\tRAW:\n");
+ nP = fL1GammaPatches[1]->MakeIterator();
+ while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)nP->Next()) {printf("\t"); p->Print("");}
+ printf("\tREC:\n");
+ nP = fL1GammaPatches[0]->MakeIterator();
+ while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)nP->Next()) {printf("\t"); p->Print("");}
+ printf("\tFound (%4d,%4d) jet patches\n",fL1JetPatches[1]->GetEntriesFast(), fL1JetPatches[0]->GetEntriesFast());
+ printf("\tRAW:\n");
+ nP = fL1JetPatches[1]->MakeIterator();
+ while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)nP->Next()) {printf("\t"); p->Print("");}
+ printf("\tREC:\n");
+ nP = fL1JetPatches[0]->MakeIterator();
+ while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)nP->Next()) {printf("\t"); p->Print("");}
}
//_____________
&&
geom->GetPositionInEMCALFromAbsFastORIndex(id, px, py)) p->SetPosition(px, py);
- if (!data->GetMode())
+ if (!data->GetMode()) // Simulation
{
Int_t peaks = p->Peaks();
+ Int_t pos;
+ AliEMCALTriggerRawDigit* dig = 0x0;
+
for (Int_t j = 0; j < sizeX * sizeY; j++)
{
if (peaks & (1 << j))
{
-
- Int_t pos = posMap[px + j % sizeX][py + j / sizeX];
-
-// cout << "px: " << px << " py: " << py << " j: " << j << " mod: " << j%sizeX << " ratio: " << j / sizeX << " pos: " << pos << endl;
-
- AliEMCALTriggerRawDigit* dig = 0x0;
+ pos = posMap[px + j % sizeX][py + j / sizeX];
if (pos == -1)
{
+ // Add a new digit
new((*digits)[digits->GetEntriesFast()]) AliEMCALTriggerRawDigit(id, 0x0, 0);
dig = (AliEMCALTriggerRawDigit*)digits->At(digits->GetEntriesFast() - 1);
dig->SetL0Time(p->Time());
}
- }
+ }
+
+ pos = posMap[px][py];
+
+ if (pos == -1)
+ {
+ // Add a new digit
+ new((*digits)[digits->GetEntriesFast()]) AliEMCALTriggerRawDigit(id, 0x0, 0);
+
+ dig = (AliEMCALTriggerRawDigit*)digits->At(digits->GetEntriesFast() - 1);
+ }
+ else
+ {
+ dig = (AliEMCALTriggerRawDigit*)digits->At(pos);
+ }
+
+ dig->SetTriggerBit(kL0,0);
}
}
data->SetL0Trigger(0, i, 1);
-
- data->SetPatches(kL0, 0, iTRU->Patches());
}
else
data->SetL0Trigger(0, i, 0);
fSTU->L1(kL1Gamma);
- data->SetPatches(kL1Gamma, 0, fSTU->Patches());
+ Int_t id, px, py;
+ AliEMCALTriggerRawDigit* dig = 0x0;
+
+ TIterator* nP = 0x0;
+
+ nP = (fSTU->Patches()).MakeIterator();
+
+ while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)nP->Next())
+ {
+ p->Position(px, py);
+
+ if (geom->GetAbsFastORIndexFromPositionInEMCAL(px, py, id))
+ {
+ if (posMap[px][py] == -1)
+ {
+ // Add a new digit
+ new((*digits)[digits->GetEntriesFast()]) AliEMCALTriggerRawDigit(id, 0x0, 0);
+
+ dig = (AliEMCALTriggerRawDigit*)digits->At(digits->GetEntriesFast() - 1);
+ }
+ else
+ {
+ dig = (AliEMCALTriggerRawDigit*)digits->At(posMap[px][py]);
+ }
+
+ dig->SetTriggerBit(kL1Gamma,0);
+ }
+ }
fSTU->Reset();
fSTU->L1(kL1Jet);
- data->SetPatches(kL1Jet, 0, fSTU->Patches());
+ nP = (fSTU->Patches()).MakeIterator();
+
+ while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)nP->Next())
+ {
+ p->Position(px, py);
+
+ px *= (Int_t)((fSTU->SubRegionSize())->X());
+
+ py *= (Int_t)((fSTU->SubRegionSize())->Y());
+
+ if (geom->GetAbsFastORIndexFromPositionInEMCAL(px, py, id))
+ {
+ if (posMap[px][py] == -1)
+ {
+ // Add a new digit
+ new((*digits)[digits->GetEntriesFast()]) AliEMCALTriggerRawDigit(id, 0x0, 0);
+
+ dig = (AliEMCALTriggerRawDigit*)digits->At(digits->GetEntriesFast() - 1);
+ }
+ else
+ {
+ dig = (AliEMCALTriggerRawDigit*)digits->At(posMap[px][py]);
+ }
+
+ dig->SetTriggerBit(kL1Jet,0);
+ }
+ }
Int_t** reg = fSTU->Region();
{
if (reg[i][j])
{
- Int_t id;
if (geom->GetAbsFastORIndexFromPositionInEMCAL(i, j, id))
{
- AliEMCALTriggerRawDigit* dig = 0x0;
-
if (posMap[i][j] == -1)
{
// Add a new digit with L1 time sum
//____________________________________________________________________________
AliEMCALTriggerRawDigit::AliEMCALTriggerRawDigit() : AliEMCALRawDigit(),
-fL0Trigger(0),
+fTriggerBits(0),
fNL0Times(0),
fL0Times(),
fL1TimeSum(-1)
//____________________________________________________________________________
AliEMCALTriggerRawDigit::AliEMCALTriggerRawDigit(Int_t id, Int_t timeSamples[], Int_t nSamples) : AliEMCALRawDigit(id, timeSamples, nSamples),
-fL0Trigger(0),
+fTriggerBits(0),
fNL0Times(0),
fL0Times(),
fL1TimeSum(-1)
return value;
}
+//____________________________________________________________________________
+Int_t AliEMCALTriggerRawDigit::GetTriggerBit(const TriggerType_t type, const Int_t mode) const
+{
+ //
+ Int_t shift = kTriggerTypeEnd * mode;
+ Int_t mask = 1 << type;
+
+ return ((fTriggerBits >> shift) & mask);
+}
+
//____________________________________________________________________________
void AliEMCALTriggerRawDigit::Print(const Option_t* /*opt*/) const
{
printf("| (%d,%d) ",timeBin,amp);
}
printf("\n");
- printf("| L0: %4d / %d Time(s): \n",fL0Trigger,fNL0Times);
+ printf("| L0: (%d,%d) / %d Time(s): \n",GetTriggerBit(kL0,1),GetTriggerBit(kL0,0),fNL0Times);
for (Int_t i = 0; i < fNL0Times; i++)
{
Int_t time;
if (GetL0Time(i, time)) printf("| %d ",time);
}
printf("\n");
- printf("| Time sum: %d\n", fL1TimeSum);
+ printf("| L1: g (%d,%d) j (%d,%d) / Time sum: %d\n",
+ GetTriggerBit(kL1Gamma,1),GetTriggerBit(kL1Gamma,0),GetTriggerBit(kL1Jet,1),GetTriggerBit(kL1Jet,0),fL1TimeSum);
}
*/
#include "AliEMCALRawDigit.h"
+#include "AliEMCALTriggerTypes.h"
class AliEMCALTriggerRawDigit : public AliEMCALRawDigit
{
virtual ~AliEMCALTriggerRawDigit();
- void SetL0Trigger(Int_t v) {fL0Trigger = v;}
+ void SetTriggerBit(const TriggerType_t type, const Int_t mode) {fTriggerBits = (fTriggerBits | (1 << (type + kTriggerTypeEnd * mode)));}
+
Bool_t SetL0Time( Int_t i);
- Int_t GetL0Trigger( ) const {return fL0Trigger;}
+ Int_t GetTriggerBit(const TriggerType_t type, const Int_t mode) const;
+
+ Int_t GetTriggerBits() const {return fTriggerBits;}
+
Bool_t GetL0Time(const Int_t i, Int_t& time) const;
Bool_t GetL0Times(Int_t times[] ) const;
Int_t GetNL0Times( ) const {return fNL0Times;}
AliEMCALTriggerRawDigit(const AliEMCALTriggerRawDigit &cd); // Not implemented
AliEMCALTriggerRawDigit &operator=(const AliEMCALTriggerRawDigit &cd); // Not implemented
- Int_t fL0Trigger;
+ Int_t fTriggerBits;
Int_t fNL0Times;
Int_t fL0Times[10];
dig = (AliEMCALTriggerRawDigit*)fRawDigits->At(fRawDigitIndex[idx]);
}
- dig->SetL0Trigger(1);
dig->SetL0Time(iBin);
}
}
for (Int_t j = 0; j < 96; j++)
{
- if (adc[j] < 5) continue;
+ //if (adc[j] < 5) continue;
if (AliDebugLevel()) printf("| STU => TRU# %2d raw data: ADC# %2d: %d\n", iTRU, j, adc[j]);
{
dig = (AliEMCALTriggerRawDigit*)fRawDigits->At(fRawDigitIndex[idx]);
- if (!dig->GetNSamples())
- AliDebug(10,Form("TRG digit of id: %4d found in STU but has 0 sample in F-ALTRO!",idx));
-
- dig->SetL1TimeSum(adc[j]);
+ if (!dig->GetNSamples()) AliDebug(10,Form("TRG digit of id: %4d found in STU but has no time sample in F-ALTRO!",idx));
}
else
{
new((*fRawDigits)[fRawDigits->GetEntriesFast()]) AliEMCALTriggerRawDigit(idx, 0x0, 0);
dig = (AliEMCALTriggerRawDigit*)fRawDigits->At(fRawDigitIndex[idx]);
- dig->SetL1TimeSum(adc[j]);
}
+
+ dig->SetL1TimeSum(adc[j]);
}
}
}
// List of patches in EMCal coordinate system
- TClonesArray* patches = new TClonesArray("AliEMCALTriggerPatch", 96);
for (Int_t i = 0; i < fSTURawStream->GetNL0GammaPatch(); i++)
{
if (fGeometry->GetFastORIndexFromL0Index(iTRU, x, idFastOR, sizePatchL0))
{
+ idx = idFastOR[1];
+
Int_t px, py;
- if (fGeometry->GetPositionInEMCALFromAbsFastORIndex(idFastOR[1], px, py))
+ if (fGeometry->GetPositionInEMCALFromAbsFastORIndex(idx, px, py))
{
- new((*patches)[patches->GetEntriesFast()]) AliEMCALTriggerPatch(px, py);
-
if (AliDebugLevel()) printf("| STU => Add L0 patch at (%2d , %2d)\n", px, py);
+
+ if (fRawDigitIndex[idx] >= 0)
+ {
+ dig = (AliEMCALTriggerRawDigit*)fRawDigits->At(fRawDigitIndex[idx]);
}
- }
+ else
+ {
+ fRawDigitIndex[idx] = fRawDigits->GetEntriesFast();
+ new((*fRawDigits)[fRawDigits->GetEntriesFast()]) AliEMCALTriggerRawDigit(idx, 0x0, 0);
- delete [] idFastOR;
+ dig = (AliEMCALTriggerRawDigit*)fRawDigits->At(fRawDigitIndex[idx]);
}
- fTriggerData->SetPatches(kL0, 1, *patches);
+ dig->SetTriggerBit(kL0,1);
+ }
+ }
- patches->Delete();
+ delete [] idFastOR;
+ }
for (Int_t i = 0; i < fSTURawStream->GetNL1GammaPatch(); i++)
{
if (vx >= 0)
{
- new((*patches)[patches->GetEntriesFast()]) AliEMCALTriggerPatch(vx, vy);
-
+ if (fGeometry->GetAbsFastORIndexFromPositionInEMCAL(vx, vy, idx))
+ {
if (AliDebugLevel()) printf("| STU => Add L1 gamma patch at (%2d , %2d)\n", vx, vy);
+
+ if (fRawDigitIndex[idx] >= 0)
+ {
+ dig = (AliEMCALTriggerRawDigit*)fRawDigits->At(fRawDigitIndex[idx]);
}
- }
- }
+ else
+ {
+ fRawDigitIndex[idx] = fRawDigits->GetEntriesFast();
+ new((*fRawDigits)[fRawDigits->GetEntriesFast()]) AliEMCALTriggerRawDigit(idx, 0x0, 0);
- fTriggerData->SetPatches(kL1Gamma, 1, *patches);
+ dig = (AliEMCALTriggerRawDigit*)fRawDigits->At(fRawDigitIndex[idx]);
+ }
- patches->Delete();
+ dig->SetTriggerBit(kL1Gamma,1);
+ }
+ }
+ }
+ }
for (Int_t i = 0; i < fSTURawStream->GetNL1JetPatch(); i++)
{
if (ix >= 0 && iy >= 0)
{
- new((*patches)[patches->GetEntriesFast()]) AliEMCALTriggerPatch(ix, iy);
-
+ if (fGeometry->GetAbsFastORIndexFromPositionInEMCAL(ix, iy, idx))
+ {
if (AliDebugLevel()) printf("| STU => Add L1 jet patch at (%2d , %2d)\n", ix, iy);
- }
- }
- }
- fTriggerData->SetPatches(kL1Jet, 1, *patches);
+ if (fRawDigitIndex[idx] >= 0)
+ {
+ dig = (AliEMCALTriggerRawDigit*)fRawDigits->At(fRawDigitIndex[idx]);
+ }
+ else
+ {
+ fRawDigitIndex[idx] = fRawDigits->GetEntriesFast();
+ new((*fRawDigits)[fRawDigits->GetEntriesFast()]) AliEMCALTriggerRawDigit(idx, 0x0, 0);
- patches->Delete();
+ dig = (AliEMCALTriggerRawDigit*)fRawDigits->At(fRawDigitIndex[idx]);
+ }
- delete patches;
+ dig->SetTriggerBit(kL1Jet,1);
+ }
+ }
+ }
+ }
}
}
fTime(0x0),
fNL0Times(0x0),
fL0Times(new TArrayI()),
-fL1TimeSum(0x0)
+fL1TimeSum(0x0),
+fTriggerBits(0x0)
{
//
- for (Int_t i = 0; i < 48; i++) for (Int_t j = 0; j < 64; j++) fTriggerBits[i][j] = 0;
}
//_______________
fTime(0x0),
fNL0Times(0x0),
fL0Times(new TArrayI()),
-fL1TimeSum(0x0)
+fL1TimeSum(0x0),
+fTriggerBits(0x0)
{
//
src.Copy(*this);
void AliESDCaloTrigger::DeAllocate()
{
//
- delete [] fColumn; fColumn = 0x0;
- delete [] fRow; fRow = 0x0;
- delete [] fAmplitude; fAmplitude = 0x0;
- delete [] fTime; fTime = 0x0;
- delete [] fNL0Times; fNL0Times = 0x0;
- delete [] fL1TimeSum; fL1TimeSum = 0x0;
-// delete [] fL0Times; fL0Times = 0x0;
+ delete [] fColumn; fColumn = 0x0;
+ delete [] fRow; fRow = 0x0;
+ delete [] fAmplitude; fAmplitude = 0x0;
+ delete [] fTime; fTime = 0x0;
+ delete [] fNL0Times; fNL0Times = 0x0;
+ delete [] fL1TimeSum; fL1TimeSum = 0x0;
+ delete [] fTriggerBits; fTriggerBits = 0x0;
fNEntries = 0;
fCurrent = -1;
-
- for (Int_t i = 0; i < 48; i++) for (Int_t j = 0; j < 64; j++) fTriggerBits[i][j] = 0;
fL0Times->Reset();
}
Int_t times[10];
for (Int_t j = 0; j < 10; j++) times[j] = fL0Times->At(10 * i + j);
- dest.Add(fColumn[i], fRow[i], fAmplitude[i], fTime[i], times, fNL0Times[i], fL1TimeSum[i]);
- }
-
- for (Int_t i = 0; i < 48; i++) for (Int_t j = 0; j < 64; j++) dest.fTriggerBits[i][j] = fTriggerBits[i][j];
+ dest.Add(fColumn[i], fRow[i], fAmplitude[i], fTime[i], times, fNL0Times[i], fL1TimeSum[i], fTriggerBits[i]);
+ }
}
//_______________
fAmplitude = new Float_t[fNEntries];
fTime = new Float_t[fNEntries];
fNL0Times = new Int_t[fNEntries];
-// fL0Times = new Int_t[fNEntries * 10];
fL1TimeSum = new Int_t[fNEntries];
+ fTriggerBits = new Int_t[fNEntries];
for (Int_t i = 0; i < fNEntries; i++)
{
- fColumn[i] = 0;
- fRow[i] = 0;
- fAmplitude[i] = 0;
- fTime[i] = 0;
- fNL0Times[i] = 0;
- fL1TimeSum[i] = 0;
+ fColumn[i] = 0;
+ fRow[i] = 0;
+ fAmplitude[i] = 0;
+ fTime[i] = 0;
+ fNL0Times[i] = 0;
+ fL1TimeSum[i] = 0;
+ fTriggerBits[i] = 0;
}
fL0Times->Set(fNEntries * 10);
}
//_______________
-Bool_t AliESDCaloTrigger::Add(Int_t col, Int_t row, Float_t amp, Float_t time, Int_t trgtimes[], Int_t ntrgtimes, Int_t trgts)
+Bool_t AliESDCaloTrigger::Add(Int_t col, Int_t row, Float_t amp, Float_t time, Int_t trgtimes[], Int_t ntrgtimes, Int_t trgts, Int_t trgbits)
{
//
fCurrent++;
- fColumn[fCurrent] = col;
- fRow[fCurrent] = row;
- fAmplitude[fCurrent] = amp;
- fTime[fCurrent] = time;
- fNL0Times[fCurrent] = ntrgtimes;
- fL1TimeSum[fCurrent] = trgts;
-
+ fColumn[fCurrent] = col;
+ fRow[fCurrent] = row;
+ fAmplitude[fCurrent] = amp;
+ fTime[fCurrent] = time;
+ fNL0Times[fCurrent] = ntrgtimes;
+ fL1TimeSum[fCurrent] = trgts;
+ fTriggerBits[fCurrent] = trgbits;
+
if (ntrgtimes > 9)
{
AliError("Should not have more than 10 L0 times");
}
//_______________
+/*
void AliESDCaloTrigger::SetTriggerBits(Int_t col, Int_t row, Int_t i, Int_t j)
{
//
fTriggerBits[col][row] = (fTriggerBits[col][row] | (1 << (i + 3 * j))); // L0 L1g L1j
}
+*/
//_______________
Bool_t AliESDCaloTrigger::Next()
}
//_______________
-void AliESDCaloTrigger::GetTriggerBits(Char_t& bits) const
+void AliESDCaloTrigger::GetTriggerBits(Int_t& bits) const
{
//
if (fCurrent == -1) return;
- bits = fTriggerBits[fColumn[fCurrent]][fRow[fCurrent]];
+ bits = fTriggerBits[fCurrent];
}
//_______________
printf("--L1:\n");
printf("\tTIME SUM: %4d\n", fL1TimeSum[fCurrent]);
printf("\tTHRESHOLDS (GAMMA: %4d, JET: %4d)\n", fL1Threshold[0], fL1Threshold[1]);
- printf("--TRIGGER BITS: 0x%x\n", fTriggerBits[fColumn[fCurrent]][fRow[fCurrent]]);
+ printf("--TRIGGER BITS: 0x%x\n", fTriggerBits[fCurrent]);
}
void Allocate(Int_t size);
void DeAllocate( );
- Bool_t Add(Int_t col, Int_t row, Float_t amp, Float_t time, Int_t trgtimes[], Int_t ntrgtimes, Int_t trgts);
+ Bool_t Add(Int_t col, Int_t row, Float_t amp, Float_t time, Int_t trgtimes[], Int_t ntrgtimes, Int_t trgts, Int_t trgbits);
void SetL1Threshold(Int_t i, Int_t thr) {fL1Threshold[i] = thr;}
- void SetTriggerBits(Int_t col, Int_t row, Int_t i, Int_t j);
+// void SetTriggerBits(Int_t col, Int_t row, Int_t i, Int_t j);
void GetPosition( Int_t& col, Int_t& row ) const;
void GetAmplitude( Float_t& amp ) const;
void GetTime( Float_t& time ) const;
- void GetTriggerBits( Char_t& bits ) const;
+ void GetTriggerBits( Int_t& bits ) const;
void GetNL0Times( Int_t& ntimes ) const;
void GetL0Times( Int_t times[] ) const;
Int_t GetEntries( ) const {return fNEntries;}
Int_t* fNL0Times; // [fNEntries]
TArrayI* fL0Times; //
Int_t* fL1TimeSum; // [fNEntries]
-
- Char_t fTriggerBits[48][64]; //
- Int_t fL1Threshold[2]; // L1 thresholds from raw data
+ Int_t* fTriggerBits; // [fNEntries]
+
+ Int_t fL1Threshold[2]; // L1 thresholds from raw data
ClassDef(AliESDCaloTrigger, 2)
};