#include "AliRun.h"
#include <TList.h>
+#include <TArrayS.h>
/// \cond CLASSIMP
// Make SDigit
digitList.Clear();
-
- if( TriggerDigits(localBoard, localStruct, digitList) ) {
+ //FIXEME should find something better than a TArray
+ TArrayS xyPattern[2];
+ xyPattern[0].Set(4);
+ xyPattern[1].Set(4);
+
+ xyPattern[0].AddAt(localStruct->GetX1(),0);
+ xyPattern[0].AddAt(localStruct->GetX2(),1);
+ xyPattern[0].AddAt(localStruct->GetX3(),2);
+ xyPattern[0].AddAt(localStruct->GetX4(),3);
+
+ xyPattern[1].AddAt(localStruct->GetY1(),0);
+ xyPattern[1].AddAt(localStruct->GetY2(),1);
+ xyPattern[1].AddAt(localStruct->GetY3(),2);
+ xyPattern[1].AddAt(localStruct->GetY4(),3);
+
+ if( TriggerDigits(loCircuit, xyPattern, digitList) ) {
for (Int_t iEntry = 0; iEntry < digitList.GetEntries(); iEntry++) {
return kTRUE;
}
+
//____________________________________________________________________
-void AliMUONDigitMaker::GetTriggerChamber(AliMUONLocalStruct* localStruct, Int_t& xyPattern,
- Int_t& iChamber, Int_t& iCath, Int_t icase)
-{
- /// get chamber & cathode number, (chamber starts at 0 !)
-
- switch(icase) {
- case 0:
- xyPattern = localStruct->GetX1();
- iCath = 0;
- iChamber = 10;
- break;
- case 1:
- xyPattern = localStruct->GetX2();
- iCath = 0;
- iChamber = 11;
- break;
- case 2:
- xyPattern = localStruct->GetX3();
- iCath = 0;
- iChamber = 12;
- break;
- case 3:
- xyPattern = localStruct->GetX4();
- iCath = 0;
- iChamber = 13;
- break;
- case 4:
- xyPattern = localStruct->GetY1();
- iCath = 1;
- iChamber = 10;
- break;
- case 5:
- xyPattern = localStruct->GetY2();
- iCath = 1;
- iChamber = 11;
- break;
- case 6:
- xyPattern = localStruct->GetY3();
- iCath = 1;
- iChamber = 12;
- break;
- case 7:
- xyPattern = localStruct->GetY4();
- iCath = 1;
- iChamber = 13;
- break;
- }
-}
-//____________________________________________________________________
-Int_t AliMUONDigitMaker::TriggerDigits(AliMUONLocalTriggerBoard* localBoard,
- AliMUONLocalStruct* localStruct,
+Int_t AliMUONDigitMaker::TriggerDigits(Int_t nBoard,
+ TArrayS* xyPattern,
TList& digitList)
{
/// make (S)Digit for trigger
Int_t detElemId;
- Int_t nBoard;
- Int_t iCath = -1;
- Int_t iChamber = 0;
- Int_t xyPattern = 0;
+ Int_t previousDetElemId[4] = {0};
+ Int_t previousBoard[4] = {0};
// loop over x1-4 and y1-4
- for (Int_t icase = 0; icase < 8; icase++) {
-
- // get chamber, cathode and associated trigger response pattern
- GetTriggerChamber(localStruct, xyPattern, iChamber, iCath, icase);
+ for(Int_t iChamber = 0; iChamber < 4; ++iChamber){
+ for(Int_t iCath = 0; iCath < 2; ++iCath){
- if (!xyPattern) continue;
+ Int_t pattern = (Int_t)xyPattern[iCath].At(iChamber);
+ if (!pattern) continue;
+
+ // get detElemId
+ AliMUONTriggerCircuit triggerCircuit;
+ AliMUONLocalTriggerBoard* localBoard = fCrateManager->LocalBoard(nBoard);
+ detElemId = triggerCircuit.DetElemId(iChamber+10, localBoard->GetName());//FIXME +/-10 (should be ok with new mapping)
+
- // get detElemId
- AliMUONTriggerCircuit triggerCircuit;
- detElemId = triggerCircuit.DetElemId(iChamber, localBoard->GetName());
- nBoard = localBoard->GetNumber();
+ if(iCath == 1){ // FIXME should find a more elegant way
+ // Don't save twice the same digit
+ // (since strips in non bending plane can cross several boards)
+ Int_t prevDetElemId = previousDetElemId[iChamber];
+ Int_t prevBoard = previousBoard[iChamber];
+ previousDetElemId[iChamber] = detElemId;
+ previousBoard[iChamber] = nBoard;
+
+ if(detElemId == prevDetElemId){
+ if(nBoard-prevBoard==1) continue;
+ }
+ }
- const AliMpVSegmentation* seg
- = AliMpSegmentation::Instance()
- ->GetMpSegmentation(detElemId, AliMp::GetCathodType(iCath));
+ const AliMpVSegmentation* seg
+ = AliMpSegmentation::Instance()
+ ->GetMpSegmentation(detElemId, AliMp::GetCathodType(iCath));
- // loop over the 16 bits of pattern
- for (Int_t ibitxy = 0; ibitxy < 16; ibitxy++) {
+ // loop over the 16 bits of pattern
+ for (Int_t ibitxy = 0; ibitxy < 16; ++ibitxy) {
- if ((xyPattern >> ibitxy) & 0x1) {
-
- // not quite sure about this
- Int_t offset = 0;
- if (iCath && localBoard->GetSwitch(6)) offset = -8;
-
- AliMpPad pad = seg->PadByLocation(AliMpIntPair(nBoard,ibitxy+offset),kTRUE);
-
- AliMUONDigit* digit = new AliMUONDigit();
- if (!pad.IsValid()) {
- AliWarning(Form("No pad for detElemId: %d, nboard %d, ibitxy: %d\n",
- detElemId, nBoard, ibitxy));
- continue;
- } //
-
- Int_t padX = pad.GetIndices().GetFirst();
- Int_t padY = pad.GetIndices().GetSecond();
-
- // file digit
- digit->SetPadX(padX);
- digit->SetPadY(padY);
- digit->SetSignal(1.);
- digit->SetCathode(iCath);
- digit->SetDetElemId(detElemId);
- digit->SetElectronics(nBoard, ibitxy);
- digitList.Add(digit);
+ if ((pattern >> ibitxy) & 0x1) {
+
+ // not quite sure about this
+ Int_t offset = 0;
+ if (iCath && localBoard->GetSwitch(6)) offset = -8;
+
+ AliMpPad pad = seg->PadByLocation(AliMpIntPair(nBoard,ibitxy+offset),kTRUE);
+
+ AliMUONDigit* digit = new AliMUONDigit();
+ if (!pad.IsValid()) {
+ AliWarning(Form("No pad for detElemId: %d, nboard %d, ibitxy: %d\n",
+ detElemId, nBoard, ibitxy));
+ continue;
+ } //
+
+ Int_t padX = pad.GetIndices().GetFirst();
+ Int_t padY = pad.GetIndices().GetSecond();
+
+ // file digit
+ digit->SetPadX(padX);
+ digit->SetPadY(padY);
+ digit->SetSignal(1.);
+ digit->SetCathode(iCath);
+ digit->SetDetElemId(detElemId);
+ digit->SetElectronics(nBoard, ibitxy);
+ digitList.Add(digit);
- }// xyPattern
- }// ibitxy
- }// case
+ }// xyPattern
+ }// ibitxy
+ }// cath
+ } // ichamber
return kTRUE;
}