Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef HtrXmlPatternSet_h_included
0002 #define HtrXmlPatternSet_h_included 1
0003 
0004 #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
0005 #include "HtrXmlPatternToolParameters.h"
0006 #include "CondFormats/HcalObjects/interface/HcalElectronicsMap.h"
0007 
0008 class ChannelPattern {
0009 public:
0010   static const int SAMPLES = 512;
0011   static const int NUM_CRATES = 18;
0012   //this is one larger than it 'needs' to be so that the array index can match the physical slot number
0013   static const int NUM_SLOTS = 22;
0014 
0015   ChannelPattern();
0016   void setLoc(int crate, int slot, int tb, int chan) {
0017     m_crate = crate;
0018     m_slot = slot;
0019     m_tb = tb;
0020     m_chan = chan;
0021   }
0022   int getCrate() const { return m_crate; }
0023   int getSlot() const { return m_slot; }
0024   int getTB() const { return m_tb; }
0025   int getChan() const { return m_chan; }
0026   double& operator[](int bc) { return fCReal[bc]; }
0027   const double operator[](int bc) const { return fCReal[bc]; }
0028   void encode();
0029   int getCoded(int bc) const { return fCCoded[bc]; }
0030   double getQuantized(int bc) const { return fCQuantized[bc]; }
0031   void Fill(HtrXmlPatternToolParameters* params, HBHEDigiCollection::const_iterator data);
0032   void Fill(HtrXmlPatternToolParameters* params, HFDigiCollection::const_iterator data);
0033   void Fill(HtrXmlPatternToolParameters* params, HODigiCollection::const_iterator data);
0034   void Fill_by_hand(const HcalElectronicsMap*, int);
0035 
0036 private:
0037   double fCReal[SAMPLES];
0038   double fCQuantized[SAMPLES];
0039   int fCCoded[SAMPLES];
0040   int m_crate, m_slot, m_tb, m_chan;
0041   int m_sample_pos;
0042 };
0043 
0044 class HalfHtrData {
0045 public:
0046   HalfHtrData(int crate, int slot, int tb);
0047   ChannelPattern* getPattern(int chan) { return (chan >= 1 && chan <= 24) ? (&m_patterns[chan - 1]) : (nullptr); }
0048   int getCrate() const { return m_crate; }
0049   int getSlot() const { return m_slot; }
0050   int getTB() const { return m_tb; }
0051   int getSpigot() const { return m_spigot; }
0052   int getDCC() const { return m_dcc; }
0053   void setSpigot(int spigot) { m_spigot = spigot; }
0054   void setDCC(int dcc) { m_dcc = dcc; }
0055 
0056 private:
0057   ChannelPattern m_patterns[24];
0058   int m_crate, m_slot, m_tb;
0059   int m_dcc, m_spigot;
0060 };
0061 
0062 class CrateData {
0063 public:
0064   CrateData(int crate, int slotsActive[ChannelPattern::NUM_SLOTS]);
0065   ~CrateData();
0066   HalfHtrData* getHalfHtrData(int slot, int one_two_tb);
0067 
0068 private:
0069   HalfHtrData* m_slotsDoubled[ChannelPattern::NUM_SLOTS][2];
0070 };
0071 
0072 class HtrXmlPatternSet {
0073 public:
0074   HtrXmlPatternSet(int cratesActive[ChannelPattern::NUM_CRATES], int slotsActive[ChannelPattern::NUM_SLOTS]);
0075   ~HtrXmlPatternSet();
0076   CrateData* getCrate(int crate);
0077 
0078 private:
0079   CrateData* m_crates[ChannelPattern::NUM_CRATES];
0080 };
0081 
0082 #endif