Getting all steps of today but truncating manually added steps, from Health kit using swift

I am getting today steps from healthkit using below code.

func retrieveStepCount(completion: (stepRetrieved: Double) -> Void) {
     let type = HKSampleType.quantityTypeForIdentifier(HKQuantityTypeIdentifierStepCount) 

let date = NSDate()
let cal = NSCalendar(calendarIdentifier: NSCalendarIdentifierGregorian)!
let newDate = cal.startOfDayForDate(NSDate())

let predicate = HKQuery.predicateForSamplesWithStartDate(newDate, endDate: NSDate(), options: .None) // Our search predicate which will fetch all steps taken today
let interval: NSDateComponents = NSDateComponents() = 1

let query = HKStatisticsCollectionQuery(quantityType: type!, quantitySamplePredicate: predicate, options: .CumulativeSum, anchorDate: newDate as NSDate, intervalComponents:interval as NSDateComponents)

query.initialResultsHandler = { query, results, error in

    if error != nil {

        print("Something went Wrong")
    if let myResults = results{
        myResults.enumerateStatisticsFromDate(newDate, toDate: NSDate()) {
            statistics, stop in
            if let quantity = statistics.sumQuantityForSource(HKSource.defaultSource()) {

                let steps = quantity.doubleValueForUnit(HKUnit.countUnit())

                print("Steps = \(Int(steps))")
                completion(stepRetrieved: steps)

Now lets say I have these steps in total

From which I have some steps which were auto detected by device. and some were added by some other application to heathkit.

Your background is very clear, but what is the part you are having trouble with? You want to ignore the steps that have been added by any application other than those detected by HealthKit itself?