source: trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeDigitalFilter.cc@ 8213

Last change on this file since 8213 was 8208, checked in by tbretz, 20 years ago
*** empty log message ***
File size: 23.0 KB
Line 
1/* ======================================================================== *\
2! $Name: not supported by cvs2svn $:$Id: MExtractTimeAndChargeDigitalFilter.cc,v 1.75 2006-11-02 17:54:22 tbretz Exp $
3! --------------------------------------------------------------------------
4!
5! *
6! * This file is part of MARS, the MAGIC Analysis and Reconstruction
7! * Software. It is distributed to you in the hope that it can be a useful
8! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
9! * It is distributed WITHOUT ANY WARRANTY.
10! *
11! * Permission to use, copy, modify and distribute this software and its
12! * documentation for any purpose is hereby granted without fee,
13! * provided that the above copyright notice appear in all copies and
14! * that both that copyright notice and this permission notice appear
15! * in supporting documentation. It is provided "as is" without express
16! * or implied warranty.
17! *
18!
19!
20! Author(s): Hendrik Bartko, 09/2004 <mailto:hbartko@mppmu.mpg.de>
21! Author(s): Markus Gaug, 05/2004 <mailto:markus@ifae.es>
22! Author(s): Diego Tescaro, 05/2004 <mailto:tescaro@pd.infn.it>
23!
24! Copyright: MAGIC Software Development, 2000-2004
25!
26!
27\* ======================================================================== */
28
29//////////////////////////////////////////////////////////////////////////////
30//
31// MExtractTimeAndChargeDigitalFilter
32//
33// Hendrik has promised to write more documentation
34//
35// The following variables have to be set by the derived class and
36// do not have defaults:
37// - fNumHiGainSamples
38// - fNumLoGainSamples
39// - fSqrtHiGainSamples
40// - fSqrtLoGainSamples
41//
42// The reading of automatic weights files (color, type) can be switched
43// off using EnableAutomaticWeights(kFALSE).
44//
45// An empty name or "-" as the weights file name is a synonym for
46// setting all weights to 1
47//
48// Input Containers:
49// MRawEvtData
50// MRawRunHeader
51// MPedestalCam
52// [MCalibrationPattern]
53//
54// Output Containers:
55// MArrivalTimeCam
56// MExtractedSignalCam
57//
58//////////////////////////////////////////////////////////////////////////////
59#include "MExtractTimeAndChargeDigitalFilter.h"
60
61#include <errno.h>
62#include <fstream>
63
64#include <TRandom.h>
65
66#include "MLog.h"
67#include "MLogManip.h"
68
69#include "MParList.h"
70
71#include "MRawRunHeader.h"
72#include "MCalibrationPattern.h"
73#include "MExtractedSignalCam.h"
74#include "MExtralgoDigitalFilter.h"
75
76ClassImp(MExtractTimeAndChargeDigitalFilter);
77
78using namespace std;
79
80const Byte_t MExtractTimeAndChargeDigitalFilter::fgHiGainFirst = 0;
81const Byte_t MExtractTimeAndChargeDigitalFilter::fgHiGainLast = 16;
82const Byte_t MExtractTimeAndChargeDigitalFilter::fgLoGainFirst = 1;
83const Byte_t MExtractTimeAndChargeDigitalFilter::fgLoGainLast = 14;
84const Int_t MExtractTimeAndChargeDigitalFilter::fgBinningResolutionHiGain = 10;
85const Int_t MExtractTimeAndChargeDigitalFilter::fgBinningResolutionLoGain = 10;
86const Float_t MExtractTimeAndChargeDigitalFilter::fgOffsetLoGain = 0.95;
87
88// --------------------------------------------------------------------------
89//
90// Default constructor.
91//
92// Calls:
93// - SetWindowSize();
94// - SetRange(fgHiGainFirst, fgHiGainLast, fgLoGainFirst, fgLoGainLast)
95// - SetBinningResolution();
96//
97// Sets all weights to 1.
98//
99MExtractTimeAndChargeDigitalFilter::MExtractTimeAndChargeDigitalFilter(const char *name, const char *title)
100 : fBinningResolutionHiGain(fgBinningResolutionHiGain),
101 fBinningResolutionLoGain(fgBinningResolutionLoGain),
102 fAutomaticWeights(kTRUE)
103{
104 fName = name ? name : "MExtractTimeAndChargeDigitalFilter";
105 fTitle = title ? title : "Digital Filter";
106
107 SetRange(fgHiGainFirst, fgHiGainLast, fgLoGainFirst, fgLoGainLast);
108 SetWindowSize(3, 5);
109 SetOffsetLoGain(fgOffsetLoGain);
110}
111
112// ---------------------------------------------------------------------------------------
113//
114// Checks:
115// - if a window is bigger than the one defined by the ranges, set it
116// to the available range
117//
118// Sets:
119// - fNumHiGainSamples to: (Float_t)fWindowSizeHiGain
120// - fNumLoGainSamples to: (Float_t)fWindowSizeLoGain
121//
122// This function might be used to turn the digital filter into a
123// sliding window extractor by setting the filename to NULL
124//
125void MExtractTimeAndChargeDigitalFilter::SetWindowSize(Int_t windowh, Int_t windowl)
126{
127 fWindowSizeHiGain = windowh;
128 fWindowSizeLoGain = windowl;
129
130 const Int_t availhirange = (Int_t)(fHiGainLast-fHiGainFirst+1);
131
132 if (fWindowSizeHiGain > availhirange)
133 {
134 *fLog << warn << GetDescriptor() << ": Hi Gain window size: " << Form("%2i",fWindowSizeHiGain);
135 *fLog << " is bigger than available range: [" << Form("%2i", (int)fHiGainFirst);
136 *fLog << "," << Form("%21", (int)fHiGainLast) << "]" << endl;
137
138 fHiGainLast = fHiGainFirst + fWindowSizeHiGain;
139
140 *fLog << warn << GetDescriptor() << ": Will set the upper range to: " << (int)fHiGainLast << endl;
141 }
142
143 if (fWindowSizeHiGain < 2)
144 {
145 fWindowSizeHiGain = 2;
146 *fLog << warn << GetDescriptor() << ": High Gain window size set to two samples" << endl;
147 }
148
149 if (fLoGainLast != 0 && fWindowSizeLoGain != 0)
150 {
151 const Int_t availlorange = (Int_t)(fLoGainLast-fLoGainFirst+1);
152
153 if (fWindowSizeLoGain > availlorange)
154 {
155 *fLog << warn << GetDescriptor() << ": Lo Gain window size: " << Form("%2i",fWindowSizeLoGain);
156 *fLog << " is bigger than available range: [" << Form("%2i", (int)fLoGainFirst);
157 *fLog << "," << Form("%21", (int)fLoGainLast) << "]" << endl;
158
159 fLoGainLast = fLoGainFirst + fWindowSizeLoGain;
160
161 *fLog << warn << GetDescriptor() << ": Will set the upper range to: " << (int)fLoGainLast << endl;
162 }
163
164 if (fWindowSizeLoGain<2)
165 {
166 fWindowSizeLoGain = 2;
167 *fLog << warn << GetDescriptor() << ": Low Gain window size set to two samples" << endl;
168 }
169 }
170 //
171 // We need here the effective number of samples which is about 2.5 in the case of a window
172 // size of 6. The exact numbers have to be found still.
173 //
174 fNumHiGainSamples = fWindowSizeHiGain;
175 fNumLoGainSamples = fWindowSizeLoGain;
176 fSqrtHiGainSamples = TMath::Sqrt(fNumHiGainSamples);
177 fSqrtLoGainSamples = TMath::Sqrt(fNumLoGainSamples);
178}
179
180
181// --------------------------------------------------------------------------
182//
183// Executing MExtractTimeAndCharge::PreProcess and searching for
184// MCalibrationPattern
185//
186Int_t MExtractTimeAndChargeDigitalFilter::PreProcess(MParList *pList)
187{
188 if (!MExtractTimeAndCharge::PreProcess(pList))
189 return kFALSE;
190
191 fCalibPattern = (MCalibrationPattern*)pList->FindObject("MCalibrationPattern");
192 return kTRUE;
193}
194
195// --------------------------------------------------------------------------
196//
197// The weights are determined using GetAutimaticWeights().
198//
199// kFALSE is returned if it returned an error.
200// kTRUE is returned if no new weights were set.
201//
202// If new weights are set
203// fNumHiGainSamples
204// fNumLoGainSamples
205// fSqrtHiGainSamples
206// fSqrtLoGainSamples
207// and
208// fSignals->SetUsedFADCSlices(...)
209// is updated accordingly.
210//
211Bool_t MExtractTimeAndChargeDigitalFilter::GetWeights()
212{
213 switch (GetAutomaticWeights())
214 {
215 case kERROR: // An error occured
216 return kFALSE;
217 case kFALSE: // No new weights set
218 return kTRUE;
219 }
220
221 //
222 // We need here the effective number of samples. In pricipal the number
223 // is different depending on the weights used and must be set
224 // event by event.
225 //
226 fNumHiGainSamples = fAmpWeightsHiGain.GetSum()/fBinningResolutionHiGain;
227 fNumLoGainSamples = fAmpWeightsLoGain.GetSum()/fBinningResolutionLoGain;
228 fSqrtHiGainSamples = TMath::Sqrt(fNumHiGainSamples);
229 fSqrtLoGainSamples = TMath::Sqrt(fNumLoGainSamples);
230
231 // From MExtractTimeAndCharge::ReInit
232 if (fSignals)
233 fSignals->SetUsedFADCSlices(fHiGainFirst, fHiGainLast/*+fHiLoLast*/, fNumHiGainSamples,
234 fLoGainFirst, fLoGainLast, fNumLoGainSamples);
235 return kTRUE;
236}
237
238// --------------------------------------------------------------------------
239//
240// InitArrays
241//
242// Gets called in the ReInit() and initialized the arrays
243//
244Bool_t MExtractTimeAndChargeDigitalFilter::InitArrays(Int_t n)
245{
246 if (!fRunHeader)
247 return kFALSE;
248
249 return GetWeights();
250}
251
252// --------------------------------------------------------------------------
253//
254// Check if reading a new weights file is necessary because the calibration
255// pattern has changed. (Cannot be done in ReInit, because at this time
256// the calibration pattern is not available.
257// Then process the event.
258//
259Int_t MExtractTimeAndChargeDigitalFilter::Process()
260{
261 // Change Weights if the calibration patter changes
262 if (!GetWeights())
263 return kERROR;
264
265 // Process event
266 return MExtractTimeAndCharge::Process();
267}
268
269// --------------------------------------------------------------------------
270//
271// Apply the digital filter algorithm to the high-gain slices.
272//
273void MExtractTimeAndChargeDigitalFilter::FindTimeAndChargeHiGain2(const Float_t *ptr, Int_t num,
274 Float_t &sum, Float_t &dsum,
275 Float_t &time, Float_t &dtime,
276 Byte_t sat, Int_t maxpos) const
277{
278 // Do some handling if maxpos is last slice!
279
280 MExtralgoDigitalFilter df(fBinningResolutionHiGain, fWindowSizeHiGain,
281 fAmpWeightsHiGain.GetArray(),
282 fTimeWeightsHiGain.GetArray(),
283 fPulseHiGain.GetArray());
284 df.SetData(num, ptr);
285
286 if (IsNoiseCalculation())
287 {
288 sum = df.ExtractNoise(gRandom->Integer(fBinningResolutionHiGain));
289 return;
290 }
291
292 df.Extract(/*maxpos*/);
293 df.GetSignal(sum, dsum);
294 df.GetTime(time, dtime);
295}
296
297void MExtractTimeAndChargeDigitalFilter::FindTimeAndChargeLoGain2(const Float_t *ptr, Int_t num,
298 Float_t &sum, Float_t &dsum,
299 Float_t &time, Float_t &dtime,
300 Byte_t sat, Int_t maxpos) const
301{
302 MExtralgoDigitalFilter df(fBinningResolutionLoGain, fWindowSizeLoGain,
303 fAmpWeightsLoGain.GetArray(),
304 fTimeWeightsLoGain.GetArray(),
305 fPulseLoGain.GetArray());
306
307 df.SetData(num, ptr);
308
309 if (IsNoiseCalculation())
310 {
311 sum = df.ExtractNoise(gRandom->Integer(fBinningResolutionHiGain));
312 return;
313 }
314
315 df.Extract(/*maxpos*/);
316 df.GetSignal(sum, dsum);
317 df.GetTime(time, dtime);
318}
319
320
321// --------------------------------------------------------------------------
322//
323// Read the setup from a TEnv, eg:
324// MJPedestal.MExtractor.WeightsFile: filename
325// MJPedestal.MExtractor.AutomaticWeights: off
326//
327Int_t MExtractTimeAndChargeDigitalFilter::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
328{
329
330 Bool_t rc = kFALSE;
331
332 if (IsEnvDefined(env, prefix, "AutomaticWeights", print))
333 {
334 EnableAutomaticWeights(GetEnvValue(env, prefix, "AutomaticWeights", fAutomaticWeights));
335 rc = kTRUE;
336 }
337
338 if (IsEnvDefined(env, prefix, "WeightsFile", print))
339 {
340 SetNameWeightsFile(GetEnvValue(env, prefix, "WeightsFile", ""));
341 rc = kTRUE;
342 }
343
344 return MExtractTimeAndCharge::ReadEnv(env, prefix, print) ? kTRUE : rc;
345}
346
347//----------------------------------------------------------------------------
348//
349// If automatic weights are requested, no default weights (name.IsNull())
350// are requested, fRunHeader is available and fRunHeader->IsMonteCarloRun()
351// is true prepend "MC_" in from of the name.
352//
353// return poth+name;
354//
355TString MExtractTimeAndChargeDigitalFilter::CompileWeightFileName(TString path, const TString &name) const
356{
357 if (fAutomaticWeights && !name.IsNull() && fRunHeader && fRunHeader->IsMonteCarloRun())
358 path += "MC_";
359
360 path += name;
361
362 return path;
363}
364
365//----------------------------------------------------------------------------
366//
367// Read a pre-defined weights file into the class.
368// This is mandatory for the extraction
369//
370// If filenname is empty, then all weights will be set to 1.
371//
372// Returns:
373// kTRUE: new weights set
374// kFALSE: no weights set
375// kERROR: error
376//
377Int_t MExtractTimeAndChargeDigitalFilter::ReadWeightsFile(TString filename, TString path)
378{
379 if (filename.IsNull())
380 {
381 fAmpWeightsHiGain .Set(fBinningResolutionHiGain*fWindowSizeHiGain);
382 fAmpWeightsLoGain .Set(fBinningResolutionLoGain*fWindowSizeLoGain);
383 fTimeWeightsHiGain.Set(fBinningResolutionHiGain*fWindowSizeHiGain);
384 fTimeWeightsLoGain.Set(fBinningResolutionLoGain*fWindowSizeLoGain);
385
386 fAmpWeightsHiGain.Reset(1);
387 fTimeWeightsHiGain.Reset(1);
388 fAmpWeightsLoGain.Reset(1);
389 fTimeWeightsLoGain.Reset(1);
390 return kTRUE;
391 }
392
393 // Add "MC_" in front of the filename if necessary
394 filename = CompileWeightFileName(path, filename);
395
396 //filename = MJob::ExpandPath(filename);
397
398 if (fNameWeightsFileSet==filename)
399 return kFALSE; // No file read
400
401 ifstream fin(filename.Data());
402 if (!fin)
403 {
404 *fLog << err << GetDescriptor() << ": ERROR - Cannot open file " << filename << ": ";
405 *fLog << strerror(errno) << endl;
406 return kERROR;
407 }
408
409 *fLog << all << GetDescriptor() << ": Reading weights in " << filename << "..." << flush;
410
411 Int_t len = 0;
412 Int_t cnt = 0;
413 Int_t line = 0;
414 Bool_t hi = kFALSE;
415 Bool_t lo = kFALSE;
416
417 TString str;
418
419 while (1)
420 {
421 str.ReadLine(fin);
422 if (!fin)
423 break;
424
425 line++;
426
427 if (str.Contains("# High Gain Weights:"))
428 {
429 if (hi)
430 {
431 *fLog << err << "ERROR - 'High Gain Weights' found twice in line #" << line << "." << endl;
432 return kERROR;
433 }
434
435 if (2!=sscanf(str.Data(), "# High Gain Weights: %2i %2i", &fWindowSizeHiGain, &fBinningResolutionHiGain))
436 {
437 *fLog << err << "ERROR - Wrong number of arguments in line #" << line << ":" << endl;
438 *fLog << str << endl;
439 return kERROR;
440 }
441
442 len = fBinningResolutionHiGain*fWindowSizeHiGain;
443 fAmpWeightsHiGain .Set(len);
444 fTimeWeightsHiGain.Set(len);
445 fPulseHiGain.Set(len);
446 hi = kTRUE;
447 continue;
448 }
449
450 if (str.Contains("# Low Gain Weights:"))
451 {
452 if (lo)
453 {
454 *fLog << err << "ERROR - 'Lo Gain Weights' found twice in line #" << line << "." << endl;
455 return kERROR;
456 }
457
458 if (2!=sscanf(str.Data(),"# Low Gain Weights: %2i %2i", &fWindowSizeLoGain, &fBinningResolutionLoGain))
459 {
460 *fLog << err << "ERROR - Wrong number of arguments in line #" << line << ":" << endl;
461 *fLog << str << endl;
462 return kERROR;
463 }
464
465 len = fBinningResolutionLoGain*fWindowSizeLoGain;
466 fAmpWeightsLoGain .Set(len);
467 fTimeWeightsLoGain.Set(len);
468 fPulseLoGain.Set(len);
469 lo = kTRUE;
470 continue;
471 }
472
473 // Handle lines with comments
474 if (str.Contains("#"))
475 continue;
476
477 // Nothing found so far
478 if (len == 0)
479 continue;
480
481 if (3!=sscanf(str.Data(), "%f %f %f",
482 lo ? &fAmpWeightsLoGain [cnt] : &fAmpWeightsHiGain [cnt],
483 lo ? &fTimeWeightsLoGain[cnt] : &fTimeWeightsHiGain[cnt],
484 lo ? &fPulseLoGain[cnt] : &fPulseHiGain[cnt]))
485 {
486 *fLog << err << "ERROR - Wrong number of arguments in line #" << line << ":" << endl;
487 *fLog << str << endl;
488 return kERROR;
489 }
490
491 if (++cnt == len)
492 {
493 len = 0;
494 cnt = 0;
495 }
496 }
497
498 if (cnt != len)
499 {
500 *fLog << err << "ERROR - Size mismatch in weights file " << filename << endl;
501 return kERROR;
502 }
503
504 if (!hi)
505 {
506 *fLog << err << "ERROR - No correct header found in weights file " << filename << endl;
507 return kERROR;
508 }
509
510 *fLog << "done." << endl;
511
512 *fLog << inf << " File contains " << fWindowSizeHiGain << " hi-gain slices ";
513 *fLog << "with a resolution of " << fBinningResolutionHiGain << endl;
514
515 *fLog << inf << " File contains " << fWindowSizeLoGain << " lo-gain slices ";
516 *fLog << "with a resolution of " << fBinningResolutionLoGain << endl;
517
518 //CalcBinningResArrays();
519
520 switch (fWindowSizeHiGain)
521 {
522 case 4:
523 SetResolutionPerPheHiGain(0.036);
524 break;
525 case 6:
526 SetResolutionPerPheHiGain(0.021);
527 break;
528 default:
529 *fLog << warn << "Could not set the high-gain extractor resolution per phe for window size "
530 << fWindowSizeHiGain << endl;
531 }
532
533 switch (fWindowSizeLoGain)
534 {
535 case 4:
536 SetResolutionPerPheLoGain(0.005);
537 break;
538 case 6:
539 SetResolutionPerPheLoGain(0.004);
540 break;
541 default:
542 *fLog << warn << "Could not set the low-gain extractor resolution per phe for window size "
543 << fWindowSizeLoGain << endl;
544 }
545
546 fNameWeightsFileSet = filename;
547
548 return kTRUE;
549}
550
551
552//----------------------------------------------------------------------------
553//
554// The default (+ prepending possible "MC_") is read for:
555//
556// - RunType: Pedestal (independant of fAutomaticWeights)
557// - fAutomaticWeights disabled
558//
559// if fAutomaticWeights enabled:
560// - fNameWeightsFile.IsNull()
561// - !fCalibPattern
562// - fCalibPattern->GetPulserColor()==MCalibrationCam::kNONE
563//
564// If automatic weights are enabled, the case above didn't take place and
565// fNameWeightsFile starts with "calibration_weights_"
566// - the color (blue, UV) is replaced by the appropriate one
567// taken from the calibration pattern
568//
569// In most cases a debug output is printed. Further output about the color
570// determination can be switched on with debug level > 5;
571//
572// Returns:
573// kFALSE: No new weights set
574// kTRUE: New weights set
575// kERROR: Error
576//
577Int_t MExtractTimeAndChargeDigitalFilter::GetAutomaticWeights()
578{
579 const Ssiz_t pos = fNameWeightsFile.Last('/')+1;
580 const Ssiz_t len = fNameWeightsFile.Length();
581
582 // Split file name in path and name
583 TString path = fNameWeightsFile(0, pos>=0?pos:len);
584 TString name = fNameWeightsFile(pos>=0?pos:0, len);
585
586 // Remove trailing "MC_" for automatic weights
587 if (fAutomaticWeights && name.BeginsWith("MC_"))
588 name.Remove(0, 3);
589
590 // In case of a pedetsal run no calibration pattern can be available
591 // the default weights are always used.
592 if (fRunHeader->GetRunType()==MRawRunHeader::kRTPedestal)
593 {
594 *fLog << dbg << "Pedestal file... using default weights: " << fNameWeightsFile << endl;
595 return ReadWeightsFile(name, path);
596 }
597
598 // If automatic weights are switched off use default weights
599 if (!fAutomaticWeights)
600 {
601 *fLog << dbg << "Automatic weights switched off... using default weights: " << fNameWeightsFile << endl;
602 return ReadWeightsFile(name, path);
603 }
604
605 // If automatic weights are switched on but no filename is given raise error
606 if (fNameWeightsFile.IsNull())
607 {
608 *fLog << err << "ERROR - Cannot get automatic weights without default filename." << endl;
609 return kERROR;
610 }
611
612 // If this is no pedestal run, automatic weights are requested and a
613 // filename for the weights file is given pedestal-extraction from
614 // cosmics data is assumed.
615 if (!fCalibPattern)
616 {
617 *fLog << dbg << "No decoded calibration pattern available... using default weights: " << fNameWeightsFile << endl;
618 return ReadWeightsFile(name, path);
619 }
620
621 const Bool_t debug = gLog.GetDebugLevel()>5;
622
623 // If no calibration pattern is available do not change the
624 // current weighs or current weights file name.
625 if (fCalibPattern->GetPulserColor()==MCalibrationCam::kNONE)
626 {
627 // If we are extracting data and the calibration pattern is kNONE
628 // we assume that it is a data file without interleaved events
629 // and calibration pattern information available.
630 if ((fRunHeader->GetRunType()!=MRawRunHeader::kRTData && !fRunHeader->IsMonteCarloRun()) || debug)
631 *fLog << dbg << "No calibration color set so far... guessing default: " << fNameWeightsFile << endl;
632
633 return ReadWeightsFile(name, path);
634 }
635
636 if (debug)
637 {
638 *fLog << dbg << endl;
639 *fLog << underline << GetDescriptor() << endl;
640 *fLog << " Trying to get automatic weight for " << fNameWeightsFile << endl;
641 *fLog << " Run type: ";
642 }
643
644 if (name.BeginsWith("calibration_weights_") && fCalibPattern)
645 {
646 if (debug)
647 *fLog << " Calibration with color " << fCalibPattern->GetPulserColorStr() << ", setting ";
648 switch (fCalibPattern->GetPulserColor())
649 {
650 case MCalibrationCam::kBLUE: // 2
651 case MCalibrationCam::kGREEN: // 1
652 if (debug)
653 *fLog << "blue/green, ";
654 name.ReplaceAll("UV", "blue");
655 break;
656
657 case MCalibrationCam::kUV: // 3
658 case MCalibrationCam::kCT1: // 0
659 if (debug)
660 *fLog << "UV/CT1, ";
661 name.ReplaceAll("blue", "UV");
662 break;
663 case MCalibrationCam::kNONE:
664 break;
665 default: // kNone + etc
666 *fLog << err << "ERROR - Cannot get automatic weights for " << fCalibPattern->GetPulserColorStr() << endl;
667 return kERROR;
668 }
669 }
670
671 return ReadWeightsFile(name, path);
672}
673
674//----------------------------------------------------------------------------
675//
676// Print the setup of the digital filter extraction used. Use
677// the option "weights" if you want to print also all weights.
678//
679void MExtractTimeAndChargeDigitalFilter::Print(Option_t *o) const
680{
681 if (IsA()==Class())
682 *fLog << GetDescriptor() << ":" << endl;
683
684 MExtractTimeAndCharge::Print(o);
685 *fLog << " Window Size HiGain: " << setw(2) << fWindowSizeHiGain << " LoGain: " << setw(2) << fWindowSizeLoGain << endl;
686 *fLog << " Binning Res HiGain: " << setw(2) << fBinningResolutionHiGain << " LoGain: " << setw(2) << fBinningResolutionHiGain << endl;
687 *fLog << " Weights File desired: " << (fNameWeightsFile.IsNull()?"-":fNameWeightsFile.Data()) << endl;
688 if (!fNameWeightsFileSet.IsNull())
689 *fLog << " Weights File set: " << fNameWeightsFileSet << endl;
690
691 TString opt(o);
692 if (!opt.Contains("weights"))
693 return;
694
695 *fLog << endl;
696 *fLog << inf << "Using the following weights: " << endl;
697 *fLog << "Hi-Gain:" << endl;
698 for (Int_t i=0; i<fBinningResolutionHiGain*fWindowSizeHiGain; i++)
699 *fLog << " " << fAmpWeightsHiGain[i] << " \t " << fTimeWeightsHiGain[i] << endl;
700
701 *fLog << "Lo-Gain:" << endl;
702 for (Int_t i=0; i<fBinningResolutionLoGain*fWindowSizeLoGain; i++)
703 *fLog << " " << fAmpWeightsLoGain[i] << " \t " << fTimeWeightsLoGain[i] << endl;
704}
Note: See TracBrowser for help on using the repository browser.