//____________________________________________________________________
//
// Class for special systematics using an envelope computation
//
// The up and down variation of this systematic is found by 
// the maximum and minimum value in each bin using all 6 variations.
//
//
//  
// Author: Soeren Stamm <mailto: stamm@physik.hu-berlin.de>
// Update: $Id: AtlHistFactorySystEnvelope.cxx,v 1.6 2016/04/19 07:46:15 stamm Exp $
// Copyright: 2015 (C) Soeren Stamm
//
#ifndef ATLAS_AtlHistFactorySystEnvelope
#include <AtlHistFactorySystEnvelope.h>
#endif
#include <TFile.h>
#include <HepDataMCPlot.h>
#include <iostream>

#ifndef __CINT__
ClassImp(AtlHistFactorySystEnvelope);
#endif

//____________________________________________________________________

AtlHistFactorySystEnvelope::AtlHistFactorySystEnvelope() {
    //
    // Default constructor
    //
}

//____________________________________________________________________

AtlHistFactorySystEnvelope::AtlHistFactorySystEnvelope(const char* systname,
						       const char *systtitle,
						       AtlTopLevelAnalysis::ESystematic Syst1,
						       AtlTopLevelAnalysis::ESystematic Syst2,
						       AtlTopLevelAnalysis::ESystematic Syst3,
						       AtlTopLevelAnalysis::ESystematic Syst4,
						       AtlTopLevelAnalysis::ESystematic Syst5,
						       AtlTopLevelAnalysis::ESystematic Syst6,
						       Bool_t useShape) :
    AtlHistFactorySystematic(systname, systtitle, useShape) {
    //
    // Default constructor
    //
    fSyst1   = Syst1;
    fSyst2   = Syst2;
    fSyst3   = Syst3;
    fSyst4   = Syst4;
    fSyst5   = Syst5;
    fSyst6   = Syst6;
    // fNominal = AtlTopLevelAnalysis::kNOMINAL;

    fPlotterFileSyst1 = 0;
    fPlotterFileSyst2 = 0;
    fPlotterFileSyst3 = 0;
    fPlotterFileSyst4 = 0;
    fPlotterFileSyst5 = 0;
    fPlotterFileSyst6 = 0;
    // fPlotterFileNom   = 0;
    
    fHistsSyst1 = 0;
    fHistsSyst2 = 0;
    fHistsSyst3 = 0;
    fHistsSyst4 = 0;
    fHistsSyst5 = 0;
    fHistsSyst6 = 0;
    // fHistsNom  = 0;
}


//____________________________________________________________________

AtlHistFactorySystEnvelope::~AtlHistFactorySystEnvelope() {
    //
    // Default destructor
    //
    if ( fPlotterFileSyst1 != 0 ) delete fPlotterFileSyst1;
    if ( fPlotterFileSyst2 != 0 ) delete fPlotterFileSyst2;
    if ( fPlotterFileSyst3 != 0 ) delete fPlotterFileSyst3;
    if ( fPlotterFileSyst4 != 0 ) delete fPlotterFileSyst4;
    if ( fPlotterFileSyst5 != 0 ) delete fPlotterFileSyst5;
    if ( fPlotterFileSyst6 != 0 ) delete fPlotterFileSyst6;
    // if ( fPlotterFileNom   != 0 ) delete fPlotterFileNom;
    
    if ( fHistsSyst1 != 0 ) delete fHistsSyst1;
    if ( fHistsSyst2 != 0 ) delete fHistsSyst2;
    if ( fHistsSyst3 != 0 ) delete fHistsSyst3;
    if ( fHistsSyst4 != 0 ) delete fHistsSyst4;
    if ( fHistsSyst5 != 0 ) delete fHistsSyst5;
    if ( fHistsSyst6 != 0 ) delete fHistsSyst6;
    // if ( fHistsNom != 0 ) delete fHistsNom;    
}

//____________________________________________________________________

void AtlHistFactorySystEnvelope::Initialize(const char* BaseDir,
					    const char* scheme) {
    //
    // Initialize for MCPlotter files
    //
    // Set the MCPlotter files for the systematic and nominal.
    //
    // The file directory is
    // 'BaseDir' + 'systname' + "plots_datamc/MCPlotter.root"
    //
    // Get the list of templates from the HepDataMCPlots
    //
    
    if ( fPlotterFileSyst1 != 0 ) delete fPlotterFileSyst1;
    fPlotterFileSyst1 = TFile::Open(Form("%s/%s/%s/MCPlotter.root",
					 BaseDir,
					 AtlTopLevelAnalysis::fgSystematicNames[fSyst1],
					 scheme));
    if ( fPlotterFileSyst2 != 0 ) delete fPlotterFileSyst2;
    fPlotterFileSyst2 = TFile::Open(Form("%s/%s/%s/MCPlotter.root",
					 BaseDir,
					 AtlTopLevelAnalysis::fgSystematicNames[fSyst2],
					 scheme));

    // These are optional systematic templates

    // Optional
    if ( fSyst3 != AtlTopLevelAnalysis::kUndefined ) {
	if ( fPlotterFileSyst3 != 0 ) delete fPlotterFileSyst3;
	fPlotterFileSyst3 = TFile::Open(Form("%s/%s/%s/MCPlotter.root",
					     BaseDir,
					     AtlTopLevelAnalysis::fgSystematicNames[fSyst3],
					     scheme));
    }
    
    // Optional
    if ( fSyst4 != AtlTopLevelAnalysis::kUndefined ) {
	if ( fPlotterFileSyst4 != 0 ) delete fPlotterFileSyst4;
	fPlotterFileSyst4 = TFile::Open(Form("%s/%s/%s/MCPlotter.root",
					     BaseDir,
					     AtlTopLevelAnalysis::fgSystematicNames[fSyst4],
					     scheme));
    }

    // Optional:
    if ( fSyst5 != AtlTopLevelAnalysis::kUndefined ) {
	if ( fPlotterFileSyst5 != 0 ) delete fPlotterFileSyst5;
	fPlotterFileSyst5 = TFile::Open(Form("%s/%s/%s/MCPlotter.root",
					     BaseDir,
					     AtlTopLevelAnalysis::fgSystematicNames[fSyst5],
					    scheme));
    }

    // Optional:
    if ( fSyst6 != AtlTopLevelAnalysis::kUndefined ) {
	if ( fPlotterFileSyst6 != 0 ) delete fPlotterFileSyst6;
	fPlotterFileSyst6 = TFile::Open(Form("%s/%s/%s/MCPlotter.root",
					     BaseDir,
					     AtlTopLevelAnalysis::fgSystematicNames[fSyst6],
					     scheme));
    }
    
    if ( fPlotterFileSyst1 == 0 ||
	 fPlotterFileSyst2 == 0 ||
	 // optional:
	 (fPlotterFileSyst3 == 0 && fSyst3 != AtlTopLevelAnalysis::kUndefined) ||
	 (fPlotterFileSyst4 == 0 && fSyst4 != AtlTopLevelAnalysis::kUndefined) ||
	 (fPlotterFileSyst5 == 0 && fSyst5 != AtlTopLevelAnalysis::kUndefined) ||
	 (fPlotterFileSyst6 == 0 && fSyst6 != AtlTopLevelAnalysis::kUndefined) ) {
	 // fPlotterFileNom == 0 ) {
	Error("Initialize",
	      "Could not find MCPlotter files. Abort!");
	gSystem->Abort();
    }
    
    if ( fDiscriminant == 0 ) {
	Error("Initialize",
	      "Discriminant not set. Please use SetDiscriminant(..). Abort!");
	gSystem->Abort();
    }	
    
    HepDataMCPlot *HepSyst1 = (HepDataMCPlot*) fPlotterFileSyst1->Get(fDiscriminant->Data());
    HepDataMCPlot *HepSyst2 = (HepDataMCPlot*) fPlotterFileSyst2->Get(fDiscriminant->Data());
    // Optional:
    HepDataMCPlot *HepSyst3 = 0;
    HepDataMCPlot *HepSyst4 = 0;
    HepDataMCPlot *HepSyst5 = 0;
    HepDataMCPlot *HepSyst6 = 0;
    
    if ( fPlotterFileSyst3 != 0 )
	HepSyst3 = (HepDataMCPlot*) fPlotterFileSyst3->Get(fDiscriminant->Data());
    if ( fPlotterFileSyst4 != 0 )
	HepSyst4 = (HepDataMCPlot*) fPlotterFileSyst4->Get(fDiscriminant->Data());
    if ( fPlotterFileSyst5 != 0 )
	HepSyst5 = (HepDataMCPlot*) fPlotterFileSyst5->Get(fDiscriminant->Data());
    if ( fPlotterFileSyst6 != 0 )
	HepSyst6 = (HepDataMCPlot*) fPlotterFileSyst6->Get(fDiscriminant->Data());
    
    // HepDataMCPlot *HepNom = (HepDataMCPlot*) fPlotterFileNom->Get(fDiscriminant->Data());

    if ( HepSyst1 == 0 ||
	 HepSyst2 == 0 ||
	 (HepSyst3 == 0 && fPlotterFileSyst3 != 0) ||
	 (HepSyst4 == 0 && fPlotterFileSyst4 != 0) ||
	 (HepSyst5 == 0 && fPlotterFileSyst5 != 0) ||
	 (HepSyst6 == 0 && fPlotterFileSyst6 != 0) ) {
	// HepNom == 0 ) {
	Error("Initialize",
	      "Could not find discriminant '%s' in file.",
	      fDiscriminant->Data());
	Error("Initialize", "Files are:\n%s",
	      fPlotterFileSyst1->GetName());
	gSystem->Abort();
    }

    fHistsSyst1 = HepSyst1->GetListOfMCTemplates(AtlTopLevelAnalysis::fgSystematicNames[fSyst1]);
    fHistsSyst2 = HepSyst2->GetListOfMCTemplates(AtlTopLevelAnalysis::fgSystematicNames[fSyst2]);
    if ( HepSyst3 != 0 )
	fHistsSyst3 = HepSyst3->GetListOfMCTemplates(AtlTopLevelAnalysis::fgSystematicNames[fSyst3]);
    if ( HepSyst4 != 0 )
        fHistsSyst4 = HepSyst4->GetListOfMCTemplates(AtlTopLevelAnalysis::fgSystematicNames[fSyst4]);
    if ( HepSyst5 != 0 )
	fHistsSyst5 = HepSyst5->GetListOfMCTemplates(AtlTopLevelAnalysis::fgSystematicNames[fSyst5]);
    if ( HepSyst6 != 0 )
	fHistsSyst6 = HepSyst6->GetListOfMCTemplates(AtlTopLevelAnalysis::fgSystematicNames[fSyst6]);
    // fHistsNom  = HepNom->GetListOfMCTemplates(AtlTopLevelAnalysis::fgSystematicNames[fNominal]);
}

//____________________________________________________________________

void AtlHistFactorySystEnvelope::GetHistsFromFile(const char* process) {
    //
    // Change the process and load the corresponding informations
    // into the class data members.
    //
    
    // we get the histos directly from the template file
    fHistUp = (TH1*) fTemplateFile->Get(Form("%s_%s_up",
					     process,
					     AtlTopLevelAnalysis::fgSystematicNames[fSyst1]));
    fHistDown = (TH1*) fTemplateFile->Get(Form("%s_%s_down",
					       process,
					       AtlTopLevelAnalysis::fgSystematicNames[fSyst1]));

    if ( fHistUp == 0 ) {
	Error("GetHistsFromFile",
	      "Could not find up histogram for systematic '%s'",
	      AtlTopLevelAnalysis::fgSystematicNames[fSyst1]);
    }
    if ( fHistDown == 0 ) {
	Error("GetHistsFromFile",
	      "Could not find down histogram for systematic '%s'",
	      AtlTopLevelAnalysis::fgSystematicNames[fSyst1]);
    }
}

//____________________________________________________________________

void AtlHistFactorySystEnvelope::ComputeUpDownVariation(const char* process) {
    //
    // Compute the up var. and down variation for this systematic
    //

    // Collect all histograms for all 6 variations
    TList *hists = new TList;

    // Skip the first histogram here, it is used below as starting point for
    // the min/max search!
    //
    hists->Add(fHistsSyst2->FindObject(Form("%s_%s",
					    process,
					    AtlTopLevelAnalysis::fgSystematicNames[fSyst2])));

    if ( fHistsSyst3 != 0 )
	hists->Add(fHistsSyst3->FindObject(Form("%s_%s",
						process,
						AtlTopLevelAnalysis::fgSystematicNames[fSyst3])));
    if ( fHistsSyst4 != 0 )
	hists->Add(fHistsSyst4->FindObject(Form("%s_%s",
						process,
						AtlTopLevelAnalysis::fgSystematicNames[fSyst4])));
    if ( fHistsSyst5 != 0 )
	hists->Add(fHistsSyst5->FindObject(Form("%s_%s",
						process,
						AtlTopLevelAnalysis::fgSystematicNames[fSyst5])));
    if ( fHistsSyst6 != 0 )
	hists->Add(fHistsSyst6->FindObject(Form("%s_%s",
						process,
						AtlTopLevelAnalysis::fgSystematicNames[fSyst6])));
    
    // TH1 *h_nom  = (TH1*) fHistsNom->FindObject(Form("%s_%s",
    // 						    process,
    // 						    AtlTopLevelAnalysis::fgSystematicNames[fNominal]));

    TH1 *h_syst = (TH1*) fHistsSyst1->FindObject(Form("%s_%s",
						      process,
						      AtlTopLevelAnalysis::fgSystematicNames[fSyst1]));
    
    // Clone the first systematic histogram for up and down envelope
    // using the name of the first systematic for envelope
    fHistUp   = (TH1*) h_syst->Clone(Form("%s_%s_up",
					  process,
					  AtlTopLevelAnalysis::fgSystematicNames[fSyst1]));
    fHistDown = (TH1*) h_syst->Clone(Form("%s_%s_down",
					  process,
					  AtlTopLevelAnalysis::fgSystematicNames[fSyst1]));
    
    // Search the maximum and minimum in each bin
    TIter next_hist(hists);
    TH1 *hist = 0;
    while ( (hist = (TH1*)next_hist()) ) {
	for ( Int_t bin = 0; bin <= fHistUp->GetNbinsX(); bin++ ) {
	    Double_t BinMax      = fHistUp->GetBinContent(bin);
	    Double_t BinMin      = fHistDown->GetBinContent(bin);

	    Double_t BinContent = hist->GetBinContent(bin);
	    Double_t BinError   = hist->GetBinError(bin);

	    if ( BinContent > BinMax ) {
		fHistUp->SetBinContent(bin, BinContent);
		fHistUp->SetBinError(bin, BinError);
	    }
	    
	    if ( BinContent < BinMin ) {
		fHistDown->SetBinContent(bin, BinContent);
		fHistDown->SetBinError(bin, BinError);
	    }
	}
    }
}

//____________________________________________________________________

void AtlHistFactorySystEnvelope::Clear(Option_t *option) {
    //
    // Close MCPlotter files
    // - Do not close the template file. The class does not own this
    //   file. The owner of this file is responsible of closing it.
    //

    if ( fPlotterFileSyst1 != 0 ) {
	fPlotterFileSyst1->Close();
	delete fPlotterFileSyst1;
	fPlotterFileSyst1 = 0;
    }
    if ( fPlotterFileSyst2 != 0 ) {
	fPlotterFileSyst2->Close();
	delete fPlotterFileSyst2;
	fPlotterFileSyst2 = 0;
    }
    if ( fPlotterFileSyst3 != 0 ) {
	fPlotterFileSyst3->Close();
	delete fPlotterFileSyst3;
	fPlotterFileSyst3 = 0;
    }
    if ( fPlotterFileSyst4 != 0 ) {
	fPlotterFileSyst4->Close();
	delete fPlotterFileSyst4;
	fPlotterFileSyst4 = 0;
    }
    if ( fPlotterFileSyst5 != 0 ) {
	fPlotterFileSyst5->Close();
	delete fPlotterFileSyst5;
	fPlotterFileSyst5 = 0;
    }
    if ( fPlotterFileSyst6 != 0 ) {
	fPlotterFileSyst6->Close();
	delete fPlotterFileSyst6;
	fPlotterFileSyst6 = 0;
    }

    // if ( fPlotterFileNom != 0 ) {
    // 	fPlotterFileNom->Close();
    // 	delete fPlotterFileNom;
    // 	fPlotterFileNom = 0;
    // }

    if ( fHistsSyst1 != 0 ) {
	delete fHistsSyst1;
	fHistsSyst1 = 0;
    }
    if ( fHistsSyst2 != 0 ) {
	delete fHistsSyst2;
	fHistsSyst2 = 0;
    }
    if ( fHistsSyst3 != 0 ) {
	delete fHistsSyst3;
	fHistsSyst3 = 0;
    }
    if ( fHistsSyst4 != 0 ) {
	delete fHistsSyst4;
	fHistsSyst4 = 0;
    }
    if ( fHistsSyst5 != 0 ) {
	delete fHistsSyst5;
	fHistsSyst5 = 0;
    }
    if ( fHistsSyst6 != 0 ) {
	delete fHistsSyst6;
	fHistsSyst6 = 0;
    }

    // if ( fHistsNom != 0 ) {
    // 	delete fHistsNom;
    // 	fHistsNom = 0;
    // }

    fHistUp = 0;
    delete fHistUp;
    fHistDown = 0;
    delete fHistDown;
}
 AtlHistFactorySystEnvelope.cxx:1
 AtlHistFactorySystEnvelope.cxx:2
 AtlHistFactorySystEnvelope.cxx:3
 AtlHistFactorySystEnvelope.cxx:4
 AtlHistFactorySystEnvelope.cxx:5
 AtlHistFactorySystEnvelope.cxx:6
 AtlHistFactorySystEnvelope.cxx:7
 AtlHistFactorySystEnvelope.cxx:8
 AtlHistFactorySystEnvelope.cxx:9
 AtlHistFactorySystEnvelope.cxx:10
 AtlHistFactorySystEnvelope.cxx:11
 AtlHistFactorySystEnvelope.cxx:12
 AtlHistFactorySystEnvelope.cxx:13
 AtlHistFactorySystEnvelope.cxx:14
 AtlHistFactorySystEnvelope.cxx:15
 AtlHistFactorySystEnvelope.cxx:16
 AtlHistFactorySystEnvelope.cxx:17
 AtlHistFactorySystEnvelope.cxx:18
 AtlHistFactorySystEnvelope.cxx:19
 AtlHistFactorySystEnvelope.cxx:20
 AtlHistFactorySystEnvelope.cxx:21
 AtlHistFactorySystEnvelope.cxx:22
 AtlHistFactorySystEnvelope.cxx:23
 AtlHistFactorySystEnvelope.cxx:24
 AtlHistFactorySystEnvelope.cxx:25
 AtlHistFactorySystEnvelope.cxx:26
 AtlHistFactorySystEnvelope.cxx:27
 AtlHistFactorySystEnvelope.cxx:28
 AtlHistFactorySystEnvelope.cxx:29
 AtlHistFactorySystEnvelope.cxx:30
 AtlHistFactorySystEnvelope.cxx:31
 AtlHistFactorySystEnvelope.cxx:32
 AtlHistFactorySystEnvelope.cxx:33
 AtlHistFactorySystEnvelope.cxx:34
 AtlHistFactorySystEnvelope.cxx:35
 AtlHistFactorySystEnvelope.cxx:36
 AtlHistFactorySystEnvelope.cxx:37
 AtlHistFactorySystEnvelope.cxx:38
 AtlHistFactorySystEnvelope.cxx:39
 AtlHistFactorySystEnvelope.cxx:40
 AtlHistFactorySystEnvelope.cxx:41
 AtlHistFactorySystEnvelope.cxx:42
 AtlHistFactorySystEnvelope.cxx:43
 AtlHistFactorySystEnvelope.cxx:44
 AtlHistFactorySystEnvelope.cxx:45
 AtlHistFactorySystEnvelope.cxx:46
 AtlHistFactorySystEnvelope.cxx:47
 AtlHistFactorySystEnvelope.cxx:48
 AtlHistFactorySystEnvelope.cxx:49
 AtlHistFactorySystEnvelope.cxx:50
 AtlHistFactorySystEnvelope.cxx:51
 AtlHistFactorySystEnvelope.cxx:52
 AtlHistFactorySystEnvelope.cxx:53
 AtlHistFactorySystEnvelope.cxx:54
 AtlHistFactorySystEnvelope.cxx:55
 AtlHistFactorySystEnvelope.cxx:56
 AtlHistFactorySystEnvelope.cxx:57
 AtlHistFactorySystEnvelope.cxx:58
 AtlHistFactorySystEnvelope.cxx:59
 AtlHistFactorySystEnvelope.cxx:60
 AtlHistFactorySystEnvelope.cxx:61
 AtlHistFactorySystEnvelope.cxx:62
 AtlHistFactorySystEnvelope.cxx:63
 AtlHistFactorySystEnvelope.cxx:64
 AtlHistFactorySystEnvelope.cxx:65
 AtlHistFactorySystEnvelope.cxx:66
 AtlHistFactorySystEnvelope.cxx:67
 AtlHistFactorySystEnvelope.cxx:68
 AtlHistFactorySystEnvelope.cxx:69
 AtlHistFactorySystEnvelope.cxx:70
 AtlHistFactorySystEnvelope.cxx:71
 AtlHistFactorySystEnvelope.cxx:72
 AtlHistFactorySystEnvelope.cxx:73
 AtlHistFactorySystEnvelope.cxx:74
 AtlHistFactorySystEnvelope.cxx:75
 AtlHistFactorySystEnvelope.cxx:76
 AtlHistFactorySystEnvelope.cxx:77
 AtlHistFactorySystEnvelope.cxx:78
 AtlHistFactorySystEnvelope.cxx:79
 AtlHistFactorySystEnvelope.cxx:80
 AtlHistFactorySystEnvelope.cxx:81
 AtlHistFactorySystEnvelope.cxx:82
 AtlHistFactorySystEnvelope.cxx:83
 AtlHistFactorySystEnvelope.cxx:84
 AtlHistFactorySystEnvelope.cxx:85
 AtlHistFactorySystEnvelope.cxx:86
 AtlHistFactorySystEnvelope.cxx:87
 AtlHistFactorySystEnvelope.cxx:88
 AtlHistFactorySystEnvelope.cxx:89
 AtlHistFactorySystEnvelope.cxx:90
 AtlHistFactorySystEnvelope.cxx:91
 AtlHistFactorySystEnvelope.cxx:92
 AtlHistFactorySystEnvelope.cxx:93
 AtlHistFactorySystEnvelope.cxx:94
 AtlHistFactorySystEnvelope.cxx:95
 AtlHistFactorySystEnvelope.cxx:96
 AtlHistFactorySystEnvelope.cxx:97
 AtlHistFactorySystEnvelope.cxx:98
 AtlHistFactorySystEnvelope.cxx:99
 AtlHistFactorySystEnvelope.cxx:100
 AtlHistFactorySystEnvelope.cxx:101
 AtlHistFactorySystEnvelope.cxx:102
 AtlHistFactorySystEnvelope.cxx:103
 AtlHistFactorySystEnvelope.cxx:104
 AtlHistFactorySystEnvelope.cxx:105
 AtlHistFactorySystEnvelope.cxx:106
 AtlHistFactorySystEnvelope.cxx:107
 AtlHistFactorySystEnvelope.cxx:108
 AtlHistFactorySystEnvelope.cxx:109
 AtlHistFactorySystEnvelope.cxx:110
 AtlHistFactorySystEnvelope.cxx:111
 AtlHistFactorySystEnvelope.cxx:112
 AtlHistFactorySystEnvelope.cxx:113
 AtlHistFactorySystEnvelope.cxx:114
 AtlHistFactorySystEnvelope.cxx:115
 AtlHistFactorySystEnvelope.cxx:116
 AtlHistFactorySystEnvelope.cxx:117
 AtlHistFactorySystEnvelope.cxx:118
 AtlHistFactorySystEnvelope.cxx:119
 AtlHistFactorySystEnvelope.cxx:120
 AtlHistFactorySystEnvelope.cxx:121
 AtlHistFactorySystEnvelope.cxx:122
 AtlHistFactorySystEnvelope.cxx:123
 AtlHistFactorySystEnvelope.cxx:124
 AtlHistFactorySystEnvelope.cxx:125
 AtlHistFactorySystEnvelope.cxx:126
 AtlHistFactorySystEnvelope.cxx:127
 AtlHistFactorySystEnvelope.cxx:128
 AtlHistFactorySystEnvelope.cxx:129
 AtlHistFactorySystEnvelope.cxx:130
 AtlHistFactorySystEnvelope.cxx:131
 AtlHistFactorySystEnvelope.cxx:132
 AtlHistFactorySystEnvelope.cxx:133
 AtlHistFactorySystEnvelope.cxx:134
 AtlHistFactorySystEnvelope.cxx:135
 AtlHistFactorySystEnvelope.cxx:136
 AtlHistFactorySystEnvelope.cxx:137
 AtlHistFactorySystEnvelope.cxx:138
 AtlHistFactorySystEnvelope.cxx:139
 AtlHistFactorySystEnvelope.cxx:140
 AtlHistFactorySystEnvelope.cxx:141
 AtlHistFactorySystEnvelope.cxx:142
 AtlHistFactorySystEnvelope.cxx:143
 AtlHistFactorySystEnvelope.cxx:144
 AtlHistFactorySystEnvelope.cxx:145
 AtlHistFactorySystEnvelope.cxx:146
 AtlHistFactorySystEnvelope.cxx:147
 AtlHistFactorySystEnvelope.cxx:148
 AtlHistFactorySystEnvelope.cxx:149
 AtlHistFactorySystEnvelope.cxx:150
 AtlHistFactorySystEnvelope.cxx:151
 AtlHistFactorySystEnvelope.cxx:152
 AtlHistFactorySystEnvelope.cxx:153
 AtlHistFactorySystEnvelope.cxx:154
 AtlHistFactorySystEnvelope.cxx:155
 AtlHistFactorySystEnvelope.cxx:156
 AtlHistFactorySystEnvelope.cxx:157
 AtlHistFactorySystEnvelope.cxx:158
 AtlHistFactorySystEnvelope.cxx:159
 AtlHistFactorySystEnvelope.cxx:160
 AtlHistFactorySystEnvelope.cxx:161
 AtlHistFactorySystEnvelope.cxx:162
 AtlHistFactorySystEnvelope.cxx:163
 AtlHistFactorySystEnvelope.cxx:164
 AtlHistFactorySystEnvelope.cxx:165
 AtlHistFactorySystEnvelope.cxx:166
 AtlHistFactorySystEnvelope.cxx:167
 AtlHistFactorySystEnvelope.cxx:168
 AtlHistFactorySystEnvelope.cxx:169
 AtlHistFactorySystEnvelope.cxx:170
 AtlHistFactorySystEnvelope.cxx:171
 AtlHistFactorySystEnvelope.cxx:172
 AtlHistFactorySystEnvelope.cxx:173
 AtlHistFactorySystEnvelope.cxx:174
 AtlHistFactorySystEnvelope.cxx:175
 AtlHistFactorySystEnvelope.cxx:176
 AtlHistFactorySystEnvelope.cxx:177
 AtlHistFactorySystEnvelope.cxx:178
 AtlHistFactorySystEnvelope.cxx:179
 AtlHistFactorySystEnvelope.cxx:180
 AtlHistFactorySystEnvelope.cxx:181
 AtlHistFactorySystEnvelope.cxx:182
 AtlHistFactorySystEnvelope.cxx:183
 AtlHistFactorySystEnvelope.cxx:184
 AtlHistFactorySystEnvelope.cxx:185
 AtlHistFactorySystEnvelope.cxx:186
 AtlHistFactorySystEnvelope.cxx:187
 AtlHistFactorySystEnvelope.cxx:188
 AtlHistFactorySystEnvelope.cxx:189
 AtlHistFactorySystEnvelope.cxx:190
 AtlHistFactorySystEnvelope.cxx:191
 AtlHistFactorySystEnvelope.cxx:192
 AtlHistFactorySystEnvelope.cxx:193
 AtlHistFactorySystEnvelope.cxx:194
 AtlHistFactorySystEnvelope.cxx:195
 AtlHistFactorySystEnvelope.cxx:196
 AtlHistFactorySystEnvelope.cxx:197
 AtlHistFactorySystEnvelope.cxx:198
 AtlHistFactorySystEnvelope.cxx:199
 AtlHistFactorySystEnvelope.cxx:200
 AtlHistFactorySystEnvelope.cxx:201
 AtlHistFactorySystEnvelope.cxx:202
 AtlHistFactorySystEnvelope.cxx:203
 AtlHistFactorySystEnvelope.cxx:204
 AtlHistFactorySystEnvelope.cxx:205
 AtlHistFactorySystEnvelope.cxx:206
 AtlHistFactorySystEnvelope.cxx:207
 AtlHistFactorySystEnvelope.cxx:208
 AtlHistFactorySystEnvelope.cxx:209
 AtlHistFactorySystEnvelope.cxx:210
 AtlHistFactorySystEnvelope.cxx:211
 AtlHistFactorySystEnvelope.cxx:212
 AtlHistFactorySystEnvelope.cxx:213
 AtlHistFactorySystEnvelope.cxx:214
 AtlHistFactorySystEnvelope.cxx:215
 AtlHistFactorySystEnvelope.cxx:216
 AtlHistFactorySystEnvelope.cxx:217
 AtlHistFactorySystEnvelope.cxx:218
 AtlHistFactorySystEnvelope.cxx:219
 AtlHistFactorySystEnvelope.cxx:220
 AtlHistFactorySystEnvelope.cxx:221
 AtlHistFactorySystEnvelope.cxx:222
 AtlHistFactorySystEnvelope.cxx:223
 AtlHistFactorySystEnvelope.cxx:224
 AtlHistFactorySystEnvelope.cxx:225
 AtlHistFactorySystEnvelope.cxx:226
 AtlHistFactorySystEnvelope.cxx:227
 AtlHistFactorySystEnvelope.cxx:228
 AtlHistFactorySystEnvelope.cxx:229
 AtlHistFactorySystEnvelope.cxx:230
 AtlHistFactorySystEnvelope.cxx:231
 AtlHistFactorySystEnvelope.cxx:232
 AtlHistFactorySystEnvelope.cxx:233
 AtlHistFactorySystEnvelope.cxx:234
 AtlHistFactorySystEnvelope.cxx:235
 AtlHistFactorySystEnvelope.cxx:236
 AtlHistFactorySystEnvelope.cxx:237
 AtlHistFactorySystEnvelope.cxx:238
 AtlHistFactorySystEnvelope.cxx:239
 AtlHistFactorySystEnvelope.cxx:240
 AtlHistFactorySystEnvelope.cxx:241
 AtlHistFactorySystEnvelope.cxx:242
 AtlHistFactorySystEnvelope.cxx:243
 AtlHistFactorySystEnvelope.cxx:244
 AtlHistFactorySystEnvelope.cxx:245
 AtlHistFactorySystEnvelope.cxx:246
 AtlHistFactorySystEnvelope.cxx:247
 AtlHistFactorySystEnvelope.cxx:248
 AtlHistFactorySystEnvelope.cxx:249
 AtlHistFactorySystEnvelope.cxx:250
 AtlHistFactorySystEnvelope.cxx:251
 AtlHistFactorySystEnvelope.cxx:252
 AtlHistFactorySystEnvelope.cxx:253
 AtlHistFactorySystEnvelope.cxx:254
 AtlHistFactorySystEnvelope.cxx:255
 AtlHistFactorySystEnvelope.cxx:256
 AtlHistFactorySystEnvelope.cxx:257
 AtlHistFactorySystEnvelope.cxx:258
 AtlHistFactorySystEnvelope.cxx:259
 AtlHistFactorySystEnvelope.cxx:260
 AtlHistFactorySystEnvelope.cxx:261
 AtlHistFactorySystEnvelope.cxx:262
 AtlHistFactorySystEnvelope.cxx:263
 AtlHistFactorySystEnvelope.cxx:264
 AtlHistFactorySystEnvelope.cxx:265
 AtlHistFactorySystEnvelope.cxx:266
 AtlHistFactorySystEnvelope.cxx:267
 AtlHistFactorySystEnvelope.cxx:268
 AtlHistFactorySystEnvelope.cxx:269
 AtlHistFactorySystEnvelope.cxx:270
 AtlHistFactorySystEnvelope.cxx:271
 AtlHistFactorySystEnvelope.cxx:272
 AtlHistFactorySystEnvelope.cxx:273
 AtlHistFactorySystEnvelope.cxx:274
 AtlHistFactorySystEnvelope.cxx:275
 AtlHistFactorySystEnvelope.cxx:276
 AtlHistFactorySystEnvelope.cxx:277
 AtlHistFactorySystEnvelope.cxx:278
 AtlHistFactorySystEnvelope.cxx:279
 AtlHistFactorySystEnvelope.cxx:280
 AtlHistFactorySystEnvelope.cxx:281
 AtlHistFactorySystEnvelope.cxx:282
 AtlHistFactorySystEnvelope.cxx:283
 AtlHistFactorySystEnvelope.cxx:284
 AtlHistFactorySystEnvelope.cxx:285
 AtlHistFactorySystEnvelope.cxx:286
 AtlHistFactorySystEnvelope.cxx:287
 AtlHistFactorySystEnvelope.cxx:288
 AtlHistFactorySystEnvelope.cxx:289
 AtlHistFactorySystEnvelope.cxx:290
 AtlHistFactorySystEnvelope.cxx:291
 AtlHistFactorySystEnvelope.cxx:292
 AtlHistFactorySystEnvelope.cxx:293
 AtlHistFactorySystEnvelope.cxx:294
 AtlHistFactorySystEnvelope.cxx:295
 AtlHistFactorySystEnvelope.cxx:296
 AtlHistFactorySystEnvelope.cxx:297
 AtlHistFactorySystEnvelope.cxx:298
 AtlHistFactorySystEnvelope.cxx:299
 AtlHistFactorySystEnvelope.cxx:300
 AtlHistFactorySystEnvelope.cxx:301
 AtlHistFactorySystEnvelope.cxx:302
 AtlHistFactorySystEnvelope.cxx:303
 AtlHistFactorySystEnvelope.cxx:304
 AtlHistFactorySystEnvelope.cxx:305
 AtlHistFactorySystEnvelope.cxx:306
 AtlHistFactorySystEnvelope.cxx:307
 AtlHistFactorySystEnvelope.cxx:308
 AtlHistFactorySystEnvelope.cxx:309
 AtlHistFactorySystEnvelope.cxx:310
 AtlHistFactorySystEnvelope.cxx:311
 AtlHistFactorySystEnvelope.cxx:312
 AtlHistFactorySystEnvelope.cxx:313
 AtlHistFactorySystEnvelope.cxx:314
 AtlHistFactorySystEnvelope.cxx:315
 AtlHistFactorySystEnvelope.cxx:316
 AtlHistFactorySystEnvelope.cxx:317
 AtlHistFactorySystEnvelope.cxx:318
 AtlHistFactorySystEnvelope.cxx:319
 AtlHistFactorySystEnvelope.cxx:320
 AtlHistFactorySystEnvelope.cxx:321
 AtlHistFactorySystEnvelope.cxx:322
 AtlHistFactorySystEnvelope.cxx:323
 AtlHistFactorySystEnvelope.cxx:324
 AtlHistFactorySystEnvelope.cxx:325
 AtlHistFactorySystEnvelope.cxx:326
 AtlHistFactorySystEnvelope.cxx:327
 AtlHistFactorySystEnvelope.cxx:328
 AtlHistFactorySystEnvelope.cxx:329
 AtlHistFactorySystEnvelope.cxx:330
 AtlHistFactorySystEnvelope.cxx:331
 AtlHistFactorySystEnvelope.cxx:332
 AtlHistFactorySystEnvelope.cxx:333
 AtlHistFactorySystEnvelope.cxx:334
 AtlHistFactorySystEnvelope.cxx:335
 AtlHistFactorySystEnvelope.cxx:336
 AtlHistFactorySystEnvelope.cxx:337
 AtlHistFactorySystEnvelope.cxx:338
 AtlHistFactorySystEnvelope.cxx:339
 AtlHistFactorySystEnvelope.cxx:340
 AtlHistFactorySystEnvelope.cxx:341
 AtlHistFactorySystEnvelope.cxx:342
 AtlHistFactorySystEnvelope.cxx:343
 AtlHistFactorySystEnvelope.cxx:344
 AtlHistFactorySystEnvelope.cxx:345
 AtlHistFactorySystEnvelope.cxx:346
 AtlHistFactorySystEnvelope.cxx:347
 AtlHistFactorySystEnvelope.cxx:348
 AtlHistFactorySystEnvelope.cxx:349
 AtlHistFactorySystEnvelope.cxx:350
 AtlHistFactorySystEnvelope.cxx:351
 AtlHistFactorySystEnvelope.cxx:352
 AtlHistFactorySystEnvelope.cxx:353
 AtlHistFactorySystEnvelope.cxx:354
 AtlHistFactorySystEnvelope.cxx:355
 AtlHistFactorySystEnvelope.cxx:356
 AtlHistFactorySystEnvelope.cxx:357
 AtlHistFactorySystEnvelope.cxx:358
 AtlHistFactorySystEnvelope.cxx:359
 AtlHistFactorySystEnvelope.cxx:360
 AtlHistFactorySystEnvelope.cxx:361
 AtlHistFactorySystEnvelope.cxx:362
 AtlHistFactorySystEnvelope.cxx:363
 AtlHistFactorySystEnvelope.cxx:364
 AtlHistFactorySystEnvelope.cxx:365
 AtlHistFactorySystEnvelope.cxx:366
 AtlHistFactorySystEnvelope.cxx:367
 AtlHistFactorySystEnvelope.cxx:368
 AtlHistFactorySystEnvelope.cxx:369
 AtlHistFactorySystEnvelope.cxx:370
 AtlHistFactorySystEnvelope.cxx:371
 AtlHistFactorySystEnvelope.cxx:372
 AtlHistFactorySystEnvelope.cxx:373
 AtlHistFactorySystEnvelope.cxx:374
 AtlHistFactorySystEnvelope.cxx:375
 AtlHistFactorySystEnvelope.cxx:376
 AtlHistFactorySystEnvelope.cxx:377
 AtlHistFactorySystEnvelope.cxx:378
 AtlHistFactorySystEnvelope.cxx:379
 AtlHistFactorySystEnvelope.cxx:380
 AtlHistFactorySystEnvelope.cxx:381
 AtlHistFactorySystEnvelope.cxx:382
 AtlHistFactorySystEnvelope.cxx:383
 AtlHistFactorySystEnvelope.cxx:384
 AtlHistFactorySystEnvelope.cxx:385
 AtlHistFactorySystEnvelope.cxx:386
 AtlHistFactorySystEnvelope.cxx:387
 AtlHistFactorySystEnvelope.cxx:388
 AtlHistFactorySystEnvelope.cxx:389
 AtlHistFactorySystEnvelope.cxx:390
 AtlHistFactorySystEnvelope.cxx:391
 AtlHistFactorySystEnvelope.cxx:392
 AtlHistFactorySystEnvelope.cxx:393
 AtlHistFactorySystEnvelope.cxx:394
 AtlHistFactorySystEnvelope.cxx:395
 AtlHistFactorySystEnvelope.cxx:396
 AtlHistFactorySystEnvelope.cxx:397
 AtlHistFactorySystEnvelope.cxx:398
 AtlHistFactorySystEnvelope.cxx:399
 AtlHistFactorySystEnvelope.cxx:400
 AtlHistFactorySystEnvelope.cxx:401
 AtlHistFactorySystEnvelope.cxx:402
 AtlHistFactorySystEnvelope.cxx:403
 AtlHistFactorySystEnvelope.cxx:404
 AtlHistFactorySystEnvelope.cxx:405
 AtlHistFactorySystEnvelope.cxx:406
 AtlHistFactorySystEnvelope.cxx:407
 AtlHistFactorySystEnvelope.cxx:408
 AtlHistFactorySystEnvelope.cxx:409
 AtlHistFactorySystEnvelope.cxx:410