/* ======================================================================== *\ ! ! * ! * This file is part of MARS, the MAGIC Analysis and Reconstruction ! * Software. It is distributed to you in the hope that it can be a useful ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes. ! * It is distributed WITHOUT ANY WARRANTY. ! * ! * Permission to use, copy, modify and distribute this software and its ! * documentation for any purpose is hereby granted without fee, ! * provided that the above copyright notice appear in all copies and ! * that both that copyright notice and this permission notice appear ! * in supporting documentation. It is provided "as is" without express ! * or implied warranty. ! * ! ! ! Author(s): Markus Gaug, 04/2004 ! Thomas Bretz, 01/2004 ! ! Copyright: MAGIC Software Development, 2000-2004 ! ! \* ======================================================================== */ ////////////////////////////////////////////////////////////////////////////// // // MExtractFixedWindow // // Extracts the signal from a fixed window // ////////////////////////////////////////////////////////////////////////////// #include "MExtractFixedWindow.h" #include "MExtractor.h" #include ClassImp(MExtractFixedWindow); using namespace std; const Byte_t MExtractFixedWindow::fgHiGainFirst = 3; const Byte_t MExtractFixedWindow::fgHiGainLast = 14; const Byte_t MExtractFixedWindow::fgLoGainFirst = 3; const Byte_t MExtractFixedWindow::fgLoGainLast = 14; // -------------------------------------------------------------------------- // // Default constructor. // MExtractFixedWindow::MExtractFixedWindow(const char *name, const char *title) { fName = name ? name : "MExtractFixedWindow"; fTitle = title ? title : "Signal Extractor for a fixed FADC window"; SetRange(fgHiGainFirst, fgHiGainLast, fgLoGainFirst, fgLoGainLast); fNumHiGainSamples = (Float_t)(fHiGainLast-fHiGainFirst) + 1.; fNumLoGainSamples = (Float_t)(fLoGainLast-fLoGainFirst) + 1.; fSqrtHiGainSamples = TMath::Sqrt(fNumHiGainSamples); fSqrtLoGainSamples = TMath::Sqrt(fNumLoGainSamples); } void MExtractFixedWindow::FindSignalHiGain(Byte_t *ptr, Int_t &sum, Byte_t &sat) const { Byte_t *end = ptr + fHiGainLast - fHiGainFirst + 1; sum = 0; sat = 0; while (ptr= fSaturationLimit) sat++; } } void MExtractFixedWindow::FindSignalLoGain(Byte_t *ptr, Int_t &sum, Byte_t &sat) const { Byte_t *end = ptr + fLoGainLast - fLoGainFirst + 1; sum = 0; sat = 0; while (ptr= fSaturationLimit) sat++; } } // -------------------------------------------------------------------------- // // Implementation of SavePrimitive. Used to write the call to a constructor // to a macro. In the original root implementation it is used to write // gui elements to a macro-file. // void MExtractFixedWindow::StreamPrimitive(ofstream &out) const { out << " " << ClassName() << " " << GetUniqueName() << "(\""; out << "\"" << fName << "\", \"" << fTitle << "\");" << endl; if (fSaturationLimit!=fgSaturationLimit) { out << " " << GetUniqueName() << ".SetSaturationLimit("; out << (int)fSaturationLimit << ");" << endl; } const Bool_t arg4 = fNumLoGainSamples+fLoGainFirst-1 != fgLoGainLast; const Bool_t arg3 = arg4 || fLoGainFirst != fgLoGainFirst; const Bool_t arg2 = arg3 || fNumHiGainSamples+fHiGainFirst-1 != fgHiGainLast; const Bool_t arg1 = arg2 || fHiGainFirst != fgHiGainFirst; if (!arg1) return; out << " " << GetUniqueName() << ".SetRange("; out << (int)fLoGainFirst; if (arg2) { out << ", " << (int)(fNumHiGainSamples+fHiGainFirst-1); if (arg3) { out << ", " << (int)fLoGainFirst; if (arg4) out << ", " << (int)(fNumLoGainSamples+fLoGainFirst-1); } } out << ");" << endl; }