QIGUICoSessionHandler.hh
00001 #ifndef _QIGUI_CO_SESSION_HANDLER__H_
00002 #define _QIGUI_CO_SESSION_HANDLER__H_
00003
00004 #include <QObject>
00005 #include <QCoincidence.hh>
00006 #include <map>
00007 #include <string>
00008 #include <TMutex.h>
00009
00010 class QIGUISession;
00011 class QCoincidenceFiller;
00012 class QIGUICoCut;
00013 class QIGUIPlotData;
00014 class TThread;
00015 class QProgressBar;
00016 class QTimer;
00017 class QCoProjector;
00018
00019 class TNtuple;
00020
00021
00022 class QIGUICoSessionHandler: public QObject
00023 {
00024 Q_OBJECT
00025
00026 public:
00027 enum Status
00028 {
00029 CoToDoEventList = 0,
00030 CoToDoCoCut,
00031 CoDone
00032 };
00033 Status fStatus;
00034
00035 private:
00036
00037 QCoincidenceFiller* fFiller;
00038 QIGUICoCut * fCoCut;
00039
00041 QIGUISession * fSession;
00042 QIGUIPlotData * fPlotData;
00043
00044 QString fName;
00045 std::string fEnergyVar;
00046 std::string fTimeVar;
00047
00048
00049 std::string fType;
00050 double fTimeWindow;
00051
00052 TThread * fCoThread;
00053 TMutex fCoMutex;
00054 int fNEvents;
00055 int fNCoincidences;
00056 QProgressBar * fProgressBar;
00057 QTimer * fTimer;
00058
00059
00060 QCoProjector * fCoProjector;
00061
00062 public:
00063
00064 QIGUICoSessionHandler (QString name, QObject * parent=0);
00065 QIGUICoSessionHandler (QString name, QIGUISession * session, QObject * parent=0);
00066 virtual ~QIGUICoSessionHandler();
00067 void Init();
00068
00069 int BuildCoincidences(QProgressBar * bar);
00070 int CreateFiller();
00071 int BuildTimeCoincidences();
00072 int BuildCoCutCoincidences();
00073 void CoAnalysisEnd();
00074
00075 std::list<QCoincidence> Filter (const std::list<QCoincidence>& coincList);
00076
00077
00078
00079
00080 QString GetName() {return fName;}
00081 QIGUISession * GetSession() { return fSession;}
00082 QIGUIPlotData *GetPlotData() { return fPlotData;}
00083 QCoincidenceFiller * GetFiller () {return fFiller;}
00084 std::string GetType() {return fType;}
00085 double GetTimeWindow () {return fTimeWindow;}
00086 QTimer * GetTimer() {return fTimer;}
00087 std::string GetEnergyVar() {return fEnergyVar;}
00088 std::string GetTimeVar() {return fTimeVar;}
00089 QIGUICoCut * GetCoCut () {return fCoCut;}
00090 int GetNEvents() {return fNEvents;}
00091 int GetNCoincidences() {return fNCoincidences;}
00092 QProgressBar * GetProgressBar() {return fProgressBar;}
00093
00094 void SetSession (QIGUISession * session) {fSession = session;fStatus=CoToDoEventList;}
00095 void SetPlotData(QIGUIPlotData * plotdata) {fPlotData = plotdata;fStatus=CoToDoEventList;}
00096
00097
00098 void SetType (std::string type);
00099 void SetTimeWindow(double timeWindow);
00100 void SetEnergyVar(std::string energy);
00101 void SetTimeVar(std::string time);
00102
00103
00104 void SetCoCut (QIGUICoCut * coCut) {fCoCut = coCut;}
00105
00106 void SetNEvents(int nev) {fNEvents=nev;}
00107 void SetNCoincidences(int nc) {fNCoincidences=nc;}
00108
00109
00110
00111 QCoProjector * GetCoProjector();
00112
00113
00114 void SetStatus (Status st);
00115 Status GetStatus ();
00116
00117
00118 void LockCoMutex();
00119 void UnLockCoMutex();
00120
00121
00122
00123
00124 std::pair<const QCoincidence*, const QCoincidence*> GetCoincidentEvents(unsigned int ev, int & channel);
00125 void CreateIndexT();
00126
00127
00128 void SetCoincidentEvents();
00129 void AddEventBasedCoin();
00130 void RemoveEventBasedCoin();
00131
00132 private:
00133
00134 static void *LaunchCoAnalysis(void * coSessionHandler);
00135
00136
00137
00138
00139
00140
00141 std::map< Int_t , std::pair<const QCoincidence* , const QCoincidence*> > fPtCoincidences;
00142
00143
00144 TNtuple * fIndexT;
00145
00146
00147 public slots:
00148 void UpdateProgressBar();
00149 void DeleteProgressBar();
00150 void DeleteTimer();
00151
00152 signals:
00153 void UpdateProgressBar(int );
00154 void CoAnalysisEnd(QString, int);
00155
00156 };
00157
00158 #endif