/////////////////////////////////////////////////////////////////////
//
// This is the base class for coupled channel sampling distributions
//
//                                  Author:  I. Froehlich
/////////////////////////////////////////////////////////////////////


using namespace std;
#include <sstream>
#include <iostream>
#include <iomanip>

#include "PChannelModel.h"


ClassImp(PChannelModel)

PChannelModel::PChannelModel()  {
} ;

PChannelModel::PChannelModel(const Char_t *id, const Char_t *de, Int_t key) :
    PDistribution(id, de) {
    // Constructor for coupled-channel calculations
    // The PChannelModel must be correlated to a key in the PDataBase
    // If "key" < 0, we try to figure out the key by parsing the descriptor

    model_def_key = is_pid = is_channel = -1;
    sec_key = -1;

    makeStaticData();
    SetVersionFlag(VERSION_IS_PRIMARY);
    if (key < 0) {
	//Needs some parser to find out what we need
	char parser_delim[2] = "_";
	char path_delim      = '/';

	if (key == -2) { // new syntax
	    path_delim = '&';
	    strcpy(parser_delim, "#");
	}

	char *arr1[10+2];
	Int_t arr1_s = 12; //max 10 decay products + parent + id

	Int_t alt_position = 0,
	    path_position  = 0;
	for (Int_t i=strlen(id); i>=0; i--) {
	    if (id[i] == '@') 
		alt_position = i;
	}

	if (alt_position) { 
	    alt_position++; //skip "@"
	}

	char *db_id = new char[strlen(id)+1-alt_position];
	strcpy(db_id, &(id[alt_position]));

	for (Int_t i=strlen(id); i>=alt_position; i--) {
	    if (id[i] == path_delim) 
		path_position = i;
	}

	if (path_position) { 
	    path_position++; //skip "/"
	    model_def_key = makeStaticData()->
		MakeDirectoryEntry("modeldef", NMODEL_NAME, LMODEL_NAME, &(id[path_position]));
	    char *nid = new char[strlen(id)+1];
	    strcpy(nid, id);
	    nid[path_position-1] = '\0';
	    id = nid;
	}

	PUtils::Tokenize(&(id[alt_position]), parser_delim, arr1, &arr1_s);

	if (path_position) { 
	    char *nid = new char[strlen(id)+1];
	    strcpy(nid,id);
	    nid[path_position-1] = path_delim;
	    id = nid;
	}

	if ((arr1_s <= 2)) { //Particle
	    //key=makeDataBase()->GetEntry(arr1[0]);
	    key = makeStaticData()->GetParticleKey(arr1[0]);
 	    if (path_position) {
		sec_key = makeStaticData()->GetSecondaryKey(key, model_def_key);
		is_pid  = makeStaticData()->GetParticleIDByKey(key);
		if (sec_key > 0) {
		    key = sec_key;
		} else {
		    key = makeStaticData()->AddAlias(makeStaticData()->
						     GetParticleName(is_pid), db_id);
		    sec_key = key;
		    makeDataBase()->SetParamInt (key, "defkey", &model_def_key);
		}
		ClearVersionFlag(VERSION_IS_PRIMARY);
 	    }
	} else if (arr1_s > 2) { //Decay

	    Int_t arr1_id[10+2];
	    arr1_id[0] = makeStaticData()->GetParticleID(arr1[0]);
	    	   
	    for (int i=1; i<=(arr1_s-2); i++) 
		arr1_id[i] = makeStaticData()->GetParticleID(arr1[i+1]);

	    key = makeStaticData()->GetDecayKey(arr1_id, arr1_s-2);
	    if (key<0) key = makeStaticData()->AddDecay(arr1_id, arr1_s-2);
	    is_channel = makeStaticData()->GetDecayIdxByKey(key);

	    //cout << "parse decay got " << key << endl;

 	    if (path_position) {
		//before we continue here, we have to check if alias
		//for this decay already exists
		sec_key = makeStaticData()->GetSecondaryKey(key, model_def_key);
		if (sec_key > 0) {
		    key = sec_key;
		} else {		    
		    key = makeStaticData()->AddAlias(makeStaticData()->GetDecayNameByKey(key), db_id);
		    //defkey has to be stored for future use!
		    makeDataBase()->SetParamInt (key, "defkey", &model_def_key);
		    sec_key = key;
		}
		ClearVersionFlag(VERSION_IS_PRIMARY);
 	    }

	    //To make life more easy, add "default" track template
 	    Add(arr1[0], "parent");
 	    for (int i=1; i<=(arr1_s-2); i++) 
 		Add(arr1[i+1], "daughter");
 	    preliminary_particles = 1;
	} // end "decay"

	if (alt_position) { 
	    //reset ID:
	    char *newid = new char[alt_position];
	    strncpy(newid, id, alt_position);
	    newid[alt_position-1] = '\0';
	    identifier=newid;
	}
    }

    if (key < 0) {
	Warning("PChannelModel", "Primary key not identified");
    }

    primary_key = key;
    width_init  = 0;
    mesh        = NULL;
    loop_flag   = 0;

    if (sec_key < 0) { //No sec. model
	is_channel = makeStaticData()->GetDecayIdxByKey(key);
	is_pid     = makeStaticData()->GetParticleIDByKey(key);
    } 

    if (is_pid<0 && !is_channel) {
	Warning("PChannelModel", "Undetermined particle for key %i", key);
    }

    mmin = 0;
    mmax = 0;
    Int_t *maxmesh_db;
    if (makeDataBase()->GetParamInt (key, "maxmesh",&maxmesh_db))
	maxmesh = *maxmesh_db;
    else
	maxmesh = 302;

    draw_option = 0;
    didx_option = -1;
    
    //some TF1 defaults...

    //ROOT6
    fNpx  = (maxmesh-1)*3; // 3 interpolation points per meshpoint should be enough
    fNpar = 4;             // Parameter1: Draw mass/width, Parameter2: Draw _specific_ didx for partial decay

    fParErrors.resize(fNpar);
    fParMin.resize(fNpar);
    fParMax.resize(fNpar);
    fParams = new TF1Parameters(fNpar);
    for (int i = 0; i < fNpar; i++) {
	fParErrors[i]  = 0;
	fParMin[i]     = 0;
	fParMax[i]     = 0;
    }
    fParams->SetParName(0, "Drawing option: 0: Weigth, 1:Width, 2: BR");
    fParams->SetParName(1, "0: Total weight, 1:Partial width(didx) for Weight");
    fParams->SetParName(2, "Amplitude(abs) for 1st propagator term for didx");
    fParams->SetParName(3, "Amplitude(phase) for 1st propagator term for didx");
    fParams->SetParameter(0, 0);
    fParams->SetParameter(1, -1);
    fParams->SetParameter(2, 0);
    fParams->SetParameter(3, 0);

#if 0
    //ROOT5
    fNpx       = (maxmesh-1)*3; //3 interpolation points per meshpoint should be enough

    fNpar = 4; //Parameter1: Draw mass/width, Parameter2: Draw _specific_ didx for partial decay
    if (fNpar) {
	fNames      = new TString[fNpar];
	fParams     = new Double_t[fNpar];
	fParErrors  = new Double_t[fNpar];
	fParMin     = new Double_t[fNpar];
	fParMax     = new Double_t[fNpar];
	for (int i = 0; i < fNpar; i++) {
	    fParams[i]     = 0;
	    fParErrors[i]  = 0;
	    fParMin[i]     = 0;
	    fParMax[i]     = 0;
	}
	fNames[0] = "Drawing option: 0: Weigth, 1:Width, 2: BR";
	fNames[1] = "0: Total weight, 1:Partial width(didx) for Weight";
	fNames[2] = "Amplitude(abs) for 1st propagator term for didx";
	fNames[3] = "Amplitude(phase) for 1st propagator term for didx";
    }
    fParams[0] = 0;
    fParams[1] = -1;
    fParams[2] = 0;
    fParams[3] = 0;
#endif

    mc_max = 1000; //for the integration methods in Width-mesh calculation

    if (is_pid >= 0) 
	SetDynamicRange(PData::LMass(is_pid), PData::UMass(is_pid));

    if ((is_channel>=0) && (sec_key<0)) {
	SetDynamicRange(makeStaticData()->GetDecayEmin(is_channel),
			PData::UMass(makeStaticData()->GetDecayParentByKey(key)));
	exp_w_mean = makeStaticData()->GetDecayBR(is_channel);

    }
    didx_param     = makeDataBase()->GetParamInt("didx");
    scfactor_param = makeDataBase()->GetParamDouble("scfactor");
    unstable_width = makeStaticData()->GetBatchValue("_system_unstable_width");
    
};

PDistribution *PChannelModel::Clone(const char *) const {
    return new PChannelModel((const PChannelModel &)* this);
};

PChannelModel *PChannelModel::GetSecondaryModel(const char *name) {
    sec_key = makeStaticData()->MakeDirectoryEntry("modeldef", NMODEL_NAME, LMODEL_NAME, name);
    if (sec_key < 0) return NULL;

    Int_t listkey = makeStaticData()->GetSecondaryKey(primary_key, sec_key);
    if (listkey < 0) return NULL;

    Int_t model_param = makeDataBase()->GetParamTObj("model");
    TObject *t_result = NULL;
    if (makeDataBase()->GetParamTObj (listkey, model_param, &t_result)) {
	if ((((PChannelModel *) t_result) -> GetDef())  == sec_key) {
	    return (PChannelModel *) t_result;
	} else {
	    Warning("GetSecondaryModel", "Consistency check failed");
	    return NULL;
	}
    }
    return NULL;
}

Bool_t PChannelModel::SampleMass(Double_t*,  Int_t*) {
    //Samples the masses of the known decay products (or single particle)
    //Order of particles is the same as in data base
    
    return kFALSE;
}

Double_t PChannelModel::EvalPar(const Double_t *x, const Double_t *params) {
    if (params) {
	draw_option = (int)params[0];
	didx_option = (int)params[1];
    }

    return Eval(x[0]);
}
 
Double_t PChannelModel::Eval(Double_t x, Double_t, Double_t, Double_t) const {
    Double_t res;
    Double_t my_x[11];
    Int_t    my_didx_option[11];
    my_x[0] = x;
    my_didx_option[0] = didx_option;

    if (draw_option == 0) {
	return ((PChannelModel*)this)->GetWeight(my_x, my_didx_option);
	//return res;
    }
    if (draw_option == 1) {
	((PChannelModel*)this)->GetWidth(x, &res, didx_option);
	return res;
    }
    if (draw_option == 2) {
	((PChannelModel*)this)->GetBR(x, &res);
	return res;
    }
    if (draw_option == 3) {
	return ((PChannelModel*)this)->GetAmplitude(my_x, my_didx_option).Re();
    }
    if (draw_option == 4) {
	return ((PChannelModel*)this)->GetAmplitude(my_x, my_didx_option).Im();
    }
    return 0;
}

Double_t PChannelModel::GetWeight(Double_t *mass, Int_t *didx) {
    //Get the weight for the masses of the known decay products 
    //(or single particle)
    //Decay: Order of particles is the same as in data base,
    //mass[0] is the parent mass
    //Single particle: Use only mass[0]

    if (loop_flag > 0) {
	loop_flag = 0;
	return 1.;
    }
    loop_flag++;
    Double_t r = GetAmplitude(mass, didx).Rho2();
    if (loop_flag > 0)
	loop_flag--;
    return r;
}

TComplex PChannelModel::GetAmplitude(Double_t *mass, Int_t *didx) {
    //Get the amplitude for the masses of the known decay products 
    //(or single particle)
    //Decay: Order of particles is the same as in data base,
    //mass[0] is the parent mass
    //Single particle: Use only mass[0]

    if (loop_flag > 0) {
	loop_flag = 0;
	return TComplex (1., 0, kTRUE);
    }
    loop_flag++;
    TComplex r = TComplex(GetWeight(mass,didx), 0, kTRUE);
    if (loop_flag > 0)
	loop_flag--;
    return r;
};

Bool_t PChannelModel::GetWidth(Double_t, Double_t *width, Int_t didx) {
    //Calculates the mass-dependent width (either partial for the decay or
    //total for the particles)
    //If didx is set, use the partial width for a particular target channel

    // Use by default only static values
    if (didx >=0 ) {
	//Do not use the local width
	//but use the partial width only
	*width = makeStaticData()->GetDecayPartialWidth(didx);
	return kTRUE;
    }
    if (is_channel) {
	*width = makeStaticData()->GetDecayPartialWidth(is_channel);
	return kTRUE;
    }
    if (is_pid) {
	*width = makeStaticData()->GetParticleTotalWidth(is_pid);
	return kTRUE;
    }
    return kFALSE;
}

Bool_t PChannelModel::GetBR(Double_t mass, Double_t *br, Double_t totalwidth) {
    //Calculates the mass-dependent br
    //This method is meaningless for particles
    //the totalwidth may be set by the user, otherwise we use the static one

    if (is_pid >= 0)
	return kFALSE;
    
    Double_t lwidth;

    //test if the GetWidth was overloaded
    //if not, simply use the static values
    if (!GetWidth(mass, &lwidth)) {
 	*br = makeStaticData()->GetDecayBR(is_channel);
 	return kTRUE;
    }
    
    //Make everything coherent to Dyn.Data
    Double_t sc = 1.;
    Double_t *scfactor = &sc;

    makeDataBase()->GetParamDouble (didx_param, is_channel , scfactor_param, &scfactor);

    lwidth *= *scfactor;
    //if total width is below unstable width-> static BR
    if (totalwidth < 0.)
	totalwidth = makeStaticData()->GetParticleTotalWidth(makeStaticData()->GetDecayParent(is_channel));

    if (totalwidth <= (*unstable_width)) 
	*br = makeStaticData()->GetDecayBR(is_channel);
    else  {
	//if we have a local width, the BR is the partial width divided by total
	*br = lwidth/totalwidth;
    }
    return kTRUE; 
}

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