source: trunk/Mars/msignal/MExtractTimeAndChargeDigitalFilter.cc@ 12789

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