00001 00078 #ifndef _Q_CAL_COEF_H_ 00079 #define _Q_CAL_COEF_H_ 00080 00081 #include "QCuore.hh" 00082 #include "QModule.hh" 00083 #include "MCalCoefficients.hh" 00084 #include "QCalPeak.hh" 00085 #include "QVector.hh" 00086 #include "QGuiSession.hh" 00087 #include <vector> 00088 #include <map> 00089 #include <set> 00090 00091 class MCalCoefficients : public QModule { 00092 00093 public: 00094 MCalCoefficients(QSequence* s); 00095 00096 virtual ~MCalCoefficients(); 00097 00098 // Init method is called before event loop 00099 virtual void Init(); 00100 00101 // Doit method is called for each event, getting the event as argument 00102 virtual QEvent* Do( QEvent* ev); 00103 00104 // Done method is called after event loop 00105 virtual void Done(); 00106 00107 // virtual void StoreData(QEvent* ev); 00108 00109 private: 00111 std::map<int, std::vector<double> > fAmplitudes; 00112 00114 std::map<int, double> fMaxAmplitude; 00115 00117 double fMaxEnergy; 00118 double fMinEnergy; 00119 00121 std::set<int> fRuns; 00122 00124 std::vector<QCalPeak*> fCalPeaks1; 00125 00127 std::vector<QCalPeak*> fCalPeaks2; 00128 00130 TF1* fCalFunction; 00131 00133 double *fCalFunctionInit; 00134 00136 std::string fTempFilename; 00137 00139 std::map<double,double> fChisquares; 00140 std::map<double,double> fReducedChisquares; 00141 00143 void InitCalPeaks(std::string source); 00144 00146 bool AutoSeed(int channel, double resolution=-1, int iter=0, double binscale=1); 00147 00149 double NearestNeighbor(double energy); 00150 00152 QMatrix* fPeaksMatrix; 00153 00155 std::string fGUIPrefix; 00156 00158 QGuiSession* fGUISession; 00159 00161 void SetGUIHistogram(int channel); 00162 00164 bool fForceFits; 00165 }; 00166 00167 std::vector<std::vector<int> > GenerateCombinations(std::vector<int> object, unsigned int r); 00168 std::vector<int> RemoveElements(std::vector<int> objects, unsigned int i) ; 00169 00170 #endif