Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:22:01

0001 //-------------------------------------------------
0002 //
0003 /**  \class DTTracoChip
0004  *
0005  *   Implementation of TRACO trigger algorithm.
0006  *   Internally uses DTTracoCand to store BTI triggers
0007  *
0008  *
0009  *
0010  *   \author S. Vanini
0011  */
0012 //
0013 //--------------------------------------------------
0014 #ifndef DT_TRACO_CHIP_H
0015 #define DT_TRACO_CHIP_H
0016 
0017 //-------------------
0018 // Constants file  --
0019 //-------------------
0020 #include "L1Trigger/DTBti/interface/DTBtiTrigData.h"
0021 #include "L1Trigger/DTTraco/interface/Lut.h"
0022 #include "L1TriggerConfig/DTTPGConfig/interface/DTConfig.h"
0023 
0024 //------------------------------------
0025 // Collaborating Class Declarations --
0026 //------------------------------------
0027 class DTTracoCard;
0028 class DTBtiTrigData;
0029 class DTTracoCand;
0030 class DTTracoTrig;
0031 class DTTracoTrigData;
0032 
0033 //----------------------
0034 // Base Class Headers --
0035 //----------------------
0036 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0037 #include "DataFormats/GeometryVector/interface/LocalPoint.h"
0038 #include "DataFormats/MuonDetId/interface/DTTracoId.h"
0039 #include "L1Trigger/DTTraco/interface/DTTracoLUTs.h"
0040 #include "L1Trigger/DTUtilities/interface/DTTrigGeom.h"
0041 #include "L1TriggerConfig/DTTPGConfig/interface/BitArray.h"
0042 #include "L1TriggerConfig/DTTPGConfig/interface/DTConfigTraco.h"
0043 
0044 //---------------
0045 // C++ Headers --
0046 //---------------
0047 #include <vector>
0048 
0049 //              ---------------------
0050 //              -- Class Interface --
0051 //              ---------------------
0052 
0053 class DTTracoChip {
0054 public:
0055   /// Constructor
0056   // DTTracoChip(DTTracoCard* card, int n);
0057 
0058   /// Constructor for passing configuration
0059   DTTracoChip(DTTracoCard *card, int n, DTConfigTraco *config);
0060 
0061   /// Copy constructor
0062   DTTracoChip(const DTTracoChip &traco);
0063 
0064   /// Destructor
0065   ~DTTracoChip();
0066 
0067   /// Assignment operator
0068   DTTracoChip &operator=(const DTTracoChip &traco);
0069 
0070   /// Add a BTI trigger to the TRACO
0071   void add_btiT(int step, int pos, const DTBtiTrigData *btitrig);
0072 
0073   /// Add a TRACO trigger
0074   void addTrig(int step, DTTracoTrig *);
0075 
0076   /// Set the preview values for a TRACO trigger
0077   void setPV(int step, int ntrk, int code, int K);
0078 
0079   /// Calculate trigger angles
0080   void calculateAngles(DTTracoTrig *);
0081 
0082   /// Run TRACO algorithm
0083   void run();
0084 
0085   /// Clear
0086   void clear();
0087 
0088   /// Return TRACO number
0089   inline int number() const { return _id.traco(); }
0090 
0091   /// raise overlap flag
0092   void raiseOverlap(int step);
0093 
0094   /// Return trigger geometry
0095   inline DTTrigGeom *geom() const { return _geom; }
0096 
0097   /// Return TRACO id
0098   inline DTTracoId id() const { return _id; }
0099 
0100   /// Return wheel number
0101   inline int wheel() const { return _geom->wheel(); }
0102 
0103   /// Return station number
0104   inline int station() const { return _geom->station(); }
0105 
0106   /// Return sector number
0107   inline int sector() const { return _geom->sector(); }
0108 
0109   /// Configuration set
0110   // inline DTConfig* config() const { return _geom->config(); }
0111 
0112   /// New Configuration set
0113   inline DTConfigTraco *config() const { return _config; }
0114 
0115   /// Radial angle of correlator center in mrad referred to plane sl
0116   float psiRad(int sl = 0) const;
0117 
0118   /// K par of the radial angle of corr center referred to plane sl
0119   int KRad() const;
0120   // int KRad(int sl=0) const;
0121 
0122   /// BTIC parameter
0123   int BTIC() const { return _btic; }
0124 
0125   /// IBTIOFF parameter
0126   int IBTIOFF() const { return _ibtioff; }
0127 
0128   /// DD parameter
0129   int DD() const { return _dd; }
0130 
0131   /// Return the number of trigger candidates
0132   int nTrig(int step) const;
0133 
0134   /// Return the requested trigger
0135   DTTracoTrig *trigger(int step, unsigned n) const;
0136 
0137   /// Return the data part of the requested trigger
0138   DTTracoTrigData triggerData(int step, unsigned n) const;
0139 
0140   /// a flag for a usable second track
0141   int useSecondTrack(int step) const;
0142 
0143   /// flags for HTRIG in edge BTI
0144   int edgeBTI(int step, int io, int lr) const;
0145 
0146   /// Position in chamber frame
0147   LocalPoint localPosition() const { return _geom->localPosition(_id); }
0148 
0149   /// Position in CMS frame
0150   GlobalPoint CMSPosition() const { return _geom->CMSPosition(_id); }
0151 
0152   /// Set flags for multiple trigger detection between cons. TRACO's
0153   void setFlag(int step, int ext = 0);
0154 
0155   /// return overlap flag
0156   inline int ovlFlag(int step) { return _flag[step - DTConfigTraco::NSTEPF].element(1); }
0157 
0158 private:
0159   /// Get the best inner/outer candidate
0160   DTTracoCand *bestCand(int itk, std::vector<DTTracoCand> &tclist);
0161 
0162   /// Set the preview for a trigger
0163   DTTracoTrig *setPV(int itk, DTTracoCand *inner, DTTracoCand *outer);
0164 
0165   /// Do suppression of LTRIG on BTI close to selected HTRIG
0166   void DoAdjBtiLts(DTTracoCand *candidate, std::vector<DTTracoCand> &tclist);
0167 
0168   /// Do suppression of LTRIG on adjacent TRACO
0169   int AdjBtiLTSuppressed(DTTracoCand *candidate);
0170 
0171   /// Check correlation and store correlated trigger
0172   int storeCorr(DTTracoTrig *tctrig, DTTracoCand *inner, DTTracoCand *outer, int tkn);
0173 
0174   /// Store uncorrelated trigger
0175   int storeUncorr(DTTracoTrig *tctrig, DTTracoCand *inner, DTTracoCand *outer, int tkn);
0176 
0177   /// Check if a trigger is inside the angular acceptance window
0178   int insideAngWindow(DTTracoTrig *) const;
0179 
0180   /// Compute traco chip acceptances
0181   void setTracoAcceptances();
0182 
0183 private:
0184   // identification
0185   DTTrigGeom *_geom;
0186   DTTracoId _id;
0187   // parent card
0188   DTTracoCard *_card;
0189   // config
0190   DTConfigTraco *_config;
0191 
0192   int _krad;
0193   int _btic;
0194   int _ibtioff;
0195   int _dd;
0196 
0197   // input data
0198   std::vector<DTTracoCand> _innerCand[DTConfigTraco::NSTEPL - DTConfigTraco::NSTEPF + 1];
0199   std::vector<DTTracoCand> _outerCand[DTConfigTraco::NSTEPL - DTConfigTraco::NSTEPF + 1];
0200 
0201   // output data
0202   std::vector<DTTracoTrig *> _tracotrig[DTConfigTraco::NSTEPL - DTConfigTraco::NSTEPF + 1];
0203 
0204   // internal use variables: SV 11V04 lts suppression if to bx+1, bx=array index
0205   BitArray<DTConfigTraco::NSTEPL + 2> _bxlts;
0206   // *** FOR TESTBEAM DATA  *** SV from input data instead from card!
0207   // 1: overlap with II track from bx-1)
0208   // 2: II track rej.
0209   // 3...8: IL,IR,OL,OR,th,th
0210   // 9: H present in traco at bx
0211   BitArray<32> _flag[DTConfigTraco::NSTEPL - DTConfigTraco::NSTEPF + 1];
0212 
0213   // psi acceptance of correlator MT ports
0214   int _PSIMIN[4 * DTConfig::NBTITC];
0215   int _PSIMAX[4 * DTConfig::NBTITC];
0216 
0217   // LUT file class
0218   DTTracoLUTs *_luts;
0219 
0220   Lut *_lutsCCB;
0221 };
0222 
0223 #endif