public void writeUserGroupTollValuesOverTime(
     final String outputFolder, final String pricingScheme) {
   SortedMap<String, SortedMap<Double, Map<Id<Person>, Double>>> userGrp2PersonToll =
       handler.getUserGrp2TimeBin2Person2Toll();
   BufferedWriter writer =
       IOUtils.getBufferedWriter(
           outputFolder + "/timeBin2TollValues_onlyCongestionMoneyEvents_userGroup.txt");
   try {
     writer.write("pricingScheme \t userGroup \t timeBin \t toll[EUR] \n");
     for (String ug : userGrp2PersonToll.keySet()) {
       for (double d : userGrp2PersonToll.get(ug).keySet()) {
         writer.write(
             pricingScheme
                 + "\t"
                 + ug
                 + "\t"
                 + d
                 + "\t"
                 + userGrp2PersonToll.get(ug).get(d)
                 + "\n");
       }
     }
     writer.close();
   } catch (Exception e) {
     throw new RuntimeException("Data is not written in file. Reason: " + e);
   }
 }
  public void writeRDataForBoxPlot(
      final String outputFolder, final boolean isWritingDataForEachTimeInterval) {
    if (!new File(outputFolder + "/boxPlot/").exists())
      new File(outputFolder + "/boxPlot/").mkdirs();

    SortedMap<String, SortedMap<Double, Map<Id<Person>, Double>>> userGrp2PersonToll =
        handler.getUserGrp2TimeBin2Person2Toll();

    for (String ug : userGrp2PersonToll.keySet()) {

      if (!isWritingDataForEachTimeInterval) {
        LOG.info(
            "Writing toll/trip for whole day for each user group. This data is likely to be suitable for box plot in R.");
        BufferedWriter writer =
            IOUtils.getBufferedWriter(outputFolder + "/boxPlot/toll_" + ug.toString() + ".txt");
        try {
          // sum all the values for different time bins
          Map<Id<Person>, Double> personToll = new HashMap<Id<Person>, Double>();
          for (double d : userGrp2PersonToll.get(ug).keySet()) {
            for (Id<Person> person : userGrp2PersonToll.get(ug).get(d).keySet()) {
              if (personToll.containsKey(person))
                personToll.put(
                    person, personToll.get(person) + userGrp2PersonToll.get(ug).get(d).get(person));
              else personToll.put(person, userGrp2PersonToll.get(ug).get(d).get(person));
            }
          }

          for (Id<Person> id : personToll.keySet()) {
            writer.write(personToll.get(id) + "\n");
          }
          writer.close();
        } catch (Exception e) {
          throw new RuntimeException("Data is not written in file. Reason: " + e);
        }
      } else {
        LOG.warn(
            "Writing toll/trip for each time bin and for each user group. Thus, this will write many files for each user group. This data is likely to be suitable for box plot in R. ");
        try {
          for (double d : userGrp2PersonToll.get(ug).keySet()) {
            BufferedWriter writer =
                IOUtils.getBufferedWriter(
                    outputFolder
                        + "/boxPlot/toll_"
                        + ug.toString()
                        + "_"
                        + ((int) d / 3600 + 1)
                        + "h.txt");
            for (Id<Person> person : userGrp2PersonToll.get(ug).get(d).keySet()) {
              writer.write(userGrp2PersonToll.get(ug).get(d).get(person) + "\n");
            }
            writer.close();
          }
        } catch (Exception e) {
          throw new RuntimeException("Data is not written in file. Reason: " + e);
        }
      }
    }
  }