StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
FwdDataSource.h
1 #ifndef FWD_FWD_DATA_SOURCE_H
2 #define FWD_FWD_DATA_SOURCE_H
3 
4 #include <map>
5 #include "StFwdTrackMaker/include/Tracker/FwdHit.h"
6 
7 
8 /* Authoritative Data Source for Fwd tracks + hits
9  *
10  * Separation here is not great, but the track/hit loading
11  * is tightly bound to the StMaker through the ttree and histogram
12  * creation, as well as through the Datasets (StEvent, geant )
13  *
14  * So while the filling is done elsewhere, this holds that
15  * data and releases the pointers when needed.
16  */
18  public:
19 
20  using HitMap_t = std::map<int, std::vector<KiTrack::IHit*>>;
21  using McTrackMap_t = std::map<int, shared_ptr<McTrack>>;
22 
23  HitMap_t &getFttHits( ) {
24  return mFttHits;
25  };
26  HitMap_t &getFstHits() {
27  return mFstHits;
28  };
29  McTrackMap_t &getMcTracks() {
30  return mMcTracks;
31  };
32 
33  // Cleanup
34  void clear() {
35 
36  // delete the hits from the hitmap
37  for ( auto kv : mFttHits ){
38  for ( auto h : kv.second ){
39  delete h;
40  }
41  kv.second.clear();
42  }
43 
44  for ( auto kv : mFstHits ){
45  for ( auto h : kv.second ){
46  delete h;
47  }
48  kv.second.clear();
49  }
50 
51  // the tracks are shared pointers, so they will be taken care of by clearing the map (below)
52 
53  mFttHits.clear();
54  mFstHits.clear();
55  mMcTracks.clear();
56  }
57 
58  // TODO, protect and add interaface for pushing hits / tracks
59  HitMap_t mFttHits;
60  HitMap_t mFstHits;
61  McTrackMap_t mMcTracks;
62 };
63 
64 
65 
66 
67 #endif