FairRoot/PandaRoot
PndGemEmpty.cxx
Go to the documentation of this file.
1 /* $Id: */
2 
3 // -------------------------------------------------------------------------
4 // ----- PndGemEmpty source file -----
5 // ----- Created 15/02/2009 by R. Karabowicz -----
6 // -------------------------------------------------------------------------
7 
16 #include "PndGemEmpty.h"
17 
18 #include "PndGemCluster.h"
19 #include "PndGemDigi.h"
20 #include "PndGemDigiPar.h"
21 #include "PndGemSensor.h"
22 #include "PndGemStation.h"
23 
24 #include "PndDetectorList.h"
25 
26 #include "FairRootManager.h"
27 #include "FairRunAna.h"
28 #include "FairRuntimeDb.h"
29 
30 #include "TClonesArray.h"
31 #include "TMath.h"
32 #include "TRandom2.h"
33 
34 #include <iomanip>
35 
36 using std::cout;
37 using std::cerr;
38 using std::endl;
39 using std::flush;
40 using std::fixed;
41 using std::right;
42 using std::left;
43 using std::setw;
44 using std::setprecision;
45 using std::set;
46 using std::map;
47 
48 // ----- Default constructor ------------------------------------------
50  : FairTask("GEMEmpty", 0),
51  fFunctor (NULL),
52  fInBranch (NULL),
53  fOutBranch (NULL),
54  fInBranchName("GEMDigi")
55 {
56 }
57 // -------------------------------------------------------------------------
58 
59 
60 
61 // ----- Standard constructor ------------------------------------------
63  : FairTask("GEMEmpty", iVerbose),
64  fFunctor (NULL),
65  fInBranch (NULL),
66  fOutBranch (NULL),
67  fInBranchName("GEMDigi")
68 {
69 }
70 // -------------------------------------------------------------------------
71 
72 
73 
74 // ----- Constructor with name -----------------------------------------
76  : FairTask(name, iVerbose),
77  fFunctor (NULL),
78  fInBranch (NULL),
79  fOutBranch (NULL),
80  fInBranchName("GEMDigi") {
81 }
82 // -------------------------------------------------------------------------
83 
84 
85 
86 // ----- Destructor ----------------------------------------------------
88  if ( 0!=fOutBranch ) {
89  fOutBranch->Delete();
90  delete fOutBranch;
91  }
92  if ( 0!=fFunctor ) delete fFunctor;
93 }
94 // -------------------------------------------------------------------------
95 
96 
97 
98 // ----- Public method Exec --------------------------------------------
99 void PndGemEmpty::Exec(Option_t*) {
100  // cout << endl << "======== PndGemEmpty::Exec(Event = " << fTNofEvents << " ) ====================" << endl;
101 
102  if ( fInBranchName.Contains("Sorted") ) {
103  fInBranch->Clear();
104  fInBranch = FairRootManager::Instance()->GetData(fInBranchName, fFunctor, 20.); //FairRootManager::Instance()->GetEventTime() +
105  }
106  else
107  fInBranch = (TClonesArray*)FairRootManager::Instance()->GetObject(fInBranchName);
108 
109  fOutBranch = FairRootManager::Instance()->GetTClonesArray("GEMCluster");
110  if ( ! fOutBranch ) Fatal("Exec", "No GEM Cluster Array");
111  fOutBranch->Delete();
112 
113  std::vector<Int_t> clusterRefs;
114  //PndGemCluster* cluster = NULL;
115  for ( Int_t iout = 0 ; iout < fInBranch->GetEntries()/14 ; iout++ ) {
116  new ((*fOutBranch)[iout]) PndGemCluster(585180824,
117  iout,
118  0,
119  iout*2.,
120  100,
121  0,
122  clusterRefs);
123 
124  }
125 
126  std::cout << "-I- PndGemEmpty::Exec. There are " << fInBranch->GetEntries() << " objects of " << fInBranchName.Data() << std::endl;
127 
128 }
129 // -------------------------------------------------------------------------
130 
131 
132 // ----- Private method SetParContainers -------------------------------
134 
135  // Get run and runtime database
136  FairRunAna* run = FairRunAna::Instance();
137  if ( ! run ) Fatal("SetParContainers", "No analysis run");
138 
139  FairRuntimeDb* db = run->GetRuntimeDb();
140  if ( ! db ) Fatal("SetParContainers", "No runtime database");
141 
142 }
143 // -------------------------------------------------------------------------
144 
145 
146 
147 
148 // ----- Private method Init -------------------------------------------
149 InitStatus PndGemEmpty::Init() {
150 
151  // Get input array
152  FairRootManager* ioman = FairRootManager::Instance();
153  if ( ! ioman ) Fatal("Init", "No FairRootManager");
154  fInBranch = (TClonesArray*) ioman->GetObject(fInBranchName.Data());
155  fOutBranch = ioman->Register("GEMCluster", "PndGemCluster", "PndGEM", kTRUE);
156 
157  fFunctor = new TimeGap();
158 
159  cout << "-I- " << fName.Data() << "::Init(). Initialization succesfull." << endl;
160 
161  return kSUCCESS;
162 }
163 // -------------------------------------------------------------------------
164 
165 
166 
167 
168 // ----- Private method ReInit -----------------------------------------
169 InitStatus PndGemEmpty::ReInit() {
170 
171  // Create sectorwise digi sets
172  // MakeSets();
173 
174  return kSUCCESS;
175 }
176 // -------------------------------------------------------------------------
177 
178 
179 
180 // ----- Public method Finish ------------------------------------------
182  if ( fOutBranch ) fOutBranch->Clear();
183 
184  cout << "-------------------- " << fName.Data() << " : Summary -----------------------" << endl;
185  cout << "-- DONE -- " << endl;
186  cout << "---------------------------------------------------------------------" << endl;
187 
188 }
189 // -------------------------------------------------------------------------
190 
191 
193 
Int_t run
Definition: autocutx.C:47
virtual void Finish()
PndTransMap * map
Definition: sim_emc_apd.C:99
virtual void Exec(Option_t *opt)
Definition: PndGemEmpty.cxx:99
TClonesArray * fOutBranch
Definition: PndGemEmpty.h:69
TString fInBranchName
Definition: PndGemEmpty.h:70
BinaryFunctor * fFunctor
Definition: PndGemEmpty.h:67
TString name
virtual InitStatus ReInit()
TClonesArray * fInBranch
Definition: PndGemEmpty.h:68
virtual void SetParContainers()
ClassImp(PndAnaContFact)
Int_t iVerbose
virtual ~PndGemEmpty()
Definition: PndGemEmpty.cxx:87
virtual InitStatus Init()