EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CbmMCMatchLoaderTask.cxx
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file CbmMCMatchLoaderTask.cxx
1 // -------------------------------------------------------------------------
2 // ----- CbmMCMatchLoaderTask source file -----
3 // ----- Created 18/07/08 by T.Stockmanns -----
4 // -------------------------------------------------------------------------
5 #include "CbmMCMatchLoaderTask.h"
6 
7 #include "CbmMCMatch.h"
8 #include "CbmDetectorList.h"
9 
10 // framework includes
11 #include "FairRootManager.h"
12 
13 // Root includes
14 #include "TClonesArray.h"
15 
16 // libc includes
17 #include <iostream>
18 using std::cout;
19 using std::endl;
20 
21 // ----- Default constructor -------------------------------------------
23  : FairTask("Creates CbmMCMatch"),
24  fMCLink(NULL),
25  fEventNr(0),
26  fMCMatch(NULL)
27 {
28 }
29 // -------------------------------------------------------------------------
30 
31 
32 // ----- Destructor ----------------------------------------------------
34 {
35 }
36 
37 // ----- Public method Init --------------------------------------------
39 {
40  fMCMatch = new CbmMCMatch("CbmMCMatch", "CbmMCMatch");
41 
42 // fMCMatch->InitStage(kMCTrack, "", "MCTrack");
43  fMCMatch->InitStage(kStsPoint, "", "StsPoint");
44  fMCMatch->InitStage(kStsDigi, "", "StsDigi");
45  fMCMatch->InitStage(kStsCluster, "", "StsCluster");
46  fMCMatch->InitStage(kStsHit, "", "StsHit");
47 
48 
50  if (!ioman) {
51  cout << "-E- CbmMCMatchLoaderTask::Init: "
52  << "RootManager not instantiated!" << endl;
53  return kFATAL;
54  }
55 
56  fMCLink = (TClonesArray*)ioman->GetObject("MCLink");
57  ioman->Register("MCMatch", "MCMatch", fMCMatch, kFALSE);
58 
59  return kSUCCESS;
60 }
61 
62 
63 // -------------------------------------------------------------------------
65 {
66  // Get Base Container
67 // FairRun* ana = FairRun::Instance();
68 // FairRuntimeDb* rtdb=ana->GetRuntimeDb();
69 
70 }
71 
72 
73 // ----- Public method Exec --------------------------------------------
74 void CbmMCMatchLoaderTask::Exec(Option_t* opt)
75 {
76 /* for (int trackIndex = 0; trackIndex < fTrack->GetEntriesFast(); trackIndex++){
77  CbmTrack* myTrack = (CbmTrack*)fTrack->At(trackIndex);
78  fMCMatch->AddElement(kTrack, trackIndex, kTrackCand, myTrack->GetRefIndex());
79  }
80 */
81 
82  if (!fMCLink) Fatal("Exec", "No fMCLink");
83 // fMCLinkDet->Delete();
84 // fMCLinkHit->Delete();
86 
89 
90  fMCMatch->Print();
91  cout << endl;
92 }
93 
95 {
96 }
97 
98