// Mainframe macro generated from application: /home/dkramer/root/bin/root.exe // By ROOT version 5.17/06 on 2007-12-23 20:12:34 #include #include #include #ifndef ROOT_TGFileDialog #include "TGFileDialog.h" #endif #ifndef ROOT_TGNumberEntry #include "TGNumberEntry.h" #endif #ifndef ROOT_TGCanvas #include "TGCanvas.h" #endif #include "TGLabel.h" #include "Riostream.h" class MyMainFrame : public TGMainFrame { private: //TGCompositeFrame *fCframe; //TGMainFrame *fMyMainFrame; TGTextButton *fTextButtonRUN, *fPause, *fExit; TGTextButton *fGetFile, *fMakeRoot; TGNumberEntry *fNumEntryRSum, *fNumEntryCard, *fNumEntryChannel,*fFstChannel2plot; TGCheckButton *fCheckRAW,*fCheckGray,*fCheckSEM; TGGroupFrame *fGframe; TGGroupFrame *pupu; TGLabel *fLabel; Bool_t start, pause; TString rootFile2o,rootFile2s; TFile *f; TTree *t2; ifstream in; Double_t DoseConv; Double_t timee[43692];//time Double_t dataArray[8][43692]; Double_t rawArray[8][43692]; TString fCard,fDate,fHour,fMin,fSec; Int_t liness; int channels; int colorOff; Double_t DoseConversion = 3.46e-6/40e-6;// in Gy/count/s Double_t DoseConversionSEM = 3.46e-6/40e-6;// the same ->no SEM in mGy/s/count TGFileInfo fi; Bool_t freshFile,reload; Double_t MaxLines; Double_t BLMI_SemFactor; public: MyMainFrame(const TGWindow *p, UInt_t w, UInt_t h); virtual ~MyMainFrame(); // slots void PrintMe(); void OpenFile(); void plotRunningSum(); TString OpenFileDialog(Int_t typeID=0); TString SaveFileDialog(); void ReadRSLogFile_andSaveRoot(); void PlotPMdata(); void Setreload(); void PlotFFT(); ClassDef(MyMainFrame, 0) }; MyMainFrame::MyMainFrame(const TGWindow *p, UInt_t w, UInt_t h) : TGMainFrame(p, w, h),DoseConversionSEM(3.46e-6/40e-6),DoseConversion(3.46e-6/40e-6),liness(0), reload(false),BLMI_SemFactor(74855) { this->SetLayoutBroken(kTRUE); // // fTextButtonRUN = new TGTextButton(this,"&Process ");// fTextButtonRUN = new TGTextButton(this,"&Plot ");// // fTextButtonRUN->Connect("Clicked()", "MyMainFrame", this, "plotRunningSum()"); fTextButtonRUN->Connect("Clicked()", "MyMainFrame", this, "ReadRSLogFile_andSaveRoot()"); fTextButtonRUN->SetToolTipText("Produce FFT from channel 1"); fTextButtonRUN->SetTextJustify(36); fTextButtonRUN->Resize(112,48); this->AddFrame(fTextButtonRUN, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); fTextButtonRUN->MoveResize(288,304,112,48); fMakeRoot = new TGTextButton(this,"Plot &FFT"); fMakeRoot->Connect("Clicked()", "MyMainFrame", this, "PlotFFT()"); fMakeRoot->MoveResize(16,204,112,48); fMakeRoot->SetToolTipText("Dialog to open ASCII file with Expert Logging data\nconverts data to ROOT file (another dialog)"); fMakeRoot->SetEnabled(false); fExit = new TGTextButton(this,"&Exit", "gApplication->Terminate(0)"); fExit->MoveResize(16,304,112,48); fExit->SetToolTipText("Close all the windows and exit"); // // pupu = new TGGroupFrame(this,"Acquisitions in TTree"); pupu = new TGGroupFrame(this,"Loaded points"); pupu->SetLayoutBroken(kTRUE); fLabel = new TGLabel(pupu,"No Input"); fLabel->SetTextJustify(36); pupu->AddFrame(fLabel, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); fLabel->MoveResize(32,32,112,30); pupu->SetLayoutManager(new TGVerticalLayout(pupu)); pupu->Resize(192,88); this->AddFrame(pupu, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); pupu->MoveResize(16,16,192,88); fGetFile = new TGTextButton(this,"&OpenFile"); fGetFile->MoveResize(152,304,112,48); fGetFile->Connect("Clicked()", "MyMainFrame", this, "OpenFile()"); fGetFile->SetToolTipText("Dialog to open .ROOT file with Expert logging data"); fCheckRAW = new TGCheckButton(this,"RAW"); fCheckRAW->MoveResize(16,120,112,40); fCheckRAW->SetToolTipText("Plot Raw electronics data if exists! (otherwise card II)"); // // fCheckGray = new TGCheckButton(this,"Output dose in Grays?"); fCheckGray = new TGCheckButton(this,"Output in counts"); fCheckGray->MoveResize(16,154,140,40); fCheckGray->SetToolTipText("Counts are converted to dose in Grays\nUnchecked means counts"); fCheckGray->Connect("Clicked()", "MyMainFrame", this, "Setreload()"); fCheckSEM = new TGCheckButton(this,"SEM?"); fCheckSEM->MoveResize(170,154,100,40); fCheckSEM->SetToolTipText("Is this a SEM detector?\nDifferent calibration..."); //fExit->Connect("Clicked()", "MyMainFrame", this, "gApplication->Terminate(0)"); // fTextButtonRUN->Connect("Clicked()", "fMyMainFrame", this, "PrintMe()"); // // fExit = new TGTextButton(fHor1, "&Exit", "gApplication->Terminate(0)"); // TGFont *ufont; // will reflect user font changes ufont = gClient->GetFont("-*-helvetica-medium-r-*-*-12-*-*-*-*-*-iso8859-1"); TGGC *uGC; // will reflect user GC changes // graphics context changes GCValues_t valEntry576; valEntry576.fMask = kGCForeground | kGCBackground | kGCFillStyle | kGCFont | kGCGraphicsExposures; gClient->GetColorByName("#000000",valEntry576.fForeground); gClient->GetColorByName("#c0c0c0",valEntry576.fBackground); valEntry576.fFillStyle = kFillSolid; valEntry576.fFont = ufont->GetFontHandle(); valEntry576.fGraphicsExposures = kFALSE; uGC = gClient->GetGC(&valEntry576, kTRUE); // fNumEntryRSum = new TGNumberEntry(this, (Double_t) 4,6,-1,(TGNumberFormat::EStyle) 5,(TGNumberFormat::EAttribute) 2,(TGNumberFormat::ELimit) 3,1,8); this->AddFrame(fNumEntryRSum, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); fNumEntryRSum->MoveResize(368,24,59,22); // // TGLabel *fLabelRSum = new TGLabel(this,"Running Sum"); TGLabel *fLabelRSum = new TGLabel(this,"Channels"); fLabelRSum->SetTextJustify(36);// // fLabelRSum->MoveResize(280,24,80,22); fLabelRSum->MoveResize(250,24,100,22); fNumEntryCard = new TGNumberEntry(this, (Double_t) 4000,6,-1,(TGNumberFormat::EStyle) 5,(TGNumberFormat::EAttribute) 2,(TGNumberFormat::ELimit) 3,10,43690); this->AddFrame(fNumEntryCard, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); fNumEntryCard->MoveResize(368,56,59,22); fNumEntryCard->Connect("ValueSet(Long_t)", "MyMainFrame", this, "Setreload()"); TGLabel *fLabelCard = new TGLabel(this,"Max Points "); fLabelCard->SetTextJustify(36); fLabelCard->MoveResize(250,56,100,22); fNumEntryChannel = new TGNumberEntry(this, (Double_t) 50,6,-1,(TGNumberFormat::EStyle) 5,(TGNumberFormat::EAttribute) 2,(TGNumberFormat::ELimit) 3,160e-3,43690*40e-3); this->AddFrame(fNumEntryChannel, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); fNumEntryChannel->MoveResize(368,88,59,22); fNumEntryChannel->Connect("ValueSet(Long_t)", "MyMainFrame", this, "Setreload()"); TGLabel *fLabelChannel = new TGLabel(this,"IntegrLen [ms]"); fLabelChannel->SetTextJustify(36); fLabelChannel->MoveResize(250,88,100,22); fFstChannel2plot = new TGNumberEntry(this, (Double_t) 2,6,-1,(TGNumberFormat::EStyle) 5,(TGNumberFormat::EAttribute) 2,(TGNumberFormat::ELimit) 3,1,8); this->AddFrame(fFstChannel2plot, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); fFstChannel2plot->MoveResize(368,120,59,22); fFstChannel2plot->Connect("ValueSet(Long_t)", "MyMainFrame", this, "Setreload()"); TGLabel *fLabelFstChannel = new TGLabel(this,"1st CH to plot"); fLabelFstChannel->SetTextJustify(36); fLabelFstChannel->MoveResize(250,120,100,22); this->SetMWMHints(kMWMDecorAll, kMWMFuncAll, kMWMInputModeless); this->MapSubwindows(); this->Resize(this->GetDefaultSize()); this->MapWindow(); SetWindowName("Running Sums plot GUI"); //this->Resize(490,372); } MyMainFrame::~MyMainFrame() { // Destructor. Cleanup(); } void MyMainFrame::PrintMe() {// // if(lines>0){ if(rootFile2o.Contains(".txt")){ if(liness>0) fLabel->SetText(Form("%d points",liness)); else{ TString toShow = rootFile2o(rootFile2o.Length()-18,18); fLabel->SetText(toShow); } }else{ //cout<<"shid happenss :o)"<SetText("Open File.."); } // Parent frame Layout() method will redraw the label showing the new value. //fGframe->Layout(); //fLabel->Layout(); } void MyMainFrame::OpenFile() { rootFile2o = OpenFileDialog(1); freshFile = true; // f = new TFile(rootFile2o); // t2 = (TTree*)f->Get("t2"); //liness=0; PrintMe(); } // // void myguiTest()// // void guiPostMortem() void guiPostMortem_fftCut() { // Popup the GUI...// // new MyMainFrame(0, 350, 80); new MyMainFrame(0, 490, 372); } //#include #include #include #include #include #include #include //#include #include #include #include #include #include #include #include #include #include #include void MyMainFrame::plotRunningSum() { return; } TString MyMainFrame::OpenFileDialog(Int_t typeID) { // Prompt for file to be opened. Depending on navigation in // dialog the current working directory can be changed. // The returned file name is always with respect to the // current directory. // // const char *gOpenAsTypes[] = { // // "SDDS files", "*.sdds", // "ROOT files", "*.root", // // "ASCI files", "*.dat", // 0, 0 // }; if(typeID==0){ const char *gOpenAsTypes[] = { "ROOT files", "*.root", 0, 0 }; }else{ const char *gOpenAsTypes[] = { "Logging files", "*.txt", "All files", "*.*", 0, 0 }; } // static // // TGFileInfo fi; fi.fFileTypes = gOpenAsTypes; new TGFileDialog(gClient->GetRoot(), gClient->GetRoot(), kFDOpen, &fi); return fi.fFilename; } TString MyMainFrame::SaveFileDialog() { // Prompt for file to be saved. Depending on navigation in // dialog the current working directory can be changed. // The returned file name is always with respect to the // current directory. const char *gSaveAsTypes[] = { "ROOT files", "*.root", "Encapsulated PostScript", "*.eps", "PostScript", "*.ps", "GIF", "*.gif", "SVG", "*.svg", "Macro files", "*.C", 0, 0 }; static TGFileInfo fi; fi.fFileTypes = gSaveAsTypes; new TGFileDialog(gClient->GetRoot(), gClient->GetRoot(), kFDSave, &fi); return fi.fFilename; } void MyMainFrame::ReadRSLogFile_andSaveRoot() { PrintMe(); if(liness>0 && !freshFile && !reload) { PlotPMdata(); return; }else if(!rootFile2o.Contains(".txt")){ OpenFile(); } gROOT->SetStyle("Plain"); liness=0; channels = 8; colorOff=0; if(fCheckGray->IsOn()){ DoseConversionSEM= 1.; DoseConversion =1.; }else if(fCheckSEM->IsOn()){ DoseConversionSEM= BLMI_SemFactor*3.46e-6/40e-6;//assume all channels are SEM! DoseConversion =BLMI_SemFactor*3.46e-6/40e-6;//assume all channels are SEM! } else{ DoseConversionSEM= 3.46e-6/40e-6; DoseConversion =3.46e-6/40e-6; } Double_t TStampCollimOffset; // // Double_t DoseConversion = 3.46e-3/40e-6;// =86.5mGy/s/count in mGy/s/count for tw9!!! // // Double_t DoseConversion = 3.46e-6/40e-6;// =86.5mGy/s/count in mGy/s/count for tw9!!! // // Double_t DoseConversionSEM = 3.46e-6/40e-6;// the same ->no SEM in mGy/s/count Int_t CH2plotMin= fFstChannel2plot->GetNumberEntry()->GetIntNumber() -1; Int_t CH2plotMax= fNumEntryRSum->GetNumberEntry()->GetIntNumber() + CH2plotMin; TString MDtype = rootFile2o(rootFile2o.Length()-11,1); TStampCollimOffset=1.5;//1.5 s? // // Double_t MaxLines = 4000;//25000=1.0s MaxLines = fNumEntryCard->GetNumberEntry()->GetIntNumber(); // XXXXX get timestamp from filename XXXXX TString tmpf; double timeStampH;//timePrevious=0.; int offset = rootFile2o.Length()-10; fDate = rootFile2o(offset-8,8); tmpf = rootFile2o(offset,2); fHour= tmpf; timeStampH = tmpf.Atof();//-24.; if(timeStampH==24)timeStampH=0.;//get rid of midnight.. tmpf = rootFile2o(offset + 2 ,2); fMin = tmpf; timeStampH += tmpf.Atof()/60; tmpf = rootFile2o(offset + 4 ,2); fSec = tmpf; timeStampH += tmpf.Atof()/3600; timeStampH -= TStampCollimOffset/3600;//match time stamps!!!? TString aLine;// // Double_t MaxLines = 43689; TString myStr; liness = 0; //Double_t cumulArray[8][43692];//cumulated sum for each BLM //Double_t smoothArray[8][43692];//filtered signal for each BLM Double_t previousCumul[]={0.,0.,0.,0.,0.,0.,0.,0.};//cumulated sum for each BLM // Double_t previousCumul2[]={0.,0.,0.,0.,0.,0.,0.,0.};//cumulated sum for each BLM //Double_t t0 = 0.; //double rawArray = new double[8] ifstream in; in.open(rootFile2o); freshFile = false; if(!in.good()) {cout << "file error" <Get("t2"); in.close(); PrintMe(); reload=false; // fTextButtonRUN->Enable(); PlotPMdata(); fMakeRoot->SetEnabled(true); } void MyMainFrame::PlotPMdata(){ Int_t fstCH2plot = fFstChannel2plot->GetNumberEntry()->GetIntNumber() -1; //Int_t CH2plotMin=0; Int_t CH2plotMax=fNumEntryRSum->GetNumberEntry()->GetIntNumber() + fstCH2plot; if(liness<=0){ cout<<"open file first"<SetEnabled(false); if(fCheckGray->IsOn()){ DoseConversionSEM= 1.; DoseConversion =1.; }else if(fCheckSEM->IsOn()){ DoseConversionSEM= BLMI_SemFactor*3.46e-6/40e-6;//assume all channels are SEM! DoseConversion =BLMI_SemFactor*3.46e-6/40e-6;//assume all channels are SEM! }else{ DoseConversionSEM= 3.46e-6/40e-6; DoseConversion =3.46e-6/40e-6; } // xxxxxx integral of the data and PEAK xxxxxx // xxxxxx OOOOOOOOOOOOOOOOOOOOOOOOOOOOO xxxxxx double peak[]={0.,0.,0.,0.,0.,0.,0.,0.}; int peakPos[]={0,0,0,0,0,0,0,0}; double sumdata[]={0.,0.,0.,0.,0.,0.,0.,0.}; double preSum[]={0.,0.,0.,0.,0.,0.,0.,0.}; double peakPeak = 0.; double peakPeakPos = 170; //remove these!!! double XMIN = 100.; double XMAX = 300.; if(fCheckGray->IsOn()){ double YMIN = 0.8e-3;//counts for BLMI double YMAX = 300.;// 255 counts }else if(fCheckSEM->IsOn()){ double YMIN = 1e-4* BLMI_SemFactor;//Gy/s for BLMI double YMAX = 25*BLMI_SemFactor;//Gy/s 22*BLMI_SemFactor is 255 counts } else{ double YMIN = 1e-4;//Gy/s for BLMI double YMAX = 25.;//Gy/s 22 is 255 counts } // Double_t MaxLines = 4000;//25000=1.0s //remove these!!! for(int i=0;i<=liness;i++){ for(int k=fstCH2plot;kpeak[k]){ peak[k]=dataArray[k][i]; //peak[k]=smoothArray[k][i]; peakPos[k] = i; } // sumdata[k]+=dataArray[k][i]; if (i<3750) //first 150 ms = before TCP movement preSum[k] += dataArray[k][i]; //preSum[k] += smoothArray[k][i]; else if (i<3750*2) sumdata[k]+= dataArray[k][i]; //sumdata[k]+= smoothArray[k][i]; } } // for(int k=0;k<4;k++){ for(int k=fstCH2plot;kpeakPeak){ peakPeak=peak[k]; peakPeakPos = timee[peakPos[k]]; } } // if(colorOff>0){ //case of SEM // peakPeak=peak[0]; // peakPeakPos = timee[peakPos[0]]; // cout<<"SEM maximum: "<0){ //case of SEM peakPeak=peak[0]; peakPeakPos = timee[peakPos[0]]; cout<<"CH1 maximum: "<GetNumberEntry()->GetIntNumber()); XMIN = peakPeakPos -0.1*(fNumEntryChannel->GetNumber()); if((peakPeakPos+20)/40e-3>MaxLines){ XMIN = 0.; XMAX = fNumEntryChannel->GetNumber(); cout<<"XMIN set to 0 XMAX to "<GetNumber()); // return; }else if(XMIN<0){ XMIN = 0; } // // XMAX = peakPeakPos +20; XMAX = peakPeakPos + (fNumEntryChannel->GetNumberEntry()->GetIntNumber()); //#endif double sumSEM = 0.; double sumBLMI[] = {0.,0.,0.,0.,0.,0.,0.,0.}; double sumBLMI2[] = {0.,0.,0.,0.,0.,0.,0.,0.}; if(colorOff>0){ //case of SEM //make integral XMIN to XMAX for(int k=peakPos[0];kSetFillColor(0); if(fCheckGray->IsOn()||fCheckRAW->IsOn()) leg1->SetHeader("Channel"); else leg1->SetHeader("Dose"); // TLegend *leg2 = new TLegend(0.910053,0.25,0.984127,0.900442); // leg2->SetFillColor(0); // leg2->SetHeader("Integral"); int markernb[] = {2,3,4,5,7,8,23,24,25,26,27,29}; int colornb[] = {1,2,3,4,5,6,7,8,9,11,14,28,29,36,41,42,45,46,49}; // TMultiGraph *mg2 = new TMultiGraph(); TGraph *displGraph[8]; // for(int aa=0;aa<4;aa++) { for(int aa=fstCH2plot;aaIsOn()) displGraph[aa] = new TGraph(liness,timee,rawArray[aa]); else displGraph[aa] = new TGraph(liness,timee,dataArray[aa]); // TGraph *displGraph = new TGraph(liness,timee,displace); displGraph[aa]->SetLineColor(colorOff+colornb[aa]); displGraph[aa]->SetLineStyle(2); displGraph[aa]->SetMarkerColor(colorOff+colornb[aa]); // displGraph[aa]->SetMarkerStyle(6); // displGraph[aa]->SetMarkerStyle(1); // displGraph[aa]->SetMarkerSize(0.1); if(colorOff>0){ //case of SEM if(aa==0){ mg1->Add(displGraph[aa]); } }else{ //case of BLMI if(fstCH2plot<=aa && aa<=CH2plotMax){ mg1->Add(displGraph[aa]); if(fCheckGray->IsOn()||(fCheckRAW->IsOn())){ TString name = Form("CH %d",aa+1); }else TString name = Form("%.3g mGy",sumBLMI[aa]); leg1->AddEntry(displGraph[aa],name,"pl"); } } } // TCanvas *myc = new TCanvas("myc","PostMortem output",0,0,760,480); TCanvas *myc = new TCanvas("myc","PostMortem output",1); myc->SetRightMargin(0.1206897); // myc->Divide(1,2,0.002); // gPad->SetLogy(); myc->cd(2); gPad->SetTickx(); gPad->SetTicky(); gPad->SetGridy(); gPad->SetGridx(); gPad->SetLogy(); // // mg1->Draw("ALP"); mg1->Draw("ALP"); if(colorOff==0){ leg1->Draw(); } //sumleg->Draw(); // // mg1->SetTitle(filename + " Raw signal");// // mg1->SetTitle(rootFile2o);//fDate,fHour,fMin,fSec mg1->SetTitle("PostMortem " +fCard +" "+ fDate + " " + fHour + ":" + fMin + ":" + fSec); mg1->GetXaxis()->SetTitle("time [ms]"); mg1->GetXaxis()->SetTitleOffset(1.1); if(fCheckRAW->IsOn()){ // mg1->GetXaxis()->SetRangeUser(XMIN,XMAX); // mg1->GetYaxis()->SetRangeUser(YMIN,YMAX); }else{ mg1->GetXaxis()->SetRangeUser(XMIN,XMAX); mg1->GetYaxis()->SetRangeUser(YMIN,YMAX); } if(fCheckGray->IsOn()){ mg1->GetYaxis()->SetTitle("counts"); }else if(fCheckRAW->IsOn()){// // mg1->GetYaxis()->SetTitle("FFT mag"); mg1->GetYaxis()->SetTitle("raw data [bits]"); } else mg1->GetYaxis()->SetTitle("Dose rate [Gy/s]"); mg1->GetYaxis()->SetTitleOffset(1.1); gPad->Update(); } void MyMainFrame::Setreload() { reload=true; if(fNumEntryChannel->GetNumber() > (fNumEntryCard->GetNumberEntry()->GetIntNumber())*40e-3){ fNumEntryCard->SetNumber(fNumEntryChannel->GetNumber()/40e-3); } if(fNumEntryRSum->GetNumber() > 9-(fFstChannel2plot->GetNumberEntry()->GetIntNumber())){ fNumEntryRSum->SetNumber(9 - fFstChannel2plot->GetNumberEntry()->GetIntNumber() ); } } void MyMainFrame::PlotFFT() { Int_t CH2FFT = fFstChannel2plot->GetNumberEntry()->GetIntNumber() -1;//1 means channel 2 cout<<"FFT of the Channel "<5000){ n = n-5000; strtCut = 5000-1; } //cout<Draw("ALP"); //Make our own TVirtualFFT object (using option "K") //Third parameter (option) consists of 3 parts: //-transform type: // real input/complex output in our case //-transform flag: // the amount of time spent in planning // the transform (see TVirtualFFT class description) //-to create a new TVirtualFFT object (option "K") or use the global (default) Int_t n_size = n+1; Double_t re, im; //TVirtualFFT *fft_own = TVirtualFFT::FFT(1, &n_size, "R2C ES K"); TVirtualFFT *fft_own = TVirtualFFT::FFT(1, &n_size, "R2C M K"); // TVirtualFFT *fft_own = TVirtualFFT::FFT(1, &n_size, "R2C EX K"); fft_own->SetPoints(inFFT); fft_own->Transform(); //Copy all the output points: //fft_own->GetPoints(inFFT); //Draw the real part of the output TCanvas *mycFFT = new TCanvas("mycFFT","FFT with Peak Search ",600,350,600,500); // mycFFT->Divide(1,2); // mycFFT->cd(1); TH1 *hr = 0; // hr = TH1::TransformHisto(fft_own, hr, "RE"); hr = TH1::TransformHisto(fft_own, hr, "MAG"); //hr->Draw(); // mycFFT->cd(2);// // Double_t timefft[n_size/2]; // // Double_t reFFT[n_size/2]; // Double_t imFFT[n_size/2]; // Double_t magFFT[n_size/2];// Double_t *timefft = new Double_t[n_size/2]; Double_t *reFFT = new Double_t[n_size/2]; Double_t *imFFT = new Double_t[n_size/2]; Double_t *magFFT = new Double_t[n_size/2]; fft_own->GetPointsComplex(reFFT,imFFT); for (Int_t i=0; iDraw("pal"); // fftGraph->GetXaxis()->SetTitle("time constant [s]"); // TString titleFFT("FFT "+filename); // fftGraph->SetTitle(titleFFT); // hr->Draw(); // hr->SetStats(kFALSE); // hr->GetXaxis()->SetLabelSize(0.05); // hr->GetYaxis()->SetLabelSize(0.05); // mycFFT->cd(2); // //Now let's make another transform of the same size // //The same transform object can be used, as the size and the type of the transform // //haven't changed // TF1 *fcos = new TF1("fcos", "cos(x)+cos(0.5*x)+cos(2*x)+1", 0, 4*TMath::Pi()); // for (Int_t i=0; i<=n; i++){ // x = (Double_t(i)/n)*(4*TMath::Pi()); // inFFT[i] = fcos->Eval(x); // } // fft_own->SetPoints(inFFT); // fft_own->Transform(); // fft_own->GetPointComplex(0, re, im); // printf("FFT transform: DC component: %f\n", re); // fft_own->GetPointComplex(n/2+1, re, im); // printf("FFT transform: Nyquist harmonic: %f\n", re); Float_t FreqConv = 25000./(Float_t)n;// SAMPLE RATE / #SAMPLES // cout<Draw("pal"); fftGraph->GetXaxis()->SetTitle("Frequency [Hz]");// // TString titleFFT("FFT "+filename); TString chTofft = Form("%i",CH2FFT+1); TString titleFFT("FFT Ch"+chTofft+" " +fCard +" "+ fDate + " " + fHour + ":" + fMin + ":" + fSec); fftGraph->SetTitle(titleFFT); delete fft_own; }