// @(#)root/roostats:$Id$
// Author: Kyle Cranmer, George Lewis 
/*************************************************************************
 * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

//_________________________________________________
/*
BEGIN_HTML
<p>
This class encapsulates all information for the statistical interpretation of one experiment.
It can be combined with other channels (e.g. for the combination of multiple experiments, or
to constrain nuisance parameters with information obtained in a control region).
A channel contains one or more samples which describe the contribution from different processes
to this measurement.
</p>
END_HTML
*/
//



#include "RooStats/HistFactory/Channel.h"
#include <stdlib.h>

#include "TFile.h"
#include "TTimeStamp.h"

#include "RooStats/HistFactory/HistFactoryException.h"

using namespace std;

RooStats::HistFactory::Channel::Channel() :
  fName( "" )
{
  // standard constructor
}

RooStats::HistFactory::Channel::Channel(const Channel& other) :
  fName( other.fName ),
  fInputFile( other.fInputFile ),
  fHistoPath( other.fHistoPath ),
  fData( other.fData ),
  fAdditionalData( other.fAdditionalData ),
  fStatErrorConfig( other.fStatErrorConfig ),
  fSamples( other.fSamples )
{ ; }


RooStats::HistFactory::Channel::Channel(std::string ChanName, std::string ChanInputFile) :
  fName( ChanName ), fInputFile( ChanInputFile )
{
  // create channel with given name and input file
}

namespace RooStats{
  namespace HistFactory{
    //BadChannel = Channel();
    Channel BadChannel;
    //    BadChannel.Name = "BadChannel"; // = Channel(); //.Name = "BadChannel";
  }
}


void RooStats::HistFactory::Channel::AddSample( RooStats::HistFactory::Sample sample )
{
  // add fully configured sample to channel
  
  sample.SetChannelName( GetName() );
  fSamples.push_back( sample ); 
}

void RooStats::HistFactory::Channel::Print( std::ostream& stream ) {
  // print information of channel to given stream

  stream << "\t Channel Name: " << fName
	 << "\t InputFile: " << fInputFile
	 << std::endl;

  stream << "\t Data:" << std::endl;
  fData.Print( stream );


  stream << "\t statErrorConfig:" << std::endl;
  fStatErrorConfig.Print( stream );


  if( fSamples.size() != 0 ) {

    stream << "\t Samples: " << std::endl;
    for( unsigned int i = 0; i < fSamples.size(); ++i ) {
      fSamples.at(i).Print( stream );
    }
  }

  
  stream << "\t End of Channel " << fName <<  std::endl;


}  


void RooStats::HistFactory::Channel::PrintXML( std::string directory, std::string prefix ) {

  // Create an XML file for this channel
  std::cout << "Printing XML Files for channel: " << GetName() << std::endl;
  
  std::string XMLName = prefix + fName + ".xml";
  if( directory != "" ) XMLName = directory + "/" + XMLName;
  
  ofstream xml( XMLName.c_str() );

  // Add the time
  xml << "<!--" << std::endl;
  xml << "This xml file created automatically on: " << std::endl;
  // LM: use TTimeStamp since time_t does not work on Windows
  TTimeStamp t; 
  UInt_t year = 0; 
  UInt_t month = 0; 
  UInt_t day = 0; 
  t.GetDate(true, 0, &year, &month, &day);
  xml << year << '-'
      << month << '-'
      << day
      << std::endl;
  xml << "-->" << std::endl;

  // Add the DOCTYPE
  xml << "<!DOCTYPE Channel  SYSTEM 'HistFactorySchema.dtd'>  " << std::endl << std::endl;

  // Add the Channel
  xml << "  <Channel Name=\"" << fName << "\" InputFile=\"" << fInputFile << "\" >" << std::endl << std::endl;

  fData.PrintXML( xml );
  /*
  xml << "    <Data HistoName=\"" << fData.GetHistoName() << "\" "
      << "InputFile=\"" << fData.GetInputFile() << "\" "
      << "HistoPath=\"" << fData.GetHistoPath() << "\" "
      << " /> " << std::endl << std::endl;  
  */

  fStatErrorConfig.PrintXML( xml );
  /*
  xml << "    <StatErrorConfig RelErrorThreshold=\"" << fStatErrorConfig.GetRelErrorThreshold() << "\" "
      << "ConstraintType=\"" << Constraint::Name( fStatErrorConfig.GetConstraintType() ) << "\" "
      << "/> " << std::endl << std::endl;            
  */

  for( unsigned int i = 0; i < fSamples.size(); ++i ) {
    fSamples.at(i).PrintXML( xml );
    xml << std::endl << std::endl;
  }

  xml << std::endl;
  xml << "  </Channel>  " << std::endl;
  xml.close();

  std::cout << "Finished printing XML files" << std::endl;

}



void RooStats::HistFactory::Channel::SetData( std::string DataHistoName, std::string DataInputFile, std::string DataHistoPath ) {
  // set data for this channel by specifying the name of the histogram,
  // the external ROOT file and the path to the histogram inside the ROOT file

  fData.SetHistoName( DataHistoName );
  fData.SetInputFile( DataInputFile );
  fData.SetHistoPath( DataHistoPath );

}



void RooStats::HistFactory::Channel::SetData( TH1* hData ) {
  // set data directly to some histogram
  fData.SetHisto( hData ); 
}

void RooStats::HistFactory::Channel::SetData( double val ) {

  // For a NumberCounting measurement only
  // Set the value of data in a particular channel
  // 
  // Internally, this simply creates a 1-bin TH1F for you

  std::string DataHistName = fName + "_data";
  
  // Histogram has 1-bin (hard-coded)
  TH1F* hData = new TH1F( DataHistName.c_str(), DataHistName.c_str(), 1, 0, 1 );
  hData->SetBinContent( 1, val );

  // Set the histogram of the internally held data
  // node of this channel to this newly created histogram
  SetData( hData );

}


void RooStats::HistFactory::Channel::SetStatErrorConfig( double StatRelErrorThreshold, Constraint::Type StatConstraintType ) {

  fStatErrorConfig.SetRelErrorThreshold( StatRelErrorThreshold );
  fStatErrorConfig.SetConstraintType( StatConstraintType );

}

void RooStats::HistFactory::Channel::SetStatErrorConfig( double StatRelErrorThreshold, std::string StatConstraintType ) {

  fStatErrorConfig.SetRelErrorThreshold( StatRelErrorThreshold );
  fStatErrorConfig.SetConstraintType( Constraint::GetType(StatConstraintType) );

}



void RooStats::HistFactory::Channel::CollectHistograms() {

  // Loop through all Samples and Systematics
  // and collect all necessary histograms

  // Get the Data Histogram:

  if( fData.GetInputFile() != "" ) {
    fData.SetHisto( GetHistogram(fData.GetInputFile(), 
				 fData.GetHistoPath(),
				 fData.GetHistoName()) );
  }

  // Collect any histograms for additional Datasets
  for( unsigned int i=0; i < fAdditionalData.size(); ++i) {
    RooStats::HistFactory::Data& data = fAdditionalData.at(i);
    if( data.GetInputFile() != "" ) {
      data.SetHisto( GetHistogram(data.GetInputFile(), data.GetHistoPath(),data.GetHistoName()) );
    }
  }

  // Get the histograms for the samples:
  for( unsigned int sampItr = 0; sampItr < fSamples.size(); ++sampItr ) {

    RooStats::HistFactory::Sample& sample = fSamples.at( sampItr );


    // Get the nominal histogram:
    std::cout << "Collecting Nominal Histogram" << std::endl;
    TH1* Nominal =  GetHistogram(sample.GetInputFile(),
				 sample.GetHistoPath(),
				 sample.GetHistoName());

    sample.SetHisto( Nominal );


    // Get the StatError Histogram (if necessary)
    if( sample.GetStatError().GetUseHisto() ) {
      sample.GetStatError().SetErrorHist( GetHistogram(sample.GetStatError().GetInputFile(),
						       sample.GetStatError().GetHistoPath(),
						       sample.GetStatError().GetHistoName()) );
    }

      
    // Get the HistoSys Variations:
    for( unsigned int histoSysItr = 0; histoSysItr < sample.GetHistoSysList().size(); ++histoSysItr ) {

      RooStats::HistFactory::HistoSys& histoSys = sample.GetHistoSysList().at( histoSysItr );
	
      histoSys.SetHistoLow( GetHistogram(histoSys.GetInputFileLow(), 
					 histoSys.GetHistoPathLow(),
					 histoSys.GetHistoNameLow()) );
	
      histoSys.SetHistoHigh( GetHistogram(histoSys.GetInputFileHigh(),
					  histoSys.GetHistoPathHigh(),
					  histoSys.GetHistoNameHigh()) );
    } // End Loop over HistoSys


      // Get the HistoFactor Variations:
    for( unsigned int histoFactorItr = 0; histoFactorItr < sample.GetHistoFactorList().size(); ++histoFactorItr ) {

      RooStats::HistFactory::HistoFactor& histoFactor = sample.GetHistoFactorList().at( histoFactorItr );

      histoFactor.SetHistoLow( GetHistogram(histoFactor.GetInputFileLow(), 
					    histoFactor.GetHistoPathLow(),
					    histoFactor.GetHistoNameLow()) );
	
      histoFactor.SetHistoHigh( GetHistogram(histoFactor.GetInputFileHigh(),
					     histoFactor.GetHistoPathHigh(),
					     histoFactor.GetHistoNameHigh()) );
    } // End Loop over HistoFactor


      // Get the ShapeSys Variations:
    for( unsigned int shapeSysItr = 0; shapeSysItr < sample.GetShapeSysList().size(); ++shapeSysItr ) {
	
      RooStats::HistFactory::ShapeSys& shapeSys = sample.GetShapeSysList().at( shapeSysItr );

      shapeSys.SetErrorHist( GetHistogram(shapeSys.GetInputFile(), 
					  shapeSys.GetHistoPath(),
					  shapeSys.GetHistoName()) );
    } // End Loop over ShapeSys

    
    // Get any initial shape for a ShapeFactor
    for( unsigned int shapeFactorItr = 0; shapeFactorItr < sample.GetShapeFactorList().size(); ++shapeFactorItr ) {

      RooStats::HistFactory::ShapeFactor& shapeFactor = sample.GetShapeFactorList().at( shapeFactorItr );

      // Check if we need an InitialShape
      if( shapeFactor.HasInitialShape() ) {
	TH1* hist = GetHistogram( shapeFactor.GetInputFile(), shapeFactor.GetHistoPath(), 
				  shapeFactor.GetHistoName() );
	shapeFactor.SetInitialShape( hist );
      }

    } // End Loop over ShapeFactor

  } // End Loop over Samples

  return;
  
}


bool RooStats::HistFactory::Channel::CheckHistograms() { 

  // Check that all internal histogram pointers
  // are properly configured (ie that they're not NULL)

  try {
  
    if( fData.GetHisto() == NULL && fData.GetInputFile() != "" ) {
      std::cout << "Error: Data Histogram for channel " << GetName() << " is NULL." << std::endl;
      throw hf_exc();
    }

    // Get the histograms for the samples:
    for( unsigned int sampItr = 0; sampItr < fSamples.size(); ++sampItr ) {

      RooStats::HistFactory::Sample& sample = fSamples.at( sampItr );

      // Get the nominal histogram:
      if( sample.GetHisto() == NULL ) {
	std::cout << "Error: Nominal Histogram for sample " << sample.GetName() << " is NULL." << std::endl;
	throw hf_exc();
      } 
      else {

	// Check if any bins are negative
	std::vector<int> NegativeBinNumber;
	std::vector<double> NegativeBinContent;
	TH1* histNominal = sample.GetHisto();
	for(int ibin=1; ibin<=histNominal->GetNbinsX(); ++ibin) {
	  if(histNominal->GetBinContent(ibin) < 0) {
	    NegativeBinNumber.push_back(ibin);
	    NegativeBinContent.push_back(histNominal->GetBinContent(ibin));
	  }
	}
	if(NegativeBinNumber.size()>0) {
	  std::cout << "WARNING: Nominal Histogram " << histNominal->GetName() << " for Sample = " << sample.GetName()
		    << " in Channel = " << GetName() << " has negative entries in bin numbers = ";

	  for(unsigned int ibin=0; ibin<NegativeBinNumber.size(); ++ibin) {
	    if(ibin>0) std::cout << " , " ;
	    std::cout << NegativeBinNumber[ibin] << " : " << NegativeBinContent[ibin] ;
	  }
	  std::cout << std::endl;
	}
	
      }

      // Get the StatError Histogram (if necessary)
      if( sample.GetStatError().GetUseHisto() ) {
	if( sample.GetStatError().GetErrorHist() == NULL ) {
	  std::cout << "Error: Statistical Error Histogram for sample " << sample.GetName() << " is NULL." << std::endl;
	  throw hf_exc();
	}
      }

      
      // Get the HistoSys Variations:
      for( unsigned int histoSysItr = 0; histoSysItr < sample.GetHistoSysList().size(); ++histoSysItr ) {

	RooStats::HistFactory::HistoSys& histoSys = sample.GetHistoSysList().at( histoSysItr );

	if( histoSys.GetHistoLow() == NULL ) {
	  std::cout << "Error: HistoSyst Low for Systematic " << histoSys.GetName() 
		    << " in sample " << sample.GetName() << " is NULL." << std::endl;
	  throw hf_exc();
	}
	if( histoSys.GetHistoHigh() == NULL ) {
	  std::cout << "Error: HistoSyst High for Systematic " << histoSys.GetName() 
		    << " in sample " << sample.GetName() << " is NULL." << std::endl;
	  throw hf_exc();
	}
	
      } // End Loop over HistoSys


      // Get the HistoFactor Variations:
      for( unsigned int histoFactorItr = 0; histoFactorItr < sample.GetHistoFactorList().size(); ++histoFactorItr ) {

	RooStats::HistFactory::HistoFactor& histoFactor = sample.GetHistoFactorList().at( histoFactorItr );

	if( histoFactor.GetHistoLow() == NULL ) {
	  std::cout << "Error: HistoSyst Low for Systematic " << histoFactor.GetName() 
		    << " in sample " << sample.GetName() << " is NULL." << std::endl;
	  throw hf_exc();
	}
	if( histoFactor.GetHistoHigh() == NULL ) {
	  std::cout << "Error: HistoSyst High for Systematic " << histoFactor.GetName() 
		    << " in sample " << sample.GetName() << " is NULL." << std::endl;
	  throw hf_exc();
	}

      } // End Loop over HistoFactor


      // Get the ShapeSys Variations:
      for( unsigned int shapeSysItr = 0; shapeSysItr < sample.GetShapeSysList().size(); ++shapeSysItr ) {
	
	RooStats::HistFactory::ShapeSys& shapeSys = sample.GetShapeSysList().at( shapeSysItr );

	if( shapeSys.GetErrorHist() == NULL ) {
	  std::cout << "Error: HistoSyst High for Systematic " << shapeSys.GetName() 
		    << " in sample " << sample.GetName() << " is NULL." << std::endl;
	  throw hf_exc();
	}

      } // End Loop over ShapeSys

    } // End Loop over Samples

  }
  catch(std::exception& e)
    {
      std::cout << e.what() << std::endl;
      return false;
    }

  return true;




}




TH1* RooStats::HistFactory::Channel::GetHistogram(std::string InputFile, std::string HistoPath, std::string HistoName) {

  std::cout << "Getting histogram. "  
	    << " InputFile " << InputFile
	    << " HistoPath " << HistoPath
	    << " HistoName " << HistoName
	    << std::endl;

  //  TFile* file = TFile::Open( InputFile.c_str() );

  TFile* inFile = TFile::Open( InputFile.c_str() );
  if( !inFile ) {
    std::cout << "Error: Unable to open input file: " << InputFile << std::endl;
    throw hf_exc();
  }

  std::cout << "Opened input file: " << InputFile << ": " << inFile << std::endl;

  std::string HistNameFull = HistoPath + HistoName;

  if( HistoPath != std::string("") ) {
    if( HistoPath[ HistoPath.length()-1 ] != std::string("/") ) {
      std::cout << "WARNING: Histogram path is set to: " << HistoPath
		<< " but it should end with a '/' " << std::endl;
      std::cout << "Total histogram path is now: " << HistNameFull << std::endl;
    }
  }

  TH1* hist = NULL;
  try{
    hist = dynamic_cast<TH1*>( inFile->Get( HistNameFull.c_str() ) );
  }
  catch(std::exception& e)
    {
      std::cout << "Failed to cast object to TH1*" << std::endl;
      std::cout << e.what() << std::endl;
      throw hf_exc();
    }
  if( !hist ) {
    std::cout << "Failed to get histogram: " << HistNameFull
	      << " in file: " << InputFile << std::endl;
    throw hf_exc();
  }


  TH1 * ptr = (TH1 *) hist->Clone();

  if(!ptr){
    std::cerr << "Not all necessary info are set to access the input file. Check your config" << std::endl;
    std::cerr << "filename: " << InputFile
	      << "path: " << HistoPath
	      << "obj: " << HistoName << std::endl;
    throw hf_exc();
  }
  else {
    ptr->SetDirectory(0); //         for the current histogram h
  }

  
#ifdef DEBUG
  std::cout << "Found Histogram: " << HistoName " at address: " << ptr 
	    << " with integral "   << ptr->Integral() << " and mean " << ptr->GetMean() 
	    << std::endl;
#endif


  inFile->Close();

  // Done
  return ptr;

}
 Channel.cxx:1
 Channel.cxx:2
 Channel.cxx:3
 Channel.cxx:4
 Channel.cxx:5
 Channel.cxx:6
 Channel.cxx:7
 Channel.cxx:8
 Channel.cxx:9
 Channel.cxx:10
 Channel.cxx:11
 Channel.cxx:12
 Channel.cxx:13
 Channel.cxx:14
 Channel.cxx:15
 Channel.cxx:16
 Channel.cxx:17
 Channel.cxx:18
 Channel.cxx:19
 Channel.cxx:20
 Channel.cxx:21
 Channel.cxx:22
 Channel.cxx:23
 Channel.cxx:24
 Channel.cxx:25
 Channel.cxx:26
 Channel.cxx:27
 Channel.cxx:28
 Channel.cxx:29
 Channel.cxx:30
 Channel.cxx:31
 Channel.cxx:32
 Channel.cxx:33
 Channel.cxx:34
 Channel.cxx:35
 Channel.cxx:36
 Channel.cxx:37
 Channel.cxx:38
 Channel.cxx:39
 Channel.cxx:40
 Channel.cxx:41
 Channel.cxx:42
 Channel.cxx:43
 Channel.cxx:44
 Channel.cxx:45
 Channel.cxx:46
 Channel.cxx:47
 Channel.cxx:48
 Channel.cxx:49
 Channel.cxx:50
 Channel.cxx:51
 Channel.cxx:52
 Channel.cxx:53
 Channel.cxx:54
 Channel.cxx:55
 Channel.cxx:56
 Channel.cxx:57
 Channel.cxx:58
 Channel.cxx:59
 Channel.cxx:60
 Channel.cxx:61
 Channel.cxx:62
 Channel.cxx:63
 Channel.cxx:64
 Channel.cxx:65
 Channel.cxx:66
 Channel.cxx:67
 Channel.cxx:68
 Channel.cxx:69
 Channel.cxx:70
 Channel.cxx:71
 Channel.cxx:72
 Channel.cxx:73
 Channel.cxx:74
 Channel.cxx:75
 Channel.cxx:76
 Channel.cxx:77
 Channel.cxx:78
 Channel.cxx:79
 Channel.cxx:80
 Channel.cxx:81
 Channel.cxx:82
 Channel.cxx:83
 Channel.cxx:84
 Channel.cxx:85
 Channel.cxx:86
 Channel.cxx:87
 Channel.cxx:88
 Channel.cxx:89
 Channel.cxx:90
 Channel.cxx:91
 Channel.cxx:92
 Channel.cxx:93
 Channel.cxx:94
 Channel.cxx:95
 Channel.cxx:96
 Channel.cxx:97
 Channel.cxx:98
 Channel.cxx:99
 Channel.cxx:100
 Channel.cxx:101
 Channel.cxx:102
 Channel.cxx:103
 Channel.cxx:104
 Channel.cxx:105
 Channel.cxx:106
 Channel.cxx:107
 Channel.cxx:108
 Channel.cxx:109
 Channel.cxx:110
 Channel.cxx:111
 Channel.cxx:112
 Channel.cxx:113
 Channel.cxx:114
 Channel.cxx:115
 Channel.cxx:116
 Channel.cxx:117
 Channel.cxx:118
 Channel.cxx:119
 Channel.cxx:120
 Channel.cxx:121
 Channel.cxx:122
 Channel.cxx:123
 Channel.cxx:124
 Channel.cxx:125
 Channel.cxx:126
 Channel.cxx:127
 Channel.cxx:128
 Channel.cxx:129
 Channel.cxx:130
 Channel.cxx:131
 Channel.cxx:132
 Channel.cxx:133
 Channel.cxx:134
 Channel.cxx:135
 Channel.cxx:136
 Channel.cxx:137
 Channel.cxx:138
 Channel.cxx:139
 Channel.cxx:140
 Channel.cxx:141
 Channel.cxx:142
 Channel.cxx:143
 Channel.cxx:144
 Channel.cxx:145
 Channel.cxx:146
 Channel.cxx:147
 Channel.cxx:148
 Channel.cxx:149
 Channel.cxx:150
 Channel.cxx:151
 Channel.cxx:152
 Channel.cxx:153
 Channel.cxx:154
 Channel.cxx:155
 Channel.cxx:156
 Channel.cxx:157
 Channel.cxx:158
 Channel.cxx:159
 Channel.cxx:160
 Channel.cxx:161
 Channel.cxx:162
 Channel.cxx:163
 Channel.cxx:164
 Channel.cxx:165
 Channel.cxx:166
 Channel.cxx:167
 Channel.cxx:168
 Channel.cxx:169
 Channel.cxx:170
 Channel.cxx:171
 Channel.cxx:172
 Channel.cxx:173
 Channel.cxx:174
 Channel.cxx:175
 Channel.cxx:176
 Channel.cxx:177
 Channel.cxx:178
 Channel.cxx:179
 Channel.cxx:180
 Channel.cxx:181
 Channel.cxx:182
 Channel.cxx:183
 Channel.cxx:184
 Channel.cxx:185
 Channel.cxx:186
 Channel.cxx:187
 Channel.cxx:188
 Channel.cxx:189
 Channel.cxx:190
 Channel.cxx:191
 Channel.cxx:192
 Channel.cxx:193
 Channel.cxx:194
 Channel.cxx:195
 Channel.cxx:196
 Channel.cxx:197
 Channel.cxx:198
 Channel.cxx:199
 Channel.cxx:200
 Channel.cxx:201
 Channel.cxx:202
 Channel.cxx:203
 Channel.cxx:204
 Channel.cxx:205
 Channel.cxx:206
 Channel.cxx:207
 Channel.cxx:208
 Channel.cxx:209
 Channel.cxx:210
 Channel.cxx:211
 Channel.cxx:212
 Channel.cxx:213
 Channel.cxx:214
 Channel.cxx:215
 Channel.cxx:216
 Channel.cxx:217
 Channel.cxx:218
 Channel.cxx:219
 Channel.cxx:220
 Channel.cxx:221
 Channel.cxx:222
 Channel.cxx:223
 Channel.cxx:224
 Channel.cxx:225
 Channel.cxx:226
 Channel.cxx:227
 Channel.cxx:228
 Channel.cxx:229
 Channel.cxx:230
 Channel.cxx:231
 Channel.cxx:232
 Channel.cxx:233
 Channel.cxx:234
 Channel.cxx:235
 Channel.cxx:236
 Channel.cxx:237
 Channel.cxx:238
 Channel.cxx:239
 Channel.cxx:240
 Channel.cxx:241
 Channel.cxx:242
 Channel.cxx:243
 Channel.cxx:244
 Channel.cxx:245
 Channel.cxx:246
 Channel.cxx:247
 Channel.cxx:248
 Channel.cxx:249
 Channel.cxx:250
 Channel.cxx:251
 Channel.cxx:252
 Channel.cxx:253
 Channel.cxx:254
 Channel.cxx:255
 Channel.cxx:256
 Channel.cxx:257
 Channel.cxx:258
 Channel.cxx:259
 Channel.cxx:260
 Channel.cxx:261
 Channel.cxx:262
 Channel.cxx:263
 Channel.cxx:264
 Channel.cxx:265
 Channel.cxx:266
 Channel.cxx:267
 Channel.cxx:268
 Channel.cxx:269
 Channel.cxx:270
 Channel.cxx:271
 Channel.cxx:272
 Channel.cxx:273
 Channel.cxx:274
 Channel.cxx:275
 Channel.cxx:276
 Channel.cxx:277
 Channel.cxx:278
 Channel.cxx:279
 Channel.cxx:280
 Channel.cxx:281
 Channel.cxx:282
 Channel.cxx:283
 Channel.cxx:284
 Channel.cxx:285
 Channel.cxx:286
 Channel.cxx:287
 Channel.cxx:288
 Channel.cxx:289
 Channel.cxx:290
 Channel.cxx:291
 Channel.cxx:292
 Channel.cxx:293
 Channel.cxx:294
 Channel.cxx:295
 Channel.cxx:296
 Channel.cxx:297
 Channel.cxx:298
 Channel.cxx:299
 Channel.cxx:300
 Channel.cxx:301
 Channel.cxx:302
 Channel.cxx:303
 Channel.cxx:304
 Channel.cxx:305
 Channel.cxx:306
 Channel.cxx:307
 Channel.cxx:308
 Channel.cxx:309
 Channel.cxx:310
 Channel.cxx:311
 Channel.cxx:312
 Channel.cxx:313
 Channel.cxx:314
 Channel.cxx:315
 Channel.cxx:316
 Channel.cxx:317
 Channel.cxx:318
 Channel.cxx:319
 Channel.cxx:320
 Channel.cxx:321
 Channel.cxx:322
 Channel.cxx:323
 Channel.cxx:324
 Channel.cxx:325
 Channel.cxx:326
 Channel.cxx:327
 Channel.cxx:328
 Channel.cxx:329
 Channel.cxx:330
 Channel.cxx:331
 Channel.cxx:332
 Channel.cxx:333
 Channel.cxx:334
 Channel.cxx:335
 Channel.cxx:336
 Channel.cxx:337
 Channel.cxx:338
 Channel.cxx:339
 Channel.cxx:340
 Channel.cxx:341
 Channel.cxx:342
 Channel.cxx:343
 Channel.cxx:344
 Channel.cxx:345
 Channel.cxx:346
 Channel.cxx:347
 Channel.cxx:348
 Channel.cxx:349
 Channel.cxx:350
 Channel.cxx:351
 Channel.cxx:352
 Channel.cxx:353
 Channel.cxx:354
 Channel.cxx:355
 Channel.cxx:356
 Channel.cxx:357
 Channel.cxx:358
 Channel.cxx:359
 Channel.cxx:360
 Channel.cxx:361
 Channel.cxx:362
 Channel.cxx:363
 Channel.cxx:364
 Channel.cxx:365
 Channel.cxx:366
 Channel.cxx:367
 Channel.cxx:368
 Channel.cxx:369
 Channel.cxx:370
 Channel.cxx:371
 Channel.cxx:372
 Channel.cxx:373
 Channel.cxx:374
 Channel.cxx:375
 Channel.cxx:376
 Channel.cxx:377
 Channel.cxx:378
 Channel.cxx:379
 Channel.cxx:380
 Channel.cxx:381
 Channel.cxx:382
 Channel.cxx:383
 Channel.cxx:384
 Channel.cxx:385
 Channel.cxx:386
 Channel.cxx:387
 Channel.cxx:388
 Channel.cxx:389
 Channel.cxx:390
 Channel.cxx:391
 Channel.cxx:392
 Channel.cxx:393
 Channel.cxx:394
 Channel.cxx:395
 Channel.cxx:396
 Channel.cxx:397
 Channel.cxx:398
 Channel.cxx:399
 Channel.cxx:400
 Channel.cxx:401
 Channel.cxx:402
 Channel.cxx:403
 Channel.cxx:404
 Channel.cxx:405
 Channel.cxx:406
 Channel.cxx:407
 Channel.cxx:408
 Channel.cxx:409
 Channel.cxx:410
 Channel.cxx:411
 Channel.cxx:412
 Channel.cxx:413
 Channel.cxx:414
 Channel.cxx:415
 Channel.cxx:416
 Channel.cxx:417
 Channel.cxx:418
 Channel.cxx:419
 Channel.cxx:420
 Channel.cxx:421
 Channel.cxx:422
 Channel.cxx:423
 Channel.cxx:424
 Channel.cxx:425
 Channel.cxx:426
 Channel.cxx:427
 Channel.cxx:428
 Channel.cxx:429
 Channel.cxx:430
 Channel.cxx:431
 Channel.cxx:432
 Channel.cxx:433
 Channel.cxx:434
 Channel.cxx:435
 Channel.cxx:436
 Channel.cxx:437
 Channel.cxx:438
 Channel.cxx:439
 Channel.cxx:440
 Channel.cxx:441
 Channel.cxx:442
 Channel.cxx:443
 Channel.cxx:444
 Channel.cxx:445
 Channel.cxx:446
 Channel.cxx:447
 Channel.cxx:448
 Channel.cxx:449
 Channel.cxx:450
 Channel.cxx:451
 Channel.cxx:452
 Channel.cxx:453
 Channel.cxx:454
 Channel.cxx:455
 Channel.cxx:456
 Channel.cxx:457
 Channel.cxx:458
 Channel.cxx:459
 Channel.cxx:460
 Channel.cxx:461
 Channel.cxx:462
 Channel.cxx:463
 Channel.cxx:464
 Channel.cxx:465
 Channel.cxx:466
 Channel.cxx:467
 Channel.cxx:468
 Channel.cxx:469
 Channel.cxx:470
 Channel.cxx:471
 Channel.cxx:472
 Channel.cxx:473
 Channel.cxx:474
 Channel.cxx:475
 Channel.cxx:476
 Channel.cxx:477
 Channel.cxx:478
 Channel.cxx:479
 Channel.cxx:480
 Channel.cxx:481
 Channel.cxx:482
 Channel.cxx:483
 Channel.cxx:484
 Channel.cxx:485
 Channel.cxx:486
 Channel.cxx:487
 Channel.cxx:488
 Channel.cxx:489
 Channel.cxx:490
 Channel.cxx:491
 Channel.cxx:492
 Channel.cxx:493
 Channel.cxx:494
 Channel.cxx:495
 Channel.cxx:496
 Channel.cxx:497
 Channel.cxx:498
 Channel.cxx:499
 Channel.cxx:500
 Channel.cxx:501
 Channel.cxx:502
 Channel.cxx:503
 Channel.cxx:504
 Channel.cxx:505
 Channel.cxx:506
 Channel.cxx:507
 Channel.cxx:508
 Channel.cxx:509
 Channel.cxx:510
 Channel.cxx:511
 Channel.cxx:512
 Channel.cxx:513
 Channel.cxx:514
 Channel.cxx:515
 Channel.cxx:516
 Channel.cxx:517
 Channel.cxx:518
 Channel.cxx:519
 Channel.cxx:520
 Channel.cxx:521
 Channel.cxx:522
 Channel.cxx:523
 Channel.cxx:524