LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
GFRecoHitProducer.h
Go to the documentation of this file.
1 /* Copyright 2008-2010, Technische Universitaet Muenchen,
2  Authors: Christian Hoeppner & Sebastian Neubert
3 
4  This file is part of GENFIT.
5 
6  GENFIT is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Lesser General Public License as published
8  by the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  GENFIT is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public License
17  along with GENFIT. If not, see <http://www.gnu.org/licenses/>.
18 */
29 #ifndef GFRECOHITPRODUCER_H
30 #define GFRECOHITPRODUCER_H
31 
32 #include<vector>
33 #include<map>
34 
35 #include "TClonesArray.h"
36 
38 
39 class GFAbsRecoHit;
40 
46 public:
50  virtual GFAbsRecoHit* produce(int index)=0;
51  virtual ~GFAbsRecoHitProducer();
52 };
53 
54 
77 template <class hit_T,class recoHit_T>
79  private:
81  TClonesArray* hitArrayTClones;
82  //std::vector<GFAbsRecoHit*>* hitArrayVector;
83  public:
84 
86  GFRecoHitProducer(TClonesArray*);
87  //GFRecoHitProducer(std::vector<GFAbsRecoHit*>*);
88  virtual ~GFRecoHitProducer();
89 
93  virtual GFAbsRecoHit* produce(int index);
94 };
97 template <class hit_T,class recoHit_T>
99  hitArrayTClones = theArr;
100  //hitArrayVector = NULL;
101 }
102 /*
103 template <class hit_T,class recoHit_T>
104  GFRecoHitProducer<hit_T,recoHit_T>::GFRecoHitProducer(std::vector<GFAbsRecoHit*>* theArr) {
105  hitArrayTClones = NULL;
106  hitArrayVector = theArr;
107 }
108 */
109 
110 template <class hit_T,class recoHit_T>
112  //we dont assume ownership over the hit arrays
113 }
114 
115 
116 template <class hit_T,class recoHit_T>
118  if (!hitArrayTClones)
119  throw GFException("GFRecoHitProducer(): no hit set up", __LINE__, __FILE__);
120  //assert(hitArrayTClones!=NULL || hitArrayVector!=NULL);//at least one exists
121  //assert(!(hitArrayTClones!=NULL && hitArrayVector!=NULL));//but not both
122  //if(hitArrayTClones!=NULL){
123  //the ROOT guys really use 0 and not NULL grrr...
124  if(hitArrayTClones->At(index) == 0) {
125  throw GFException("In GFRecoHitProducer: index for hit in TClonesArray out of bounds",__LINE__,__FILE__).setFatal();
126  }
127  return ( new recoHit_T( (hit_T*) hitArrayTClones->At(index) ) );
128  //}
129  //else{//after assertions this is save: the hitArrayVector is good
130  // if(index >= hitArrayVector->size()) {
131  // GFException e("In GFRecoHitProducer: index for hit in std::vector out of bounds",__LINE__,__FILE__);
132  // e.setFatal();
133  // throw e;
134  // }
135  // return ( new recoHit_T( (hit_T*) hitArrayVector->at(index) ) );
136  //}
137 }
138 
139 
140 #endif
141 
142 
virtual GFAbsRecoHit * produce(int index)=0
Virtual abstract method to produce a RecoHit. Implemented in GFRecoHitProducer.
virtual GFAbsRecoHit * produce(int index)
Create a RecoHit from the cluster at position index in TClonesArray.
Template class for a hit producer module.
virtual ~GFRecoHitProducer()
Abstract interface class for GFRecoHitProducer.
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:50
TClonesArray * hitArrayTClones
pointer to array with cluster data
GFException & setFatal(bool b=true)
set fatal flag. if this is true, the fit stops for this current track repr.
Definition: GFException.h:80
GFRecoHitProducer(TClonesArray *)
Constructor takes pointer to the cluster array.