CMS 3D CMS Logo

CSCAnodeLCTProcessor Class Reference

This class simulates the functionality of the anode LCT card. More...

#include <L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.h>

List of all members.

Public Types

enum  { MAX_ALCT_BINS = 16 }
 Maximum number of time bins reported in the ALCT readout. More...
enum  { NUM_PATTERN_WIRES = 14 }
 Pre-defined patterns. More...

Public Member Functions

void clear ()
 Clears the LCT containers.
 CSCAnodeLCTProcessor ()
 Default constructor.
 CSCAnodeLCTProcessor (unsigned endcap, unsigned station, unsigned sector, unsigned subsector, unsigned chamber, const edm::ParameterSet &conf, const edm::ParameterSet &comm)
 Normal constructor.
std::vector< CSCALCTDigigetALCTs ()
 Returns vector of found ALCTs, if any.
bool getDigis (const CSCWireDigiCollection *wiredc)
 Access routine to wire digis.
void run (const std::vector< int > wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES])
 Runs the LCT processor code.
std::vector< CSCALCTDigirun (const CSCWireDigiCollection *wiredc)
 Runs the LCT processor code.
void setConfigParameters (const CSCL1TPParameters *conf)
 Sets configuration parameters obtained via EventSetup mechanism.

Public Attributes

CSCALCTDigi bestALCT [MAX_ALCT_BINS]
 Best LCTs in this chamber, as found by the processor.
CSCALCTDigi secondALCT [MAX_ALCT_BINS]
 Second best LCTs in this chamber, as found by the processor.

Static Public Attributes

static const int pattern_envelope [CSCConstants::NUM_ALCT_PATTERNS][NUM_PATTERN_WIRES]
static const int pattern_mask_default [CSCConstants::NUM_ALCT_PATTERNS][NUM_PATTERN_WIRES]
static const int pattern_mask_MTCC [CSCConstants::NUM_ALCT_PATTERNS][NUM_PATTERN_WIRES]

Private Member Functions

void accelMode (const int key_wire)
std::vector< CSCALCTDigibestTrackSelector (const std::vector< CSCALCTDigi > &all_alcts)
void checkConfigParameters ()
 Make sure that the parameter values are within the allowed range.
void clear (const int wire, const int pattern)
 Clears the quality for a given wire and pattern if it is a ghost.
void dumpConfigParams () const
 Dump ALCT configuration parameters.
void dumpDigis (const std::vector< int > wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]) const
 Dump digis on wire groups.
void ghostCancellationLogic ()
bool isBetterALCT (const CSCALCTDigi &lhsALCT, const CSCALCTDigi &rhsALCT)
void lctSearch ()
bool patternDetection (const int key_wire)
bool preTrigger (const int key_wire, const int start_bx)
bool pulseExtension (const std::vector< int > wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES])
void readWireDigis (std::vector< int > wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES])
 ALCT algorithm methods.
void setDefaultConfigParameters ()
 Set default values for configuration parameters.
void showPatterns (const int key_wire)
void trigMode (const int key_wire)

Private Attributes

unsigned int accel_mode
std::vector< CSCWireDigidigiV [CSCConstants::NUM_LAYERS]
unsigned int drift_delay
unsigned int fifo_pretrig
unsigned int fifo_tbins
 Configuration parameters.
int first_bx [CSCConstants::MAX_NUM_WIRES]
int infoV
 Verbosity level: 0: no print (default).
bool isMTCC
 Flag for MTCC data.
bool isTMB07
 Use TMB07 flag for DAQ-2006 version (implemented in late 2007).
unsigned int l1a_window_width
int MESelection
unsigned int nplanes_hit_accel_pattern
unsigned int nplanes_hit_accel_pretrig
unsigned int nplanes_hit_pattern
unsigned int nplanes_hit_pretrig
int numWireGroups
int pattern_mask [CSCConstants::NUM_ALCT_PATTERNS][NUM_PATTERN_WIRES]
 Chosen pattern mask.
unsigned int pulse [CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]
int quality [CSCConstants::MAX_NUM_WIRES][3]
const unsigned theEndcap
 Chamber id (trigger-type labels).
const unsigned theSector
const unsigned theStation
const unsigned theSubsector
const unsigned theTrigChamber
unsigned int trig_mode

Static Private Attributes

static const unsigned int def_accel_mode = 0
static const unsigned int def_drift_delay = 2
static const unsigned int def_fifo_pretrig = 10
static const unsigned int def_fifo_tbins = 16
 Default values of configuration parameters.
static const unsigned int def_l1a_window_width = 7
static const unsigned int def_nplanes_hit_accel_pattern = 4
static const unsigned int def_nplanes_hit_accel_pretrig = 2
static const unsigned int def_nplanes_hit_pattern = 4
static const unsigned int def_nplanes_hit_pretrig = 2
static const unsigned int def_trig_mode = 2


Detailed Description

This class simulates the functionality of the anode LCT card.

It is run by the MotherBoard and returns up to two AnodeLCTs. It can be run either in a test mode, where it is passed an array of wire times, or in normal mode where it determines the wire times from the wire digis.

Author:
Benn Tannenbaum benn@physics.ucla.edu 13 July 1999 Numerous later improvements by Jason Mumford and Slava Valuev (see cvs in ORCA). Porting from ORCA by S. Valuev (Slava.Valuev@cern.ch), May 2006.
Date
2008/09/10 10:45:20
Revision
1.16

Definition at line 28 of file CSCAnodeLCTProcessor.h.


Member Enumeration Documentation

anonymous enum

Maximum number of time bins reported in the ALCT readout.

Enumerator:
MAX_ALCT_BINS 

Definition at line 58 of file CSCAnodeLCTProcessor.h.

00058 {MAX_ALCT_BINS = 16};

anonymous enum

Pre-defined patterns.

Enumerator:
NUM_PATTERN_WIRES 

Definition at line 74 of file CSCAnodeLCTProcessor.h.

00074 {NUM_PATTERN_WIRES = 14};


Constructor & Destructor Documentation

CSCAnodeLCTProcessor::CSCAnodeLCTProcessor ( unsigned  endcap,
unsigned  station,
unsigned  sector,
unsigned  subsector,
unsigned  chamber,
const edm::ParameterSet conf,
const edm::ParameterSet comm 
)

Normal constructor.

Definition at line 143 of file CSCAnodeLCTProcessor.cc.

References accel_mode, checkConfigParameters(), drift_delay, dumpConfigParams(), fifo_pretrig, fifo_tbins, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), infoV, isMTCC, isTMB07, l1a_window_width, MESelection, nplanes_hit_accel_pattern, nplanes_hit_accel_pretrig, nplanes_hit_pattern, nplanes_hit_pretrig, CSCConstants::NUM_ALCT_PATTERNS, NUM_PATTERN_WIRES, numWireGroups, pattern_mask, pattern_mask_default, pattern_mask_MTCC, theStation, and trig_mode.

00147                                                                         : 
00148                      theEndcap(endcap), theStation(station), theSector(sector),
00149                      theSubsector(subsector), theTrigChamber(chamber) {
00150   static bool config_dumped = false;
00151 
00152   // ALCT configuration parameters.
00153   fifo_tbins   = conf.getParameter<unsigned int>("alctFifoTbins");
00154   fifo_pretrig = conf.getParameter<unsigned int>("alctFifoPretrig");
00155   drift_delay  = conf.getParameter<unsigned int>("alctDriftDelay");
00156   nplanes_hit_pretrig =
00157     conf.getParameter<unsigned int>("alctNplanesHitPretrig");
00158   nplanes_hit_pattern =
00159     conf.getParameter<unsigned int>("alctNplanesHitPattern");
00160   nplanes_hit_accel_pretrig =
00161     conf.getParameter<unsigned int>("alctNplanesHitAccelPretrig");
00162   nplanes_hit_accel_pattern =
00163     conf.getParameter<unsigned int>("alctNplanesHitAccelPattern");
00164   trig_mode        = conf.getParameter<unsigned int>("alctTrigMode");
00165   accel_mode       = conf.getParameter<unsigned int>("alctAccelMode");
00166   l1a_window_width = conf.getParameter<unsigned int>("alctL1aWindowWidth");
00167 
00168   // Verbosity level, set to 0 (no print) by default.
00169   infoV        = conf.getUntrackedParameter<int>("verbosity", 0);
00170 
00171   // Other parameters.
00172   isMTCC       = comm.getParameter<bool>("isMTCC");
00173   // Use TMB07 flag for DAQ-2006 version (implemented in late 2007).
00174   isTMB07      = comm.getParameter<bool>("isTMB07");
00175 
00176   // Check and print configuration parameters.
00177   checkConfigParameters();
00178   if (infoV > 0 && !config_dumped) {
00179     dumpConfigParams();
00180     config_dumped = true;
00181   }
00182 
00183   numWireGroups = 0;
00184   MESelection   = (theStation < 3) ? 0 : 1;
00185 
00186   // Load appropriate pattern mask.
00187   for (int i_patt = 0; i_patt < CSCConstants::NUM_ALCT_PATTERNS; i_patt++) {
00188     for (int i_wire = 0; i_wire < NUM_PATTERN_WIRES; i_wire++) {
00189       if (isMTCC || isTMB07) {
00190         pattern_mask[i_patt][i_wire] = pattern_mask_MTCC[i_patt][i_wire];
00191       }
00192       else {
00193         pattern_mask[i_patt][i_wire] = pattern_mask_default[i_patt][i_wire];
00194       }
00195     }
00196   }
00197 }

CSCAnodeLCTProcessor::CSCAnodeLCTProcessor (  ) 

Default constructor.

Used for testing.

Definition at line 199 of file CSCAnodeLCTProcessor.cc.

References checkConfigParameters(), dumpConfigParams(), infoV, isMTCC, isTMB07, CSCConstants::MAX_NUM_WIRES, MESelection, numWireGroups, setDefaultConfigParameters(), and theStation.

00199                                            :
00200                      theEndcap(1), theStation(1), theSector(1),
00201                      theSubsector(1), theTrigChamber(1) {
00202   // Used for debugging. -JM
00203   static bool config_dumped = false;
00204 
00205   // ALCT parameters.
00206   setDefaultConfigParameters();
00207   infoV = 2;
00208   isMTCC  = true;
00209   isTMB07 = true;
00210 
00211   // Check and print configuration parameters.
00212   checkConfigParameters();
00213   if (!config_dumped) {
00214     dumpConfigParams();
00215     config_dumped = true;
00216   }
00217 
00218   numWireGroups = CSCConstants::MAX_NUM_WIRES;
00219   MESelection   = (theStation < 3) ? 0 : 1;
00220 }


Member Function Documentation

void CSCAnodeLCTProcessor::accelMode ( const int  key_wire  )  [private]

Definition at line 1225 of file CSCAnodeLCTProcessor.cc.

References accel_mode, infoV, LogTrace, and quality.

Referenced by lctSearch().

01225                                                        {
01226   /* Function which gives a preference either to the collision patterns
01227      or accelerator patterns.  The function uses the accel_mode parameter
01228      to decide. */
01229   int promotionBit = 1 << 2;
01230 
01231   switch(accel_mode) {
01232   default:
01233   case 0:
01234     // Ignore accelerator muons.
01235     if (quality[key_wire][0] > 0) {
01236       quality[key_wire][0] = 0;
01237       if (infoV > 1) LogTrace("CSCAnodeLCTProcessor")
01238         << "alctMode(): accelerator track " << key_wire << " ignored" << "\n";
01239     }
01240     break;
01241   case 1:
01242     // Prefer collision muons by adding promotion bit.
01243     if (quality[key_wire][1] > 0) {
01244       quality[key_wire][1] += promotionBit;
01245       if (infoV > 1) LogTrace("CSCAnodeLCTProcessor")
01246         << "alctMode(): collision track " << key_wire << " promoted" << "\n";
01247     }
01248     break;
01249   case 2:
01250     // Prefer accelerator muons by adding promotion bit.
01251     if (quality[key_wire][0] > 0) {
01252       quality[key_wire][0] += promotionBit;
01253       if (infoV > 1) LogTrace("CSCAnodeLCTProcessor")
01254         << "alctMode(): accelerator track " << key_wire << " promoted"<< "\n";
01255     }
01256     break;
01257   case 3:
01258     // Ignore collision muons.
01259     if (quality[key_wire][1] > 0) {
01260       quality[key_wire][1] = 0;
01261       if (infoV > 1) LogTrace("CSCAnodeLCTProcessor")
01262         << "alctMode(): collision track " << key_wire << " ignored" << "\n";
01263     }
01264     break;
01265   }
01266 }

std::vector< CSCALCTDigi > CSCAnodeLCTProcessor::bestTrackSelector ( const std::vector< CSCALCTDigi > &  all_alcts  )  [private]

Definition at line 1011 of file CSCAnodeLCTProcessor.cc.

References fifo_pretrig, CSCALCTDigi::getKeyWG(), CSCALCTDigi::getQuality(), i, infoV, CSCALCTDigi::isValid(), l1a_window_width, LogDebug, LogTrace, and MAX_ALCT_BINS.

Referenced by lctSearch().

01012                                                                           {
01013   /* Selects two collision and two accelerator ALCTs per time bin with
01014      the best quality. */
01015   CSCALCTDigi bestALCTs[MAX_ALCT_BINS][2], secondALCTs[MAX_ALCT_BINS][2];
01016 
01017   static int fpga_latency = 6;
01018   static int early_tbins  = fifo_pretrig - fpga_latency;
01019   // The number of LCT bins is equal to l1a_window_width parameter, but made
01020   // even by setting the LSB of l1a_window_width to 0.
01021   static int lct_bins   = 
01022     (l1a_window_width%2 == 0) ? l1a_window_width : l1a_window_width-1;
01023   static int late_tbins = early_tbins + lct_bins;
01024 
01025   static int ifois = 0;
01026   if (ifois == 0) {
01027     if (infoV > 0 && early_tbins < 0) {
01028       edm::LogWarning("CSCAnodeLCTProcessor")
01029         << "+++ fifo_pretrig = " << fifo_pretrig
01030         << "; you are loosing in-time ALCT hits!!! +++" << "\n";
01031     }
01032 
01033     if (late_tbins > MAX_ALCT_BINS-1) {
01034       if (infoV > 0) edm::LogWarning("CSCAnodeLCTProcessor")
01035         << "+++ Allowed range of time bins, [0-" << late_tbins
01036         << "] exceeds max allowed, " << MAX_ALCT_BINS-1 << " +++\n"
01037         << "+++ Set late_tbins to max allowed +++\n";
01038       late_tbins = MAX_ALCT_BINS-1;
01039     }
01040     ifois = 1;
01041   }
01042 
01043   if (infoV > 1) {
01044     LogTrace("CSCAnodeLCTProcessor") << all_alcts.size() <<
01045       " ALCTs at the input of best-track selector: ";
01046     for (std::vector <CSCALCTDigi>::const_iterator plct = all_alcts.begin();
01047          plct != all_alcts.end(); plct++) {
01048       if (!plct->isValid()) continue;
01049       LogTrace("CSCAnodeLCTProcessor") << (*plct);
01050     }
01051   }
01052 
01053   CSCALCTDigi tA[MAX_ALCT_BINS][2], tB[MAX_ALCT_BINS][2];
01054   for (std::vector <CSCALCTDigi>::const_iterator plct = all_alcts.begin();
01055        plct != all_alcts.end(); plct++) {
01056     if (!plct->isValid()) continue;
01057 
01058     int bx = (*plct).getBX();
01059     // Skip ALCTs found too early relative to L1Accept.
01060     if (bx <= early_tbins) {
01061       if (infoV > 1) LogDebug("CSCAnodeLCTProcessor")
01062         << " Do not report ALCT on keywire " << plct->getKeyWG()
01063         << ": found at bx " << bx << ", whereas the earliest allowed bx is "
01064         << early_tbins+1;
01065       continue;
01066     }
01067 
01068     // Skip ALCTs found too late relative to L1Accept.
01069     if (bx > late_tbins) {
01070       if (infoV > 1) LogDebug("CSCAnodeLCTProcessor")
01071         << " Do not report ALCT on keywire " << plct->getKeyWG()
01072         << ": found at bx " << bx << ", whereas the latest allowed bx is "
01073         << late_tbins;
01074       continue;
01075     }
01076 
01077     // Select two collision and two accelerator ALCTs with the highest
01078     // quality at every bx.  The search for best ALCTs is done in parallel
01079     // for collision and accelerator patterns, and simultaneously for
01080     // two ALCTs, tA and tB.  If two or more ALCTs have equal qualities,
01081     // the priority is given to the ALCT with larger wiregroup number
01082     // in the search for tA (collision and accelerator), and to the ALCT
01083     // with smaller wiregroup number in the search for tB.
01084     int accel = (*plct).getAccelerator();
01085     int qual  = (*plct).getQuality();
01086     int wire  = (*plct).getKeyWG();
01087     bool vA = tA[bx][accel].isValid();
01088     bool vB = tB[bx][accel].isValid();
01089     int qA  = tA[bx][accel].getQuality();
01090     int qB  = tB[bx][accel].getQuality();
01091     int wA  = tA[bx][accel].getKeyWG();
01092     int wB  = tB[bx][accel].getKeyWG();
01093     if (!vA || qual > qA || (qual == qA && wire > wA)) {
01094       tA[bx][accel] = *plct;
01095     }
01096     if (!vB || qual > qB || (qual == qB && wire < wB)) {
01097       tB[bx][accel] = *plct;
01098     }
01099   }
01100 
01101   for (int bx = early_tbins+1; bx <= late_tbins; bx++) {
01102     for (int accel = 0; accel <= 1; accel++) {
01103       // Best ALCT is always tA.
01104       if (tA[bx][accel].isValid()) {
01105         if (infoV > 2) {
01106           LogTrace("CSCAnodeLCTProcessor") << "tA: " << tA[bx][accel];
01107           LogTrace("CSCAnodeLCTProcessor") << "tB: " << tB[bx][accel];
01108         }
01109         bestALCTs[bx][accel] = tA[bx][accel];
01110 
01111         // If tA exists, tB exists too.
01112         if (tA[bx][accel] != tB[bx][accel] &&
01113             tA[bx][accel].getQuality() == tB[bx][accel].getQuality()) {
01114           secondALCTs[bx][accel] = tB[bx][accel];
01115         }
01116         else {
01117           // Funny part: if tA and tB are the same, or the quality of tB
01118           // is inferior to the quality of tA, the second best ALCT is
01119           // not tB.  Instead it is the largest-wiregroup ALCT among those
01120           // ALCT whose qualities are lower than the quality of the best one.
01121           for (std::vector <CSCALCTDigi>::const_iterator plct =
01122                  all_alcts.begin(); plct != all_alcts.end(); plct++) {
01123             if ((*plct).isValid() && 
01124                 (*plct).getAccelerator() == accel && (*plct).getBX() == bx &&
01125                 (*plct).getQuality() <  bestALCTs[bx][accel].getQuality() && 
01126                 (*plct).getQuality() >= secondALCTs[bx][accel].getQuality() &&
01127                 (*plct).getKeyWG()   >= secondALCTs[bx][accel].getKeyWG()) {
01128               secondALCTs[bx][accel] = *plct;
01129             }
01130           }
01131         }
01132       }
01133     }
01134   }
01135 
01136   // Fill the vector with up to four best ALCTs and return it.
01137   std::vector<CSCALCTDigi> fourBest;
01138   for (int bx = 0; bx <= late_tbins; bx++) {
01139     for (int i = 0; i < 2; i++) {
01140       if (bestALCTs[bx][i].isValid())   fourBest.push_back(bestALCTs[bx][i]);
01141     }
01142     for (int i = 0; i < 2; i++) {
01143       if (secondALCTs[bx][i].isValid()) fourBest.push_back(secondALCTs[bx][i]);
01144     }
01145   }
01146 
01147   if (infoV > 1) {
01148     LogTrace("CSCAnodeLCTProcessor") << fourBest.size() << " ALCTs selected: ";
01149     for (std::vector<CSCALCTDigi>::const_iterator plct = fourBest.begin();
01150          plct != fourBest.end(); plct++) {
01151       LogTrace("CSCAnodeLCTProcessor") << (*plct);
01152     }
01153   }
01154 
01155   return fourBest;
01156 }

void CSCAnodeLCTProcessor::checkConfigParameters (  )  [private]

Make sure that the parameter values are within the allowed range.

Definition at line 259 of file CSCAnodeLCTProcessor.cc.

References accel_mode, def_accel_mode, def_drift_delay, def_fifo_pretrig, def_fifo_tbins, def_l1a_window_width, def_nplanes_hit_accel_pattern, def_nplanes_hit_accel_pretrig, def_nplanes_hit_pattern, def_nplanes_hit_pretrig, def_trig_mode, drift_delay, fifo_pretrig, fifo_tbins, infoV, l1a_window_width, MAX_ALCT_BINS, nplanes_hit_accel_pattern, nplanes_hit_accel_pretrig, nplanes_hit_pattern, nplanes_hit_pretrig, and trig_mode.

Referenced by CSCAnodeLCTProcessor(), and setConfigParameters().

00259                                                  {
00260   // Make sure that the parameter values are within the allowed range.
00261 
00262   // Max expected values.
00263   static const unsigned int max_fifo_tbins   = 1 << 5;
00264   static const unsigned int max_fifo_pretrig = 1 << 5;
00265   static const unsigned int max_drift_delay  = 1 << 2;
00266   static const unsigned int max_nplanes_hit_pretrig = 1 << 3;
00267   static const unsigned int max_nplanes_hit_pattern = 1 << 3;
00268   static const unsigned int max_nplanes_hit_accel_pretrig = 1 << 3;
00269   static const unsigned int max_nplanes_hit_accel_pattern = 1 << 3;
00270   static const unsigned int max_trig_mode        = 1 << 2;
00271   static const unsigned int max_accel_mode       = 1 << 2;
00272   static const unsigned int max_l1a_window_width = MAX_ALCT_BINS; // 4 bits
00273 
00274   // Checks.
00275   if (fifo_tbins >= max_fifo_tbins) {
00276     if (infoV > 0) edm::LogError("CSCAnodeLCTProcessor")
00277       << "+++ Value of fifo_tbins, " << fifo_tbins
00278       << ", exceeds max allowed, " << max_fifo_tbins-1 << " +++\n"
00279       << "+++ Try to proceed with the default value, fifo_tbins="
00280       << def_fifo_tbins << " +++\n";
00281     fifo_tbins = def_fifo_tbins;
00282   }
00283   if (fifo_pretrig >= max_fifo_pretrig) {
00284     if (infoV > 0) edm::LogError("CSCAnodeLCTProcessor")
00285       << "+++ Value of fifo_pretrig, " << fifo_pretrig
00286       << ", exceeds max allowed, " << max_fifo_pretrig-1 << " +++\n"
00287       << "+++ Try to proceed with the default value, fifo_pretrig="
00288       << def_fifo_pretrig << " +++\n";
00289     fifo_pretrig = def_fifo_pretrig;
00290   }
00291   if (drift_delay >= max_drift_delay) {
00292     if (infoV > 0) edm::LogError("CSCAnodeLCTProcessor")
00293       << "+++ Value of drift_delay, " << drift_delay
00294       << ", exceeds max allowed, " << max_drift_delay-1 << " +++\n"
00295       << "+++ Try to proceed with the default value, drift_delay="
00296       << def_drift_delay << " +++\n";
00297     drift_delay = def_drift_delay;
00298   }
00299   if (nplanes_hit_pretrig >= max_nplanes_hit_pretrig) {
00300     if (infoV > 0) edm::LogError("CSCAnodeLCTProcessor")
00301       << "+++ Value of nplanes_hit_pretrig, " << nplanes_hit_pretrig
00302       << ", exceeds max allowed, " << max_nplanes_hit_pretrig-1 << " +++\n"
00303       << "+++ Try to proceed with the default value, nplanes_hit_pretrig="
00304       << nplanes_hit_pretrig << " +++\n";
00305     nplanes_hit_pretrig = def_nplanes_hit_pretrig;
00306   }
00307   if (nplanes_hit_pattern >= max_nplanes_hit_pattern) {
00308     if (infoV > 0) edm::LogError("CSCAnodeLCTProcessor")
00309       << "+++ Value of nplanes_hit_pattern, " << nplanes_hit_pattern
00310       << ", exceeds max allowed, " << max_nplanes_hit_pattern-1 << " +++\n"
00311       << "+++ Try to proceed with the default value, nplanes_hit_pattern="
00312       << nplanes_hit_pattern << " +++\n";
00313     nplanes_hit_pattern = def_nplanes_hit_pattern;
00314   }
00315   if (nplanes_hit_accel_pretrig >= max_nplanes_hit_accel_pretrig) {
00316     if (infoV > 0) edm::LogError("CSCAnodeLCTProcessor")
00317       << "+++ Value of nplanes_hit_accel_pretrig, "
00318       << nplanes_hit_accel_pretrig << ", exceeds max allowed, "
00319       << max_nplanes_hit_accel_pretrig-1 << " +++\n"
00320       << "+++ Try to proceed with the default value, "
00321       << "nplanes_hit_accel_pretrig=" << nplanes_hit_accel_pretrig << " +++\n";
00322     nplanes_hit_accel_pretrig = def_nplanes_hit_accel_pretrig;
00323   }
00324   if (nplanes_hit_accel_pattern >= max_nplanes_hit_accel_pattern) {
00325     if (infoV > 0) edm::LogError("CSCAnodeLCTProcessor")
00326       << "+++ Value of nplanes_hit_accel_pattern, "
00327       << nplanes_hit_accel_pattern << ", exceeds max allowed, "
00328       << max_nplanes_hit_accel_pattern-1 << " +++\n"
00329       << "+++ Try to proceed with the default value, "
00330       << "nplanes_hit_accel_pattern=" << nplanes_hit_accel_pattern << " +++\n";
00331     nplanes_hit_accel_pattern = def_nplanes_hit_accel_pattern;
00332   }
00333   if (trig_mode >= max_trig_mode) {
00334     if (infoV > 0) edm::LogError("CSCAnodeLCTProcessor")
00335       << "+++ Value of trig_mode, " << trig_mode
00336       << ", exceeds max allowed, " << max_trig_mode-1 << " +++\n"
00337       << "+++ Try to proceed with the default value, trig_mode="
00338       << trig_mode << " +++\n";
00339     trig_mode = def_trig_mode;
00340   }
00341   if (accel_mode >= max_accel_mode) {
00342     if (infoV > 0) edm::LogError("CSCAnodeLCTProcessor")
00343       << "+++ Value of accel_mode, " << accel_mode
00344       << ", exceeds max allowed, " << max_accel_mode-1 << " +++\n"
00345       << "+++ Try to proceed with the default value, accel_mode="
00346       << accel_mode << " +++\n";
00347     accel_mode = def_accel_mode;
00348   }
00349   if (l1a_window_width >= max_l1a_window_width) {
00350     if (infoV > 0) edm::LogError("CSCAnodeLCTProcessor")
00351       << "+++ Value of l1a_window_width, " << l1a_window_width
00352       << ", exceeds max allowed, " << max_l1a_window_width-1 << " +++\n"
00353       << "+++ Try to proceed with the default value, l1a_window_width="
00354       << l1a_window_width << " +++\n";
00355     l1a_window_width = def_l1a_window_width;
00356   }
00357 }

void CSCAnodeLCTProcessor::clear ( const int  wire,
const int  pattern 
) [private]

Clears the quality for a given wire and pattern if it is a ghost.

Definition at line 366 of file CSCAnodeLCTProcessor.cc.

References quality.

00366                                                                   {
00367   /* Clear the data off of selected pattern */
00368   if (pattern == 0) quality[wire][0] = -999;
00369   else {
00370     quality[wire][1] = -999;
00371     quality[wire][2] = -999;
00372   }
00373 }

void CSCAnodeLCTProcessor::clear ( void   ) 

Clears the LCT containers.

Definition at line 359 of file CSCAnodeLCTProcessor.cc.

References bestALCT, CSCALCTDigi::clear(), MAX_ALCT_BINS, and secondALCT.

Referenced by CSCMotherboard::clear(), and ghostCancellationLogic().

00359                                  {
00360   for (int bx = 0; bx < MAX_ALCT_BINS; bx++) {
00361     bestALCT[bx].clear();
00362     secondALCT[bx].clear();
00363   }
00364 }

void CSCAnodeLCTProcessor::dumpConfigParams (  )  const [private]

Dump ALCT configuration parameters.

Definition at line 1269 of file CSCAnodeLCTProcessor.cc.

References accel_mode, drift_delay, fifo_pretrig, fifo_tbins, l1a_window_width, LogDebug, nplanes_hit_accel_pattern, nplanes_hit_accel_pretrig, nplanes_hit_pattern, nplanes_hit_pretrig, and trig_mode.

Referenced by CSCAnodeLCTProcessor(), and setConfigParameters().

01269                                                   {
01270   std::ostringstream strm;
01271   strm << "\n";
01272   strm << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
01273   strm << "+                  ALCT configuration parameters:                  +\n";
01274   strm << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
01275   strm << " fifo_tbins   [total number of time bins in DAQ readout] = "
01276        << fifo_tbins << "\n";
01277   strm << " fifo_pretrig [start time of anode raw hits in DAQ readout] = "
01278        << fifo_pretrig << "\n";
01279   strm << " drift_delay  [drift delay after pre-trigger, in 25 ns bins] = "
01280        << drift_delay << "\n";
01281   strm << " nplanes_hit_pretrig [min. number of layers hit for pre-trigger] = "
01282        << nplanes_hit_pretrig << "\n";
01283   strm << " nplanes_hit_pattern [min. number of layers hit for trigger] = "
01284        << nplanes_hit_pattern << "\n";
01285   strm << " nplanes_hit_accel_pretrig [min. number of layers hit for accel."
01286        << " pre-trig.] = " << nplanes_hit_accel_pretrig << "\n";
01287   strm << " nplanes_hit_accel_pattern [min. number of layers hit for accel."
01288        << " trigger] = "   << nplanes_hit_accel_pattern << "\n";
01289   strm << " trig_mode  [enabling/disabling collision/accelerator tracks] = "
01290        << trig_mode << "\n";
01291   strm << " accel_mode [preference to collision/accelerator tracks] = "
01292        << accel_mode << "\n";
01293   strm << " l1a_window_width [L1Accept window width, in 25 ns bins] = "
01294        << l1a_window_width << "\n";
01295   strm << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
01296   LogDebug("CSCAnodeLCTProcessor") << strm.str();
01297 }

void CSCAnodeLCTProcessor::dumpDigis ( const std::vector< int wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]  )  const [private]

Dump digis on wire groups.

Definition at line 1300 of file CSCAnodeLCTProcessor.cc.

References CSCTriggerNumbering::chamberFromTriggerLabels(), LogDebug, LogTrace, CSCConstants::NUM_LAYERS, numWireGroups, CSCTriggerNumbering::ringFromTriggerLabels(), size, theEndcap, theSector, theStation, theSubsector, and theTrigChamber.

Referenced by pulseExtension().

01300                                                                                                                        {
01301   LogDebug("CSCAnodeLCTProcessor")
01302     << "ME" << ((theEndcap == 1) ? "+" : "-") << theStation << "/"
01303     << CSCTriggerNumbering::ringFromTriggerLabels(theStation, theTrigChamber)
01304     << "/" << CSCTriggerNumbering::chamberFromTriggerLabels(theSector,
01305                                     theSubsector, theStation, theTrigChamber)
01306     << " nWiregroups " << numWireGroups;
01307 
01308   std::ostringstream strstrm;
01309   for (int i_wire = 0; i_wire < numWireGroups; i_wire++) {
01310     if (i_wire%10 == 0) {
01311       if (i_wire < 100) strstrm << i_wire/10;
01312       else              strstrm << (i_wire-100)/10;
01313     }
01314     else                strstrm << " ";
01315   }
01316   strstrm << "\n";
01317   for (int i_wire = 0; i_wire < numWireGroups; i_wire++) {
01318     strstrm << i_wire%10;
01319   }
01320   for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
01321     strstrm << "\n";
01322     for (int i_wire = 0; i_wire < numWireGroups; i_wire++) {
01323       if (wire[i_layer][i_wire].size() > 0) {
01324         std::vector<int> bx_times = wire[i_layer][i_wire];
01325         strstrm << std::hex << bx_times[0] << std::dec;
01326       }
01327       else {
01328         strstrm << ".";
01329       }
01330     }
01331   }
01332   LogTrace("CSCAnodeLCTProcessor") << strstrm.str();
01333 }

std::vector< CSCALCTDigi > CSCAnodeLCTProcessor::getALCTs (  ) 

Returns vector of found ALCTs, if any.

Definition at line 1336 of file CSCAnodeLCTProcessor.cc.

References bestALCT, MAX_ALCT_BINS, and secondALCT.

Referenced by CSCTriggerPrimitivesBuilder::build(), and run().

01336                                                       {
01337   std::vector<CSCALCTDigi> tmpV;
01338   for (int bx = 0; bx < MAX_ALCT_BINS; bx++) {
01339     if (bestALCT[bx].isValid())   tmpV.push_back(bestALCT[bx]);
01340     if (secondALCT[bx].isValid()) tmpV.push_back(secondALCT[bx]);
01341   }
01342   return tmpV;
01343 }

bool CSCAnodeLCTProcessor::getDigis ( const CSCWireDigiCollection wiredc  ) 

Access routine to wire digis.

Definition at line 500 of file CSCAnodeLCTProcessor.cc.

References CSCTriggerNumbering::chamberFromTriggerLabels(), digiV, infoV, LogTrace, CSCConstants::NUM_LAYERS, CSCTriggerNumbering::ringFromTriggerLabels(), theEndcap, theSector, theStation, theSubsector, and theTrigChamber.

Referenced by run().

00500                                                                        {
00501   // Routine for getting digis and filling digiV vector.
00502   bool noDigis = true;
00503   int  theRing    = CSCTriggerNumbering::ringFromTriggerLabels(theStation,
00504                                                                theTrigChamber);
00505   int  theChamber = CSCTriggerNumbering::chamberFromTriggerLabels(theSector,
00506                                      theSubsector, theStation, theTrigChamber);
00507 
00508   // Loop over layers and save wire digis on each one into digiV[layer].
00509   for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
00510     CSCDetId detid(theEndcap, theStation, theRing, theChamber, i_layer+1);
00511 
00512     const CSCWireDigiCollection::Range rwired = wiredc->get(detid);
00513 
00514     // Skip if no wire digis in this layer.
00515     if (rwired.second == rwired.first) continue;
00516 
00517     // If this is the first layer with digis in this chamber, clear digiV
00518     // array and set the empty flag to false.
00519     if (noDigis) {
00520       for (int lay = 0; lay < CSCConstants::NUM_LAYERS; lay++) {
00521         digiV[lay].clear();
00522       }
00523       noDigis = false;
00524     }
00525 
00526     if (infoV > 1) LogTrace("CSCAnodeLCTProcessor")
00527       << "found " << rwired.second - rwired.first
00528       << " wire digi(s) in layer " << i_layer << " of ME"
00529       << ((theEndcap == 1) ? "+" : "-") << theStation << "/" << theRing
00530       << "/" << theChamber << " (trig. sector " << theSector
00531       << " subsector " << theSubsector << " id " << theTrigChamber << ")";
00532 
00533     for (CSCWireDigiCollection::const_iterator digiIt = rwired.first;
00534          digiIt != rwired.second; ++digiIt) {
00535       digiV[i_layer].push_back(*digiIt);
00536       if (infoV > 1) LogTrace("CSCAnodeLCTProcessor") << "   " << (*digiIt);
00537     }
00538   }
00539 
00540   return noDigis;
00541 }

void CSCAnodeLCTProcessor::ghostCancellationLogic (  )  [private]

Definition at line 813 of file CSCAnodeLCTProcessor.cc.

References clear(), first_bx, infoV, LogTrace, CSCConstants::MAX_NUM_WIRES, numWireGroups, and quality.

Referenced by run().

00813                                                   {
00814   /* This function looks for LCTs on the previous and next wires.  If one
00815      exists and it has a better quality and a bx_time up to 4 clocks earlier
00816      than the present, then the present LCT is cancelled.  The present LCT
00817      also gets cancelled if it has the same quality as the one on the
00818      previous wire (this has not been done in 2003 test beam).  The
00819      cancellation is done separately for collision and accelerator patterns. */
00820 
00821   int ghost_cleared[CSCConstants::MAX_NUM_WIRES][2];
00822 
00823   for (int key_wire = 0; key_wire < numWireGroups; key_wire++) {
00824     for (int i_pattern = 0; i_pattern < 2; i_pattern++) {
00825       ghost_cleared[key_wire][i_pattern] = 0;
00826 
00827       // Non-empty wire group.
00828       int qual_this = quality[key_wire][i_pattern];
00829       if (qual_this > 0) {
00830 
00831         // Previous wire.
00832         int qual_prev = (key_wire > 0) ? quality[key_wire-1][i_pattern] : 0;
00833         if (qual_prev > 0) {
00834           int dt = first_bx[key_wire] - first_bx[key_wire-1];
00835           // Cancel this wire
00836           //   1) If the candidate at the previous wire is at the same bx
00837           //      clock and has better quality (or equal quality - this has
00838           //      been implemented only in 2004).
00839           //   2) If the candidate at the previous wire is up to 4 clocks
00840           //      earlier, regardless of quality.
00841           if (dt == 0) {
00842             if (qual_prev >= qual_this) ghost_cleared[key_wire][i_pattern] = 1;
00843           }
00844           else if (dt > 0 && dt <= 4) {
00845             // Next "if" check accounts for firmware bug and should be
00846             // removed once the next firmware version is used.
00847             // The bug is fixed in 5/5/2008 version of ALCT firmware,
00848             // which is used in all chambers starting with 26/05/2008.
00850             ghost_cleared[key_wire][i_pattern] = 1;
00851           }
00852         }
00853 
00854         // Next wire.
00855         // Skip this step if this wire is already declared "ghost".
00856         if (ghost_cleared[key_wire][i_pattern] == 1) {
00857           if (infoV > 1) LogTrace("CSCAnodeLCTProcessor")
00858             << ((i_pattern == 0) ? "Accelerator" : "Collision")
00859             << " pattern ghost cancelled on key_wire " << key_wire
00860             << " by wire " << key_wire-1;
00861           continue;
00862         }
00863 
00864         int qual_next =
00865           (key_wire < numWireGroups-1) ? quality[key_wire+1][i_pattern] : 0;
00866         if (qual_next > 0) {
00867           int dt = first_bx[key_wire] - first_bx[key_wire+1];
00868           // Same cancellation logic as for the previous wire.
00869           if (dt == 0) {
00870             if (qual_next > qual_this) ghost_cleared[key_wire][i_pattern] = 1;
00871           }
00872           else if (dt > 0 && dt <= 4) {
00873             // Next "if" check accounts for firmware bug and should be
00874             // removed once the next firmware version is used.
00875             // The bug is fixed in 5/5/2008 version of ALCT firmware,
00876             // which is used in all chambers starting with 26/05/2008.
00878             ghost_cleared[key_wire][i_pattern] = 1;
00879           }
00880         }
00881         if (ghost_cleared[key_wire][i_pattern] == 1) {
00882           if (infoV > 1) LogTrace("CSCAnodeLCTProcessor")
00883             << ((i_pattern == 0) ? "Accelerator" : "Collision")
00884             << " pattern ghost cancelled on key_wire " << key_wire
00885             << " by wire " << key_wire+1;
00886           continue;
00887         }
00888       }
00889     }
00890   }
00891 
00892   // All cancellation is done in parallel, so wiregroups do not know what
00893   // their neighbors are cancelling.
00894   for (int key_wire = 0; key_wire < numWireGroups; key_wire++) {
00895     for (int i_pattern = 0; i_pattern < 2; i_pattern++) {
00896       if (ghost_cleared[key_wire][i_pattern] > 0) {
00897         clear(key_wire, i_pattern);
00898       }
00899     }
00900   }
00901 }

bool CSCAnodeLCTProcessor::isBetterALCT ( const CSCALCTDigi lhsALCT,
const CSCALCTDigi rhsALCT 
) [private]

Definition at line 1158 of file CSCAnodeLCTProcessor.cc.

References CSCALCTDigi::getAccelerator(), CSCALCTDigi::getBX(), CSCALCTDigi::getKeyWG(), CSCALCTDigi::getQuality(), CSCALCTDigi::isValid(), and quality.

Referenced by lctSearch().

01159                                                                     {
01160   /* This method should have been an overloaded > operator, but we
01161      have to keep it here since need to check values in quality[][]
01162      array modified according to accel_mode parameter. */
01163   bool returnValue = false;
01164 
01165   if (lhsALCT.isValid() && !rhsALCT.isValid()) {return true;}
01166 
01167   // ALCTs found at earlier bx times are ranked higher than ALCTs found at
01168   // later bx times regardless of the quality.
01169   if (lhsALCT.getBX()  < rhsALCT.getBX()) {returnValue = true;}
01170   if (lhsALCT.getBX() != rhsALCT.getBX()) {return returnValue;}
01171 
01172   // First check the quality of ALCTs.
01173   int qual1 = lhsALCT.getQuality();
01174   int qual2 = rhsALCT.getQuality();
01175   if (qual1 >  qual2) {returnValue = true;}
01176   // If qualities are the same, check accelerator bits of both ALCTs.
01177   // If they are not the same, rank according to accel_mode value.
01178   // If they are the same, keep the track selector assignment.
01179   else if (qual1 == qual2 && 
01180            lhsALCT.getAccelerator() != rhsALCT.getAccelerator() &&
01181            quality[lhsALCT.getKeyWG()][1-lhsALCT.getAccelerator()] >
01182            quality[rhsALCT.getKeyWG()][1-rhsALCT.getAccelerator()])
01183     {returnValue = true;}
01184 
01185   return returnValue;
01186 }

void CSCAnodeLCTProcessor::lctSearch (  )  [private]

Definition at line 903 of file CSCAnodeLCTProcessor.cc.

References accelMode(), bestALCT, bestTrackSelector(), CSCTriggerNumbering::chamberFromTriggerLabels(), CSCALCTDigi::clear(), first_bx, infoV, isBetterALCT(), isTMB07, LogDebug, MAX_ALCT_BINS, numWireGroups, quality, CSCTriggerNumbering::ringFromTriggerLabels(), secondALCT, CSCALCTDigi::setTrknmb(), theEndcap, theSector, theStation, theSubsector, theTrigChamber, and trigMode().

Referenced by run().

00903                                      {
00904   // First modify the quality according accel_mode, then store all
00905   // of the valid LCTs in an array.
00906   std::vector<CSCALCTDigi> lct_list;
00907 
00908   for (int i_wire = 0; i_wire < numWireGroups; i_wire++) {
00909     // If there is either accelerator or collision, perform trigMode
00910     // function before storing and sorting.
00911     if (quality[i_wire][0] > 0 || quality[i_wire][1] > 0) {
00912       trigMode(i_wire);
00913 
00914       // Store any valid accelerator pattern LCTs.
00915       if (quality[i_wire][0] > 0) {
00916         int qual = (quality[i_wire][0] & 0x03); // 2 LSBs
00917         CSCALCTDigi lct_info(1, qual, 1, 0, i_wire, first_bx[i_wire]);
00918         lct_list.push_back(lct_info);
00919       }
00920 
00921       // Store any valid collision pattern LCTs.
00922       if (quality[i_wire][1] > 0) {
00923         int qual = (quality[i_wire][1] & 0x03); // 2 LSBs
00924         CSCALCTDigi lct_info(1, qual, 0, quality[i_wire][2], i_wire,
00925                              first_bx[i_wire]);
00926         lct_list.push_back(lct_info);
00927       }
00928 
00929       // Modify qualities according to accel_mode parameter.
00930       accelMode(i_wire);
00931     }
00932   }
00933 
00934   // Best track selector selects two collision and two accelerator ALCTs
00935   // with the best quality per time bin.
00936   std::vector<CSCALCTDigi> fourBest = bestTrackSelector(lct_list);
00937 
00938   // Select two best of of four per time bin, based on quality and
00939   // accel_mode parameter.
00940   for (std::vector<CSCALCTDigi>::const_iterator plct = fourBest.begin();
00941        plct != fourBest.end(); plct++) {
00942 
00943     int bx = plct->getBX();
00944     if (bx >= MAX_ALCT_BINS) {
00945       if (infoV > 0) edm::LogWarning("CSCAnodeLCTProcessor")
00946         << "+++ Bx of ALCT candidate, " << bx << ", exceeds max allowed, "
00947         << MAX_ALCT_BINS-1 << "; skipping it... +++\n";
00948       continue;
00949     }
00950 
00951     if (isBetterALCT(*plct, bestALCT[bx])) {
00952       if (isBetterALCT(bestALCT[bx], secondALCT[bx])) {
00953         secondALCT[bx] = bestALCT[bx];
00954       }
00955       bestALCT[bx] = *plct;
00956     }
00957     else if (isBetterALCT(*plct, secondALCT[bx])) {
00958       secondALCT[bx] = *plct;
00959     }
00960   }
00961 
00962   if (!isTMB07) {
00963     // Prior to DAQ-2006 format, only ALCTs at the earliest bx were reported.
00964     int first_bx = MAX_ALCT_BINS;
00965     for (int bx = 0; bx < MAX_ALCT_BINS; bx++) {
00966       if (bestALCT[bx].isValid()) {
00967         first_bx = bx;
00968         break;
00969       }
00970     }
00971     if (first_bx < MAX_ALCT_BINS) {
00972       for (int bx = first_bx + 1; bx < MAX_ALCT_BINS; bx++) {
00973         if (bestALCT[bx].isValid())   bestALCT[bx].clear();
00974         if (secondALCT[bx].isValid()) secondALCT[bx].clear();
00975       }
00976     }
00977   }
00978 
00979   for (int bx = 0; bx < MAX_ALCT_BINS; bx++) {
00980     if (bestALCT[bx].isValid()) {
00981       bestALCT[bx].setTrknmb(1);
00982       if (infoV > 0) {
00983         LogDebug("CSCAnodeLCTProcessor")
00984           << "\n" << bestALCT[bx] << " found in ME"
00985           << ((theEndcap == 1) ? "+" : "-") << theStation << "/"
00986           << CSCTriggerNumbering::ringFromTriggerLabels(theStation,
00987                                                         theTrigChamber) << "/"
00988           << CSCTriggerNumbering::chamberFromTriggerLabels(theSector,
00989                               theSubsector, theStation, theTrigChamber)
00990           << " (sector " << theSector << " subsector " << theSubsector
00991           << " trig id. " << theTrigChamber << ")" << "\n";
00992       }
00993       if (secondALCT[bx].isValid()) {
00994         secondALCT[bx].setTrknmb(2);
00995         if (infoV > 0) {
00996           LogDebug("CSCAnodeLCTProcessor")
00997             << secondALCT[bx] << " found in ME"
00998             << ((theEndcap == 1) ? "+" : "-") << theStation << "/"
00999             << CSCTriggerNumbering::ringFromTriggerLabels(theStation,
01000                                                           theTrigChamber) <<"/"
01001             << CSCTriggerNumbering::chamberFromTriggerLabels(theSector,
01002                                 theSubsector, theStation, theTrigChamber)
01003             << " (sector " << theSector << " subsector " << theSubsector
01004             << " trig id. " << theTrigChamber << ")" << "\n";
01005         }
01006       }
01007     }
01008   }
01009 }

bool CSCAnodeLCTProcessor::patternDetection ( const int  key_wire  )  [private]

Definition at line 721 of file CSCAnodeLCTProcessor.cc.

References drift_delay, first_bx, infoV, isTMB07, LogTrace, MESelection, nplanes_hit_accel_pattern, nplanes_hit_pattern, CSCConstants::NUM_ALCT_PATTERNS, CSCConstants::NUM_LAYERS, NUM_PATTERN_WIRES, numWireGroups, pattern_envelope, pattern_mask, pulse, and quality.

Referenced by run().

00721                                                               {
00722   /* See if there is a pattern that satisfies nplanes_hit_pattern number of
00723      layers hit for either the accelerator or collision patterns.  Use
00724      the pattern with the best quality. */
00725 
00726   bool trigger = false;
00727   bool hit_layer[CSCConstants::NUM_LAYERS];
00728   unsigned int temp_quality;
00729   int this_layer, this_wire;
00730   const unsigned int pattern_thresh[CSCConstants::NUM_ALCT_PATTERNS] = {
00731     nplanes_hit_accel_pattern, nplanes_hit_pattern, nplanes_hit_pattern
00732   };
00733   const std::string ptn_label[] = {"Accelerator", "CollisionA", "CollisionB"};
00734 
00735   for (int i_pattern = 0; i_pattern < CSCConstants::NUM_ALCT_PATTERNS; i_pattern++){
00736     temp_quality = 0;
00737     for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++)
00738       hit_layer[i_layer] = false;
00739 
00740     for (int i_wire = 0; i_wire < NUM_PATTERN_WIRES; i_wire++){
00741       if (pattern_mask[i_pattern][i_wire] != 0){
00742         this_layer = pattern_envelope[0][i_wire];
00743         this_wire  = pattern_envelope[1+MESelection][i_wire]+key_wire;
00744         if ((this_wire >= 0) && (this_wire < numWireGroups)){
00745 
00746           // Wait a drift_delay time later and look for layers hit in
00747           // the pattern.
00748           if ((pulse[this_layer][this_wire] >> 
00749                (first_bx[key_wire] + drift_delay)) & 1 == 1) {
00750 
00751             // If layer has never had a hit before, then increment number
00752             // of layer hits.
00753             if (hit_layer[this_layer] == false){
00754               temp_quality++;
00755               // keep track of which layers already had hits.
00756               hit_layer[this_layer] = true;
00757               if (infoV > 1)
00758                 LogTrace("CSCAnodeLCTProcessor")
00759                   << "bx_time: " << first_bx[key_wire]
00760                   << " pattern: " << i_pattern << " keywire: " << key_wire
00761                   << " layer: "     << this_layer
00762                   << " quality: "   << temp_quality;
00763             }
00764           }
00765         }
00766       }
00767     }
00768     if (temp_quality >= pattern_thresh[i_pattern]) {
00769       trigger = true;
00770 
00771       if (!isTMB07) {
00772         // Quality reported by the pattern detector is defined as the number
00773         // of the layers hit in a pattern minus (pattern_thresh-1) value.
00774         temp_quality -= (pattern_thresh[i_pattern]-1);
00775       }
00776       else {
00777         // Quality definition changed on 22 June 2007: it no longer depends
00778         // on pattern_thresh.
00779         if (temp_quality > 3) temp_quality -= 3;
00780         else                  temp_quality  = 0; // quality code 0 is valid!
00781       }
00782 
00783       if (i_pattern == 0) {
00784         // Accelerator pattern
00785         quality[key_wire][0] = temp_quality;
00786       }
00787       else {
00788         // Only one collision pattern (of the best quality) is reported
00789         if (static_cast<int>(temp_quality) > quality[key_wire][1]) {
00790           quality[key_wire][1] = temp_quality;
00791           quality[key_wire][2] = i_pattern-1;
00792         }
00793       }
00794       if (infoV > 1) {
00795         LogTrace("CSCAnodeLCTProcessor")
00796           << "Pattern found; keywire: "  << key_wire
00797           << " type: " << ptn_label[i_pattern]
00798           << " quality: " << temp_quality << "\n";
00799       }
00800     }
00801   }
00802   if (infoV > 1 && quality[key_wire][1] > 0) {
00803     if (quality[key_wire][2] == 0)
00804       LogTrace("CSCAnodeLCTProcessor")
00805         << "Collision Pattern A is chosen" << "\n";
00806     else if (quality[key_wire][2] == 1)
00807       LogTrace("CSCAnodeLCTProcessor")
00808         << "Collision Pattern B is chosen" << "\n";
00809   }
00810   return trigger;
00811 }

bool CSCAnodeLCTProcessor::preTrigger ( const int  key_wire,
const int  start_bx 
) [private]

Definition at line 666 of file CSCAnodeLCTProcessor.cc.

References fifo_tbins, first_bx, infoV, LogTrace, MESelection, nplanes_hit_accel_pretrig, nplanes_hit_pretrig, CSCConstants::NUM_ALCT_PATTERNS, CSCConstants::NUM_LAYERS, NUM_PATTERN_WIRES, numWireGroups, pattern_envelope, pattern_mask, and pulse.

Referenced by run().

00666                                                                             {
00667   /* Check that there are nplanes_hit_pretrig or more layers hit in collision
00668      or accelerator patterns for a particular key_wire.  If so, return
00669      true and the PatternDetection process will start. */
00670 
00671   unsigned int layers_hit;
00672   bool hit_layer[CSCConstants::NUM_LAYERS];
00673   int this_layer, this_wire;
00674   const unsigned int pretrig_thresh[CSCConstants::NUM_ALCT_PATTERNS] = {
00675     nplanes_hit_accel_pretrig, nplanes_hit_pretrig, nplanes_hit_pretrig
00676   };
00677 
00678   // Loop over bx times, accelerator and collision patterns to 
00679   // look for pretrigger.
00680   for (unsigned int bx_time = start_bx; bx_time < fifo_tbins; bx_time++) {
00681     for (int i_pattern = 0; i_pattern < CSCConstants::NUM_ALCT_PATTERNS; i_pattern++) {
00682       for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++)
00683         hit_layer[i_layer] = false;
00684       layers_hit = 0;
00685 
00686       for (int i_wire = 0; i_wire < NUM_PATTERN_WIRES; i_wire++){
00687         if (pattern_mask[i_pattern][i_wire] != 0){
00688           this_layer = pattern_envelope[0][i_wire];
00689           this_wire  = pattern_envelope[1+MESelection][i_wire]+key_wire;
00690           if ((this_wire >= 0) && (this_wire < numWireGroups)){
00691             // Perform bit operation to see if pulse is 1 at a certain bx_time.
00692             if (((pulse[this_layer][this_wire] >> bx_time) & 1) == 1) {
00693               // Store number of layers hit.
00694               if (hit_layer[this_layer] == false){
00695                 hit_layer[this_layer] = true;
00696                 layers_hit++;
00697               }
00698 
00699               // See if number of layers hit is greater than or equal to
00700               // pretrig_thresh.
00701               if (layers_hit >= pretrig_thresh[i_pattern]) {
00702                 first_bx[key_wire] = bx_time;
00703                 if (infoV > 1) {
00704                   LogTrace("CSCAnodeLCTProcessor")
00705                     << "Pretrigger was satisfied for wire: " << key_wire
00706                     << " pattern: " << i_pattern
00707                     << " bx_time: " << bx_time;
00708                 }
00709                 return true;
00710               }
00711             }
00712           }
00713         }
00714       }
00715     }
00716   }
00717   // If the pretrigger was never satisfied, then return false.
00718   return false;
00719 }

bool CSCAnodeLCTProcessor::pulseExtension ( const std::vector< int wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]  )  [private]

Definition at line 596 of file CSCAnodeLCTProcessor.cc.

References dumpDigis(), first_bx, i, infoV, j, LogTrace, CSCConstants::NUM_LAYERS, numWireGroups, pulse, quality, and size.

Referenced by run().

00596                                                                                                                      {
00597   /* A pulse array will be used as a bit representation of hit times.
00598      For example: if a keywire has a bx_time of 3, then 1 shifted
00599      left 3 will be bit pattern 0000000000001000.  Bits are then added to
00600      signify the duration of a signal (hit_persist, formerly bx_width).  So
00601      for the pulse with a hit_persist of 6 will look like 0000000111111000. */
00602 
00603   bool chamber_empty = true;
00604   int i_wire, i_layer, digi_num;
00605   static unsigned int hit_persist = 6;
00606   static unsigned int bits_in_pulse = 8*sizeof(pulse[0][0]);
00607 
00608   for (i_wire = 0; i_wire < numWireGroups; i_wire++) {
00609     for (i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
00610       pulse[i_layer][i_wire] = 0;
00611     }
00612     first_bx[i_wire] = -999;
00613     for (int j = 0; j < 3; j++) quality[i_wire][j] = -999;
00614   }
00615 
00616   for (i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++){
00617     digi_num = 0;
00618     for (i_wire = 0; i_wire < numWireGroups; i_wire++) {
00619       if (wire[i_layer][i_wire].size() > 0) {
00620         std::vector<int> bx_times = wire[i_layer][i_wire];
00621         for (unsigned int i = 0; i < bx_times.size(); i++) {
00622           // Check that min and max times are within the allowed range.
00623           if (bx_times[i] < 0 || bx_times[i] + hit_persist >= bits_in_pulse) {
00624             if (infoV > 0) edm::LogWarning("CSCAnodeLCTProcessor")
00625               << "+++ BX time of wire digi (wire = " << i_wire
00626               << " layer = " << i_layer << ") bx = " << bx_times[i]
00627               << " is not within the range (0-" << bits_in_pulse
00628               << "] allowed for pulse extension.  Skip this digi! +++\n";
00629             continue;
00630           }
00631 
00632           // Found at least one in-time digi; set chamber_empty to false
00633           if (chamber_empty) chamber_empty = false;
00634 
00635           // make the pulse
00636           for (unsigned int bx = bx_times[i];
00637                bx < (bx_times[i] + hit_persist); bx++)
00638           pulse[i_layer][i_wire] = pulse[i_layer][i_wire] | (1 << bx);
00639 
00640           // Debug information.
00641           if (infoV > 1) {
00642             LogTrace("CSCAnodeLCTProcessor")
00643               << "Wire digi: layer " << i_layer
00644               << " digi #" << ++digi_num << " wire group " << i_wire
00645               << " time " << bx_times[i];
00646             if (infoV > 2) {
00647               std::ostringstream strstrm;
00648               for (int i = 1; i <= 32; i++) {
00649                 strstrm << ((pulse[i_layer][i_wire]>>(32-i)) & 1);
00650               }
00651               LogTrace("CSCAnodeLCTProcessor") << "  Pulse: " << strstrm.str();
00652             }
00653           }
00654         }
00655       }
00656     }
00657   }
00658 
00659   if (infoV > 1 && !chamber_empty) {
00660     dumpDigis(wire);
00661   }
00662 
00663   return chamber_empty;
00664 }

void CSCAnodeLCTProcessor::readWireDigis ( std::vector< int wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]  )  [private]

ALCT algorithm methods.

Definition at line 543 of file CSCAnodeLCTProcessor.cc.

References begin, digiV, fifo_tbins, i, infoV, LogTrace, CSCConstants::NUM_LAYERS, and numWireGroups.

Referenced by run().

00543                                                                                                                {
00544   /* Gets wire times from the wire digis and fills wire[][] array */
00545 
00546   // Loop over all 6 layers.
00547   for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
00548     // Loop over all digis in the layer and find the wireGroup and bx
00549     // time for each.
00550     for (std::vector<CSCWireDigi>::iterator pld = digiV[i_layer].begin();
00551          pld != digiV[i_layer].end(); pld++) {
00552       int i_wire  = pld->getWireGroup()-1;
00553       std::vector<int> bx_times = pld->getTimeBinsOn();
00554 
00555       // Check that the wires and times are appropriate.
00556       if (i_wire < 0 || i_wire >= numWireGroups) {
00557         if (infoV > 0) edm::LogWarning("CSCAnodeLCTProcessor")
00558           << "+++ Found wire digi with wrong wire number = " << i_wire
00559           << "( max wires = " << numWireGroups << "); skipping it... +++\n";
00560         continue;
00561       }
00562       // Accept digis in expected time window.  Total number of time
00563       // bins in DAQ readout is given by fifo_tbins, which thus
00564       // determines the maximum length of time interval.  Anode raw
00565       // hits in DAQ readout start (fifo_pretrig - 6) clocks before
00566       // L1Accept.  If times earlier than L1Accept were recorded, we
00567       // use them since they can modify the ALCTs found later, via
00568       // ghost-cancellation logic.
00569       //int last_time = -999;
00570       for (unsigned int i = 0; i < bx_times.size(); i++) {
00571         // Comparisons with data show that time bin 0 needs to be skipped.
00572         if (bx_times[i] > 0 && bx_times[i] < static_cast<int>(fifo_tbins)) {
00573           if (infoV > 2) LogTrace("CSCAnodeLCTProcessor")
00574             << "Digi on layer " << i_layer << " wire " << i_wire
00575             << " at time " << bx_times[i];
00576 
00577           // Finally save times of hit wires.  For the time being, if there
00578           // is more than one hit on the same wire, pick the one which
00579           // occurred earlier.
00580           //if (last_time < 0 || (bx_times[i]-last_time) >= 6) {
00581           wire[i_layer][i_wire].push_back(bx_times[i]);
00582           break;
00583             //last_time = bx_times[i];
00584           //}
00585         }
00586         else {
00587           if (infoV > 1) LogTrace("CSCAnodeLCTProcessor")
00588             << "+++ Skipping wire digi: wire = " << i_wire
00589             << " layer = " << i_layer << ", bx = " << bx_times[i] << " +++";
00590         }
00591       }
00592     }
00593   }
00594 }

void CSCAnodeLCTProcessor::run ( const std::vector< int wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]  ) 

Runs the LCT processor code.

Called in normal running or in testing mode.

Definition at line 456 of file CSCAnodeLCTProcessor.cc.

References drift_delay, fifo_tbins, first_bx, ghostCancellationLogic(), infoV, lctSearch(), numWireGroups, patternDetection(), preTrigger(), pulseExtension(), and showPatterns().

00456                                                                                                            {
00457   // This version of the run() function can either be called in a standalone
00458   // test, being passed the time array, or called by the run() function above.
00459   // It gets wire times from an input array and then loops over the keywires.
00460   // All found LCT candidates are sorted and the best two are retained.
00461 
00462   bool trigger = false;
00463 
00464   // Check if there are any in-time hits and do the pulse extension.
00465   bool chamber_empty = pulseExtension(wire);
00466 
00467   // Only do the rest of the processing if chamber is not empty.
00468   if (!chamber_empty) {
00469     for (int i_wire = 0; i_wire < numWireGroups; i_wire++) {
00470       unsigned int start_bx = 0;
00471       // Allow for more than one pass over the hits in the time window.
00472       while (start_bx < fifo_tbins) {
00473         if (preTrigger(i_wire, start_bx)) {
00474           if (infoV > 2) showPatterns(i_wire);
00475           if (patternDetection(i_wire)) {
00476             trigger  = true;
00477             break;
00478           }
00479           else {
00480             // Assume that the earliest time when another pre-trigger can
00481             // occur in case pattern detection failed is bx_pretrigger+6:
00482             // this seems to match the data.
00483             start_bx = first_bx[i_wire] + drift_delay + 4;
00484           }
00485         }
00486         else {
00487           break;
00488         }
00489       }
00490     }
00491   }
00492 
00493   // Do the rest only if there is at least one trigger candidate.
00494   if (trigger) {
00495     ghostCancellationLogic();
00496     lctSearch();
00497   }
00498 }

std::vector< CSCALCTDigi > CSCAnodeLCTProcessor::run ( const CSCWireDigiCollection wiredc  ) 

Runs the LCT processor code.

Called in normal running -- gets info from a collection of wire digis.

Definition at line 376 of file CSCAnodeLCTProcessor.cc.

References CSCTriggerGeomManager::chamber(), CSCTriggerNumbering::chamberFromTriggerLabels(), CSCLayer::geometry(), CSCTriggerGeometry::get(), getALCTs(), getDigis(), infoV, CSCChamber::layer(), CSCConstants::MAX_NUM_WIRES, CSCConstants::NUM_LAYERS, CSCLayerGeometry::numberOfWireGroups(), numWireGroups, readWireDigis(), CSCTriggerNumbering::ringFromTriggerLabels(), theEndcap, theSector, theStation, theSubsector, and theTrigChamber.

Referenced by CSCMotherboard::run().

00376                                                              {
00377   // This is the main routine for normal running.  It gets wire times
00378   // from the wire digis and then passes them on to another run() function.
00379 
00380   // clear(); // redundant; called by L1MuCSCMotherboard.
00381 
00382   // Get the number of wire groups for the given chamber.  Do it only once
00383   // per chamber.
00384   if (numWireGroups == 0) {
00385     CSCTriggerGeomManager* theGeom = CSCTriggerGeometry::get();
00386     CSCChamber* theChamber = theGeom->chamber(theEndcap, theStation, theSector,
00387                                               theSubsector, theTrigChamber);
00388     if (theChamber) {
00389       numWireGroups = theChamber->layer(1)->geometry()->numberOfWireGroups();
00390       if (numWireGroups > CSCConstants::MAX_NUM_WIRES) {
00391         if (infoV > 0) edm::LogWarning("CSCAnodeLCTProcessor")
00392           << "+++ Number of wire groups, " << numWireGroups
00393           << " found in ME" << ((theEndcap == 1) ? "+" : "-")
00394           << theStation << "/"
00395           << CSCTriggerNumbering::ringFromTriggerLabels(theStation,
00396                                                         theTrigChamber) << "/"
00397           << CSCTriggerNumbering::chamberFromTriggerLabels(theSector,
00398                               theSubsector, theStation, theTrigChamber)
00399           << " (sector " << theSector << " subsector " << theSubsector
00400           << " trig id. " << theTrigChamber << ")"
00401           << " exceeds max expected, " << CSCConstants::MAX_NUM_WIRES
00402           << " +++\n" 
00403           << "+++ CSC geometry looks garbled; no emulation possible +++\n";
00404         numWireGroups = -1;
00405       }
00406     }
00407     else {
00408       if (infoV > 0) edm::LogWarning("CSCAnodeLCTProcessor")
00409         << "+++ ME" << ((theEndcap == 1) ? "+" : "-") << theStation << "/"
00410         << CSCTriggerNumbering::ringFromTriggerLabels(theStation,
00411                                                       theTrigChamber) << "/"
00412         << CSCTriggerNumbering::chamberFromTriggerLabels(theSector,
00413                             theSubsector, theStation, theTrigChamber)
00414         << " (sector " << theSector << " subsector " << theSubsector
00415         << " trig id. " << theTrigChamber << ")"
00416         << " is not defined in current geometry! +++\n"
00417         << "+++ CSC geometry looks garbled; no emulation possible +++\n";
00418       numWireGroups = -1;
00419     }
00420   }
00421 
00422   if (numWireGroups < 0) {
00423     if (infoV > 0) edm::LogWarning("CSCAnodeLCTProcessor")
00424       << "+++ ME" << ((theEndcap == 1) ? "+" : "-") << theStation << "/"
00425       << CSCTriggerNumbering::ringFromTriggerLabels(theStation,
00426                                                     theTrigChamber) << "/"
00427       << CSCTriggerNumbering::chamberFromTriggerLabels(theSector,
00428                           theSubsector, theStation, theTrigChamber)
00429       << " (sector " << theSector << " subsector " << theSubsector
00430       << " trig id. " << theTrigChamber << "):"
00431       << " numWireGroups = " << numWireGroups
00432       << "; ALCT emulation skipped! +++";
00433     std::vector<CSCALCTDigi> emptyV;
00434     return emptyV;
00435   }
00436 
00437   // Get wire digis in this chamber from wire digi collection.
00438   bool noDigis = getDigis(wiredc);
00439 
00440   if (!noDigis) {
00441     // First get wire times from the wire digis.
00442     std::vector<int>
00443       wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES];
00444     readWireDigis(wire);
00445 
00446     // Then pass an array of wire times on to another run() doing the LCT
00447     // search.
00448     run(wire);
00449   }
00450 
00451   // Return vector of ALCTs.
00452   std::vector<CSCALCTDigi> tmpV = getALCTs();
00453   return tmpV;
00454 }

void CSCAnodeLCTProcessor::setConfigParameters ( const CSCL1TPParameters conf  ) 

Sets configuration parameters obtained via EventSetup mechanism.

Definition at line 237 of file CSCAnodeLCTProcessor.cc.

References accel_mode, CSCL1TPParameters::alctAccelMode(), CSCL1TPParameters::alctDriftDelay(), CSCL1TPParameters::alctFifoPretrig(), CSCL1TPParameters::alctFifoTbins(), CSCL1TPParameters::alctL1aWindowWidth(), CSCL1TPParameters::alctNplanesHitAccelPattern(), CSCL1TPParameters::alctNplanesHitAccelPretrig(), CSCL1TPParameters::alctNplanesHitPattern(), CSCL1TPParameters::alctNplanesHitPretrig(), CSCL1TPParameters::alctTrigMode(), checkConfigParameters(), drift_delay, dumpConfigParams(), fifo_pretrig, fifo_tbins, l1a_window_width, nplanes_hit_accel_pattern, nplanes_hit_accel_pretrig, nplanes_hit_pattern, nplanes_hit_pretrig, and trig_mode.

Referenced by CSCMotherboard::setConfigParameters().

00237                                                                             {
00238   static bool config_dumped = false;
00239 
00240   fifo_tbins   = conf->alctFifoTbins();
00241   fifo_pretrig = conf->alctFifoPretrig();
00242   drift_delay  = conf->alctDriftDelay();
00243   nplanes_hit_pretrig = conf->alctNplanesHitPretrig();
00244   nplanes_hit_pattern = conf->alctNplanesHitPattern();
00245   nplanes_hit_accel_pretrig = conf->alctNplanesHitAccelPretrig();
00246   nplanes_hit_accel_pattern = conf->alctNplanesHitAccelPattern();
00247   trig_mode        = conf->alctTrigMode();
00248   accel_mode       = conf->alctAccelMode();
00249   l1a_window_width = conf->alctL1aWindowWidth();
00250 
00251   // Check and print configuration parameters.
00252   checkConfigParameters();
00253   if (!config_dumped) {
00254     dumpConfigParams();
00255     config_dumped = true;
00256   }
00257 }

void CSCAnodeLCTProcessor::setDefaultConfigParameters (  )  [private]

Set default values for configuration parameters.

Definition at line 222 of file CSCAnodeLCTProcessor.cc.

References accel_mode, def_accel_mode, def_drift_delay, def_fifo_pretrig, def_fifo_tbins, def_l1a_window_width, def_nplanes_hit_accel_pattern, def_nplanes_hit_accel_pretrig, def_nplanes_hit_pattern, def_nplanes_hit_pretrig, def_trig_mode, drift_delay, fifo_pretrig, fifo_tbins, l1a_window_width, nplanes_hit_accel_pattern, nplanes_hit_accel_pretrig, nplanes_hit_pattern, nplanes_hit_pretrig, and trig_mode.

Referenced by CSCAnodeLCTProcessor().

void CSCAnodeLCTProcessor::showPatterns ( const int  key_wire  )  [private]

Definition at line 1348 of file CSCAnodeLCTProcessor.cc.

References i, LogTrace, MESelection, CSCConstants::NUM_ALCT_PATTERNS, NUM_PATTERN_WIRES, pattern_envelope, and pattern_mask.

Referenced by run().

01348                                                           {
01349   /* Method to test the pretrigger */
01350   for (int i_pattern = 0; i_pattern < CSCConstants::NUM_ALCT_PATTERNS;
01351        i_pattern++) {
01352     std::ostringstream strstrm_header;
01353     LogTrace("CSCAnodeLCTProcessor")
01354       << "\n" << "Pattern: " << i_pattern << " Key wire: " << key_wire;
01355     for (int i = 1; i <= 32; i++) {
01356       strstrm_header << ((32-i)%10);
01357     }
01358     LogTrace("CSCAnodeLCTProcessor") << strstrm_header.str();
01359     for (int i_wire = 0; i_wire < NUM_PATTERN_WIRES; i_wire++) {
01360       if (pattern_mask[i_pattern][i_wire] != 0) {
01361         std::ostringstream strstrm_pulse;
01362         int this_layer = pattern_envelope[0][i_wire];
01363         int this_wire  = pattern_envelope[1+MESelection][i_wire]+key_wire;
01364         for (int i = 1; i <= 32; i++) {
01365           strstrm_pulse << ((pulse[this_layer][this_wire]>>(32-i)) & 1);
01366         }
01367         LogTrace("CSCAnodeLCTProcessor")
01368           << strstrm_pulse.str() << " on layer " << this_layer;
01369       }
01370     }
01371     LogTrace("CSCAnodeLCTProcessor")
01372       << "-------------------------------------------";
01373   }
01374 }

void CSCAnodeLCTProcessor::trigMode ( const int  key_wire  )  [private]

Definition at line 1188 of file CSCAnodeLCTProcessor.cc.

References infoV, LogTrace, quality, and trig_mode.

Referenced by lctSearch().

01188                                                       {
01189   /* Function which enables/disables either collision or accelerator tracks.
01190      The function uses the trig_mode parameter to decide. */
01191 
01192   switch(trig_mode) {
01193   default:
01194   case 0:
01195     // Enables both collision and accelerator tracks
01196     break;
01197   case 1:
01198     // Disables collision tracks
01199     if (quality[key_wire][1] > 0) {
01200       quality[key_wire][1] = 0;
01201       if (infoV > 1) LogTrace("CSCAnodeLCTProcessor")
01202         << "trigMode(): collision track " << key_wire << " disabled" << "\n";
01203     }
01204     break;
01205   case 2:
01206     // Disables accelerator tracks
01207     if (quality[key_wire][0] > 0) {
01208       quality[key_wire][0] = 0;
01209       if (infoV > 1) LogTrace("CSCAnodeLCTProcessor")
01210         << "trigMode(): accelerator track " << key_wire << " disabled" << "\n";
01211     }
01212     break;
01213   case 3:
01214     // Disables collision track if there is an accelerator track found
01215     // in the same wire group at the same time
01216     if (quality[key_wire][0] > 0 && quality[key_wire][1] > 0) {
01217       quality[key_wire][1] = 0;
01218       if (infoV > 1) LogTrace("CSCAnodeLCTProcessor")
01219         << "trigMode(): collision track " << key_wire << " disabled" << "\n";
01220     }
01221     break;
01222   }
01223 }


Member Data Documentation

unsigned int CSCAnodeLCTProcessor::accel_mode [private]

Definition at line 111 of file CSCAnodeLCTProcessor.h.

Referenced by accelMode(), checkConfigParameters(), CSCAnodeLCTProcessor(), dumpConfigParams(), setConfigParameters(), and setDefaultConfigParameters().

CSCALCTDigi CSCAnodeLCTProcessor::bestALCT[MAX_ALCT_BINS]

Best LCTs in this chamber, as found by the processor.

In old ALCT algorithms, up to two best ALCT per Level-1 accept window had been reported. In the ALCT-2006 algorithms, up to two best ALCTs PER EVERY TIME BIN in Level-1 accept window are reported.

Definition at line 65 of file CSCAnodeLCTProcessor.h.

Referenced by clear(), getALCTs(), lctSearch(), and CSCMotherboard::run().

const unsigned int CSCAnodeLCTProcessor::def_accel_mode = 0 [static, private]

Definition at line 119 of file CSCAnodeLCTProcessor.h.

Referenced by checkConfigParameters(), and setDefaultConfigParameters().

const unsigned int CSCAnodeLCTProcessor::def_drift_delay = 2 [static, private]

Definition at line 115 of file CSCAnodeLCTProcessor.h.

Referenced by checkConfigParameters(), and setDefaultConfigParameters().

const unsigned int CSCAnodeLCTProcessor::def_fifo_pretrig = 10 [static, private]

Definition at line 114 of file CSCAnodeLCTProcessor.h.

Referenced by checkConfigParameters(), and setDefaultConfigParameters().

const unsigned int CSCAnodeLCTProcessor::def_fifo_tbins = 16 [static, private]

Default values of configuration parameters.

Definition at line 114 of file CSCAnodeLCTProcessor.h.

Referenced by checkConfigParameters(), and setDefaultConfigParameters().

const unsigned int CSCAnodeLCTProcessor::def_l1a_window_width = 7 [static, private]

Definition at line 120 of file CSCAnodeLCTProcessor.h.

Referenced by checkConfigParameters(), and setDefaultConfigParameters().

const unsigned int CSCAnodeLCTProcessor::def_nplanes_hit_accel_pattern = 4 [static, private]

Definition at line 118 of file CSCAnodeLCTProcessor.h.

Referenced by checkConfigParameters(), and setDefaultConfigParameters().

const unsigned int CSCAnodeLCTProcessor::def_nplanes_hit_accel_pretrig = 2 [static, private]

Definition at line 117 of file CSCAnodeLCTProcessor.h.

Referenced by checkConfigParameters(), and setDefaultConfigParameters().

const unsigned int CSCAnodeLCTProcessor::def_nplanes_hit_pattern = 4 [static, private]

Definition at line 116 of file CSCAnodeLCTProcessor.h.

Referenced by checkConfigParameters(), and setDefaultConfigParameters().

const unsigned int CSCAnodeLCTProcessor::def_nplanes_hit_pretrig = 2 [static, private]

Definition at line 116 of file CSCAnodeLCTProcessor.h.

Referenced by checkConfigParameters(), and setDefaultConfigParameters().

const unsigned int CSCAnodeLCTProcessor::def_trig_mode = 2 [static, private]

Definition at line 119 of file CSCAnodeLCTProcessor.h.

Referenced by checkConfigParameters(), and setDefaultConfigParameters().

std::vector<CSCWireDigi> CSCAnodeLCTProcessor::digiV[CSCConstants::NUM_LAYERS] [private]

Definition at line 98 of file CSCAnodeLCTProcessor.h.

Referenced by getDigis(), and readWireDigis().

unsigned int CSCAnodeLCTProcessor::drift_delay [private]

Definition at line 108 of file CSCAnodeLCTProcessor.h.

Referenced by checkConfigParameters(), CSCAnodeLCTProcessor(), dumpConfigParams(), patternDetection(), run(), setConfigParameters(), and setDefaultConfigParameters().

unsigned int CSCAnodeLCTProcessor::fifo_pretrig [private]

Definition at line 108 of file CSCAnodeLCTProcessor.h.

Referenced by bestTrackSelector(), checkConfigParameters(), CSCAnodeLCTProcessor(), dumpConfigParams(), setConfigParameters(), and setDefaultConfigParameters().

unsigned int CSCAnodeLCTProcessor::fifo_tbins [private]

Configuration parameters.

Definition at line 108 of file CSCAnodeLCTProcessor.h.

Referenced by checkConfigParameters(), CSCAnodeLCTProcessor(), dumpConfigParams(), preTrigger(), readWireDigis(), run(), setConfigParameters(), and setDefaultConfigParameters().

int CSCAnodeLCTProcessor::first_bx[CSCConstants::MAX_NUM_WIRES] [private]

Definition at line 96 of file CSCAnodeLCTProcessor.h.

Referenced by ghostCancellationLogic(), lctSearch(), patternDetection(), preTrigger(), pulseExtension(), and run().

int CSCAnodeLCTProcessor::infoV [private]

Verbosity level: 0: no print (default).

1: print only ALCTs found. 2: info at every step of the algorithm. 3: add special-purpose prints.

Definition at line 84 of file CSCAnodeLCTProcessor.h.

Referenced by accelMode(), bestTrackSelector(), checkConfigParameters(), CSCAnodeLCTProcessor(), getDigis(), ghostCancellationLogic(), lctSearch(), patternDetection(), preTrigger(), pulseExtension(), readWireDigis(), run(), and trigMode().

bool CSCAnodeLCTProcessor::isMTCC [private]

Flag for MTCC data.

Definition at line 102 of file CSCAnodeLCTProcessor.h.

Referenced by CSCAnodeLCTProcessor().

bool CSCAnodeLCTProcessor::isTMB07 [private]

Use TMB07 flag for DAQ-2006 version (implemented in late 2007).

Definition at line 105 of file CSCAnodeLCTProcessor.h.

Referenced by CSCAnodeLCTProcessor(), lctSearch(), and patternDetection().

unsigned int CSCAnodeLCTProcessor::l1a_window_width [private]

Definition at line 111 of file CSCAnodeLCTProcessor.h.

Referenced by bestTrackSelector(), checkConfigParameters(), CSCAnodeLCTProcessor(), dumpConfigParams(), setConfigParameters(), and setDefaultConfigParameters().

int CSCAnodeLCTProcessor::MESelection [private]

Definition at line 94 of file CSCAnodeLCTProcessor.h.

Referenced by CSCAnodeLCTProcessor(), patternDetection(), preTrigger(), and showPatterns().

unsigned int CSCAnodeLCTProcessor::nplanes_hit_accel_pattern [private]

Definition at line 110 of file CSCAnodeLCTProcessor.h.

Referenced by checkConfigParameters(), CSCAnodeLCTProcessor(), dumpConfigParams(), patternDetection(), setConfigParameters(), and setDefaultConfigParameters().

unsigned int CSCAnodeLCTProcessor::nplanes_hit_accel_pretrig [private]

Definition at line 109 of file CSCAnodeLCTProcessor.h.

Referenced by checkConfigParameters(), CSCAnodeLCTProcessor(), dumpConfigParams(), preTrigger(), setConfigParameters(), and setDefaultConfigParameters().

unsigned int CSCAnodeLCTProcessor::nplanes_hit_pattern [private]

Definition at line 110 of file CSCAnodeLCTProcessor.h.

Referenced by checkConfigParameters(), CSCAnodeLCTProcessor(), dumpConfigParams(), patternDetection(), setConfigParameters(), and setDefaultConfigParameters().

unsigned int CSCAnodeLCTProcessor::nplanes_hit_pretrig [private]

Definition at line 109 of file CSCAnodeLCTProcessor.h.

Referenced by checkConfigParameters(), CSCAnodeLCTProcessor(), dumpConfigParams(), preTrigger(), setConfigParameters(), and setDefaultConfigParameters().

int CSCAnodeLCTProcessor::numWireGroups [private]

Definition at line 93 of file CSCAnodeLCTProcessor.h.

Referenced by CSCAnodeLCTProcessor(), dumpDigis(), ghostCancellationLogic(), lctSearch(), patternDetection(), preTrigger(), pulseExtension(), readWireDigis(), and run().

const int CSCAnodeLCTProcessor::pattern_envelope [static]

Initial value:

 {
  
  { 0,  0,  0,
        1,  1,
            2,
            3,  3,
            4,  4,  4,
            5,  5,  5},

  
  {-2, -1,  0,
       -1,  0,
            0,
            0,  1,
            0,  1,  2,
            0,  1,  2},

  
  {2,  1,  0,
       1,  0,
           0,
           0, -1,
           0, -1, -2,
           0, -1, -2}
}

Definition at line 75 of file CSCAnodeLCTProcessor.h.

Referenced by patternDetection(), preTrigger(), and showPatterns().

int CSCAnodeLCTProcessor::pattern_mask[CSCConstants::NUM_ALCT_PATTERNS][NUM_PATTERN_WIRES] [private]

Chosen pattern mask.

Definition at line 123 of file CSCAnodeLCTProcessor.h.

Referenced by CSCAnodeLCTProcessor(), patternDetection(), preTrigger(), and showPatterns().

const int CSCAnodeLCTProcessor::pattern_mask_default [static]

Initial value:

 {
  
  {0,  0,  1,
       0,  1,
           1,
           1,  0,
           1,  0,  0,
           1,  0,  0},

  
  {0,  1,  0,
       1,  1,
           1,
           1,  0,
           0,  1,  0,
           0,  1,  0},

  
  {1,  1,  0,
       1,  1,
           1,
           1,  1,
           0,  1,  1,
           0,  0,  1}
}

Definition at line 76 of file CSCAnodeLCTProcessor.h.

Referenced by CSCAnodeLCTProcessor().

const int CSCAnodeLCTProcessor::pattern_mask_MTCC [static]

Initial value:

 {
  
  {0,  0,  1,
       0,  1,
           1,
           1,  0,
           1,  0,  0,
           1,  0,  0},

  
  {1,  1,  1,
       1,  1,
           1,
           1,  1,
           1,  1,  1,
           1,  1,  1},

  
  {1,  1,  1,
       1,  1,
           1,
           1,  1,
           1,  1,  1,
           1,  1,  1}
}

Definition at line 77 of file CSCAnodeLCTProcessor.h.

Referenced by CSCAnodeLCTProcessor().

unsigned int CSCAnodeLCTProcessor::pulse[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES] [private]

Definition at line 99 of file CSCAnodeLCTProcessor.h.

Referenced by patternDetection(), preTrigger(), and pulseExtension().

int CSCAnodeLCTProcessor::quality[CSCConstants::MAX_NUM_WIRES][3] [private]

Definition at line 97 of file CSCAnodeLCTProcessor.h.

Referenced by accelMode(), clear(), ghostCancellationLogic(), isBetterALCT(), lctSearch(), patternDetection(), pulseExtension(), and trigMode().

CSCALCTDigi CSCAnodeLCTProcessor::secondALCT[MAX_ALCT_BINS]

Second best LCTs in this chamber, as found by the processor.

Definition at line 68 of file CSCAnodeLCTProcessor.h.

Referenced by clear(), getALCTs(), lctSearch(), and CSCMotherboard::run().

const unsigned CSCAnodeLCTProcessor::theEndcap [private]

Chamber id (trigger-type labels).

Definition at line 87 of file CSCAnodeLCTProcessor.h.

Referenced by dumpDigis(), getDigis(), lctSearch(), and run().

const unsigned CSCAnodeLCTProcessor::theSector [private]

Definition at line 89 of file CSCAnodeLCTProcessor.h.

Referenced by dumpDigis(), getDigis(), lctSearch(), and run().

const unsigned CSCAnodeLCTProcessor::theStation [private]

Definition at line 88 of file CSCAnodeLCTProcessor.h.

Referenced by CSCAnodeLCTProcessor(), dumpDigis(), getDigis(), lctSearch(), and run().

const unsigned CSCAnodeLCTProcessor::theSubsector [private]

Definition at line 90 of file CSCAnodeLCTProcessor.h.

Referenced by dumpDigis(), getDigis(), lctSearch(), and run().

const unsigned CSCAnodeLCTProcessor::theTrigChamber [private]

Definition at line 91 of file CSCAnodeLCTProcessor.h.

Referenced by dumpDigis(), getDigis(), lctSearch(), and run().

unsigned int CSCAnodeLCTProcessor::trig_mode [private]

Definition at line 111 of file CSCAnodeLCTProcessor.h.

Referenced by checkConfigParameters(), CSCAnodeLCTProcessor(), dumpConfigParams(), setConfigParameters(), setDefaultConfigParameters(), and trigMode().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:17:04 2009 for CMSSW by  doxygen 1.5.4