public ChromDataCollectorSet(ChromSource chromSource, TimeSharing timeSharing,
     ChromatogramLoadingStatus.TransitionData allChromData, BlockWriter blockWriter)
 {
     ChromSource = chromSource;
     TypeOfScans = timeSharing;
     PrecursorCollectorMap = new List<Tuple<PrecursorTextId, ChromDataCollector>>();
     if (timeSharing == TimeSharing.shared)
     {
         SharedTimesCollector = new SortedBlockedList<float>();
         ScanIdsCollector = new BlockedList<int>();
     }
     _allChromData = allChromData;
     _blockWriter = blockWriter;
 }
        public SpectraChromDataProvider(MsDataFileImpl dataFile,
            ChromFileInfo fileInfo,
            SrmDocument document,
            IRetentionTimePredictor retentionTimePredictor,
            string cachePath, // We'll write tempfiles in this directory
            ProgressStatus status,
            int startPercent,
            int endPercent,
            IProgressMonitor loader)
            : base(fileInfo, status, startPercent, endPercent, loader)
        {
            _document = document;
            _filePath = dataFile.FilePath;
            _cachePath = cachePath;

            // If no SRM spectra, then full-scan filtering must be enabled
            _isSrm = dataFile.HasSrmSpectra;
            if (!_isSrm)
            {
                if (!document.Settings.TransitionSettings.FullScan.IsEnabled)
                    throw new NoFullScanFilteringException(dataFile.FilePath);

                // Only use the retention time predictor on non-SRM data, and only when
                // there are enough transitions to cause performance issues with extracting
                // full-gradient in a single pass, and then trimming.
                if (_document.Settings.TransitionSettings.FullScan.RetentionTimeFilterType == RetentionTimeFilterType.scheduling_windows &&
                    _document.MoleculeTransitionCount > MAX_FULL_GRADIENT_TRANSITIONS)
                {
                    _retentionTimePredictor = retentionTimePredictor;
                }
            }

            // Only mzXML from mzWiff requires the introduction of zero values
            // during interpolation.
            _isProcessedScans = dataFile.IsMzWiffXml;

            UpdatePercentComplete();

            // Create the filter responsible for chromatogram extraction
            bool firstPass = (_retentionTimePredictor != null);
            _filter = new SpectrumFilter(_document, FileInfo.FilePath, new DataFileInstrumentInfo(dataFile),
                _retentionTimePredictor, firstPass);

            if (!_isSrm && (_filter.EnabledMs || _filter.EnabledMsMs))
            {
                // Full-scan filtering should always match a single precursor
                // m/z value to a single precursor node in the document tree,
                // because that is the way the filters are constructed in the
                // first place.
                _isSingleMzMatch = true;
            }

            // Get data object used to graph all of the chromatograms.
            if (_loader.HasUI)
                _allChromData = LoadingStatus.Transitions;

            try
            {
                InitSpectrumReader(dataFile);
                InitChromatogramExtraction();
            }
            catch(Exception)
            {
                // If exception thrown before construction is complete than Dispose will not be called.
                if (_spectra == null)
                    dataFile.Dispose();
                else
                    _spectra.Dispose();

                throw;
            }
        }
            public Spectra(SrmDocument document, SpectrumFilter filter, ChromatogramLoadingStatus.TransitionData allChromData, MsDataFileImpl dataFile)
            {
                _document = document;
                _filter = filter;
                _dataFile = dataFile;

                _allChromData = allChromData;

                _lookaheadContext = new LookaheadContext(_filter, _dataFile);
                _countSpectra = dataFile.SpectrumCount;

                HasSrmSpectra = dataFile.HasSrmSpectra;

                // If possible, find the maximum retention time in order to scale the chromatogram graph.
                if (_allChromData != null && (_filter.EnabledMsMs || _filter.EnabledMs))
                {
                    var retentionTime = _dataFile.GetStartTime(_countSpectra - 1);
                    if (retentionTime.HasValue)
                    {
                        _allChromData.MaxRetentionTime = (float)retentionTime.Value;
                        _allChromData.MaxRetentionTimeKnown = true;
                        _allChromData.Progressive = true;
                    }
                }
            }