void Wavelet::nullOutsideFrequencyBand(float loCut ,float hiCut ) { // note there is a difference in scale since wavelet is an operator, // the squared norm in fft domain is nzp_ times the squared in regular domain. // for consistency we use the norm in real (time) domain assert(!isReal_); float dOmega = static_cast<float>(1.0/(nzp_*dz_*0.001)); int loI = std::max<int>(0,static_cast<int>(floor(loCut/dOmega))); int hiI = std::min<int>(cnzp_,static_cast<int>(ceil(hiCut/dOmega))); double fac=1.0/double(nzp_); for(int i=0;i<loI;i++) { cAmp_[i].re=0; cAmp_[i].im=0; } for(int i =hiI;i<cnzp_;i++) { cAmp_[i].re=0; cAmp_[i].im=0; } double norm2=0; for(int i=loI;i<hiI;i++) norm2 += static_cast<float> (2.0*fac*(cAmp_[i].re*cAmp_[i].re+cAmp_[i].im*cAmp_[i].im)); if(loI==0) norm2 -=static_cast<float> (fac*(cAmp_[0].re*cAmp_[0].re+cAmp_[0].im*cAmp_[0].im)); setNorm(static_cast<float>(sqrt(norm2))); }
void trackPreviewWnd::drawContents( QPainter *p ) { if ( m_track ) { setNorm( trackPreviewWnd::PAL ); p->fillRect( rect(), QBrush( m_bgcolor ) ); p->setPen( m_fgcolor ); p->setFont( m_font ); QFontMetrics fm( m_font ); m_step = fm.lineSpacing(); int y = m_yorig; int x = m_xorig; if ( md_genre ) { p->drawText( x, y, m_track->text( ID_GENRE ) ); y+=m_step; } if ( md_artist ) { p->drawText( x, y, m_track->text( ID_ARTIST ) ); y+=m_step; } if ( md_album ) { p->drawText( x, y, m_track->text( ID_ALBUM ) ); y+=m_step; } if ( md_year ) { p->drawText( x, y, m_track->text( ID_YEAR ) ); y+=m_step; } if ( md_title ) { p->drawText( x, y, m_track->text( ID_NAME ) ); y+=m_step; } if ( md_track ) { p->drawText( x, y, "Track " + m_track->text( ID_TRACK ) ); y+=m_step; } if ( md_duration ) { p->drawText( x, y, m_track->text( ID_DURATION ) ); y+=m_step; } if ( md_bitrate ) { p->drawText( x, y, m_track->text( ID_BITRATE ) ); y+=m_step; } } }
void IndexReader::setNorm(int32_t doc, const TCHAR* field, float_t value){ ensureOpen(); setNorm(doc, field, CL_NS(search)::Similarity::encodeNorm(value)); }
void IndexReader::setNorm(int32_t doc, const String& field, double value) { ensureOpen(); setNorm(doc, field, Similarity::encodeNorm(value)); }
scanBXoff( char* Rrun = "R6104032") { gStyle->SetPalette(1,0); gStyle->SetOptStat(11); char *tit[]={"bX7","bX48"}; // char *tit[]={"bX48"}; int myOff[]={-1, -1}; int myRms[]={-1, -1}; int nd=2; TString fname="iter1/"; fname+=Rrun; fname+=".hist.root"; TFile *fd=new TFile(fname); //printf("open?=%d\n",fd->IsOpen()); if(!fd->IsOpen()) { printf("scanBXoff %s not exits \n",fname.Data()); return; } fd->ls(); // tmp // TFile *fd2=new TFile("iter0/F7238.hist.root"); // fd2->ls(); hI =(TH1F*) fd->Get("bXI"); assert(hI); // Ideal distribution --> the goal TH1F *hI2=(TH1F*)hI->Clone(); hI2->Scale(200.); hI2->SetFillColor(kYellow); hI2->SetLineColor(kWhite); TCanvas *c1=new TCanvas(Rrun,Rrun,800,700); c1->Divide(nd,3); // ..... find bXing offset for the list of spectra int k,i; for(k=0;k<nd;k++) { TString tt=tit[k]; TH1F *hc =new TH1F("ch-"+tt,"CHi2 dostribution vs. bXing offset for:"+tt,120,-0.5,119.5); TH1F *hd=(TH1F*) fd->Get(tt); hd->Print(); if(hd==0) { printf("%s file exist but %s is missing\n",fname.Data(),tt.Data()); continue; } assert(hd); c1->cd(0*nd+k+1); hd->Draw(); hI2->Draw("same"); hd->Draw("same"); hd->SetFillColor(kBlue); myRms[k]=hd->GetRMS(); if(myRms[k]<10) continue; TH1F *hx=(TH1F*)hd->Clone(); // working copy setNorm(hx); int off= scanOff(hx, hI, hc); myOff[k]=off; printf("run=%s off=%d\n",Rrun,off); c1->cd(1*nd+k+1); hc->Draw(); gPad->SetLogy(); //hc->SetFillColor(kGreen); //hc->SetLineColor(kWhite); TH1F *hg=(TH1F*)hd->Clone(); // input+shift shift(hd,hg,off); c1->cd(2*nd+k+1); hg->Draw(); hI2->Draw("same"); hg->Draw("same"); hg->SetFillColor(kBlue); } // hg->SetLineColor(kRed); printf("#scanBXoff %s ",Rrun); for(k=0;k<nd;k++) { printf("%s: rms=%f off=%d ",tit[k], myRms[k], myOff[k]); } // printf("spinBitsMean=%.1f\n", ((TH2F*) fd->Get("sBit0119"))->GetMean(2)); printf("\n"); // c1->Print(fname.ReplaceAll(".root",".ps")); }