~chris-rogers/maus/emr_mc_digitization

« back to all changes in this revision

Viewing changes to src/common_cpp/Utils/TOFCalibrationMap.cc

  • Committer: Chris Rogers
  • Date: 2014-04-16 11:48:45 UTC
  • mfrom: (707 merge)
  • mto: This revision was merged to the branch mainline in revision 711.
  • Revision ID: chris.rogers@stfc.ac.uk-20140416114845-h3u3q7pdcxkxvovs
Update to trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
#include "Utils/TOFCalibrationMap.hh"
19
19
 
 
20
#include "Utils/TOFChannelMap.hh"
 
21
 
 
22
namespace MAUS {
 
23
 
20
24
TOFCalibrationMap::TOFCalibrationMap() {
21
25
  pymod_ok = true;
22
26
  if (!this->InitializePyMod()) pymod_ok = false;
182
186
      _reff[n] = reff;
183
187
      // std::cout << key << " pos:" << n << "  t0:" << p0 << "  reff:" << reff << std::endl;
184
188
    }
185
 
  } catch(Squeal e) {
 
189
  } catch (MAUS::Exception e) {
186
190
    Squeak::mout(Squeak::error)
187
191
    << "Error in TOFCalibrationMap::LoadT0File : Error during loading. " << std::endl
188
192
    << e.GetMessage() << std::endl;
215
219
      _twPar[n][3] = p3;
216
220
      // std::cout<< key << " pos:" << n << "  p0:" << p0 << "  p1:" << p1 << std::endl;
217
221
    }
218
 
  } catch(Squeal e) {
 
222
  } catch (MAUS::Exception e) {
219
223
    Squeak::mout(Squeak::error)
220
224
    << "Error in TOFCalibrationMap::LoadTWFile : Error during loading. " << std::endl
221
225
    << e.GetMessage() << std::endl;
243
247
      _Trt0.push_back(dt);
244
248
      // std::cout<< Pkey << "  dt:" << dt << std::endl;
245
249
    }
246
 
  } catch(Squeal e) {
 
250
  } catch (MAUS::Exception e) {
247
251
    Squeak::mout(Squeak::error)
248
252
    << "Error in TOFCalibrationMap::LoadTriggerFile. Error during loading. " << std::endl
249
253
    << e.GetMessage() << std::endl;
376
380
  std::cout<< "===================================================================" << std::endl;
377
381
}
378
382
 
379
 
TOFPixelKey::TOFPixelKey(string keyStr) throw(Squeal) {
 
383
TOFPixelKey::TOFPixelKey(string keyStr) throw(MAUS::Exception) {
380
384
  std::stringstream xConv;
381
385
  try {
382
386
    xConv << keyStr;
383
387
    xConv >> (*this);
384
 
  }catch(Squeal e) {
385
 
    throw(Squeal(Squeal::recoverable,
 
388
  }catch(MAUS::Exception e) {
 
389
    throw(MAUS::Exception(MAUS::Exception::recoverable,
386
390
                 std::string("corrupted TOF Pixel Key"),
387
391
                 "TOFPixelKey::TOFPixelKey(std::string)"));
388
392
  }
418
422
  return stream;
419
423
}
420
424
 
421
 
istream& operator>>( istream& stream, TOFPixelKey &key ) throw(Squeal) {
 
425
istream& operator>>( istream& stream, TOFPixelKey &key ) throw(MAUS::Exception) {
422
426
  string xLabel;
423
427
  stream >> xLabel >> key._station >> key._slabX >> key._slabY >> key._detector;
424
428
 
425
429
  if (xLabel != "TOFPixelKey") {
426
 
    throw(Squeal(Squeal::recoverable,
 
430
    throw(MAUS::Exception(MAUS::Exception::recoverable,
427
431
                 std::string("corrupted TOF Pixel Key"),
428
432
                 "istream& operator>>(istream& stream, TOFPixelKey)"));
429
433
  }
480
484
  py_arg = Py_BuildValue("(sss)", devname.c_str(), caltype.c_str(), fromdate.c_str());
481
485
  if (py_arg == NULL) {
482
486
    PyErr_Clear();
483
 
    throw(Squeal(Squeal::recoverable,
 
487
    throw(MAUS::Exception(MAUS::Exception::recoverable,
484
488
              "Failed to resolve arguments to get_calib",
485
489
              "MAUSEvaluator::evaluate"));
486
490
    }
497
501
    if (py_value == NULL) {
498
502
        PyErr_Clear();
499
503
        Py_XDECREF(py_arg);
500
 
        throw(Squeal(Squeal::recoverable,
 
504
        throw(MAUS::Exception(MAUS::Exception::recoverable,
501
505
                     "Failed to parse argument "+devname,
502
506
                     "GetCalib::get_calib"));
503
507
    }
520
524
      _reff[n] = reff;
521
525
      // std::cout << key << " pos:" << n << "  t0:" << p0 << "  reff:" << reff << std::endl;
522
526
    }
523
 
  } catch(Squeal e) {
 
527
  } catch (MAUS::Exception e) {
524
528
    Squeak::mout(Squeak::error)
525
529
    << "Error in TOFCalibrationMap::LoadT0Calib : Error during loading. " << std::endl
526
530
    << e.GetMessage() << std::endl;
547
551
      _twPar[n][3] = p3;
548
552
       // std::cout<< key << " pos:" << n << "  p0:" << p0 << "  p1:" << p1 << std::endl;
549
553
    }
550
 
  } catch(Squeal e) {
 
554
  } catch (MAUS::Exception e) {
551
555
    Squeak::mout(Squeak::error)
552
556
    << "Error in TOFCalibrationMap::LoadTWCalib : Error during loading. " << std::endl
553
557
    << e.GetMessage() << std::endl;
569
573
      _Trt0.push_back(dt);
570
574
       // std::cout<< Pkey << "  dt:" << dt << std::endl;
571
575
    }
572
 
  } catch(Squeal e) {
 
576
  } catch (MAUS::Exception e) {
573
577
    Squeak::mout(Squeak::error)
574
578
    << "Error in TOFCalibrationMap::LoadTriggerCalib. Error during loading. " << std::endl
575
579
    << e.GetMessage() << std::endl;
580
584
 
581
585
  return true;
582
586
}
 
587
}