text:
import {
  LocalizedStringBundleDef,
  LocalizedStringId,
} from '../../../../src/localized-strings';

/**
 * Localized string bundle used for pt-PT strings.
 * @const {!LocalizedStringBundleDef}
 */
export default /** @const {!LocalizedStringBundleDef} */ ({
  [LocalizedStringId.AMP_STORY_AUDIO_MUTE_BUTTON_TEXT]: {
    string: 'Som desativado',
  },
  [LocalizedStringId.AMP_STORY_AUDIO_UNMUTE_NO_SOUND_TEXT]: {
    string: 'Esta página não tem som.',
  },
  [LocalizedStringId.AMP_STORY_AUDIO_UNMUTE_SOUND_TEXT]: {
    string: 'Som ativado',
  },
  [LocalizedStringId.AMP_STORY_AUTO_ADS_BUTTON_LABEL_APPLY_NOW]: {
    string: 'Candidate-se agora',
  },
  [LocalizedStringId.AMP_STORY_AUTO_ADS_BUTTON_LABEL_BOOK_NOW]: {
    string: 'Reservar',
  },
  [LocalizedStringId.AMP_STORY_AUTO_ADS_BUTTON_LABEL_BUY_TICKETS]: {
    string: 'Comprar bilhetes',
  },
  [LocalizedStringId.AMP_STORY_AUTO_ADS_BUTTON_LABEL_DOWNLOAD]: {
    string: 'Transferir',
  },
  [LocalizedStringId.AMP_STORY_AUTO_ADS_BUTTON_LABEL_EXPLORE]: {
    string: 'Explorar',
  },
  [LocalizedStringId.AMP_STORY_AUTO_ADS_BUTTON_LABEL_GET_NOW]: {
    string: 'Obter agora',
  },
  [LocalizedStringId.AMP_STORY_AUTO_ADS_BUTTON_LABEL_INSTALL]: {
    string: 'Instalar agora',
  },
  [LocalizedStringId.AMP_STORY_AUTO_ADS_BUTTON_LABEL_LEARN_MORE]: {
    string: 'Saiba mais',
  },
  [LocalizedStringId.AMP_STORY_AUTO_ADS_BUTTON_LABEL_LISTEN]: {
    string: 'Ouvir',
  },
  [LocalizedStringId.AMP_STORY_AUTO_ADS_BUTTON_LABEL_MORE]: {
    string: 'Mais',
  },
  [LocalizedStringId.AMP_STORY_AUTO_ADS_BUTTON_LABEL_OPEN_APP]: {
    string: 'Abrir aplicação',
  },
  [LocalizedStringId.AMP_STORY_AUTO_ADS_BUTTON_LABEL_ORDER_NOW]: {
    string: 'Encomendar agora',
  },
  [LocalizedStringId.AMP_STORY_AUTO_ADS_BUTTON_LABEL_PLAY]: {
    string: 'Reproduzir',
  },
  [LocalizedStringId.AMP_STORY_AUTO_ADS_BUTTON_LABEL_READ]: {
    string: 'Ler',
  },
  [LocalizedStringId.AMP_STORY_AUTO_ADS_BUTTON_LABEL_SHOP]: {
    string: 'Comprar',
  },
  [LocalizedStringId.AMP_STORY_AUTO_ADS_BUTTON_LABEL_SHOW]: {
    string: 'Mostrar',
  },
  [LocalizedStringId.AMP_STORY_AUTO_ADS_BUTTON_LABEL_SHOWTIMES]: {
    string: 'Sessões',
  },
  [LocalizedStringId.AMP_STORY_AUTO_ADS_BUTTON_LABEL_SIGN_UP]: {
    string: 'Inscrever-se',
  },
  [LocalizedStringId.AMP_STORY_AUTO_ADS_BUTTON_LABEL_SUBSCRIBE]: {
    string: 'Subscrever agora',
  },
  [LocalizedStringId.AMP_STORY_AUTO_ADS_BUTTON_LABEL_USE_APP]: {
    string: 'Utilizar aplicação',
  },
  [LocalizedStringId.AMP_STORY_AUTO_ADS_BUTTON_LABEL_VIEW]: {
    string: 'Ver',
  },
  [LocalizedStringId.AMP_STORY_AUTO_ADS_BUTTON_LABEL_WATCH]: {
    string: 'Ver',
  },
  [LocalizedStringId.AMP_STORY_AUTO_ADS_BUTTON_LABEL_WATCH_EPISODE]: {
    string: 'Ver episódio',
  },
  [LocalizedStringId.AMP_STORY_BOOKEND_MORE_TO_READ_LABEL]: {
    string: 'Mais para ler',
  },
  [LocalizedStringId.AMP_STORY_BOOKEND_PRIVACY_SETTINGS_BUTTON_LABEL]: {
    string: 'Alterar as definições de privacidade dos dados',
  },
  [LocalizedStringId.AMP_STORY_BOOKEND_PRIVACY_SETTINGS_TITLE]: {
    string: 'Definições de privacidade',
  },
  [LocalizedStringId.AMP_STORY_CONSENT_ACCEPT_BUTTON_LABEL]: {
    string: 'Aceitar',
  },
  [LocalizedStringId.AMP_STORY_CONSENT_DECLINE_BUTTON_LABEL]: {
    string: 'Recusar',
  },
  [LocalizedStringId.AMP_STORY_CONTINUE_ANYWAY_BUTTON_LABEL]: {
    string: 'Continuar mesmo assim',
  },
  [LocalizedStringId.AMP_STORY_DOMAIN_DIALOG_HEADING_LABEL]: {
    string: 'Veja no domínio original:',
  },
  [LocalizedStringId.AMP_STORY_DOMAIN_DIALOG_HEADING_LINK]: {
    string: 'Mais acerca dos resultados AMP',
  },
  [LocalizedStringId.AMP_STORY_HINT_UI_NEXT_LABEL]: {
    string: 'Toque em Seguinte.',
  },
  [LocalizedStringId.AMP_STORY_HINT_UI_PREVIOUS_LABEL]: {
    string: 'Toque em Anterior',
  },
  [LocalizedStringId.AMP_STORY_PAGE_ATTACHMENT_OPEN_LABEL]: {
    string: 'Deslizar rapidamente para cima',
  },
  [LocalizedStringId.AMP_STORY_PAGE_PLAY_VIDEO]: {
    string: 'Reproduzir vídeo',
  },
  [LocalizedStringId.AMP_STORY_SHARING_CLIPBOARD_FAILURE_TEXT]: {
    string: 'Não foi possível copiar o link para a área de transferência :(',
  },
  [LocalizedStringId.AMP_STORY_SHARING_CLIPBOARD_SUCCESS_TEXT]: {
    string: 'Link copiado!',
  },
  [LocalizedStringId.AMP_STORY_SHARING_PROVIDER_NAME_EMAIL]: {
    string: 'Email',
  },
  [LocalizedStringId.AMP_STORY_SHARING_PROVIDER_NAME_FACEBOOK]: {
    string: 'Facebook',
  },
  [LocalizedStringId.AMP_STORY_SHARING_PROVIDER_NAME_GOOGLE_PLUS]: {
    string: 'Google+',
  },
  [LocalizedStringId.AMP_STORY_SHARING_PROVIDER_NAME_LINK]: {
    string: 'Obter link',
  },
  [LocalizedStringId.AMP_STORY_SHARING_PROVIDER_NAME_LINKEDIN]: {
    string: 'LinkedIn',
  },
  [LocalizedStringId.AMP_STORY_SHARING_PROVIDER_NAME_PINTEREST]: {
    string: 'Pinterest',
  },
  [LocalizedStringId.AMP_STORY_SHARING_PROVIDER_NAME_SMS]: {
    string: 'SMS',
  },
  [LocalizedStringId.AMP_STORY_SHARING_PROVIDER_NAME_TUMBLR]: {
    string: 'Tumblr',
  },
  [LocalizedStringId.AMP_STORY_SHARING_PROVIDER_NAME_TWITTER]: {
    string: 'Twitter',
  },
  [LocalizedStringId.AMP_STORY_SHARING_PROVIDER_NAME_WHATSAPP]: {
    string: 'WhatsApp',
  },
  [LocalizedStringId.AMP_STORY_TOOLTIP_EXPAND_TWEET]: {
    string: 'Expandir twit',
  },
  [LocalizedStringId.AMP_STORY_WARNING_DESKTOP_HEIGHT_SIZE_TEXT]: {
    string: 'Expanda a altura da janela para ver esta experiência.',
  },
  [LocalizedStringId.AMP_STORY_WARNING_DESKTOP_SIZE_TEXT]: {
    string: 'Expanda a altura e a largura da sua janela para ver esta ' +
        'experiência.',
  },
  [LocalizedStringId.AMP_STORY_WARNING_DESKTOP_WIDTH_SIZE_TEXT]: {
    string: 'Expanda a largura da janela para ver esta experiência.',
  },
  [LocalizedStringId.AMP_STORY_WARNING_EXPERIMENT_DISABLED_TEXT]: {
    string: 'Tem de ativar a experiência da história AMP para ver este ' +
        'conteúdo.',
  },
  [LocalizedStringId.AMP_STORY_WARNING_LANDSCAPE_ORIENTATION_TEXT]: {
    string: 'Conseguirá visualizar melhor esta página no modo retrato.',
  },
  [LocalizedStringId.AMP_STORY_WARNING_UNSUPPORTED_BROWSER_TEXT]: {
    string: 'Lamentamos, mas parece que o seu navegador não suporta esta ' +
        'experiência.',
  },
});


text:
package com.bbva.arq.devops.ae.mirrorgate.repository;

import com.bbva.arq.devops.ae.mirrorgate.dto.ApplicationDTO;
import com.bbva.arq.devops.ae.mirrorgate.dto.ApplicationReviewsDTO;
import java.util.List;

public interface ReviewRepositoryCustom {

    /**
     * Get information from the applications with a list of the last reviews.
     *
     * @param names A list with the name of the applications
     * @return A List of Application
     */
    List<ApplicationDTO> getAppInfoByAppNames(final List<String> names);

    /**
     * Get the last review for each application.
     *
     * @param names A list with the name of the applications
     * @return A List of ApplicationReviews objects with reviews data
     */
    List<ApplicationReviewsDTO> getLastReviewPerApplication(final List<String> names);

    /**
     * Get the average of star rating after the specified time of every application form a list of names.
     *
     * @param names A list with the name of the applications
     * @param timestamp Looking applications rating after timestamp
     * @return the rating average
     */
    List<ApplicationDTO> getAverageRateByAppNamesAfterTimestamp(final List<String> names, final Long timestamp);

}

redpajama_set_name: RedPajamaGithub


text:
package com.wodejia.myapp.controller.community;

import android.text.TextUtils;

import com.wodejia.myapp.app.AppController;
import com.wodejia.myapp.data.community.TipsAddDO;
import com.wodejia.myapp.data.community.TipsDO;
import com.wodejia.myapp.http.ApiService;
import com.wodejia.myapp.http.ApiUrl;
import com.wodejia.myapp.manager.manager.TipsDOManager;
import com.wodejia.myapp.ui.MainActivity;

import javax.inject.Inject;

import retrofit.GsonConverterFactory;
import retrofit.Retrofit;
import retrofit.RxJavaCallAdapterFactory;
import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

/**
 * Created by clarence on 16/9/29.
 */

public class TipsAddController extends AppController {
    @Inject
    TipsDOManager tipsDOManager;

    @Inject
    public TipsAddController() {

    }

    /**
     * 标题不能为空并且大于6个字符
     *
     * @param tipTitle
     * @return
     */
    public boolean checkTipTitle(String tipTitle){
        //TODO 临时的条件
        return !TextUtils.isEmpty(tipTitle)&&tipTitle.length()>=6;
    }

    /**
     * 内容不能为空并且大于6个字符
     *
     * @param tipContent
     * @return
     */
    public boolean checkTipContent(String tipContent){
        //TODO 临时的条件
        return !TextUtils.isEmpty(tipContent)&&tipContent.length()>=6;
    }
    /**
     * 发表帖子
     *
     * @param tipsAddRequestDO
     * @param subscriber
     */
    public void commitTip(TipsAddDO tipsAddRequestDO, Subscriber subscriber) {
        try {
            Retrofit retrofit = new Retrofit.Builder()
                    .baseUrl(ApiUrl.searchWeather)
                    .addConverterFactory(GsonConverterFactory.create())
                    .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
                    .build();

            ApiService apiService = retrofit.create(ApiService.class);
            apiService.getWeather("test")
                    .subscribeOn(Schedulers.io())
                    .observeOn(AndroidSchedulers.mainThread())
                    .subscribe(subscriber);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void saveMockData(TipsAddDO tipsAddRequestDO) {
        TipsDO tipsRequestDO=new TipsDO();
        tipsRequestDO.setBlockId(tipsAddRequestDO.getBlockId());
        tipsRequestDO.setUpdateTime("2016-10-8 10:00");
        tipsRequestDO.setProducterId(tipsAddRequestDO.getProducterId());
        tipsRequestDO.setTipTitle(tipsAddRequestDO.getTipTitle());
        tipsRequestDO.setTipContent(tipsAddRequestDO.getTipContent());
        tipsRequestDO.setProducterName(MainActivity.accountDO.getUserNickname());
        tipsRequestDO.setReplyNum(9);
        tipsDOManager.insert(tipsRequestDO);
    }
}


text:
import {Dtype} from "./dataConstants";

export const getPValue = function(dataType, results) {
        if (dataType === Dtype.DICHOTOMOUS) {
            return results.gof.p_value;
        } else {
            return results.tests.p_values[3];
        }
    },
    isFrequentist = function(priorClass) {
        return priorClass < 2;
    },
    priorClass = {
        frequentist_unrestricted: 0,
        frequentist_restricted: 1,
        bayesian: 2,
        custom: 3,
    },
    modelClasses = {
        frequentist: 0,
        bayesian: 1,
    },
    maIndex = 999,
    priorClassLabels = [
        {value: 0, label: "Frequentist Unrestricted"},
        {value: 1, label: "Frequentist Restricted"},
        {value: 2, label: "Bayesian"},
    ],
    priorTypeLabels = [
        {value: 0, label: "Uniform"},
        {value: 1, label: "Normal"},
        {value: 2, label: "Lognormal"},
    ];


text:
__author__ = 'mhan'

import graphlab as gl
gl.canvas.set_target('ipynb')

vertices = gl.SFrame.read_csv('http://s3.amazonaws.com/dato-datasets/bond/bond_vertices.csv')
edges = gl.SFrame.read_csv('http://s3.amazonaws.com/dato-datasets/bond/bond_edges.csv')

vertices.show()
edges.show()

g = gl.SGraph()

# add some vertices in a dataflow-ish way
g = g.add_vertices(vertices=vertices, vid_field='name')

# more dataflow
g = g.add_edges(edges=edges, src_field='src', dst_field='dst')

g.get_vertices()
g.get_edges()

# Get all the "friend" edges
g.get_edges(fields={'relation': 'friend'})

pr = gl.pagerank.create(g)
pr.get('pagerank').topk(column_name='pagerank')


text:
{-# LANGUAGE OverloadedStrings, TemplateHaskell #-}

module GHCJS.VDOM.Attribute ( Attribute
                            , Attributes
                              -- * some predefined attributes
                            , class_
                            , id
                            , href
                            , alt
                            , src
                            , name
                            , target
                            , value
                            , width
                            , height
                            , title
                            , lang
                            , type_
                            , key -- virtual-dom identifiers
                            ) where

import Prelude hiding (id)

import GHCJS.Types

import GHCJS.VDOM.Internal.Types
import GHCJS.VDOM.Internal

mkAttrs ''JSString [ "id", "href", "src", "alt", "title"
                   , "lang", "name", "target", "value"
                   ]

mkAttrs' ''JSString [ ("class_", "className")
                    , ("type_", "type")
                    ]

mkAttrs ''Int [ "key", "width", "height" ]


text:
from .base import AbstractObjStore

from oss.oss_api import OssAPI
from seafobj.exceptions import GetObjectError
import httplib

class OSSConf(object):
    def __init__(self, key_id, key, bucket_name, host):
        self.key_id = key_id
        self.key = key
        self.bucket_name = bucket_name
        self.host = host

class SeafOSSClient(object):
    '''Wraps a oss connection and a bucket'''
    def __init__(self, conf):
        self.conf = conf
        # Due to a bug in httplib we can't use https
        self.oss = OssAPI(conf.host, conf.key_id, conf.key)

    def read_object_content(self, obj_id):
        res = self.oss.get_object(self.conf.bucket_name, obj_id)
        if res.status != httplib.OK:
            raise GetObjectError("Failed to get object %s from bucket %s: %s %s" % (
                                 obj_id, self.conf.bucket_name, res.status, res.reason))
        return res.read()

class SeafObjStoreOSS(AbstractObjStore):
    '''OSS backend for seafile objecs'''
    def __init__(self, compressed, oss_conf, crypto=None):
        AbstractObjStore.__init__(self, compressed, crypto)
        self.oss_client = SeafOSSClient(oss_conf)

    def read_obj_raw(self, repo_id, version, obj_id):
        real_obj_id = '%s/%s' % (repo_id, obj_id)
        data = self.oss_client.read_object_content(real_obj_id)
        return data

    def get_name(self):
        return 'OSS storage backend'


text:
from lib.hachoir_metadata.metadata import (registerExtractor,
    Metadata, RootMetadata, MultipleMetadata)
from lib.hachoir_parser.audio import AuFile, MpegAudioFile, RealAudioFile, AiffFile, FlacParser
from lib.hachoir_parser.container import OggFile, RealMediaFile
from lib.hachoir_core.i18n import _
from lib.hachoir_core.tools import makePrintable, timedelta2seconds, humanBitRate
from datetime import timedelta
from lib.hachoir_metadata.metadata_item import QUALITY_FAST, QUALITY_NORMAL, QUALITY_BEST
from lib.hachoir_metadata.safe import fault_tolerant, getValue

def computeComprRate(meta, size):
    if not meta.has("duration") \
    or not meta.has("sample_rate") \
    or not meta.has("bits_per_sample") \
    or not meta.has("nb_channel") \
    or not size:
        return
    orig_size = timedelta2seconds(meta.get("duration")) * meta.get('sample_rate') * meta.get('bits_per_sample') * meta.get('nb_channel')
    meta.compr_rate = float(orig_size) / size

def computeBitRate(meta):
    if not meta.has("bits_per_sample") \
    or not meta.has("nb_channel") \
    or not meta.has("sample_rate"):
        return
    meta.bit_rate = meta.get('bits_per_sample') * meta.get('nb_channel') * meta.get('sample_rate')

VORBIS_KEY_TO_ATTR = {
    "ARTIST": "artist",
    "ALBUM": "album",
    "TRACKNUMBER": "track_number",
    "TRACKTOTAL": "track_total",
    "ENCODER": "producer",
    "TITLE": "title",
    "LOCATION": "location",
    "DATE": "creation_date",
    "ORGANIZATION": "organization",
    "GENRE": "music_genre",
    "": "comment",
    "COMPOSER": "music_composer",
    "DESCRIPTION": "comment",
    "COMMENT": "comment",
    "WWW": "url",
    "WOAF": "url",
    "LICENSE": "copyright",
}

@fault_tolerant
def readVorbisComment(metadata, comment):
    metadata.producer = getValue(comment, "vendor")
    for item in comment.array("metadata"):
        if "=" in item.value:
            key, value = item.value.split("=", 1)
            key = key.upper()
            if key in VORBIS_KEY_TO_ATTR:
                key = VORBIS_KEY_TO_ATTR[key]
                setattr(metadata, key, value)
            elif value:
                metadata.warning("Skip Vorbis comment %s: %s" % (key, value))

class OggMetadata(MultipleMetadata):
    def extract(self, ogg):
        granule_quotient = None
        for index, page in enumerate(ogg.array("page")):
            if "segments" not in page:
                continue
            page = page["segments"]
            if "vorbis_hdr" in page:
                meta = Metadata(self)
                self.vorbisHeader(page["vorbis_hdr"], meta)
                self.addGroup("audio[]", meta, "Audio")
                if not granule_quotient and meta.has("sample_rate"):
                    granule_quotient = meta.get('sample_rate')
            if "theora_hdr" in page:
                meta = Metadata(self)
                self.theoraHeader(page["theora_hdr"], meta)
                self.addGroup("video[]", meta, "Video")
            if "video_hdr" in page:
                meta = Metadata(self)
                self.videoHeader(page["video_hdr"], meta)
                self.addGroup("video[]", meta, "Video")
                if not granule_quotient and meta.has("frame_rate"):
                    granule_quotient = meta.get('frame_rate')
            if "comment" in page:
                readVorbisComment(self, page["comment"])
            if 3 <= index:
                # Only process pages 0..3
                break

        # Compute duration
        if granule_quotient and QUALITY_NORMAL <= self.quality:
            page = ogg.createLastPage()
            if page and "abs_granule_pos" in page:
                try:
                    self.duration = timedelta(seconds=float(page["abs_granule_pos"].value) / granule_quotient)
                except OverflowError:
                    pass

    def videoHeader(self, header, meta):
        meta.compression = header["fourcc"].display
        meta.width = header["width"].value
        meta.height = header["height"].value
        meta.bits_per_pixel = header["bits_per_sample"].value
        if header["time_unit"].value:
            meta.frame_rate = 10000000.0 / header["time_unit"].value

    def theoraHeader(self, header, meta):
        meta.compression = "Theora"
        meta.format_version = "Theora version %u.%u (revision %u)" % (\
            header["version_major"].value,
            header["version_minor"].value,
            header["version_revision"].value)
        meta.width = header["frame_width"].value
        meta.height = header["frame_height"].value
        if header["fps_den"].value:
            meta.frame_rate = float(header["fps_num"].value) / header["fps_den"].value
        if header["aspect_ratio_den"].value:
            meta.aspect_ratio = float(header["aspect_ratio_num"].value) / header["aspect_ratio_den"].value
        meta.pixel_format = header["pixel_format"].display
        meta.comment = "Quality: %s" % header["quality"].value

    def vorbisHeader(self, header, meta):
        meta.compression = u"Vorbis"
        meta.sample_rate = header["audio_sample_rate"].value
        meta.nb_channel = header["audio_channels"].value
        meta.format_version = u"Vorbis version %s" % header["vorbis_version"].value
        meta.bit_rate = header["bitrate_nominal"].value

class AuMetadata(RootMetadata):
    def extract(self, audio):
        self.sample_rate = audio["sample_rate"].value
        self.nb_channel = audio["channels"].value
        self.compression = audio["codec"].display
        if "info" in audio:
            self.comment = audio["info"].value
        self.bits_per_sample = audio.getBitsPerSample()
        computeBitRate(self)
        if "audio_data" in audio:
            if self.has("bit_rate"):
                self.duration = timedelta(seconds=float(audio["audio_data"].size) / self.get('bit_rate'))
            computeComprRate(self, audio["audio_data"].size)

class RealAudioMetadata(RootMetadata):
    FOURCC_TO_BITRATE = {
        u"28_8": 15200, # 28.8 kbit/sec (audio bit rate: 15.2 kbit/s)
        u"14_4": 8000,  # 14.4 kbit/sec
        u"lpcJ": 8000,  # 14.4 kbit/sec
    }

    def extract(self, real):
        version = real["version"].value
        if "metadata" in real:
            self.useMetadata(real["metadata"])
        self.useRoot(real)
        self.format_version = "Real audio version %s" % version
        if version == 3:
            size = getValue(real, "data_size")
        elif "filesize" in real and "headersize" in real:
            size = (real["filesize"].value + 40) - (real["headersize"].value + 16)
        else:
            size = None
        if size:
            size *= 8
            if self.has("bit_rate"):
                sec = float(size) / self.get('bit_rate')
                self.duration = timedelta(seconds=sec)
            computeComprRate(self, size)

    @fault_tolerant
    def useMetadata(self, info):
        self.title = info["title"].value
        self.author = info["author"].value
        self.copyright = info["copyright"].value
        self.comment = info["comment"].value

    @fault_tolerant
    def useRoot(self, real):
        self.bits_per_sample = 16   # FIXME: Is that correct?
        if real["version"].value != 3:
            self.sample_rate = real["sample_rate"].value
            self.nb_channel = real["channels"].value
        else:
            self.sample_rate = 8000
            self.nb_channel = 1
        fourcc = getValue(real, "FourCC")
        if fourcc:
            self.compression = fourcc
            try:
                self.bit_rate = self.FOURCC_TO_BITRATE[fourcc]
            except LookupError:
                pass

class RealMediaMetadata(MultipleMetadata):
    KEY_TO_ATTR = {
        "generated by": "producer",
        "creation date": "creation_date",
        "modification date": "last_modification",
        "description": "comment",
    }

    def extract(self, media):
        if "file_prop" in media:
            self.useFileProp(media["file_prop"])
        if "content_desc" in media:
            self.useContentDesc(media["content_desc"])
        for index, stream in enumerate(media.array("stream_prop")):
            self.useStreamProp(stream, index)

    @fault_tolerant
    def useFileInfoProp(self, prop):
        key = prop["name"].value.lower()
        value = prop["value"].value
        if key in self.KEY_TO_ATTR:
            setattr(self, self.KEY_TO_ATTR[key], value)
        elif value:
            self.warning("Skip %s: %s" % (prop["name"].value, value))

    @fault_tolerant
    def useFileProp(self, prop):
        self.bit_rate = prop["avg_bit_rate"].value
        self.duration = timedelta(milliseconds=prop["duration"].value)

    @fault_tolerant
    def useContentDesc(self, content):
        self.title = content["title"].value
        self.author = content["author"].value
        self.copyright = content["copyright"].value
        self.comment = content["comment"].value

    @fault_tolerant
    def useStreamProp(self, stream, index):
        meta = Metadata(self)
        meta.comment = "Start: %s" % stream["stream_start"].value
        if getValue(stream, "mime_type") == "logical-fileinfo":
            for prop in stream.array("file_info/prop"):
                self.useFileInfoProp(prop)
        else:
            meta.bit_rate = stream["avg_bit_rate"].value
            meta.duration = timedelta(milliseconds=stream["duration"].value)
            meta.mime_type = getValue(stream, "mime_type")
        meta.title = getValue(stream, "desc")
        self.addGroup("stream[%u]" % index, meta, "Stream #%u" % (1+index))

class MpegAudioMetadata(RootMetadata):
    TAG_TO_KEY = {
        # ID3 version 2.2
        "TP1": "author",
        "COM": "comment",
        "TEN": "producer",
        "TRK": "track_number",
        "TAL": "album",
        "TT2": "title",
        "TYE": "creation_date",
        "TCO": "music_genre",

        # ID3 version 2.3+
        "TPE1": "author",
        "COMM": "comment",
        "TENC": "producer",
        "TRCK": "track_number",
        "TALB": "album",
        "TIT2": "title",
        "TYER": "creation_date",
        "WXXX": "url",
        "TCON": "music_genre",
        "TLAN": "language",
        "TCOP": "copyright",
        "TDAT": "creation_date",
        "TRDA": "creation_date",
        "TORY": "creation_date",
        "TIT1": "title",
    }

    def processID3v2(self, field):
        # Read value
        if "content" not in field:
            return
        content = field["content"]
        if "text" not in content:
            return
        if "title" in content and content["title"].value:
            value = "%s: %s" % (content["title"].value, content["text"].value)
        else:
            value = content["text"].value

        # Known tag?
        tag = field["tag"].value
        if tag not in self.TAG_TO_KEY:
            if tag:
                if isinstance(tag, str):
                    tag = makePrintable(tag, "ISO-8859-1", to_unicode=True)
                self.warning("Skip ID3v2 tag %s: %s" % (tag, value))
            return
        key = self.TAG_TO_KEY[tag]
        setattr(self, key, value)

    def readID3v2(self, id3):
        for field in id3:
            if field.is_field_set and "tag" in field:
                self.processID3v2(field)

    def extract(self, mp3):
        if "/frames/frame[0]" in mp3:
            frame = mp3["/frames/frame[0]"]
            self.nb_channel = (frame.getNbChannel(), frame["channel_mode"].display)
            self.format_version = u"MPEG version %s layer %s" % \
                (frame["version"].display, frame["layer"].display)
            self.sample_rate = frame.getSampleRate()
            self.bits_per_sample = 16
            if mp3["frames"].looksConstantBitRate():
                self.computeBitrate(frame)
            else:
                self.computeVariableBitrate(mp3)
        if "id3v1" in mp3:
            id3 = mp3["id3v1"]
            self.comment = id3["comment"].value
            self.author = id3["author"].value
            self.title = id3["song"].value
            self.album = id3["album"].value
            if id3["year"].value != "0":
                self.creation_date = id3["year"].value
            if "track_nb" in id3:
                self.track_number = id3["track_nb"].value
        if "id3v2" in mp3:
            self.readID3v2(mp3["id3v2"])
        if "frames" in mp3:
            computeComprRate(self, mp3["frames"].size)

    def computeBitrate(self, frame):
        bit_rate = frame.getBitRate() # may returns None on error
        if not bit_rate:
            return
        self.bit_rate = (bit_rate, _("%s (constant)") % humanBitRate(bit_rate))
        self.duration = timedelta(seconds=float(frame["/frames"].size) / bit_rate)

    def computeVariableBitrate(self, mp3):
        if self.quality <= QUALITY_FAST:
            return
        count = 0
        if QUALITY_BEST <= self.quality:
            self.warning("Process all MPEG audio frames to compute exact duration")
            max_count = None
        else:
            max_count = 500 * self.quality
        total_bit_rate = 0.0
        for index, frame in enumerate(mp3.array("frames/frame")):
            if index < 3:
                continue
            bit_rate = frame.getBitRate()
            if bit_rate:
                total_bit_rate += float(bit_rate)
                count += 1
                if max_count and max_count <= count:
                    break
        if not count:
            return
        bit_rate = total_bit_rate / count
        self.bit_rate = (bit_rate,
            _("%s (Variable bit rate)") % humanBitRate(bit_rate))
        duration = timedelta(seconds=float(mp3["frames"].size) / bit_rate)
        self.duration = duration

class AiffMetadata(RootMetadata):
    def extract(self, aiff):
        if "common" in aiff:
            self.useCommon(aiff["common"])
        computeBitRate(self)

    @fault_tolerant
    def useCommon(self, info):
        self.nb_channel = info["nb_channel"].value
        self.bits_per_sample = info["sample_size"].value
        self.sample_rate = getValue(info, "sample_rate")
        if self.has("sample_rate"):
            rate = self.get("sample_rate")
            if rate:
                sec = float(info["nb_sample"].value) / rate
                self.duration = timedelta(seconds=sec)
        if "codec" in info:
            self.compression = info["codec"].display

class FlacMetadata(RootMetadata):
    def extract(self, flac):
        if "metadata/stream_info/content" in flac:
            self.useStreamInfo(flac["metadata/stream_info/content"])
        if "metadata/comment/content" in flac:
            readVorbisComment(self, flac["metadata/comment/content"])

    @fault_tolerant
    def useStreamInfo(self, info):
        self.nb_channel = info["nb_channel"].value + 1
        self.bits_per_sample = info["bits_per_sample"].value + 1
        self.sample_rate = info["sample_hertz"].value
        sec = info["total_samples"].value
        if sec:
            sec = float(sec) / info["sample_hertz"].value
            self.duration = timedelta(seconds=sec)

registerExtractor(AuFile, AuMetadata)
registerExtractor(MpegAudioFile, MpegAudioMetadata)
registerExtractor(OggFile, OggMetadata)
registerExtractor(RealMediaFile, RealMediaMetadata)
registerExtractor(RealAudioFile, RealAudioMetadata)
registerExtractor(AiffFile, AiffMetadata)
registerExtractor(FlacParser, FlacMetadata)


text:
layout: docs
slug: guides
title: Getting Started with systemd
category: launching_containers
sub_category: launching
weight: 5
---

# Getting Started with systemd

systemd is an init system that provides many powerful features for starting, stopping and managing processes. Within the CoreOS world, you will almost exclusively use systemd to manage the lifecycle of your Docker containers.

## Terminology

systemd consists of two main concepts: a unit and a target. A unit is a configuration file that describes the properties of the process that you'd like to run. This is normally a `docker run` command or something similar. A target is a grouping mechanism that allows systemd to start up groups of processes at the same time. This happens at every boot as processes are started at different run levels.

systemd is the first process started on CoreOS and it reads different targets and starts the processes specified which allows the operating system to start. The target that you'll interact with is the `multi-user.target` which holds all of the general use unit files for our containers.

Each target is actually a collection of symlinks to our unit files. This is specified in the unit file by `WantedBy=multi-user.target`. Running `systemctl enable foo.service` creates symlinks to the unit inside `multi-user.target.wants`.

## Unit File

On CoreOS, unit files are located within the R/W filesystem at `/etc/systemd/system`. Let's create a simple unit named `hello.service`:

```ini
[Unit]
Description=MyApp
After=docker.service
Requires=docker.service

[Service]
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker kill busybox1
ExecStartPre=-/usr/bin/docker rm busybox1
ExecStartPre=/usr/bin/docker pull busybox
ExecStart=/usr/bin/docker run --name busybox1 busybox /bin/sh -c "while true; do echo Hello World; sleep 1; done"

[Install]
WantedBy=multi-user.target
```

The `Description` shows up in the systemd log and a few other places. Write something that will help you understand exactly what this does later on.

`After=docker.service` and `Requires=docker.service` means this unit will only start after `docker.service` is active. You can define as many of these as you want.

`ExecStart=` allows you to specify any command that you'd like to run when this unit is started. The pid assigned to this process is what systemd will monitor to determine whether the process has crashed or not. Do not run docker containers with `-d` as this will prevent the container from starting as a child of this pid. systemd will think the process has exited and the unit will be stopped.

`WantedBy=` is the target that this unit is a part of.

To start a new unit, we need to tell systemd to create the symlink and then start the file:

```sh
$ sudo systemctl enable /etc/systemd/system/hello.service
$ sudo systemctl start hello.service
```

To verify the unit started, you can see the list of containers running with `docker ps` and read the unit's output with `journalctl`:

```sh
$ journalctl -f -u hello.service
-- Logs begin at Fri 2014-02-07 00:05:55 UTC. --
Feb 11 17:46:26 localhost docker[23470]: Hello World
Feb 11 17:46:27 localhost docker[23470]: Hello World
Feb 11 17:46:28 localhost docker[23470]: Hello World
...
```

Overview of systemctl
Reading the System Log

## Advanced Unit Files

systemd provides a high degree of functionality in your unit files. Here's a curated list of useful features listed in the order they'll occur in the lifecycle of a unit:

| Name    | Description |
|---------|-------------|
| ExecStartPre | Commands that will run before `ExecStart`. |
| ExecStart | Main commands to run for this unit. |
| ExecStartPost | Commands that will run after all `ExecStart` commands have completed. |
| ExecReload | Commands that will run when this unit is reloaded via `systemctl reload foo.service` |
| ExecStop | Commands that will run when this unit is considered failed or if it is stopped via `systemctl stop foo.service` |
| ExecStopPost | Commands that will run after `ExecStop` has completed. |
| RestartSec | The amount of time to sleep before restarting a service. Useful to prevent your failed service from attempting to restart itself every 100ms. |

The full list is located on the [systemd man page](http://www.freedesktop.org/software/systemd/man/systemd.service.html).

Let's put a few of these concepts together to register new units within etcd. Imagine we had another container running that would read these values from etcd and act upon them.

We can use `ExecStartPre` to scrub existing container state. The `docker kill` will force any previous copy of this container to stop, which is useful if we restarted the unit but docker didn't stop the container for some reason. The `=-` is systemd syntax to ignore errors for this command. We need to do this because docker will return a non-zero exit code if we try to stop a container that doesn't exist. We don't consider this an error (because we want the container stopped) so we tell systemd to ignore the possible failure.

`docker rm` will remove the container and `docker pull` will pull down the latest version. You can optionally pull down a specific version as a docker tag: `coreos/apache:1.2.3`

`ExecStart` is where the container is started from the container image that we pulled above.

Since our container will be started in `ExecStart`, it makes sense for our etcd command to run as `ExecStartPost` to ensure that our container is started and functioning.

When the service is told to stop, we need to stop the docker container using its `--name` from the run command. We also need to clean up our etcd key when the container exits or the unit is failed by using `ExecStopPost`.

```ini
[Unit]
Description=My Advanced Service
After=etcd.service
After=docker.service

[Service]
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker kill apache1
ExecStartPre=-/usr/bin/docker rm apache1
ExecStartPre=/usr/bin/docker pull coreos/apache
ExecStart=/usr/bin/docker run --name apache1 -p 8081:80 coreos/apache /usr/sbin/apache2ctl -D FOREGROUND
ExecStartPost=/usr/bin/etcdctl set /domains/example.com/10.10.10.123:8081 running
ExecStop=/usr/bin/docker stop apache1
ExecStopPost=/usr/bin/etcdctl rm /domains/example.com/10.10.10.123:8081

[Install]
WantedBy=multi-user.target
```

While it's possible to manage the starting, stopping, and removal of the container in a single `ExecStart` command by using `docker run --rm`, it's a good idea to separate the container's lifecycle into `ExecStartPre`, `ExecStart`, and `ExecStop` options as we've done above. This gives you a chance to inspect the container's state after it stops or fails.

## Unit Specifiers

In our last example we had to hardcode our IP address when we announced our container in etcd. That's not scalable and systemd has a few variables built in to help us out. Here's a few of the most useful:

| Variable | Meaning | Description |
|----------|---------|-------------|
| `%n` | Full unit name | Useful if the name of your unit is unique enough to be used as an argument on a command. |
| `%m` | Machine ID | Useful for namespacing etcd keys by machine. Example: `/machines/%m/units` |
| `%b` | BootID | Similar to the machine ID, but this value is random and changes on each boot |
| `%H` | Hostname | Allows you to run the same unit file across many machines. Useful for service discovery. Example: `/domains/example.com/%H:8081` |

A full list of specifiers can be found on the [systemd man page](http://www.freedesktop.org/software/systemd/man/systemd.unit.html#Specifiers).

## Instantiated Units

Since systemd is based on symlinks, there are a few interesting tricks you can leverage that are very powerful when used with containers. If you create multiple symlinks to the same unit file, the following variables become available to you:

| Variable | Meaning | Description |
|----------|---------|-------------|
| `%p` | Prefix name | Refers to any string before `@` in your unit name. |
| `%i` | Instance name | Refers to the string between the `@` and the suffix. |

In our earlier example we had to hardcode our IP address when registering within etcd:

```ini
ExecStartPost=/usr/bin/etcdctl set /domains/example.com/10.10.10.123:8081 running
```

We can enhance this by using `%H` and `%i` to dynamically announce the hostname and port. Specify the port after the `@` by using two unit files named `foo@123.service` and `foo@456.service`:

```ini
ExecStartPost=/usr/bin/etcdctl set /domains/example.com/%H:%i running
```

This gives us the flexiblity to use a single unit file to announce multiple copies of the same container on a single machine (no port overlap) and on multiple machines (no hostname overlap).

#### More Information
systemd.service Docs
systemd.unit Docs
systemd.target Docs


text:
namespace Swan.Logging;

using Platform;

/// <summary>
/// Represents a Console implementation of <c>ILogger</c>.
/// </summary>
/// <seealso cref="ILogger" />
public class ConsoleLogger : TextLogger, ILogger
{
    /// <summary>
    /// Initializes a new instance of the <see cref="ConsoleLogger"/> class.
    /// </summary>
    protected ConsoleLogger()
    {
        // Empty
    }

    /// <summary>
    /// Gets the current instance of ConsoleLogger.
    /// </summary>
    /// <value>
    /// The instance.
    /// </value>
    public static ConsoleLogger Instance { get; } = new();

    /// <summary>
    /// Gets or sets the debug logging prefix.
    /// </summary>
    /// <value>
    /// The debug prefix.
    /// </value>
    public static string DebugPrefix { get; set; } = "DBG";

    /// <summary>
    /// Gets or sets the trace logging prefix.
    /// </summary>
    /// <value>
    /// The trace prefix.
    /// </value>
    public static string TracePrefix { get; set; } = "TRC";

    /// <summary>
    /// Gets or sets the warning logging prefix.
    /// </summary>
    /// <value>
    /// The warn prefix.
    /// </value>
    public static string WarnPrefix { get; set; } = "WRN";

    /// <summary>
    /// Gets or sets the fatal logging prefix.
    /// </summary>
    /// <value>
    /// The fatal prefix.
    /// </value>
    public static string FatalPrefix { get; set; } = "FAT";

    /// <summary>
    /// Gets or sets the error logging prefix.
    /// </summary>
    /// <value>
    /// The error prefix.
    /// </value>
    public static string ErrorPrefix { get; set; } = "ERR";

    /// <summary>
    /// Gets or sets the information logging prefix.
    /// </summary>
    /// <value>
    /// The information prefix.
    /// </value>
    public static string InfoPrefix { get; set; } = "INF";

    /// <summary>
    /// Gets or sets the color of the information output logging.
    /// </summary>
    /// <value>
    /// The color of the information.
    /// </value>
    public static ConsoleColor InfoColor { get; set; } = ConsoleColor.Cyan;

    /// <summary>
    /// Gets or sets the color of the debug output logging.
    /// </summary>
    /// <value>
    /// The color of the debug.
    /// </value>
    public static ConsoleColor DebugColor { get; set; } = ConsoleColor.Gray;

    /// <summary>
    /// Gets or sets the color of the trace output logging.
    /// </summary>
    /// <value>
    /// The color of the trace.
    /// </value>
    public static ConsoleColor TraceColor { get; set; } = ConsoleColor.DarkGray;

    /// <summary>
    /// Gets or sets the color of the warning logging.
    /// </summary>
    /// <value>
    /// The color of the warn.
    /// </value>
    public static ConsoleColor WarnColor { get; set; } = ConsoleColor.Yellow;

    /// <summary>
    /// Gets or sets the color of the error logging.
    /// </summary>
    /// <value>
    /// The color of the error.
    /// </value>
    public static ConsoleColor ErrorColor { get; set; } = ConsoleColor.DarkRed;

    /// <summary>
    /// Gets or sets the color of the error logging.
    /// </summary>
    /// <value>
    /// The color of the error.
    /// </value>
    public static ConsoleColor FatalColor { get; set; } = ConsoleColor.Red;

    /// <inheritdoc />
    public LogLevel LogLevel { get; set; } = DebugLogger.IsDebuggerAttached ? LogLevel.Trace : LogLevel.Info;

    /// <inheritdoc />
    public void Log(LogMessageReceivedEventArgs logEvent)
    {
        // Select the writer based on the message type
        var writer = logEvent.MessageType == LogLevel.Error
            ? TerminalWriterFlags.StandardError
            : TerminalWriterFlags.StandardOutput;

        var (outputMessage, color) = GetOutputAndColor(logEvent);

        Terminal.Write(outputMessage, color, writer);
    }

    /// <inheritdoc />
    public void Dispose()
    {
        // Do nothing
    }
}


text:
/*
 * Based on comments by @runanet and @coomsie
 * https://github.com/CloudMade/Leaflet/issues/386
 *
 * Wrapping function is needed to preserve L.Marker.update function
 */
(function () {
	var _old__setPos = L.Marker.prototype._setPos;
	L.Marker.include({
		_updateImg: function(i, a, s) {
			a = L.point(s).divideBy(2)._subtract(L.point(a));
			var transform = '';
		    //console.log("a.x: " + a.x + "a.y: " + a.y);
			transform += ' translate(' + -4 + 'px, ' + a.y + 'px)';
			transform += ' rotate(' + this.options.iconAngle + 'deg)';
			transform += ' translate(' + 4 + 'px, ' + -a.y + 'px)';
			i.style[L.DomUtil.TRANSFORM] += transform;
		},

		setIconAngle: function (iconAngle) {
			this.options.iconAngle = iconAngle;
			if (this._map)
				this.update();
		},

		_setPos: function (pos) {
			if (this._icon)
				this._icon.style[L.DomUtil.TRANSFORM] = '';
			if (this._shadow)
				this._shadow.style[L.DomUtil.TRANSFORM] = '';

			_old__setPos.apply(this,[pos]);

			if (this.options.iconAngle) {
				var defaultIcon = new L.Icon.Default;
				var a = this.options.icon.options.iconAnchor || defaultIcon.options.iconAnchor;
				var s = this.options.icon.options.iconSize || defaultIcon.options.iconSize;
				var i;
				if (this._icon) {
					i = this._icon;
					this._updateImg(i, a, s);
				}
				if (this._shadow) {
					if (this.options.icon.options.shadowAnchor)
						a = this.options.icon.options.shadowAnchor;
					s = this.options.icon.options.shadowSize;
					i = this._shadow;
					this._updateImg(i, a, s);
				}
			}
		}
	});
}());


text:
<?php

namespace Oro\Bundle\ApiBundle\Tests\Unit\Processor;

use Oro\Bundle\ApiBundle\Processor\ApiContext;

class ApiContextStub extends ApiContext
{
}


text:
package name.prokop.bart.fps.datamodel;

import name.prokop.bart.fps.util.BPMath;

/**
 *
 * @author Bart
 */
public class SaleLine {

    public SaleLine() {
    }

    /**
     * Creates a new instance of SlipLine na podstawie podanych parametrów
     *
     * @param name Nazwa towaru
     * @param amount Ilość towaru
     * @param price Cena towaru
     * @param taxRate Stawka VAT na dany towar
     */
    public SaleLine(String name, double amount, double price, VATRate taxRate) {
        this.name = name;
        this.amount = amount;
        this.price = price;
        this.taxRate = taxRate;
    }

    public SaleLine(String name, double amount, double price, VATRate taxRate, DiscountType discountType, double discount) {
        this.name = name;
        this.amount = amount;
        this.price = price;
        this.taxRate = taxRate;
        this.discountType = discountType;
        this.discount = discount;
    }

    /**
     * Zwraca wartość brutto danej pozycji paragonu (PRZED RABATEM)
     *
     * @return Wartość brutto danej pozycji paragonu
     */
    public double getGross() {
        return BPMath.roundCurrency(amount * price);
    }

    public double getTax() {
        double r = getTotal();
        r /= 1 + taxRate.getVatRate();
        r *= taxRate.getVatRate();
        return BPMath.roundCurrency(r);
    }

    /**
     * Zwraca wartość brutto danej pozycji paragonu (PO RABACIE)
     *
     * @return Wartość brutto danej pozycji paragonu
     */
    public double getTotal() {
        double retVal = amount * price;
        switch (discountType) {
            case AmountDiscount:
                retVal -= discount;
                break;
            case RateDiscount:
                retVal = retVal - retVal * discount;
                break;
            case AmountExtra:
                retVal += discount;
                break;
            case RateExtra:
                break;
        }
        return BPMath.roundCurrency(retVal);
    }
    private String name;
    private double amount;
    private double price;
    private VATRate taxRate;
    private DiscountType discountType = DiscountType.NoDiscount;
    private double discount = 0.0;

    @Override
    public String toString() {
        return ": " + getName() + " A:" + getAmount() + " P:" + getPrice() + " T:" + getTaxRate().name() + " G:" + getGross() + " DT:" + getDiscountType().ordinal() + " D:" + getDiscount() + " T:" + getTotal();
    }

    public double getAmount() {
        return amount;
    }

    public void setAmount(double amount) {
        this.amount = amount;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        if (name != null) {
            name = name.trim();
        }
        this.name = name;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public VATRate getTaxRate() {
        return taxRate;
    }

    public void setTaxRate(VATRate taxRate) {
        this.taxRate = taxRate;
    }

    public double getDiscount() {
        return discount;
    }

    public void setDiscount(double discount) {
        this.discount = discount;
    }

    public DiscountType getDiscountType() {
        return discountType;
    }

    public void setDiscountType(DiscountType discountType) {
        this.discountType = discountType;
    }
}


text:
void AddFMDTask();

//__________________________________________________________________________________________
AliAnalysisTask *AddTask_iarsene_dst(Int_t reducedEventType=-1, Bool_t writeTree=kTRUE, TString prod="LHC10h"){
  //get the current analysis manager
  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
  if (!mgr) {
    Error("AddTask_iarsene_dst", "No analysis manager found.");
    return 0;
  }

  //Do we have an MC handler?
  Bool_t hasMC=(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()!=0x0);
  Bool_t isAOD=mgr->GetInputEventHandler()->IsA()==AliAODInputHandler::Class();

  Int_t collSystem = 0;
  if(!prod.CompareTo("LHC10h")) collSystem = 1;    // minimum bias Pb-Pb
  if(!prod.CompareTo("LHC11h")) collSystem = 2;    // centrality triggered Pb-Pb
  if(!prod.CompareTo("LHC15o")) collSystem = 3;    // minimum bias Pb-Pb
  if(!prod.CompareTo("LHC10b") || !prod.CompareTo("LHC10c") || !prod.CompareTo("LHC10d") ||
     !prod.CompareTo("LHC10e") || !prod.CompareTo("LHC10f")) collSystem = 4;   // minimum bias pp
  if(!prod.CompareTo("LHC13b") || !prod.CompareTo("LHC13c")) collSystem = 5;   // minimum bias p-Pb
  if(!prod.CompareTo("LHC16l")) collSystem = 6;    // minimum bias pp and Pb-Pb
  if(!prod.CompareTo("LHC16q") || !prod.CompareTo("LHC16r") || !prod.CompareTo("LHC16s") || !prod.CompareTo("LHC16t")) collSystem = 7;    // triggered p-Pb (2016 data)
  if(!prod.CompareTo("LHC17n")) collSystem = 8;
  if(!prod.CompareTo("LHC15n") || !prod.CompareTo("LHC17p") || !prod.CompareTo("LHC17q")) collSystem = 9;
  if(!prod.CompareTo("LHC17k") || !prod.CompareTo("LHC17o") || !prod.CompareTo("LHC18c")) collSystem = 10;

  if(!collSystem && !hasMC) {
     collSystem = 1;
     printf("WARNING: In AddTask_iarsene_dst(), no proper production name specified, or not supported! \n");
     printf("                 Using collSystem=1 (min bias 2010 Pb-Pb) as default \n");
  }

  //create task and add it to the manager
  AliAnalysisTaskReducedTreeMaker *task=new AliAnalysisTaskReducedTreeMaker("DSTTreeMaker", kTRUE);
  if(collSystem==1) task->SetTriggerMask(AliVEvent::kMB);
  if(collSystem==2)
    task->SetTriggerMask(AliVEvent::kMB | AliVEvent::kCentral | AliVEvent::kSemiCentral);
  if(collSystem==3) task->SetTriggerMask(AliVEvent::kINT7);
  if(collSystem==4) task->SetTriggerMask(AliVEvent::kMB);
  if(collSystem==5) task->SetTriggerMask(AliVEvent::kINT7);
  if(collSystem==6) task->SetTriggerMask(AliVEvent::kMB | AliVEvent::kINT7 | AliVEvent::kHighMultSPD | AliVEvent::kHighMultV0);
  if(collSystem==7) task->SetTriggerMask(AliVEvent::kINT7 | AliVEvent::kTRD);
  if(collSystem==10) task->SetTriggerMask(AliVEvent::kINT7 | AliVEvent::kTRD | AliVEvent::kHighMultV0 | AliVEvent::kEMCEJE | AliVEvent::kEMCEGA);
  //if(collSystem==10) task->SetTriggerMask(AliVEvent::kINT7);
  if(collSystem==8) task->SetTriggerMask(AliVEvent::kINT7);
  if(collSystem==9) task->SetTriggerMask(AliVEvent::kINT7);
  if(collSystem==0) task->SetTriggerMask(AliVEvent::kINT7);

  //if(collSystem==4)
  //task->SetRejectPileup();

  task->UsePhysicsSelection(kTRUE);
  task->SetUseAnalysisUtils(kTRUE);

  task->SetFillV0Info(kFALSE);
  task->SetFillGammaConversions(kFALSE);
  task->SetFillK0s(kFALSE);
  task->SetFillLambda(kFALSE);
  task->SetFillALambda(kFALSE);
  task->SetFillCaloClusterInfo(kFALSE);
  //task->SetFillDielectronInfo(kFALSE);
  //task->SetFillFriendInfo(kFALSE);

  task->SetEventFilter(CreateEventFilter(isAOD));
  //task->SetTrackFilter(CreateGlobalTrackFilter(isAOD));
  CreateTrackFilters(task, isAOD);

  //  task->SetFlowTrackFilter(CreateFlowTrackFilter(isAOD));
  //task->SetK0sPionCuts(CreateK0sPionCuts(isAOD));
  //task->SetLambdaProtonCuts(CreateLambdaProtonCuts(isAOD));
  //task->SetLambdaPionCuts(CreateLambdaPionCuts(isAOD));
  task->SetGammaElectronCuts(CreateGammaConvElectronCuts(isAOD));
  //task->SetK0sMassRange(0.44,0.55);
  //task->SetLambdaMassRange(1.090,1.14);
  task->SetGammaConvMassRange(0.0,0.1);
  task->SetV0OpenCuts(CreateV0OpenCuts(AliESDv0KineCuts::kPurity, AliESDv0KineCuts::kPbPb));
  task->SetV0StrongCuts(CreateV0StrongCuts(AliESDv0KineCuts::kPurity, AliESDv0KineCuts::kPbPb));
  //task->SetFillFMDInfo(); AddFMDTask();
  if(hasMC) {
     task->SetFillMCInfo(kTRUE);
     AddMCSignals(task);
  }
  //task->SetFillEventPlaneInfo(kTRUE);

  //task->SetTreeWritingOption(AliAnalysisTaskReducedTreeMaker::kFullEventsWithFullTracks);
  //task->SetTreeWritingOption(AliAnalysisTaskReducedTreeMaker::kBaseEventsWithBaseTracks);
  if(reducedEventType!=-1)
    task->SetTreeWritingOption(reducedEventType);
  task->SetWriteTree(writeTree);
  //if(!hasMC)
   //task->SetEventWritingRequirement(2,0,0.005);
  //task->SetWriteEventsWithNoSelectedTracks(kFALSE, 0.05, 2);
  //task->SetWriteEventsWithNoSelectedTracksAndNoSelectedAssociatedTracks(kFALSE);

  SetInactiveBranches(task);

  mgr->AddTask(task);

  AliAnalysisDataContainer *cReducedTree = 0x0;
  AliAnalysisDataContainer *cEventStatsInfo = 0x0;
  AliAnalysisDataContainer *cTrackStatsInfo = 0x0;
  AliAnalysisDataContainer *cMCStatsInfo = 0x0;
  if(task->WriteTree()) {
    cReducedTree = mgr->CreateContainer("dstTree", TTree::Class(),
                                          AliAnalysisManager::kOutputContainer, "dstTree.root");
    cEventStatsInfo = mgr->CreateContainer("EventStats", TH2I::Class(),
       AliAnalysisManager::kOutputContainer, "dstTree.root");
    cTrackStatsInfo = mgr->CreateContainer("TrackStats", TH2I::Class(),
                                           AliAnalysisManager::kOutputContainer, "dstTree.root");
    cMCStatsInfo = mgr->CreateContainer("MCStats", TH2I::Class(),
                                           AliAnalysisManager::kOutputContainer, "dstTree.root");
  }

  AliAnalysisDataContainer *cReducedEvent =
  mgr->CreateContainer("ReducedEventDQ",
                         AliReducedBaseEvent::Class(),
                         AliAnalysisManager::kExchangeContainer,
                         "reducedEvent");

  mgr->ConnectInput(task,  0, mgr->GetCommonInputContainer());
  mgr->ConnectOutput(task, 1, cReducedEvent);
  if(task->WriteTree()) {
     mgr->ConnectOutput(task, 2, cReducedTree);
     mgr->ConnectOutput(task, 3, cEventStatsInfo);
     mgr->ConnectOutput(task, 4, cTrackStatsInfo);
     if(hasMC) mgr->ConnectOutput(task, 5, cMCStatsInfo);
  }

  return task;
}

//_______________________________________________________________________________________________
void AddMCSignals(AliAnalysisTaskReducedTreeMaker* task) {
   //
   // Add the MC signals to be filtered
   //
   AliSignalMC* jpsiInclusive=new AliSignalMC("JpsiInclusive", "",1,1);
   jpsiInclusive->SetPDGcode(0, 0, 443, kFALSE);
   task->AddMCsignal(jpsiInclusive, AliAnalysisTaskReducedTreeMaker::kFullTrack);

   AliSignalMC* jpsiFromB=new AliSignalMC("JpsiNonPrompt","",1,2);
   jpsiFromB->SetPDGcode(0, 0, 443, kFALSE);
   jpsiFromB->SetPDGcode(0, 1, 503, kTRUE);
   task->AddMCsignal(jpsiFromB, AliAnalysisTaskReducedTreeMaker::kFullTrack);

   AliSignalMC* jpsiPrompt=new AliSignalMC("JpsiPrompt","",1,2);
   jpsiPrompt->SetPDGcode(0, 0, 443, kFALSE);
   jpsiPrompt->SetPDGcode(0, 1, 503, kTRUE, kTRUE);
   task->AddMCsignal(jpsiPrompt, AliAnalysisTaskReducedTreeMaker::kFullTrack);

   AliSignalMC* jpsiInclusiveRadiative=new AliSignalMC("JpsiInclusiveRadiative","",1,1);
   jpsiInclusiveRadiative->SetPDGcode(0, 0, 443, kFALSE);
   jpsiInclusiveRadiative->SetSourceBit(0, 0, AliSignalMC::kRadiativeDecay);
   task->AddMCsignal(jpsiInclusiveRadiative, AliAnalysisTaskReducedTreeMaker::kFullTrack);

   AliSignalMC* jpsiInclusiveNonRadiative=new AliSignalMC("JpsiInclusiveNonRadiative","",1,1);
   jpsiInclusiveNonRadiative->SetPDGcode(0, 0, 443, kFALSE);
   jpsiInclusiveNonRadiative->SetSourceBit(0, 0, AliSignalMC::kRadiativeDecay, kTRUE);
   task->AddMCsignal(jpsiInclusiveNonRadiative, AliAnalysisTaskReducedTreeMaker::kFullTrack);

   AliSignalMC* electronFromJpsi=new AliSignalMC("electronFromJpsiInclusive","",1,2);
   electronFromJpsi->SetPDGcode(0, 0, 11, kTRUE);
   electronFromJpsi->SetPDGcode(0, 1, 443);
   task->AddMCsignal(electronFromJpsi, AliAnalysisTaskReducedTreeMaker::kFullTrack);

   AliSignalMC* electronFromJpsiNonPrompt=new AliSignalMC("electronFromJpsiNonPrompt","",1,3);
   electronFromJpsiNonPrompt->SetPDGcode(0, 0, 11, kTRUE);
   electronFromJpsiNonPrompt->SetPDGcode(0, 1, 443);
   electronFromJpsiNonPrompt->SetPDGcode(0, 2, 503, kTRUE);      //
   task->AddMCsignal(electronFromJpsiNonPrompt, AliAnalysisTaskReducedTreeMaker::kFullTrack);

   AliSignalMC* electronFromJpsiPrompt=new AliSignalMC("electronFromJpsiPrompt","", 1,3);
   electronFromJpsiPrompt->SetPDGcode(0, 0, 11, kTRUE);
   electronFromJpsiPrompt->SetPDGcode(0, 1, 443);
   electronFromJpsiPrompt->SetPDGcode(0, 2, 503, kTRUE, kTRUE);    //
   task->AddMCsignal(electronFromJpsiPrompt, AliAnalysisTaskReducedTreeMaker::kFullTrack);

   AliSignalMC* electronFromJpsiRadiative=new AliSignalMC("electronFromJpsiRadiative","",1,2);
   electronFromJpsiRadiative->SetPDGcode(0, 0, 11, kTRUE);
   electronFromJpsiRadiative->SetPDGcode(0, 1, 443);
   electronFromJpsiRadiative->SetSourceBit(0, 1, AliSignalMC::kRadiativeDecay);
   task->AddMCsignal(electronFromJpsiRadiative, AliAnalysisTaskReducedTreeMaker::kFullTrack);

   AliSignalMC* electronFromJpsiNonRadiative=new AliSignalMC("electronFromJpsiNonRadiative","",1,2);
   electronFromJpsiNonRadiative->SetPDGcode(0, 0, 11, kTRUE);
   electronFromJpsiNonRadiative->SetPDGcode(0, 1, 443);
   electronFromJpsiNonRadiative->SetSourceBit(0, 1, AliSignalMC::kRadiativeDecay, kTRUE);
   task->AddMCsignal(electronFromJpsiNonRadiative, AliAnalysisTaskReducedTreeMaker::kFullTrack);

   AliSignalMC* photonFromJpsiDecay=new AliSignalMC("photonFromJpsiDecay","",1,2);
   photonFromJpsiDecay->SetPDGcode(0, 0, 22);
   photonFromJpsiDecay->SetPDGcode(0, 1, 443);
   task->AddMCsignal(photonFromJpsiDecay, AliAnalysisTaskReducedTreeMaker::kFullTrack);

   AliSignalMC* primary = new AliSignalMC("primary", "", 1, 1);
   primary->SetSourceBit(0, 0, AliSignalMC::kPhysicalPrimary);
   //task->AddMCsignal(primary, AliAnalysisTaskReducedTreeMaker::kFullTrack);
}

//_______________________________________________________________________________________________
void SetInactiveBranches(AliAnalysisTaskReducedTreeMaker* task) {
   //
   // Set inactive branches
   //
   // You can define the active branches of the tree, all other branches will be set to inactive
   //task->SetTreeActiveBranch("Event");
   //task->SetTreeActiveBranch("fRunNo");
   // Alternatively, you can define the inactive branches of the tree, all other branches will be set to active

   //task->SetTreeInactiveBranch("fEventTag");
   //task->SetTreeInactiveBranch("fRunNo");
   //task->SetTreeInactiveBranch("fVtx*");
   //task->SetTreeInactiveBranch("fNVtxContributors");
   task->SetTreeInactiveBranch("fCentrality*");
   task->SetTreeInactiveBranch("fCentQuality");
   //task->SetTreeInactiveBranch("fNtracks*");
   //task->SetTreeInactiveBranch("fNV0candidates*");
   //task->SetTreeInactiveBranch("fTracks.*");
   task->SetTreeInactiveBranch("fCandidates.*");
   task->SetTreeInactiveBranch("fEventNumberInFile");
   task->SetTreeInactiveBranch("fL0TriggerInputs");
   task->SetTreeInactiveBranch("fL1TriggerInputs");
   task->SetTreeInactiveBranch("fL2TriggerInputs");
   //task->SetTreeInactiveBranch("fBC");
   //task->SetTreeInactiveBranch("fTimeStamp");
   task->SetTreeInactiveBranch("fEventType");
   //task->SetTreeInactiveBranch("fTriggerMask");
   //task->SetTreeInactiveBranch("fMultiplicityEstimators*");
   //task->SetTreeInactiveBranch("fMultiplicityEstimatorPercentiles*");
   //task->SetTreeInactiveBranch("fIsPhysicsSelection");
   //task->SetTreeInactiveBranch("fIsSPDPileup");
   //task->SetTreeInactiveBranch("fIsSPDPileupMultBins");
   //task->SetTreeInactiveBranch("fIRIntClosestIntMap*");
   //task->SetTreeInactiveBranch("fVtxTPC*");
   task->SetTreeInactiveBranch("fVtxMC*");
   task->SetTreeInactiveBranch("fNch*");
   //task->SetTreeInactiveBranch("fNVtxTPCContributors");
   //task->SetTreeInactiveBranch("fVtxSPD*");
   //task->SetTreeInactiveBranch("fNVtxSPDContributors");
   //task->SetTreeInactiveBranch("fNpileupSPD");
   //task->SetTreeInactiveBranch("fNpileupTracks");
   //task->SetTreeInactiveBranch("fNTPCclusters");
   task->SetTreeInactiveBranch("fNPMDtracks");
   task->SetTreeInactiveBranch("fNTRDtracks");
   task->SetTreeInactiveBranch("fNTRDtracklets");
   //task->SetTreeInactiveBranch("fSPDntracklets");
   //task->SetTreeInactiveBranch("fSPDntrackletsEta*");
   //task->SetTreeInactiveBranch("fSPDFiredChips*");
   //task->SetTreeInactiveBranch("fITSClusters*");
   //task->SetTreeInactiveBranch("fSPDnSingle");
   //task->SetTreeInactiveBranch("fNtracksPerTrackingFlag*");
   //task->SetTreeInactiveBranch("fVZEROMult*");
   //task->SetTreeInactiveBranch("fVZEROTotalMult*");
   task->SetTreeInactiveBranch("fZDCnEnergy*");
   task->SetTreeInactiveBranch("fZDCpEnergy*");
   //task->SetTreeInactiveBranch("fZDCnTotalEnergy*");
   //task->SetTreeInactiveBranch("fZDCpTotalEnergy*");
   task->SetTreeInactiveBranch("fT0amplitude*");
   task->SetTreeInactiveBranch("fT0TOF*");
   task->SetTreeInactiveBranch("fT0TOFbest*");
   task->SetTreeInactiveBranch("fT0zVertex");
   task->SetTreeInactiveBranch("fT0start");
   //task->SetTreeInactiveBranch("fT0pileup");
   //task->SetTreeInactiveBranch("fT0sattelite");
   //task->SetTreeInactiveBranch("fNCaloClusters");
   //task->SetTreeInactiveBranch("fCaloClusters.*");
   //task->SetTreeInactiveBranch("fFMD.*");
   //task->SetTreeInactiveBranch("fEventPlane.*");

   //task->SetTreeInactiveBranch("fTracks2.*");
   //task->SetTreeInactiveBranch("fTracks.fP*");
   //task->SetTreeInactiveBranch("fTracks.fIsCartesian");
   //task->SetTreeInactiveBranch("fTracks.fCharge");
   //task->SetTreeInactiveBranch("fTracks.fFlags");
   //task->SetTreeInactiveBranch("fTracks.fQualityFlags");
   //task->SetTreeInactiveBranch("fTracks.fTrackId");
   //task->SetTreeInactiveBranch("fTracks.fStatus");
   task->SetTreeInactiveBranch("fTracks.fTPCPhi");
   task->SetTreeInactiveBranch("fTracks.fTPCPt");
   task->SetTreeInactiveBranch("fTracks.fTPCEta");
   //task->SetTreeInactiveBranch("fTracks.fMomentumInner");
   //task->SetTreeInactiveBranch("fTracks.fDCA*");
   task->SetTreeInactiveBranch("fTracks.fTPCDCA*");
   task->SetTreeInactiveBranch("fTracks.fTrackLength");
   task->SetTreeInactiveBranch("fTracks.fMassForTracking");
   //task->SetTreeInactiveBranch("fTracks.fChi2TPCConstrainedVsGlobal");
   task->SetTreeInactiveBranch("fTracks.fHelixCenter*");
   task->SetTreeInactiveBranch("fTracks.fHelixRadius");
   //task->SetTreeInactiveBranch("fTracks.fITSclusterMap");
   //task->SetTreeInactiveBranch("fTracks.fITSSharedClusterMap");
   task->SetTreeInactiveBranch("fTracks.fITSsignal");
   task->SetTreeInactiveBranch("fTracks.fITSnSig*");
   //task->SetTreeInactiveBranch("fTracks.fITSchi2");
   //task->SetTreeInactiveBranch("fTracks.fTPCNcls");
   //task->SetTreeInactiveBranch("fTracks.fTPCCrossedRows");
   //task->SetTreeInactiveBranch("fTracks.fTPCNclsF");
   //task->SetTreeInactiveBranch("fTracks.fTPCNclsShared");
   //task->SetTreeInactiveBranch("fTracks.fTPCClusterMap");
   //task->SetTreeInactiveBranch("fTracks.fTPCsignal");
   //task->SetTreeInactiveBranch("fTracks.fTPCsignalN");
   //task->SetTreeInactiveBranch("fTracks.fTPCnSig*");
   //task->SetTreeInactiveBranch("fTracks.fTPCchi2");
   task->SetTreeInactiveBranch("fTracks.fTPCActiveLength");
   task->SetTreeInactiveBranch("fTracks.fTPCGeomLength");
   //task->SetTreeInactiveBranch("fTracks.fTOFbeta");
   task->SetTreeInactiveBranch("fTracks.fTOFtime");
   task->SetTreeInactiveBranch("fTracks.fTOFdx");
   task->SetTreeInactiveBranch("fTracks.fTOFdz");
   //task->SetTreeInactiveBranch("fTracks.fTOFmismatchProbab");
   //task->SetTreeInactiveBranch("fTracks.fTOFchi2");
   //task->SetTreeInactiveBranch("fTracks.fTOFnSig*");
   //task->SetTreeInactiveBranch("fTracks.fTOFdeltaBC");
   task->SetTreeInactiveBranch("fTracks.fTRDntracklets*");
   task->SetTreeInactiveBranch("fTracks.fTRDpid*");
   task->SetTreeInactiveBranch("fTracks.fTRDpidLQ2D*");
   task->SetTreeInactiveBranch("fTracks.fCaloClusterId");
   //task->SetTreeInactiveBranch("fTracks.fMCMom*");
   //task->SetTreeInactiveBranch("fTracks.fMCFreezeout*");
   //task->SetTreeInactiveBranch("fTracks.fMCLabels*");
   //task->SetTreeInactiveBranch("fTracks.fMCPdg*");
   //task->SetTreeInactiveBranch("fTracks.fMCGeneratorIndex");

   task->SetTreeInactiveBranch("fCandidates.*");
   //task->SetTreeInactiveBranch("fCandidates.fP*");
   //task->SetTreeInactiveBranch("fCandidates.fIsCartesian");
   //task->SetTreeInactiveBranch("fCandidates.fCharge");
   //task->SetTreeInactiveBranch("fCandidates.fFlags");
   //task->SetTreeInactiveBranch("fCandidates.fQualityFlags");
   //task->SetTreeInactiveBranch("fCandidates.fCandidateId");
   //task->SetTreeInactiveBranch("fCandidates.fPairType");
   //task->SetTreeInactiveBranch("fCandidates.fLegIds*");
   //task->SetTreeInactiveBranch("fCandidates.fMass*");
   //task->SetTreeInactiveBranch("fCandidates.fLxy");
   //task->SetTreeInactiveBranch("fCandidates.fPointingAngle");
   //task->SetTreeInactiveBranch("fCandidates.fChisquare");

}

//_______________________________________________________________________________________________
AliAnalysisCuts* CreateEventFilter(Bool_t isAOD) {
  //
  // Event wise cuts
  //
  AliDielectronEventCuts *eventCuts=new AliDielectronEventCuts("eventCuts","Vertex Track && |vtxZ|<10 && ncontrib>0");
  //if(isAOD) eventCuts->SetVertexType(AliDielectronEventCuts::kVtxAny);
  //eventCuts->SetRequireVertex();
  //eventCuts->SetMinVtxContributors(1);
  //eventCuts->SetVertexZ(-10.,10.);
  return eventCuts;
}

//______________________________________________________________________________________
void CreateTrackFilters(AliAnalysisTaskReducedTreeMaker* task, Bool_t isAOD) {
   //
   // add track filters
   //
   AliDielectronCutGroup* basicCut = new AliDielectronCutGroup("basicCut","J/psi candidate electron (basic cut)",AliDielectronCutGroup::kCompAND);
   AliDielectronVarCuts *basicVarCuts = new AliDielectronVarCuts("basicVarCuts","basic var track cuts");
   basicVarCuts->AddCut(AliDielectronVarManager::kImpactParXY,-1.0,1.0);
   basicVarCuts->AddCut(AliDielectronVarManager::kImpactParZ,-3.0,3.0);
   basicVarCuts->AddCut(AliDielectronVarManager::kEta,-0.9,0.9);
   basicVarCuts->AddCut(AliDielectronVarManager::kP,0.9,1.0e+30);
   basicVarCuts->AddCut(AliDielectronVarManager::kNclsTPC,70.0,161.0);
   basicVarCuts->AddCut(AliDielectronVarManager::kTPCnSigmaEle, -3.0, 4.0);
   basicVarCuts->AddCut(AliDielectronVarManager::kTPCnSigmaPro, -3.0, 2.0, kTRUE);
   //basicVarCuts->AddCut(AliDielectronVarManager::kTPCnSigmaPio, -3.0, 2.0, kTRUE);
   basicVarCuts->AddCut(AliDielectronVarManager::kTPCnSigmaKao, -3.0, 3.0, kTRUE);
//   basicVarCuts->AddCut(AliDielectronVarManager::kTPCchi2Cl, 0.0, 10.0);
//   basicVarCuts->AddCut(AliDielectronVarManager::kITSchi2Cl, 0.0, 100.);
//   basicVarCuts->AddCut(AliDielectronVarManager::kTPCclsSegments, 5., 9.);
//   basicVarCuts->AddCut(AliDielectronVarManager::kNclsSFracTPC, 0.6, 2.0, kTRUE);
//   basicVarCuts->AddCut(AliDielectronVarManager::kNFclsTPCfCross, 0.5, 2.0);
//   basicVarCuts->AddCut(AliDielectronVarManager::kChi2TPCConstrainedVsGlobal, 100., 1.0e+10, kTRUE);
   basicCut->AddCut(basicVarCuts);
   AliDielectronTrackCuts* basicTrackCuts = new AliDielectronTrackCuts("basicTrackCuts","basic track cuts");
   basicTrackCuts->SetRequireITSRefit(kTRUE);
   basicTrackCuts->SetRequireTPCRefit(kTRUE);
   if(isAOD) basicTrackCuts->SetAODFilterBit(AliDielectronTrackCuts::kTPCqual);
   basicCut->AddCut(basicTrackCuts);
   task->AddTrackFilter(basicCut, kFALSE);   // basic cut, no SPD requirements

   AliDielectronCutGroup* prefilterCut = new AliDielectronCutGroup("prefilterCut","basic electron cut to be used for prefilter",AliDielectronCutGroup::kCompAND);
   AliDielectronVarCuts *prefilterVarCuts = new AliDielectronVarCuts("prefilterVarCuts","prefilter var track cuts");
   prefilterVarCuts->AddCut(AliDielectronVarManager::kImpactParXY,-3.0,3.0);
   prefilterVarCuts->AddCut(AliDielectronVarManager::kImpactParZ,-10.0,10.0);
   prefilterVarCuts->AddCut(AliDielectronVarManager::kEta,-0.9,0.9);
   prefilterVarCuts->AddCut(AliDielectronVarManager::kPt,0.2,1.0e+30);
   prefilterVarCuts->AddCut(AliDielectronVarManager::kNclsTPC,70.0,161.0);
   prefilterVarCuts->AddCut(AliDielectronVarManager::kTPCnSigmaEle, -4.0, 4.0);
   prefilterVarCuts->AddCut(AliDielectronVarManager::kTPCnSigmaPro, -3.0, 3.0, kTRUE);
   //prefilterVarCuts->AddCut(AliDielectronVarManager::kTPCnSigmaPio, -3.0, 3.0, kTRUE);
   prefilterVarCuts->AddCut(AliDielectronVarManager::kTPCnSigmaKao, -3.0, 3.0, kTRUE);
//   prefilterVarCuts->AddCut(AliDielectronVarManager::kTPCchi2Cl, 0.0, 10.0);
//   prefilterVarCuts->AddCut(AliDielectronVarManager::kITSchi2Cl, 0.0, 100.);
//   prefilterVarCuts->AddCut(AliDielectronVarManager::kTPCclsSegments, 4., 9.);
   //prefilterVarCuts->AddCut(AliDielectronVarManager::kNclsSFracTPC, 0.6, 2.0, kTRUE);
   //prefilterVarCuts->AddCut(AliDielectronVarManager::kNFclsTPCfCross, 0.5, 2.0);
   //prefilterVarCuts->AddCut(AliDielectronVarManager::kChi2TPCConstrainedVsGlobal, 100., 1.0e+10, kTRUE);
   prefilterCut->AddCut(prefilterVarCuts);
   AliDielectronTrackCuts* prefilterTrackCuts = new AliDielectronTrackCuts("prefilterTrackCuts","prefilter track cuts");
   //prefilterTrackCuts->SetRequireITSRefit(kTRUE);
   prefilterTrackCuts->SetRequireTPCRefit(kTRUE);
   if(isAOD) prefilterTrackCuts->SetAODFilterBit(AliDielectronTrackCuts::kTPCqual);
   prefilterCut->AddCut(prefilterTrackCuts);
   task->AddTrackFilter(prefilterCut, kTRUE);   // prefilter electron cut

   AliDielectronCutGroup* assocHadr = new AliDielectronCutGroup("assocHadr","Hadrons",AliDielectronCutGroup::kCompAND);
   AliDielectronVarCuts *hadrVarCuts = new AliDielectronVarCuts("hadrVarCuts","hadron var track cuts");
   hadrVarCuts->AddCut(AliDielectronVarManager::kImpactParXY,-0.5,0.5);
   hadrVarCuts->AddCut(AliDielectronVarManager::kImpactParZ,-1.0,1.0);
   hadrVarCuts->AddCut(AliDielectronVarManager::kEta,-1.0,1.0);
   hadrVarCuts->AddCut(AliDielectronVarManager::kPt,0.2,1.0e+30);
   hadrVarCuts->AddCut(AliDielectronVarManager::kNclsTPC,70.0,161.0);
   hadrVarCuts->AddCut(AliDielectronVarManager::kTPCchi2Cl, 0.0, 4.0);
   hadrVarCuts->AddCut(AliDielectronVarManager::kITSchi2Cl, 0.0, 20.);
   assocHadr->AddCut(hadrVarCuts);
   assocHadr->AddCut(basicTrackCuts);     // ITSrefit and TPCrefit
   //task->AddTrackFilter(assocHadr, kTRUE);

   AliDielectronCutGroup* assocHadr2 = new AliDielectronCutGroup("assocHadrNoITSrefit","Hadrons, no ITSrefit",AliDielectronCutGroup::kCompAND);
   assocHadr2->AddCut(hadrVarCuts);
   assocHadr2->AddCut(prefilterTrackCuts);    // TPCrefit (no ITSrefit  --> check consistency !!!!!!!!!!!!)
   //task->AddTrackFilter(assocHadr2, kTRUE);

   AliDielectronCutGroup* assocPion = new AliDielectronCutGroup("assocPion","Associated pions",AliDielectronCutGroup::kCompAND);
   assocPion->AddCut(hadrVarCuts);
   assocPion->AddCut(basicTrackCuts);
   AliDielectronVarCuts *pionPID = new AliDielectronVarCuts("pionPID","pion PID");
   pionPID->AddCut(AliDielectronVarManager::kTPCnSigmaPio, -3.0, 3.0);
   assocPion->AddCut(pionPID);
   //task->AddTrackFilter(assocPion, kTRUE);

   AliDielectronCutGroup* assocKaon = new AliDielectronCutGroup("assocKaon","Associated kaons",AliDielectronCutGroup::kCompAND);
   assocKaon->AddCut(hadrVarCuts);
   assocKaon->AddCut(basicTrackCuts);
   AliDielectronVarCuts *kaonPID = new AliDielectronVarCuts("kaonPID","kaon PID");
   kaonPID->AddCut(AliDielectronVarManager::kTPCnSigmaKao, -3.0, 3.0);
   assocKaon->AddCut(kaonPID);
   //task->AddTrackFilter(assocKaon, kTRUE);

   AliDielectronCutGroup* assocProton = new AliDielectronCutGroup("assocProton","Associated protons",AliDielectronCutGroup::kCompAND);
   assocProton->AddCut(hadrVarCuts);
   assocProton->AddCut(basicTrackCuts);
   AliDielectronVarCuts *protonPID = new AliDielectronVarCuts("protonPID","proton PID");
   protonPID->AddCut(AliDielectronVarManager::kTPCnSigmaPro, -3.0, 3.0);
   assocProton->AddCut(protonPID);
   //task->AddTrackFilter(assocProton, kTRUE);
}

//_________________________________________________________________________________________________________________
void AddFMDTask(){

  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();

  gSystem->Load("libPWGLFforward2");  // for FMD

  // Create the FMD task and add it to the manager
  //===========================================================================

  //--- AOD output handler -----------------------------------------
  AliAODHandler* ret = new AliAODHandler();
  //ret->SetFillAOD(kTRUE);
  ret->SetOutputFileName("AliAOD.pass2.root");
  mgr->SetOutputEventHandler(ret);
  ////AliVEventHandler*  outputHandlernew AliAODInputHandler();
  //

  //gROOT->LoadClass("AliAODForwardMult", "libPWGLFforward2");
  gSystem->Load("libESDfilter.so");
  gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/ESDfilter/macros/AddTaskESDFilter.C");
  AliAnalysisTaskESDfilter *esdfilter = AddTaskESDFilter(kTRUE, kFALSE, kFALSE, kFALSE, kFALSE, kTRUE);
  //AliAnalysisTaskESDfilter *esdfilter = AddTaskESDFilter();

  // Create ONLY the output containers for the data produced by the task.
  // Get and connect other common input/output containers via the manager as below
  //==============================================================================
  mgr->ConnectInput  (esdfilter,  0, mgr->GetCommonInputContainer());
  mgr->ConnectOutput (esdfilter,  0, mgr->GetCommonOutputContainer());

  gROOT->LoadMacro("$ALICE_PHYSICS/PWGLF/FORWARD/analysis2/AddTaskForwardMult.C");

  Bool_t   mc  = false; // false: real data, true: simulated data
  ULong_t run = 0; // 0: get from data???
  UShort_t sys = 0; // 0: get from data, 1: pp, 2: AA
  UShort_t sNN = 0; // 0: get from data, otherwise center of mass energy (per nucleon pair)
  Short_t  fld = 0; // 0: get from data, otherwise L3 field in kG
  //AliAnalysisTask *taskFmd  = AddTaskForwardMult(mc, sys, sNN, fld);
  //const Char_t* config = "$ALICE_PHYSICS/PWGDQ/dielectron/ReducedTreeMaker/ForwardAODConfig2.C";
  const Char_t* config = "ForwardAODConfig2.C";  // to be changed to the above line when config is committed
  AliAnalysisTask *taskFmd  = AddTaskForwardMult(mc, run, sys, sNN, fld, config);

  // --- Make the output container and connect it --------------------
  AliAnalysisDataContainer* histOut =
    mgr->CreateContainer("Forward", TList::Class(),
        AliAnalysisManager::kExchangeContainer,
        "Forward");
  //AliAnalysisManager::GetCommonFileName());
  AliAnalysisDataContainer *output =
    mgr->CreateContainer("ForwardResults", TList::Class(),
        AliAnalysisManager::kParamContainer,
        "ForwardResults");
  //AliAnalysisManager::GetCommonFileName());

  mgr->ConnectInput(taskFmd, 0, mgr->GetCommonInputContainer());
  mgr->ConnectOutput(taskFmd, 1, histOut);
  //mgr->ConnectOutput(taskFmd, 2, output);
  mgr->AddTask(taskFmd);
}

//_______________________________________________________________________________________________
AliAnalysisCuts* CreateFlowTrackFilter(Bool_t isAOD) {
  //
  // Cuts for tracks to be used for the event plane q-vector
  // These cuts are applied aditionally to the global track cuts
  //
  if(!isAOD) {
    AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts;
    esdTrackCuts->SetPtRange(0.2,2.0);
    esdTrackCuts->SetEtaRange(-0.8, 0.8);
    esdTrackCuts->SetMinNClustersTPC(70);
    return esdTrackCuts;
  }
  else return 0;
}

//_______________________________________________________________________________________________
AliAnalysisCuts* CreateK0sPionCuts(Bool_t isAOD) {
  //
  // Cuts on the K0s pions (tracking cuts, pid cuts, ...)
  //
  if(!isAOD) {
    AliESDtrackCuts *pionCuts = new AliESDtrackCuts;
    pionCuts->SetPtRange(0.15,100.0);
    pionCuts->SetEtaRange(-1.6,1.6);
    pionCuts->SetRequireTPCRefit(kTRUE);
    pionCuts->SetMinNClustersTPC(50);
    return pionCuts;
  }
  else return 0;
}

//_______________________________________________________________________________________________
AliAnalysisCuts* CreateLambdaPionCuts(Bool_t isAOD) {
  //
  // Cuts on the Lambda pions (tracking cuts, pid cuts, ...)
  //
  if(!isAOD) {
    AliESDtrackCuts *pionCuts = new AliESDtrackCuts;
    pionCuts->SetPtRange(0.15,100.0);
    pionCuts->SetEtaRange(-1.6,1.6);
    pionCuts->SetRequireTPCRefit(kTRUE);
    pionCuts->SetMinNClustersTPC(50);
    return pionCuts;
  }
  else return 0;
}

//_______________________________________________________________________________________________
AliAnalysisCuts* CreateLambdaProtonCuts(Bool_t isAOD) {
  //
  // Cuts on the Lambda protons (tracking cuts, pid cuts, ...)
  //
  if(!isAOD) {
    AliESDtrackCuts *protonCuts = new AliESDtrackCuts;
    protonCuts->SetPtRange(0.15,100.0);
    protonCuts->SetEtaRange(-1.6,1.6);
    protonCuts->SetRequireTPCRefit(kTRUE);
    protonCuts->SetMinNClustersTPC(50);
    return protonCuts;
  }
  else return 0;
}

//______________________________________________________________________________________
AliAnalysisCuts* CreateGammaConvElectronCuts(Bool_t isAOD) {
  //
  // Cuts for the selection of electrons from gamma conversions
  //
  if(!isAOD) {
    AliESDtrackCuts* electronCuts = new AliESDtrackCuts;
    electronCuts->SetPtRange(0.6,100.0);
    electronCuts->SetEtaRange(-0.9,0.9);
    electronCuts->SetRequireTPCRefit(kTRUE);
    electronCuts->SetMinNClustersTPC(70);
    return electronCuts;
  }
}

//______________________________________________________________________________________
AliESDv0KineCuts* CreateV0StrongCuts(Int_t mode, Int_t type) {
  //
  // cuts for the selection of gamma conversions
  //
  AliESDv0KineCuts* cuts = new AliESDv0KineCuts();
  cuts->SetMode(mode, type);

  // leg cuts
  cuts->SetNTPCclusters(50);
  cuts->SetTPCrefit(kTRUE);
  cuts->SetTPCchi2perCls(4.0);
  cuts->SetTPCclusterratio(0.6);
  cuts->SetNoKinks(kTRUE);
  // gamma cuts
  cuts->SetGammaCutChi2NDF(10.0);
  Float_t cosPoint[2] = {0.0, 0.02};
  cuts->SetGammaCutCosPoint(cosPoint);
  Float_t cutDCA[2] = {0.0, 0.25};
  cuts->SetGammaCutDCA(cutDCA);
  Float_t vtxR[2] = {3.0, 90.0};
  cuts->SetGammaCutVertexR(vtxR);
  Float_t psiPairCut[2]={0.0,0.05};
  cuts->SetGammaCutPsiPair(psiPairCut);
  cuts->SetGammaCutInvMass(0.05);
  // K0s cuts
  cuts->SetK0CutChi2NDF(10.0);
  Float_t cosPointK0s[2] = {0.0, 0.02};
  cuts->SetK0CutCosPoint(cosPointK0s);
  Float_t cutDCAK0s[2] = {0.0, 0.2};
  cuts->SetK0CutDCA(cutDCAK0s);
  Float_t vtxRK0s[2] = {2.0, 30.0};
  cuts->SetK0CutVertexR(vtxRK0s);
  Float_t k0sInvMass[2] = {0.486, 0.508};
  cuts->SetK0CutInvMass(k0sInvMass);
  // Lambda and anti-Lambda cuts
  cuts->SetLambdaCutChi2NDF(10.0);
  Float_t cosPointLambda[2] = {0.0, 0.02};
  cuts->SetLambdaCutCosPoint(cosPointLambda);
  Float_t cutDCALambda[2] = {0.0, 0.2};
  cuts->SetLambdaCutDCA(cutDCALambda);
  Float_t vtxRLambda[2] = {2.0, 40.0};
  cuts->SetLambdaCutVertexR(vtxRLambda);
  Float_t lambdaInvMass[2] = {1.11, 1.12};
  cuts->SetLambdaCutInvMass(lambdaInvMass);

  return cuts;
}

//______________________________________________________________________________________
AliESDv0KineCuts* CreateV0OpenCuts(Int_t mode, Int_t type) {
  //
  // cuts for the selection of gamma conversions
  //
  AliESDv0KineCuts* cuts = new AliESDv0KineCuts();
  cuts->SetMode(mode, type);

  // leg cuts
  cuts->SetNTPCclusters(50);
  cuts->SetTPCrefit(kTRUE);
  cuts->SetTPCchi2perCls(4.0);
  cuts->SetTPCclusterratio(0.6);
  cuts->SetNoKinks(kTRUE);
  // gamma cuts
  cuts->SetGammaCutChi2NDF(10.0);
  Float_t cosPoint[2] = {0.0, 0.05};  //  Float_t cosPoint[2] = {0.0, 0.02};
  cuts->SetGammaCutCosPoint(cosPoint);
  Float_t cutDCA[2] = {0.0, 1.0};  //  Float_t cutDCA[2] = {0.0, 0.25};
  cuts->SetGammaCutDCA(cutDCA);
  Float_t vtxR[2] = {3.0, 90.0};
  cuts->SetGammaCutVertexR(vtxR);
  Float_t psiPairCut[2]={0.0,0.20};  //Float_t psiPairCut[2]={0.0,0.05};
  cuts->SetGammaCutPsiPair(psiPairCut);
  cuts->SetGammaCutInvMass(0.1); //  cuts->SetGammaCutInvMass(0.05);
  // K0s cuts
  cuts->SetK0CutChi2NDF(10.0);
  Float_t cosPointK0s[2] = {0.0, 0.1};  //  Float_t cosPointK0s[2] = {0.0, 0.02};
  cuts->SetK0CutCosPoint(cosPointK0s);
  Float_t cutDCAK0s[2] = {0.0, 1.0};  //  Float_t cutDCAK0s[2] = {0.0, 0.2};
  cuts->SetK0CutDCA(cutDCAK0s);
  Float_t vtxRK0s[2] = {2.0, 90.0};  //  Float_t vtxRK0s[2] = {2.0, 30.0};
  cuts->SetK0CutVertexR(vtxRK0s);
  Float_t k0sInvMass[2] = {0.44, 0.55};  //  Float_t k0sInvMass[2] = {0.486, 0.508};
  cuts->SetK0CutInvMass(k0sInvMass);
  // Lambda and anti-Lambda cuts
  cuts->SetLambdaCutChi2NDF(10.0);
  Float_t cosPointLambda[2] = {0.0, 0.1};  //  Float_t cosPointLambda[2] = {0.0, 0.02};
  cuts->SetLambdaCutCosPoint(cosPointLambda);
  Float_t cutDCALambda[2] = {0.0, 1.0};  //  Float_t cutDCALambda[2] = {0.0, 0.2};
  cuts->SetLambdaCutDCA(cutDCALambda);
  Float_t vtxRLambda[2] = {2.0, 90.0};  //  Float_t vtxRLambda[2] = {2.0, 40.0};
  cuts->SetLambdaCutVertexR(vtxRLambda);
  Float_t lambdaInvMass[2] = {1.09, 1.14};  //  Float_t lambdaInvMass[2] = {1.11, 1.12};
  cuts->SetLambdaCutInvMass(lambdaInvMass);

  return cuts;
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>IConsumer (Red5 :: Common server classes 1.0.7-SNAPSHOT API)</title>
<meta name="date" content="2016-02-18">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.red5.server.messaging

Interface IConsumer

All Superinterfaces:

IMessageComponent

All Known Subinterfaces:

IFilter, IPushableConsumer

All Known Implementing Classes:

ClientBroadcastStream, ConnectionConsumer, FileConsumer, PlayEngine

public interface IConsumer
extends IMessageComponent

Signature for the message consumer.

Author:

The Red5 Project, Steven Gong (steven.gong@gmail.com)

Method Summary

Methods inherited from interface org.red5.server.messaging.IMessageComponent

onOOBControlMessage

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Copyright © 2005–2016 Red5. All rights reserved.