//____________________________________________________________________
//
// Class for storing HistFactory Channel Information
//
// The class holds a list of samples (AtlHistFactorySample) and a list
// of systematics (AtlHistFactorySystematic) that should be used for
// each sample.
//
// The histogram of the discriminant is expected in the directory
// <basedir>/<systematic>/plots_datamc/MCPlotter.root
//
// - see AtlHistFactorySystematik::Initialize for more details.
//
//  
// Author: Soeren Stamm <mailto: stamm@physik.hu-berlin.de>
// Update: $Id: AtlHistFactoryChannel.cxx,v 1.1 2015/04/22 22:27:40 stamm Exp $
// Copyright: 2015 (C) Soeren Stamm
//
#ifndef ATLAS_AtlHistFactoryChannel
#include <AtlHistFactoryChannel.h>
#endif
#include <TList.h>
#include <AtlHistFactorySystematic.h>
#include <AtlHistFactorySample.h>

#ifndef __CINT__
ClassImp(AtlHistFactoryChannel);
#endif

//____________________________________________________________________

AtlHistFactoryChannel::AtlHistFactoryChannel(const char* name,
					     const char* discriminant,
					     const char* basedir) :
    TNamed(name, name), fDiscriminant(discriminant),
    fMCPlotterBaseDir(basedir) {
    //
    // Default constructor
    //

    fListOfSamples = new TList;
    fListOfSystematics = new TList;

    fShapeDiscriminantRef  = 0;
    fShapeDiscriminantSyst = 0;
}

//____________________________________________________________________

AtlHistFactoryChannel::~AtlHistFactoryChannel() {
    //
    // Default destructor
    //

    delete fListOfSystematics;
    if ( fShapeDiscriminantRef != 0 ) delete fShapeDiscriminantRef;
    if ( fShapeDiscriminantSyst != 0 ) delete fShapeDiscriminantSyst;	
}

//____________________________________________________________________

void AtlHistFactoryChannel::AddSystematic(AtlHistFactorySystematic *syst) {
    //
    // Add Systematic to channel
    //
    
    fListOfSystematics->Add(syst);
}

//____________________________________________________________________

void AtlHistFactoryChannel::AddSystematics(TList *list) {
    //
    // Add Systematic to channel
    //
    
    fListOfSystematics->AddAll(list);
}

//____________________________________________________________________

void AtlHistFactoryChannel::AddSample(AtlHistFactorySample *sample) {
    //
    // Add Systematic to channel
    //
    
    fListOfSamples->Add(sample);
}

//____________________________________________________________________

void AtlHistFactoryChannel::SetShapeDiscriminants(const char* ShapeRef,
						  const char* ShapeSyst) {
    //
    // Set shape discriminants
    // The histogram 'ShapeRef' will be used as Reference histogram
    // ans tested against the histogram 'ShapeSyst'.
    //
    if ( fShapeDiscriminantRef != 0 ) {
	delete fShapeDiscriminantRef;
    }
    fShapeDiscriminantRef  = new TString(ShapeRef);
    
    if ( fShapeDiscriminantSyst != 0 ) {
	delete fShapeDiscriminantSyst;
    }
    fShapeDiscriminantSyst  = new TString(ShapeSyst);
}
 AtlHistFactoryChannel.cxx:1
 AtlHistFactoryChannel.cxx:2
 AtlHistFactoryChannel.cxx:3
 AtlHistFactoryChannel.cxx:4
 AtlHistFactoryChannel.cxx:5
 AtlHistFactoryChannel.cxx:6
 AtlHistFactoryChannel.cxx:7
 AtlHistFactoryChannel.cxx:8
 AtlHistFactoryChannel.cxx:9
 AtlHistFactoryChannel.cxx:10
 AtlHistFactoryChannel.cxx:11
 AtlHistFactoryChannel.cxx:12
 AtlHistFactoryChannel.cxx:13
 AtlHistFactoryChannel.cxx:14
 AtlHistFactoryChannel.cxx:15
 AtlHistFactoryChannel.cxx:16
 AtlHistFactoryChannel.cxx:17
 AtlHistFactoryChannel.cxx:18
 AtlHistFactoryChannel.cxx:19
 AtlHistFactoryChannel.cxx:20
 AtlHistFactoryChannel.cxx:21
 AtlHistFactoryChannel.cxx:22
 AtlHistFactoryChannel.cxx:23
 AtlHistFactoryChannel.cxx:24
 AtlHistFactoryChannel.cxx:25
 AtlHistFactoryChannel.cxx:26
 AtlHistFactoryChannel.cxx:27
 AtlHistFactoryChannel.cxx:28
 AtlHistFactoryChannel.cxx:29
 AtlHistFactoryChannel.cxx:30
 AtlHistFactoryChannel.cxx:31
 AtlHistFactoryChannel.cxx:32
 AtlHistFactoryChannel.cxx:33
 AtlHistFactoryChannel.cxx:34
 AtlHistFactoryChannel.cxx:35
 AtlHistFactoryChannel.cxx:36
 AtlHistFactoryChannel.cxx:37
 AtlHistFactoryChannel.cxx:38
 AtlHistFactoryChannel.cxx:39
 AtlHistFactoryChannel.cxx:40
 AtlHistFactoryChannel.cxx:41
 AtlHistFactoryChannel.cxx:42
 AtlHistFactoryChannel.cxx:43
 AtlHistFactoryChannel.cxx:44
 AtlHistFactoryChannel.cxx:45
 AtlHistFactoryChannel.cxx:46
 AtlHistFactoryChannel.cxx:47
 AtlHistFactoryChannel.cxx:48
 AtlHistFactoryChannel.cxx:49
 AtlHistFactoryChannel.cxx:50
 AtlHistFactoryChannel.cxx:51
 AtlHistFactoryChannel.cxx:52
 AtlHistFactoryChannel.cxx:53
 AtlHistFactoryChannel.cxx:54
 AtlHistFactoryChannel.cxx:55
 AtlHistFactoryChannel.cxx:56
 AtlHistFactoryChannel.cxx:57
 AtlHistFactoryChannel.cxx:58
 AtlHistFactoryChannel.cxx:59
 AtlHistFactoryChannel.cxx:60
 AtlHistFactoryChannel.cxx:61
 AtlHistFactoryChannel.cxx:62
 AtlHistFactoryChannel.cxx:63
 AtlHistFactoryChannel.cxx:64
 AtlHistFactoryChannel.cxx:65
 AtlHistFactoryChannel.cxx:66
 AtlHistFactoryChannel.cxx:67
 AtlHistFactoryChannel.cxx:68
 AtlHistFactoryChannel.cxx:69
 AtlHistFactoryChannel.cxx:70
 AtlHistFactoryChannel.cxx:71
 AtlHistFactoryChannel.cxx:72
 AtlHistFactoryChannel.cxx:73
 AtlHistFactoryChannel.cxx:74
 AtlHistFactoryChannel.cxx:75
 AtlHistFactoryChannel.cxx:76
 AtlHistFactoryChannel.cxx:77
 AtlHistFactoryChannel.cxx:78
 AtlHistFactoryChannel.cxx:79
 AtlHistFactoryChannel.cxx:80
 AtlHistFactoryChannel.cxx:81
 AtlHistFactoryChannel.cxx:82
 AtlHistFactoryChannel.cxx:83
 AtlHistFactoryChannel.cxx:84
 AtlHistFactoryChannel.cxx:85
 AtlHistFactoryChannel.cxx:86
 AtlHistFactoryChannel.cxx:87
 AtlHistFactoryChannel.cxx:88
 AtlHistFactoryChannel.cxx:89
 AtlHistFactoryChannel.cxx:90
 AtlHistFactoryChannel.cxx:91
 AtlHistFactoryChannel.cxx:92
 AtlHistFactoryChannel.cxx:93
 AtlHistFactoryChannel.cxx:94
 AtlHistFactoryChannel.cxx:95
 AtlHistFactoryChannel.cxx:96
 AtlHistFactoryChannel.cxx:97
 AtlHistFactoryChannel.cxx:98
 AtlHistFactoryChannel.cxx:99
 AtlHistFactoryChannel.cxx:100
 AtlHistFactoryChannel.cxx:101
 AtlHistFactoryChannel.cxx:102
 AtlHistFactoryChannel.cxx:103
 AtlHistFactoryChannel.cxx:104
 AtlHistFactoryChannel.cxx:105
 AtlHistFactoryChannel.cxx:106
 AtlHistFactoryChannel.cxx:107
 AtlHistFactoryChannel.cxx:108