FairRoot/PandaRoot
PndEmcMakeRecoHit.cxx
Go to the documentation of this file.
1 //---------------------------------------------------------------------
2 // File and Version Information:
3 // $Id: $
4 //
5 // Description:
6 // This task convert PndEmcBumps to PndEmcRecoHit objects
7 // At the moment PndEmcBump and PndEmcRecoHit have alsmost identically structure
8 // The main difference that for PndEmcBump position() nad energy() calculate corresponding values but for PndEmcRecoHit just return corresponding data member
9 //
10 // Environment:
11 // Software developed for the PANDA Detector at GSI.
12 //
13 //------------------------------------------------------------------------
14 
15 #include "PndEmcMakeRecoHit.h"
16 
17 #include "PndEmcRecoHit.h"
18 #include "PndEmcBump.h"
19 #include "PndEmcRecoPar.h"
20 #include "PndDetectorList.h"
21 
22 #include "FairRootManager.h"
23 #include "FairRunAna.h"
24 #include "FairRuntimeDb.h"
25 
26 #include "TClonesArray.h"
27 #include "TStopwatch.h"
28 #include "TROOT.h"
29 #include "TVector3.h"
30 
31 #include <iostream>
32 //#include <vector>
33 //#include <set>
34 
35 using std::cout;
36 using std::endl;
37 
39 fBumpArray(0), fRecoHitArray(0), fRecoPar(new PndEmcRecoPar()), fVerbose(verbose)
40 {
41  SetPersistency(storerecohits);
42 }
43 
44 //--------------
45 // Destructor --
46 //--------------
47 
49 {
50 }
51 
52 // ----- Public method Init -------------------------------
54 
55  // Get RootManager
56  FairRootManager* ioman = FairRootManager::Instance();
57  if ( ! ioman )
58  {
59  cout << "-E- PndEmcMakeRecoHit::Init: "
60  << "RootManager not instantiated!" << endl;
61  return kFATAL;
62  }
63 
64  // Get input array
65  fBumpArray = dynamic_cast<TClonesArray *>(ioman->GetObject("EmcBump"));
66  if ( ! fBumpArray ) {
67  cout << "-W- PndEmcMakeRecoHit::Init: "
68  << "No PndEmcBump array!" << endl;
69  return kERROR;
70  }
71 
72  // Create and register output array
73  fRecoHitArray = new TClonesArray("PndEmcRecoHit");
74 
75  ioman->Register("EmcRecoHit","Emc",fRecoHitArray,GetPersistency());
76 
77  cout << "-I- PndEmcMakeRecoHit: Intialization successfull" << endl;
78 
79  return kSUCCESS;
80 }
81 
82 
83 void PndEmcMakeRecoHit::Exec(Option_t*)
84 {
85  // Reset output array
86  if ( ! fRecoHitArray ) Fatal("Exec", "No Cluster Array");
87  fRecoHitArray->Delete();
88 
89  Int_t nBumps = fBumpArray->GetEntriesFast();
90 
91  //loop to build Cluster
92  for (Int_t iBump=0; iBump<nBumps; iBump++)
93  {
94  PndEmcBump* theBump = (PndEmcBump*) fBumpArray->At(iBump);
95  Double_t energy=theBump->energy();
96  TVector3 position=theBump->position();
97  PndEmcRecoHit* myHit = new((*fRecoHitArray)[iBump]) PndEmcRecoHit(energy,position);
98  myHit->SetLink(FairLink("EmcBump", iBump));
99 
100  }
101 }
102 
104 
105  // Get run and runtime database
106  FairRun* run = FairRun::Instance();
107  if ( ! run ) Fatal("SetParContainers", "No analysis run");
108 
109  FairRuntimeDb* db = run->GetRuntimeDb();
110  if ( ! db ) Fatal("SetParContainers", "No runtime database");
111 
112  // Get Emc reconstruction parameter container
113  fRecoPar = (PndEmcRecoPar*) db->getContainer("PndEmcRecoPar");
114 }
115 
117 {
118  SetPersistency(val);
119  return;
120 }
121 
122 
int fVerbose
Definition: poormantracks.C:24
Int_t run
Definition: autocutx.C:47
Create PndEmcRecoHit from PndEmcBump.
void SetStorageOfData(Bool_t val)
PndEmcRecoPar * fRecoPar
Double_t val[nBoxes][nFEBox]
Definition: createCalib.C:11
#define verbose
void SetPersistency(Bool_t val=kTRUE)
TVector3 position() const
PndEmcMakeRecoHit(Int_t verbose=0, Bool_t storerecohits=kTRUE)
virtual void SetParContainers()
Double_t
TClonesArray * fBumpArray
virtual InitStatus Init()
represents the reconstructed hit in the emc
Definition: PndEmcRecoHit.h:23
TClonesArray * fRecoHitArray
virtual Double_t energy() const
ClassImp(PndAnaContFact)
represents a reconstructed (splitted) emc cluster
Definition: PndEmcBump.h:34
virtual void Exec(Option_t *opt)
Parameter set for Emc Reco.
Definition: PndEmcRecoPar.h:12
Double_t energy
Definition: plot_dirc.C:15