1. A method of detecting a reference sequence of events in a sample sequence of events, wherein each event is of a certain event type and holds a set of data attributes, the method comprising: (a) picking candidate combinations of events from said sample sequence so that the event types within each candidate combination match the event types in the reference sequence; (b) calculating an overall similarity score for each candidate combination from at least (i) an event occurrence score based on occurrence deviations representing a count of non-matching events between the events of a candidate combination matching events of the reference sequence, and (ii) an attribute match score based on similarity deviations between the data attributes of the events of a candidate combination and the data attributes of the matching events of the reference sequence; and (c) identifying the candidate combination with the best overall similarity score as reference sequence detected; wherein the events of the candidate combinations picked from the sample sequence are put as nodes into a tree graph, each candidate combination forming a branch of the tree graph consisting of nodes connected via edges; wherein occurrence deviations are attributed as weights to said edges and similarity deviations as weights to said nodes; and wherein the overall similarity score of each candidate combination is calculated as a total weight accumulated along the branch formed by each candidate combination.