00001 00010 #ifndef PREELECSIMALG_H 00011 #define PREELECSIMALG_H 00012 00013 #include "MixSimHit.h" 00014 00015 #include "Event/GenHeader.h" 00016 #include "Event/SimHeader.h" 00017 #include "Event/SimHit.h" 00018 00019 #include "Conventions/Electronics.h" 00020 00021 #include "MixInputSvc/IMixInputSvc.h" 00022 #include "PreElecSimSvc/IPreElecSimSvc.h" 00023 00024 #include "GaudiKernel/Service.h" 00025 #include "GaudiKernel/MsgStream.h" 00026 00027 #include <map> 00028 #include <deque> 00029 #include <vector> 00030 00031 using namespace std; 00032 00033 class PreElecSimSvc : public Service, 00034 virtual public IPreElecSimSvc 00035 { 00036 public: 00037 PreElecSimSvc(const string& name, ISvcLocator* pSvcLocator); 00038 virtual ~PreElecSimSvc(); 00039 00040 virtual StatusCode initialize(); 00041 virtual StatusCode queryInterface(const InterfaceID& riid, void** ppint); 00042 00043 SimHitHeader* getSimHitHeader(vector<const DayaBay::SimHeader*>& shs, TimeStamp& hite, TimeStamp& hitl); 00044 00045 private: 00046 //MsgStream 00047 mutable MsgStream m_log; 00048 00049 //Service for multi-events inputting 00050 IMixInputSvc* m_mixInputSvc; 00051 00052 //Parameters to dealing with SimHits 00053 //vector<double> m_hitsgap; 00054 deque<TimeStamp> m_hitsGap; //for SimHeader : absolute time 00055 deque<MixSimHit> m_tranSimHits; //for merged SimHits buffer 00056 deque<MixSimHit> m_SimHits; //real SimHits buffer 00057 00058 //Fill Hits buffer and HitHeader with given SimHeader's 00059 StatusCode fillHitsBuffer(DayaBay::SimHeader* sh); 00060 00061 //Search Hits buffer for a gap, update the gap vector 00062 StatusCode findGap(); 00063 00064 //Filling one or more SimHitHeader with proper SimHits 00065 //then push_back the SimHitHeader into m_propSimHitHeaders 00066 //Bookkeep references between SimHitHeader and SimHeaders 00067 StatusCode createHitHeaders(); 00068 00069 //SimHitHeader buffer to hold current SimHitHeader 00070 //This two containers' size must be the same! 00071 map<DayaBay::SimHitHeader*, vector<const DayaBay::SimHeader*> > m_HitHeaderToHeaders; 00072 deque<DayaBay::SimHitHeader*> m_propSimHitHeaders; 00073 00074 //SimHit chunks' earliest and latest 00075 deque<TimeStamp> m_hitEarliests; 00076 deque<TimeStamp> m_hitLatests; 00077 00078 //Minimum width of time gap that determines a chunk. 00079 //double m_mintimeGap; 00080 TimeStamp m_minTimeGap; 00081 TimeStamp m_absTime; //current SimHeader's timeStamp 00082 00083 //Decide the ouput SimHit chunk's site 00084 bool m_ifDeal; 00085 deque<TimeStamp>::size_type m_dealInd; 00086 }; 00087 00088 #endif //PREELECSIMALG_H