CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Globals.cc
Go to the documentation of this file.
1 // Globals: holds "global" variables such as the IMATH_TrackletCalculators
10 
11 using namespace std;
12 using namespace trklet;
13 
14 Globals::Globals(Settings const& settings) {
15  imathGlobals* imathGlobs = new imathGlobals();
16 
17  //takes owernship of globals pointer
18  imathGlobals_.reset(imathGlobs);
19 
20  // tracklet calculators
21  ITC_L1L2_ = make_unique<IMATH_TrackletCalculator>(settings, imathGlobs, 1, 2);
22  ITC_L2L3_ = make_unique<IMATH_TrackletCalculator>(settings, imathGlobs, 2, 3);
23  ITC_L3L4_ = make_unique<IMATH_TrackletCalculator>(settings, imathGlobs, 3, 4);
24  ITC_L5L6_ = make_unique<IMATH_TrackletCalculator>(settings, imathGlobs, 5, 6);
25 
26  ITC_F1F2_ = make_unique<IMATH_TrackletCalculatorDisk>(settings, imathGlobs, 1, 2);
27  ITC_F3F4_ = make_unique<IMATH_TrackletCalculatorDisk>(settings, imathGlobs, 3, 4);
28  ITC_B1B2_ = make_unique<IMATH_TrackletCalculatorDisk>(settings, imathGlobs, -1, -2);
29  ITC_B3B4_ = make_unique<IMATH_TrackletCalculatorDisk>(settings, imathGlobs, -3, -4);
30 
31  ITC_L1F1_ = make_unique<IMATH_TrackletCalculatorOverlap>(settings, imathGlobs, 1, 1);
32  ITC_L2F1_ = make_unique<IMATH_TrackletCalculatorOverlap>(settings, imathGlobs, 2, 1);
33  ITC_L1B1_ = make_unique<IMATH_TrackletCalculatorOverlap>(settings, imathGlobs, 1, -1);
34  ITC_L2B1_ = make_unique<IMATH_TrackletCalculatorOverlap>(settings, imathGlobs, 2, -1);
35 }
36 
37 Globals::~Globals() {
38  for (auto i : thePhiCorr_) {
39  delete i;
40  i = nullptr;
41  }
42 }
43 
44 std::ofstream& Globals::ofstream(std::string fname) {
45  if (ofstreams_.find(fname) != ofstreams_.end()) {
46  return *(ofstreams_[fname]);
47  }
48  std::ofstream* outptr = new std::ofstream(fname.c_str());
49  ofstreams_[fname] = outptr;
50  return *outptr;
51 }
string fname
main script