Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-04-07 05:50:16

0001 #ifndef EventFilter_CSCRawToDigi_CSCDigiToRaw_h
0002 #define EventFilter_CSCRawToDigi_CSCDigiToRaw_h
0003 
0004 /** \class CSCDigiToRaw
0005  *
0006  *  \author A. Tumanov - Rice
0007  */
0008 
0009 #include "DataFormats/Provenance/interface/EventID.h"
0010 #include "DataFormats/CSCDigi/interface/CSCStripDigiCollection.h"
0011 #include "DataFormats/CSCDigi/interface/CSCWireDigiCollection.h"
0012 #include "DataFormats/CSCDigi/interface/CSCComparatorDigiCollection.h"
0013 #include "DataFormats/CSCDigi/interface/CSCALCTDigiCollection.h"
0014 #include "DataFormats/CSCDigi/interface/CSCCLCTDigiCollection.h"
0015 #include "DataFormats/CSCDigi/interface/CSCCLCTPreTriggerCollection.h"
0016 #include "DataFormats/CSCDigi/interface/CSCCLCTPreTriggerDigiCollection.h"
0017 #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiCollection.h"
0018 #include "DataFormats/CSCDigi/interface/CSCShowerDigiCollection.h"
0019 #include "DataFormats/GEMDigi/interface/GEMPadDigiClusterCollection.h"
0020 #include "EventFilter/CSCRawToDigi/interface/CSCEventData.h"
0021 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0022 
0023 class FEDRawDataCollection;
0024 class CSCChamberMap;
0025 
0026 class CSCDigiToRaw {
0027 public:
0028   /// CSC Shower HMT bits types
0029   enum CSCShowerType { lctShower = 0, anodeShower = 1, cathodeShower = 2, anodeALCTShower = 3 };
0030 
0031   /// Constructor
0032   explicit CSCDigiToRaw(const edm::ParameterSet& pset);
0033 
0034   /// Take a vector of digis and fill the FEDRawDataCollection
0035   void createFedBuffers(const CSCStripDigiCollection& stripDigis,
0036                         const CSCWireDigiCollection& wireDigis,
0037                         const CSCComparatorDigiCollection& comparatorDigis,
0038                         const CSCALCTDigiCollection& alctDigis,
0039                         const CSCCLCTDigiCollection& clctDigis,
0040                         const CSCCLCTPreTriggerCollection* preTriggers,
0041                         const CSCCLCTPreTriggerDigiCollection* preTriggerDigis,
0042                         const CSCCorrelatedLCTDigiCollection& correlatedLCTDigis,
0043                         const CSCShowerDigiCollection* showerDigis,
0044                         const CSCShowerDigiCollection* anodeShowerDigis,
0045                         const CSCShowerDigiCollection* cathodeShowerDigis,
0046                         const CSCShowerDigiCollection* anodeALCTShowerDigis,
0047                         const GEMPadDigiClusterCollection* padDigiClusters,
0048                         FEDRawDataCollection& fed_buffers,
0049                         const CSCChamberMap* theMapping,
0050                         const edm::EventID& eid) const;
0051 
0052 private:
0053   struct FindEventDataInfo {
0054     FindEventDataInfo(const CSCChamberMap* map, uint16_t version) : theElectronicsMap{map}, formatVersion_{version} {}
0055 
0056     using ChamberDataMap = std::map<CSCDetId, CSCEventData>;
0057     ChamberDataMap theChamberDataMap;
0058     const CSCChamberMap* theElectronicsMap;
0059     const uint16_t formatVersion_;
0060   };
0061 
0062   // specialized because it reverses strip direction
0063   void add(const CSCStripDigiCollection& stripDigis,
0064            const CSCCLCTPreTriggerCollection* preTriggers,
0065            const CSCCLCTPreTriggerDigiCollection* preTriggerDigis,
0066            FindEventDataInfo&) const;
0067   void add(const CSCWireDigiCollection& wireDigis, const CSCALCTDigiCollection& alctDigis, FindEventDataInfo&) const;
0068   // may require CLCTs to read out comparators.  Doesn't add CLCTs.
0069   void add(const CSCComparatorDigiCollection& comparatorDigis,
0070            const CSCCLCTDigiCollection& clctDigis,
0071            FindEventDataInfo&) const;
0072   void add(const CSCALCTDigiCollection& alctDigis, FindEventDataInfo&) const;
0073   void add(const CSCCLCTDigiCollection& clctDigis, FindEventDataInfo&) const;
0074   void add(const CSCCorrelatedLCTDigiCollection& corrLCTDigis, FindEventDataInfo&) const;
0075   /// Run3 packing of CSCShower objects depending on shower HMT type
0076   void add(const CSCShowerDigiCollection& cscShowerDigis,
0077            FindEventDataInfo&,
0078            enum CSCShowerType shower = CSCShowerType::lctShower) const;
0079   /// Run3 adding GEM GE11 Pad Clusters trigger objects
0080   void add(const GEMPadDigiClusterCollection& gemPadClusters, FindEventDataInfo&) const;
0081   /// pick out the correct data object for this chamber
0082   CSCEventData& findEventData(const CSCDetId& cscDetId, FindEventDataInfo&) const;
0083 
0084   const int alctWindowMin_;
0085   const int alctWindowMax_;
0086   const int clctWindowMin_;
0087   const int clctWindowMax_;
0088   const int preTriggerWindowMin_;
0089   const int preTriggerWindowMax_;
0090 
0091   uint16_t formatVersion_;
0092   bool packEverything_;
0093   bool usePreTriggers_;
0094   bool packByCFEB_;
0095 };
0096 
0097 #endif