X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=MUON%2FAliMUONTriggerElectronics.cxx;h=88dcaf2ad4e9b3bb0ac911cc29e77346d1b04d5a;hb=03dec2c995153acc4cbb3a0f13b3b6a455d81ce1;hp=4f1335b2193a50c7ab1c92794baa1c919c389436;hpb=8af755f4e43d82e0e0a5505b38ed40d25083a82e;p=u%2Fmrichter%2FAliRoot.git diff --git a/MUON/AliMUONTriggerElectronics.cxx b/MUON/AliMUONTriggerElectronics.cxx index 4f1335b2193..88dcaf2ad4e 100644 --- a/MUON/AliMUONTriggerElectronics.cxx +++ b/MUON/AliMUONTriggerElectronics.cxx @@ -15,581 +15,382 @@ /* $Id$ */ -//*-- Author: Rachid Guernane (LPCCFd) +//----------------------------------------------------------------------------- +// Class AliMUONTriggerElectronics +//-------------------------------- +// Manager class for muon trigger electronics +// Client of trigger board classes +// Debugged by Ph. Crochet & Ch. Finck +// Interfaced with new mapping Ch. Finck +// +// Author: Rachid Guernane (LPCCFd) +//----------------------------------------------------------------------------- -#include "AliMUONTriggerElectronics.h" -#include "AliMUONTriggerCrate.h" -#include "AliMUONConstants.h" -#include "AliMUONLocalTriggerBoard.h" -#include "AliMUONRegionalTriggerBoard.h" -#include "AliMUONGlobalTriggerBoard.h" -#include "AliMUONLocalTrigger.h" -#include "AliMUONGlobalTrigger.h" #include "AliLoader.h" -#include "AliRun.h" -#include "AliMUON.h" -#include "AliMUONData.h" -#include "AliMUONDigit.h" #include "AliLog.h" -#include "AliLoader.h" -#include "AliMUONTriggerConstants.h" -#include "AliMpTriggerSegmentation.h" -#include "AliMUONSegmentation.h" +#include "AliMUON.h" +#include "AliMUONCalibrationData.h" +#include "AliMUONVDigit.h" +#include "AliMUONVDigitStore.h" +#include "AliMUONGlobalTrigger.h" +#include "AliMUONGlobalTriggerBoard.h" +#include "AliMUONLocalTrigger.h" +#include "AliMUONLocalTriggerBoard.h" +#include "AliMUONRegionalTrigger.h" +#include "AliMUONRegionalTriggerBoard.h" +#include "AliMUONTriggerCrate.h" +#include "AliMUONTriggerCrateStore.h" +#include "AliMUONTriggerElectronics.h" +#include "AliMUONTriggerCrateConfig.h" +#include "AliMUONRegionalTriggerConfig.h" +#include "AliMUONGlobalCrateConfig.h" +#include "AliMUONVTriggerStore.h" +#include "AliMUONVCalibParam.h" +#include "AliMpCathodType.h" +#include "AliMpDEManager.h" +#include "AliMpSegmentation.h" #include "AliMpVSegmentation.h" +#include "AliMpCathodType.h" +#include "AliMpTriggerCrate.h" +#include "AliMpLocalBoard.h" +#include "AliMpDDLStore.h" +#include "AliMpExMap.h" +#include "AliMpIntPair.h" -#include "TBits.h" +#include "AliLog.h" +#include "AliLoader.h" +#include "AliRun.h" +#include +#include -#include "Riostream.h" -#include "TSystem.h" +/// \cond CLASSIMP ClassImp(AliMUONTriggerElectronics) - -const Int_t AliMUONTriggerElectronics::fgkNCrates = 16; +/// \endcond //___________________________________________ -AliMUONTriggerElectronics::AliMUONTriggerElectronics(AliMUONData *Data) -: TTask("AliMUONTriggerElectronics", - "From trigger digits to Local and Global Trigger objects"), - fCrates(new TClonesArray("AliMUONTriggerCrate", fgkNCrates)), - fGlobalTriggerBoard(new AliMUONGlobalTriggerBoard), - fNCrates(0), - fMUONData(Data) +AliMUONTriggerElectronics::AliMUONTriggerElectronics(AliMUONCalibrationData* calibData) +: TObject(), + fCrates(new AliMUONTriggerCrateStore), + fGlobalTriggerBoard(new AliMUONGlobalTriggerBoard) { - if (!fMUONData) - { - AliFatal("NO MUON TRIGGER DATA"); - } - - for (Int_t i=0;i<16;i++) - { - fRegional[i] = 0; - for (Int_t j=0;j<16;j++) fLocal[i][j] = 0; + /// CONSTRUCTOR +/// + + for (Int_t i = 0; i < 2; ++i) { + fCopyXInput[i] = new TList(); + fCopyXInput[i]->SetOwner(); + fCopyYInput[i] = new TList(); + fCopyYInput[i]->SetOwner(); } - - fGlobal = 0; - - fCrateMap = new char*[234]; - for (Int_t i=0;i<234;i++) fBoardMap[i] = 0; - - SetDataSource(); - Factory(); - AliWarning("ZERO-ALLY-LSB TO BE CHECKED!!!"); - AliWarning("AliMUONLocalTriggerBoard Y_pos DIVIDED BY 2 TO BE CONSISTENT W/ AliMUONTrackReconstructor!!!"); + SetCopyInput(); + + Factory(calibData); + LoadMasks(calibData); } //___________________________________________ AliMUONTriggerElectronics::~AliMUONTriggerElectronics() { +/// DESTRUCTOR +/// delete fGlobalTriggerBoard; delete fCrates; + for (Int_t i = 0; i < 2; ++i) { + delete fCopyXInput[i]; + delete fCopyYInput[i]; + } - for (Int_t i=0;i<234;i++) if (fCrateMap[i]) {delete [] fCrateMap[i]; fCrateMap[i] = NULL;} } //___________________________________________ -void AliMUONTriggerElectronics::Factory() +void AliMUONTriggerElectronics::SetCopyInput() { - ifstream myInputFile(gSystem->ExpandPathName(fSourceFileName.Data()), ios::in); - - string sLine, sValue; - - if ( !myInputFile ) - { - AliError("TRIGGER ELECTRONICS CONFIGURATION FILE COULD NOT BE OPENED"); - } - else - { - while (getline(myInputFile,sLine)) - { - if (sLine.empty()) continue; // Ignore empty lines - else - { - const Int_t maxfields = 15; char **fields = new char*[maxfields]; - - char s[100]; - - if (sLine.find("Board",0) != string::npos) - { - strcpy(s,sLine.c_str()); - - Int_t numlines = 0; - - for (char *token = strtok(s, " "); - token != NULL; - token = strtok(NULL, " ")) - { - fields[numlines] = new char[strlen(token)+1]; - strcpy(fields[numlines++],token); - } - - char str[10]; strcpy(str, fields[6]); strcat(str, fields[7]); - - AliMUONTriggerCrate *crate = Crate(str); - -// cout << " Manipulating crate " << str << endl; - - - - if (!crate) - { - AddCrate(str); crate = Crate(str); - - AliMUONRegionalTriggerBoard *rboard = new AliMUONRegionalTriggerBoard(); - crate->AddBoard(rboard, 0); - } - -// CONVENTION: SLOT 0 HOLDS THE REGIONAL BOARD - Int_t sl = atoi(fields[10]); - - AliMUONLocalTriggerBoard *board = new AliMUONLocalTriggerBoard(fields[4], sl); - - if (strcmp(fields[1],"nn")) - { - Int_t sboard = atoi(fields[1]); - - board->SetNumber(sboard); - - fCrateMap[sboard-1] = new char[strlen(str)+1]; strcpy(fCrateMap[sboard-1], str); -// cout << " fCrateMap[" << sboard-1 << "]: " << fCrateMap[sboard-1] << endl; - - fBoardMap[sboard-1] = sl; - } - - board->SetCrate(str); - - crate->AddBoard(board, sl); - - while (getline(myInputFile,sLine)) if (sLine.find("transv",0) != string::npos) break; - - strcpy(s,sLine.c_str()); - - for (char *token = strtok(s, " "); - token != NULL; - token = strtok(NULL, " ")) if (!strcmp(token,"NONE")) board->SetTC(kFALSE); - - while (getline(myInputFile,sLine)) if (sLine.find("Switch",0) != string::npos) break; - - while (getline(myInputFile,sLine)) if (!sLine.empty()) break; - - strcpy(s,sLine.c_str()); - - Int_t lines = 0; - - for (char *token = strtok(s, " "); - token != NULL; - token = strtok(NULL, " ")) board->SetSwitch(lines++, atoi(token)); - - for (Int_t i = 0; iGetTriggerCrate(iDDL, iReg); + + for(Int_t iLocal = 0; iLocal < crateMapping->GetNofLocalBoards(); ++iLocal) { + + Int_t localBoardFromId = crateMapping->GetLocalBoardId(iLocal); + if (!localBoardFromId) continue; //empty slot, should not happen + + AliMpLocalBoard* localBoardFrom = AliMpDDLStore::Instance()->GetLocalBoard(localBoardFromId); + Int_t localBoardToId; + if ((localBoardToId = localBoardFrom->GetInputXto())) { + AliMpLocalBoard* localBoardTo = AliMpDDLStore::Instance()->GetLocalBoard(localBoardToId); + TString crateFrom = localBoardFrom->GetCrate(); + Int_t slotFrom = localBoardFrom->GetSlot(); + TString crateTo = localBoardTo->GetCrate(); + Int_t slotTo = localBoardTo->GetSlot(); + + fCopyXInput[0]->Add(new AliMpIntPair(AliMpExMap::GetIndex(crateFrom), slotFrom)); + fCopyXInput[1]->Add(new AliMpIntPair(AliMpExMap::GetIndex(crateTo), slotTo)); + AliDebug(3, Form("copy xInputs from local %s_%d to %s_%d\n", crateFrom.Data(), slotFrom, + crateTo.Data(), slotTo)); + } + + if ((localBoardToId = localBoardFrom->GetInputYto())) { + AliMpLocalBoard* localBoardTo = AliMpDDLStore::Instance()->GetLocalBoard(localBoardToId); + TString crateFrom = localBoardFrom->GetCrate(); + Int_t slotFrom = localBoardFrom->GetSlot(); + TString crateTo = localBoardTo->GetCrate(); + Int_t slotTo = localBoardTo->GetSlot(); + + fCopyYInput[0]->Add(new AliMpIntPair(AliMpExMap::GetIndex(crateFrom), slotFrom)); + fCopyYInput[1]->Add(new AliMpIntPair(AliMpExMap::GetIndex(crateTo), slotTo)); + AliDebug(3, Form("copy yInputs from local %s_%d to %s_%d\n", crateFrom.Data(), slotFrom, + crateTo.Data(), slotTo)); + + } + + } } - } + } } //___________________________________________ -void AliMUONTriggerElectronics::Feed() -{ - for (Int_t ichamber=10; ichamber<14; ichamber++) - { - TClonesArray *MuonDigits = fMUONData->Digits(ichamber); - Int_t ndigits = MuonDigits->GetEntriesFast(); - - for (Int_t digit=0; digit(MuonDigits->UncheckedAt(digit)); - - Int_t ix = mdig->PadX(), iy = mdig->PadY(); - -// GET THE SUM OF THE CODED CHARGE -// SEE CODING CONVENTION IN AliMUONChamberTrigger::DisIntegration - Int_t schg = 0; - for (Int_t ichg=0; ichg<10; ichg++) schg += mdig->TrackCharge(ichg); - -// APPLY CONDITION ON SOFT BACKGROUND - Int_t tchg = schg - (Int_t(schg/10))*10; - - if (schg<=10 || tchg>0) - { - Int_t cathode = mdig->Cathode(); - -// Now identify local board from (ix,iy) - char name[10]; BoardName(ix,iy,name); - - for (Int_t i=0;iUncheckedAt(i); - - TObjArray *boards = cr->Boards(); - - AliMUONLocalTriggerBoard *b = (AliMUONLocalTriggerBoard*)boards->FindObject(name); - - if (b) - { - Int_t digitindex = digit; - -// Y STRIP IS FIRED ONCE BUT ALL BOARDS FROM THE SAME MODULE ARE FED - if (cathode) - { - if (b->GetSwitch(6)) iy += 8; - - char M1[20]; b->Module(M1); - - for (Int_t j=0;jUncheckedAt(j); - - TObjArray *bs = ca->Boards(); - - for (Int_t k=1; kGetEntries()-1; k++) - { - AliMUONLocalTriggerBoard *h = (AliMUONLocalTriggerBoard*)bs->At(k); - - if (h) - { - char M2[20]; h->Module(M2); - - if (!strcmp(M1,M2)) h->Setbit(iy,cathode,ichamber-10); - } - } - } - } - else - b->Setbit(iy,cathode,ichamber-10); - - DigitFiredCircuit(b->GetI(), cathode, ichamber, digitindex); - } - } - } - } - } - -// Particular case of the columns with 22 local boards (2R(L) 3R(L)) - AliMUONTriggerCrate *crate = 0x0; TObjArray *bs = 0x0; - - char *scratess[4] = { "2R", "2L", "3L", "3R"}; - char *scratesd[4] = {"2-3R", "2-3L", "2-3L", "2-3R"}; - Int_t slotf[4] = { 2, 2, 10, 10}; - Int_t slotd[4] = { 1, 1, 9, 9}; - - for (Int_t i=0; i<4; i++) - { - crate = (AliMUONTriggerCrate*)fCrates->FindObject(scratess[i]); - bs = crate->Boards(); - AliMUONLocalTriggerBoard *desybb = (AliMUONLocalTriggerBoard*)bs->At(14); - AliMUONLocalTriggerBoard *fromcb = (AliMUONLocalTriggerBoard*)bs->At(15); - AliMUONLocalTriggerBoard *desxbb = (AliMUONLocalTriggerBoard*)bs->At(16); - - crate = (AliMUONTriggerCrate*)fCrates->FindObject(scratesd[i]); - bs = crate->Boards(); - AliMUONLocalTriggerBoard *frombb = (AliMUONLocalTriggerBoard*)bs->At(slotf[i]); - AliMUONLocalTriggerBoard *desycb = (AliMUONLocalTriggerBoard*)bs->At(slotd[i]); - - UShort_t cX[2]; - -// COPY X3-4 FROM BOARD 2 OF CRATE 2-3 TO BOARD 16 OF CRATE 2 -// COPY X3-4 FROM BOARD 10 OF CRATE 2-3 TO BOARD 16 OF CRATE 3 - frombb->GetX34(cX); desxbb->SetX34(cX); - -// COPY X3-4 FROM BOARD 15 OF CRATE 2 TO BOARD 1 OF CRATE 2-3 -// COPY X3-4 FROM BOARD 15 OF CRATE 3 TO BOARD 9 OF CRATE 2-3 - fromcb->GetX34(cX); desycb->SetX34(cX); - - UShort_t cY[4]; - - desybb->GetY(cY); frombb->SetY(cY); - } +void AliMUONTriggerElectronics::Factory(AliMUONCalibrationData* calibData) +{ + /// BUILD ALL ELECTRONICS + /// -// FILL UP/DOWN OF CURRENT BOARD (DONE VIA J3 BUS IN REAL LIFE) - for (Int_t i=0; iUncheckedAt(i); - - TObjArray *boards = cr->Boards(); - - for (Int_t j=1; jGetEntries()-1; j++) - { - TObject *o = boards->At(j); - - if (!o) break; - - AliMUONLocalTriggerBoard *currboard = (AliMUONLocalTriggerBoard*)o; - - AliMUONLocalTriggerBoard *neighbour = (AliMUONLocalTriggerBoard*)boards->At(j+1); - - UShort_t cXY[2][4]; - - if (j==1) {neighbour->GetXY(cXY); currboard->SetXYU(cXY);} - -// LAST BOARD IN THE CRATE HAS NO UP EXCEPT FOR CRATES 2 & 3 - if (jGetEntries()-2) - { - AliMUONLocalTriggerBoard *nextboard = (AliMUONLocalTriggerBoard*)boards->At(j+2); - - currboard->GetXY(cXY); neighbour->SetXYD(cXY); - nextboard->GetXY(cXY); neighbour->SetXYU(cXY); - - if (j==boards->GetEntries()-3) {neighbour->GetXY(cXY); nextboard->SetXYD(cXY);} - } - } - } + fCrates->ReadFromFile(calibData); } //___________________________________________ -void AliMUONTriggerElectronics::FeedM() +void AliMUONTriggerElectronics::Feed(const AliMUONVDigitStore& digitStore) { - for (Int_t ichamber=10; ichamber<14; ichamber++) - { - TClonesArray *MuonDigits = fMUONData->Digits(ichamber); - Int_t ndigits = MuonDigits->GetEntriesFast(); - -// cout << " ichamber: " << ichamber << " ndigits: " << ndigits << endl; - - for (Int_t digit=0; digit(MuonDigits->UncheckedAt(digit)); - -// CHECKME ! The TrackCharge is not ok with new digitizerV3 ! -// for (Int_t ichg=0; ichg<10; ichg++) schg += mdig->TrackCharge(ichg); -// assert(schg==mdig->Signal()); - Int_t schg = mdig->Signal(); - -// APPLY CONDITION ON SOFT BACKGROUND - Int_t tchg = schg - (Int_t(schg/10))*10; - - if (schg<=10 || tchg>0) - { -// mdig->Print(); - - Int_t digitindex = digit; - Int_t detElemId = mdig->DetElemId(); - Int_t cathode = mdig->Cathode(); - - const AliMpVSegmentation *seg = ((AliMUON*)gAlice->GetDetector("MUON"))->GetSegmentation()->GetMpSegmentation(detElemId,cathode); - - Int_t ix = mdig->PadX(), iy = mdig->PadY(); - - AliDebug(3,Form("cathode %d ix %d iy %d ",cathode,ix,iy)); - - AliMpPad pad = seg->PadByIndices(AliMpIntPair(ix,iy),kTRUE); - - for (Int_t i=0; iFindObject(fCrateMap[nboard-1]); - - TObjArray *boards = cr->Boards(); - - AliMUONLocalTriggerBoard *b = (AliMUONLocalTriggerBoard*)boards->At(fBoardMap[nboard-1]); - -// if (b && nboard && b->GetNumber()==nboard) - if (b) - { - if (cathode && b->GetSwitch(6)) ibitxy += 8; - -// cout << " nboard:\t" << nboard << " ibitxy:\t" << ibitxy << " schg:\t" << schg << " crate:\t" << fCrateMap[nboard-1] << endl; - - b->SetbitM(ibitxy,cathode,ichamber-10); - - DigitFiredCircuit(b->GetI(), cathode, ichamber, digitindex); - } - - -// for (Int_t j=0; jUncheckedAt(j); - -// TObjArray *boards = cr->Boards(); - -// for (Int_t k=1; kGetEntries()-1; k++) -// { -// AliMUONLocalTriggerBoard *b = (AliMUONLocalTriggerBoard*)boards->At(k); - -// if (b && nboard && b->GetNumber()==nboard) -// { -// if (cathode && b->GetSwitch(6)) ibitxy += 8; - -// b->SetbitM(ibitxy,cathode,ichamber-10); - -// // cout << "BOARD: " << b->GetName() << " Number: " << b->GetNumber() -// // << " ibitxy: " << ibitxy -// // << " nboard: " << nboard -// // << " ich: " << ichamber-10 << endl; - -// DigitFiredCircuit(b->GetI(), cathode, ichamber, digitindex); -// } -// } -// } - } - } - } - -// fMUONData->ResetDigits(); - } - -// Particular case of the columns with 22 local boards (2R(L) 3R(L)) - AliMUONTriggerCrate *crate = 0x0; TObjArray *bs = 0x0; - - char *scratess[4] = { "2R", "2L", "3L", "3R"}; - char *scratesd[4] = {"2-3R", "2-3L", "2-3L", "2-3R"}; - Int_t slotf[4] = { 2, 2, 10, 10}; - Int_t slotd[4] = { 1, 1, 9, 9}; + /// FILL INPUTS + /// + + TIter next(digitStore.CreateTriggerIterator()); + AliMUONVDigit* mdig; + + while ( ( mdig = static_cast(next()) ) ) + { + // CHECKME ! The TrackCharge is not ok with new digitizerV3 ! + // for (Int_t ichg=0; ichg<10; ichg++) schg += mdig->TrackCharge(ichg); + Int_t ichamber = AliMpDEManager::GetChamberId(mdig->DetElemId()); + Int_t schg = (Int_t)(mdig->Charge() + 0.5); + + // APPLY CONDITION ON SOFT BACKGROUND + Int_t tchg = schg - (Int_t(schg/10))*10; + + if (schg<=10 || tchg>0) + { + Int_t detElemId = mdig->DetElemId(); + Int_t cathode = mdig->Cathode(); + + const AliMpVSegmentation* seg = + AliMpSegmentation::Instance() + ->GetMpSegmentation(detElemId,AliMp::GetCathodType(cathode)); + + Int_t ix = mdig->PadX(), iy = mdig->PadY(); + + AliDebug(3,Form("cathode %d ix %d iy %d ",cathode,ix,iy)); - for (Int_t i=0; i<4; i++) - { - crate = (AliMUONTriggerCrate*)fCrates->FindObject(scratess[i]); - bs = crate->Boards(); - AliMUONLocalTriggerBoard *desybb = (AliMUONLocalTriggerBoard*)bs->At(14); - AliMUONLocalTriggerBoard *fromcb = (AliMUONLocalTriggerBoard*)bs->At(15); - AliMUONLocalTriggerBoard *desxbb = (AliMUONLocalTriggerBoard*)bs->At(16); + AliMpPad pad = seg->PadByIndices(ix,iy,kTRUE); + + for (Int_t i=0; iLocalBoard(nboard); + + if (b) + { + if (cathode && b->GetSwitch(6)) ibitxy += 8; + + b->SetbitM(ibitxy,cathode,ichamber-10); + } + else + { + AliError(Form("Could not get local board number %d",b->GetNumber())); + } + } + } + } - crate = (AliMUONTriggerCrate*)fCrates->FindObject(scratesd[i]); - bs = crate->Boards(); - AliMUONLocalTriggerBoard *frombb = (AliMUONLocalTriggerBoard*)bs->At(slotf[i]); - AliMUONLocalTriggerBoard *desycb = (AliMUONLocalTriggerBoard*)bs->At(slotd[i]); + // Particular case of the columns with 22 local boards (2R(L) 3R(L)) + // fill copy input from mapping instead of hardcoded valued (Ch.F) + AliMUONTriggerCrate *crate = 0x0; TObjArray *bs = 0x0; - UShort_t cX[2]; + for (Int_t i = 0; i < fCopyXInput[0]->GetEntries(); ++i) + { + AliMpIntPair* pair = (AliMpIntPair*)fCopyXInput[0]->At(i); + TString crateFrom = AliMpExMap::GetString(pair->GetFirst()); + Int_t slotFrom = pair->GetSecond(); -// COPY X3-4 FROM BOARD 2 OF CRATE 2-3 TO BOARD 16 OF CRATE 2 -// COPY X3-4 FROM BOARD 10 OF CRATE 2-3 TO BOARD 16 OF CRATE 3 - frombb->GetX34(cX); desxbb->SetX34(cX); + pair = (AliMpIntPair*)fCopyXInput[1]->At(i); + TString crateTo = AliMpExMap::GetString(pair->GetFirst()); + Int_t slotTo = pair->GetSecond(); -// COPY X3-4 FROM BOARD 15 OF CRATE 2 TO BOARD 1 OF CRATE 2-3 -// COPY X3-4 FROM BOARD 15 OF CRATE 3 TO BOARD 9 OF CRATE 2-3 - fromcb->GetX34(cX); desycb->SetX34(cX); + AliDebug(3, Form("copy xInputs from local %s_%d to %s_%d\n", crateFrom.Data(), slotFrom, + crateTo.Data(), slotTo)); - UShort_t cY[4]; + UShort_t cX[2]; + crate = fCrates->Crate(crateFrom); + bs = crate->Boards(); + AliMUONLocalTriggerBoard *fromxb = (AliMUONLocalTriggerBoard*)bs->At(slotFrom); + crate = fCrates->Crate(crateTo); + bs = crate->Boards(); + AliMUONLocalTriggerBoard *desxb = (AliMUONLocalTriggerBoard*)bs->At(slotTo); + fromxb->GetX34(cX); desxb->SetX34(cX); - desybb->GetY(cY); frombb->SetY(cY); - frombb->GetY(cY); desxbb->SetY(cY); - fromcb->GetY(cY); desycb->SetY(cY); - } + } -// FILL UP/DOWN OF CURRENT BOARD (DONE VIA J3 BUS IN REAL LIFE) - for (Int_t i=0; iUncheckedAt(i); - - TObjArray *boards = cr->Boards(); - - for (Int_t j=1; jGetEntries()-1; j++) - { - TObject *o = boards->At(j); + for (Int_t i = 0; i < fCopyYInput[0]->GetEntries(); ++i) + { + AliMpIntPair* pair = (AliMpIntPair*)fCopyYInput[0]->At(i); + TString crateFrom = AliMpExMap::GetString(pair->GetFirst()); + Int_t slotFrom = pair->GetSecond(); + + pair = (AliMpIntPair*)fCopyYInput[1]->At(i); + TString crateTo = AliMpExMap::GetString(pair->GetFirst()); + Int_t slotTo = pair->GetSecond(); + + AliDebug(3, Form("copy yInputs from local %s_%d to %s_%d\n", crateFrom.Data(), slotFrom, + crateTo.Data(), slotTo)); + + UShort_t cY[4]; + crate = fCrates->Crate(crateFrom); + bs = crate->Boards(); + AliMUONLocalTriggerBoard *fromyb = (AliMUONLocalTriggerBoard*)bs->At(slotFrom); + crate = fCrates->Crate(crateTo); + bs = crate->Boards(); + AliMUONLocalTriggerBoard *desyb = (AliMUONLocalTriggerBoard*)bs->At(slotTo); + fromyb->GetY(cY); desyb->SetY(cY); + } + + // FILL UP/DOWN OF CURRENT BOARD (DONE VIA J3 BUS IN REAL LIFE) + AliMUONTriggerCrate* cr; + TIter next2(fCrates->CreateCrateIterator()); + + while ( ( cr = static_cast(next2()) ) ) + { + TObjArray *boards = cr->Boards(); + + for (Int_t j = 1; j < boards->GetEntries()-1; j++) + { + TObject *o = boards->At(j); - if (!o) break; + if (!o) break; - AliMUONLocalTriggerBoard *currboard = (AliMUONLocalTriggerBoard*)o; + AliMUONLocalTriggerBoard *currboard = (AliMUONLocalTriggerBoard*)o; - AliMUONLocalTriggerBoard *neighbour = (AliMUONLocalTriggerBoard*)boards->At(j+1); + AliMUONLocalTriggerBoard *neighbour = (AliMUONLocalTriggerBoard*)boards->At(j+1); - UShort_t cXY[2][4]; + UShort_t cXY[2][4]; - if (j==1) {neighbour->GetXY(cXY); currboard->SetXYU(cXY);} + if (j==1) {neighbour->GetXY(cXY); currboard->SetXYU(cXY);} -// LAST BOARD IN THE CRATE HAS NO UP EXCEPT FOR CRATES 2 & 3 - if (jGetEntries()-2) - { - AliMUONLocalTriggerBoard *nextboard = (AliMUONLocalTriggerBoard*)boards->At(j+2); + // LAST BOARD IN THE CRATE HAS NO UP EXCEPT FOR CRATES 2 & 3 + if (j < boards->GetEntries()-2) + { + AliMUONLocalTriggerBoard *nextboard = (AliMUONLocalTriggerBoard*)boards->At(j+2); - currboard->GetXY(cXY); neighbour->SetXYD(cXY); - nextboard->GetXY(cXY); neighbour->SetXYU(cXY); + currboard->GetXY(cXY); neighbour->SetXYD(cXY); + nextboard->GetXY(cXY); neighbour->SetXYU(cXY); - if (j==boards->GetEntries()-3) {neighbour->GetXY(cXY); nextboard->SetXYD(cXY);} - } - } - } + if (j==boards->GetEntries()-3) {neighbour->GetXY(cXY); nextboard->SetXYD(cXY);} + } + } + } + } + //___________________________________________ void AliMUONTriggerElectronics::Feed(UShort_t pattern[2][4]) { - for (Int_t i=0; iUncheckedAt(i); - - TObjArray *boards = cr->Boards(); - - for (Int_t j=1; jGetEntries(); j++) - { - TObject *o = boards->At(j); - - if (!o) break; - - AliMUONLocalTriggerBoard *board = (AliMUONLocalTriggerBoard*)o; - - board->SetXY(pattern); - } + /// FILL INPUTS + /// + AliMUONTriggerCrate* cr; + TIter next(fCrates->CreateCrateIterator()); + + while ( ( cr = static_cast(next()) ) ) + { + TObjArray *boards = cr->Boards(); + + for (Int_t j = 1; j < boards->GetEntries(); j++) + { + TObject *o = boards->At(j); + + if (!o) break; + + AliMUONLocalTriggerBoard *board = (AliMUONLocalTriggerBoard*)o; + + board->SetXY(pattern); + } } } //___________________________________________ void AliMUONTriggerElectronics::DumpOS() { - for (Int_t i=0;i<234;i++) +/// DUMP IN THE OLD WAY +/// + for (Int_t i= 0; i < 234;i++) { - char name[20]; - BuildName(i,name); + AliMUONLocalTriggerBoard *board = fCrates->LocalBoard(i); - for (Int_t i=0; iUncheckedAt(i); - - TObjArray *boards = cr->Boards(); - - AliMUONLocalTriggerBoard *board = (AliMUONLocalTriggerBoard*)boards->FindObject(name); - - if (board) board->Scan("ALL"); - } + if (board) board->Scan("ALL"); } } //___________________________________________ void AliMUONTriggerElectronics::Scan(Option_t *option) { - for (Int_t i=0; iUncheckedAt(i); - - TObjArray *boards = cr->Boards(); - - for (Int_t j=0; jGetEntries(); j++) - { - TObject *o = boards->At(j); - - TString op = option; - - Bool_t cdtion = kFALSE; - - if (op.Contains("LOCAL")) cdtion = o->IsA() == AliMUONLocalTriggerBoard::Class(); - if (op.Contains("REGIONAL")) cdtion = o->IsA() == AliMUONRegionalTriggerBoard::Class(); - if (op.Contains("GLOBAL")) cdtion = o->IsA() == AliMUONGlobalTriggerBoard::Class(); - - if (!o || !cdtion) continue; - - AliMUONLocalTriggerBoard *board = (AliMUONLocalTriggerBoard*)o; - - board->Scan(); - } - } + /// SCAN + /// + + AliMUONTriggerCrate* cr; + TIter next(fCrates->CreateCrateIterator()); + + while ( ( cr = static_cast(next()) ) ) + { + TObjArray *boards = cr->Boards(); + + for (Int_t j = 0; j < boards->GetEntries(); j++) + { + TObject *o = boards->At(j); + + TString op = option; + + Bool_t cdtion = kFALSE; + + if (op.Contains("LOCAL")) cdtion = o->IsA() == AliMUONLocalTriggerBoard::Class(); + if (op.Contains("REGIONAL")) cdtion = o->IsA() == AliMUONRegionalTriggerBoard::Class(); + if (op.Contains("GLOBAL")) cdtion = o->IsA() == AliMUONGlobalTriggerBoard::Class(); + + if (!o || !cdtion) continue; + + AliMUONLocalTriggerBoard *board = (AliMUONLocalTriggerBoard*)o; + + board->Scan(); + } + } } //___________________________________________ void AliMUONTriggerElectronics::Reset() { - for (Int_t i=0; iCreateCrateIterator()); + while ( ( cr = static_cast(next()) ) ) { - AliMUONTriggerCrate *cr = (AliMUONTriggerCrate*)fCrates->UncheckedAt(i); - TObjArray *boards = cr->Boards(); for (Int_t j=0; jGetEntries(); j++) @@ -599,99 +400,132 @@ void AliMUONTriggerElectronics::Reset() if (b) b->Reset(); } } +} - for (Int_t i=0;i<16;i++) - { - fRegional[i] = 0; - for (Int_t j=0;j<16;j++) fLocal[i][j] = 0; - } - fGlobal = 0; +//_______________________________________________________________________ +void AliMUONTriggerElectronics::LoadMasks(AliMUONCalibrationData* calibData) +{ + /// Load mask from config in CDB + + // Set mask + + AliMUONRegionalTriggerConfig* regionalConfig = calibData->RegionalTriggerConfig(); + if (!regionalConfig) + AliWarning("No valid regional trigger configuration in CDB"); + + + AliMUONTriggerCrate* cr; + TIter next(fCrates->CreateCrateIterator()); + + Int_t irb(0); + + while ( ( cr = static_cast(next()) ) ) + { + TObjArray *boards = cr->Boards(); + + AliMUONRegionalTriggerBoard *regb = (AliMUONRegionalTriggerBoard*)boards->At(0); + + AliMUONTriggerCrateConfig* crateConfig = regionalConfig->FindTriggerCrate(cr->GetName()); + + if (!crateConfig) + { + AliError(Form("Crate %s not present in configuration !!!", cr->GetName())); + return; + } + + UShort_t rmask= crateConfig->GetMask(); + + regb->Mask(rmask); + + for (Int_t j = 1; j < boards->GetEntries(); j++) + { + AliMUONLocalTriggerBoard *b = (AliMUONLocalTriggerBoard*)boards->At(j); + + Int_t cardNumber = b->GetNumber(); + + if (cardNumber) // interface board are not interested + { + AliMUONVCalibParam* localBoardMasks = calibData->LocalTriggerBoardMasks(cardNumber); + for ( Int_t i = 0; i < localBoardMasks->Size(); ++i ) + { + UShort_t lmask = static_cast(localBoardMasks->ValueAsInt(i) & 0xFFFF); + b->Mask(i,lmask); + } + } + } + ++irb; + } + + AliMUONGlobalCrateConfig * globalConfig = calibData->GlobalTriggerCrateConfig(); + if (!globalConfig) + AliWarning("No valid trigger crate configuration in CDB"); + + UInt_t gmask = 0; + for (Int_t i = 0; i < 4; i++) { + gmask = globalConfig->GetGlobalMask(i); + fGlobalTriggerBoard->Mask(i,gmask); + } } //___________________________________________ void AliMUONTriggerElectronics::LocalResponse() { -// INTERFACE BOARDS - struct crates_t - { - TString name; - Int_t slots[5]; - Int_t ns; - } crate[6]; - - crate[0].name = "2R"; crate[0].ns = 1; crate[0].slots[0] = 16; - crate[1].name = "2L"; crate[1].ns = 1; crate[1].slots[0] = 16; - crate[2].name = "3L"; crate[2].ns = 1; crate[2].slots[0] = 16; - crate[3].name = "3R"; crate[3].ns = 1; crate[3].slots[0] = 16; - crate[4].name = "2-3R"; crate[4].ns = 2; crate[4].slots[0] = 1; crate[4].slots[1] = 9; - crate[5].name = "2-3L"; crate[5].ns = 2; crate[5].slots[0] = 1; crate[5].slots[1] = 9; +/// Compute the response for local cards - for (Int_t i=0; iCreateCrateIterator()); + + while ( ( cr = static_cast(next()) ) ) + { + + TObjArray *boards = cr->Boards(); + + AliMUONRegionalTriggerBoard *regb = (AliMUONRegionalTriggerBoard*)boards->At(0); + + UShort_t thisl[16]; for (Int_t j=0; j<16; j++) thisl[j] = 0; + + for (Int_t j = 1; j < boards->GetEntries(); j++) + { + TObject *o = boards->At(j); - AliMUONTriggerCrate *cr = (AliMUONTriggerCrate*)fCrates->UncheckedAt(i); - - for (Int_t icr=0; icr<6; icr++) - { - const char *n = (crate[icr].name).Data(); - - AliMUONTriggerCrate *dcr = (AliMUONTriggerCrate*)fCrates->FindObject(n); - -// THIS CRATE CONTAINS AN INTERFACE BOARD - if ( dcr && !strcmp(cr->GetName(),dcr->GetName()) ) iib = icr; - } - - TObjArray *boards = cr->Boards(); - - AliMUONRegionalTriggerBoard *regb = (AliMUONRegionalTriggerBoard*)boards->At(0); - - for (Int_t j=1; jGetEntries(); j++) - { - TObject *o = boards->At(j); - - if (!o) break; - - AliMUONLocalTriggerBoard *board = (AliMUONLocalTriggerBoard*)o; - - if (board) - { - board->Response(); + if (!o) break; + + AliMUONLocalTriggerBoard *board = (AliMUONLocalTriggerBoard*)o; + + if (board) // check if empty slot + { + board->Response(); - fLocal[i][j-1] = board->GetResponse(); - -// CRATE CONTAINING INTERFACE BOARD - if ( iib>-1 ) - { - for (Int_t iid = 0; iidGetName(),j,cr->GetName())); - } - } - } - } - - UShort_t thisl[16]; for (Int_t j=0; j<16; j++) thisl[j] = 0; - - for (Int_t j=1; jGetEntries(); j++) thisl[j] = fLocal[i][j-1]; - - regb->SetLocalResponse(thisl); + UShort_t response = board->GetResponse(); + + // CRATE CONTAINING INTERFACE BOARD + if (board->GetNumber() == 0) // copy boards + { + if ( response != 0 ) + AliWarning(Form("Interface board %s in slot %d of crate %s has a non zero response", + board->GetName(),j,cr->GetName())); + AliDebug(1, Form("local slot %d, number %d in crate %s\n", j, board->GetNumber(), cr->GetName())); + + } + + thisl[j-1] = response; + } } - } + + regb->SetLocalResponse(thisl); + } } //___________________________________________ void AliMUONTriggerElectronics::RegionalResponse() { - for (Int_t i=0; iUncheckedAt(i); - + /// Compute the response for all regional cards. + AliMUONTriggerCrate* cr; + TIter next(fCrates->CreateCrateIterator()); + + while ( ( cr = static_cast(next()) ) ) + { TObjArray *boards = cr->Boards(); AliMUONRegionalTriggerBoard *regb = (AliMUONRegionalTriggerBoard*)boards->At(0); @@ -699,8 +533,6 @@ void AliMUONTriggerElectronics::RegionalResponse() if (regb) { regb->Response(); - - fRegional[i] = regb->GetResponse(); } } } @@ -708,255 +540,150 @@ void AliMUONTriggerElectronics::RegionalResponse() //___________________________________________ void AliMUONTriggerElectronics::GlobalResponse() { - fGlobalTriggerBoard->SetRegionalResponse(fRegional); - - fGlobalTriggerBoard->Response(); - - fGlobal = fGlobalTriggerBoard->GetResponse(); -} - -//___________________________________________ -void AliMUONTriggerElectronics::BoardName(Int_t ix, Int_t iy, char *name) -{ - TString s = (ix>0) ? "R" : "L"; - - Int_t board = iy / 16, bid[4] = {12,34,56,78}; - - ix = abs(ix); - - Int_t line = ix / 10, column = ix - 10 * line; - -// old scheme: line==1 is line==9 - line -= 9; line = TMath::Abs(line); line++; - - sprintf(name,"%sC%dL%dB%d", s.Data(), column, line, bid[board]); - - AliDebug(3, Form("Strip ( %d , %d ) connected to board %s ", ix, iy, name)); -} - -//___________________________________________ -void AliMUONTriggerElectronics::AddCrate(char *name) -{ - TClonesArray &lcrates = *fCrates; - new(lcrates[fNCrates++]) AliMUONTriggerCrate(name,17); -} - -//___________________________________________ -AliMUONTriggerCrate* AliMUONTriggerElectronics::Crate(char *name) -{ - return (AliMUONTriggerCrate*)fCrates->FindObject(name); -} - -//___________________________________________ -void AliMUONTriggerElectronics::BuildName(Int_t icirc, char name[20]) -{ - const Int_t CircuitId[234] = - { - 111, 121, 131, 141, 151, 161, 171, - 211, 212, 221, 222, 231, 232, 241, 242, 251, 252, 261, 262, 271, - 311, 312, 321, 322, 331, 332, 341, 342, 351, 352, 361, 362, 371, - 411, 412, 413, 421, 422, 423, 424, 431, 432, 433, 434, 441, 442, 451, 452, 461, 462, 471, - 521, 522, 523, 524, 531, 532, 533, 534, 541, 542, 551, 552, 561, 562, 571, - 611, 612, 613, 621, 622, 623, 624, 631, 632, 633, 634, 641, 642, 651, 652, 661, 662, 671, - 711, 712, 721, 722, 731, 732, 741, 742, 751, 752, 761, 762, 771, - 811, 812, 821, 822, 831, 832, 841, 842, 851, 852, 861, 862, 871, - 911, 921, 931, 941, 951, 961, 971, - -111, -121, -131, -141, -151, -161, -171, - -211, -212, -221, -222, -231, -232, -241, -242, -251, -252, -261, -262, -271, - -311, -312, -321, -322, -331, -332, -341, -342, -351, -352, -361, -362, -371, - -411, -412, -413, -421, -422, -423, -424, -431, -432, -433, -434, -441, -442, -451, -452, -461, -462, -471, - -521, -522, -523, -524, -531, -532, -533, -534, -541, -542, -551, -552, -561, -562, -571, - -611, -612, -613, -621, -622, -623, -624, -631, -632, -633, -634, -641, -642, -651, -652, -661, -662, -671, - -711, -712, -721, -722, -731, -732, -741, -742, -751, -752, -761, -762, -771, - -811, -812, -821, -822, -831, -832, -841, -842, -851, -852, -861, -862, -871, - -911, -921, -931, -941, -951, -961, -971 - }; - - Int_t b[4] = {12, 34, 56, 78}; - - Int_t code = TMath::Abs(CircuitId[icirc]); - - Int_t L = code / 100; - - Int_t C = ( code - 100 * L ) / 10; - - Int_t B = code - 100 * L - 10 * C; - - const char *Side = (CircuitId[icirc]>0) ? "R" : "L"; - -// L=1 AT TOP - L -= 9; L = abs(L); L++; - - sprintf(name,"%sC%dL%dB%d",Side,C,L,b[B-1]); -} - -//_______________________________________________________________________ -void -AliMUONTriggerElectronics::Exec(Option_t*) -{ - Digits2Trigger(); -} - -//_______________________________________________________________________ -void AliMUONTriggerElectronics::Trigger() -{ - FeedM(); - LocalResponse(); - RegionalResponse(); - GlobalResponse(); -} -/* -//_______________________________________________________________________ -void AliMUONTriggerElectronics::DisableCrate(Int_t icrate) -{ - fRegional[icrate] = 0; -} + /// Compute the global response + + UShort_t regional[16]; + + AliMUONTriggerCrate* cr; + Int_t irb(0); + + if ( !fCrates->NumberOfCrates() >= 16 ) + { + AliFatal(Form("Something is wrong : too many crates %d", + fCrates->NumberOfCrates())); + } -//_______________________________________________________________________ -void AliMUONTriggerElectronics::DisableCrate(char *Name) -{ - Int_t icrate; - - for (Int_t i=0; iUncheckedAt(i); - if (strcmp(cr->GetName(),Name) ) - continue; - else - { - icrate = i; - break; - } - } + // send regional responses to the global trigger in right order + // do not used iterator order + + for (Int_t iSide = 0; iSide < 2; iSide++) // right & left side + { + for (Int_t iReg = 0; iReg < 8; iReg++) // 8 crates/regional boards for each side. + { + cr = fCrates->Crate(iSide, iReg); + + AliMUONTriggerBoard* rb = + static_cast(cr->Boards()->At(0)); + regional[irb] = rb->GetResponse(); + ++irb; + } + } - fRegional[icrate] = 0; + fGlobalTriggerBoard->SetRegionalResponse(regional); + fGlobalTriggerBoard->Response(); } //_______________________________________________________________________ -void AliMUONTriggerElectronics::DisableBoardInCrate(Int_t icrate, Int_t islot) -{ -// BEWARE, REGIONAL BOARD IS IN SLOT 0 - fLocal[icrate][islot] = 0; -} -*/ -//_______________________________________________________________________ -void AliMUONTriggerElectronics::Digits2Trigger() +void AliMUONTriggerElectronics::Digits2Trigger(const AliMUONVDigitStore& digitStore, + AliMUONVTriggerStore& triggerStore) { - ClearDigitNumbers(); - - fMUONData->ResetTrigger(); - -// RUN THE FULL BEE CHAIN - Trigger(); -// DumpOS(); + /// Main method to go from digits to trigger decision + AliMUONRegionalTrigger pRegTrig; + + triggerStore.Clear(); + + // RUN THE FULL BEE CHAIN + Feed(digitStore); + LocalResponse(); + RegionalResponse(); + GlobalResponse(); + // DumpOS(); - for (Int_t i=0; iUncheckedAt(i); - + AliMUONTriggerCrate* cr; + AliMUONLocalTrigger localTrigger; + + // stored in right order + // do not used iterator order + + for (Int_t iSide = 0; iSide < 2; iSide++) // right & left side + { + for (Int_t iReg = 0; iReg < 8; iReg++) // 8 crates/regional boards for each side. + { + cr = fCrates->Crate(iSide, iReg); TObjArray *boards = cr->Boards(); - - for (Int_t j=1; jGetEntries(); j++) + + UInt_t regInpLpt = 0; + UInt_t regInpHpt = 0; + + AliMUONRegionalTriggerBoard *regBoard = (AliMUONRegionalTriggerBoard*)boards->At(0); + + for (Int_t j = 1; j < boards->GetEntries(); j++) { - TObject *o = boards->At(j); - - if (!o) break; - - AliMUONLocalTriggerBoard *board = (AliMUONLocalTriggerBoard*)o; - - if (board) - { -// L0 TRIGGER - if (board->Triggered()) - { - Int_t localtr[15] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ,0}; - - Int_t icirc = board->GetI(); - - localtr[0] = icirc; - localtr[1] = board->GetStripX11(); - localtr[2] = board->GetDev(); - localtr[3] = board->GetStripY11(); - -// SAVE LUT OUTPUT - localtr[4] = (fLocal[i][j-1] & 12) >> 2; - localtr[5] = (fLocal[i][j-1] & 48) >> 4; - localtr[6] = (fLocal[i][j-1] & 3); - -// SAVE BIT PATTERN - localtr[7] = board->GetXY(0,0); - localtr[8] = board->GetXY(0,1); - localtr[9] = board->GetXY(0,2); - localtr[10] = board->GetXY(0,3); - - localtr[11] = board->GetXY(1,0); - localtr[12] = board->GetXY(1,1); - localtr[13] = board->GetXY(1,2); - localtr[14] = board->GetXY(1,3); - -// ADD A NEW LOCAL TRIGGER - AliMUONLocalTrigger *pLocTrig = new AliMUONLocalTrigger(localtr, fDigitNumbers[icirc]); - - fMUONData->AddLocalTrigger(*pLocTrig); - } - } + TObject *o = boards->At(j); + + if (!o) break; + + AliMUONLocalTriggerBoard *board = (AliMUONLocalTriggerBoard*)o; + + if (board) + { + // L0 TRIGGER + // pcrochet 181206: MOOD needs ALL boards + // if (board->Triggered()) + // { + + Int_t icirc = board->GetNumber(); + if (icirc != 0) { // pcrochet 181206: MOOD needs ALL boards + + localTrigger.SetLoCircuit(icirc); + localTrigger.SetLoStripX(board->GetStripX11()); + localTrigger.SetLoDev(board->GetDev()); + localTrigger.SetLoSdev(board->GetSdev()); + localTrigger.SetLoTrigY(board->GetTrigY()); + localTrigger.SetLoStripY(board->GetStripY11()); + + // SAVE LUT OUTPUT + UShort_t response = board->GetResponse(); + localTrigger.SetLoHpt((response & 12) >> 2); + localTrigger.SetLoLpt(response & 3); + + // calculates regional inputs from local for the moment + UInt_t hPt = (response >> 2) & 0x3; + UInt_t lPt = response & 0x3; + + regInpHpt |= hPt << (30 - (j-1)*2); + regInpLpt |= lPt << (30 - (j-1)*2); + + TBits rrr; + rrr.Set(6,&response); + + // SAVE BIT PATTERN + localTrigger.SetX1Pattern(board->GetXY(0,0)); + localTrigger.SetX2Pattern(board->GetXY(0,1)); + localTrigger.SetX3Pattern(board->GetXY(0,2)); + localTrigger.SetX4Pattern(board->GetXY(0,3)); + + localTrigger.SetY1Pattern(board->GetXY(1,0)); + localTrigger.SetY2Pattern(board->GetXY(1,1)); + localTrigger.SetY3Pattern(board->GetXY(1,2)); + localTrigger.SetY4Pattern(board->GetXY(1,3)); + + // ADD A NEW LOCAL TRIGGER + triggerStore.Add(localTrigger); + + } + } + } + pRegTrig.SetId(iReg + 8*iSide); + pRegTrig.SetLocalOutput(regInpLpt, 0); + pRegTrig.SetLocalOutput(regInpHpt, 1); + pRegTrig.SetOutput(regBoard->GetResponse()); + + triggerStore.Add(pRegTrig); } - } - -// GLOBAL TRIGGER INFORMATION: [0] -> LOW PT -// [1] -> HIGH PT -// [2] -> ALL PT - Int_t GlobalSinglePlus[3], GlobalSingleMinus[3], GlobalSingleUndef[3]; - Int_t GlobalPairUnlike[3], GlobalPairLike[3]; - - GlobalPairUnlike[0] = (fGlobal & 16) >> 4; - GlobalPairUnlike[1] = (fGlobal & 256) >> 8; - GlobalPairUnlike[2] = (fGlobal & 1); - - GlobalPairLike[0] = (fGlobal & 32) >> 5; - GlobalPairLike[1] = (fGlobal & 512) >> 9; - GlobalPairLike[2] = (fGlobal & 2) >> 1; - - GlobalSinglePlus[0] = ((fGlobal & 192) >> 6) == 2; - GlobalSinglePlus[1] = ((fGlobal & 3072) >> 10) == 2; - GlobalSinglePlus[2] = ((fGlobal & 12) >> 2) == 2; - - GlobalSingleMinus[0] = ((fGlobal & 192) >> 6) == 1; - GlobalSingleMinus[1] = ((fGlobal & 3072) >> 10) == 1; - GlobalSingleMinus[2] = ((fGlobal & 12) >> 2) == 1; - - GlobalSingleUndef[0] = ((fGlobal & 192) >> 6) == 3; - GlobalSingleUndef[1] = ((fGlobal & 3072) >> 10) == 3; - GlobalSingleUndef[2] = ((fGlobal & 12) >> 2) == 3; - - AliMUONGlobalTrigger *pGloTrig = new AliMUONGlobalTrigger(GlobalSinglePlus, GlobalSingleMinus, - GlobalSingleUndef, GlobalPairUnlike, - GlobalPairLike); - -// ADD A LOCAL TRIGGER IN THE LIST - fMUONData->AddGlobalTrigger(*pGloTrig); - -// NOW RESET ELECTRONICS - Reset(); + } + + // GLOBAL TRIGGER INFORMATION + UShort_t global = fGlobalTriggerBoard->GetResponse(); + UInt_t *globalInput = fGlobalTriggerBoard->GetGlobalInput(); + + AliMUONGlobalTrigger globalTrigger; + + globalTrigger.SetFromGlobalResponse(global); + globalTrigger.SetFromGlobalInput(globalInput); + // ADD A LOCAL TRIGGER IN THE LIST + triggerStore.SetGlobal(globalTrigger); + + // NOW RESET ELECTRONICS + Reset(); } - -//_______________________________________________________________________ -void AliMUONTriggerElectronics::ClearDigitNumbers() -{ -// RESET fDigitNumbers - for (Int_t i=0; i