/************************************************************************** * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * * * Author: The ALICE Off-line Project. * * Contributors are mentioned in the code where appropriate. * * * * Permission to use, copy, modify and distribute this software and its * * documentation strictly for non-commercial purposes is hereby granted * * without fee, provided that the above copyright notice appears in all * * copies and that both the copyright notice and this permission notice * * appear in the supporting documentation. The authors make no claims * * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ /* $Id$ */ //----------------------------------------------------------------------------- /// \class AliMUONGlobalTriggerBoard /// Global trigger implementation: /// - inputs are regional responses /// - output is a 12-bit word /// - 4 bits per trigger level /// /// \author Rachid Guernane (LPCCFd), /// Corrected by Christian Finck (Subatech) //----------------------------------------------------------------------------- #include "AliMUONGlobalTriggerBoard.h" #include "AliLog.h" #include "TBits.h" #include /// \cond CLASSIMP ClassImp(AliMUONGlobalTriggerBoard) /// \endcond //___________________________________________ AliMUONGlobalTriggerBoard::AliMUONGlobalTriggerBoard(): AliMUONTriggerBoard() { /// Default constructor for (Int_t i=0;i<16;i++) fRegionalResponse[i] = 0; for (Int_t i=0;i< 4;i++) fGlobalInput[i] = 0; for (Int_t i=0;i< 4;i++) fMask[i] = 0xffffffff; } //___________________________________________ AliMUONGlobalTriggerBoard::AliMUONGlobalTriggerBoard(const char *name, Int_t a) : AliMUONTriggerBoard(name, a) { /// Standard constructor for (Int_t i=0;i<16;i++) fRegionalResponse[i] = 0; for (Int_t i=0;i< 4;i++) fGlobalInput[i] = 0; for (Int_t i=0;i< 4;i++) fMask[i] = 0xffffffff; } //___________________________________________ AliMUONGlobalTriggerBoard::~AliMUONGlobalTriggerBoard() { /// Destructor } //___________________________________________ void AliMUONGlobalTriggerBoard::Mask(Int_t index, UInt_t mask) { /// mask global trigger board input index with value mask if ( index >= 0 && index < 4 ) { fMask[index]=mask; } else { AliError(Form("Index %d out of bounds (max %d)",index,3)); } } //___________________________________________ void AliMUONGlobalTriggerBoard::Response() { /// compute the global trigger board /// response according to the algo() method // output from global trigger algorithm // [+, -, US, LS] * [Hpt, Lpt] // transformed to [usHpt, usLpt, lsHpt, lsLpt, sHpt, sLpt] according // to Global Trigger Unit user manual Int_t t[16]; BuildGlobalInput(); MaskGlobalInput(); for (Int_t i = 0; i < 16; ++i) { t[i] = fRegionalResponse[i]; } Int_t rank = 8; for (Int_t i=0;i<4;i++) { Int_t ip = 0; for (Int_t j=0;j> 4) << (4*iReg); } else { // left // Lpt word fGlobalInput[1] |= (regRespInv & 0x0F) << (4*(iReg-8)); // Hpt word fGlobalInput[3] |= ((regRespInv & 0xF0) >> 4) << (4*(iReg-8)); } } } //___________________________________________ void AliMUONGlobalTriggerBoard::MaskGlobalInput() { /// Apply masks to global input and recalculate regional inputs before /// applying the global response UInt_t gitmp[4]; for (Int_t i = 0; i < 4; i++) { fGlobalInput[i] &= fMask[i]; gitmp[i] = fGlobalInput[i]; } RecomputeRegional(gitmp); } //___________________________________________ void AliMUONGlobalTriggerBoard::RecomputeRegional(UInt_t gitmp[4]) { // /// Recomput regional response from global input // for (Int_t iReg = 0; iReg < 16; iReg++) { fRegionalResponse[iReg] = 0; if (iReg < 8) { // right // Lpt fRegionalResponse[iReg] |= (gitmp[0] >> (4*iReg)) & 0xF; // Hpt fRegionalResponse[iReg] |= ((gitmp[2] >> (4*iReg)) & 0xF) << 4; } else { // left // Lpt fRegionalResponse[iReg] |= (gitmp[1] >> (4*(iReg-8))) & 0xF; // Hpt fRegionalResponse[iReg] |= ((gitmp[3] >> (4*(iReg-8))) & 0xF) << 4; } fRegionalResponse[iReg] = InvertPairBits(iReg); } } //___________________________________________ void AliMUONGlobalTriggerBoard::Scan(Option_t*) const { /// print global trigger output TBits w(7); w.Set(7,&fResponse); // TRG[1:0] // 00 noth // 01 negative track // 10 positive track // 11 undef Int_t iS[2] = {0,0}; iS[0] = (Int_t)w.TestBitNumber(1); iS[1] = (Int_t)w.TestBitNumber(2); Int_t iPU[2] = {w[5],w[6]}; Int_t iPL[2] = {w[3],w[4]}; printf("============================================\n"); printf(" Global Trigger output Low pt High pt\n"); printf(" number of Single :\t"); for (Int_t i=0; i<2; i++) printf("%i\t",iS[i]); printf("\n"); printf(" number of UnlikeSign pair :\t"); for (Int_t i=0; i<2; i++) printf("%i\t",iPU[i]); printf("\n"); printf(" number of LikeSign pair :\t"); for (Int_t i=0; i<2; i++) printf("%i\t",iPL[i]); printf("\n"); printf("===================================================\n"); printf("\n"); } //___________________________________________ UShort_t AliMUONGlobalTriggerBoard::InvertPairBits(Int_t iReg) { // /// invert "pair" bits in regional response /// [+, -, US, LS] becomes [+, -, LS, US] // TBits rs(8), rsi(8); rs.Set(8,&fRegionalResponse[iReg]); for (Int_t i = 0; i < 4; i++) { if (i%2 == 0) { rsi[2*i] = rs[2*i+1]; rsi[2*i+1] = rs[2*i]; } else { rsi[2*i] = rs[2*i]; rsi[2*i+1] = rs[2*i+1]; } } UShort_t regRespInv = 0; rsi.Get(®RespInv); return regRespInv; }