PandaRoot
PndSttRecoHitProducer2.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/5/2014
14 
15 #ifndef PNDSTTRECOHITPRODUCER2_H
16 #define PNDSTTRECOHITPRODUCER2_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 "TrackCandHit.h"
26 #include "MeasurementProducer.h"
27 #include "AbsMeasurement.h"
28 
29 template <class hit_T, class measurement_T>
30 class PndSttRecoHitProducer2 : public genfit::AbsMeasurementProducer<genfit::AbsMeasurement> {
31 
32  private:
33  TClonesArray *hitArrayTClones;
34  TClonesArray *tubeArrayTClones;
35 
36  public:
37  PndSttRecoHitProducer2(TClonesArray *, TClonesArray *);
38  virtual ~PndSttRecoHitProducer2();
39 
40  virtual genfit::AbsMeasurement *produce(int index, const genfit::TrackCandHit *hit);
41 };
42 
43 template <class hit_T, class measurement_T>
44 PndSttRecoHitProducer2<hit_T, measurement_T>::PndSttRecoHitProducer2(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 PndSttRecoHitProducer2: 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.
PndSttRecoHitProducer2(TClonesArray *, TClonesArray *)
Hit object for use in TrackCand. Provides IDs and sorting parameters.
Definition: TrackCandHit.h:45
virtual genfit::AbsMeasurement * produce(int index, const genfit::TrackCandHit *hit)
Virtual abstract method to produce a Measurement. Implemented in MeasurementProducer.
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: Exception.h:59
Contains the measurement and covariance in raw detector coordinates.
void setFatal(bool b=true)
Set fatal flag.
Definition: Exception.h:72