Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-07 22:33:31

0001 // Globals: holds "global" variables such as the IMATH_TrackletCalculators
0002 #include "L1Trigger/TrackFindingTracklet/interface/Settings.h"
0003 #include "L1Trigger/TrackFindingTracklet/interface/Globals.h"
0004 #include "L1Trigger/TrackFindingTracklet/interface/imath.h"
0005 #include "L1Trigger/TrackFindingTracklet/interface/IMATH_TrackletCalculator.h"
0006 #include "L1Trigger/TrackFindingTracklet/interface/IMATH_TrackletCalculatorDisk.h"
0007 #include "L1Trigger/TrackFindingTracklet/interface/IMATH_TrackletCalculatorOverlap.h"
0008 #include "L1Trigger/TrackFindingTracklet/interface/TrackletLUT.h"
0009 #include "L1Trigger/TrackFindingTracklet/interface/HistBase.h"
0010 
0011 using namespace std;
0012 using namespace trklet;
0013 
0014 Globals::Globals(Settings const& settings) {
0015   imathGlobals* imathGlobs = new imathGlobals();
0016 
0017   //takes owernship of globals pointer
0018   imathGlobals_.reset(imathGlobs);
0019 
0020   // tracklet calculators
0021   ITC_L1L2_ = make_unique<IMATH_TrackletCalculator>(settings, imathGlobs, 1, 2);
0022   ITC_L2L3_ = make_unique<IMATH_TrackletCalculator>(settings, imathGlobs, 2, 3);
0023   ITC_L3L4_ = make_unique<IMATH_TrackletCalculator>(settings, imathGlobs, 3, 4);
0024   ITC_L5L6_ = make_unique<IMATH_TrackletCalculator>(settings, imathGlobs, 5, 6);
0025 
0026   ITC_F1F2_ = make_unique<IMATH_TrackletCalculatorDisk>(settings, imathGlobs, 1, 2);
0027   ITC_F3F4_ = make_unique<IMATH_TrackletCalculatorDisk>(settings, imathGlobs, 3, 4);
0028   ITC_B1B2_ = make_unique<IMATH_TrackletCalculatorDisk>(settings, imathGlobs, -1, -2);
0029   ITC_B3B4_ = make_unique<IMATH_TrackletCalculatorDisk>(settings, imathGlobs, -3, -4);
0030 
0031   ITC_L1F1_ = make_unique<IMATH_TrackletCalculatorOverlap>(settings, imathGlobs, 1, 1);
0032   ITC_L2F1_ = make_unique<IMATH_TrackletCalculatorOverlap>(settings, imathGlobs, 2, 1);
0033   ITC_L1B1_ = make_unique<IMATH_TrackletCalculatorOverlap>(settings, imathGlobs, 1, -1);
0034   ITC_L2B1_ = make_unique<IMATH_TrackletCalculatorOverlap>(settings, imathGlobs, 2, -1);
0035 }
0036 
0037 Globals::~Globals() {
0038   for (auto i : thePhiCorr_) {
0039     delete i;
0040     i = nullptr;
0041   }
0042 }
0043 
0044 std::ofstream& Globals::ofstream(std::string fname) {
0045   if (ofstreams_.find(fname) != ofstreams_.end()) {
0046     return *(ofstreams_[fname]);
0047   }
0048   std::ofstream* outptr = new std::ofstream(fname.c_str());
0049   ofstreams_[fname] = outptr;
0050   return *outptr;
0051 }