FairRoot/PandaRoot
RhoFactory.cxx
Go to the documentation of this file.
1 // //
3 // RhoFactory //
4 // //
5 // Object factory for RhoCandidate and Vertices (RhoVector3Err) //
6 // //
7 // Author List: //
8 // Marcel Kunze, RUB, Feb. 01 //
9 // Copyright (C) 1999-2001, Ruhr-University Bochum. //
10 // Ralf Kliemt, HIM/GSI Feb.2013 (Cleanup & Restructuring) //
11 // //
13 
14 #include <stdlib.h>
15 
16 #include "RhoBase/RhoFactory.h"
17 #include "RhoBase/RhoCandidate.h"
18 
20 
21 using namespace std;
22 
23 RhoFactory* RhoFactory::fgInstance = 0;
24 TClonesArray* RhoFactory::fgCandBuffer = 0;
25 Int_t RhoFactory::fgCandPointer=0;
26 Int_t RhoFactory::fgCandWatermark=0;
27 
29 {
30  if (fgCandBuffer != 0) fgCandBuffer->Delete();
31  fgCandPointer = 0;
32 }
33 
35 {
36  if ( !fgInstance ) { fgInstance= new RhoFactory(); }
37  return fgInstance;
38 }
39 
41 {
42  if(fgCandBuffer){
43  fgCandBuffer->Delete();
44  delete fgCandBuffer;
45  }
46  delete fgInstance;
47  fgInstance = 0;
48 }
49 
50 //---------------------------------------
51 
53 {
55  return NewCandidate ( c );
56 }
57 
59 {
60  return NewCandidate(&c);
61 // if ( fgCandBuffer==0 ) { fgCandBuffer = new TClonesArray ( "RhoCandidate" ); }
62 // int current = fgCandPointer++;
63 // if ( current>fgCandWatermark ) { fgCandWatermark = current; }
64 // if ( current<fgCandWatermark ) {
65 // RhoCandidate* b = GetCandidate ( current );
66 // b->RemoveAssociations();
67 // }
68 // new ( ( *fgCandBuffer ) [current] ) RhoCandidate ( c );
69 // return GetCandidate ( current );
70 }
71 
73 {
74  if ( fgCandBuffer==0 ) { fgCandBuffer = new TClonesArray ( "RhoCandidate" ); }
75  int current = fgCandPointer++;
76  if ( current>fgCandWatermark ) { fgCandWatermark = current; }
77  if ( current<fgCandWatermark ) {
78  RhoCandidate* b = GetCandidate ( current );
79  b->RemoveAssociations();
80  }
81  new ( ( *fgCandBuffer ) [current] ) RhoCandidate ( *c );
82  return GetCandidate ( current );
83 }
84 
85 
86 
87 // RhoCandidate* RhoFactory::NewCandidate ( TLorentzVector p4,
88 // RhoError& p4Err,
89 // RhoCandListIterator& iterDau,
90 // RhoVector3Err& theVertex,
91 // const TParticlePDG* hypo )
92 // {
93 // if ( fgCandBuffer==0 ) { fgCandBuffer = new TClonesArray ( "RhoCandidate" ); }
94 // int current = fgCandPointer++;
95 // if ( current>fgCandWatermark ) { fgCandWatermark = current; }
96 // if ( current<fgCandWatermark ) {
97 // RhoCandidate* c = GetCandidate ( current );
98 // c->RemoveAssociations();
99 // }
100 // new ( ( *fgCandBuffer ) [current] ) RhoCandidate ( p4,p4Err,iterDau,theVertex,hypo );
101 // return GetCandidate ( current );
102 // }
103 
105 {
106  if ( fgCandBuffer==0 || i>fgCandWatermark ) { return 0; }
107  return ( RhoCandidate* ) ( *fgCandBuffer ) [i];
108 }
109 
111 {
112  return fgCandWatermark;
113 }
114 
116 {
117  return fgCandPointer;
118 }
119 
Int_t i
Definition: run_full.C:25
TTree * b
static Int_t fgCandPointer
Candidate buffer.
Definition: RhoFactory.h:52
static Int_t fgCandWatermark
Definition: RhoFactory.h:53
void RemoveAssociations()
static RhoFactory * Instance()
Definition: RhoFactory.cxx:34
static TClonesArray * fgCandBuffer
Do not stream.
Definition: RhoFactory.h:51
static Int_t GetCandidateWatermark()
Definition: RhoFactory.cxx:110
static RhoCandidate * NewCandidate()
Definition: RhoFactory.cxx:52
static RhoFactory * fgInstance
Definition: RhoFactory.h:50
ClassImp(PndAnaContFact)
static RhoCandidate * GetCandidate(Int_t)
Definition: RhoFactory.cxx:104
static Int_t GetCandPointer()
Definition: RhoFactory.cxx:115
virtual ~RhoFactory()
Definition: RhoFactory.cxx:40
gROOT Reset()