Ejemplo n.º 1
0
void CProfileInfo::SetProfileInfo()
{
	CProfileIterator* it = CProfileManager::Get_Iterator();
	
	float fTotal = 0.0f;
	while( !it->Is_Done() )
	{
		fTotal += it->Get_Current_Total_Time();
		it->Next();
	}
	it->First();

	Clear();
	m_vecstrProfileInfo.push_back( "Root" );
	char szTab[64], szTemp[4096];
	while( !it->Is_Done() )
	{
		memset( szTab, 0, sizeof(szTab) );
		for( DWORD i=0; i<it->GetPreOrderDepth(); i++ )
			strcat( szTab, PROFILE_TAB_STR );
		sprintf( szTemp, "%s---> %.2f%%  %s,  <%.3f ms>,  <%d calls>,  <%f ms/call>", szTab, (it->Get_Current_Total_Time() / fTotal) * 100, 
						it->Get_Current_Name(), it->Get_Current_Total_Time() * 1000, it->Get_Current_Total_Calls(),
						(it->Get_Current_Total_Time() * 1000) / (it->Get_Current_Total_Calls() ? it->Get_Current_Total_Calls() : 1));
		m_vecstrProfileInfo.push_back( szTemp );
		it->NextPreOrder();
	}

	CProfileManager::Release_Iterator( it );
	Reset();

	if( fTotal * 1000 > SEC( 1 ) )	// 1초이상 지연되면 로그 남김
		FileOut( "..\\profile.txt" );
}
Ejemplo n.º 2
0
int TemplateCommand :: Execute( ALib::CommandLine & cmd ) {

	GetSkipOptions( cmd );
	ReadTemplate( cmd );

	if ( cmd.HasFlag( FLAG_FNAMES ) ) {
		mFileTemplate = cmd.GetValue( FLAG_FNAMES );
	}

	IOManager io( cmd );
	CSVRow row;

	while( io.ReadCSV( row ) ) {
		if ( Skip( row ) ) {
			continue;
		}

		if ( mFileTemplate.empty() ) {
			io.Out() << ReplaceColumns( mTemplate, row );
		}
		else {
			FileOut( row );
		}
	}

	return 0;
}
Ejemplo n.º 3
0
void TDimension::WriteDimensionFile(TString FileName)
{
  std::ofstream FileOut(FileName);
  if(!FileOut.is_open())
    {
      std::cout<<"Error opening "<<FileName<<std::endl;
    }
  std::cout<<" Writing parameters to file: "<<FileName<<std::endl;
  
  FileOut<<"Thickness Gem_Radius Gem_Pitch Pitch Gain ElectronADC"<<std::endl;
  double Thickness;
  Thickness=Z_Drift-Z_Gem;
  FileOut << Thickness<<" "<<Gem_Radius<<" "<<Gem_Pitch<<" "<<Pitch<<" "<<Gain<<" "<<ElectronADC<<" "<<Pressure<<std::endl;
  FileOut.close();
}
Ejemplo n.º 4
0
void CMSPeak::CullChargeAndWhich(const CMSSearchSettings& Settings)
{
    int iCharges;
	for(iCharges = 0; iCharges < GetNumCharges(); iCharges++){
        int TempLen(0);
        CMZI *Temp = new CMZI [GetPeakLists()[eMSPeakListOriginal]->GetNum()]; // temporary holder
        copy(SetPeakLists()[eMSPeakListOriginal]->GetMZI(), 
             SetPeakLists()[eMSPeakListOriginal]->GetMZI() + 
             GetPeakLists()[eMSPeakListOriginal]->GetNum(), Temp);
        TempLen = GetPeakLists()[eMSPeakListOriginal]->GetNum();
        bool ConsiderMultProduct(false);

		CullPrecursor(Temp,
                      TempLen,
                      CalcPrecursorMass(GetCharges()[iCharges]),
                      GetCharges()[iCharges],
                      Settings.GetPrecursorcull() != 0,
                      Settings.GetChargehandling().GetNegative());

//#define DEBUG_PEAKS1
#ifdef DEBUG_PEAKS1
    {
	sort(Temp, Temp+TempLen , CMZICompare());
	ofstream FileOut("afterprecurse.dta");
	xWrite(FileOut, Temp, TempLen);
	sort(Temp, Temp+TempLen , CMZICompareIntensity());
    }
#endif

        if(GetCharges()[iCharges] >= ConsiderMult) ConsiderMultProduct = true;

    	SmartCull(Settings,
    			  Temp, TempLen, ConsiderMultProduct);
    
        // make the array of culled peaks
    	EMSPeakListTypes Which = GetWhich(GetCharges()[iCharges]);
        SetPeakLists()[Which]->CreateLists(TempLen);
        copy(Temp, Temp+TempLen, SetPeakLists()[Which]->GetMZI());
        SetPeakLists()[Which]->Sort(eMSPeakListSortIntensity);
        SetPeakLists()[Which]->Rank();
        SetPeakLists()[Which]->Sort(eMSPeakListSortMZ);

        delete [] Temp;
	}
}
Ejemplo n.º 5
0
// recursively culls the peaks
void CMSPeak::SmartCull(const CMSSearchSettings& Settings,
						CMZI *Temp, 
                        int& TempLen, 
                        const bool ConsiderMultProduct)
{
    int iMZI = 0;  // starting point

    // prep the data
    CullBaseLine(Settings.GetCutlo(), Temp, TempLen);
#ifdef DEBUG_PEAKS1
    {
	sort(Temp, Temp+TempLen , CMZICompare());
	ofstream FileOut("afterbase.dta");
	xWrite(FileOut, Temp, TempLen);
	sort(Temp, Temp+TempLen , CMZICompareIntensity());
    }
#endif
    CullIsotope(Temp, TempLen);
#ifdef DEBUG_PEAKS1
    {
	sort(Temp, Temp+TempLen , CMZICompare());
	ofstream FileOut("afteriso.dta");
	xWrite(FileOut, Temp, TempLen);
	sort(Temp, Temp+TempLen , CMZICompareIntensity());
    }
#endif
    // h20 and nh3 loss ignored until this cut can be studied
#if 0
    sort(Temp, Temp + TempLen, CMZICompareHigh());
    CullH20NH3(Temp, TempLen);
    sort(Temp, Temp + TempLen, CMZICompareIntensity());
#endif

    // now do the recursion
    int iTemp(0), jMZI;
    set <int> Deleted;
    map <int, int> MajorPeak; // maps a peak to it's "major peak"
    int HitsAllowed; // the number of hits allowed in a window
    int Window; // the m/z range used to limit the number of peaks
    int HitCount;  // number of nearby peaks
   
    // scan for isotopes, starting at highest peak
    for(iMZI = 0; iMZI < TempLen - 1; iMZI++) { 
        if(Deleted.count(iMZI) != 0) continue;
        HitCount = 0;
        if(!ConsiderMultProduct ||
           Temp[iMZI].GetMZ() > 
           Precursormz) {
            // if charge 1 region, allow fewer peaks
            Window = Settings.GetSinglewin(); //27;
            HitsAllowed = Settings.GetSinglenum();
        }
        else {
            // otherwise allow a greater number
            Window = Settings.GetDoublewin(); //14;
            HitsAllowed = Settings.GetDoublenum();
        }
        // go over smaller peaks
        set <int> Considered;
        for(jMZI = iMZI + 1; jMZI < TempLen; jMZI++) { 
            if(Temp[jMZI].GetMZ() < Temp[iMZI].GetMZ() + MSSCALE2INT(Window) + tol &&
               Temp[jMZI].GetMZ() > Temp[iMZI].GetMZ() - MSSCALE2INT(Window) - tol &&
               Deleted.find(jMZI) == Deleted.end()) {
                if(IsMajorPeak(Temp[iMZI].GetMZ(), Temp[jMZI].GetMZ(), tol)) {
                    // link little peak to big peak
                    MajorPeak[jMZI] = iMZI;
                    // ignore for deletion
                    continue;
                }
                // if linked to a major peak, skip
                if(MajorPeak.find(jMZI) != MajorPeak.end()) {
                    if(Considered.find(jMZI) != Considered.end())
                        continue;
                    Considered.insert(jMZI);
                    HitCount++;
                    if(HitCount <= HitsAllowed)  continue;
                }
                // if the first peak, skip
                HitCount++;
                if(HitCount <= HitsAllowed)  continue;
                Deleted.insert(jMZI);
            }
        }
    }
    
    // delete the culled peaks
    for(iMZI = 0; iMZI < TempLen; iMZI++) {
		if(Deleted.count(iMZI) == 0) {
			Temp[iTemp] = Temp[iMZI];
			iTemp++;
		}
    }
    TempLen = iTemp;

#ifdef DEBUG_PEAKS1
    {
	sort(Temp, Temp+TempLen , CMZICompare());
	ofstream FileOut("aftercull.dta");
	xWrite(FileOut, Temp, TempLen);
	sort(Temp, Temp+TempLen , CMZICompareIntensity());
    }
#endif

}