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