| 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): Markus Gaug, 04/2004 <mailto:markus@ifae.es> | 
|---|
| 19 | !   Author(s): Thomas Bretz, 04/2004 <mailto:tbretz@astro.uni-wuerzburg.de> | 
|---|
| 20 | ! | 
|---|
| 21 | !   Copyright: MAGIC Software Development, 2000-2006 | 
|---|
| 22 | ! | 
|---|
| 23 | ! | 
|---|
| 24 | \* ======================================================================== */ | 
|---|
| 25 |  | 
|---|
| 26 | ////////////////////////////////////////////////////////////////////////////// | 
|---|
| 27 | // | 
|---|
| 28 | //   MExtractTime | 
|---|
| 29 | // | 
|---|
| 30 | //   Base class for the signal extractors, used the functions | 
|---|
| 31 | //   FindTimeHiGain() and FindTimeLoGain() to extract the signal and | 
|---|
| 32 | //   substract the pedestal value | 
|---|
| 33 | // | 
|---|
| 34 | //   The following figure gives and example of possible inheritance trees. | 
|---|
| 35 | //   An extractor class can inherit from each of the following base classes: | 
|---|
| 36 | //    - MExtractor | 
|---|
| 37 | //    - MExtractTime | 
|---|
| 38 | //    - MExtractTimeAndCharge | 
|---|
| 39 | // | 
|---|
| 40 | //Begin_Html | 
|---|
| 41 | /* | 
|---|
| 42 | <img src="images/ExtractorClasses.gif"> | 
|---|
| 43 | */ | 
|---|
| 44 | //End_Html | 
|---|
| 45 | // | 
|---|
| 46 | //   The following variables have to be set by the derived class and | 
|---|
| 47 | //   do not have defaults: | 
|---|
| 48 | //   - fNumHiGainSamples | 
|---|
| 49 | //   - fNumLoGainSamples | 
|---|
| 50 | //   - fSqrtHiGainSamples | 
|---|
| 51 | //   - fSqrtLoGainSamples | 
|---|
| 52 | // | 
|---|
| 53 | // Input Containers: | 
|---|
| 54 | //   MRawEvtData | 
|---|
| 55 | //   MRawRunHeader | 
|---|
| 56 | //   MPedestalCam | 
|---|
| 57 | // | 
|---|
| 58 | // Output Containers: | 
|---|
| 59 | //   MArrivalTimeCam | 
|---|
| 60 | // | 
|---|
| 61 | ////////////////////////////////////////////////////////////////////////////// | 
|---|
| 62 | #include "MExtractTime.h" | 
|---|
| 63 |  | 
|---|
| 64 | #include <fstream> | 
|---|
| 65 |  | 
|---|
| 66 | #include "MLog.h" | 
|---|
| 67 | #include "MLogManip.h" | 
|---|
| 68 |  | 
|---|
| 69 | #include "MParList.h" | 
|---|
| 70 |  | 
|---|
| 71 | #include "MRawEvtData.h" | 
|---|
| 72 | #include "MRawEvtPixelIter.h" | 
|---|
| 73 | #include "MRawRunHeader.h" | 
|---|
| 74 |  | 
|---|
| 75 | #include "MPedestalCam.h" | 
|---|
| 76 | #include "MPedestalPix.h" | 
|---|
| 77 |  | 
|---|
| 78 | #include "MArrivalTimeCam.h" | 
|---|
| 79 | #include "MArrivalTimePix.h" | 
|---|
| 80 |  | 
|---|
| 81 | ClassImp(MExtractTime); | 
|---|
| 82 |  | 
|---|
| 83 | using namespace std; | 
|---|
| 84 |  | 
|---|
| 85 | const char *MExtractTime::fgNameTimeCam = "MArrivalTimeCam"; | 
|---|
| 86 |  | 
|---|
| 87 | // -------------------------------------------------------------------------- | 
|---|
| 88 | // | 
|---|
| 89 | // Default constructor. | 
|---|
| 90 | // | 
|---|
| 91 | // Set: | 
|---|
| 92 | // - all pointers to NULL | 
|---|
| 93 | // - all variables to 0 | 
|---|
| 94 | // - fSaturationLimit to fgSaturationLimit | 
|---|
| 95 | // - fNameTimeCam to fgNameTimeCam | 
|---|
| 96 | // | 
|---|
| 97 | // Call: | 
|---|
| 98 | // -  AddToBranchList("MRawEvtData.*") | 
|---|
| 99 | // | 
|---|
| 100 | MExtractTime::MExtractTime(const char *name, const char *title) | 
|---|
| 101 | : fArrTime(NULL) | 
|---|
| 102 | { | 
|---|
| 103 |  | 
|---|
| 104 | fName  = name  ? name  : "MExtractTime"; | 
|---|
| 105 | fTitle = title ? title : "Base class for signal extractors"; | 
|---|
| 106 |  | 
|---|
| 107 | SetNameTimeCam(); | 
|---|
| 108 | } | 
|---|
| 109 |  | 
|---|
| 110 | // -------------------------------------------------------------------------- | 
|---|
| 111 | // | 
|---|
| 112 | // The PreProcess searches for the following input containers: | 
|---|
| 113 | //  - MRawEvtData | 
|---|
| 114 | //  - MRawRunHeader | 
|---|
| 115 | //  - MPedestalCam | 
|---|
| 116 | // | 
|---|
| 117 | // The following output containers are also searched and created if | 
|---|
| 118 | // they were not found: | 
|---|
| 119 | // | 
|---|
| 120 | //  - MArrivalTimeCam | 
|---|
| 121 | // | 
|---|
| 122 | Int_t MExtractTime::PreProcess(MParList *pList) | 
|---|
| 123 | { | 
|---|
| 124 | fArrTime = (MArrivalTimeCam*)pList->FindCreateObj("MArrivalTimeCam",AddSerialNumber(fNameTimeCam)); | 
|---|
| 125 | if (!fArrTime) | 
|---|
| 126 | return kFALSE; | 
|---|
| 127 |  | 
|---|
| 128 | return PreProcessStd(pList); | 
|---|
| 129 | } | 
|---|
| 130 |  | 
|---|
| 131 |  | 
|---|
| 132 | void MExtractTime::Print(Option_t *o) const | 
|---|
| 133 | { | 
|---|
| 134 | MExtractor::Print(o); | 
|---|
| 135 | if (HasLoGain()) | 
|---|
| 136 | *fLog << " Offset Lo-Gain:     " << fOffsetLoGain << endl; | 
|---|
| 137 | } | 
|---|