public bool DoJob()
        {
            SettingsHelper settingHelper = new SettingsHelper();
            log.Info("load settings");
            settingHelper.LoadSettings(ref pipettingSetting, ref labwareSettings);

            heights = ResultReader.Instance.Read();
            log.Info("read heights");

            //PreparePlasmaDestPositions();
            positionGenerator = new PositionGenerator(pipettingSetting, labwareSettings,heights.Count);
            string errMsg = "";
            
            bool bok = settingHelper.IsValidSetting(labwareSettings,pipettingSetting,ref errMsg);
            if (!bok)
            {
                throw new Exception("Invalid setting:" + errMsg);
            }

            int maxSampleAllowed = positionGenerator.AllowedSamples();
            if (maxSampleAllowed < heights.Count)
                throw new Exception(string.Format("max allowed sample is: {0}",maxSampleAllowed));
            
            string sOutput = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\output\\";
            //create folders
            if (!Directory.Exists(sOutput))
                Directory.CreateDirectory(sOutput);
            
            RunResult runResult = new RunResult();
            int sourceRackCount = (int)Math.Ceiling((double)heights.Count / labwareSettings.sourceWells);
            WriteRacksCount(sourceRackCount);
            string sOrgOutPut = sOutput;
            for (int srcRack = 0; srcRack < sourceRackCount; srcRack++)
            {
                sOutput = sOrgOutPut + "\\srcRack" + (srcRack + 1).ToString() + "\\";
                if (!Directory.Exists(sOutput))
                    Directory.CreateDirectory(sOutput);
               

                int thisRackSamples = srcRack == sourceRackCount - 1 ? (heights.Count - srcRack * labwareSettings.sourceWells) : labwareSettings.sourceWells;
                Utility.Write2File(sOutput + "totalSample.txt", thisRackSamples.ToString());
                int batchNum = (int)Math.Ceiling((double)thisRackSamples / labwareSettings.tipCount);
                Utility.Write2File(sOutput + "batchCount.txt", batchNum.ToString());
                for (int startSample = 0; startSample < thisRackSamples; startSample += labwareSettings.tipCount)
                {
                    List<DetectedHeight> heightsThisTime = new List<DetectedHeight>();
                    for (int tip = 0; tip < labwareSettings.tipCount; tip++)
                    {
                        if (tip + startSample >= thisRackSamples)
                            break;
                        heightsThisTime.Add(heights[srcRack*labwareSettings.sourceWells+ startSample + tip]);
                    }
                    GenerateForBatch(sOutput,srcRack, startSample, heightsThisTime);
                    AddEachSampleInfo2RunResult(srcRack, startSample,heightsThisTime, runResult);
                }
            }

            AddCommonInfo2RunResult(runResult);
            SaveRunResult(runResult);
            //runResultSw.Close();
            return true;
        }
        public worklistGenerator()
        {
            SettingsHelper settingHelper = new SettingsHelper();
            settingHelper.LoadSettings(ref pipettingSetting, ref labwareSettings);

        }