~mwinter4/maus/ckov-update

« back to all changes in this revision

Viewing changes to src/legacy/Interface/dataCards.cc

  • Committer: Durga Rajaram
  • Date: 2014-01-14 07:07:02 UTC
  • mfrom: (659.1.80 relcand)
  • Revision ID: durga@fnal.gov-20140114070702-2l1fuj1w6rraw7xe
Tags: MAUS-v0.7.6
MAUS-v0.7.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
 
10
10
#include "Interface/dataCards.hh"
11
11
#include "Interface/Squeak.hh"
12
 
#include "Interface/Squeal.hh"
 
12
#include "Utils/Exception.hh"
13
13
#include "CLHEP/Units/SystemOfUnits.h"
14
14
using CLHEP::ms;
15
15
using CLHEP::mm;
52
52
  initializeApplicationCodes();
53
53
  std::map<std::string,int>::iterator i = appCode.find(client);
54
54
  if (i == appCode.end()) {
55
 
    throw(Squeal(Squeal::recoverable, "Unrecognized client application for datacards", "dataCards(...)"));
 
55
    throw(MAUS::Exception(MAUS::Exception::recoverable, "Unrecognized client application for datacards", "dataCards(...)"));
56
56
  }
57
57
  fillCards(i->second);
58
58
}
110
110
  }
111
111
  else
112
112
  {
113
 
    throw(Squeal(Squeal::recoverable, "Unrecognized client application for datacards", "dataCards::fillCards"));
 
113
    throw(MAUS::Exception(MAUS::Exception::recoverable, "Unrecognized client application for datacards", "dataCards::fillCards"));
114
114
  }
115
115
  cs["FileTag"] = ""; //Can be used as a component of output filenames for various applications, being descriptive of the beam and analysis, e.g. 400MeVpions. Convenient for batch scripts.
116
116
 
497
497
      is >> vd;
498
498
    }
499
499
    else {
500
 
      throw(Squeal(Squeal::recoverable, "Error reading key "+t+". Bad data format", "dataCards::readKeys"));
 
500
      throw(MAUS::Exception(MAUS::Exception::recoverable, "Error reading key "+t+". Bad data format", "dataCards::readKeys"));
501
501
    }
502
502
    cvec[i] = vd;
503
503
  }
506
506
      }
507
507
    }
508
508
    if (ok != 1)
509
 
      throw(Squeal(Squeal::recoverable, "Failed to recognise datacard "+t+".", "dataCards::readKeys"));
 
509
      throw(MAUS::Exception(MAUS::Exception::recoverable, "Failed to recognise datacard "+t+".", "dataCards::readKeys"));
510
510
  }
511
511
  return 1;
512
512
}
515
515
{
516
516
  InputDataCardsDouble::iterator i=cd.find(key);
517
517
  if (i == cd.end())
518
 
    throw(Squeal(Squeal::recoverable, "Error fetching unknown datacard "+key+".", "dataCards::fetchValueDouble"));
 
518
    throw(MAUS::Exception(MAUS::Exception::recoverable, "Error fetching unknown datacard "+key+".", "dataCards::fetchValueDouble"));
519
519
  return i->second;
520
520
}
521
521
 
522
522
int dataCards::fetchValueInt(const std::string& key){
523
523
 InputDataCardsInt::iterator i=ci.find(key);
524
524
 if( i == ci.end())
525
 
    throw(Squeal(Squeal::recoverable, "Error fetching unknown datacard "+key+".", "dataCards::fetchValueInt"));
 
525
    throw(MAUS::Exception(MAUS::Exception::recoverable, "Error fetching unknown datacard "+key+".", "dataCards::fetchValueInt"));
526
526
 else
527
527
   return i->second;
528
528
 InputDataCardsDouble::iterator i2=cd.find(key); // only gets here if not
529
529
 if( i2 == cd.end())                             // stored as int
530
 
    throw(Squeal(Squeal::recoverable, "Error fetching unknown datacard "+key+".", "dataCards::fetchValueInt"));
 
530
    throw(MAUS::Exception(MAUS::Exception::recoverable, "Error fetching unknown datacard "+key+".", "dataCards::fetchValueInt"));
531
531
 return (int) i->second;
532
532
}
533
533
 
535
535
{
536
536
  InputDataCards3Vector::iterator i=c3v.find(key);
537
537
  if (i == c3v.end())
538
 
    throw(Squeal(Squeal::recoverable, "Error fetching unknown datacard "+key+".", "dataCards::fetchValue3Vector"));
 
538
    throw(MAUS::Exception(MAUS::Exception::recoverable, "Error fetching unknown datacard "+key+".", "dataCards::fetchValue3Vector"));
539
539
  return i->second;
540
540
}
541
541
 
543
543
{
544
544
  InputDataCardsString::iterator i=cs.find(key);
545
545
  if (i == cs.end())
546
 
    throw(Squeal(Squeal::recoverable, "Error fetching unknown datacard "+key+".", "dataCards::fetchValueString"));
 
546
    throw(MAUS::Exception(MAUS::Exception::recoverable, "Error fetching unknown datacard "+key+".", "dataCards::fetchValueString"));
547
547
  return i->second;
548
548
}
549
549
 
551
551
{
552
552
  InputDataCardsVector::iterator i=cv.find(key);
553
553
  if (i == cv.end())
554
 
    throw(Squeal(Squeal::recoverable, "Error fetching unknown datacard "+key+".", "dataCards::fetchValueVector"));
 
554
    throw(MAUS::Exception(MAUS::Exception::recoverable, "Error fetching unknown datacard "+key+".", "dataCards::fetchValueVector"));
555
555
  return i->second;
556
556
}
557
557
 
588
588
    std::cout << ")";
589
589
    return;
590
590
  }
591
 
  throw(Squeal(Squeal::recoverable, "datacard "+key+" not found.", "dataCards::printValue"));
 
591
  throw(MAUS::Exception(MAUS::Exception::recoverable, "datacard "+key+" not found.", "dataCards::printValue"));
592
592
}
593
593
 
594
594
std::ostream& operator<<(std::ostream& o, const dataCards& d)