PandaRoot
PndFtsRecoHitProducer2.h
Go to the documentation of this file.
1 //****************************************************************************
2 //* This file is part of PandaRoot. *
3 //* *
4 //* PandaRoot is distributed under the terms of the *
5 //* GNU General Public License (GPL) version 3, *
6 //* copied verbatim in the file "LICENSE". *
7 //* *
8 //* Copyright (C) 2006 - 2024 FAIR GmbH and copyright holders of PandaRoot *
9 //* The copyright holders are listed in the file "COPYRIGHTHOLDERS". *
10 //* The authors are listed in the file "AUTHORS". *
11 //****************************************************************************
12 
13 // modified by elisabetta Prencipe 19/05/2014
14 
15 #ifndef PNDFTSRECOHITPRODUCER2_H
16 #define PNDFTSRECOHITPRODUCER2_H
17 
18 #include <vector>
19 #include <map>
20 #include <assert.h>
21 #include <iostream>
22 
23 #include "TClonesArray.h"
24 #include "Exception.h"
25 #include "MeasurementProducer.h"
26 #include "WireMeasurement.h"
27 #include "TrackCandHit.h"
28 
29 template <class hit_T, class measurement_T>
30 class PndFtsRecoHitProducer2 : public genfit::AbsMeasurementProducer<genfit::AbsMeasurement> {
31 
32  private:
33  TClonesArray *hitArrayTClones;
34  TClonesArray *tubeArrayTClones;
35 
36  public:
37  PndFtsRecoHitProducer2(TClonesArray *, TClonesArray *);
38  virtual ~PndFtsRecoHitProducer2();
39 
40  virtual genfit::WireMeasurement *produce(int index, const genfit::TrackCandHit *hit);
41 };
42 
43 template <class hit_T, class measurement_T>
44 PndFtsRecoHitProducer2<hit_T, measurement_T>::PndFtsRecoHitProducer2(TClonesArray *theArr, TClonesArray *theTubeArr)
45 {
46  hitArrayTClones = theArr;
47  tubeArrayTClones = theTubeArr;
48 }
49 
50 template <class hit_T, class measurement_T>
52 {
53  delete (tubeArrayTClones);
54 }
55 
56 template <class hit_T, class measurement_T>
58 {
59  assert(hitArrayTClones != nullptr);
60  assert(tubeArrayTClones != nullptr);
61  if (hitArrayTClones->At(index) == 0) {
62  genfit::Exception e("In PndFtsRecoHitProducer2: index for hit in TClonesArray out of bounds", __LINE__, __FILE__);
63  e.setFatal();
64  throw e;
65  }
66 
67  return (new measurement_T((hit_T *)hitArrayTClones->At(index), hit, tubeArrayTClones));
68 }
69 
70 #endif
Abstract interface class for MeasurementProducer.
virtual genfit::WireMeasurement * produce(int index, const genfit::TrackCandHit *hit)
Virtual abstract method to produce a Measurement. Implemented in MeasurementProducer.
Hit object for use in TrackCand. Provides IDs and sorting parameters.
Definition: TrackCandHit.h:45
Class for measurements in wire detectors (Straw tubes and drift chambers) which do not measure the co...
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: Exception.h:59
PndFtsRecoHitProducer2(TClonesArray *, TClonesArray *)
void setFatal(bool b=true)
Set fatal flag.
Definition: Exception.h:72