NCFS-Pack
A generic (astro)particle physics analysis framework
 
Loading...
Searching...
No Matches
IceChi2.cxx
Go to the documentation of this file.
1
17
19
152
153#include "IceChi2.h"
154#include "Riostream.h"
155
156// Global pointer to the instance of this object
158
159// TFitter/Minuit interface to IceChi2::FitFCN
160 void IceChi2FCN(Int_t& npar,Double_t* gin,Double_t& f,Double_t* u,Int_t flag)
161 {
162 if (gIceChi2) gIceChi2->FitFCN(npar,gin,f,u,flag);
163 }
164
165ClassImp(IceChi2); // Class implementation to enable ROOT I/O
166
168IceChi2::IceChi2(const char* name,const char* title) : TTask(name,title)
169{
175
176 fFirst=1;
177 fPrint=-2;
178 fSelhits=2;
179 fVgroup=1;
180 fEvt=0;
181 fUseNames=0;
182 fUseNtk=0;
183 fHits=0;
184 fFitter=0;
185 fTrackname="IceChi2";
186 fCharge=0;
187 fPenalty=0;
188 fTkfit=0;
189 fFitstats=0;
190
191 // Set the global pointer to this instance
192 gIceChi2=this;
193}
194
196{
202
203 if (fUseNames)
204 {
205 delete fUseNames;
206 fUseNames=0;
207 }
208 if (fUseNtk)
209 {
210 delete fUseNtk;
211 fUseNtk=0;
212 }
213 if (fHits)
214 {
215 delete fHits;
216 fHits=0;
217 }
218 if (fFitter)
219 {
220 delete fFitter;
221 fFitter=0;
222 }
223 if (fTkfit)
224 {
225 delete fTkfit;
226 fTkfit=0;
227 }
228 if (fFitstats)
229 {
230 delete fFitstats;
231 fFitstats=0;
232 }
233}
234
235void IceChi2::Exec(Option_t* opt)
236{
242
243 TString name=opt;
244 NcJob* parent=(NcJob*)(gROOT->GetListOfTasks()->FindObject(name.Data()));
245
246 if (!parent) return;
247
248 fEvt=(IceEvent*)parent->GetObject("IceEvent");
249 if (!fEvt) return;
250
251 // Only process accepted events
252 NcDevice* seldev=(NcDevice*)fEvt->GetDevice("NcEventSelector");
253 if (seldev)
254 {
255 if (seldev->GetSignal("Select") < 0.1) return;
256 }
257
258 // Storage of the used parameters in the IceChi2 device
259 NcDevice params;
260 params.SetNameTitle("IceChi2","IceChi2 processor parameters");
261 params.SetSlotName("Selhits",1);
262 params.SetSlotName("Penalty",2);
263 params.SetSlotName("Vgroup",3);
264
265 params.SetSignal(fSelhits,1);
266 params.SetSignal(fPenalty,2);
267 params.SetSignal(fVgroup,3);
268
269 fEvt->AddDevice(params);
270
271 if (!fUseNames)
272 {
273 UseTracks("IceDwalkA",1);
274 UseTracks("IceDwalkI",1);
275 }
276
277 Int_t nclasses=fUseNames->GetEntries(); // Number of first guess classes to be processed
278 Int_t ntkmax=0; // Max. number of tracks for a certain class
279 TObjString* strx=0;
280 TString str;
281
282 if (fFirst)
283 {
284 cout << " *IceChi2* First guess selections to be processed (-1=all)." << endl;
285 for (Int_t i=0; i<nclasses; i++)
286 {
287 strx=(TObjString*)fUseNames->At(i);
288 if (!strx) continue;
289 str=strx->GetString();
290 ntkmax=fUseNtk->At(i);
291 cout << " Maximally " << ntkmax << " track(s) per event for procedure : " << str.Data() << endl;
292 }
293 cout << " *IceChi2* Hit selection mode : " << fSelhits << endl;
294 cout << " *IceChi2* Penalty value for psi evaluation outside range : " << fPenalty << endl;
295 cout << endl;
296
297 fPsistats.SetStoreMode(1);
298
299 fFirst=0;
300 }
301
302 const Double_t pi=acos(-1.);
303
304 // Initialisation of the minimisation processor
305 Double_t arglist[100];
306 if (!fFitter) fFitter=new TFitter();
307
308 // The number of reconstructed tracks already present in the event
309 Int_t ntkreco=fEvt->GetNtracks(1);
310
311 if (!fHits)
312 {
313 fHits=new TObjArray();
314 }
315 else
316 {
317 fHits->Clear();
318 }
319
320 // Initialise the basis for the fitted track(s)
321 if (!fTkfit) fTkfit=new NcTrack();
322 TString trackname=fTrackname;
323
324 // If selected, use all the good quality hits of the complete event
325 if (fSelhits==0)
326 {
327 TObjArray* hits=fEvt->GetHits("IceGOM");
328 if (!hits) return;
329 trackname+="C"; // Trackname suffix to indicate combined hit usage
330 fTkfit->SetNameTitle(trackname.Data(),"IceChi2 Combined fit result");
331 for (Int_t ih=0; ih<hits->GetEntries(); ih++)
332 {
333 NcSignal* sx=(NcSignal*)hits->At(ih);
334 if (!sx) continue;
335 if (sx->GetDeadValue("ADC") || sx->GetDeadValue("LE") || sx->GetDeadValue("TOT")) continue;
336 fHits->Add(sx);
337 }
338 }
339
340 // Track by track processing of the selected first guess classes
341 Float_t vec[3];
342 Float_t err[3];
343 Nc3Vector p;
344 NcPosition pos;
345 if (!fFitstats)
346 {
347 fFitstats=new NcSignal();
348 fFitstats->SetNameTitle("Fitstats","TFitter stats for Chi2 fit");
349 fFitstats->SetSlotName("IERFIT",1);
350 fFitstats->SetSlotName("FCN",2);
351 fFitstats->SetSlotName("EDM",3);
352 fFitstats->SetSlotName("NVARS",4);
353 fFitstats->SetSlotName("IERERR",5);
354 fFitstats->SetSlotName("PsiSum",6);
355 fFitstats->SetSlotName("PsiMedian",7);
356 fFitstats->SetSlotName("PsiSpread",8);
357 fFitstats->SetSlotName("PsiMean",9);
358 fFitstats->SetSlotName("PsiSigma",10);
359 }
360 Float_t x,y,z,theta,phi,t0;
361 Double_t amin,edm,errdef; // Minimisation stats
362 Int_t ierfit,iererr,nvpar,nparx; // Minimisation stats
363 Double_t psi; // Bayesian psi value for the fitted track w.r.t. a Convoluted Pandel PDF
364 Int_t ntk=0;
365 Int_t nsig=0;
366 NcTrack* track=0;
367 Int_t amanda,inice; // Detector system indicators of associated hits
368 for (Int_t iclass=0; iclass<nclasses; iclass++) // Loop over first guess classes
369 {
370 strx=(TObjString*)fUseNames->At(iclass);
371 if (!strx) continue;
372 str=strx->GetString();
373 ntkmax=fUseNtk->At(iclass);
374 TObjArray* tracks=fEvt->GetTracks(str);
375 ntk=0;
376 if (tracks) ntk=tracks->GetEntries();
377 if (ntkmax>0 && ntk>ntkmax) ntk=ntkmax;
378
379 for (Int_t jtk=0; jtk<ntk; jtk++) // Loop over tracks of a certain class
380 {
381 track=(NcTrack*)tracks->At(jtk);
382 if (!track) continue;
383
384 amanda=0;
385 inice=0;
386 trackname=fTrackname;
387
388 NcPosition* r0=track->GetReferencePoint();
389 if (!r0) continue;
390
391 NcTimestamp* tt0=r0->GetTimestamp();
392
393 // Selection of hits to be used in the fitting procedure
394 if (fSelhits==1 || fSelhits==2)
395 {
396 fHits->Clear();
397 nsig=track->GetNsignals();
398 for (Int_t is=1; is<=nsig; is++)
399 {
400 NcSignal* sx=track->GetSignal(is);
401 if (!sx) continue;
402 if (!sx->GetDevice()->InheritsFrom("IceGOM")) continue;
403 if (sx->GetDevice()->InheritsFrom("IceAOM")) amanda=1;
404 if (sx->GetDevice()->InheritsFrom("IceIDOM")) inice=1;
405 if (sx->GetDeadValue("ADC") || sx->GetDeadValue("LE") || sx->GetDeadValue("TOT")) continue;
406 if (fSelhits==1) fHits->Add(sx); // Only use the associated hits
407 }
408 if (fSelhits==2)
409 {
410 TObjArray* hits=0;
411 if (amanda && inice) // Combined hit usage
412 {
413 hits=fEvt->GetHits("IceGOM");
414 trackname+="C";
415 fTkfit->SetNameTitle(trackname.Data(),"IceChi2 Combined fit result");
416 }
417 if (amanda && !inice) // Only Amanda hit usage
418 {
419 hits=fEvt->GetHits("IceAOM");
420 trackname+="A";
421 fTkfit->SetNameTitle(trackname.Data(),"IceChi2 Amanda fit result");
422 }
423 if (inice && !amanda) // Only InIce hit usage
424 {
425 hits=fEvt->GetHits("IceIDOM");
426 trackname+="I";
427 fTkfit->SetNameTitle(trackname.Data(),"IceChi2 InIce fit result");
428 }
429 if (!hits) return;
430 for (Int_t is2=0; is2<hits->GetEntries(); is2++)
431 {
432 NcSignal* sx=(NcSignal*)hits->At(is2);
433 if (!sx) continue;
434 if (sx->GetDeadValue("ADC") || sx->GetDeadValue("LE") || sx->GetDeadValue("TOT")) continue;
435 fHits->Add(sx);
436 }
437 }
438 }
439
440 // Require enough hits to fit the 6 parameters
441 if (fHits->GetEntries()<7) continue;
442
443 r0->GetVector(vec,"car");
444 r0->GetErrors(err,"car");
445
446 x=vec[0];
447 y=vec[1];
448 z=vec[2];
449
450 p=track->Get3Momentum();
451 p.GetVector(vec,"sph");
452
453 theta=vec[1];
454 phi=vec[2];
455
456 t0=fEvt->GetDifference(tt0,"ns");
457
458 // Process this first guess track with its associated hits
459 fFitter->Clear();
460
461 // Set user selected TFitter printout level
462 arglist[0]=fPrint;
463 if (fPrint==-2) arglist[0]=-1;
464 fFitter->ExecuteCommand("SET PRINT",arglist,1);
465 if (fPrint==-2) fFitter->ExecuteCommand("SET NOWARNINGS",arglist,0);
466
467 fFitter->SetFitMethod("chisquare");
468
469 fFitter->SetParameter(0,"r0x",x,0.1,0,0);
470 fFitter->SetParameter(1,"r0y",y,0.1,0,0);
471 fFitter->SetParameter(2,"r0z",z,0.1,0,0);
472 fFitter->SetParameter(3,"theta",theta,0.001,0,pi);
473 fFitter->SetParameter(4,"phi",phi,0.001,0,2.*pi);
474 fFitter->SetParameter(5,"t0",t0,1.,0,32000);
475
476 fFitter->SetFCN(IceChi2FCN);
477
478 fTkfit->Reset();
479
480 arglist[0]=0;
481 ierfit=fFitter->ExecuteCommand("SIMPLEX",arglist,0);
482
483 fFitter->GetStats(amin,edm,errdef,nvpar,nparx);
484 fFitstats->Reset();
485 fFitstats->SetSignal(ierfit,1);
486 fFitstats->SetSignal(amin,2);
487 fFitstats->SetSignal(edm,3);
488 fFitstats->SetSignal(nvpar,4);
489
490 iererr=fFitter->ExecuteCommand("HESSE",arglist,0);
491 fFitstats->SetSignal(iererr,5);
492
493
494 // Resulting parameters after minimisation and error calculation
495 vec[0]=fFitter->GetParameter(0);
496 vec[1]=fFitter->GetParameter(1);
497 vec[2]=fFitter->GetParameter(2);
498 err[0]=fFitter->GetParError(0);
499 err[1]=fFitter->GetParError(1);
500 err[2]=fFitter->GetParError(2);
501 pos.SetPosition(vec,"car");
502 pos.SetPositionErrors(err,"car");
503
504 vec[0]=1.;
505 vec[1]=fFitter->GetParameter(3);
506 vec[2]=fFitter->GetParameter(4);
507 err[0]=0.;
508 err[1]=fFitter->GetParError(3);
509 err[2]=fFitter->GetParError(4);
510 p.SetVector(vec,"sph");
511 p.SetErrors(err,"sph");
512
513 t0=fFitter->GetParameter(5);
514 NcTimestamp t0fit((NcTimestamp)(*fEvt));
515 t0fit.Add(0,0,int(t0));
516
517 // Enter the fit result as a track in the event structure
518 ntkreco++;
519 fTkfit->SetId(ntkreco);
520 fTkfit->SetCharge(fCharge);
521 fTkfit->SetParentTrack(track);
522 pos.SetTimestamp(t0fit);
523 fTkfit->SetTimestamp(t0fit);
524 fTkfit->SetReferencePoint(pos);
525 fTkfit->Set3Momentum(p);
526 for (Int_t ihit=0; ihit<fHits->GetEntries(); ihit++)
527 {
528 NcSignal* sx=(NcSignal*)fHits->At(ihit);
529 if (sx) fTkfit->AddSignal(*sx);
530 }
531 psi=GetPsi(fTkfit);
532 fFitstats->SetSignal(psi,6);
533 fFitstats->SetSignal(fPsistats.GetMedian(1),7);
534 fFitstats->SetSignal(fPsistats.GetSpread(1),8);
535 fFitstats->SetSignal(fPsistats.GetMean(1),9);
536 fFitstats->SetSignal(fPsistats.GetSigma(1),10);
537 fTkfit->SetFitDetails(fFitstats);
538 fEvt->AddTrack(fTkfit);
539 } // End loop over tracks
540 } // End loop over first guess classes
541
542}
543
544void IceChi2::SetPrintLevel(Int_t level)
545{
556
557 fPrint=level;
558}
559
560void IceChi2::UseTracks(TString classname,Int_t n)
561{
586
587 if (!fUseNames)
588 {
589 fUseNames=new TObjArray();
590 fUseNames->SetOwner();
591 }
592
593 if (!fUseNtk) fUseNtk=new TArrayI();
594
595 // Check if this classname has already been specified before
596 TString s;
597 Int_t nen=fUseNames->GetEntries();
598 for (Int_t i=0; i<nen; i++)
599 {
600 TObjString* sx=(TObjString*)fUseNames->At(i);
601 if (!sx) continue;
602 s=sx->GetString();
603 if (s==classname) return;
604 }
605
606 // New classname to be added into the storage
607 if (nen >= fUseNames->GetSize()) fUseNames->Expand(nen+1);
608 if (nen >= fUseNtk->GetSize()) fUseNtk->Set(nen+1);
609
610 TObjString* name=new TObjString();
611 name->SetString(classname);
612 fUseNames->Add(name);
613 fUseNtk->AddAt(n,nen);
614}
615
616void IceChi2::SelectHits(Int_t mode)
617{
630
631 if (mode>=0 && mode<=2) fSelhits=mode;
632}
633
635{
647
648 fVgroup=flag;
649}
650
652{
662
663 fTrackname=s;
664}
665
666void IceChi2::SetCharge(Float_t charge)
667{
676
677 fCharge=charge;
678}
679
680void IceChi2::SetPenalty(Float_t val)
681{
691
692 fPenalty=val;
693}
694
695void IceChi2::FitFCN(Int_t&,Double_t*,Double_t& f,Double_t* x,Int_t)
696{
702
703 const Float_t c=0.299792458; // Light speed in vacuum in meters per ns
704 const Float_t npice=1.31768387; // Phase refractive index (c/v_phase) of ice
705 const Float_t ngice=1.35075806; // Group refractive index (c/v_group) of ice
706 const Float_t thetac=acos(1./npice);// Cherenkov angle (in radians)
707 const Double_t pi=acos(-1.);
708
709 // Angular reduction of complement of thetac due to v_phase and v_group difference
710 Float_t alphac=0;
711 if (fVgroup) alphac=atan((1.-npice/ngice)/sqrt(npice*npice-1.));
712
713 // Assumed PMT timing jitter in ns
714 const Double_t sigt=10;
715
716 f=0;
717
718 // The new r0 and p vectors and t0 from the minimisation
719 Float_t vec[3];
720
721 NcPosition r0;
722 vec[0]=x[0];
723 vec[1]=x[1];
724 vec[2]=x[2];
725 r0.SetPosition(vec,"car");
726
727 Nc3Vector p;
728 vec[0]=1;
729 vec[1]=x[3];
730 vec[2]=x[4];
731 p.SetVector(vec,"sph");
732
733 Float_t t0=x[5];
734
735 // Construct a track with the new values from the minimisation
736 fTkfit->SetReferencePoint(r0);
737 fTkfit->Set3Momentum(p);
738
739 Int_t nhits=fHits->GetEntries();
740 NcPosition rhit;
741 Nc3Vector r12;
742 Float_t d,dist,thit,tgeo;
743 Double_t tres,chi2;
744 for (Int_t i=0; i<nhits; i++)
745 {
746 NcSignal* sx=(NcSignal*)fHits->At(i);
747 if (!sx) continue;
748 IceGOM* omx=(IceGOM*)sx->GetDevice();
749 if (!omx) continue;
750 rhit=omx->GetPosition();
751 d=fTkfit->GetDistance(rhit);
752 r12=rhit-r0;
753 dist=p.Dot(r12)+d/tan(pi/2.-thetac-alphac);
754 tgeo=t0+dist/c;
755 thit=sx->GetSignal("LE",7);
756 tres=thit-tgeo;
757
758 // Chisquared contribution for this hit
759 chi2=pow(tres/sigt,2);
760
761 f+=chi2;
762 }
763}
764
766{
776
777 const Float_t c=0.299792458; // Light speed in vacuum in meters per ns
778 const Float_t npice=1.31768387; // Phase refractive index (c/v_phase) of ice
779 const Float_t ngice=1.35075806; // Group refractive index (c/v_group) of ice
780 const Float_t thetac=acos(1./npice);// Cherenkov angle (in radians)
781 const Float_t lambda=33.3; // Light scattering length in ice
782 const Float_t labs=98; // Light absorbtion length in ice
783 const Float_t cice=c/ngice; // Light speed in ice in meters per ns
784 const Float_t tau=557;
785 const Double_t rho=((1./tau)+(cice/labs));
786 const Double_t pi=acos(-1.);
787
788 // Angular reduction of complement of thetac due to v_phase and v_group difference
789 Float_t alphac=0;
790 if (fVgroup) alphac=atan((1.-npice/ngice)/sqrt(npice*npice-1.));
791
792 // Assumed PMT timing jitter in ns
793 const Double_t sigma=10;
794
795 Double_t psi=-1;
796
797 if (!t) return psi;
798
799 // The r0 and p vectors from the track
801 Nc3Vector p=t->Get3Momentum();
802
803 if (!ref || p.GetNorm()<=0) return psi;
804
805 // The number of associated hits and t0 of the track
806 Int_t nhits=t->GetNsignals();
807 NcTimestamp* tstamp=ref->GetTimestamp();
808
809 if (!nhits || !tstamp) return psi;
810
811 NcPosition r0=ref->GetPosition();
812 Float_t t0=fEvt->GetDifference(tstamp,"ns");
813
814 NcPosition rhit;
815 Nc3Vector r12;
816 Float_t d,dist,thit,tgeo;
817 Double_t tres,ksi,eta,pandel;
818 Double_t cpandel1,cpandel2,cpandel3,cpandel;
819 Double_t z,k,alpha,beta,phi,n1,n2,n3,u; // Function parameters for regions 3 and 4
820 psi=0;
821 Int_t ier;
822 Double_t psihit=0;
823 fPsistats.Reset();
824 for (Int_t i=1; i<=nhits; i++)
825 {
826 NcSignal* sx=t->GetSignal(i);
827 if (!sx) continue;
828 IceGOM* omx=(IceGOM*)sx->GetDevice();
829 if (!omx) continue;
830 rhit=omx->GetPosition();
831 d=t->GetDistance(rhit);
832 ksi=d/lambda;
833 r12=rhit-r0;
834 dist=p.Dot(r12)+d/tan(pi/2.-thetac-alphac);
835 tgeo=t0+dist/c;
836 thit=sx->GetSignal("LE",7);
837 tres=thit-tgeo;
838
839 // The Convoluted Pandel function evaluation
840 // For definitions of functions and validity regions, see the
841 // CPandel writeup of O. Fadiran, G. Japaridze and N. van Eijndhoven
842
843 // Move points which are outside the validity rectangle in the (tres,ksi) space
844 // to the edge of the validity rectangle and signal the use of the penalty
845 ier=0;
846 if (tres<-25.*sigma)
847 {
848 tres=-25.*sigma;
849 ier=1;
850 }
851 if (tres>3500)
852 {
853 tres=3500;
854 ier=1;
855 }
856 if (ksi>50)
857 {
858 ksi=50;
859 ier=1;
860 }
861
862 eta=(rho*sigma)-(tres/sigma);
863
864 if (ksi<=0) // The zero distance (ksi=0) axis
865 {
866 cpandel=exp(-tres*tres/(2.*sigma*sigma))/(sigma*sqrt(2.*pi));
867 }
868 else if (ksi<=5 && tres>=-5.*sigma && tres<=30.*sigma) // The exact expression in region 1
869 {
870 cpandel1=pow(rho,ksi)*pow(sigma,ksi-1.)*exp(-tres*tres/(2.*sigma*sigma))/pow(2.,0.5*(1.+ksi));
871 cpandel2=ROOT::Math::conf_hyperg(ksi/2.,0.5,eta*eta/2.)/TMath::Gamma((ksi+1.)/2.);
872 cpandel3=sqrt(2.)*eta*ROOT::Math::conf_hyperg((ksi+1.)/2.,1.5,eta*eta/2.)/TMath::Gamma(ksi/2.);
873
874 cpandel=cpandel1*(cpandel2-cpandel3);
875 }
876 else if (ksi<=1 && tres>30.*sigma && tres<=3500) // Approximation in region 2
877 {
878 pandel=pow(rho,ksi)*pow(tres,(ksi-1.))*exp(-rho*tres)/TMath::Gamma(ksi);
879
880 cpandel=exp(rho*rho*sigma*sigma/2.)*pandel;
881 }
882 else if (ksi<=1 && tres<-5.*sigma && tres>=-25.*sigma) // Approximation in region 5
883 {
884 cpandel=pow(rho*sigma,ksi)*pow(eta,-ksi)*exp(-tres*tres/(2.*sigma*sigma))/(sigma*sqrt(2.*pi));
885 }
886 else if (ksi<=50 && tres>=0 && tres<=3500) // Approximation in region 3
887 {
888 z=-eta/sqrt(4.*ksi-2.);
889 k=0.5*(z*sqrt(1.+z*z)+log(z+sqrt(1.+z*z)));
890 alpha=-tres*tres/(2.*sigma*sigma)+eta*eta/4.-ksi/2.+0.25+k*(2.*ksi-1.);
891 alpha+=-log(1.+z*z)/4.-ksi*log(2.)/2.+(ksi-1.)*log(2.*ksi-1.)/2.+ksi*log(rho)+(ksi-1.)*log(sigma);
892 beta=0.5*(z/sqrt(1.+z*z)-1.);
893 n1=beta*(20.*beta*beta+30.*beta+9.)/12.;
894 n2=pow(beta,2.)*(6160.*pow(beta,4.)+18480.*pow(beta,3.)+19404.*pow(beta,2.)+8028.*beta+945.)/288.;
895 n3=27227200.*pow(beta,6.)+122522400.*pow(beta,5.)+220540320.*pow(beta,4.);
896 n3+=200166120.*pow(beta,3.)+94064328.*pow(beta,2.)+20546550.*beta+1403325.;
897 n3*=pow(beta,3.)/51840.;
898 phi=1.-n1/(2.*ksi-1.)+n2/pow(2.*ksi-1.,2.)-n3/pow(2.*ksi-1.,3.);
899 cpandel=exp(alpha)*phi/TMath::Gamma(ksi);
900 }
901 else if (ksi<=50 && tres<0 && tres>=-25.*sigma) // Approximation in region 4
902 {
903 z=eta/sqrt(4.*ksi-2.);
904 k=0.5*(z*sqrt(1.+z*z)+log(z+sqrt(1.+z*z)));
905 u=exp(ksi/2.-0.25)*pow(2.*ksi-1.,-ksi/2.)*pow(2.,(ksi-1.)/2.);
906 beta=0.5*(z/sqrt(1.+z*z)-1.);
907 n1=beta*(20.*beta*beta+30.*beta+9.)/12.;
908 n2=pow(beta,2.)*(6160.*pow(beta,4.)+18480.*pow(beta,3.)+19404.*pow(beta,2.)+8028.*beta+945.)/288.;
909 n3=27227200.*pow(beta,6.)+122522400.*pow(beta,5.)+220540320.*pow(beta,4.);
910 n3+=200166120.*pow(beta,3.)+94064328.*pow(beta,2.)+20546550.*beta+1403325.;
911 n3*=pow(beta,3.)/51840.;
912 phi=1.+n1/(2.*ksi-1.)+n2/pow(2.*ksi-1.,2.)+n3/pow(2.*ksi-1.,3.);
913 cpandel=pow(rho,ksi)*pow(sigma,ksi-1.)*exp(-pow(tres,2.)/(2.*pow(sigma,2.))+pow(eta,2.)/4.)/sqrt(2.*pi);
914 cpandel*=u*phi*exp(-k*(2.*ksi-1.))*pow(1.+z*z,-0.25);
915 }
916 else // (tres,ksi) outside validity rectangle
917 {
918 ier=1;
919 cout << " *IceChi2::GetPsi* Outside rectangle. We should never get here." << endl;
920 }
921
922 // Use 10*log10 expression to obtain intuitive dB scale
923 // Omit (small) negative values which are possible due to computer accuracy
924 psihit=0;
925 if (cpandel>0) psihit=-10.*log10(cpandel);
926
927 // Penalty in dB for (tres,ksi) points outside the validity rectangle
928 if (ier) psihit+=fPenalty;
929
930 // Update the psi statistics for this hit
931 fPsistats.Enter(float(psihit));
932 psi+=psihit;
933 }
934 return psi;
935}
936
IceChi2 * gIceChi2
Definition IceChi2.cxx:157
ClassImp(IceChi2)
void IceChi2FCN(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag)
Definition IceChi2.cxx:160
TTask derived class to perform Chi-squared track fitting.
Definition IceChi2.h:23
TObjArray * fHits
Definition IceChi2.h:46
Double_t GetPsi(NcTrack *t)
Definition IceChi2.cxx:765
Int_t fSelhits
Definition IceChi2.h:41
Float_t fPenalty
Definition IceChi2.h:50
void SetVgroupUsage(Int_t flag)
Definition IceChi2.cxx:634
void FitFCN(Int_t &, Double_t *, Double_t &, Double_t *, Int_t)
Definition IceChi2.cxx:695
TString fTrackname
Definition IceChi2.h:48
TFitter * fFitter
Definition IceChi2.h:47
IceChi2(const char *name="", const char *title="")
Definition IceChi2.cxx:168
Int_t fVgroup
Definition IceChi2.h:42
NcSignal * fFitstats
Definition IceChi2.h:52
NcSample fPsistats
Definition IceChi2.h:53
void SetTrackName(TString s)
Definition IceChi2.cxx:651
Int_t fPrint
Definition IceChi2.h:40
void SetPenalty(Float_t val)
Definition IceChi2.cxx:680
virtual ~IceChi2()
Definition IceChi2.cxx:195
void UseTracks(TString classname, Int_t n=-1)
Definition IceChi2.cxx:560
void SetCharge(Float_t charge)
Definition IceChi2.cxx:666
virtual void Exec(Option_t *opt)
Definition IceChi2.cxx:235
void SetPrintLevel(Int_t level)
Definition IceChi2.cxx:544
IceEvent * fEvt
Definition IceChi2.h:43
Int_t fFirst
Definition IceChi2.h:39
NcTrack * fTkfit
Definition IceChi2.h:51
void SelectHits(Int_t mode=1)
Definition IceChi2.cxx:616
Float_t fCharge
Definition IceChi2.h:49
TArrayI * fUseNtk
Definition IceChi2.h:45
TObjArray * fUseNames
Definition IceChi2.h:44
Handling of IceCube event data.
Definition IceEvent.h:20
Signal (Hit) handling of a generic IceCube Optical Module (GOM).
Definition IceGOM.h:12
Handling of 3-vectors in various reference frames.
Definition Nc3Vector.h:15
void GetErrors(Double_t *e, TString f, TString u="rad") const
void SetVector(Double_t *v, TString f, TString u="rad")
void SetErrors(Double_t *e, TString f, TString u="rad")
Double_t Dot(Nc3Vector &q)
void GetVector(Double_t *v, TString f, TString u="rad") const
Double_t GetNorm()
Int_t GetDeadValue(Int_t j=1) const
void SetSlotName(TString s, Int_t j=1)
Signal (Hit) handling of a generic device.
Definition NcDevice.h:14
Base class for top level job in a task based procedure.
Definition NcJob.h:18
TObject * GetObject(const char *classname) const
Definition NcJob.cxx:456
Handling of positions (with timestamps) in various reference frames.
Definition NcPosition.h:18
void GetPosition(Double_t *r, TString f, TString u="rad", Float_t s=-1) const
void SetPositionErrors(Double_t *e, TString f, TString u="rad")
void SetPosition(Double_t *r, TString f, TString u="rad")
NcTimestamp * GetTimestamp()
void SetTimestamp(NcTimestamp &t)
Generic handling of (extrapolated) detector signals.
Definition NcSignal.h:23
virtual void SetSignal(Double_t sig, Int_t j=1)
Definition NcSignal.cxx:516
NcDevice * GetDevice() const
virtual Float_t GetSignal(Int_t j=1, Int_t mode=0) const
Definition NcSignal.cxx:651
Handling of timestamps for (astro)particle physics research.
Definition NcTimestamp.h:20
void Add(Int_t d, Int_t s, Int_t ns, Int_t ps=0)
Handling of the attributes of a reconstructed particle track.
Definition NcTrack.h:19
NcSignal * GetSignal(Int_t j) const
Definition NcTrack.cxx:1017
Int_t GetNsignals() const
Definition NcTrack.cxx:970
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