Neutral Particle Spectrometer analysis code
Loading...
Searching...
No Matches
THcNPSApparatus.cxx
Go to the documentation of this file.
1
47#include "THcNPSApparatus.h"
49
50#include "TDatime.h"
51
52#include "THcGlobals.h"
53#include "THcParmList.h"
54
55#ifdef WITH_DEBUG
56#include <iostream>
57#endif
58using namespace std;
59
61 const char* name, const char* description
62) :
63 THaApparatus(name, description),
64 fKwPrefix(""),
65 fStagesDone(0), fListInit(kFALSE)
66{
67 // Constructorn
68
69 fTracks = 0;
71 // Construct the kwPrefix here. Better place would be in `Setup` method.
72 string kwPrefix = name;
73 std::transform(kwPrefix.begin(), kwPrefix.end(), kwPrefix.begin(), ::tolower);
74 fKwPrefix = kwPrefix;
75}
76
77
79
80//_____________________________________________________________________________
82{
83 // Initialize lists of specialized detectors.
84 // Private function called by Reconstruct().
85
87
88 TIter next(fDetectors);
89 while( THaDetector* theDetector =
90 static_cast<THaDetector*>( next() )) {
91
92 // if( theDetector->IsTracking() )
93 // fTrackingDetectors->Add( theDetector );
94 // else
95 fNonTrackingDetectors->Add( theDetector );
96
97 // if( theDetector->IsPid() )
98 // fPidDetectors->Add( theDetector );
99 }
100
101 // Set up PIDinfo and vertex objects that can be associated with tracks
102
103 // UInt_t ndet = GetNpidDetectors();
104 // UInt_t npart = GetNpidParticles();
105 // TClonesArray& pid = *fTrackPID;
106
107 // for( int i = 0; i < kInitTrackMultiplicity; i++ ) {
108 // new( pid[i] ) THaPIDinfo( ndet, npart );
109 // }
110
112}
113//_____________________________________________________________________________
115{
116 // 2nd step: Coarse processing. Pass the coarse tracks to the remaining
117 // detectors for any processing that can be done at this stage.
118 // This may include clustering and preliminary PID.
119 // PID information is tacked onto the tracks as a THaPIDinfo object.
120
121 if( !fListInit )
122 ListInit();
123
124 // No Tracking in NPS apparatus
125 // if( !IsDone(kCoarseTrack))a
126 // CoarseTrack();
127
129 while( THaNonTrackingDetector* theNonTrackDetector =
130 static_cast<THaNonTrackingDetector*>( next() )) {
131#ifdef WITH_DEBUG
132 if( fDebug>1 ) cout << "Call CoarseProcess() for "
133 << theNonTrackDetector->GetName() << "... ";
134#endif
135 theNonTrackDetector->CoarseProcess( *fTracks );
136#ifdef WITH_DEBUG
137 if( fDebug>1 ) cout << "done.\n";
138#endif
139 }
140
142 return 0;
143}
144
145//_____________________________________________________________________________
147{
148 // This method implements a fairly generic algorithm for spectrometer
149 // reconstruction which should be useful for most situations.
150 // Additional, equipment-specific processing can be done in
151 // a derived class that calls this method first.
152 //
153 // The algorithm is as follows:
154 //
155 // For all tracking detectors:
156 // CoarseTrack()
157 // For all non-tracking detectors:
158 // CoarseProcess()
159 // For all tracking detectors:
160 // FineTrack()
161 // Reconstruct tracks to target
162 // For all non-tracking detectors:
163 // FineProcess()
164 // Compute additional attributes of tracks (e.g. momentum, beta)
165 // Find "Golden Track"
166 // Combine all PID detectors to get overall PID for each track
167 //
168
169 // Do prior analysis stages if not done yet
170 // if( !IsDone(kTracking))
171 // Track();
172
173 // Fine processing. Pass the precise tracks to the
174 // remaining detectors for any precision processing.
175 // PID likelihoods should be calculated here.
176
178 while( THaNonTrackingDetector* theNonTrackDetector =
179 static_cast<THaNonTrackingDetector*>( next() )) {
180#ifdef WITH_DEBUG
181 if( fDebug>1 ) cout << "Call FineProcess() for "
182 << theNonTrackDetector->GetName() << "... ";
183#endif
184 theNonTrackDetector->FineProcess( *fTracks );
185#ifdef WITH_DEBUG
186 if( fDebug>1 ) cout << "done.\n";
187#endif
188 }
189
190 // Compute additional track properties (e.g. beta)
191 // Find "Golden Track" if appropriate.
192
193 //TrackCalc();
194
195 // Compute combined PID
196
197 // if( fPID ) CalcPID();
198
200 return 0;
201}
202
203
207
209
210 return kOK;
211}
212
213
215
216 Double_t shmsThetaLab;
217 Double_t npsThetaOffset;
218 DBRequest list[]={
219 {"stheta_lab", &shmsThetaLab, kDouble},
220 {0}
221 };
222 gHcParms->LoadParmValues((DBRequest*)&list);
223
224 DBRequest listprefixed[]={
225 {"_theta_offset", &npsThetaOffset, kDouble},
226 {0}
227 };
228 gHcParms->LoadParmValues((DBRequest*)&listprefixed,fKwPrefix.c_str());
229
230 fTheta_lab = shmsThetaLab + npsThetaOffset;
231
232 return kOK;
233}
234
235
237 if (mode == kDefine && fIsSetup) return kOK;
238 fIsSetup = (mode == kDefine);
239
240 return kOK;
241 // std::vector<RVarDef> vars;
242 // RVarDef end {0};
243 // vars.push_back(end);
244
245 // return DefineVarsFromList(vars.data(), mode);
246}
247
248
250
251
int Int_t
const Bool_t kFALSE
double Double_t
const Bool_t kTRUE
Option_t Option_t TPoint TPoint const char mode
ClassImp(VDC::AnalyticTTDConv) using namespace std
R__EXTERN class THcParmList * gHcParms
TList * fDetectors
A dummy spectrometer apparatus for testing detectors.
virtual Int_t ReadDatabase(const TDatime &date)
TString GetKwPrefix()
Returns prefix used for parameters in param files.
virtual ~THcNPSApparatus()
A destructor.
virtual Int_t DefineVariables(EMode mode=kDefine)
virtual Int_t CoarseReconstruct()
virtual Int_t ReadRunDatabase(const TDatime &date)
TList * fNonTrackingDetectors
std::string fKwPrefix
TClonesArray * fTracks
virtual Int_t Reconstruct()
Does nothing and returns 0.
Int_t LoadParmValues(const DBRequest *list, const char *prefix="")
void Clear(Option_t *option="") override
void Add(TObject *obj) override
STL namespace.