Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:21:25

0001 #ifndef PFEGINPUT_REF_H
0002 #define PFEGINPUT_REF_H
0003 
0004 #include "DataFormats/L1TParticleFlow/interface/layer1_emulator.h"
0005 #include "DataFormats/L1TParticleFlow/interface/egamma.h"
0006 #include "DataFormats/L1TParticleFlow/interface/pf.h"
0007 
0008 namespace edm {
0009   class ParameterSet;
0010   class ParameterSetDescription;
0011 }  // namespace edm
0012 
0013 namespace l1ct {
0014 
0015   struct EGInputSelectorEmuConfig {
0016     EGInputSelectorEmuConfig(const edm::ParameterSet &iConfig);
0017     EGInputSelectorEmuConfig(unsigned int emIdMask, unsigned int nHADCALO_IN, unsigned int nEMCALO_OUT, int debug)
0018         : idMask(emIdMask), nHADCALO_IN(nHADCALO_IN), nEMCALO_OUT(nEMCALO_OUT), debug(debug) {}
0019 
0020     static edm::ParameterSetDescription getParameterSetDescription();
0021 
0022     emid_t idMask;
0023     unsigned int nHADCALO_IN;
0024     unsigned int nEMCALO_OUT;
0025 
0026     int debug;
0027   };
0028 
0029   class EGInputSelectorEmulator {
0030   public:
0031     EGInputSelectorEmulator(const EGInputSelectorEmuConfig &config) : cfg(config), debug_(cfg.debug) {}
0032 
0033     virtual ~EGInputSelectorEmulator() {}
0034 
0035     void toFirmware(const PFInputRegion &in, HadCaloObj hadcalo[/*nCALO*/]) const;
0036     void toFirmware(const std::vector<l1ct::EmCaloObjEmu> &emcalo_sel, l1ct::EmCaloObj emcalo[]) const;
0037 
0038     void select_eginput(const l1ct::HadCaloObjEmu &in, l1ct::EmCaloObjEmu &out, bool &valid_out) const;
0039     void select_eginputs(const std::vector<l1ct::HadCaloObjEmu> &hadcalo_in,
0040                          std::vector<l1ct::EmCaloObjEmu> &emcalo_sel) const;
0041 
0042     /// if the hadcalo passes the EM selection, do the conversion, otherwise zero-out the result
0043     void select_or_clear(const l1ct::HadCaloObjEmu &hadcalo_in, l1ct::EmCaloObjEmu &emcalo_out) const;
0044 
0045     /// apply select_or_clear on all elements of the input vector
0046     void select_or_clear(const std::vector<l1ct::HadCaloObjEmu> &hadcalo_in,
0047                          std::vector<l1ct::EmCaloObjEmu> &emcalo_out) const;
0048 
0049     // void run(const PFInputRegion &in, OutputRegion &out) const;
0050 
0051     void setDebug(int debug) { debug_ = debug; }
0052 
0053   private:
0054     EGInputSelectorEmuConfig cfg;
0055     int debug_;
0056   };
0057 }  // namespace l1ct
0058 
0059 #endif