(channel << 8) - ypos)
* (0.635 + 0.03 * (fDetector % 6))
/ 256.0;
- label = fHits[index].fLabel;
+ label = fHits[index].fLabel[0];
return kTRUE;
}
}
}
-void AliTRDmcmSim::AddHitToFitreg(Int_t adc, UShort_t timebin, UShort_t qtot, Short_t ypos, Int_t label)
+void AliTRDmcmSim::AddHitToFitreg(Int_t adc, UShort_t timebin, UShort_t qtot, Short_t ypos, Int_t label[])
{
// Add the given hit to the fit register which is lateron used for
// the tracklet calculation.
fHits[fNHits].fQtot = qtot;
fHits[fNHits].fYpos = ypos;
fHits[fNHits].fTimebin = timebin;
- fHits[fNHits].fLabel = label;
+ fHits[fNHits].fLabel[0] = label[0];
+ fHits[fNHits].fLabel[1] = label[1];
+ fHits[fNHits].fLabel[2] = label[2];
fNHits++;
}
ypos = 128*(adcLeft - adcRight) / adcCentral;
if (ypos < 0) ypos = -ypos;
// make the correction using the position LUT
- ypos = ypos + fTrapConfig->GetTrapReg((AliTRDtrapConfig::TrapReg_t) (AliTRDtrapConfig::kTPL00 + (ypos & 0x7F)));
+ ypos = ypos + fTrapConfig->GetTrapReg((AliTRDtrapConfig::TrapReg_t) (AliTRDtrapConfig::kTPL00 + (ypos & 0x7F)),
+ fDetector, fRobPos, fMcmPos);
if (adcLeft > adcRight) ypos = -ypos;
- // label calculation
- Int_t mcLabel = -1;
+ // label calculation (up to 3)
+ Int_t mcLabel[] = {-1, -1, -1};
if (fDigitsManager) {
- Int_t label[9] = { 0 }; // up to 9 different labels possible
- Int_t count[9] = { 0 };
- Int_t maxIdx = -1;
- Int_t maxCount = 0;
+ const Int_t maxLabels = 9;
+ Int_t label[maxLabels] = { 0 }; // up to 9 different labels possible
+ Int_t count[maxLabels] = { 0 };
Int_t nLabels = 0;
Int_t padcol[3];
padcol[0] = fFeeParam->GetPadColFromADC(fRobPos, fMcmPos, adcch);
for (Int_t iPad = 0; iPad < 3; iPad++) {
if (padcol[iPad] < 0)
continue;
- Int_t currLabel = fDict[iDict]->GetData(padrow, padcol[iPad], timebin); //fDigitsManager->GetTrack(iDict, padrow, padcol, timebin, fDetector);
+ Int_t currLabel = fDict[iDict]->GetData(padrow, padcol[iPad], timebin);
AliDebug(10, Form("Read label: %4i for det: %3i, row: %i, col: %i, tb: %i\n", currLabel, fDetector, padrow, padcol[iPad], timebin));
for (Int_t iLabel = 0; iLabel < nLabels; iLabel++) {
if (currLabel == label[iLabel]) {
count[iLabel]++;
- if (count[iLabel] > maxCount) {
- maxCount = count[iLabel];
- maxIdx = iLabel;
- }
currLabel = -1;
break;
}
}
if (currLabel >= 0) {
- label[nLabels++] = currLabel;
+ label[nLabels] = currLabel;
+ count[nLabels] = 1;
+ nLabels++;
}
}
}
- if (maxIdx >= 0)
- mcLabel = label[maxIdx];
+ Int_t index[maxLabels];
+ TMath::Sort(maxLabels, count, index);
+ for (Int_t i = 0; i < 3; i++) {
+ if (count[index[i]] <= 0)
+ break;
+ mcLabel[i] = label[index[i]];
+ }
}
// add the hit to the fitregister
fMCMT[cpu] = (pid << 24) | (padrow << 20) | (slope << 13) | offset;
// calculate MC label
- Int_t mcLabel = -1;
+ Int_t mcLabel[] = { -1, -1, -1};
Int_t nHits0 = 0;
Int_t nHits1 = 0;
if (fDigitsManager) {
- Int_t label[30] = {0}; // up to 30 different labels possible
- Int_t count[30] = {0};
- Int_t maxIdx = -1;
- Int_t maxCount = 0;
+ const Int_t maxLabels = 30;
+ Int_t label[maxLabels] = {0}; // up to 30 different labels possible
+ Int_t count[maxLabels] = {0};
Int_t nLabels = 0;
for (Int_t iHit = 0; iHit < fNHits; iHit++) {
if ((fHits[iHit].fChannel - fFitPtr[cpu] < 0) ||
fHits[iHit].fTimebin < fTrapConfig->GetTrapReg(AliTRDtrapConfig::kTPQE1))
nHits1++;
- Int_t currLabel = fHits[iHit].fLabel;
- for (Int_t iLabel = 0; iLabel < nLabels; iLabel++) {
- if (currLabel == label[iLabel]) {
- count[iLabel]++;
- if (count[iLabel] > maxCount) {
- maxCount = count[iLabel];
- maxIdx = iLabel;
- }
- currLabel = -1;
- break;
- }
- }
- if (currLabel >= 0) {
- label[nLabels++] = currLabel;
- }
- }
- if (maxIdx >= 0)
- mcLabel = label[maxIdx];
+ for (Int_t i = 0; i < 3; i++) {
+ Int_t currLabel = fHits[iHit].fLabel[i];
+ for (Int_t iLabel = 0; iLabel < nLabels; iLabel++) {
+ if (currLabel == label[iLabel]) {
+ count[iLabel]++;
+ currLabel = -1;
+ break;
+ }
+ }
+ if (currLabel >= 0 && nLabels < maxLabels) {
+ label[nLabels] = currLabel;
+ count[nLabels]++;
+ nLabels++;
+ }
+ }
+ }
+ Int_t index[maxLabels];
+ TMath::Sort(maxLabels, count, index);
+ for (Int_t i = 0; i < 3; i++) {
+ if (count[index[i]] <= 0)
+ break;
+ mcLabel[i] = label[index[i]];
+ }
}
new ((*fTrackletArray)[fTrackletArray->GetEntriesFast()]) AliTRDtrackletMCM((UInt_t) fMCMT[cpu], fDetector*2 + fRobPos%2, fRobPos, fMcmPos);
((AliTRDtrackletMCM*) (*fTrackletArray)[fTrackletArray->GetEntriesFast()-1])->SetLabel(mcLabel);
fNHits(0),
fNHits0(0),
fNHits1(0),
- fLabel(-1),
fSlope(0.),
fOffset(0.),
fError(0.),
fClsCharges(0x0)
{
fGeo = new AliTRDgeometry();
+ fLabel[0] = -1;
+ fLabel[1] = -1;
+ fLabel[2] = -1;
}
AliTRDtrackletMCM::AliTRDtrackletMCM(UInt_t trackletWord, Int_t hcid) :
fNHits(0),
fNHits0(0),
fNHits1(0),
- fLabel(-1),
fSlope(0.),
fOffset(0.),
fError(0.),
fClsCharges(0x0)
{
fGeo = new AliTRDgeometry();
+ fLabel[0] = -1;
+ fLabel[1] = -1;
+ fLabel[2] = -1;
}
AliTRDtrackletMCM::AliTRDtrackletMCM(UInt_t trackletWord, Int_t hcid, Int_t rob, Int_t mcm) :
fNHits(0),
fNHits0(0),
fNHits1(0),
- fLabel(-1),
fSlope(0.),
fOffset(0.),
fError(0.),
fClsCharges(0x0)
{
fGeo = new AliTRDgeometry();
+ fLabel[0] = -1;
+ fLabel[1] = -1;
+ fLabel[2] = -1;
}
AliTRDtrackletMCM::AliTRDtrackletMCM(const AliTRDtrackletMCM &rhs) :
fNHits(rhs.fNHits),
fNHits0(rhs.fNHits0),
fNHits1(rhs.fNHits1),
- fLabel(rhs.fLabel),
- fSlope(rhs.fLabel),
+ fSlope(rhs.fSlope),
fOffset(rhs.fOffset),
fError(rhs.fError),
fNClusters(rhs.fNClusters),
fResiduals[iCls] = rhs.fResiduals[iCls];
fClsCharges[iCls] = rhs.fClsCharges[iCls];
}
+ fLabel[0] = rhs.fLabel[0];
+ fLabel[1] = rhs.fLabel[1];
+ fLabel[2] = rhs.fLabel[2];
}
AliTRDtrackletMCM::~AliTRDtrackletMCM()
}
}
+void AliTRDtrackletMCM::SetLabel(Int_t label[])
+{
+ fLabel[0] = label[0];
+ fLabel[1] = label[1];
+ fLabel[2] = label[2];
+}
+
void AliTRDtrackletMCM::SetClusters(Float_t *res, Float_t *q, Int_t n)
{
fNClusters = n;
// ----- Getters for MCM-tracklet information -----
Int_t GetMCM() const { return fMCM; }
Int_t GetROB() const { return fROB; }
- Int_t GetLabel() const { return fLabel; }
+ Int_t GetLabel() const { return fLabel[0]; }
+ Int_t GetLabel(const Int_t i) const { return fLabel[i]; }
+ Bool_t HasLabel(const Int_t label) const { return (fLabel[0] == label || fLabel[1] == label || fLabel[2] == label); }
// ----- Getters for offline corresponding values -----
Bool_t CookPID() { return kFALSE; }
Float_t GetY() const { return (GetYbin() * 160e-4); }
Float_t GetZ() const { return fGeo->GetPadPlane((fHCId % 12) / 2, (fHCId / 12) % 5)->GetRowPos( 4 * (fROB / 2) + fMCM / 4) -
fGeo->GetPadPlane((fHCId % 12) / 2, (fHCId /12) % 5)->GetRowSize(4 * (fROB / 2) + fMCM / 4) * .5; }
- Float_t GetLocalZ() const { return GetZ() - fGeo->GetPadPlane((fHCId % 12) / 2, (fHCId / 12) % 5)->GetRowPos(8); }
+ Float_t GetLocalZ() const { return GetZ() -
+ (fGeo->GetPadPlane((fHCId % 12) / 2, (fHCId / 12) % 5)->GetRow0()+fGeo->GetPadPlane((fHCId % 12) / 2, (fHCId / 12) % 5)->GetRowEnd())/2.; }
Int_t GetQ0() const { return fQ0; }
Int_t GetQ1() const { return fQ1; }
void SetHCId(Int_t id) { fHCId = id; }
void SetMCM(Int_t mcm) { fMCM = mcm; }
void SetROB(Int_t rob) { fROB = rob; }
- void SetLabel(Int_t label) { fLabel = label; }
+ void SetLabel(Int_t label[]);
void SetQ0(Int_t charge) { fQ0 = charge; }
void SetQ1(Int_t charge) { fQ1 = charge; }
void SetNHits(Int_t nhits) { fNHits = nhits; }
Int_t fNHits0; // no. of contributing clusters in window 0
Int_t fNHits1; // no. of contributing clusters in window 1
- Int_t fLabel; // label for MC track
+ Int_t fLabel[3]; // up to 3 labels for MC track
Float_t fSlope; // tracklet slope
Float_t fOffset; // tracklet offset