source: trunk/MagicSoft/Mars/mfilter/MFMagicCuts.cc@ 8648

Last change on this file since 8648 was 8646, checked in by tbretz, 18 years ago
*** empty log message ***
File size: 21.2 KB
Line 
1/* ======================================================================== *\
2!
3! *
4! * This file is part of MARS, the MAGIC Analysis and Reconstruction
5! * Software. It is distributed to you in the hope that it can be a useful
6! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
7! * It is distributed WITHOUT ANY WARRANTY.
8! *
9! * Permission to use, copy, modify and distribute this software and its
10! * documentation for any purpose is hereby granted without fee,
11! * provided that the above copyright notice appear in all copies and
12! * that both that copyright notice and this permission notice appear
13! * in supporting documentation. It is provided "as is" without express
14! * or implied warranty.
15! *
16!
17!
18! Author(s): Thomas Bretz, 03/2005 <mailto:tbretz@astro.uni-wuerzburg.de>
19!
20! Copyright: MAGIC Software Development, 2000-2007
21!
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26//
27// MFMagicCuts
28//
29// Predefinitions:
30// ---------------
31// width/length = MHillas.fWidth/MHillas.fLength
32// area = MHillas.GetArea*fMm2Deg*fMm2Deg
33// lgsize = log10(MHillas.fSize)
34//
35// leakage1 = log10(MNewImagePar.fLeakage1+1)
36//
37// alpha = MHillasSrc.fAlpha
38// dist = MHillasSrc.fDist*fMm2Deg
39// m3long = MHillasExt.fM3Long*sign(MHillasSrc.fCosDeltaAlpha)*fMm2Deg
40// slope = MHillasExt.fSlopeLong*sign(MHillasSrc.fCosDeltaAlpha)/fMm2Deg
41//
42// antialpha = MHillasSrcAnti.fAlpha
43// antidist = MHillasSrcAnti.fDist*fMm2Deg
44// antim3long = MHillasExt.fM3Long*sign(MHillasSrcAnti.fCosDeltaAlpha)*fMm2Deg
45// antislope = MHillasExt.fSlopeLong*sign(MHillasSrcAnti.fCosDeltaAlpha)/fMm2Deg
46//
47// had = Hadronness.fVal
48//
49// Coefficients/Cuts:
50// ------------------
51//
52// c[0], c[5], c[6], c[7], c[8], c[9]:
53// xi = c[0] + c[8]*slope + c[9]*leak +
54// (lgsize>c[10])*c[11]*(lgsize-c[10])^2;
55// p = xi*(1-width/length);
56// sign1 = m3long-c[5]
57// sign2 = (dist-c[7])*c[6]-slope
58// disp = sign1<0 ||sign2<0 ? -disp : disp
59// thetasq = disp^2 + dist^2 - 2*disp*dist*alpha
60//
61// And the values with respect to the antisource position respectively.
62//
63//
64// c[1]:
65// thetasq < c[1]*c[1]
66//
67// AreaCut:
68// c[2], c[3], c[4]:
69// A = c[2]*(1 - c[4]*(lgsize-c[3])*(lgsize-c[3]))
70// area < A
71//
72// HadronnessCut:
73// c[13], c[14]:
74// had <= c[13]
75// 10^lgsize >= c[14]
76//
77//
78// Options:
79// --------
80//
81// HadronnessCut:
82// - none/nocut: No area cut
83// - area: Area cut <default>
84// - hadronness: Cut in size and hadronness (c[10], c[11])
85// - all: area + hadronness
86//
87// ThetaCut:
88// - none/nocut: no theta cut <default>
89// - on: cut in theta only
90// - off: anti-cut in anti-theta only
91// - wobble: same as on|off (both)
92//
93// CalcDisp:
94// - yes: Disp is calculated as defined above <default>
95// - no: abs(Disp.fVal) from the parameter list is used instead
96//
97// CalcGhostbuster:
98// - yes: The ghostbuster is calculated as defined above <default>
99// - no: Ghostbuster.fVal<c[12] is used as ghostbusting condition
100//
101// Input Container:
102// ------
103// MGeomCam
104// MHillas
105// MHillasExt
106// MNewImagePar
107// MHillasSrc
108// [MHillasSrcAnti [MHillasSrc]]
109// [Disp [MParameterD]]
110// [Ghostbuster [MParameterD]]
111//
112// Output:
113// -------
114// ThetaSquared [MParameterD] // stores thetasq
115// Disp [MParameterD] // stores -p*sign(MHillasSrc.fCosDeltaAlpha)
116// ThetaSquaredCut [MParameterD] // stores c[1]*c[1]
117//
118/////////////////////////////////////////////////////////////////////////////
119#include "MFMagicCuts.h"
120
121#include <fstream>
122#include <errno.h>
123
124#include "MHMatrix.h"
125
126#include "MLog.h"
127#include "MLogManip.h"
128
129#include "MMath.h"
130
131#include "MParList.h"
132
133#include "MGeomCam.h"
134#include "MHillas.h"
135#include "MHillasSrc.h"
136#include "MHillasExt.h"
137#include "MNewImagePar.h"
138#include "MParameters.h"
139
140ClassImp(MFMagicCuts);
141
142using namespace std;
143
144// --------------------------------------------------------------------------
145//
146// constructor
147//
148MFMagicCuts::MFMagicCuts(const char *name, const char *title)
149 : fHil(0), fHilSrc(0), fHilAnti(0), fHilExt(0), fNewImgPar(0),
150 fThetaSq(0), fDisp(0), fHadronness(0), fMatrix(0), fVariables(20),
151 fThetaCut(kNone), fHadronnessCut(kArea), fCalcDisp(kTRUE),
152 fCalcGhostbuster(kTRUE)
153{
154 fName = name ? name : "MFMagicCuts";
155 fTitle = title ? title : "Class to evaluate the MagicCuts";
156
157 fMatrix = NULL;
158
159 AddToBranchList("MHillas.fWidth");
160 AddToBranchList("MHillas.fLength");
161 AddToBranchList("MHillas.fSize");
162 AddToBranchList("MHillasSrc.fAlpha");
163 AddToBranchList("MHillasSrc.fDist");
164 AddToBranchList("MHillasSrc.fCosDeltaAlpha");
165 AddToBranchList("MHillasSrcAnti.fAlpha");
166 AddToBranchList("MHillasSrcAnti.fDist");
167 AddToBranchList("MHillasSrcAnti.fCosDeltaAlpha");
168 AddToBranchList("MHillasExt.fM3Long");
169 AddToBranchList("MHillasExt.fSlopeLong");
170 AddToBranchList("MNewImagePar.fLeakage1");
171 AddToBranchList("Hadronness.fVal");
172 AddToBranchList("Disp.fVal");
173 AddToBranchList("Ghostbuster.fVal");
174}
175
176// --------------------------------------------------------------------------
177//
178// The theta cut value GetThetaSqCut() is propageted to the parameter list
179// as 'ThetaSquaredCut' as MParameterD so that it can be used somewhere else.
180//
181Int_t MFMagicCuts::PreProcess(MParList *pList)
182{
183 MGeomCam *cam = (MGeomCam*)pList->FindObject("MGeomCam");
184 if (!cam)
185 {
186 *fLog << err << "MGeomCam not found... aborting." << endl;
187 return kFALSE;
188 }
189
190 fMm2Deg = cam->GetConvMm2Deg();
191
192 fThetaSq = (MParameterD*)pList->FindCreateObj("MParameterD", "ThetaSquared");
193 if (!fThetaSq)
194 return kFALSE;
195
196 if (!fCalcDisp)
197 fDisp = (MParameterD*)pList->FindObject("Disp", "MParameterD");
198 else
199 fDisp = (MParameterD*)pList->FindCreateObj("MParameterD", "Disp");
200 if (!fDisp)
201 {
202 *fLog << err << "Disp [MParameterD] not found... aborting." << endl;
203 return kFALSE;
204 }
205
206 if (!fCalcGhostbuster)
207 fGhostbuster = (MParameterD*)pList->FindObject("Ghostbuster", "MParameterD");
208 else
209 fGhostbuster = (MParameterD*)pList->FindCreateObj("MParameterD", "Ghostbuster");
210 if (!fGhostbuster)
211 {
212 *fLog << err << "Ghostbuster [MParameterD] not found... aborting." << endl;
213 return kFALSE;
214 }
215
216 // propagate Theta cut to the parameter list
217 // so that it can be used somewhere else
218 MParameterD *thetacut = (MParameterD*)pList->FindCreateObj("MParameterD", "ThetaSquaredCut");
219 if (!thetacut)
220 return kFALSE;
221 thetacut->SetVal(GetThetaSqCut());
222
223 Print();
224
225 if (fMatrix)
226 return kTRUE;
227
228 //-----------------------------------------------------------
229
230 fHil = (MHillas*)pList->FindObject("MHillas");
231 if (!fHil)
232 {
233 *fLog << err << "MHillas not found... aborting." << endl;
234 return kFALSE;
235 }
236
237 fHilExt = (MHillasExt*)pList->FindObject("MHillasExt");
238 if (!fHilExt)
239 {
240 *fLog << err << "MHillasExt not found... aborting." << endl;
241 return kFALSE;
242 }
243
244 fNewImgPar = (MNewImagePar*)pList->FindObject("MNewImagePar");
245 if (!fNewImgPar)
246 {
247 *fLog << err << "MNewImagePar not found... aborting." << endl;
248 return kFALSE;
249 }
250
251 fHilSrc = (MHillasSrc*)pList->FindObject("MHillasSrc");
252 if (!fHilSrc)
253 {
254 *fLog << err << "MHillasSrc not found... aborting." << endl;
255 return kFALSE;
256 }
257
258 if (fThetaCut&kOff)
259 {
260 fHilAnti = (MHillasSrc*)pList->FindObject("MHillasSrcAnti", "MHillasSrc");
261 if (!fHilAnti)
262 {
263 *fLog << warn << "MHillasSrcAnti [MHillasSrc] not found... aborting." << endl;
264 return kFALSE;
265 }
266 }
267
268 if (fHadronnessCut&kHadronness)
269 {
270 fHadronness = (MParameterD*)pList->FindObject("Hadronness", "MParameterD");
271 if (!fHadronness)
272 {
273 *fLog << warn << "Hadronness [MParameterD] not found... aborting." << endl;
274 return kFALSE;
275 }
276 }
277
278 return kTRUE;
279}
280
281// --------------------------------------------------------------------------
282//
283// Returns the mapped value from the Matrix
284//
285Double_t MFMagicCuts::GetVal(Int_t i) const
286{
287 return (*fMatrix)[fMap[i]];
288}
289
290// --------------------------------------------------------------------------
291//
292// You can use this function if you want to use a MHMatrix instead of the
293// given containers. This function adds all necessary columns to the
294// given matrix. Afterward you should fill the matrix with the corresponding
295// data (eg from a file by using MHMatrix::Fill). If you now loop
296// through the matrix (eg using MMatrixLoop) MEnergyEstParam::Process
297// will take the values from the matrix instead of the containers.
298//
299void MFMagicCuts::InitMapping(MHMatrix *mat)
300{
301 if (fMatrix)
302 return;
303
304 fMatrix = mat;
305
306// fMap[kELength] = fMatrix->AddColumn("MHillas.fLength*MGeomCam.fConvMm2Deg");
307// fMap[kEWidth] = fMatrix->AddColumn("MHillas.fWidth*MGeomCam.fConvMm2Deg");
308
309 fMap[kEWdivL] = fMatrix->AddColumn("MHillas.fWidth/MHillas.fLength");
310 fMap[kESize] = fMatrix->AddColumn("log10(MHillas.fSize)");
311 fMap[kEArea] = fMatrix->AddColumn("MHillas.GetArea*MGeomCam.fConvMm2Deg*MGeomCam.fConvMm2Deg");
312
313 fMap[kELeakage] = fMatrix->AddColumn("log10(MNewImagePar.fLeakage1+1)");
314
315 fMap[kEAlpha] = fMatrix->AddColumn("MHillasSrc.fAlpha");
316 fMap[kEDist] = fMatrix->AddColumn("MHillasSrc.fDist*MGeomCam.fConvMm2Deg");
317 fMap[kEM3Long] = fMatrix->AddColumn("MHillasExt.fM3Long*sign(MHillasSrc.fCosDeltaAlpha)*MGeomCam.fConvMm2Deg");
318
319 fMap[kESign] = fMatrix->AddColumn("sign(MHillasSrc.fCosDeltaAlpha)");
320
321 fMap[kESlope] = fMatrix->AddColumn("MHillasExt.fSlopeLong*sign(MHillasSrc.fCosDeltaAlpha)/MGeomCam.fConvMm2Deg");
322
323 if (!fCalcDisp)
324 fMap[kEDisp] = fMatrix->AddColumn("abs(Disp.fVal)");
325
326 if (!fCalcGhostbuster)
327 fMap[kEGhostbuster] = fMatrix->AddColumn("Ghostbuster.fVal");
328
329 if (fThetaCut&kOff)
330 {
331 fMap[kEAlphaAnti] = fMatrix->AddColumn("MHillasSrcAnti.fAlpha");
332 fMap[kEDistAnti] = fMatrix->AddColumn("MHillasSrcAnti.fDist*MGeomCam.fConvMm2Deg");
333 fMap[kEM3LongAnti] = fMatrix->AddColumn("MHillasExt.fM3Long*sign(MHillasSrcAnti.fCosDeltaAlpha)*MGeomCam.fConvMm2Deg");
334 fMap[kESlopeAnti] = fMatrix->AddColumn("MHillasExt.fSlopeLong*sign(MHillasSrcAnti.fCosDeltaAlpha)/MGeomCam.fConvMm2Deg");
335 }
336
337 if (fHadronnessCut&kHadronness)
338 fMap[kEHadronness] = fMatrix->AddColumn("Hadronness.fVal");
339}
340
341// --------------------------------------------------------------------------
342//
343// Returns theta squared based on the formula:
344// p := c*(1-width/length)
345// return d*d + p*p - 2*d*p*cos(a*TMath::DegToRad());
346//
347// If par!=NULL p is stored in this MParameterD
348//
349Double_t MFMagicCuts::GetThetaSq(Double_t p, Double_t d, Double_t a) const
350{
351 // wl = width/l [1]
352 // d = dist [deg]
353 // a = alpha [deg]
354 return d*d + p*p - 2*d*p*TMath::Cos(a*TMath::DegToRad());
355}
356
357// --------------------------------------------------------------------------
358//
359// Returns squared cut value in theta: fVariables[1]^2
360//
361Double_t MFMagicCuts::GetThetaSqCut() const
362{
363 return fVariables[1]*fVariables[1];
364}
365
366// --------------------------------------------------------------------------
367//
368// Return abs(Disp.fVal) if disp calculation is switched off.
369// Otherwise return (c0+c6*leak^c7)*(1-width/length)
370//
371Double_t MFMagicCuts::GetDisp(Double_t slope, Double_t lgsize) const
372{
373 if (!fCalcDisp)
374 return fMatrix ? GetVal(kEDisp) : TMath::Abs(fDisp->GetVal());
375
376 // Get some variables
377 const Double_t wdivl = fMatrix ? GetVal(kEWdivL) : fHil->GetWidth()/fHil->GetLength();
378 const Double_t leak = fMatrix ? GetVal(kELeakage) : TMath::Log10(fNewImgPar->GetLeakage1()+1);
379
380 // For simplicity
381 const Double_t *c = fVariables.GetArray();
382
383 // As rule for root or MDataPhrase:
384 // ((M[3]>[3])*[4]*(M[3]-[3])^2 + [2]*M[2] + [1]*M[1] + [0])*M[0]
385 //
386 Double_t xi = c[0] + c[8]*slope + c[9]*leak;
387 if (lgsize>c[10])
388 xi += (lgsize-c[10])*(lgsize-c[10])*c[11];
389
390 const Double_t disp = xi*(1-wdivl);
391
392 return disp;
393}
394
395Bool_t MFMagicCuts::IsGhost(Double_t m3long, Double_t slope, Double_t dist) const
396{
397 // For simplicity
398 const Double_t *c = fVariables.GetArray();
399
400 if (!fCalcGhostbuster)
401 return (fMatrix ? GetVal(kEGhostbuster) : fGhostbuster->GetVal())<c[12];
402
403 // Do Ghostbusting with slope and m3l
404 const Bool_t sign1 = m3long < c[5];
405 const Bool_t sign2 = slope > (dist-c[7])*c[6];
406
407 return sign1 || sign2;
408}
409
410// ---------------------------------------------------------------------------
411//
412// Evaluate dynamical magic-cuts
413//
414Int_t MFMagicCuts::Process()
415{
416 // For simplicity
417 const Double_t *c = fVariables.GetArray();
418
419 // Default if we return before the end
420 fResult = kFALSE;
421
422 // Value for Theta cut (Disp parametrization)
423 const Double_t cut = GetThetaSqCut();
424
425 // ------------------- Most efficient cut -----------------------
426 // ---------------------- Theta cut ON --------------------------
427 const Double_t dist = fMatrix ? GetVal(kEDist) : fHilSrc->GetDist()*fMm2Deg;
428 const Double_t alpha = fMatrix ? GetVal(kEAlpha) : fHilSrc->GetAlpha();
429 const Double_t m3long = fMatrix ? GetVal(kEM3Long) : fHilExt->GetM3Long()*TMath::Sign(fMm2Deg, fHilSrc->GetCosDeltaAlpha());
430 const Double_t slope = fMatrix ? GetVal(kESlope) : fHilExt->GetSlopeLong()/TMath::Sign(fMm2Deg, fHilSrc->GetCosDeltaAlpha());
431 const Double_t sign = fMatrix ? GetVal(kESign) : MMath::Sgn(fHilSrc->GetCosDeltaAlpha());
432 const Double_t lgsize = fMatrix ? GetVal(kESize) : TMath::Log10(fHil->GetSize());
433
434 // Calculate disp including sign
435 const Double_t disp = GetDisp(slope, lgsize);
436 const Double_t ghost = IsGhost(m3long, slope, dist);
437
438 const Double_t p = ghost ? -disp : disp;
439
440 // Align sign of disp along shower axis like m3long
441 fDisp->SetVal(-p*sign);
442
443 // Calculate corresponding Theta^2
444 const Double_t thetasq = GetThetaSq(p, dist, alpha);
445 fThetaSq->SetVal(thetasq);
446
447 // Perform theta cut
448 if (fThetaCut&kOn && thetasq >= cut)
449 return kTRUE;
450
451 // --------------------- Efficient cut -------------------------
452 // ---------------------- Area/M3l cut --------------------------
453 if (fHadronnessCut&kArea)
454 {
455 const Double_t area = fMatrix ? GetVal(kEArea) : fHil->GetArea()*fMm2Deg*fMm2Deg;
456 const Double_t A = lgsize>c[3] ? c[2] : c[2]*(1 - c[4]*(lgsize-c[3])*(lgsize-c[3]));
457 if (area>=A)
458 return kTRUE;
459 }
460
461 // ---------------------------------------------------------------
462 // ---------------------------------------------------------------
463
464 if (fHadronnessCut&kHadronness)
465 {
466 const Double_t had = fMatrix ? GetVal(kEHadronness) : fHadronness->GetVal();
467 if (had>c[13])
468 return kTRUE;
469
470 if (TMath::Power(10, lgsize)<c[14])
471 return kTRUE;
472 }
473
474 // ------------------- Least efficient cut -----------------------
475 // ---------------------- Theta cut OFF --------------------------
476
477 if (fThetaCut&kOff)
478 {
479 const Double_t distanti = fMatrix ? GetVal(kEDistAnti) : fHilAnti->GetDist()*fMm2Deg;
480 const Double_t alphaanti = fMatrix ? GetVal(kEAlphaAnti) : fHilAnti->GetAlpha();
481 const Double_t m3lanti = fMatrix ? GetVal(kEM3LongAnti) : fHilExt->GetM3Long()*TMath::Sign(fMm2Deg, fHilAnti->GetCosDeltaAlpha());
482 const Double_t slopeanti = fMatrix ? GetVal(kESlopeAnti) : fHilExt->GetSlopeLong()/TMath::Sign(fMm2Deg, fHilAnti->GetCosDeltaAlpha());
483
484 const Double_t dispanti = GetDisp(slopeanti, lgsize);
485 const Double_t ghostanti = IsGhost(m3lanti, slopeanti, lgsize);
486
487 const Double_t panti = ghostanti ? -dispanti : dispanti;
488
489 // Align disp along source direction depending on third moment
490 const Double_t thetasqanti = GetThetaSq(panti, distanti, alphaanti);
491
492 if (thetasqanti<cut)
493 return kTRUE;
494
495 // This cut throws away gamma-like events which would be assigned to the
496 // anti-source. It is not necessary but it offers the possibility to
497 // fill the MHDisp plot in one run (Having a hole instead of eg. Crab
498 // the data can be rotated and subtracted)
499 }
500
501 fResult = kTRUE;
502
503 return kTRUE;
504}
505
506void MFMagicCuts::SetVariables(const TArrayD &arr)
507{
508 fVariables = arr;
509}
510
511TString MFMagicCuts::GetParam(Int_t i) const
512{
513 if (i>=fVariables.GetSize())
514 return "";
515
516 return Form("Param[%2d]=%+f", i, fVariables[i]);
517}
518
519void MFMagicCuts::Print(Option_t *o) const
520{
521 *fLog << all << GetDescriptor() << ":" << setiosflags(ios::left) << endl;
522
523 *fLog << "Using Theta cut: ";
524 switch (fThetaCut)
525 {
526 case kNone:
527 *fLog << "none" << endl;
528 break;
529 case kOn:
530 *fLog << "on" << endl;
531 break;
532 case kOff:
533 *fLog << "off" << endl;
534 break;
535 case kWobble:
536 *fLog << "on and off (wobble)" << endl;
537 break;
538 }
539 *fLog << "Using hadronness cut: ";
540 switch (fHadronnessCut)
541 {
542 case kNoCut:
543 *fLog << "none" << endl;
544 break;
545 case kArea:
546 *fLog << "area" << endl;
547 break;
548 case kHadronness:
549 *fLog << "hadronness" << endl;
550 break;
551 case kAll:
552 *fLog << "all" << endl;
553 break;
554 }
555 if (fCalcDisp)
556 *fLog << "Disp is calculated from c0, c7, c8." << endl;
557 else
558 *fLog << "Disp.fVal from the parameter list is used as disp." << endl;
559 if (fCalcGhostbuster)
560 *fLog << "Ghostbusting is calculated from c5, c6, c7." << endl;
561 else
562 *fLog << "Ghostbuster.fVal from the parameter list is used for ghostbusting." << endl;
563
564 *fLog << "Filter is" << (IsInverted()?"":" not") << " inverted." << endl;
565
566 const Int_t n = fVariables.GetSize();
567 for (int i=0; i<n; i+=3)
568 {
569 *fLog << setw(25) << GetParam(i);
570 *fLog << setw(25) << GetParam(i+1);
571 *fLog << setw(25) << GetParam(i+2);
572 *fLog << endl;
573 }
574 *fLog << setiosflags(ios::right);
575}
576
577Bool_t MFMagicCuts::CoefficentsRead(const char *fname)
578{
579 ifstream fin(fname);
580 if (!fin)
581 {
582 *fLog << err << "Cannot open file " << fname << ": ";
583 *fLog << strerror(errno) << endl;
584 return kFALSE;
585 }
586
587 for (int i=0; i<fVariables.GetSize(); i++)
588 {
589 fin >> fVariables[i];
590 if (!fin)
591 {
592 *fLog << err << "ERROR - Not enough coefficients in file " << fname << endl;
593 return kERROR;
594 }
595 }
596 return kTRUE;
597}
598
599Bool_t MFMagicCuts::CoefficentsWrite(const char *fname) const
600{
601 ofstream fout(fname);
602 if (!fout)
603 {
604 *fLog << err << "Cannot open file " << fname << ": ";
605 *fLog << strerror(errno) << endl;
606 return kFALSE;
607 }
608
609 for (int i=0; i<fVariables.GetSize(); i++)
610 fout << setw(11) << fVariables[i] << endl;
611
612 return kTRUE;
613}
614
615Int_t MFMagicCuts::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
616{
617 if (MFilter::ReadEnv(env, prefix, print)==kERROR)
618 return kERROR;
619
620
621 Bool_t rc = kFALSE;
622 if (IsEnvDefined(env, prefix, "ThetaCut", print))
623 {
624 TString str = GetEnvValue(env, prefix, "ThetaCut", "");
625 str.ToLower();
626 str=str.Strip(TString::kBoth);
627
628 if (str==(TString)"nocut" || str==(TString)"none")
629 fThetaCut = kNone;
630 if (str==(TString)"on")
631 fThetaCut = kOn;
632 if (str==(TString)"off")
633 fThetaCut = kOff;
634 if (str==(TString)"wobble")
635 fThetaCut = kWobble;
636 rc = kTRUE;
637 }
638
639 if (IsEnvDefined(env, prefix, "HadronnessCut", print))
640 {
641 TString str = GetEnvValue(env, prefix, "HadronnessCut", "");
642 str.ToLower();
643 str=str.Strip(TString::kBoth);
644
645 if (str==(TString)"nocut" || str==(TString)"none")
646 fHadronnessCut = kNoCut;
647 if (str==(TString)"area")
648 fHadronnessCut = kArea;
649 if (str==(TString)"hadronness")
650 fHadronnessCut = kHadronness;
651 if (str==(TString)"all")
652 fHadronnessCut = kAll;
653
654 rc = kTRUE;
655 }
656
657 if (IsEnvDefined(env, prefix, "CalcDisp", print))
658 {
659 fCalcDisp = GetEnvValue(env, prefix, "CalcDisp", fCalcDisp);
660 rc = kTRUE;
661 }
662
663 if (IsEnvDefined(env, prefix, "CalcGhostbuster", print))
664 {
665 fCalcGhostbuster = GetEnvValue(env, prefix, "CalcGhostbuster", fCalcGhostbuster);
666 rc = kTRUE;
667 }
668
669 if (IsEnvDefined(env, prefix, "File", print))
670 {
671 const TString fname = GetEnvValue(env, prefix, "File", "");
672 if (!CoefficentsRead(fname))
673 return kERROR;
674
675 return kTRUE;
676 }
677
678 for (int i=0; i<fVariables.GetSize(); i++)
679 {
680 if (IsEnvDefined(env, prefix, Form("Param%d", i), print))
681 {
682 // It is important that the last argument is a floating point
683 fVariables[i] = GetEnvValue(env, prefix, Form("Param%d", i), 0.0);
684 rc = kTRUE;
685 }
686 }
687 return rc;
688}
Note: See TracBrowser for help on using the repository browser.