text:
%% This is file `elsarticle-template-1-num.tex',
%%
%% Copyright 2009 Elsevier Ltd
%%
%% This file is part of the 'Elsarticle Bundle'.
%% ---------------------------------------------
%%
%% It may be distributed under the conditions of the LaTeX Project Public
%% License, either version 1.2 of this license or (at your option) any
%% later version.  The latest version of this license is in
%%    http://www.latex-project.org/lppl.txt
%% and version 1.2 or later is part of all distributions of LaTeX
%% version 1999/12/01 or later.
%%
%% Template article for Elsevier's document class `elsarticle'
%% with numbered style bibliographic references
%%
%% $Id: elsarticle-template-1-num.tex 149 2009-10-08 05:01:15Z rishi $
%% $URL: http://lenova.river-valley.com/svn/elsbst/trunk/elsarticle-template-1-num.tex $
%%
\documentclass[review,12pt]{elsarticle}

%% Use the option review to obtain double line spacing
%% \documentclass[preprint,review,12pt]{elsarticle}

%% Use the options 1p,twocolumn; 3p; 3p,twocolumn; 5p; or 5p,twocolumn
%% for a journal layout:
%% \documentclass[final,1p,times]{elsarticle}
%% \documentclass[final,1p,times,twocolumn]{elsarticle}
%% \documentclass[final,3p,times]{elsarticle}
%% \documentclass[final,3p,times,twocolumn]{elsarticle}
%% \documentclass[final,5p,times]{elsarticle}
%% \documentclass[final,5p,times,twocolumn]{elsarticle}

%% The graphicx package provides the includegraphics command.
\usepackage{graphicx}
%% The amssymb package provides various useful mathematical symbols
\usepackage{amssymb}
%% The amsthm package provides extended theorem environments
%% \usepackage{amsthm}

%% The lineno packages adds line numbers. Start line numbering with
%% \begin{linenumbers}, end it with \end{linenumbers}. Or switch it on
%% for the whole article with \linenumbers after \end{frontmatter}.
\usepackage{lineno}

\usepackage{blindtext}
\usepackage[hyphens]{url}
\usepackage{hyperref}
  \hypersetup{
  bookmarks=true,         % show bookmarks bar?
  unicode=false,          % non-Latin characters in Acrobat bookmarks
  pdftoolbar=true,        % show Acrobat toolbar?
  pdfmenubar=true,        % show Acrobat menu?
  pdffitwindow=false,     % window fit to page when opened
  pdfstartview={FitH},    % fits the width of the page to the window
  pdftitle={Ludurel Service Agreement},    % title
  pdfauthor={sb swae},     % author
  pdfsubject={},   % subject of the document
  pdfcreator={sb swae},   % creator of the document
  pdfproducer={sb swae}, % producer of the document
  pdfkeywords={}, % list of keywords
  pdfnewwindow=true,      % links in new window
  colorlinks=true,        % false: boxed links; true: colored links
  linkcolor=Gray,         % color of internal links
  citecolor=Gray,        % color of links to bibliography
  filecolor=magenta,      % color of file links
  urlcolor=Gray           % color of external links
  }

%% natbib.sty is loaded by default. However, natbib options can be
%% provided with \biboptions{...} command. Following options are
%% valid:

%%   round  -  round parentheses are used (default)
%%   square -  square brackets are used   [option]
%%   curly  -  curly braces are used      {option}
%%   angle  -  angle brackets are used    <option>
%%   semicolon  -  multiple citations separated by semi-colon
%%   colon  - same as semicolon, an earlier confusion
%%   comma  -  separated by comma
%%   numbers-  selects numerical citations
%%   super  -  numerical citations as superscripts
%%   sort   -  sorts multiple citations according to order in ref. list
%%   sort&compress   -  like sort, but also compresses numerical citations
%%   compress - compresses without sorting
%%
%% \biboptions{comma,round}

% \biboptions{}

\journal{GitHub}

\begin{document}

\begin{frontmatter}

%% Title, authors and addresses

\title{Management of Liability, Money, Logistics, and User Experience by Turo, Inc.}

%% use the tnoteref command within \title for footnotes;
%% use the tnotetext command for the associated footnote;
%% use the fnref command within \author or \address for footnotes;
%% use the fntext command for the associated footnote;
%% use the corref command within \author for corresponding author footnotes;
%% use the cortext command for the associated footnote;
%% use the ead command for the email address,
%% and the form \ead[url] for the home page:
%%
%% \title{Title\tnoteref{label1}}
%% \tnotetext[label1]{}
%% \author{Name\corref{cor1}\fnref{label2}}
%% \ead{email address}
%% \ead[url]{home page}
%% \fntext[label2]{}
%% \cortext[cor1]{}
%% \address{Address\fnref{label3}}
%% \fntext[label3]{}

%% use optional labels to link authors explicitly to addresses:
%% \author[label1,label2]{<author name>}
%% \address[label1]{<address>}
%% \address[label2]{<address>}

\author{sb swae}

\address{\href{mailto:sb.swae@gmail.com}{sb.swae@gmail.com}; \url{https://swaevior.io}}

\begin{abstract}
%% Text of abstract
Numerous peer-to-peer car sharing marketplaces exist in the United States, but Turo, Inc. almost certainly operates the largest. In an effort to build a complete characterization of the company's operating principles and the experiences that users have with the service, we collected data on liability exposure, money management, the UI/UX, and other loci of interest. The findings suggest that liability exposure for all parties is large, that Turo, as the market maker, takes a cut of both buy- and sell-side transactions, and that the website and apps, while attractive, suffer from some issues.
\end{abstract}

\begin{keyword}
Turo \sep car sharing \sep peer-to-peer \sep liability \sep insurance \sep money \sep user experience \sep user interface
%% keywords here, in the form: keyword \sep keyword

%% MSC codes here, in the form: \MSC code \sep code
%% or \MSC[2008] code \sep code (2000 is the default)

\end{keyword}

\end{frontmatter}

%%
%% Start line numbering here if you want
%%
\linenumbers

%% main text
\section{Introduction and Background}
Formerly known as RelayRides, Turo, Inc., is a company that operates a peer-to-peer car sharing marketplace which allows private owners of vehicles to make them available for rent using an online and/or mobile app interface. In 2017, Turo had approximately four million registered users and 170,000 cars available for rent.
  \footnote{``Peer-to-peer car rental start-up Turo heads to Germany.'' USA Today, 6 Sept 2017. \url{https://www.usatoday.com/story/tech/2017/09/06/turn-funding-round-92-million-from-daimler/634102001/}
  }
The privately-held company now has six million registered users and the service covers 5,500 cities across 56 countries.
\footnote{\url{https://www.motorauthority.com/news/1117212_truly-keyless-entry-turo-go-unlocks-registered-cars-with-a-smartphone}
}
The company is based in San Francisco and operates in every US state except New York. To date, it has raised over \$180M in venture capital funding.
  \footnote{\url{https://www.crunchbase.com/organization/turo}}
Turo announced a \$92M series D funding round in 2017 that was led by Daimler AG. In the process, Turo also acquired Croove, Daimler's German car sharing service. Turo launched in Germany in January 2018.
  \footnote{``The Airbnb of Cars Just Bought A Startup From Its Newest Investor.'' Fortune, 6 September 2017. \url{http://fortune.com/2017/09/06/turo-mercedes-daimler/}
  }

The service is popular; its app has been downloaded more than 45,000 times
\footnote{\url{https://www.crunchbase.com/apptopia_app/e81be748-e411-442a-b218-98316adf73ec\#section-overview}}
and the Website receives more than 2.1M
  \footnote{\url{https://www.crunchbase.com/organization/turo\#section-web-traffic-by-similarweb}}
visitors each month. Estimates place Turo's revenue at \$10M.

The scope of this research was intended to create a complete characterization of how Turo operates and the experience of buy-side and sell-side users. We considered a number of questions that ranged from how Turo manages liability exposure to the logistics and movement of money in the process of reserving, picking up, and returning a car.

To this end, we downloaded the Turo mobile apps for Android and iOS in addition to accessing the marketplace from the web interface. We successfully registered for the service and were able to create a listing for a 2008 Chevrolet Malibu
\footnote{Our listing can be seen at \url{https://turo.com/rentals/cars/Chevrolet-Malibu/455238}
}
in the Battle Creek, Michigan area.

Despite the fact that we were initially granted ``Approved Driver'' status immediately upon signing up, we were not successful in making a reservation or obtaining a rental car using the service. Turo considers automotive insurance scores, among other things, when approving individual trips. It is likely that the fact that the author has not owned a personal motor vehicle or carried and auto insurance policy for almost 12 months has resulted in a score that Turo perceives as outside of their acceptable risk.
\footnote{Prior to selling the vehicle and cancelling the auto insurance policy, the author had been continually insured for a decade with only one accident and one moving violation in that span of time.
}

\section{Liability Exposure and Insurance Coverage}
\label{S:2}
\subsection{Owner's Insurance}
Turo offers three protection plans for owners who make their cars available for rent: basic, standard, and premium. The owner's choice of protection plan determines the share of the rental fee that the owner receives. Owners are also permitted to carry their own commercial insurance.

Insurance coverage in the United States is provided by a group plan administered by Liberty Mutual.

Turo openly admits that their protection plans come with an inherent level of uncertainty. Turo senior claims manager Chris Aragon states that ``if there's an engine failure, and it's something that's caused by a mechanical failure and not something that the renter could have caused by using the vehicle, that's something that is not covered by us. That's something that's just a mechanical breakdown that you'd be expected to pay for.''
  \footnote{
  Kristen Lee. Jalopnik, 22 February 2017. \url{https://jalopnik.com/how-insurance-works-when-you-rent-out-your-car-on-turo-1792401490}
  }
This is consistent with standard insurance practices in the United States. Insurance carriers do not typically provide coverage for mechanical failures in vehicles as these cases are often covered by warranties or are expected to be handled out-of-pocket by the owner. In the event that a component of the vehicle fails due to driver abuse, Turo states that it will determine the cause and ``act accordingly.''

\subsubsection{Basic Protection}
The basic protection plan for owners offers \$1,000,000 USD in liability insurance, covers physical damage to the vehicle up to \$125,000 USD, and has a \$3,000 USD deductible. For reference, private auto insurance deductibles in the United States typically range between \$500 and \$1000 USD, though they can be as low as \$100 USD or as high as \$2500 USD. Under this plan, Turo will pay 20\% up to the first \$3,750 of a damage claim and then covers 100\% beyond that limit, up to a cap of \$125,000. At this level, owners receive 85\% of the trip fee.

\subsubsection{Standard Protection}
The standard protection plan for owners offers \$1,000,000 USD in liability insurance, covers physical damage to the vehicle up to \$125,000, and has a \$0 deductible. Owners also receive reimbursement for a replacement vehicle during the period of time that their personal vehicle is being repaired, up certain limits.
\footnote{See \S\ref{claims-process}
}
At this level, owners receive 75\% of the trip fee.

\subsubsection{Premium Protection}\label{owner-premium-protection}
The premium protection plan for owners offers \$1,000,000 USD in liability insurance, covers physical damage to the vehicle up to \$125,000, and has a \$0 deductible. Owners also receive reimbursement for a replacement vehicle during the period of time that their personal vehicle is being repaired,
\footnote{See \S\ref{claims-process}
}
includes coverage for wear and tear on the exterior of the vehicle, and also includes coverage for lost rental income.
\footnote{Turo determines ``lost rental income'' by taking the mean daily rental earnings of the vehicle for the past 60 days and multiplying that dollar amount by the number of days that the owner's vehicle spent being repaired within a ``reasonable range.'' Turo's ``reasonable range'' is determined like so: Turo assumes that a mechanic should reasonably be able to perform four hours of labor per day to repair the vehicle. Turo takes the number of labor hours on the mechanic's estimate and divides it by four. This calculated ``number of days'' is then multiplied by the 60-day mean rental earnings. In the event that the owner cannot pick up otherwise obtain the vehicle within the calculated number of ``days,'' Turo will not pay for additional lost rental income.
}
At this level, owners receive 65\% of the trip fee.

\subsubsection{Owner-provided Protection}
Vehicle owners also have the option of opting-out of any coverage provided that they carry commercial insurance on their own. Such an insurance policy is typically only carried by businesses. At this level, owners receive 90\% of the trip fee and have no protection whatsoever provided to them by Turo or Liberty Mutual.

\subsection{Renter's Insurance}\label{renters-insurance}
Renters are presented with a trio of insurance coverage options.

\textbf{Physical damage protection} includes both comprehensive (property damage or loss to a vehicle, including theft, fire, impacts with wildlife,  vandalism, and acts of nature) and collision (protection in the event that two or more vehicles impact each other or in the event that a single vehicle suffers an impact with an object) coverage.

\textbf{Personal injury protection} varies widely by state, but typically provides coverage for medical expenses, lost income, funeral expenses, and the like for for the driver and passenger in the vehicle with no regard given to who is at fault.

\textbf{Uninsured/underinsured motorist coverage} pays the renter and/or the renter's passengers for bodily injury they may suffer in the event that they experience a collision caused by a driver without insurance, a hit-and-run driver, a driver who has exhausted the benefits available to them under their own insurance plan, or a driver whose insurance carrier is found to be insolvent and therefore incapable of paying a claim.

\subsubsection{Premium Rental Insurance}\label{premium-rental-insurance}
The premium rental insurance option provides \$1,000,000 USD in bodily injury and property damage coverage to renters. Personal injury protection coverage (also known as no-fault or first party benefits) are capped at the statutory minimum required in the state where the vehicle is registered. In some cases, this amount may be \$0 USD. Uninsured/underinsured motorist coverage is also capped at the statutory minimum required in the state where the vehicle is registered. In some cases, this may be \$0 USD. The renter's out-of-pocket exposure is limited to a deductible payment of \$500, which is collected in full when the owner reports damage. In the event that the total costs are less than \$500, then the renter will be refunded the difference.

\subsubsection{Basic Rental Insurance}\label{basic-rental-insurance}
The basic rental insurance option provides \$1,000,000 USD in bodily injury and property damage coverage to renters. Personal injury protection coverage (also known as no-fault or first party benefits) are capped at the statutory minimum required in the state where the vehicle is registered. In some cases, this amount may be \$0 USD. Uninsured/underinsured motorist coverage is also capped at the statutory minimum required in the state where the vehicle is registered. In some cases, this may be \$0 USD. The renter's out-of-pocket exposure is limited to a deductible payment of \$3000 USD. If the total costs are less than \$3000, then the renter will be refunded the difference.

\subsubsection{Declining Rental Insurance Coverage}\label{commercial-insurance}
Renters are also allowed to decline a protection plan. In this case, the renter's exposure is effectively unlimited and is only bounded by the actual cash value of the vehicle plus all related costs, as determined by the process described in \S\ref{claims-process}. In the event that a rented vehicle is lost, stolen, or deemed a total loss,
\footnote{For Turo's purposes, a ``total loss'' is defined by anticipated repair costs in excess of 75\% of the vehicle's actual cash value.
}
then the renter is liable for paying the entire actual cash value of the vehicle, plus all related costs and minus any residual salvage value.
\footnote{Salvage value is the expected sale value of an asset at the end of its useful life. Insurance companies may employ a number of methods to determine the salvage value of a vehicle, but it is often classified as the sum value of the remaining usable parts in a vehicle.
}

\subsubsection{Other Sources of Renter's Insurance}
Some renters may be able to obtain, or already have as a part of their personal auto insurance policy, coverage that extends to vehicles rented by the primary policy holder.

Some renters may be also be able to obtain, or already have as a part of their existing credit card account, coverage that extends to vehicles rented and driven by the cardholder using that credit card as the payment method.

Such coverage varies widely between insurance carriers and credit providers and may, in some cases, be deficient. Turo states that it is ``highly unlikely that [the renter] would be covered by any credit card insurance when [they] book cars through the Turo marketplace.''
\footnote{\url{https://support.turo.com/hc/en-us/articles/203990610-I-d-like-a-detailed-explanation-of-insurance-and-protection-provisions}}

\subsubsection{Subrogation}
Insurance offered by Turo is secondary to any existing coverage that the renter may have through other sources (\emph{i.e.,} that available through a credit card provider, personal auto policy, or other insurance policy). Practically speaking, the secondary nature of Turo's rental insurance offerings means that the renter is primarily liable, but can satisfy their obligations through other sources. In the event of a claim, Turo will first attempt to collect deductibles directly from the renter and then then seek reimbursement from other sources of coverage that the renter may have in a process known as subrogation.
\footnote{Subrogation is the common law legal doctrine through which one party is entitled to enforce the legal rights or protections of another party for its own benefit.
}

\subsubsection{Exception to Renter's Elected Protection Plans}
In the event that the renter is found to have violated Turo's terms of service, engaged in prohibited uses of the rented vehicle, or is otherwise found to have recklessly used the rented vehicle, the deductible limits mentioned in \S\ref{premium-rental-insurance} and \S\ref{basic-rental-insurance} do not apply and the renter will be liable for physical damage up the full actual cash value of the vehicle including Turo's related costs.

\subsection{Claims Process}\label{claims-process}
A renter is supposed to report any incidents involving a rented vehicle to the relevant authorities. Urgent matters should be referred to the local police immediately and either to Turo or to the owner of the vehicle within 24 hours of the incident.

In the event that a host does not learn about an incident that occurred with their vehicle until after the vehicle has been returned, the owner has 24 hours to report the incident to Turo in order to remain eligible for Turo's coverage.

If a vehicle's owner has elected to decline Turo's coverage, then they are responsible for making a claim directly to their own insurance company.

If the owner of a vehicle has elected either the premium or the standard Turo protection plans, then they are eligible to receive up to \$30 USD per day for up to 10 days (\$300 USD cap) to rent a replacement vehicle. They may also elect to receive a travel credit from Turo that may be used to rent a vehicle on the Turo marketplace. Additionally, users may submit receipts from public transport, taxis, and ride-sharing services like Uber or Lyft for reimbursement.

Owners and renters have the option to resolve claims directly with each other. However, if an owner elects to file a claim through Turo, they have until 24 hours after the end of a trip to visit \url{https://turo.com/resolutions} to file an eligible claim. Turo states that one of their claims specialists will make contact with the owner of the vehicle within 24 hours of a claim being submitted. Turo will then provide instructions to the parties about how to obtain an appraisal.

Turo uses a third-party administrator called the Littleton Group to determine a vehicle's actual cash value. Littleton, in turn, uses AutoClaims Direct, a nation-wide network of independent auto appraisers. In the event of a claim, AutoClaims Direct will dispatch an appraiser to perform a visual inspection of the vehicle and to obtain photographic documentation of the vehicle's condition. The appraiser will also collect information on the general condition of the vehicle, the odometer reading, and any other information that may help accurately determine the actual cash value of the vehicle.

Software is employed to sweep across the market to obtain information on  vehicles comparable to the one subject to a claim. The software will then determine the value of the vehicle based on how it compares in condition and mileage to comparable vehicles on the market at that time. It may also include a factor that accounts for depreciation.

In some cases, Turo may direct users making a claim to download an app and upload photos of the damage.

If a claim made to Turo is determined to be eligible, Turo notifies the renter and charges their payment method(s) for an initial claim processing cost of up to \$575.

The owner is then presented with their options for resolution. They may elect not to pursue further action, resolve the issue directly with the renter, resolve the claim directly with the insurance carrier of the renter (or a third party in the event that the renter is found not to be at fault), or the claim may be processed through Turo's claims administrator.

Depending on the resolution option elected by the parties, the owner's car may be repaired and the renter may be responsible for settling their financial obligations, including payment of their deductible.

\section{Data and Metrics}
  \subsection{Data Collection}
  At this time, Turo relies on renters and owners to provide data to the company about the vehicles available on the marketplace.
  \subsection{Mileage}
  Mileage tracking is performed by the owner by submitting photos before and after a trip. All cars on the Turo marketplace have daily, weekly, and monthly mileage limits that are set by the owner.
  \subsection{Location Tracking}
  Turo does not currently support vehicle location tracking.
  \subsection{Fuel}
  Fuel tracking is performed by the owner by submitting photos of the fuel gauge before and after a trip. Renters are required to replace the fuel that they use.
  \subsection{Turo Go}
  Turo is presently signing users up for a beta program called Turo Go that will collect data and also allow cars to be unlocked with a smartphone, thereby sidestepping the issue of needing to liaise in person with the owner of the vehicle. Unlocking and data collection will be provided by a device plugged into the vehicle's OBD-II port. Turo Go is expected to launch in select US cities in the second half of 2018.
  \footnote{\url{https://explore.turo.com/turo-go-announce/}}
  \footnote{\url{https://www.motorauthority.com/news/1117212_truly-keyless-entry-turo-go-unlocks-registered-cars-with-a-smartphone}
  }
  \footnote{\url{https://www.cnet.com/roadshow/news/turo-go-will-allow-instant-car-rentals/}
  }
  \footnote{\url{https://www.autorentalnews.com/304179/turo-users-to-unlock-cars-via-app}
  }

\section{Logistics}
  \subsection{Reserving a Vehicle}
  Some vehicles on Turo are available for instant booking and do not require the consent of the owner.

  Most vehicles, however, have an arbitrary limit (on the order of 12, 24, 48, etc. hours advance notice) that the owners sets on his or her listing. Reservations are denied if an attempt is made by a renter to reserve a car inside of the owner's specified window. Vehicles that are reserved in this fashion also require the owner to manually authorize such trips.

  \subsection{Picking Up a Vehicle}
  At this time, renters must meet in person with the owner of the vehicle in order to obtain keys to the vehicle. Turo recommends that renters and owners both take pictures of the vehicle's interior and exterior to aid in potential claims after the vehicle is returned.

  \subsection{Delivery Option}
  Owners may configure their listing to allow for delivery to local airports or an arbitrary location elected by the renter. The fee for this service is typically \$50 USD, but it may be manually set by the owner.

  \subsection{Returning a Vehicle}
  By default, a vehicle must be returned to the location from which it was picked up. There does exist anecdotal evidence of renters contacting owners to strike an informal agreement to drop off the car at a different location.

\section{Money Management}

  \subsection{Payment Methods and Payment Timing}
  In the United States. Turo accepts credit cards branded as Visa, Mastercard, Discover, or American Express, debit cards branded Visa or Mastercard, Apple Pay, and Google Wallet. These payment methods are required to be in the name of the Turo account holder.

  Turo does not accept prepaid cards, temporary bank cards, or cards that are not linked to a bank account.
  \subsection{Timing of Payments}\label{timing}
    \subsubsection{Renters}
    Owners of vehicles listed on Turo may elect to manually approve each reservation request from renters or they may make designate their vehicle as one that renters can ``Book Instantly.''

    Under the manual-approval option, renters' debit or credit cards are authorized
    \footnote{An authorization hold, preauthorization, preauth, or card authorization is the practice of verifying transactions that have been initiated with a debit or credit card. Banks will make the balance required to pay the charge unavailable until either the merchant clears the transaction or the hold ``falls off,'' typically within 3 to 5 business days.
    }
    but not yet charged. When the owner approves the booking, Turo then clears the transaction and the renter's card is charged.

    The Apple Pay and Google Wallet payment methods are charged immediately.

    When a vehicle that is listed as instantly available is booked, the renter's payment method is immediately charged.

    \subsubsection{Owners}
    Thirty minutes after a trip ends, Turo automatically initiates ACH payments
    \footnote{Automated Clearing House, or ACH, is an electronic network for financial transactions in the United States. ACH credits include direct deposits and payroll. It is also possible to make debit transactions using ACH out of bank accounts. ACH transactions typically take 1-3 business days to clear.
    }
    for the owner's share of the trip price. For extended trips, owners receive a partial payment on day 7 of the trip and subsequent partial payments every seven days until the trip ends. To allow ACH transactions, owners must provide Turo with the account and routing number of their bank account. Turo says that a PCI Level 1-compliant third party stores this information and facilitates payments.

  \subsection{Pricing}
    \subsubsection{Trip Pricing}
    Owners may price their vehicles themselves or allow Turo to determine pricing for them based on vehicle make, model, year, mileage, and geographic area. Renters may toggle the days and length of their trip and pricing updates live online and in the apps. Owners may also charge different amounts for different days of the week (\emph{e.g.,} weekends) or a different daily rate for longer trips (typically at a discount).
    \subsubsection{Trip Fee}
    Renters also pay a ``trip fee'' that is calculated as a variable percentage of up to 25\% of the trip price. Renters are shown the exact amount as they are checking out. Turo states that the trip fee covers operating costs.
    \subsubsection{Protection Plan Pricing}
    Turo offers three protection plans to renters: premium, basic, and no protection (See \S\ref{renters-insurance}). In the United States, premium protection is 40\% of the trip price, basic is 15\%, and there is no charge for a renter who chooses to decline a protection plan. Vehicle owners who opt to carry their own commercial insurance are allowed to charge their own fee for that protection. Owners are supposed to declare whether they are charging a separate protection fee or if that cost is included in the trip price.

  \subsection{Young Driver Fees}
  Renters between the ages of 21 and 24 incur a charge that is calculated as the greater of 30\% of the trip price or \$10 USD. Vehicles in the marketplace whose owners have chosen to carry their own commercial insurance do not incur this cost and such owners are permitted to charge young drivers their own fee. Owners are supposed to declare whether they are charging a young driver fee.

  \subsection{Security Deposits}
  In some cases, Turo may require renters to pay a security deposit before they will be permitted to drive a vehicle. Deposits are collected in full before a trip begins. Instantly booked trips see the deposit added at checkout while trips requiring owner approval will see deposits charged when the owner approves the trip. If the deposit cannot be collected, booking of the trip will fail.

  Deposits are returned to renters 80 hours after the car has been returned to the owner in the same condition that it was found in.

  \subsection{Delivery Fees}
  Owners may elect to offer to deliver their cars to local airports or custom locations. These fees, when applicable, are clearly noted in the listing for the vehicle.

  \subsection{Extras}
  Some owners may elect to offer ``Extras'' to their renters and are permitted to set their own fees for these types of items, up to a limit of \$999 USD. Where applicable, fees for extras are displayed at checkout time. Extras may include things like tents, roof racks, bikes, and kayaks, as examples of physical items, and post-trip refueling, unlimited mileage, or post-trip cleaning as intangibles. Owners may charge a flat fee for an extra or they may choose to charge on a daily basis.

  \subsection{Refunds}
  Refunds for US payment methods typically take 3 to 5 business days and are deposited back into the account used to originally make the payment.

  \subsection{Payment Authorization}
  See \S\ref{timing} for a discussion of card authorizations and payment timing.

  \subsection{Ending a Trip Early}
  Renters who end their trips early, do so through the website or mobile app, and receive approval from the owner are eligible to receive a prorated refund.

\section{User Experience}
\subsection{User Responsibilities and Obligations}
  \subsubsection{Wear and Tear}
    \paragraph{Owners}
    ``Normal wear and tear'' is the result of the normal operation of a vehicle and therefore should be an expected part of the experience of sharing or renting a car on Turo. Owners are not, under any circumstances, protected against normal wear and tear of the interior of their vehicle(s). Owners who have elected the premium protection plan (\S\ref{owner-premium-protection}) receive protection against exterior wear and tear.
      \footnote{Defined by Turo as ``any dings, dents, cracks, or scratches to the exterior body of the vehicle that is 3 inches in diameter or less. This includes, but is not limited to, rims, wheels, hubcaps, any painted or textured area for the body of the vehicle, and moldings.'' See \url{https://support.turo.com/hc/en-us/articles/217043898}.
      }
    \paragraph{Renters}
    Renters are not responsible for wear and tear that is the result of normal use of a vehicle.

    Renters are fully responsible for damage that is the result of misuse or prohibited use of a vehicle, ``significant damage'' to the interior of a vehicle, and mechanical damage due to negligence, intentional acts, or improper driving on the part of the renter.
      \footnote{Owners who decline any of Turo's in-house protection plans and instead opt to provide their own commercial insurance (see \S\ref{commercial-insurance}) are not covered by Turo against any of the aforementioned items.
      }

  \subsubsection{Mechanical Failure}
    \paragraph{Renters}
    If the vehicle that a renter is using is covered by one of Turo's own protection plans, then renters can be connected with a dispatcher, available 24/7 who has the ability to send a service provider to the vehicle's location. Roadside assistance is only available in the United States, Canada, and Germany.

    Renters may be liable for fees associated with the actual services provided during a roadside assistance event (\emph{e.g.,} towing, locksmith services, battery jumps, etc.

    In the event that the renter is using a vehicle that was listed on Turo by an owner who has brought their own commercial insurance,
    \footnote{See \S\ref{commercial-insurance}
    }
    then roadside assistance will be provided by that vehicle's owner and/or their insurance carrier. In these cases, renters are instructed to direct their questions about or requests for roadside assistance to the owner of the vehicle.

    \paragraph{Owners}
    Owners are required to ensure that their vehicle complies with laws and regulations pertaining to vehicle safety, condition, and operation, including any local seasonal rules or regulations.

    Turo recommends that owners obtain an annual mechanical and safety inspection from an ASE-certified
    \footnote{Automotive Service Excellence.
    }
    mechanic. From time to time, Turo may ask owners to obtain an inspection. In this event, owners will download an inspection form provided by Turo, schedule the ASE inspection, and return the completed form.

    Failure by an owner to maintain their car in an acceptable or road-worthy condition may result in that vehicle being removed from the Turo marketplace.

    In the event that the owner's vehicle breaks down while it is being rented and such a breakdown is found to be a result of a violation of Turo's maintenance policy, Turo will charge the host \$100 USD. In the event that the renter makes contact with the 24/7 Turo support line and requests roadside assistance or a tow, Turo will also assess a \$200 USD administrative fee to the owner.
  \subsection{Traffic Violations and Tickets}
    \subsubsection{Renters}
    Renters are responsible for paying all tickets for violations that they commit during their trip, with the exception of moving violations and photo tickets.
      \footnote{\label{moving-violations}In the event that a vehicle is ticketed for speeding, running a red light, or other moving violations, including those captured by cameras, and the owner of the vehicle receives said ticket via mail, then Turo agrees that it will provide the information required by the ticketing body or the owner such that the owner may contest the ticket and transfer liability for the moving violation to the renter.

      Renters are not supposed to pay moving violations or photo tickets immediately because the liability for such violations (including penalty ``points'' assigned in many US states) may be assigned to the owner of the vehicle for a traffic offense that they did not actually commit.
      }
    Renters are also responsible for parking tickets, towing fees, and fines that may be levied for up to 24 hours after the end of a trip, provided that such tickets, fines, and/or fees are a result of improper parking by the renter.

    The renter is responsible for informing the owner when they receive a ticket during their trip and ought to immediately pay it, except for those tickets mentioned in footnote \ref{moving-violations}.

    \subsubsection{Owners}
    In the event that an owner notifies Turo that a ticket was received during the renter's trip or within the 24 hour period thereafter, Turo will charge the renter's payment method(s) for the total cost of the ticket plus administration fees levied by Turo. Owners must submit their requests for reimbursement within 90 days after the trip in question ended, provide documentation of the ticket, and receipts for payment of the ticket.

  \subsubsection{Canceling a Reservation}
    \paragraph{Renters}
    Turo's cancellation policy
    \footnote{``Cancellation Policy.'' Turo. Retrieved from \url{https://turo.com/policies/cancellation}
    }
    states that renters may cancel their trips through the Turo website or mobile apps. Cancellations take place immediately.

    If a renter cancels a trip within one hour of making the reservation, they are refunded 100\% of the trip price and 100\% of the Turo trip fee. Cancellations made more than seven days before a trip is scheduled to begin result in 100\% of the trip price being refunded, but Turo keeps the trip fee. Renters receive a refund for 90\% of the trip price and 0\% of the trip fee if cancellations are made between 1 and 7 days of the trip's scheduled start. Cancellations made with less than 24 hours remaining until the scheduled start of the trip are not eligible for a refund.

    Protection fees and young driver fees are refunded in full if the renter cancels the trip before the trip is scheduled to start.

    \paragraph{Owners}
    In the event that the owner of the vehicle needs to cancel a trip, then they must contact the renter in writing using the Turo website or mobile apps. Cancellations by owners are effective immediately and result in a 100\% refund being issued to the renter.

    Hosts will be charged a \$50 USD fee if they cancel a trip with fewer than 24 hours remaining until the trip's scheduled start. Cancellations made by owners outside of the 24 hour window result in a \$25 USD fee being charged to the owner. Additional penalties, including having a car delisted, may result if an owner repeatedly cancels trips.

    \paragraph{Flight Delays and Flight Cancellations}
    In the event that a flight that the renter was scheduled to take is delayed or canceled, Turo requires the renter to make contact with the owner to request a modification to the trip's itinerary to reflect a new start time. Owners are expected to make a good faith effort to accommodate new start times for trips.

    In the event that the owner cannot or does not accommodate a new start time for the trip as the result of a flight delay or cancellation, Turo will issue a 100\% refund to renters. Renters must provide evidence that their flight was delayed or canceled.

    Renters must make contact with owners at least 1 hour before the trip start time to be eligible for a refund. They must also notify Turo within 24 hours after the scheduled start time of trip in order to be eligible for a refund.

  \subsubsection{Cleaning Cars}
  Owners are expected to provide clean cars to renters. Renters are instructed to contact Turo Support if they take possession of a car that is dirty. Similarly, renters are expected to return vehicles in the same or better condition as when they found them. Owners are also instructed to contact Turo Support if their vehicle is returned them in unclean condition.

    \paragraph{Cleaning Claims}
    Turo requires owners to send before and after pictures within 24 hours of a trip's end if their car was returned to them in unclean condition. The check-in and check-out features of the mobile apps are recommended for prompt filing and handling of cleaning claims. After Turo has reviewed the information, Turo may issue a reimbursement based on the severity of the claim.

    \paragraph{Cleaning Fines and Fees}
    \begin{itemize}
      \item \textbf{Not Eligible}
    \end{itemize}
      Small amounts of refuse, crumbs, dirt, or sand, small marks that can be easily cleaned.
    \begin{itemize}
      \item \textbf{Light Cleaning: \$30}
    \end{itemize}
      Significantly dirtier exterior than when car was rented out; significantly dirtier floor mats; large amounts of crumbs, dirt, sand, or food.
    \begin{itemize}
      \item \textbf{Medium Cleaning: \$50}
    \end{itemize}
      Light stains or residue on hard surfaces.
    \begin{itemize}
      \item \textbf{Heavy Cleaning: \$100}
    \end{itemize}
      Major stains or residue on fabric or other hard-to-clean surfaces.
    \begin{itemize}
      \item \textbf{Severe Cleaning: \$150}
    \end{itemize}
      Any of the previously mentioned situations at such a level that cleanup requires steam cleaning or detailing of the vehicle.
    \begin{itemize}
      \item \textbf{Pet Hair: \$150}
    \end{itemize}
      Applicable to events in which a pet enters a vehicle without prior consent of the owner or events in which the owner consents to the presence of a pet but the vehicle is returned with significant amounts of pet hair. Turo includes service animals in this policy.
    \begin{itemize}
      \item \textbf{Smoking: \$50 or \$150}
    \end{itemize}
      \$50 charged for smoke smell removal and \$150 for smoke smell removal and as well as cleaning of cigarette butts, ash, etc. In the event that burn marks are found in a returned vehicle, owners are instructed to submit a damage claim, not request reimbursement for cleaning.
    \begin{itemize}
      \item \textbf{Maximum: \$250}
    \end{itemize}
      Reserved for a combination of issues like the combination of smoke damage and severe level cleaning.

\section{User Interface}
Turo has only one app that is used by both owners and renters. It is possible to list a vehicle and to rent one using the same Turo account.

Screen capture footage of the apps and web interface being used will be delivered alongside this report.

\subsection{Screen Captures of User Interfaces}
  \subsubsection{iOS}
  The iOS app screen capture was done using the native screen recording feature on an iPhone 7 Plus running iOS 12.0 Public Beta 1 (build number 16A5308e). The iOS app is fluid and easy to operate. It features an omnipresent menu button and a bar at the bottom of the screen that function as ``tabs'' that allow for easy switching between primary functions of the app. If an owner wishes to change anything about his or her listing beyond availability times and dates, then it is necessary to log in to the Turo mobile site using a mobile browser.

  The iOS screen recording can be accessed at: \url{http://bit.ly/af-media}

  \subsubsection{Android}
  The Android app screen capture was done using AZ Screen Recorder on a Pixel 2 running Android 8.1.0 (build number OPM2.171019.029.B1). Compared to the iOS app, the Android version is significantly jerkier and more sensitive to touchscreen errors. All functions in the Android app are located inside of a menu. Compared to the iOS app, the Android version also contains more options about a vehicle listing that can be altered by the owner from directly inside the application.

  The Android screen recording can be accessed at: \url{http://bit.ly/af-media}

  \subsubsection{Desktop Browser}
  The Turo website screen capture was done on a late 2017 MacBook Pro running macOS High Sierra Version 10.13.4. We attempted to access the website through both Google Chrome (Version 67.0.3396.99 64-bit Official Build) and Safari (Version 11.1 (13605.1.33.1.2)) browsers and found the Chrome version to be buggy. The screen capture was inside of the Safari browser with OBS software.

  The macOS Safari screen recording can be accessed at: \url{http://bit.ly/af-media}

  Of particular note was the experience we had listing a a vehicle using the Turo website. We initially tried to upload pictures of our vehicle that were taken with an iPhone 7 Plus running iOS 12, which shoots in the HEIC format. Not expecting compatibility with this image format, we manually converted our images to high-quality PNGs and attempted to upload them using Chrome. The uploader tool, which was only partially displayed on the webpage, returned a generic error message when we attempted to upload the PNGs.

  We then switched to Safari. The uploader was fully displayed and opened a Finder window. It did not allow for upload of the original HEIC images, but gave the impression that the PNGs would be accepted since the file names were displayed in full color. An attempt to upload the PNGs returned the same generic error message.

  We contacted Turo chat support to inquire as to the file types and sizes necessary. After providing the chat agent (who took 15 minutes to become available despite the fact that we were first in the queue) with the specifications of our machine, operating system, and browser(s), the first suggestion by the support agent was that we switch to the Windows operating system. While we do have Bootcamp and corresponding version of Windows 8 & 10 installed on our machines, we do believe that most Apple Mac product users will have this ability. We insisted that we be provided with a solution that would work on a Mac.

  The support agent then suggested that we ``crop the images,'' a suggestion that was again impractical as the images that we had captured, in a style consistent with other listings on Turo, were full-frame exposures of our vehicle. We insisted that the support agent consult his documentation or someone knowledgeable and return to us with specs for filetypes and sizes. He was gone for several minutes. In the intervening time, we converted the images to sub-5MB jpegs and had success in uploading these new file with the uploader tool in Safari. It is unclear whether it was the conversion, the compression, or both that allowed the upload to proceed successfully.

  Our experience with the chat support agent, who was clearly not given the tools, documentation, or information to adequately assist us left us wondering why there was not simply some text in the Upload box of the List Your Vehicle section of the site that plainly indicated filetypes and sizes that the tool accepts.

%% The Appendices part is started with the command \appendix;
%% appendix sections are then done as normal sections
%% \appendix

%% \section{}
%% \label{}

%% References
%%
%% Following citation commands can be used in the body text:
%% Usage of \cite is as follows:
%%   \cite{key}          ==>>  [#]
%%   \cite[chap. 2]{key} ==>>  [#, chap. 2]
%%   \citet{key}         ==>>  Author [#]

%% References with bibTeX database:

%\bibliographystyle{model1-num-names}
%\bibliography{sample.bib}

%% Authors are advised to submit their bibtex database files. They are
%% requested to list a bibtex style file in the manuscript if they do
%% not want to use model1-num-names.bst.

%% References without bibTeX database:

% \begin{thebibliography}{00}

%% \bibitem must have the following form:
%%   \bibitem{key}...
%%

% \bibitem{}

% \end{thebibliography}

\end{document}

%%
%% End of file `elsarticle-template-1-num.tex'.

max_stars_repo_name: swaevior/notes-and-research

max_issues_repo_name: swaevior/notes-and-research

max_forks_repo_name: swaevior/notes-and-research


text:
\subsection{Comparison of results}

	From the table~\ref{tab:ri-comparison-results} we can see that for \verb|SC_545| and \verb|MAX_682| the Tabu Search is the best choice but it needs 8 minutes of computation versus only a few seconds of Local Search. In the \verb|DS_1120| instance instead Tabu Search performs poorly, this happens because the 60 seconds for each run it's not a sufficient time to get a local minimum. I think this is due to the fact that with 1120 nodes the evaluation of neighbours needs much more time than with others instances.

	\begin{table}[hb]
		\centering
		\begin{tabular}{llrrrr}
			\toprule
			\textbf{Instance} & \textbf{Solver} & \textbf{Avg Value} & \textbf{Best Value} & \textbf{Avg T (s)} & \textbf{Tot T (s)} \\
			\toprule
			\verb|SC_545|           & TS BI AC        & 16250.2            & 15991               & 60.01                 & 480.06                \\
			& LS BI           & 16809.8            & 16440               & 0.45                  & 3.59                  \\
			& LS FI           & 16504.8            & 16231               & 0.70                  & 5.61                  \\
			\midrule
			\verb|MAX_682|          & TS BI AC        & 5276730.0          & 5115970             & 60.02                 & 480.12                \\
			& LS BI           & 5350680.0          & 5187620             & 0.86       &  6.92           \\
			& LS FI           & 5356200.0          & 5272060             & 1.44                 &   11.56                \\
			\midrule
			\verb|DS_1120|          & TS BI AC        & 35080600.0         & 33428000            & 60.04                 & 480.36                \\
			& LS BI           & 17051200.0         & 16969100            & 4.99                & 39.94                \\
			& LS FI           & 16921800.0         & 16742900            & 8.88                & 71.01    \\
			\bottomrule
		\end{tabular}
		\caption{Comparison of results between Local Search and Tabu Search with real instances (T = Time).}
		\label{tab:ri-comparison-results}
	\end{table}

ext: tex


text:
\section{Appendix 5: Visualisation}

\begin{figure}[h]
\begin{center}
	\scriptsize{
	\begin{python}
    for i, line in enumerate(fr2):
        x1, x2, x3, x4, x5, x6, x7, x8 = map(float, line.split())
        color_target = ''
        if x8 == 1: color_target = 'orange'
        elif x8 == 0: color_target = 'red'
        elif x8 == -1: color_target = 'pink'

        targetcircle = plt.Circle(util.polar_to_cartesian(x3,x4), radius=1, color=color_target, fill=True)
        subfig.add_patch(targetcircle)
	\end{python}
	}
	\caption{Code assigning a color to each targets on the animation, depending on the fiber required for the survey.}
	\label{fig:appendix:visualisation}
\end{center}
\end{figure}


text:
\input{head}
\input{customstuff}

\begin{document}

\title{The Geometry of Physics --\\Problem Solutions}
\author{David Luposchainsky, Ernest Yeung}
\date{\number\day.\,\number\month.\,\number\year}
\maketitle

\abstract{These are my solutions to problems given in Theodore Frankel's book ``The Geometry of Physics'' (second edition). As I could not find any other sources, I do not know whether they are correct or not, so read with care (especially the index battles). If you have a solution that is not in here already, a better way of showing something, or just some useful comment, I'd like to hear about it\footnote{e-mail: stupid underscore name at gmx dot net}.} \\

20110714 - further solutions begun by Ernest Yeung.

\section*{Conventions}
If not mentioned differently, use the following conventions:
\begin{itemize}
	\item Use Einstein summation. Sometimes I'll typeset a \(\sum\) for clarification though.
	\item The ``\(\rightharpoondown\)'' used in the book will be used implicitly, i.e. multiindices are always assumed to be in ascending order.
	\item Abbreviations concerning the metric tensor: \\ \ieq{g:=|\det{\{g_{ij}\}}|}, \ieq{s:=\sign{\det{\{g_{ij}\}}}}
\end{itemize}

\newpage

\setcounter{tocdepth}{4}
\tableofcontents

\newpage

\section*{I Manifolds, Tensors and Exterior Forms}

\section{Manifolds and Vector Fields}
 \input{01ManifoldsVector}

\section{Tensors and Exterior Forms}
		\input{02tensors}

\section{Integration of Differential Forms}
		\input{03integration}

\section{The Lie derivative}
		\input{04liederivative}

\section{The Poincare Lemma and Potentials}
		\input{05potentials}

\section{Holonomic and Nonholonomic Constraints}

\section*{II Geometry and Topology}

\section{$\mathbb R^3$ and Minkowski Space}
		\input{07r3minkowski}

\section{The Geometry of Surfaces in $\mathbb{R}^3$}

\section{9 Covariant Differentiation and Curvature}
		\input{09covariantdifferentiation}

\section{10 Geodesics}

\section{11 Relativity, Tensors, and Curvature}

\section{12 Curvature and Topology: Synge's Theorem}

\section{13 Betti Numbers and De Rham's Theorem}

\section{14 Harmonic Forms}

\section*{III Lie Groups, Bundles, and Chern Forms}

	\section{15. Lie groups}
		\input{15liegroups}
	\section{16. Vector Bundles in Geometry and Physics}
		\input{16vectorbundles}

\section{17. Fiber Bundles, Gauss-Bonnet, and Topological Quantization  }
\input{17fiberbundles}

\section{18. Connections and Associated Bundles}

\input{18ConnectionsandAssociatedBundles}

\section{19. The Dirac Equation}

\input{19TheDiracEquation}

\section{20. Yang-Mills Fields }

             \input{20YangMillsFields}

\section{21.}

\begin{appendix}

\section{A. Elasticity}

\subsection{A.a. The Classical Cauchy Stress Tensor and Equations of Motion}

$B(t)$ compact body, might be portion of larger body in motion

mass 3 form
\[
m^3 \equiv \rho \text{ vol }
\]

mass conservation
\[
\frac{d}{dt} \int_{B(t)} m^3 = \int_{B(t)} \mathcal{L}_{\textbf{v} + \frac{ \partial }{ \partial t}} m^3 = 0
\]
$\mathbf{b}$ external force density (per unit mass)
\[
\frac{d}{dt} \int_{B(t)} v^i m^3 = \int_{B(t)} b^i m^3 + \int_{ \partial B(t)} t^{ij}n_j da
\]

\subsection{A.b. Stresses in Terms of Exterior Forms}

$t$ pseudo $(n-1)$ form on $M^n$ with values in tangent bundle $TM$ (vector bundle language)

\begin{equation}
        \mathbf{t} = \mathbf{e}_r \otimes \mathfrak{t}^r \equiv \mathbf{e}_r \otimes \mathfrak{t}^r_{ \, \, \underline{J}} \sigma^J
\end{equation}

\[
\int_{ \partial B} \mathbf{t} = \int_{\partial B} \mathbf{e}_r \otimes \mathfrak{t}^r = \mathbf{e}_r \int_{\partial B} \mathfrak{t}^r = \mathbf{e}_r \int_{ \partial B} \mathfrak{t}^r_{ \underline{J}} dx^J
\]
as total traction that part of body outside $\partial B$ exerts on $B$

(2.73) $\forall \, $  Riemannian $M$, write $(n-1)$ form $\mathfrak{t}^r$ in terms of vector $t^{(r)}$

\[
\mathfrak{t}^r = i(\mathbf{t}^r) \text{vol} = i (\mathbf{t}^{(r)} ) \sqrt{g} \epsilon_{\underline{I}} dx^I = \sqrt{g} \mathbf{t}^{(r)i} \epsilon_{i \underline{J}} dx^J
\]

\begin{equation}
t^r_{ \, \underline{J}}  = \sqrt{g} t^{(r)i} \epsilon_{i \underline{J}} \quad \quad \, (A.6)
\end{equation}
\[
t^{ri} \equiv t^{(r)i} = \frac{1}{\sqrt{g}} t^r_{ \, \, \underline{J}} \epsilon^{i J }
\]
relation between stress form $t^r$ and Cauchy's stress tensor $t^{ri}$

assuming $\mathbf{t} = \mathbf{e}_r \otimes \mathfrak{t}^r$ is $(n-1)$ form section of the tangent bundle, thus from (9.31), we have

20141102 EY recall
\[
\nabla \alpha = e \otimes (d\alpha + \omega \wedge \alpha) \quad \quad \quad \, (9.31)
\]
and
\[
\begin{gathered}
        \nabla \alpha = \nabla( e_i \otimes \alpha^i) = (\nabla e_i) \otimes_{\wedge} \alpha^i + e_i \otimes d\alpha^i \\
 \text{ where }  \\
(\nabla e_i) \otimes_{\wedge} \alpha^i = (e_k \otimes \omega^k_{\, \, i}\otimes_{\wedge} \alpha^i \equiv e_k \otimes ( \omega^k_{\, \, i} \wedge \alpha^i)
\end{gathered}
\]

\begin{equation}
        \nabla t = \nabla (\mathbf{e}_r \otimes \mathfrak{t}^r) = \nabla \mathbf{e}_r \otimes_{\wedge} \mathfrak{t}^r + \mathbf{e}_r \otimes d\mathfrak{t}^r = \mathbf{e}_r \otimes (d\mathfrak{t}^r + \omega^r_{ \, \, s} \wedge \mathfrak{t}^s) = \mathbf{e}_r \otimes \nabla \mathfrak{t}^r \quad \quad \quad \, (A.7)
\end{equation}

\subsection{A.f. Hamilton's Principle in Elasticity}

\begin{equation}
        \delta U = \int_B \delta E_{RC} dX^R \wedge S^C \quad \quad \quad \, (A.24)
\end{equation}

\begin{equation}
        \delta U = \int_B S^{CR} \delta E_{RC} \text{VOL}^n \quad \quad \quad \, (A.25)
\end{equation}

Hamilton's principle
\begin{equation}
\delta \int T dt - \int \delta U dt + \int \delta W dt = 0 \quad \quad \quad \, (A.26)
\end{equation}

We don't write $\delta \int U dt $ because we don't assume \\

We don't assume that $\exists \, $ stored energy function $U$ so we don't write $\delta \int U dt$, $\exists \, $ only differential $\delta U$

\end{appendix}
\end{document}

max_stars_repo_path: LaTeX_and_pdfs/the geometry of physics problems/tgpfix.tex


text:
\documentclass[usepdftitle=false,professionalfonts,compress ]{beamer}

%Packages to be included
\usepackage[latin1]{inputenc}
\usepackage{graphics,epsfig, subfigure}
\usepackage{url}
\usepackage[T1]{fontenc}
%\usepackage{listings}
\usepackage{hyperref}
\usepackage[english]{babel}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%% PDF meta data inserted here %%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\hypersetup{
	pdftitle={Introduction},
	pdfauthor={Kenneth Sundberg}
}

%%%%%% Beamer Theme %%%%%%%%%%%%%

\usetheme[]{Warsaw}

\title{Introduction}
\subtitle{CS 5300}
\author{Kenneth Sundberg}
\date{}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%% Begin Document  %%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
\frame[plain]{
	\frametitle{}
	\titlepage
	\vspace{-0.5cm}
	\begin{center}
	%\frontpagelogo
	\end{center}
}
\frame{
	\tableofcontents[hideallsubsections]
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%% Content starts here %%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Syllabus}

\subsection{Policies}

{
\begin{frame}\frametitle{Late Policy}

	\begin{itemize}
	\item 10\% off per day late
			\item Not accepted more than 3 days late
				\end{itemize}

\end{frame}}

{
\begin{frame}\frametitle{Grading Weights}

	\begin{itemize}
	\item Exams - 30\%
			\item Compiler Project - 70\%
				\end{itemize}

\end{frame}}

{
\begin{frame}\frametitle{ADA}

	\begin{itemize}
	\item Course is ADA compliant
			\item If necessary get me paperwork from the DRC
				\end{itemize}

\end{frame}}

{
\begin{frame}\frametitle{Cheating}

	\begin{itemize}
	\item Don't do it
			\item Group Work
				\end{itemize}

\end{frame}}

\subsection{Tool Chain}

{
\begin{frame}\frametitle{Compilers}

	\begin{itemize}
	\item gcc 4.8.1
			\item flex 2.5.4
			\item bison 2.5
				\end{itemize}

\end{frame}}

{
\begin{frame}\frametitle{Build Tools}

	\begin{itemize}
	\item CMake

	\begin{itemize}
	\item Cross Platform Make
				\end{itemize}

			\item gmake
			\item Either is fine
				\end{itemize}

\end{frame}}

{
\begin{frame}\frametitle{MIPS Simulator}

	\begin{itemize}
	\item Mars
			\item SPIM also available but not fully compatible
				\end{itemize}

\end{frame}}

\subsection{CPSL}

{
\begin{frame}\frametitle{Compiler Project Source Language}

	\begin{itemize}
	\item We are building a simple compiler
			\item Language is PASCAL-like
			\item Only integral types and string constants
			\item MIPS is the target archetecture
			\item Beware - sometimes the dragon wins.
				\end{itemize}

\end{frame}}

{
\begin{frame}\frametitle{GitHub}

	\begin{itemize}
	\item https://github.com/ksundberg/CS5300
			\item Documentation

	\begin{itemize}
	\item Also available on Canvas as a .pdf
			\item Further sections and clarifications may be added as course progresses
				\end{itemize}

			\item Test Files

	\begin{itemize}
	\item Correct processing of these files is the goal of compiler project
				\end{itemize}

			\item Feel free to make pull requests, especially for more test files
				\end{itemize}

\end{frame}}

\section{C++}

\subsection{RAII}

{
\begin{frame}\frametitle{Resource acquisition Is Initialization}

	\begin{itemize}
	\item Possibly most important C++ idiom
			\item Everything is owned by something
			\item If ownership is complex then that should be a classes only task
				\end{itemize}

\end{frame}}

\subsection{C++ 11}

{
\begin{frame}\frametitle{Smart Pointers}

	\begin{itemize}
	\item new and delete are radioactive
			\item shared\_ptr
			\item unique\_ptr
			\item weak\_ptr
			\item make\_shared
			\item make\_unique (C++ 14)
				\end{itemize}

\end{frame}}

{
\begin{frame}\frametitle{Lambda}

	\begin{itemize}
	\item Short anonymous functions
			\item Capture List
			\item Parameter List
			\item Return Type
			\item Body
				\end{itemize}

\end{frame}}

{
\begin{frame}\frametitle{Auto}

	\begin{itemize}
	\item AAA style (Almost Always Auto)
			\item Let the compiler worry about types
			\item Still strongly typed and safe
				\end{itemize}

\end{frame}}

{
\begin{frame}\frametitle{Range based for}

	\begin{itemize}
	\item Simple iterating syntax
			\item For more complex things use algorithims
			\item Avoid raw loops
				\end{itemize}

\end{frame}}

\section{Compilers}

\subsection{Purpose}

{
\begin{frame}\frametitle{Language Processors}

	\begin{itemize}
	\item Compilers convert from source languages to target languages
			\item An important side job is error detection
				\end{itemize}

\end{frame}}

{
\begin{frame}\frametitle{Processing Chain}

	\begin{itemize}
	\item Preprocessor
			\item Compiler
			\item Assembler
			\item Linker
			\item Loader
				\end{itemize}

\end{frame}}

\subsection{Structure}

{
\begin{frame}\frametitle{Symbol Table}

	\begin{itemize}
	\item All parts access the Symbol Table
			\item Stores type and location information
				\end{itemize}

\end{frame}}

{
\begin{frame}\frametitle{Front End}

	\begin{itemize}
	\item Responsible for language dependent portions
			\item Lexical, syntax, and semantic analysis
			\item Intermediate code generation
				\end{itemize}

\end{frame}}

{
\begin{frame}\frametitle{Optimizer}

	\begin{itemize}
	\item Most work done here
			\item Intermediate code to better intermediate code
			\item Independent of both source and target language
				\end{itemize}

\end{frame}}

{
\begin{frame}\frametitle{Back End}

	\begin{itemize}
	\item Responsible for target dependent portions
			\item Code generator and machine dependent optimization
				\end{itemize}

\end{frame}}

{
\begin{frame}\frametitle{Compiler Collection}

	\begin{itemize}
	\item Mix and Match front ends and back ends
			\item New languages only require a front end
			\item New machines only require a back end
				\end{itemize}

\end{frame}}

\subsection{Compiler Phases}

{
\begin{frame}\frametitle{Scanning}

	\begin{itemize}
	\item Lexical Analysis
			\item Regular Language
			\item Transform character stream into tokens
				\end{itemize}

\end{frame}}

{
\begin{frame}\frametitle{Parsing}

	\begin{itemize}
	\item Syntax Analysis
			\item Context Free Grammar
			\item Transform token stream to syntax tree
				\end{itemize}

\end{frame}}

{
\begin{frame}\frametitle{Code Generation}

	\begin{itemize}
	\item May include optimization
			\item Transform syntax tree to executable code
				\end{itemize}

\end{frame}}

\subsection{History and Evolution}

{
\begin{frame}\frametitle{Generations}

	\begin{itemize}
	\item First generation - machine code
			\item Second generation - assembly code
			\item Third generation - general purpose languages
			\item Fourth generation - special purpose languages
				\end{itemize}

\end{frame}}

{
\begin{frame}\frametitle{Types of Languages}

	\begin{itemize}
	\item Imperative vs. Declarative
			\item High Level vs. Low Level
				\end{itemize}

\end{frame}}

\end{document}


text:
This section describes the analysis methodology. This study uses boosted $Z\to\tauhad\taulep$ events to measure Monte Carlo correction factors for the tau identification algorithms in the high-$\pt$ region.

Different working points are defined for RNN score relative to the efficiency of selecting true $\tauhad$ candidates. When the efficiency of the working points is measured in data and simulation, a correction factor has to be derived and then applied to the simulation in order for the signal efficiency to agree between data and simulation \cite{ATLAS:2017mpa}. Because of the top quark mass, $t\bar{t}$ events are usually used as a source of high momentum taus for measuring the scale factors in the high-$p_T$ regime. However, Lepton universality may not hold in W decays. For that reason, this study uses boosted $Z\to\tauhad\taulep$ events for deriving and cross checking the simulation correction factors in the high-$p_T$ region.
\subsection{Signal Events}\label{signalevents}
For this study, we consider as signal the events where one the taus decays hadronically and the other leptonically, either into an electron or a muon. Thus, our final states will include a $\tauhad$ candidate and one light lepton $l=e,\mu$. The presence of the light lepton will be used as our tag.
Generally, in $Z\to\tau\tau$ events, the taus are produced back to back and their $\pt$ spectrum falls sharply. In order to select boosted taus, we look for events where the opening angle in the transverse plane between the taus ($\Delta\phi(\tauhad,\taulep)$) is narrower than usual. A depiction of the topologies of our signal events is shown in Fig.\ref{Fig1}. For these events, the missing transverse momentum ($\met$) is assumed to come from the neutrinos produced in the decays of the tau leptons. Due to the fact that two neutrinos are produced in the leptonic decay mode we expect our events to have a larger $\met$ component along the $\taulep$ direction.
\begin{figure}[htbp]
	\centering
	\subfloat[]{\label{Fig1a}{\includegraphics[width=0.49\textwidth]{Fig1a}}}\hfill
	\subfloat[]{\label{Fig1b}{\includegraphics[width=0.49\textwidth]{Fig1b}}}
	\caption{The two different types of topologies that define the signal events. On the left, when the missing energy is between the visible objects. For these events two neutrinos are assumed to be responsible for all the missing energy. On the right, when the missing energy is outside only one neutrino is assumed to be flying on the direction of the visible object closest to the missing energy.}
	\label{Fig1}
\end{figure}

Events are classified into two topologies. First, the events where the $\met$ is inside the opening angle between the visible objects. For this kind of events, we assume that the missing energy is due to a pair of neutrinos flying in the same direction as the visible objects. This is shown in Fig.\ref{Fig1a}. In this case, the following equation is solved to obtain the momentum of the neutrinos:
\begin{equation}
\vec{p}_{T_{\nu_l}}+\vec{p}_{\nu_h}=\vec{\met},
\end{equation}
given the following set of constraints (\textit{collinear approximation}):
\begin{align}
	\phi(\nu_l)&=\phi(l),
	\\
	\phi(\nu_h)&=\phi(\tauhad),
	\\
	\eta(\nu_l)&=\eta(l),
	\\
	\eta(\nu_h)&=\eta(\tauhad).
\end{align}
In the second case, when the $\met$ is pointing outside the angle formed by the visible objects, the assumption is that only one neutrino is responsible for the majority of the $\met$. We suppose the neutrino is flying in the direction of the visible object that is closest to the $\met$, as is shown in Fig.\ref{Fig1b}. The following equations are used to obtain the neutrino momentum:
\begin{align}
	p_{T_{\nu}}&=\met \cos(\Delta\phi(\tau_{\text{closer}},\met)),
	\\
	\phi(\nu)&=\phi(\tau_{\text{closer}}),
	\\
	\eta(\nu)&=\eta(\tau_{\text{closer}}),
\end{align}
where $\tau_{closer}$ stands for the visible object closest to the direction of the $\met$.

A variable called $\Omega$ is defined in order to classify the events in one of the described topologies . First, we define:
\begin{equation}
\omega=\frac{\Delta\phi(\tau_{\text{closer}},\met)}{\Delta\phi(\tauhad,\taulep)},
\end{equation}
then,
\begin{itemize}
	\item when $\met$ is inside the opening angle between the visible objects but closer to $\tauhad$:
	\begin{equation}
	\Omega=\omega,
	\end{equation}
	\item when $\met$ is still inside, but closer to $\taulep$:
	\begin{equation}
	\Omega=1-\omega.
	\end{equation}
	\item If $\met$ is outside and closer to $\tauhad$:
	\begin{equation}
	\Omega=-\omega,
	\end{equation}
	\item and finally, if $\met$ is outside and closer to $\taulep$:
	\begin{equation}
	\Omega=\omega+1.
	\end{equation}
\end{itemize}
Thus, $\Omega$ is a continuous variable that gives information on the topology of the event. When the $\met$ is inside the visible system it has values in the interval [0,1]. It is exactly zero when $\met$ is in the $\tauhad$ direction and one when $\met$ is in the $\taulep$ direction. $\Omega$ has negative values when the $\met$ is outside and closer to the $\tauhad$ candidate and has positive and values greater than one when is outside and closer to the $\taulep$. A diagram describing the $\Omega$ values is shown in Fig.\ref{Fig2}.
\begin{figure}[htbp]
	\centering
	\includegraphics[width=0.5\textwidth]{Fig2.png}
	\caption{Graphical representation of the different values of $\Omega$ depending on the region where the $\met$ is located.}
	\label{Fig2}
\end{figure}
As we will see later, the event classification into these different topologies will allow us to reconstruct and exploit kinematic variables as the invariant mass of the di-tau system, the Z boson transverse momentum ($Z\pt$) and the angular distribution of the objects in the event.

\subsection{Scale Factors Calculation}\label{sec3.2}
Conventionally, the correction or scale factors (SFs), are defined as the ratio of the efficiency in data and simulation of a $\tauhad$ candidate to pass a certain level of identification. The main challenge in that approach is the estimation of the background coming from QCD initiated jets. Additionally, $\POWPY$ and $\SHERPA$ simulations give different predictions for the $Z\pt$. Consequently, distinct MC generators will predict different kinematics for the reconstructed objects and this will affect the measurement.

For this measurement, an alternative approach has been taken. First, the ratio of observed signal events to predicted events in simulation for $Z\to\tauhad\taulep$ is defined as:
\begin{equation}
	C_{X}(Z\to\tauhad\taulep)=\frac{\NData}{\NMC}.
	\label{eq14}
\end{equation}
Where X is any of the tau-ID working points, $\NData$ is the number of $Z\to\tauhad\taulep$ events observed in the data having subtracted the background predictions and $\NMC$ are the number of simulated $\Ztt$ events with one truth-matched $\tauhad$. Next, we calculate the same ratio but for $Z\to ll$ events:
\begin{equation}
C(Z\to ll)=\frac{\NData}{\NMC}.
\end{equation}
Here, $\NData$ is the number of $Z\to ll$ events observed in data having subtracted the background predictions and $\NMC$ is the number of simulated $\Zll$ events passing all the selections.

Finally, to define the SFs we take the following double ratio:
\begin{equation}
SF_{X}=\frac{C_{X}(Z\to\tauhad\taulep)}{C(Z\to ll)}.
\end{equation}
With this method, at first order, it is expected that some of the light lepton related uncertainties cancel. Additionally, phenomenological and luminosity uncertainties would be reduced as well.

However, it is important to point out that this method does not have some of the advantages offered by the traditional measurement. In that case, it is the efficiency itself what is compared between data and MC. This helps to partially cancel the systematic uncertainties, coming for instance, from the calibration of the $\pt$ of the taus. This happens since both in the numerator and denominator the MC yields are affected by the tau calibration systematics.

\subsection{Event Selection}\label{sec3.3}
\subsubsection{$Z\to\tauhad\taulep$ Events}\label{sec3.3.1}
In order to select $Z\to\tauhad\taulep$ events, the basic selection includes events with exactly one light lepton and one or more loose $\tauhad$ candidates. The $\tauhad$ and lepton pair need to have opposite charge. The presence of the lepton will be used as our tag, thus, a lepton trigger is required to be fired with an online requirement on the $p_{T}(\mu)\geq 20$ ($p_{T}(e)\geq 24$) GeV for 2015 data taking period. For 2016-2018 the online requirement is $p_{T}(\mu,e)\geq 26$ GeV. The muon is required to pass a \textit{medium} ID requirement and the electron has to pass a \textit{tight} ID filter. Additionally, both muons and electrons have to pass an offline $p_T$ requirement, it has to be greater than 27 GeV. Finally, the opening angle between the two visible objects $\Delta\phi(\tauhad,l)\leq 1.0$ rad.

Events containing b-jets are vetoed to reject $t\bar{t}$ background. In addition, an isolation criterion is required to be passed by the leptons: for the muon (electron), the scalar sum of the $p_T$ of the tracks within a cone of $\Delta R=0.3 (0.2)$ of the muon (electron) must be less than 0.06 times the muon (electron) $p_T$. Additionally, for the electron, the sum of the calorimeter cluster energy in a cone of size $\Delta R=0.2$ must be 0.06 times smaller than the electron $p_T$. As discussed above, we expect signal events to peak around $\Omega=1$, thus we select events where $\Omega\in (-0.2,1.6)$. Fig.\ref{Fig3} shows the $\Omega$ distribution for the $Z\to\tauhad\mu$ final state.
\begin{figure}[htbp]
	\centering
	\includegraphics[width=0.6\textwidth]{figures/Fig3.pdf}
	\caption{Distribution of $\Omega$ for the $Z\to\tauhad\mu$ final state. All the other cuts have been applied apart from the one being plotted. The ATLAS data is shown as points with error bars, showing the statistical uncertainties. The detector-level predictions are shown as the coloured histograms, with the colour code as given on the plots.The region between the vertical dashed red lines is included in the final event selection. The lower section of each plot shows the ratio of prediction to data. The uncertainties on the predictions represent the MC statistical uncertainties. These uncertainties are shown as the blue shaded regions.}
	\label{Fig3}
\end{figure}
Additionally, a cut on the reconstructed invariant mass ($\mreco$) of the event is made. The cut is designed to pick events where the invariant mass is around the Z boson mass ($60\leq\mreco\leq 120$ GeV). The invariant mass of the final states is calculated depending on the event topology. For events where $\Omega\in [0,1]$ (\textit{in-between events}),
\begin{equation}
\mreco^{2}=(q_l+q_{\tauhad}+q_{\nu_l}+q_{\nu_{\tauhad}})^2.
\label{eq35a}
\end{equation}
When the $\met$ is outside (\textit{outside events}),
\begin{equation}
(\mreco-5)^{2}=(q_l+q_{\tauhad}+q_\nu)^2.
\label{eq35b}
\end{equation}
The RHS of \eqref{eq35a} and \eqref{eq35b} are 4-vector sums, where $q$ represents the four-momentum of each particle. In the outside events case we manually add 5 GeV, since in this region we find empirically that the di-tau mass is underestimated and we wish to apply the same selection in both regions. Fig.\ref{Fig4} shows the distribution of $\mreco$ for the in-between and outside $Z\to\tauhad\mu$ events.
\begin{figure}[htbp]
	\centering
	\subfloat[]{\label{Fig4a}{\includegraphics[width=0.50\textwidth]{figures/Fig4a}}}\hfill
	\subfloat[]{\label{Fig4b}{\includegraphics[width=0.50\textwidth]{figures/Fig4b}}}
	\caption{$\mreco$ distribution for the in-between region (a) and the outside region (b). All the other cuts have been applied apart from the one being plotted.}
	\label{Fig4}
\end{figure}

Furthermore, for the $Z\to\tauhad e$ final state, we add two cuts aimed to reject events where the $\tauhad$ candidate is faked by an electron. First, a requirement on the invariant mass of the electron and $\tauhad$ candidate is applied, $m(e,\tauhad)<80$ GeV. Then, we make use of an ID algorithm trained to discriminate electrons from real $\tauhad$. We require, eBDTScore$\geq 0.05$. The distributions for these variables are shown in Fig.\ref{Fig5}.
\begin{figure}[htbp]
	\centering
	\subfloat[]{\label{Fig5a}{\includegraphics[width=0.50\textwidth]{figures/Fig5a}}}\hfill
	\subfloat[]{\label{Fig5b}{\includegraphics[width=0.50\textwidth]{figures/Fig5b}}}
	\caption{Distribution of the variables used to reject $\tauhad$ fakes coming from electrons. On the right $m(e,\tauhad)$ distribution (a) and on the left the eBDTScore distribution (b). All the other cuts have been applied apart from the one being plotted.}
	\label{Fig5}
\end{figure}

Finally, in order to measure the tau ID SFs in the high-$p_T$ region we select events where $p_T(\tauhad)\geq 45$ GeV. The $p_T$ distributions for $\tauhad$ candidates are shown in Fig.\ref{Fig6} for the in-between and outside regions. A side by side comparison of the $Z\to\tauhad\mu$ and $Z\to\tauhad e$ cut distributions can be found in A\ref{DistComparisons}.
\begin{figure}[htbp]
	\centering
	\subfloat[]{\label{Fig6a}{\includegraphics[width=0.50\textwidth]{figures/Fig6a}}}\hfill
	\subfloat[]{\label{Fig6b}{\includegraphics[width=0.50\textwidth]{figures/Fig6b}}}
	\caption{$p_T(\tauhad)$ distribution for the in-between (a) and outside (b) regions. All the other cuts have been applied apart from the one being plotted.}
	\label{Fig6}
\end{figure}
\subsubsection{$\Zll$ Events}\label{sec3.3.2}
As described in Sec. \ref{sec3.2}, we will divide the simulation to data ratio in $Z\to\tauhad\taulep$ events by the same quantity in $\Zll$ events. In this final state, our basic selection includes events with exactly two same flavour and opposite charge light-leptons. The same lepton triggers are used for this final state.

Events containing b-jets are vetoed in order to reject $t\bar{t}$ background. In addition, the same isolation and identification criterion is required to be passed by the leptons. A cut in the invariant mass of the light lepton pair is applied, $70<m(l_1,l_2)<110$ GeV. The corresponding distribution is shown in Fig. \ref{Fig7s}.

\begin{figure}[htbp]
	\centering
	\includegraphics[width=0.6\textwidth]{figures/Fig7.pdf}
	\caption{$m(l_1,l_2)$ distribution for the $Z\to\mu\mu$ final state. All the other cuts have been applied apart from the one being plotted. In this and all subsequent figures, the ATLAS data is shown as points with error bars, corresponding to the statistical uncertainties. The detector-level predictions are shown as the coloured histograms, with the colour code as given in the plots. The region included in the final sample is $70<m(l_1,l_2)<11	0$ GeV. The lower section of each plot shows the ratio of prediction to real data. The uncertainties on the predictions represent the MC statistical uncertainties. These uncertainties are shown as the blue shaded region.}
	\label{Fig7s}
\end{figure}

Since the visible products of the tau decay only carry a part of the original tau $\pt$, we need to cut harder on the light leptons produced in $\Zll$ events. Therefore, to approximately match the kinematic phase space between  $Z\to\tauhad\taulep$ and $\Zll$ events many different values for the $\Delta\phi (l_1,l_2)$ and the $\pt$ of the leptons have been explored. For the angular separation, the best match is to require $\Delta\phi (l_1,l_2)\leq 1.0$ rad, the $\Delta\phi (l_1,l_2)$ distribution is shown in Fig. \ref{Fig8s}. Regarding the transverse momentum of the leptons, an initial offline requirement of $\pt(l_1)\geq 50$ and $\pt(l_2)\geq 47$ GeV is applied. To be able to match the high-$\pt$ $\tauhad$ candidates a further cut of 30 GeV is randomly applied in one of the leptons. This last part is due to the fact that the light-leptons are ordered in $\pt$ and not always the hardest tau is the $\tauhad$ candidate. The resulting distributions are shown in Fig. \ref{Fig9}.
\begin{figure}[htbp]
	\centering
	\includegraphics[width=0.6\textwidth]{figures/Fig8.pdf}
	\caption{Distribution of $\Delta\phi (l_1,l_2)$ for the $Z\to\mu\mu$ final state. The region included in the final selection is $\Delta\phi (l_1,l_2)\leq 1.0$ rad.}
	\label{Fig8s}
\end{figure}
\begin{figure}[htbp]
	\centering
	\subfloat[]{\label{Fig9a}{\includegraphics[width=0.50\textwidth]{figures/Fig9a}}}\hfill
	\subfloat[]{\label{Fig9b}{\includegraphics[width=0.50\textwidth]{figures/Fig9b}}}
	\caption{$\pt$ distributions for $Z\to\mu\mu$ events.}
	\label{Fig9}
\end{figure}

The reconstructed and truth Z$(\pt)$ distributions with the best match cuts between $\Zll$ and $Z\to\tauhad\taulep$ events are shown in Fig.\ref{Fig13} . A set of alternative selections, defined by varying the last lepton $\pT$ cut by 10 GeV have been studied. This aims to asses the effect of having different degree of kinematic match between $\Zll$ and $Z\to\tauhad\taulep$ final states. The corresponding truth Z$(\pt)$ distributions for every selection are shown in Fig.\ref{Fig14} .

\begin{figure}[htbp]
	\centering
	\subfloat[]{\label{Fig13a}{\includegraphics[width=0.50\textwidth]{figures/Fig13a.pdf}}}
	\subfloat[]{\label{Fig13b}{\includegraphics[width=0.50\textwidth]{figures/Fig13b.pdf}}}\hfill
	\subfloat[]{\label{Fig13c}{\includegraphics[width=0.50\textwidth]{figures/Fig13c.png}}}
	\subfloat[]{\label{Fig13d}{\includegraphics[width=0.50\textwidth]{figures/Fig13d.png}}}
	\caption{Left column represents the detector level (a) and truth level (c) Z$(\pt)$ distributions for $Z\to\tauhad\mu$ events. In the right column, the same variables are shown for the $Z\to\mu\mu$ final state.}
	\label{Fig13}
\end{figure}

\begin{figure}[htbp]
	\centering
	\subfloat[]{\label{Fig14a}{\includegraphics[width=0.50\textwidth]{figures/Fig14a.png}}}
	\subfloat[]{\label{Fig14b}{\includegraphics[width=0.50\textwidth]{figures/Fig14b.png}}}\hfill
	\subfloat[]{\label{Fig14c}{\includegraphics[width=0.50\textwidth]{figures/Fig13d.png}}}
	\subfloat[]{\label{Fig14d}{\includegraphics[width=0.50\textwidth]{figures/Fig14c.png}}}
	\caption{Truth Z-$(\pt)$ distributions for different values of the last lepton $\pt$ cut in the $Z\to\mu\mu$ signal sample. (a) -20 GeV selection, (b) -10 GeV selection, (c) standard selection and (d) +10 GeV selection.}
	\label{Fig14}
\end{figure}

max_stars_repo_name: diegobaronm/QTNote

max_issues_repo_name: diegobaronm/QTNote

max_forks_repo_name: diegobaronm/QTNote


text:
\documentclass[11pt]{article}

\usepackage{amsmath,amsfonts,amssymb}
\usepackage{breqn}
\usepackage[pdftex]{graphicx}
\usepackage{natbib}
\usepackage[usenames,dvipsnames]{xcolor}
%\usepackage[nooneline,tight,raggedright]{subfigure}
\usepackage{multirow}
\usepackage[version=3]{mhchem}

\usepackage{wrapfig}
\usepackage{pstricks,enumerate}
\usepackage{colortbl}
\usepackage{hhtensor}
\usepackage{longtable}
\usepackage[hang,flushmargin,symbol*]{footmisc}
\usepackage[]{algorithm2e}

\usepackage[font=footnotesize,format=plain,labelfont=bf]{caption}
\usepackage{subcaption}

%%%%%%%%% PAGE DIMENSIONS

\setlength{\oddsidemargin}{-0.5in}
\setlength{\textwidth}{5.0in}
\setlength{\topmargin}{-0.5in}
\setlength{\footskip}{0.30in}
\setlength{\textheight}{9.0in}
\setlength{\headheight}{0.2in}
\setlength{\headsep}{0.3in}

%%%%%%%%% SECTIONING STUFF
\makeatletter
\renewcommand{\section}{\@startsection
{section}%
{0}%
{0mm}%
{0.4\baselineskip}%
{0.4\baselineskip}%
{\normalfont\Large\bfseries\color{myBrown}}}%
\makeatother

\makeatletter
\renewcommand{\subsection}{\@startsection
{subsection}%
{1}%
{0mm}%
{0.4\baselineskip}%
{0.4\baselineskip}%
{\normalfont\large\bfseries\color{myBrown}}}%
\makeatother

\makeatletter
\renewcommand{\subsubsection}{\@startsection
{subsubsection}%
{1}%
{0mm}%
{-0.5\baselineskip}%
{0.3\baselineskip}%
{\normalfont\normalsize\itshape\centering\color{myBrown}}}%
\makeatother

\renewcommand{\thesection}{\arabic{section}}
\renewcommand{\thesubsection}{\thesection.\arabic{subsection}}

%\renewcommand*{\thefootnote}{\fnsymbol{footnote}}
%\renewcommand{\footnoterule}{%
%  \kern -3pt
% \hrule width \textwidth height 1pt
%  \kern 2pt
%}

%%%%%%%%% FORMATTING TIDBITS

\definecolor{myTan}{RGB}{205,133,63}
\definecolor{myBrown}{RGB}{155,77,40}
\captionsetup{labelfont={color=myBrown,bf},textfont={color=myTan}}
\newcommand{\HRule}[2]{{\color{myBrown}\rule{#1}{#2}}}
\newcommand{\tPI}[1]{{\color{myBrown}#1}}
\newcommand{\sPI}[1]{\textsc{\color{myBrown}#1}}
\newcommand{\cPI}[1]{\textbf{\color{myBrown}#1}}
\newcommand{\iPI}[1]{\textit{\color{myBrown}#1}}
\newcommand{\lead}[1]{\textit{\color{myBrown}(#1)}}
\newcommand{\tabtit}[1]{\textsc{\color{myBrown}#1}}
\newcommand{\entry}[1]{\mbox{\sffamily\bfseries{#1:}}\hfil}%
\newcommand{\bitem}{\item[{\color{myBrown}$\bullet$}]}
\newcommand{\bmath}{\boldsymbol}
\newcommand{\eps}{\varepsilon}
\newcommand{\Dpartial}[2]{\frac{\partial #1}{\partial #2}}
\newcommand{\itemcolor}[1]{% Update list item colour
\renewcommand{\makelabel}[1]{\color{#1}\hfil ##1}}
\newcommand{\PlasComCM}{\textit{PlasComCM}}
\newcommand{\cl}[1]{\textit{codelet-#1}}
\newcommand{\Cl}[1]{\textit{Codelet-#1}}
\newcommand{\fut}{$^*$}
\newcommand{\pas}{$^\dag$}
\newcommand{\plusplus}[1]{#1{}\texttt{++}}
%%
%%
\newif\ifclean
\cleantrue
%\cleanfalse

%%%%% CONSISTENCY COMMANDS
\newcommand{\eqr}[1]{(\ref{#1})}
\newcommand{\fgr}[1]{figure~\ref{#1}}
\newcommand{\tbr}[1]{Table~\ref{#1}}
\newcommand{\Fgr}[1]{Figure~\ref{#1}}
\newcommand{\secr}[1]{section~\ref{#1}}
\newcommand{\eqnd}[2]{equations~(\ref{#1}) and (\ref{#2})}
\newcommand{\pp}[1]{\ensuremath{\left( #1 \right)}}
\newcommand{\psq}[1]{\ensuremath{{\left[ #1 \right]}}}
\newcommand{\pcrl}[1]{\ensuremath{{\left \{ #1 \right \} }}}
\newcommand{\pang}[1]{\ensuremath{ \left \langle #1 \right \rangle }}
\providecommand{\pop} {}
\renewcommand{\pop}[2] {\ensuremath{\frac {\partial{#1}} {\partial{#2}}} }
\newcommand{\popn}[3] {\ensuremath{\frac {\partial^{#3}{#1}} {\partial{#2}^{#3}}} }
\newcommand{\dod}[2] {\ensuremath{\frac {d{#1}} {d{#2}}} }
\newcommand{\nd}{\ensuremath{~\textrm{and}~}}
\newcommand{\ee}[1]{ \ensuremath{\times 10^{#1}}}
\newcommand{\plasma}{\ensuremath{\mathrm{c}}}
\newcommand{\plasmar}{\ensuremath{\mathrm{cr}}}
\newcommand{\dancode}{\emph{PlasComCM}}
\newcommand{\bvec}[1]{\ensuremath{\boldsymbol{#1}}}
\newcommand{\mat}[1]{\ensuremath{\mathsf{#1}}}
\newcommand{\parab}[2]{\vspace{#1 pt}\noindent \paragraph{\bf #2 \\}}
\newcommand{\answer}[1]{
$$
\begin{array}{|c|}\hline \\
#1 \\
\\ \hline
  \end{array}
$$}
\newcommand{\Answer}[1]{
\ensuremath{
\begin{array}{|c|}\hline \\
#1 \\
\\ \hline
  \end{array}}}

\DeclareMathOperator\erf{erf}

\usepackage[toc,page]{appendix}
\usepackage{fancyvrb}
% redefine \VerbatimInput
\RecustomVerbatimCommand{\VerbatimInput}{VerbatimInput}%
{fontsize=\tiny,
 %
 frame=lines,  % top and bottom rule only
 framesep=2em, % separation between frame and text
 rulecolor=\color{Gray},
 %
}

%%%%%%%%% COMMENTS/INSTRUCTIONS/NOTES
\setlength{\marginparwidth}{.65in}
\newcommand{\margcomment}[1]{{\color{red}$\bullet$}\marginpar{\raggedright
{\color{red} \tiny #1}}}
\newcommand{\TODO}[1]{{\color{blue}$\bullet$}\marginpar{\raggedright
{\color{blue} \tiny TODO: #1}}}
\usepackage[disable,colorinlistoftodos, color=blue!20!white, bordercolor=gray,
textsize=tiny,textwidth=2.7in]{todonotes}
\newcommand{\LOGM}[1]{\todo[noline,color=green!40]{Luca: #1}}
\newcommand{\LOGF}[1]{\todo[noline,color=orange!40]{JBF: #1}}
\usepackage{color,soul}
\newcommand{\hly}[1]{\textcolor{blue}{#1}}
\usepackage{pstool}
%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%NOMENCLATURE

%%%% REMOVE COMMENTS
\renewcommand{\hl}{}
\renewcommand{\hly}{}
\setlength{\oddsidemargin}{00.0in}
\setlength{\textwidth}{6.5in}

\begin{document}
\pagestyle{plain}

Hi Dan, and Lukas,

After today's discussions, I am convinced we should be able to integrate Lukas' \textit{OpenCL}-based strategy for accelerator/cpu integration with the PC2 development codelets with minimal effort. This is low-hanging fruit and I believe we should jump on it. If you agree, I'd like to discuss some of the specific details about how each of our codes work and make a plan for integration upon which we can all agree. I am just hoping to start a discussion here, not provide a complete description.

Figures~\ref{Figure:Lukas1}, \ref{Figure:Lukas2} and \ref{Figure:PC2Codelet1} are cartoons of my understanding of the \textit{OpenCL} code (does it have a proper name?) and \textit{PlasCom2} development codelets. Lukas, please comment and/or correct this if it's off-base. My understanding of the \textit{OpenCL} procedure is as follows:

\begin{enumerate}
\item{Initialization} -- the domain is coarsely partitioned, the CPU and GPU regions are ``decided'', MPI processes \textbf{P} and \textbf{M} are created to \textit{handle} the CPU and GPU regions, respectively. Process \textbf{P} runs a regular \plusplus{C} program, while the GPU handler process \textbf{M} runs an \textit{OpenCL} program. The GPU/CPU and CPU/CPU halo regions are formed, and all partition buffers are created to \textbf{include} the halo regions. All initial data is exchanged so that the overall program is ready to begin stepping.
\item{Step}\label{step:step} --  Each process \textbf{P} conducts the $N$th RBSOR step, using the already available remote halo data in its main buffer. OpenMP loop parallelism is used to thread the procedure and distribute to available processing cores on the host platform. At the same time, GPU handler processes \textbf{M} use blocking \textit{OpenCL} directives to advance the solution owned by the accelerator devices.
\item{Communication collection \& send} -- Each CPU process \textbf{P} copies the local halo data (i.e. that required by remote (CPU and GPU) partitions) into MPI send buffers, and sends (non-blocking) to remote processes (including remote processes of type \textbf{P} and \textbf{M}. Each GPU process copies local halo data into local buffers dedicated to communication with its driver process \textbf{M}. The GPU driver process \textbf{M} pulls the halo data from the GPU using \textit{OpenCL} directives, and packs the data into MPI communication buffers which it uses to send to remote processes (including the local parent of type \textbf{P}, and remote processes of types \textbf{P} and \textbf{M}.
\item{Receive and unpack} -- All MPI processes of all types post matching receives to all the posted sends, and perform unpacking of the received data into local main buffers. For processes of type \textbf{M}, the data is pushed to the device exchange buffer, and then from the device exchange buffer into the device partition's main buffer using blocking \textit{OpenCL} directives.
\item{Update N} - Go to Step~\ref{step:step}
\end{enumerate}

I propose that we do a few of things:
\begin{description}
\item{Update Lukas' OpenCL code} -- Port the advection kernels from the PC2 development codelets and RK4 to the OpenCL integrator, and conduct the verification test on the results. Currently, we only really know that the OpenCL integrator doesn't fail to run.  We have a one-file, flat procedural implementation of the 1dadvection that should be quite easy to port to Lukas' framework. This will also give us an idea of what it takes to implement the time-marching driver in the \textit{OpenCL} program run by MPI processes of type \textbf{M}.
\item{Update Codelet 4 to use OpenCL} -- The general plan would be to take the interior part of the partition interval, $\text{\mathbf{I}}$, and dispatch it to the GPU through using Lukas' mechanism of spawning off an MPI process of type \textbf{M} to manage the GPU through \textit{OpenCL}. The CPU part of the partition interval would likely retain only the local halo regions, $\text{\mathbf{B}}_{i}$, and domain boundaries. The fact that some remote processes are of type \textbf{M} and handle GPU devices should be transparent to the current operation of Codelet 4.
\end{description}

There are a few additional things we should discuss about using asynchronous communication and asynchronous \textit{OpenCL} to overlap communciation and computation for further gains in Lukas' code, as well as to jibe with the current Codelet4 control flow. Lukas and I have reviewed a potential control flow, and identified a couple of minor related buffering issues.  More details on this can be provided as our discussions continue (if we agree they should continue).

\begin{figure}[h]
\begin{center}
\includegraphics[width=\textwidth]{Figures/Lukas1}
\vspace{-20pt}
\caption{Partition arrangements and communication buffers for OpenCL integrator. An initial \textit{coarse} partitioning into some number of partitions is followed by a finer partitioning of each coarse partition where some subset of the partition is sent to a GPU. In general, the GPU region may collide with the coarse partition boundary, but in practice it may be better if it does not. Each MPI process that handles some portion of the domain (i.e. some partition), communicates data in the halo regions by performing copies to-and-from communication buffers that are used in MPI exchanges. The grid and state buffers are allocated such that they \textit{include} the remote halo regions (i.e. the regions that will contain data owned by remote partitions).}\label{Figure:Lukas1}
\end{center}
\end{figure}

\begin{figure}[h]
\begin{center}
\includegraphics[width=\textwidth]{Figures/Lukas2}
\vspace{-20pt}
\caption{Details of single coarse partition of the OpenCL integrator -- \textit{work} partitioning. The CPU region(s) (possibly a disparate collection of them) are handled by MPI process \textbf{P} on the compute host, and the GPU region (a contiguous subset of the coarse partition) is handled by MPI process \textbf{M} on the compute host. MPI process \textbf{M} is simply a \textit{handler} for \textit{OpenCL} program that runs on the device. The handler process owns the MPI communication buffers used in communicating the gpu/cpu halos between the two host-local MPI processes, and manages the control flow of the \textit{OpenCL} program.  If the GPU region actually collides with the coarse partition boundaries, then the handler process is capable of sending data directly to the corresponding MPI process that requires the halo data. GPU/CPU communication and control flow handling between the \textit{OpenCL} program and the MPI process \textbf{M} are acutated by \textit{OpenCL} directives, and involves the same copy,transfer,copy sequence used in the MPI-MPI exchanges.}\label{Figure:Lukas2}
\end{center}
\end{figure}

\begin{figure}[h]
\begin{center}
\includegraphics[width=\textwidth]{Figures/PC2Codelet1}
\vspace{-20pt}
\caption{PlasCom2 development codelet partition arrangements, regions, and communication regions. In Codelets 3 \& 4, multiple levels of partitioning result in a set of partition intervals, ${\text{\mathbf{I}}_p}$. The grid and state buffers are allocated such that the \textit{remote halo regions} specified by intervals $\text{\mathbf{H}}_{i^{\pm}}$ are not included. The \textit{local halo regions} specified by intervals $\text{\mathbf{B}}_{i^{\pm}}$ are the regions in the local partition that are required by remote partitions. For each region that requires communication with remote partitions, matching send and receive buffers are created.}\label{Figure:PC2Codelet1}
\end{center}
\end{figure}

\end{document}
%-------------------------------------------------------------------------

max_stars_repo_name: MTCam/OKLib

max_issues_repo_name: illinois-ceesd/teesd

max_forks_repo_name: illinois-ceesd/teesd


text:
\documentclass[a4paper]{article}

%% Language and font encodings
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}

%% Sets page size and margins
\usepackage[a4paper,top=3cm,bottom=2cm,left=3cm,right=3cm,marginparwidth=1.75cm]{geometry}

%% Useful packages
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[colorinlistoftodos]{todonotes}
\usepackage[colorlinks=true, allcolors=blue]{hyperref}

\title{Direct unfolded density estimation}
\author{Kyle Cranmer}

\begin{document}
\maketitle

\begin{abstract}
We describe an approach to high-dimensional, unbinned unfolding problems, when the stochastic folding process is implicitly defined by a simulator.
\end{abstract}

\section{Introduction}

Consider a random variable $X \sim p_{X}$ that can be regarded as the   "folding" of  a latent variable  $Z \sim p_{Z}$ through some  stochastic process  described by $p(X|Z)$.  We can write the density for $X$ as
\begin{equation}\label{eq:px}
p_{X}(x) = \int dz \, p_{X|Z}(x|z)\, p_{Z}(z) \; .
\end{equation}

We assume that we have a simulation of the stochastic process $p(X|Z)$ that provides training pairs $\left \{ (x,z)_j \right\}_{j=1}^{M}$ that we can use to learn $\hat{p}_{X|Z}(x|z)$, our estimate $p_{X|Z}(x|z)$.

Given some observations $\left\{ x_i \right\}_{i=1}^{N}$, our goal is to estimate the "unfolded" distribution $p_{Z}$. This is an inverse problem, often referred to as "unfolding" in particle physics.  This inverse  problem is  \textit{ill posed}, and is typically regularized via  Tikhonov regularization. There is a connection to Tikhonov regularization and reproducing kernel Hilbert spaces (RKHS). Here we consider a similar setting. our focus is not on regularization, which can be seen as a penalty or prior on $\hat{p}_Z$, but instead  on recent methods for direct density estimation of the unfolded distribution.

\subsection{density estimation via a bijection}

Our starting point is to consider the idealized case where we observe $z$. We can estimate the density $p_Z$ with  techniques that use a bijection $f:Z\to V$ (e.g. an invertible flow or autoregressive model) and a tractable density $p_V(v)$.  In particular
\begin{equation}
p_{Z}(z) =  p_V(f_{\theta}(z))\, J_{z}
\end{equation}
where
\begin{equation}
\label{eq:jacJz}
J_{z} =  \left| \det \frac{\partial f_{\theta}(z)}{\partial {z}_T} \right|
\end{equation}
and $\theta$ are the internal network parameters for the bijection $f_\theta$. Learning proceeds via gradient ascent $\nabla_\theta \sum_i \log p_{Z}(z_i)$ with data $z_i$  (i.e. maximum likelihood wrt. the internal parameters $\theta$).

Of course, we don't estimate the latent variable $Z$, but we can still use this technique as described below.

\subsection{learning the folding process with a conditional bijection}

Similarly, we can estimate the stochastic folding process  with a conditional bijection $g_{z}:X\to U$, a tractable density $p_U(u)$, and training data from the simulator. In particular,
\begin{equation}
p_{X|Z}(x|z) =  p_{U}(g_{\phi;z}(x))\, J_{x|z} \;,
\end{equation}
where
\begin{equation}
J_{x|z} =  \left| \det \frac{\partial g_{\phi,z}({x})}{\partial {x}_T} \right|
\end{equation}
and $\phi$ are the internal network parameters for the bijection $g_{\phi; z}$. Learning of the stochastic folding process proceeds via gradient ascent $\nabla_\phi \sum_i \log p(x_j|z_j)$ with training data $(x,z)_j$.

\subsection{learning the unfolded density}

Once we have the estimate $\hat{p}_{X|Z}(x|z)$, with $\phi$ fixed, we can estimate $p_{Z}(z)$ from observations $\left\{ x_i \right\}_{i=1}^{N}$ using Eq.~\ref{eq:px}. In particular we can approximate the integral $\int dz p(z)$ by efficiently sampling $\left \{ v_k \right \}_{k=1}^{K}$ from $p_V$, which induces an efficient sampling of $z_k = f^{-1}(v_k)$.
In particular
\begin{equation}\label{eq:px}
p_{X}(x) = \int dz \, p_{X|Z}(x|z)\, p_{Z}(z) \approx \sum_{k=1}^K p_{U}(g_{\phi;z_k}(x))\, J_{x|z_k)} \, \, J_{z_k}\; .
\end{equation}
Learning proceeds via gradient ascent $\nabla_\theta \sum_i \log p(x_i)$ with data $x_i$  (i.e. maximum likelihood wrt. the internal parameters $\theta$). We envisage mini-batches of $\left \{ v_k \right \}_{k=1}^{K}$. Critically, $\nabla_\theta \sum_i \log p(x_i)$ includes a term $\nabla_\theta \sum_k \log J_{z_k}$, where $J_{z_k}$ depends on $\theta$ via Eq.~\ref{eq:jacJz}.

\subsection{Discussion}

The approach described above corresponds to a maximum likelihood estimate in the ill-posed inverse problem, thus there is still need for regularization for $p_Z{z}$. However, the approach described above works for un-binned data, and situations where the stochastic folding process $p_{X|Z}$ is implicitly defined by a simulator. Furthermore, $X$ and $Z$ may be high dimensional. Thus, this provides an in-roads to high-dimensional, unbinned unfolding using machine learning.

\bibliographystyle{alpha}
\bibliography{sample}

\end{document}