NCFS-Pack
A generic (astro)particle physics analysis framework
 
Loading...
Searching...
No Matches
RnoGANT.cxx
Go to the documentation of this file.
1
17
19
116
117#include "RnoGANT.h"
118#include "Riostream.h"
119
120ClassImp(RnoGANT); // Class implementation to enable ROOT I/O
121
123RnoGANT::RnoGANT(const char* name,const char* title) : NcDevice(name,title)
124{
130}
131
140
142{
148}
149
150Int_t RnoGANT::GetStation(Int_t id) const
151{
165
166 Int_t antid=GetUniqueID();
167 if (id>0) antid=id;
168
169 if (antid<=0) return -1;
170
171 Int_t station=-1;
172
173 station=antid/1000;
174
175 return station;
176}
177
178Int_t RnoGANT::GetString(Int_t id) const
179{
193
194 Int_t antid=GetUniqueID();
195 if (id>0) antid=id;
196
197 if (antid<=0) return -1;
198
199 Int_t string=-1;
200
201 if (InheritsFrom("RnoSANT"))
202 {
203 string=0;
204 }
205 else
206 {
207 antid=antid%1000;
208 string=antid/100;
209 }
210
211 return string;
212}
213
214Int_t RnoGANT::GetNumber(Int_t id) const
215{
241
242 Int_t number=-1;
243
244 // DAQ channel number was requested
245 if (id<0)
246 {
247 TString name=GetName();
248
249 if (!name.Contains("Ch")) return -1;
250
251 name.ReplaceAll("Ch","");
252 number=name.Atoi();
253 return number;
254 }
255
256 // Antenna number was requested
257 Int_t antid=GetUniqueID();
258 if (id>0) antid=id;
259
260 Int_t station=GetStation(antid);
261 Int_t string=GetString(antid);
262
263 if (station<0 || string<0) return -1;
264
265 number=antid%100;
266
267 return number;
268}
269
270Int_t RnoGANT::GetANTId(Int_t station,Int_t string,Int_t number) const
271{
289
290 Int_t antid=-1;
291
292 if (station<11 || station>77 || string<1 || string>3 || number<=0 || number>9) return -1;
293
294 if (!(station%10)) return -1; // Station IDs must represent the matrix (col,row) indexing
295
296 if ((string==2 || string==3) && number<7) return -1; // Helper string antenna numbers start at 7
297
298 antid=1000*station+100*string+number;
299
300 return antid;
301}
302
303Double_t RnoGANT::GetTimeResidual(NcEvent* evt,NcTrack* t,NcSignal* s,TString name,Int_t mode,Int_t vgroup) const
304{
329
330 Double_t tres=-99999;
331
332 if (!evt || !t || !s) return tres;
333
334 RnoGANT* ant=(RnoGANT*)s->GetDevice();
335 if (!ant) return tres;
336
337 Nc3Vector p=t->Get3Momentum();
338 if (!p.HasVector() || !p.GetNorm()) return tres;
339
340 const Float_t pi=acos(-1.);
341 const Float_t c=0.299792458; // Light speed in vacuum in meters per ns
342 const Float_t npice=1.78829165; // Phase refractive index (c/v_phase) of ice (IceCube optical 1.31768387)
343 const Float_t ngice=1.0251*npice; // Group refractive index (c/v_group) of ice (IceCube optical 1.35075806)
344 const Float_t thetac=acos(1./npice); // Cherenkov angle (in radians)
345
346 // Angular reduction of complement of thetac due to v_phase and v_group difference
347 Float_t alphac=0;
348 if (vgroup) alphac=atan((1.-npice/ngice)/sqrt(npice*npice-1.));
349
350 // The track reference point
352 if (!r0) return tres;
353
354 // Absolute (UT) time stamp of the track reference point
355 NcTimestamp* tt0=r0->GetTimestamp();
356 if (!tt0) return tres;
357
358 // Time stamp of the track relative to the event time stamp
359 Float_t t0=evt->GetDifference(tt0,"ns");
360
361 NcPosition rhit=ant->GetPosition();
362 Float_t d=t->GetDistance(rhit);
363 Nc3Vector r12=rhit-(*r0);
364 Float_t hproj=p.Dot(r12)/p.GetNorm();
365 Float_t dist=fabs(hproj)+d/tan(pi/2.-thetac-alphac);
366 if (hproj<0) dist=-dist;
367 Float_t tgeo=t0+dist/c; // The predicted geometrical hit time
368 Float_t thit=s->GetSignal(name,mode); // Hit time relative to the event time stamp
369
370 tres=thit-tgeo;
371 return tres;
372}
373
374Double_t RnoGANT::GetTimeResidual(NcEvent* evt,NcTrack* t,Int_t j,TString name,Int_t mode,Int_t vgroup) const
375{
400
401 NcSignal* s=GetHit(j);
402 Double_t tres=GetTimeResidual(evt,t,s,name,mode,vgroup);
403 return tres;
404}
405
406TObject* RnoGANT::Clone(const char* name) const
407{
420
421 RnoGANT* q=new RnoGANT(*this);
422 if (name)
423 {
424 if (strlen(name)) q->SetName(name);
425 }
426 return q;
427}
428
ClassImp(RnoGANT)
Handling of 3-vectors in various reference frames.
Definition Nc3Vector.h:15
Double_t Dot(Nc3Vector &q)
Int_t HasVector() const
Double_t GetNorm()
NcDevice(const char *name="", const char *title="")
Definition NcDevice.cxx:109
NcSignal * GetHit(Int_t j) const
Definition NcDevice.cxx:489
Creation and investigation of an NCFS generic event structure.
Definition NcEvent.h:15
void GetPosition(Double_t *r, TString f, TString u="rad", Float_t s=-1) const
NcTimestamp * GetTimestamp()
NcDevice * GetDevice() const
virtual Float_t GetSignal(Int_t j=1, Int_t mode=0) const
Definition NcSignal.cxx:651
NcSignal(const char *name="", const char *title="")
Definition NcSignal.cxx:155
Handling of timestamps for (astro)particle physics research.
Definition NcTimestamp.h:20
Int_t GetDifference(NcTimestamp *t, Int_t &days, Int_t &sec, Int_t &ns, Int_t &ps, TString type="UT")
Handling of the attributes of a reconstructed particle track.
Definition NcTrack.h:19
Double_t GetDistance(NcPosition *p, Float_t scale=-1)
Definition NcTrack.cxx:2011
NcPosition * GetReferencePoint()
Definition NcTrack.cxx:1485
Nc3Vector Get3Momentum(Float_t scale=-1) const
Definition NcTrack.cxx:652
Signal (Hit) handling of an RNO-G Generic Antenna (GANT).
Definition RnoGANT.h:12
Int_t GetNumber(Int_t id=0) const
Definition RnoGANT.cxx:214
virtual ~RnoGANT()
Definition RnoGANT.cxx:132
Int_t GetString(Int_t id=0) const
Definition RnoGANT.cxx:178
Double_t GetTimeResidual(NcEvent *evt, NcTrack *t, NcSignal *s, TString name="LE", Int_t mode=7, Int_t vgroup=1) const
Definition RnoGANT.cxx:303
RnoGANT(const char *name="", const char *title="")
Definition RnoGANT.cxx:123
Int_t GetStation(Int_t id=0) const
Definition RnoGANT.cxx:150
virtual TObject * Clone(const char *name="") const
Definition RnoGANT.cxx:406
Int_t GetANTId(Int_t station, Int_t string, Int_t number) const
Definition RnoGANT.cxx:270