Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:19:34

0001 #ifndef L1Trigger_CSCTriggerPrimitives_CSCTriggerPrimitivesBuilder_h
0002 #define L1Trigger_CSCTriggerPrimitives_CSCTriggerPrimitivesBuilder_h
0003 
0004 /** class CSCTriggerPrimitivesBuilder
0005  *
0006  * Algorithm to build anode, cathode, and correlated LCTs from wire and
0007  * comparator digis in endcap muon CSCs by implementing a 'build' function
0008  * required by CSCTriggerPrimitivesProducer.
0009  *
0010  * Configured via the Producer's ParameterSet.
0011  *
0012  * author Slava Valuev, UCLA.
0013  *
0014  * The builder was expanded to use GEM pad or GEM pad clusters
0015  * In addition the builder can produce GEM coincidence pads in
0016  * case an upgrade scenario with GEMs is run.
0017  *
0018  * authors: Sven Dildick (TAMU), Tao Huang (TAMU)
0019  */
0020 
0021 #include "CondFormats/CSCObjects/interface/CSCBadChambers.h"
0022 #include "CondFormats/CSCObjects/interface/CSCL1TPLookupTableCCLUT.h"
0023 #include "CondFormats/CSCObjects/interface/CSCL1TPLookupTableME21ILT.h"
0024 #include "CondFormats/CSCObjects/interface/CSCL1TPLookupTableME11ILT.h"
0025 #include "DataFormats/CSCDigi/interface/CSCComparatorDigiCollection.h"
0026 #include "DataFormats/CSCDigi/interface/CSCWireDigiCollection.h"
0027 #include "DataFormats/CSCDigi/interface/CSCALCTDigiCollection.h"
0028 #include "DataFormats/CSCDigi/interface/CSCCLCTDigiCollection.h"
0029 #include "DataFormats/CSCDigi/interface/CSCALCTPreTriggerDigiCollection.h"
0030 #include "DataFormats/CSCDigi/interface/CSCCLCTPreTriggerDigiCollection.h"
0031 #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiCollection.h"
0032 #include "DataFormats/CSCDigi/interface/CSCCLCTPreTriggerCollection.h"
0033 #include "DataFormats/CSCDigi/interface/CSCShowerDigiCollection.h"
0034 #include "DataFormats/GEMDigi/interface/GEMPadDigiClusterCollection.h"
0035 #include "DataFormats/GEMDigi/interface/GEMCoPadDigiCollection.h"
0036 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0037 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0038 
0039 class CSCDBL1TPParameters;
0040 class CSCMotherboard;
0041 class CSCMuonPortCard;
0042 class CSCGeometry;
0043 class GEMGeometry;
0044 class CSCTriggerPrimitivesBuilder {
0045 public:
0046   /** Configure the algorithm via constructor.
0047    *  Receives ParameterSet percolated down from EDProducer which owns this
0048    *  Builder.
0049    */
0050   explicit CSCTriggerPrimitivesBuilder(const edm::ParameterSet&);
0051 
0052   ~CSCTriggerPrimitivesBuilder();
0053 
0054   struct BuildContext {
0055     const CSCL1TPLookupTableCCLUT* cclut_;
0056     const CSCL1TPLookupTableME11ILT* me11ilt_;
0057     const CSCL1TPLookupTableME21ILT* me21ilt_;
0058     const CSCGeometry* cscgeom_;
0059     const GEMGeometry* gemgeom_;
0060     const CSCDBL1TPParameters* parameters_;
0061   };
0062 
0063   // Build anode, cathode, and correlated LCTs in each chamber and fill them
0064   // into output collections.  Pass collections of wire and comparator digis
0065   // to Trigger MotherBoard (TMB) processors, which, in turn, pass them to
0066   // ALCT and CLCT processors.  Up to 2 anode and 2 cathode LCTs can be found
0067   // in each chamber during any bunch crossing.  The 2 projections are then
0068   // combined into three-dimensional "correlated" LCTs in the TMB.  Finally,
0069   // MPC processor sorts up to 18 LCTs from 9 TMBs and writes collections of
0070   // up to 3 best LCTs per (sub)sector into Event (to be used by the Sector
0071   // Receiver).
0072   void build(const CSCBadChambers* badChambers,
0073              const CSCWireDigiCollection* wiredc,
0074              const CSCComparatorDigiCollection* compdc,
0075              const GEMPadDigiClusterCollection* gemPadClusters,
0076              const BuildContext& context,
0077              CSCALCTDigiCollection& oc_alct,
0078              CSCCLCTDigiCollection& oc_clct,
0079              CSCALCTPreTriggerDigiCollection& oc_alctpretrigger,
0080              CSCCLCTPreTriggerDigiCollection& oc_clctpretrigger,
0081              CSCCLCTPreTriggerCollection& oc_pretrig,
0082              CSCCorrelatedLCTDigiCollection& oc_lct,
0083              CSCCorrelatedLCTDigiCollection& oc_sorted_lct,
0084              CSCShowerDigiCollection& oc_shower_anode,
0085              CSCShowerDigiCollection& oc_shower_cathode,
0086              CSCShowerDigiCollection& oc_shower,
0087              GEMCoPadDigiCollection& oc_gemcopad);
0088 
0089   /** Max values of trigger labels for all CSCs; used to construct TMB
0090    *  processors. */
0091   enum trig_cscs { MAX_ENDCAPS = 2, MAX_STATIONS = 4, MAX_SECTORS = 6, MAX_SUBSECTORS = 2, MAX_CHAMBERS = 9 };
0092 
0093 private:
0094   /** template function to put data in the output
0095       helps to reduce the large amount of code duplication!
0096    */
0097   template <class T, class S>
0098   void put(const T&, S&, const CSCDetId&, std::string comment);
0099 
0100   /** Min and max allowed values for various CSC elements, defined in
0101    *  CSCDetId and CSCTriggerNumbering classes. */
0102   static const int min_endcap;  // endcaps
0103   static const int max_endcap;
0104   static const int min_station;  // stations per endcap
0105   static const int max_station;
0106   static const int min_sector;  // trigger sectors per station
0107   static const int max_sector;
0108   static const int min_subsector;  // trigger subsectors per sector
0109   static const int max_subsector;
0110   static const int min_chamber;  // chambers per trigger subsector
0111   static const int max_chamber;
0112 
0113   // debug
0114   int infoV;
0115 
0116   /// a flag whether to skip chambers from the bad chambers map
0117   bool checkBadChambers_;
0118 
0119   /** Phase2: special configuration parameters for ME11 treatment. */
0120   bool runPhase2_;
0121 
0122   /** Phase2: special switch for disabling ME42 */
0123   bool disableME42_;
0124 
0125   /** Phase2: individual switches */
0126   bool runME11Up_;
0127   bool runME21Up_;
0128 
0129   /** Phase2: special switch for the upgrade ME1/1 TMB */
0130   bool runME11ILT_;
0131 
0132   /** Phase2: special switch for the upgrade ME2/1 TMB */
0133   bool runME21ILT_;
0134 
0135   /** Selected chambers to run */
0136   std::vector<std::string> selectedChambers_;
0137 
0138   /** Pointers to TMB processors for all possible chambers. */
0139   std::unique_ptr<CSCMotherboard> tmb_[MAX_ENDCAPS][MAX_STATIONS][MAX_SECTORS][MAX_SUBSECTORS][MAX_CHAMBERS];
0140 
0141   /** Pointer to MPC processors. */
0142   std::unique_ptr<CSCMuonPortCard> mpc_[MAX_ENDCAPS][MAX_STATIONS][MAX_SECTORS];
0143 };
0144 
0145 template <class T, class S>
0146 void CSCTriggerPrimitivesBuilder::put(const T& t, S& s, const CSCDetId& detid, std::string comment) {
0147   if (!t.empty()) {
0148     LogTrace("L1CSCTrigger") << "Put " << t.size() << comment << ((t.size() > 1) ? "s " : " ") << "in collection\n";
0149     s.put(std::make_pair(t.begin(), t.end()), detid);
0150   }
0151 }
0152 
0153 #endif