// // NoiseScan.cpp // #include "NoiseScan.h" #include #include // =========================================== // constructor // =========================================== NoiseScan::NoiseScan (double start, double stop, double stepSize, DetPlane* detPlane) : Scan (start, stop, stepSize, detPlane) { _detPlane = detPlane; _maxEvents = 0; } // ================================================ // init // ================================================ int NoiseScan::init (double value) { _detPlane->setV_cal (0.0); _maxEvents = (int) value; return 1; } // ================================================ // setVariable // ================================================ int NoiseScan::setVariable (double* setValue) { _detPlane->setV_thres (*setValue); *setValue = _detPlane->getV_thres (); return 2; } // ================================================= // run over write default Scan function // ================================================= int NoiseScan::run (int events, int ctrlBlk) { double setValue; int nPoints = ScanData::nPoints (); ScanData::resetPoint (); // ------------------------------- // loop over points // ------------------------------- unsigned int* pt; int evtsFound; ScanData::resetPoint (); do { // -------------------------------- // retrieve value and set it // -------------------------------- setValue = getPoint (); setVariable ( &setValue ); // ------------------------ // collect events // ------------------------ pt = ScanData::dataProjection (); evtsFound = DoCalibrate::collectData (_maxEvents, events, pt, ctrlBlk); ScanData::setPoint (setValue, evtsFound); } while ( ScanData::nextPoint () == 1 ); return 1; } // ===================================================== // write header line // ===================================================== void NoiseScan::headerToFile (ofstream& outFile) { outFile << "NoiseScan " << endl; }