00001 #ifndef HtrXmlPatternSet_h_included
00002 #define HtrXmlPatternSet_h_included 1
00003
00004 #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
00005 #include "HtrXmlPatternToolParameters.h"
00006
00007 class ChannelPattern {
00008 public:
00009 static const int SAMPLES = 512;
00010 static const int NUM_CRATES = 18;
00011
00012 static const int NUM_SLOTS = 22;
00013
00014 ChannelPattern();
00015 void setLoc(int crate, int slot, int tb, int chan) { m_crate=crate; m_slot=slot; m_tb=tb; m_chan=chan; }
00016 int getCrate() const { return m_crate; }
00017 int getSlot() const { return m_slot; }
00018 int getTB() const { return m_tb; }
00019 int getChan() const { return m_chan; }
00020 double& operator[](int bc) { return fCReal[bc]; }
00021 const double operator[](int bc) const { return fCReal[bc]; }
00022 void encode();
00023 int getCoded(int bc) const { return fCCoded[bc]; }
00024 double getQuantized(int bc) const { return fCQuantized[bc]; }
00025 void Fill(HtrXmlPatternToolParameters *params,HBHEDigiCollection::const_iterator data);
00026 void Fill(HtrXmlPatternToolParameters *params,HFDigiCollection::const_iterator data);
00027 void Fill(HtrXmlPatternToolParameters *params,HODigiCollection::const_iterator data);
00028 private:
00029 double fCReal[SAMPLES];
00030 double fCQuantized[SAMPLES];
00031 int fCCoded[SAMPLES];
00032 int m_crate, m_slot, m_tb, m_chan;
00033 int m_sample_pos;
00034 };
00035
00036 class HalfHtrData {
00037 public:
00038 HalfHtrData(int crate, int slot, int tb);
00039 ChannelPattern* getPattern(int chan) { return (chan>=1 && chan<=24)?(&m_patterns[chan-1]):(0); }
00040 int getCrate() const { return m_crate; }
00041 int getSlot() const { return m_slot; }
00042 int getTB() const { return m_tb; }
00043 int getSpigot() const { return m_spigot; }
00044 int getDCC() const { return m_dcc; }
00045 void setSpigot(int spigot) { m_spigot = spigot; }
00046 void setDCC(int dcc) { m_dcc = dcc; }
00047 private:
00048 ChannelPattern m_patterns[24];
00049 int m_crate, m_slot, m_tb;
00050 int m_dcc, m_spigot;
00051 };
00052
00053 class CrateData {
00054 public:
00055 CrateData(int crate, int slotsActive[ChannelPattern::NUM_SLOTS]);
00056 ~CrateData();
00057 HalfHtrData* getHalfHtrData(int slot, int one_two_tb);
00058 private:
00059 HalfHtrData* m_slotsDoubled[ChannelPattern::NUM_SLOTS][2];
00060 };
00061
00062 class HtrXmlPatternSet {
00063 public:
00064 HtrXmlPatternSet(int cratesActive[ChannelPattern::NUM_CRATES], int slotsActive[ChannelPattern::NUM_SLOTS]);
00065 ~HtrXmlPatternSet();
00066 CrateData* getCrate(int crate);
00067 private:
00068 CrateData* m_crates[ChannelPattern::NUM_CRATES];
00069 };
00070
00071 #endif