NCFS-Pack
A generic (astro)particle physics analysis framework
 
Loading...
Searching...
No Matches
IceDwalk.cxx
Go to the documentation of this file.
1
17
19
348
349#include "IceDwalk.h"
350#include "Riostream.h"
351
352ClassImp(IceDwalk); // Class implementation to enable ROOT I/O
353
355IceDwalk::IceDwalk(const char* name,const char* title) : IceRecoBase(name,title)
356{
366
367 SetCleaned(1,"A");
368 SetCleaned(0,"I");
369 SetCleaned(0,"IC");
370 SetCleaned(0,"DC");
371
372 SetMaxMod(999999,"A");
373 SetMaxMod(999999,"I");
374 SetMaxMod(999999,"IC");
375 SetMaxMod(999999,"DC");
376
377 SetMinMod(0,"A");
378 SetMinMod(0,"I");
379 SetMinMod(0,"IC");
380 SetMinMod(0,"DC");
381
382 SetMaxHits(0,"A");
383 SetMaxHits(3,"I");
384 SetMaxHits(3,"IC");
385 SetMaxHits(3,"DC");
386
387 SetMinAhits(0,"A");
388 SetMinAhits(0,"I");
389 SetMinAhits(0,"IC");
390 SetMinAhits(0,"DC");
391
392 SetMinAmods(0,"A");
393 SetMinAmods(6,"I");
394 SetMinAmods(6,"IC");
395 SetMinAmods(2,"DC");
396
397 SetSLChitUsage(1,"I");
398 SetSLChitUsage(1,"IC");
399 SetSLChitUsage(1,"DC");
400
401 SetFlipAngles(-999,999);
402
403 SetScatteringLength(33.3,"A");
404 SetScatteringLength(30,"UD");
405 SetScatteringLength(5,"DL");
406 SetScatteringLength(40,"LD");
407
408 SetDmin(75,"A");
409 SetDmin(120,"IC");
410 SetDmin(85,"I");
411 SetDmin(45,"DC");
412
413 SetDtmarg(0,"A");
414 SetDtmarg(-1,"IC");
415 SetDtmarg(-1,"I");
416 SetDtmarg(-1,"DC");
417
418 SetMaxDhit(3.07126,"A");
419 SetMaxDhit(3,"IC");
420 SetMaxDhit(6,"I");
421 SetMaxDhit(12,"DC");
422
423 SetDthit(-30,300,"A");
424 SetDthit(-50,250,"IC");
425 SetDthit(-100,300,"I");
426 SetDthit(-150,350,"DC");
427
428 SetTangmax(15,"A");
429 SetTangmax(15,"IC");
430 SetTangmax(15,"I");
431 SetTangmax(15,"DC");
432
433 SetTdistmax(20,"A",1);
434 SetTdistmax(20,"IC",1);
435 SetTdistmax(20,"I",1);
436 SetTdistmax(20,"DC",1);
437
438 SetJangmax(fTangmaxA/2.,"A",1);
439 SetJangmax(fTangmaxIC/2.,"IC",1);
440 SetJangmax(fTangmaxI/2.,"I",1);
441 SetJangmax(fTangmaxDC/2.,"DC",1);
442
443 SetJdistmax(30,"A",1);
444 SetJdistmax(30,"IC",1);
445 SetJdistmax(30,"I",1);
446 SetJdistmax(30,"DC",1);
447
448 SetVgroupUsage(1,"A");
449 SetVgroupUsage(1,"IC");
450 SetVgroupUsage(1,"I");
451 SetVgroupUsage(1,"DC");
452
453 SetAsType(3,"A",2);
454 SetAsType(-5,"IC",2);
455 SetAsType(-5,"I",2);
456 SetAsType(-5,"DC",2);
457
458 SetHitWeight(-2);
459
460 SetSingleHit(0,"A");
461 SetSingleHit(200,"IC",20);
462 SetSingleHit(200,"I",20);
463 SetSingleHit(200,"DC",20);
464
466
467 SetQvalueCut(0.8);
468}
469
478
479void IceDwalk::SetDmin(Float_t d,TString s)
480{
493
494 if (s=="A")
495 {
496 fDminA=d;
497 fParams.AddNamedSlot("DminA");
498 fParams.SetSignal(fDminA,"DminA");
499 }
500 if (s=="IC")
501 {
502 fDminIC=d;
503 fParams.AddNamedSlot("DminIC");
504 fParams.SetSignal(fDminIC,"DminIC");
505 }
506 if (s=="DC")
507 {
508 fDminDC=d;
509 fParams.AddNamedSlot("DminDC");
510 fParams.SetSignal(fDminDC,"DminDC");
511 }
512 if (s=="I")
513 {
514 fDminI=d;
515 fParams.AddNamedSlot("DminI");
516 fParams.SetSignal(fDminI,"DminI");
517 }
518}
519
520void IceDwalk::SetDtmarg(Int_t dt,TString s)
521{
538
539 if (s=="A")
540 {
541 fDtmargA=dt;
542 fParams.AddNamedSlot("DtmargA");
543 fParams.SetSignal(fDtmargA,"DtmargA");
544 }
545 if (s=="IC")
546 {
547 fDtmargIC=dt;
548 fParams.AddNamedSlot("DtmargIC");
549 fParams.SetSignal(fDtmargIC,"DtmargIC");
550 }
551 if (s=="DC")
552 {
553 fDtmargDC=dt;
554 fParams.AddNamedSlot("DtmargDC");
555 fParams.SetSignal(fDtmargDC,"DtmargDC");
556 }
557 if (s=="I")
558 {
559 fDtmargI=dt;
560 fParams.AddNamedSlot("DtmargI");
561 fParams.SetSignal(fDtmargI,"DtmargI");
562 }
563}
564
565void IceDwalk::SetMaxDhit(Float_t d,TString s)
566{
579
580 if (s=="A")
581 {
582 fMaxdhitA=d;
583 fParams.AddNamedSlot("MaxdhitA");
584 fParams.SetSignal(fMaxdhitA,"MaxdhitA");
585 }
586 if (s=="IC")
587 {
588 fMaxdhitIC=d;
589 fParams.AddNamedSlot("MaxdhitIC");
590 fParams.SetSignal(fMaxdhitIC,"MaxdhitIC");
591 }
592 if (s=="DC")
593 {
594 fMaxdhitDC=d;
595 fParams.AddNamedSlot("MaxdhitDC");
596 fParams.SetSignal(fMaxdhitDC,"MaxdhitDC");
597 }
598 if (s=="I")
599 {
600 fMaxdhitI=d;
601 fParams.AddNamedSlot("MaxdhitI");
602 fParams.SetSignal(fMaxdhitI,"MaxdhitI");
603 }
604}
605
606void IceDwalk::SetDthit(Float_t dtmin,Float_t dtmax,TString s)
607{
627
628 if (s=="A")
629 {
630 fDtminA=dtmin;
631 fDtmaxA=dtmax;
632 fParams.AddNamedSlot("DtminA");
633 fParams.AddNamedSlot("DtmaxA");
634 fParams.SetSignal(fDtminA,"DtminA");
635 fParams.SetSignal(fDtmaxA,"DtmaxA");
636 }
637
638 if (s=="IC")
639 {
640 fDtminIC=dtmin;
641 fDtmaxIC=dtmax;
642 fParams.AddNamedSlot("DtminIC");
643 fParams.AddNamedSlot("DtmaxIC");
644 fParams.SetSignal(fDtminIC,"DtminIC");
645 fParams.SetSignal(fDtmaxIC,"DtmaxIC");
646 }
647
648 if (s=="DC")
649 {
650 fDtminDC=dtmin;
651 fDtmaxDC=dtmax;
652 fParams.AddNamedSlot("DtminDC");
653 fParams.AddNamedSlot("DtmaxDC");
654 fParams.SetSignal(fDtminDC,"DtminDC");
655 fParams.SetSignal(fDtmaxDC,"DtmaxDC");
656 }
657
658 if (s=="I")
659 {
660 fDtminI=dtmin;
661 fDtmaxI=dtmax;
662 fParams.AddNamedSlot("DtminI");
663 fParams.AddNamedSlot("DtmaxI");
664 fParams.SetSignal(fDtminI,"DtminI");
665 fParams.SetSignal(fDtmaxI,"DtmaxI");
666 }
667}
668
669void IceDwalk::SetTangmax(Float_t ang,TString s)
670{
689
690 if (s=="A")
691 {
692 fTangmaxA=ang;
693 fJangmaxA=ang/2.;
694 fParams.AddNamedSlot("TangmaxA");
695 fParams.SetSignal(fTangmaxA,"TangmaxA");
696 fParams.AddNamedSlot("JangmaxA");
697 fParams.SetSignal(fJangmaxA,"JangmaxA");
698 }
699
700 if (s=="IC")
701 {
702 fTangmaxIC=ang;
703 fJangmaxIC=ang/2.;
704 fParams.AddNamedSlot("TangmaxIC");
705 fParams.SetSignal(fTangmaxIC,"TangmaxIC");
706 fParams.AddNamedSlot("JangmaxIC");
707 fParams.SetSignal(fJangmaxIC,"JangmaxIC");
708 }
709
710 if (s=="DC")
711 {
712 fTangmaxDC=ang;
713 fJangmaxDC=ang/2.;
714 fParams.AddNamedSlot("TangmaxDC");
715 fParams.SetSignal(fTangmaxDC,"TangmaxDC");
716 fParams.AddNamedSlot("JangmaxDC");
717 fParams.SetSignal(fJangmaxDC,"JangmaxDC");
718 }
719
720 if (s=="I")
721 {
722 fTangmaxI=ang;
723 fJangmaxI=ang/2.;
724 fParams.AddNamedSlot("TangmaxI");
725 fParams.SetSignal(fTangmaxI,"TangmaxI");
726 fParams.AddNamedSlot("JangmaxI");
727 fParams.SetSignal(fJangmaxI,"JangmaxI");
728 }
729}
730
731void IceDwalk::SetTdistmax(Float_t d,TString s,Int_t invol)
732{
755
756 if (s=="A")
757 {
758 fTdistmaxA=d;
759 fTinvolA=invol;
760 fParams.AddNamedSlot("TdistmaxA");
761 fParams.AddNamedSlot("TinvolA");
762 fParams.SetSignal(fTdistmaxA,"TdistmaxA");
763 fParams.SetSignal(fTinvolA,"TinvolA");
764 }
765
766 if (s=="IC")
767 {
768 fTdistmaxIC=d;
769 fTinvolIC=invol;
770 fParams.AddNamedSlot("TdistmaxIC");
771 fParams.AddNamedSlot("TinvolIC");
772 fParams.SetSignal(fTdistmaxIC,"TdistmaxIC");
773 fParams.SetSignal(fTinvolIC,"TinvolIC");
774 }
775
776 if (s=="DC")
777 {
778 fTdistmaxDC=d;
779 fTinvolDC=invol;
780 fParams.AddNamedSlot("TdistmaxDC");
781 fParams.AddNamedSlot("TinvolDC");
782 fParams.SetSignal(fTdistmaxDC,"TdistmaxDC");
783 fParams.SetSignal(fTinvolDC,"TinvolDC");
784 }
785
786 if (s=="I")
787 {
788 fTdistmaxI=d;
789 fTinvolI=invol;
790 fParams.AddNamedSlot("TdistmaxI");
791 fParams.AddNamedSlot("TinvolI");
792 fParams.SetSignal(fTdistmaxI,"TdistmaxI");
793 fParams.SetSignal(fTinvolI,"TinvolI");
794 }
795}
796
797void IceDwalk::SetJangmax(Float_t ang,TString s,Int_t iter)
798{
831
832 if (s=="A")
833 {
834 fJangmaxA=ang;
835 fJiterateA=iter;
836 fParams.AddNamedSlot("JangmaxA");
837 fParams.AddNamedSlot("JiterateA");
838 fParams.SetSignal(fJangmaxA,"JangmaxA");
839 fParams.SetSignal(fJiterateA,"JiterateA");
840 }
841
842 if (s=="IC")
843 {
844 fJangmaxIC=ang;
845 fJiterateIC=iter;
846 fParams.AddNamedSlot("JangmaxIC");
847 fParams.AddNamedSlot("JiterateIC");
848 fParams.SetSignal(fJangmaxIC,"JangmaxIC");
849 fParams.SetSignal(fJiterateIC,"JiterateIC");
850 }
851
852 if (s=="DC")
853 {
854 fJangmaxDC=ang;
855 fJiterateDC=iter;
856 fParams.AddNamedSlot("JangmaxDC");
857 fParams.AddNamedSlot("JiterateDC");
858 fParams.SetSignal(fJangmaxDC,"JangmaxDC");
859 fParams.SetSignal(fJiterateDC,"JiterateDC");
860 }
861
862 if (s=="I")
863 {
864 fJangmaxI=ang;
865 fJiterateI=iter;
866 fParams.AddNamedSlot("JangmaxI");
867 fParams.AddNamedSlot("JiterateI");
868 fParams.SetSignal(fJangmaxI,"JangmaxI");
869 fParams.SetSignal(fJiterateI,"JiterateI");
870 }
871}
872
873void IceDwalk::SetJdistmax(Float_t d,TString s,Int_t invol)
874{
896
897 if (s=="A")
898 {
899 fJdistmaxA=d;
900 fJinvolA=invol;
901 fParams.AddNamedSlot("JdistmaxA");
902 fParams.AddNamedSlot("JinvolA");
903 fParams.SetSignal(fJdistmaxA,"JdistmaxA");
904 fParams.SetSignal(fJinvolA,"JinvolA");
905 }
906
907 if (s=="IC")
908 {
909 fJdistmaxIC=d;
910 fJinvolIC=invol;
911 fParams.AddNamedSlot("JdistmaxIC");
912 fParams.AddNamedSlot("JinvolIC");
913 fParams.SetSignal(fJdistmaxIC,"JdistmaxIC");
914 fParams.SetSignal(fJinvolIC,"JinvolIC");
915 }
916
917 if (s=="DC")
918 {
919 fJdistmaxDC=d;
920 fJinvolDC=invol;
921 fParams.AddNamedSlot("JdistmaxDC");
922 fParams.AddNamedSlot("JinvolDC");
923 fParams.SetSignal(fJdistmaxDC,"JdistmaxDC");
924 fParams.SetSignal(fJinvolDC,"JinvolDC");
925 }
926
927 if (s=="I")
928 {
929 fJdistmaxI=d;
930 fJinvolI=invol;
931 fParams.AddNamedSlot("JdistmaxI");
932 fParams.AddNamedSlot("JinvolI");
933 fParams.SetSignal(fJdistmaxI,"JdistmaxI");
934 fParams.SetSignal(fJinvolI,"JinvolI");
935 }
936}
937
938void IceDwalk::SetAsType(Int_t flag,TString s,Float_t w)
939{
976
977 if (s=="A")
978 {
979 if (flag>=-5 && flag<=4) fAsTypeA=flag;
980 if (w>0) fWstringA=w;
981 fParams.AddNamedSlot("AsTypeA");
982 fParams.AddNamedSlot("WstringA");
983 fParams.SetSignal(fAsTypeA,"AsTypeA");
984 fParams.SetSignal(fWstringA,"WstringA");
985 }
986
987 if (s=="IC")
988 {
989 if (flag>=-5 && flag<=4) fAsTypeIC=flag;
990 if (w>0) fWstringIC=w;
991 fParams.AddNamedSlot("AsTypeIC");
992 fParams.AddNamedSlot("WstringIC");
993 fParams.SetSignal(fAsTypeIC,"AsTypeIC");
994 fParams.SetSignal(fWstringIC,"WstringIC");
995 }
996
997 if (s=="DC")
998 {
999 if (flag>=-5 && flag<=4) fAsTypeDC=flag;
1000 if (w>0) fWstringDC=w;
1001 fParams.AddNamedSlot("AsTypeDC");
1002 fParams.AddNamedSlot("WstringDC");
1003 fParams.SetSignal(fAsTypeDC,"AsTypeDC");
1004 fParams.SetSignal(fWstringDC,"WstringDC");
1005 }
1006
1007 if (s=="I")
1008 {
1009 if (flag>=-5 && flag<=4) fAsTypeI=flag;
1010 if (w>0) fWstringI=w;
1011 fParams.AddNamedSlot("AsTypeI");
1012 fParams.AddNamedSlot("WstringI");
1013 fParams.SetSignal(fAsTypeI,"AsTypeI");
1014 fParams.SetSignal(fWstringI,"WstringI");
1015 }
1016}
1017
1019{
1043
1044 fHitweight=w;
1045
1046 fParams.AddNamedSlot("Hitweight");
1047 fParams.SetSignal(fHitweight,"Hitweight");
1048}
1049
1051{
1093
1094 if (flag>=0 && flag<=8) fConditional=flag;
1095
1096 fParams.AddNamedSlot("ConditionalReco");
1097 fParams.SetSignal(fConditional,"ConditionalReco");
1098}
1099
1100void IceDwalk::SetQvalueCut(Float_t qcut)
1101{
1110
1111 fQcut=qcut;
1112
1113 fParams.AddNamedSlot("QvalueCut");
1114 fParams.SetSignal(fQcut,"QvalueCut");
1115}
1116
1117void IceDwalk::Exec(Option_t* opt)
1118{
1124
1125 // Obtain a pointer to the parent NcJob of this reconstruction task
1126 TString name=opt;
1127 NcJob* parent=(NcJob*)(gROOT->GetListOfTasks()->FindObject(name.Data()));
1128
1129 if (!parent) return;
1130
1131 // Obtain a pointer to the IceCube event data structure
1132 fEvt=(IceEvent*)parent->GetObject("IceEvent");
1133 if (!fEvt) return;
1134
1135 // Only process accepted events
1136 NcDevice* seldev=(NcDevice*)fEvt->GetDevice("NcEventSelector");
1137 if (seldev)
1138 {
1139 if (seldev->GetSignal("Select") < 0.1) return;
1140 }
1141
1142 // Provide a name for the fParams device in the event
1143 fParams.SetNameTitle(ClassName(),"Reco parameters");
1144
1145 // Add the fParams device to the IceEvent structure
1146 fEvt->AddDevice(fParams);
1147
1148 // Flag to indicate that a track has been found
1149 // to enable condional reconstruction
1150 Int_t track=0;
1151
1153 // Perform the various reconstructions (conditionally) //
1155
1156 Amanda(); // The (old) Amanda reconstruction
1157
1158 TObjArray hits; // Storage area for hits to be used in reconstruction
1159
1160 track=IceCube(hits);
1161 if (fConditional==0 || fConditional==3 || fConditional==6 || !track) track=InIce(hits);
1162 if (fConditional==0 || fConditional==1 || fConditional==3 || fConditional==4 || fConditional==6 || fConditional==7 || !track) track=DeepCore(hits);
1163}
1164
1166{
1172
1173 if (fMaxhitsA<0) return 0;
1174
1175 // Fetch all fired Amanda OMs for this event
1176 TObjArray* devs=fEvt->GetDevices("IceAOM");
1177 if (!devs) return 0;
1178 Int_t naoms=devs->GetEntries();
1179 if (!naoms) return 0;
1180
1181 // Secure the OM pointers in a private array
1182 TObjArray aoms;
1183 for (Int_t i=0; i<naoms; i++)
1184 {
1185 aoms.Add(devs->At(i));
1186 }
1187
1188 // Check for the minimum and/or maximum number of good fired Amanda OMs
1189 Int_t ngood=0;
1190 for (Int_t iom=0; iom<naoms; iom++)
1191 {
1192 IceGOM* omx=(IceGOM*)aoms.At(iom);
1193 if (!omx) continue;
1194 if (omx->GetDeadValue("ADC") || omx->GetDeadValue("LE") || omx->GetDeadValue("TOT")) continue;
1195 ngood++;
1196 }
1197 if (ngood<fMinmodA || ngood>fMaxmodA) return 0;
1198
1199 Int_t ngood1=fEvt->GetStringMax("IceAOM");
1200
1201 Int_t maxhits=fMaxhitsA;
1202 if (fSingleA && ngood>=fSingleA) maxhits=1;
1203 if (fSingle1A && ngood1>=fSingle1A) maxhits=1;
1204
1205 const Float_t c=0.299792458; // Light speed in vacuum in meters per ns
1206
1207 // Storage of track elements.
1208 TObjArray tes;
1209 tes.SetOwner();
1210
1211 NcPosition r1;
1212 NcPosition r2;
1213 Nc3Vector r12;
1214 Nc3Vector rsum;
1215 NcPosition r0;
1216 TObjArray hits1;
1217 TObjArray hits2;
1218 Int_t nh1,nh2;
1219 NcSignal* sx1=0;
1220 NcSignal* sx2=0;
1221 Float_t dist=0;
1222 Float_t t1,t2,dt,t0;
1223 Float_t dtres;
1224 TObjArray hits;
1225 TObjArray* ordered;
1226
1227 Float_t dtmin=fDtminA;
1228 Float_t dtmax=fDtmaxA;
1229 if (fDtmargA>=0)
1230 {
1231 dtmin=-fDtmargA;
1232 dtmax=fDtmargA;
1233 }
1234
1235 // Check the hits of Amanda OM pairs for possible track elements.
1236 // Also all the good hits are stored in the meantime (to save CPU time)
1237 // for hit association with the various track elements lateron.
1238 NcTrack* te=0;
1239 for (Int_t i1=0; i1<naoms; i1++) // First OM of the pair
1240 {
1241 IceGOM* omx1=(IceGOM*)aoms.At(i1);
1242 if (!omx1) continue;
1243 if (omx1->GetDeadValue("LE")) continue;
1244 r1=omx1->GetPosition();
1245 // Select all the good hits of this first OM
1246 hits1.Clear();
1247 // Determine the max. number of hits to be processed for this OM
1248 ordered=0;
1249 if (maxhits>0 && omx1->GetNhits()>maxhits) ordered=omx1->SortHits("LE",1,0,7);
1250 nh1=0;
1251 for (Int_t j1=1; j1<=omx1->GetNhits(); j1++)
1252 {
1253 if (ordered)
1254 {
1255 if (nh1>=maxhits) break;
1256 sx1=(NcSignal*)ordered->At(j1-1);
1257 }
1258 else
1259 {
1260 sx1=omx1->GetHit(j1);
1261 }
1262 if (!sx1) continue;
1263 if (fCleanA && (sx1->GetDeadValue("ADC") || sx1->GetDeadValue("LE") || sx1->GetDeadValue("TOT"))) continue;
1264 hits1.Add(sx1);
1265 // Also store all good hits in the total hit array
1266 hits.Add(sx1);
1267 nh1++;
1268 }
1269
1270 // No further pair to be formed with the last OM in the list
1271 if (i1==(naoms-1)) break;
1272
1273 nh1=hits1.GetEntries();
1274 if (!nh1) continue;
1275
1276 for (Int_t i2=i1+1; i2<naoms; i2++) // Second OM of the pair
1277 {
1278 IceGOM* omx2=(IceGOM*)aoms.At(i2);
1279 if (!omx2) continue;
1280 if (omx2->GetDeadValue("LE")) continue;
1281 r2=omx2->GetPosition();
1282 r12=r2-r1;
1283 dist=r12.GetNorm();
1284
1285 if (dist<fDminA) continue;
1286
1287 // Select all the good hits of this second OM
1288 hits2.Clear();
1289 // Determine the max. number of hits to be processed for this OM
1290 ordered=0;
1291 if (maxhits>0 && omx2->GetNhits()>maxhits) ordered=omx2->SortHits("LE",1,0,7);
1292 nh2=0;
1293 for (Int_t j2=1; j2<=omx2->GetNhits(); j2++)
1294 {
1295 if (ordered)
1296 {
1297 if (nh2>=maxhits) break;
1298 sx2=(NcSignal*)ordered->At(j2-1);
1299 }
1300 else
1301 {
1302 sx2=omx2->GetHit(j2);
1303 }
1304 if (!sx2) continue;
1305 if (fCleanA && (sx2->GetDeadValue("ADC") || sx2->GetDeadValue("LE") || sx2->GetDeadValue("TOT"))) continue;
1306 hits2.Add(sx2);
1307 nh2++;
1308 }
1309
1310 nh2=hits2.GetEntries();
1311 if (!nh2) continue;
1312
1313 // Position r0 in between the two OMs and normalised relative direction r12
1314 rsum=(r1+r2)/2.;
1315 r0.SetPosition((Nc3Vector&)rsum);
1316 r12/=dist;
1317
1318 // Check all hit pair combinations of these two OMs for possible track elements
1319 for (Int_t ih1=0; ih1<nh1; ih1++) // Hits of first OM
1320 {
1321 sx1=(NcSignal*)hits1.At(ih1);
1322 if (!sx1) continue;
1323 for (Int_t ih2=0; ih2<nh2; ih2++) // Hits of second OM
1324 {
1325 sx2=(NcSignal*)hits2.At(ih2);
1326 if (!sx2) continue;
1327 t1=sx1->GetSignal("LE",7);
1328 t2=sx2->GetSignal("LE",7);
1329 dt=t2-t1;
1330 dtres=fabs(dt)-dist/c;
1331 t0=(t1+t2)/2.;
1332
1333 if (dtres<dtmin || dtres>dtmax) continue;
1334
1335 te=new NcTrack();
1336 tes.Add(te);
1337 if (dt<0) r12*=-1.;
1339 NcTimestamp* tsx=r0.GetTimestamp();
1340 tsx->Add(0,0,(int)t0);
1341 te->SetReferencePoint(r0);
1342 te->Set3Momentum(r12);
1343 }
1344 }
1345 } // end of loop over the second OM of the pair
1346 } // end of loop over first OM of the pair
1347
1348 // Association of hits to the various track elements.
1349 Float_t qmax=0;
1351
1352 // Skip poorly reconstructed events
1353 if (qmax<=0) return 0;
1354
1355 // Selection on quality (Q value) in case of multiple track candidates
1356 SelectQvalue(tes,qmax);
1357
1358 Int_t nte=tes.GetEntries();
1359 if (!nte) return 0;
1360
1361 // Clustering of track candidates into jets
1362 TObjArray jets;
1363 jets.SetOwner();
1365
1366 Int_t njets=jets.GetEntries();
1367 if (!njets) return 0;
1368
1369 // Order the jets w.r.t. decreasing quality value
1370 ordered=fEvt->SortJets(-2,&jets);
1371 TObjArray jets2(*ordered);
1372
1373 // Merging of jets
1375
1376 // Production and storage of the final tracks
1377 TString name=fTrackname;
1378 if (name=="") name=ClassName();
1379 name+="A";
1380 TString title=ClassName();
1381 title+=" Amanda track";
1382 Int_t ntk=StoreTracks(jets2,fMinahitsA,fMinamodsA,fJangmaxA,name,title,hits);
1383
1384 return ntk;
1385}
1386
1387Int_t IceDwalk::IceCube(TObjArray& hits)
1388{
1401
1402 // Determination and storage of track elements.
1403 TObjArray tes;
1404 tes.SetOwner();
1405 Int_t gethits=1;
1406 TString domclass="IceICDOM";
1407 if (fConditional>=3) domclass="IceIDOM";
1408 Int_t ntes=MakeTEs(fCleanIC,fMaxhitsIC,fDminIC,fDtmargIC,fDtminIC,fDtmaxIC,domclass,tes,hits,gethits);
1409 if (!ntes) return 0;
1410
1411 // Association of hits to the various track elements.
1412 Float_t qmax=0;
1414
1415 // Skip poorly reconstructed events
1416 if (qmax<=0) return 0;
1417
1418 // Selection on quality (Q value) in case of multiple track candidates
1419 SelectQvalue(tes,qmax);
1420
1421 Int_t nte=tes.GetEntries();
1422 if (!nte) return 0;
1423
1424 // Clustering of track candidates into jets
1425 TObjArray jets;
1426 jets.SetOwner();
1428
1429 Int_t njets=jets.GetEntries();
1430 if (!njets) return 0;
1431
1432 // Order the jets w.r.t. decreasing quality value
1433 TObjArray* ordered=fEvt->SortJets(-2,&jets);
1434 TObjArray jets2(*ordered);
1435
1436 // Merging of jets
1438
1439 // Production and storage of the final tracks
1440 TString name=fTrackname;
1441 if (name=="") name=ClassName();
1442 name+="IC";
1443 TString title=ClassName();
1444 title+=" standard IceCube track";
1445 Int_t ntk=StoreTracks(jets2,fMinahitsIC,fMinamodsIC,fJangmaxIC,name,title,hits);
1446
1447 return ntk;
1448}
1449
1450Int_t IceDwalk::InIce(TObjArray& hits)
1451{
1464
1465 // Determination and storage of track elements.
1466 TObjArray tes;
1467 tes.SetOwner();
1468 Int_t gethits=1;
1469 if (fConditional>=3 && fMaxhitsIC>=0) gethits=0;
1470 Int_t ntes=MakeTEs(fCleanI,fMaxhitsI,fDminI,fDtmargI,fDtminI,fDtmaxI,"IceIDOM",tes,hits,gethits);
1471 if (!ntes) return 0;
1472
1473 // Association of hits to the various track elements.
1474 Float_t qmax=0;
1476
1477 // Skip poorly reconstructed events
1478 if (qmax<=0) return 0;
1479
1480 // Selection on quality (Q value) in case of multiple track candidates
1481 SelectQvalue(tes,qmax);
1482
1483 Int_t nte=tes.GetEntries();
1484 if (!nte) return 0;
1485
1486 // Clustering of track candidates into jets
1487 TObjArray jets;
1488 jets.SetOwner();
1490
1491 Int_t njets=jets.GetEntries();
1492 if (!njets) return 0;
1493
1494 // Order the jets w.r.t. decreasing quality value
1495 TObjArray* ordered=fEvt->SortJets(-2,&jets);
1496 TObjArray jets2(*ordered);
1497
1498 // Merging of jets
1500
1501 // Production and storage of the final tracks
1502 TString name=fTrackname;
1503 if (name=="") name=ClassName();
1504 name+="I";
1505 TString title=ClassName();
1506 title+=" InIce track";
1507 Int_t ntk=StoreTracks(jets2,fMinahitsI,fMinamodsI,fJangmaxI,name,title,hits);
1508
1509 return ntk;
1510}
1511
1512Int_t IceDwalk::DeepCore(TObjArray& hits)
1513{
1526
1527 // Determination and storage of track elements.
1528 TObjArray tes;
1529 tes.SetOwner();
1530 Int_t gethits=1;
1531 TString domclass="IceDCDOM";
1532 if (fConditional>=3)
1533 {
1534 domclass="IceIDOM";
1535 if (fMaxhitsIC>=0 || fMaxhitsI>=0) gethits=0;
1536 }
1537 Int_t ntes=MakeTEs(fCleanDC,fMaxhitsDC,fDminDC,fDtmargDC,fDtminDC,fDtmaxDC,domclass,tes,hits,gethits);
1538 if (!ntes) return 0;
1539
1540 // Association of hits to the various track elements.
1541 Float_t qmax=0;
1543
1544 // Skip poorly reconstructed events
1545 if (qmax<=0) return 0;
1546
1547 // Selection on quality (Q value) in case of multiple track candidates
1548 SelectQvalue(tes,qmax);
1549
1550 Int_t nte=tes.GetEntries();
1551 if (!nte) return 0;
1552
1553 // Clustering of track candidates into jets
1554 TObjArray jets;
1555 jets.SetOwner();
1557
1558 Int_t njets=jets.GetEntries();
1559 if (!njets) return 0;
1560
1561 // Order the jets w.r.t. decreasing quality value
1562 TObjArray* ordered=fEvt->SortJets(-2,&jets);
1563 TObjArray jets2(*ordered);
1564
1565 // Merging of jets
1567
1568 // Production and storage of the final tracks
1569 TString name=fTrackname;
1570 if (name=="") name=ClassName();
1571 name+="DC";
1572 TString title=ClassName();
1573 title+=" DeepCore track";
1574 Int_t ntk=StoreTracks(jets2,fMinahitsDC,fMinamodsDC,fJangmaxDC,name,title,hits);
1575
1576 return ntk;
1577}
1578
1579Int_t IceDwalk::MakeTEs(Int_t cln,Int_t maxhits,Float_t dmin,Float_t dtmarg,Float_t dtmin,Float_t dtmax,TString domclass,TObjArray& tes,TObjArray& hits,Int_t gethits)
1580{
1595
1596 if (fConditional<=2 && maxhits<0) return 0;
1597
1598 // Fetch all fired "domclass" DOMs for this event
1599 TObjArray* devs=fEvt->GetDevices(domclass);
1600 if (!devs) return 0;
1601 Int_t ndoms=devs->GetEntries();
1602 if (!ndoms) return 0;
1603
1604 // Secure the DOM pointers in a private array
1605 TObjArray doms;
1606 for (Int_t i=0; i<ndoms; i++)
1607 {
1608 doms.Add(devs->At(i));
1609 }
1610
1611 // Check for the minimum and/or maximum number of good fired DOMs
1612 Int_t ngoodIC=0;
1613 Int_t ngoodI=0;
1614 Int_t ngoodDC=0;
1615 for (Int_t idom=0; idom<ndoms; idom++)
1616 {
1617 IceGOM* omx=(IceGOM*)doms.At(idom);
1618 if (!omx) continue;
1619 if (omx->GetDeadValue("ADC") || omx->GetDeadValue("LE") || omx->GetDeadValue("TOT")) continue;
1620 if (omx->InheritsFrom("IceICDOM")) ngoodIC++;
1621 if (omx->InheritsFrom("IceIDOM")) ngoodI++;
1622 if (omx->InheritsFrom("IceDCDOM")) ngoodDC++;
1623 }
1624 if (ngoodIC<fMinmodIC || ngoodIC>fMaxmodIC) return 0;
1625 if (ngoodI<fMinmodI || ngoodI>fMaxmodI) return 0;
1626 if (ngoodDC<fMinmodDC || ngoodDC>fMaxmodDC) return 0;
1627
1628 Int_t ngood1IC=fEvt->GetStringMax("IceICDOM");
1629 Int_t ngood1I=fEvt->GetStringMax("IceIDOM");
1630 Int_t ngood1DC=fEvt->GetStringMax("IceDCDOM");
1631
1632 const Float_t c=0.299792458; // Light speed in vacuum in meters per ns
1633
1634 // Use dtmarg as symmetric causality time window margin if selected.
1635 // Otherwise the specified timeresidual windows will be used.
1636 if (dtmarg>=0)
1637 {
1638 dtmin=-dtmarg;
1639 dtmax=dtmarg;
1640 }
1641
1642 NcPosition r1;
1643 NcPosition r2;
1644 Nc3Vector r12;
1645 Nc3Vector rsum;
1646 NcPosition r0;
1647 TObjArray hits1;
1648 TObjArray hits2;
1649 Int_t nh1,nh2;
1650 NcSignal* sx1=0;
1651 NcSignal* sx2=0;
1652 Float_t dist=0;
1653 Float_t t1,t2,dt,t0;
1654 Float_t dtres;
1655 TObjArray* ordered;
1656
1657 // Check the hits of DOM pairs for possible track elements.
1658 // Also all the good hits are stored in the meantime (to save CPU time)
1659 // for hit association with the various track elements lateron.
1660 NcTrack* te=0;
1661 for (Int_t i1=0; i1<ndoms; i1++) // First DOM of the pair
1662 {
1663 IceGOM* omx1=(IceGOM*)doms.At(i1);
1664 if (!omx1) continue;
1665 if (omx1->GetDeadValue("ADC") || omx1->GetDeadValue("LE") || omx1->GetDeadValue("TOT")) continue;
1666 r1=omx1->GetPosition();
1667
1668 // Select all the good hits of this first DOM
1669 hits1.Clear();
1670
1671 if (gethits) // New filling of the hit array data
1672 {
1673 // Determine the max. number of hits to be processed for this DOM
1674 if (omx1->InheritsFrom("IceICDOM"))
1675 {
1676 maxhits=fMaxhitsIC;
1677 if (fSingleIC && ngoodIC>=fSingleIC) maxhits=1;
1678 if (fSingle1IC && ngood1IC>=fSingle1IC) maxhits=1;
1679 }
1680 if (omx1->InheritsFrom("IceDCDOM"))
1681 {
1682 maxhits=fMaxhitsDC;
1683 if (fSingleDC && ngoodDC>=fSingleDC) maxhits=1;
1684 if (fSingle1DC && ngood1DC>=fSingle1DC) maxhits=1;
1685 }
1686 if (fSingleI && ngoodI>=fSingleI) maxhits=1;
1687 if (fSingle1I && ngood1I>=fSingle1I) maxhits=1;
1688
1689 if (maxhits<0) continue;
1690
1691 ordered=0;
1692 if (maxhits>0 && omx1->GetNhits()>maxhits) ordered=omx1->SortHits("ADC",-1,0,7);
1693 nh1=0;
1694 for (Int_t j1=1; j1<=omx1->GetNhits(); j1++)
1695 {
1696 if (ordered)
1697 {
1698 if (nh1>=maxhits) break;
1699 sx1=(NcSignal*)ordered->At(j1-1);
1700 }
1701 else
1702 {
1703 sx1=omx1->GetHit(j1);
1704 }
1705 if (!sx1) continue;
1706 if (cln && (sx1->GetDeadValue("ADC") || sx1->GetDeadValue("LE") || sx1->GetDeadValue("TOT"))) continue;
1707 if (sx1->GetSignal("SLC")<0.5)
1708 {
1709 hits1.Add(sx1);
1710 nh1++;
1711 }
1712 // Also store all good hits in the total hit array
1713 hits.Add(sx1);
1714 }
1715 }
1716 else // Use the existing hits in the array for this DOM
1717 {
1718 for (Int_t j1=0; j1<hits.GetEntries(); j1++)
1719 {
1720 sx1=(NcSignal*)hits.At(j1);
1721 if (!sx1) continue;
1722 if (cln && (sx1->GetDeadValue("ADC") || sx1->GetDeadValue("LE") || sx1->GetDeadValue("TOT"))) continue;
1723 if (sx1->GetSignal("SLC")>0.5) continue;
1724 IceGOM* omx=(IceGOM*)sx1->GetDevice();
1725 if (omx==omx1) hits1.Add(sx1);
1726 }
1727 }
1728
1729 // No further pair to be formed with the last DOM in the list
1730 if (i1==(ndoms-1)) break;
1731
1732 nh1=hits1.GetEntries();
1733 if (!nh1) continue;
1734
1735 for (Int_t i2=i1+1; i2<ndoms; i2++) // Second DOM of the pair
1736 {
1737 IceGOM* omx2=(IceGOM*)doms.At(i2);
1738 if (!omx2) continue;
1739 if (omx2->GetDeadValue("ADC") || omx2->GetDeadValue("LE") || omx2->GetDeadValue("TOT")) continue;
1740 r2=omx2->GetPosition();
1741 r12=r2-r1;
1742 dist=r12.GetNorm();
1743 if (dist<dmin) continue;
1744
1745 // Select all the good hits of this second DOM
1746 hits2.Clear();
1747
1748 if (gethits) // New filling of the hit array data
1749 {
1750 // Determine the max. number of hits to be processed for this DOM
1751 if (omx2->InheritsFrom("IceICDOM"))
1752 {
1753 maxhits=fMaxhitsIC;
1754 if (fSingleIC && ngoodIC>=fSingleIC) maxhits=1;
1755 if (fSingle1IC && ngood1IC>=fSingle1IC) maxhits=1;
1756 }
1757 if (omx2->InheritsFrom("IceDCDOM"))
1758 {
1759 maxhits=fMaxhitsDC;
1760 if (fSingleDC && ngoodDC>=fSingleDC) maxhits=1;
1761 if (fSingle1DC && ngood1DC>=fSingle1DC) maxhits=1;
1762 }
1763 if (fSingleI && ngoodI>=fSingleI) maxhits=1;
1764 if (fSingle1I && ngood1I>=fSingle1I) maxhits=1;
1765
1766 if (maxhits<0) continue;
1767
1768 ordered=0;
1769 if (maxhits>0 && omx2->GetNhits()>maxhits) ordered=omx2->SortHits("ADC",-1,0,7);
1770 nh2=0;
1771 for (Int_t j2=1; j2<=omx2->GetNhits(); j2++)
1772 {
1773 if (ordered)
1774 {
1775 if (nh2>=maxhits) break;
1776 sx2=(NcSignal*)ordered->At(j2-1);
1777 }
1778 else
1779 {
1780 sx2=omx2->GetHit(j2);
1781 }
1782 if (!sx2) continue;
1783 if (cln && (sx2->GetDeadValue("ADC") || sx2->GetDeadValue("LE") || sx2->GetDeadValue("TOT"))) continue;
1784 if (sx2->GetSignal("SLC")>0.5) continue;
1785 hits2.Add(sx2);
1786 nh2++;
1787 }
1788 }
1789 else // Use the existing hits in the array for this DOM
1790 {
1791 for (Int_t j2=0; j2<hits.GetEntries(); j2++)
1792 {
1793 sx2=(NcSignal*)hits.At(j2);
1794 if (!sx2) continue;
1795 if (cln && (sx2->GetDeadValue("ADC") || sx2->GetDeadValue("LE") || sx2->GetDeadValue("TOT"))) continue;
1796 if (sx2->GetSignal("SLC")>0.5) continue;
1797 IceGOM* omx=(IceGOM*)sx2->GetDevice();
1798 if (omx==omx2) hits2.Add(sx2);
1799 }
1800 }
1801
1802 nh2=hits2.GetEntries();
1803 if (!nh2) continue;
1804
1805 // Position r0 in between the two DOMs and normalised relative direction r12
1806 rsum=(r1+r2)/2.;
1807 r0.SetPosition((Nc3Vector&)rsum);
1808 r12/=dist; // Make r12 a unit vector
1809
1810 // Check all hit pair combinations of these two DOMs for possible track elements
1811 for (Int_t ih1=0; ih1<nh1; ih1++) // Hits of first DOM
1812 {
1813 sx1=(NcSignal*)hits1.At(ih1);
1814 if (!sx1) continue;
1815 for (Int_t ih2=0; ih2<nh2; ih2++) // Hits of second DOM
1816 {
1817 sx2=(NcSignal*)hits2.At(ih2);
1818 if (!sx2) continue;
1819 t1=sx1->GetSignal("LE",7);
1820 t2=sx2->GetSignal("LE",7);
1821 dt=t2-t1;
1822 dtres=fabs(dt)-dist/c;
1823 t0=(t1+t2)/2.;
1824
1825 if (dtres<dtmin || dtres>dtmax) continue;
1826
1827 te=new NcTrack();
1828 tes.Add(te);
1829 if (dt<0) r12*=-1.;
1831 NcTimestamp* tsx=r0.GetTimestamp();
1832 tsx->Add(0,0,(int)t0);
1833 te->SetReferencePoint(r0);
1834 te->Set3Momentum(r12);
1835 }
1836 }
1837 } // end of loop over the second DOM of the pair
1838 } // end of loop over first DOM of the pair
1839
1840 Int_t ntes=tes.GetEntries();
1841
1842 return ntes;
1843}
1844
1845void IceDwalk::AssociateHits(TObjArray& tes,TObjArray& hits,Int_t astype,Float_t ws,Float_t dtmin,Float_t dtmax,Float_t maxdhit,Int_t vgroup,Int_t cln,Int_t slc,Float_t& qmax)
1846{
1852
1853 const Float_t pi=acos(-1.);
1854 const Float_t c=0.299792458; // Light speed in vacuum in meters per ns
1855 const Float_t npice=1.31768387; // Phase refractive index (c/v_phase) of ice
1856 const Float_t ngice=1.35075806; // Group refractive index (c/v_group) of ice
1857 const Float_t thetac=acos(1./npice); // Cherenkov angle (in radians)
1858
1859 // Angular reduction of complement of thetac due to v_phase and v_group difference
1860 Float_t alphac=0;
1861 if (vgroup) alphac=atan((1.-npice/ngice)/sqrt(npice*npice-1.));
1862
1863 Float_t zhit;
1864 Float_t lambda=0;
1865
1866 Int_t nte=tes.GetEntries();
1867 Int_t nh=hits.GetEntries();
1868 Float_t d=0;
1869 Nc3Vector p;
1870 NcPosition rhit;
1871 Float_t thit;
1872 Nc3Vector r12;
1873 Float_t dist,t0,tgeo,tres;
1874 NcSample levers; // Statistics of the assoc. hit lever arms
1875 levers.SetStoreMode(1);// Enable median calculation
1876 NcSample hprojs; // Statistics of the assoc. hit position projections on the track w.r.t. r0
1877 hprojs.SetStoreMode(1);// Enable median calculation
1878 NcSample times; // Statistics of the time residuals of the associated hits
1879 times.SetStoreMode(1); // Enable median calculation
1880 NcSignal fit; // Storage of Q value etc... for each track candidate
1881 fit.AddNamedSlot("QTC");
1882 fit.AddNamedSlot("Nstrings");
1883 fit.AddNamedSlot("Nmods");
1884 fit.AddNamedSlot("Nhits");
1885 fit.AddNamedSlot("Nhlc");
1886 fit.AddNamedSlot("Nax");
1887 fit.AddNamedSlot("SpanL");
1888 fit.AddNamedSlot("MedianL");
1889 fit.AddNamedSlot("MeanL");
1890 fit.AddNamedSlot("SigmaL");
1891 fit.AddNamedSlot("SpreadL");
1892 fit.AddNamedSlot("ExpSpreadL");
1893 fit.AddNamedSlot("Span");
1894 fit.AddNamedSlot("Median");
1895 fit.AddNamedSlot("Mean");
1896 fit.AddNamedSlot("Sigma");
1897 fit.AddNamedSlot("Spread");
1898 fit.AddNamedSlot("ExpSpread");
1899 fit.AddNamedSlot("MedianT");
1900 fit.AddNamedSlot("MeanT");
1901 fit.AddNamedSlot("SigmaT");
1902 fit.AddNamedSlot("SpreadT");
1903 fit.AddNamedSlot("term1");
1904 fit.AddNamedSlot("term2");
1905 fit.AddNamedSlot("term3");
1906 fit.AddNamedSlot("term4");
1907 fit.AddNamedSlot("term5");
1908 Float_t nah=0; // Weighted number of associated hits
1909 Float_t nahlc=0; // Weighted number of associated HLC hits
1910 Int_t nas=0; // Number of associated strings
1911 Int_t nam=0; // Number of associated modules
1912 Float_t qtc=0; // Quality parameter for the track (candidate)
1913 Float_t nax=0; // Associated hits, mods and/or strings value to build the QTC for a certain TE
1914 Float_t frac=0;
1915 Float_t amp=0;
1916 Float_t lmin,lmax,spanl,medianl,meanl,sigmal,spreadl,expspreadl;
1917 Float_t hproj,hprojmin,hprojmax,span,median,mean,sigma,spread,expspread;
1918 Float_t mediant,meant,sigmat,spreadt;
1919 Float_t term1,term2,term3,term4,term5;
1920 qmax=0;
1921 for (Int_t jte=0; jte<nte; jte++)
1922 {
1923 NcTrack* te=(NcTrack*)tes.At(jte);
1924 if (!te) continue;
1925 NcPosition* tr0=te->GetReferencePoint();
1926 NcTimestamp* tt0=tr0->GetTimestamp();
1927 t0=fEvt->GetDifference(tt0,"ns");
1928 p=te->Get3Momentum();
1929 if (!p.HasVector() || !p.GetNorm()) continue;
1930 levers.Reset();
1931 hprojs.Reset();
1932 times.Reset();
1933 nah=0;
1934 nahlc=0;
1935 for (Int_t jh=0; jh<nh; jh++)
1936 {
1937 NcSignal* sx=(NcSignal*)hits.At(jh);
1938 if (!sx) continue;
1939
1940 if (cln && (sx->GetDeadValue("ADC") || sx->GetDeadValue("LE") || sx->GetDeadValue("TOT"))) continue;
1941 if (!slc && sx->GetSignal("SLC")>0.5) continue;
1942
1943 IceGOM* omx=(IceGOM*)sx->GetDevice();
1944 if (!omx) continue;
1945
1946 // The hit position dependent scattering length
1947 if (omx->InheritsFrom("IceAOM")) // Amanda reconstruction
1948 {
1949 lambda=fLambdaA;
1950 }
1951 else // IceCube reconstruction
1952 {
1953 lambda=fLambdaDL; // The ice at the Dust Layer
1954 zhit=omx->GetX(3,"car");
1955 if (zhit>-50) lambda=fLambdaUD; // The Ice in the Upper Detector above the dustlayer
1956 if (zhit<-150) lambda=fLambdaLD; // Clearest Ice in the Lower Detector under the dustlayer
1957 }
1958
1959 rhit=omx->GetPosition();
1960 d=te->GetDistance(rhit);
1961 r12=rhit-(*tr0);
1962 hproj=p.Dot(r12)/p.GetNorm();
1963 dist=fabs(hproj)+d/tan(pi/2.-thetac-alphac);
1964 if (hproj<0) dist=-dist;
1965 tgeo=t0+dist/c;
1966 thit=sx->GetSignal("LE",7);
1967 tres=thit-tgeo;
1968
1969 d=d/sin(thetac); // The distance traveled by a cherenkov photon
1970
1971 if (tres<dtmin || tres>dtmax || d>maxdhit*lambda) continue;
1972
1973 // Associate this hit to the TE
1974 te->AddSignal(*sx);
1975 levers.Enter(fabs(hproj));
1976 hprojs.Enter(hproj);
1977 times.Enter(tres);
1978 frac=d/lambda;
1979 if (frac<1) frac=1;
1980 if (fHitweight>=0)
1981 {
1982 nah=nah+(fHitweight/frac);
1983 if (sx->GetSignal("SLC")<0.5) nahlc=nahlc+(fHitweight/frac);
1984 }
1985 else if (fHitweight>-1.5)
1986 {
1987 nah=nah+1;
1988 if (sx->GetSignal("SLC")<0.5) nahlc=nahlc+1;
1989 }
1990 else
1991 {
1992 amp=sx->GetSignal("ADC",7);
1993 nah=nah+(amp/frac);
1994 if (sx->GetSignal("SLC")<0.5) nahlc=nahlc+(amp/frac);
1995 }
1996 }
1997
1998 // Determine the Q quality of the various TE's.
1999 // Good quality TE's will be called track candidates (TC's)
2000 nas=fEvt->GetNstrings(*te,"IceGOM");
2001 nam=fEvt->GetNmodules(*te,"IceGOM");
2002 nax=0;
2003 frac=0;
2004 if (nah>0) frac=nahlc/nah;
2005 if (nas>0 && nam>0)
2006 {
2007 if (astype==1) nax=nah;
2008 if (astype==2) nax=float(nas);
2009 if (astype==3) nax=nah*float(nas);
2010 if (astype==4) nax=nah+frac+ws*float(nas-1)/float(nas);
2011 if (astype==-1) nax=float(nam)+ws*float(nas);
2012 if (astype==-2) nax=float(nam)+nah/float(nam);
2013 if (astype==-3) nax=float(nam*nas);
2014 if (astype==-4) nax=float(nam)+frac+ws*float(nas-1)/float(nas);
2015 if (astype==-5) nax=float(nam)+nah+frac+ws*float(nas-1)/float(nas);
2016 }
2017 lmin=levers.GetMinimum(1);
2018 lmax=levers.GetMaximum(1);
2019 spanl=lmax-lmin;
2020 medianl=levers.GetMedian(1);
2021 meanl=levers.GetMean(1);
2022 sigmal=levers.GetSigma(1);
2023 spreadl=levers.GetSpread(1);
2024 // Expected spread for a flat distribution
2025 expspreadl=0;
2026 if (spanl>0) expspreadl=(0.5*pow(lmin,2)+0.5*pow(lmax,2)+pow(medianl,2)-medianl*(lmin+lmax))/spanl;
2027 hprojmin=hprojs.GetMinimum(1);
2028 hprojmax=hprojs.GetMaximum(1);
2029 span=hprojmax-hprojmin;
2030 median=hprojs.GetMedian(1);
2031 mean=hprojs.GetMean(1);
2032 sigma=hprojs.GetSigma(1);
2033 spread=hprojs.GetSpread(1);
2034 // Expected spread for a flat distribution
2035 expspread=0;
2036 if (span>0) expspread=(0.5*pow(hprojmin,2)+0.5*pow(hprojmax,2)+pow(median,2)-median*(hprojmin+hprojmax))/span;
2037 mediant=times.GetMedian(1);
2038 meant=times.GetMean(1);
2039 sigmat=times.GetSigma(1);
2040 spreadt=times.GetSpread(1);
2041
2042 term1=0;
2043 if (span>0) term1=2.*spread/span;
2044
2045 term2=0;
2046 if (spanl>0) term2=2.*spreadl/spanl;
2047
2048 term3=0;
2049 if (spread>0) term3=fabs(spread-expspread)/spread;
2050
2051 term4=0;
2052 if (spreadl>0) term4=fabs(spreadl-expspreadl)/spreadl;
2053
2054 term5=0;
2055 if (spreadt>0) term5=fabs(mediant)/spreadt;
2056
2057 qtc=nax*(term1+term2)-term3-term4-term5;
2058 if (fabs(median)>span/2.) qtc=0; // Require projected hits on both sides of r0
2059
2060 if (qtc>qmax) qmax=qtc;
2061
2062 fit.SetSignal(qtc,"QTC");
2063 fit.SetSignal(nas,"Nstrings");
2064 fit.SetSignal(nam,"Nmods");
2065 fit.SetSignal(nah,"Nhits");
2066 fit.SetSignal(nahlc,"Nhlc");
2067 fit.SetSignal(nax,"Nax");
2068 fit.SetSignal(spanl,"SpanL");
2069 fit.SetSignal(medianl,"MedianL");
2070 fit.SetSignal(meanl,"MeanL");
2071 fit.SetSignal(sigmal,"SigmaL");
2072 fit.SetSignal(spreadl,"SpreadL");
2073 fit.SetSignal(expspreadl,"ExpSpreadL");
2074 fit.SetSignal(span,"Span");
2075 fit.SetSignal(median,"Median");
2076 fit.SetSignal(mean,"Mean");
2077 fit.SetSignal(sigma,"Sigma");
2078 fit.SetSignal(spread,"Spread");
2079 fit.SetSignal(expspread,"ExpSpread");
2080 fit.SetSignal(mediant,"MedianT");
2081 fit.SetSignal(meant,"MeanT");
2082 fit.SetSignal(sigmat,"SigmaT");
2083 fit.SetSignal(spreadt,"SpreadT");
2084 fit.SetSignal(term1,"term1");
2085 fit.SetSignal(term2,"term2");
2086 fit.SetSignal(term3,"term3");
2087 fit.SetSignal(term4,"term4");
2088 fit.SetSignal(term5,"term5");
2089 te->SetFitDetails(fit);
2090 }
2091}
2092
2093void IceDwalk::SelectQvalue(TObjArray& tes,Float_t qmax)
2094{
2100
2101 Int_t nte=tes.GetEntries();
2102 Float_t qtc=0;
2103 Float_t nax=0;
2104 Nc3Vector p;
2105 for (Int_t jtc=0; jtc<nte; jtc++)
2106 {
2107 NcTrack* te=(NcTrack*)tes.At(jtc);
2108 if (!te) continue;
2109 NcSignal* sx=(NcSignal*)te->GetFitDetails();
2110 qtc=-1;
2111 nax=0;
2112 if (sx)
2113 {
2114 qtc=sx->GetSignal("QTC");
2115 nax=sx->GetSignal("Nax");
2116 }
2117
2118 if (nax<=0 || qtc<0.8*qmax)
2119 {
2120 tes.RemoveAt(jtc);
2121 delete te;
2122 }
2123 else // Set Q value as momentum to provide a weight for jet clustering
2124 {
2125 if (qtc>0)
2126 {
2127 p=te->Get3Momentum();
2128 p*=qtc;
2129 te->Set3Momentum(p);
2130 }
2131 }
2132 }
2133 tes.Compress();
2134}
2135
2136void IceDwalk::ClusterTracks(TObjArray& tes,TObjArray& jets,Float_t tangmax,Int_t tinvol,Float_t tdistmax,Float_t qmax)
2137{
2149
2150 NcSignal usd; // Storage of total Q value etc... in a jet via user data
2151 usd.AddNamedSlot("Qvalue");
2152 usd.AddNamedSlot("Ntcs");
2153 usd.AddNamedSlot("Ntcsmax");
2154 usd.AddNamedSlot("Nstrings");
2155 usd.AddNamedSlot("Nstringsmax");
2156 usd.AddNamedSlot("Nmods");
2157 usd.AddNamedSlot("Nmodsmax");
2158 usd.AddNamedSlot("Nhits");
2159 usd.AddNamedSlot("Nhitsmax");
2160 usd.AddNamedSlot("Nhitshlc");
2161 usd.AddNamedSlot("Nhitshlcmax");
2162 usd.AddNamedSlot("AvQTC");
2163 usd.AddNamedSlot("QTCmax");
2164
2165 Int_t nte=tes.GetEntries();
2166 Float_t ang=0;
2167 NcSample pos;
2168 NcSample time;
2169 Float_t vec[3],err[3];
2170 NcPosition r0;
2171 Float_t t0,dist,dist2;
2172 Int_t ntk=0; // Number of track candidates used for a jet
2173 Int_t ntkmax=0; // Maximum number of track candidates used for a jet
2174 Int_t nam=0; // Number of associated (D)OMs
2175 Int_t nammax=0; // Maximum number of associated (D)OMs
2176 Int_t nah=0; // Number of associated hits
2177 Int_t nahmax=0; // Maximum number of associated hits
2178 Int_t nahlc=0; // Number of associated HLC hits
2179 Int_t nahlcmax=0; // Maximum number of associated HLC hits
2180 Int_t nas=0; // Number of associated strings
2181 Int_t nasmax=0; // Maximum number of associated strings
2182 Float_t qtc=0;
2183 Float_t avqtc=0;
2184 TObjArray* signals=0;
2185
2186 // Loop over the various TCs to start the various jets
2187 for (Int_t jtc1=0; jtc1<nte; jtc1++)
2188 {
2189 NcTrack* te=(NcTrack*)tes.At(jtc1);
2190 if (!te) continue;
2191 NcPosition* x1=te->GetReferencePoint();
2192 if (!x1) continue;
2193 NcTimestamp* ts1=x1->GetTimestamp();
2194 if (!ts1) continue;
2195
2196 NcJet* jx=new NcJet();
2197 jx->AddTrack(te);
2198
2199 pos.Reset();
2200 time.Reset();
2201 x1->GetPosition(vec,"car");
2202 pos.Enter(vec[0],vec[1],vec[2]);
2203 t0=fEvt->GetDifference(ts1,"ns");
2204 time.Enter(t0);
2205
2206 // Look for additional TCs to be clustered into this jet
2207 for (Int_t jtc2=0; jtc2<nte; jtc2++)
2208 {
2209 if (jtc2==jtc1) continue;
2210 NcTrack* te2=(NcTrack*)tes.At(jtc2);
2211 if (!te2) continue;
2212 ang=te->GetOpeningAngle(*te2,"deg");
2213 if (ang<=tangmax)
2214 {
2215 NcPosition* x2=te2->GetReferencePoint();
2216 if (!x2) continue;
2217 NcTimestamp* ts2=x2->GetTimestamp();
2218 if (!ts2) continue;
2219 if (!tinvol)
2220 {
2221 dist=te->GetDistance(te2);
2222 }
2223 else
2224 {
2225 dist=te->GetDistance(x2);
2226 dist2=te2->GetDistance(x1);
2227 if (dist2<dist) dist=dist2;
2228 }
2229 if (dist<=tdistmax)
2230 {
2231 x2->GetPosition(vec,"car");
2232 pos.Enter(vec[0],vec[1],vec[2]);
2233 t0=fEvt->GetDifference(ts2,"ns");
2234 time.Enter(t0);
2235 jx->AddTrack(te2);
2236 }
2237 }
2238 }
2239
2240 // Set the reference point data for this jet
2241 for (Int_t j=1; j<=3; j++)
2242 {
2243 vec[j-1]=pos.GetMean(j);
2244 err[j-1]=pos.GetSigma(j);
2245 }
2246 r0.SetPosition(vec,"car");
2247 r0.SetPositionErrors(err,"car");
2249 NcTimestamp* jt0=r0.GetTimestamp();
2250 t0=time.GetMean(1);
2251 jt0->Add(0,0,(int)t0);
2252 jx->SetReferencePoint(r0);
2253
2254 // Store this jet for further processing if ntracks>1
2255 if (jx->GetNtracks() > 1 || tangmax<=0)
2256 {
2257 jets.Add(jx);
2258 ntk=jx->GetNtracks();
2259 if (ntk>ntkmax) ntkmax=ntk;
2260 nam=fEvt->GetNmodules(*jx,"IceGOM");
2261 if (nam>nammax) nammax=nam;
2262 nas=fEvt->GetNstrings(*jx,"IceGOM");
2263 if (nas>nasmax) nasmax=nas;
2264 nah=jx->GetNsignals("IceGOM",2);
2265 if (nah>nahmax) nahmax=nah;
2266 nahlc=0;
2267 signals=jx->GetSignals("IceGOM",2);
2268 if (signals)
2269 {
2270 for (Int_t is=0; is<signals->GetEntries(); is++)
2271 {
2272 NcSignal* sx=(NcSignal*)signals->At(is);
2273 if (!sx) continue;
2274 if (sx->GetSignal("SLC")<0.5) nahlc++;
2275 }
2276 }
2277 if (nahlc>nahlcmax) nahlcmax=nahlc;
2278 }
2279 else // Only keep single-track jets which have qtc=qmax
2280 {
2281 NcSignal* sx1=(NcSignal*)te->GetFitDetails();
2282 qtc=-1;
2283 if (sx1) qtc=sx1->GetSignal("QTC");
2284 if (qtc>=(qmax-1.e-10))
2285 {
2286 jets.Add(jx);
2287 ntk=jx->GetNtracks();
2288 if (ntk>ntkmax) ntkmax=ntk;
2289 nam=fEvt->GetNmodules(*jx,"IceGOM");
2290 if (nam>nammax) nammax=nam;
2291 nas=fEvt->GetNstrings(*jx,"IceGOM");
2292 if (nas>nasmax) nasmax=nas;
2293 nah=jx->GetNsignals("IceGOM",2);
2294 if (nah>nahmax) nahmax=nah;
2295 nahlc=0;
2296 signals=jx->GetSignals("IceGOM",2);
2297 if (signals)
2298 {
2299 for (Int_t is=0; is<signals->GetEntries(); is++)
2300 {
2301 NcSignal* sx=(NcSignal*)signals->At(is);
2302 if (!sx) continue;
2303 if (sx->GetSignal("SLC")<0.5) nahlc++;
2304 }
2305 }
2306 if (nahlc>nahlcmax) nahlcmax=nahlc;
2307 }
2308 else
2309 {
2310 delete jx;
2311 }
2312 }
2313 }
2314
2315 Int_t njets=jets.GetEntries();
2316 if (!njets) return;
2317
2318 // For each jet the sum of nam/nammax, nah/nahmax, nahlc/nahlcmax and (1/qmax) times the average qtc value per jet-track
2319 // will be stored as the jet energy to enable sorting on this value lateron
2320 Float_t sortval=0;
2321 for (Int_t ijet=0; ijet<njets; ijet++)
2322 {
2323 NcJet* jx=(NcJet*)jets.At(ijet);
2324 if (!jx) continue;
2325 nah=jx->GetNsignals("IceGOM",2);
2326 nas=fEvt->GetNstrings(*jx,"IceGOM");
2327 nam=fEvt->GetNmodules(*jx,"IceGOM");
2328 qtc=jx->GetMomentum();
2329 avqtc=0;
2330 ntk=jx->GetNtracks();
2331 if (ntk) avqtc=qtc/float(ntk);
2332 nahlc=0;
2333 signals=jx->GetSignals("IceGOM",2);
2334 if (signals)
2335 {
2336 for (Int_t is=0; is<signals->GetEntries(); is++)
2337 {
2338 NcSignal* sx=(NcSignal*)signals->At(is);
2339 if (!sx) continue;
2340 if (sx->GetSignal("SLC")<0.5) nahlc++;
2341 }
2342 }
2343 sortval=0;
2344 if (qmax>0) sortval=avqtc/qmax;
2345 if (nammax>0) sortval+=float(nam)/float(nammax);
2346 if (nahmax>0) sortval+=float(nah)/float(nahmax);
2347 if (nahlcmax>0) sortval+=float(nahlc)/float(nahlcmax);
2348 jx->SetScalar(sortval);
2349
2350 usd.SetSignal(sortval,"Qvalue");
2351 usd.SetSignal(ntk,"Ntcs");
2352 usd.SetSignal(ntkmax,"Ntcsmax");
2353 usd.SetSignal(nas,"Nstrings");
2354 usd.SetSignal(nasmax,"Nstringsmax");
2355 usd.SetSignal(nam,"Nmods");
2356 usd.SetSignal(nammax,"Nmodsmax");
2357 usd.SetSignal(nah,"Nhits");
2358 usd.SetSignal(nahmax,"Nhitsmax");
2359 usd.SetSignal(nahlc,"Nhitshlc");
2360 usd.SetSignal(nahlcmax,"Nhitshlcmax");
2361 usd.SetSignal(avqtc,"AvQTC");
2362 usd.SetSignal(qmax,"QTCmax");
2363 jx->SetUserData(usd);
2364 }
2365}
2366
2367void IceDwalk::MergeJets(TObjArray& jets2,Float_t jangmax,Float_t jdistmax,Int_t jinvol,Int_t jiterate,Float_t qmax)
2368{
2380
2381 NcSignal usd; // Storage of average Q value etc... in a jet via user data
2382 usd.AddNamedSlot("Qvalue");
2383 usd.AddNamedSlot("Ntcs");
2384 usd.AddNamedSlot("Ntcsmax");
2385 usd.AddNamedSlot("Nstrings");
2386 usd.AddNamedSlot("Nstringsmax");
2387 usd.AddNamedSlot("Nmods");
2388 usd.AddNamedSlot("Nmodsmax");
2389 usd.AddNamedSlot("Nhits");
2390 usd.AddNamedSlot("Nhitsmax");
2391 usd.AddNamedSlot("Nhitshlc");
2392 usd.AddNamedSlot("Nhitshlcmax");
2393 usd.AddNamedSlot("AvQTC");
2394 usd.AddNamedSlot("QTCmax");
2395
2396 Int_t njets=jets2.GetEntries();
2397 NcJet* jx1=0;
2398 NcJet* jx2=0;
2399 Int_t merged=1;
2400 Int_t ntk=0; // Number of track candidates in a jet
2401 Int_t ntkmax=0; // Maximum number of track candidates in a jet
2402 Int_t nam=0; // Number of associated (D)OMs
2403 Int_t nammax=0; // Maximum number of associated (D)OMs
2404 Int_t nah=0; // Number of associated hits
2405 Int_t nahmax=0; // Maximum number of associated hits
2406 Int_t nahlc=0; // Number of associated HLC hits
2407 Int_t nahlcmax=0; // Maximum number of associated HLC hits
2408 Int_t nas=0; // Number of associated strings
2409 Int_t nasmax=0; // Maximum number of associated strings
2410 Float_t qtc=0;
2411 Float_t avqtc=0;
2412 Float_t ang,dist,dist2,t0;
2413 NcSample pos;
2414 NcSample time;
2415 NcPosition r0;
2416 Float_t vec[3],err[3];
2417 Float_t sortval;
2418 TObjArray* signals=0;
2419 if (jangmax>=0)
2420 {
2421 while (merged)
2422 {
2423 merged=0;
2424 for (Int_t jet1=0; jet1<njets; jet1++)
2425 {
2426 jx1=(NcJet*)jets2.At(jet1);
2427 if (!jx1) continue;
2428 NcPosition* x1=jx1->GetReferencePoint();
2429 if (!x1) continue;
2430 NcTimestamp* ts1=x1->GetTimestamp();
2431 if (!ts1) continue;
2432 pos.Reset();
2433 time.Reset();
2434 x1->GetPosition(vec,"car");
2435 pos.Enter(vec[0],vec[1],vec[2]);
2436 t0=fEvt->GetDifference(ts1,"ns");
2437 time.Enter(t0);
2438 for (Int_t jet2=0; jet2<njets; jet2++)
2439 {
2440 jx2=(NcJet*)jets2.At(jet2);
2441 if (!jx2 || jet2==jet1) continue;
2442 NcPosition* x2=jx2->GetReferencePoint();
2443 if (!x2) continue;
2444 NcTimestamp* ts2=x2->GetTimestamp();
2445 if (!ts2) continue;
2446 ang=jx1->GetOpeningAngle(*jx2,"deg");
2447 if (ang<=jangmax)
2448 {
2449 if (!jinvol)
2450 {
2451 dist=jx1->GetDistance(jx2);
2452 }
2453 else
2454 {
2455 dist=jx1->GetDistance(x2);
2456 dist2=jx2->GetDistance(x1);
2457 if (dist2<dist) dist=dist2;
2458 }
2459 if (dist<=jdistmax)
2460 {
2461 x2->GetPosition(vec,"car");
2462 pos.Enter(vec[0],vec[1],vec[2]);
2463 t0=fEvt->GetDifference(ts2,"ns");
2464 time.Enter(t0);
2465 for (Int_t jtk=1; jtk<=jx2->GetNtracks(); jtk++)
2466 {
2467 NcTrack* te=jx2->GetTrack(jtk);
2468 if (!te) continue;
2469 jx1->AddTrack(te);
2470 }
2471 jets2.RemoveAt(jet2);
2472 if (jiterate) merged=1;
2473 }
2474 }
2475 } // End of jet2 loop
2476
2477 // Set the reference point data for this jet
2478 for (Int_t k=1; k<=3; k++)
2479 {
2480 vec[k-1]=pos.GetMean(k);
2481 err[k-1]=pos.GetSigma(k);
2482 }
2483 r0.SetPosition(vec,"car");
2484 r0.SetPositionErrors(err,"car");
2486 NcTimestamp* jt0=r0.GetTimestamp();
2487 t0=time.GetMean(1);
2488 jt0->Add(0,0,(int)t0);
2489 jx1->SetReferencePoint(r0);
2490
2491 ntk=jx1->GetNtracks();
2492 if (ntk>ntkmax) ntkmax=ntk;
2493 nas=fEvt->GetNstrings(*jx1,"IceGOM");
2494 if (nas>nasmax) nasmax=nas;
2495 nam=fEvt->GetNmodules(*jx1,"IceGOM");
2496 if (nam>nammax) nammax=nam;
2497 nah=jx1->GetNsignals("IceGOM",2);
2498 if (nah>nahmax) nahmax=nah;
2499 nahlc=0;
2500 signals=jx1->GetSignals("IceGOM",2);
2501 if (signals)
2502 {
2503 for (Int_t is=0; is<signals->GetEntries(); is++)
2504 {
2505 NcSignal* sx=(NcSignal*)signals->At(is);
2506 if (!sx) continue;
2507 if (sx->GetSignal("SLC")<0.5) nahlc++;
2508 }
2509 }
2510 if (nahlc>nahlcmax) nahlcmax=nahlc;
2511 } // End of jet1 loop
2512
2513 jets2.Compress();
2514
2515 // For each jet the sum of nam/nammax, nah/nahmax, nahlc/nahlcmax and (1/qmax) times the average qtc value per jet-track
2516 // will be stored as the jet energy to enable sorting on this value lateron
2517 for (Int_t jjet=0; jjet<njets; jjet++)
2518 {
2519 NcJet* jx=(NcJet*)jets2.At(jjet);
2520 if (!jx) continue;
2521 nah=jx->GetNsignals("IceGOM",2);
2522 nas=fEvt->GetNstrings(*jx,"IceGOM");
2523 nam=fEvt->GetNmodules(*jx,"IceGOM");
2524 qtc=jx->GetMomentum();
2525 avqtc=0;
2526 ntk=jx->GetNtracks();
2527 if (ntk) avqtc=qtc/float(ntk);
2528 nahlc=0;
2529 signals=jx->GetSignals("IceGOM",2);
2530 if (signals)
2531 {
2532 for (Int_t is=0; is<signals->GetEntries(); is++)
2533 {
2534 NcSignal* sx=(NcSignal*)signals->At(is);
2535 if (!sx) continue;
2536 if (sx->GetSignal("SLC")<0.5) nahlc++;
2537 }
2538 }
2539 sortval=0;
2540 if (qmax>0) sortval=avqtc/qmax;
2541 if (nammax>0) sortval+=float(nam)/float(nammax);
2542 if (nahmax>0) sortval+=float(nah)/float(nahmax);
2543 if (nahlcmax>0) sortval+=float(nahlc)/float(nahlcmax);
2544 jx->SetScalar(sortval);
2545
2546 usd.SetSignal(sortval,"Qvalue");
2547 usd.SetSignal(ntk,"Ntcs");
2548 usd.SetSignal(ntkmax,"Ntcsmax");
2549 usd.SetSignal(nas,"Nstrings");
2550 usd.SetSignal(nasmax,"Nstringsmax");
2551 usd.SetSignal(nam,"Nmods");
2552 usd.SetSignal(nammax,"Nmodsmax");
2553 usd.SetSignal(nah,"Nhits");
2554 usd.SetSignal(nahmax,"Nhitsmax");
2555 usd.SetSignal(nahlc,"Nhitshlc");
2556 usd.SetSignal(nahlcmax,"Nhitshlcmax");
2557 usd.SetSignal(avqtc,"AvQTC");
2558 usd.SetSignal(qmax,"QTCmax");
2559 jx->SetUserData(usd);
2560 }
2561
2562 // Order the jets w.r.t. decreasing quality value
2563 TObjArray* ordered=fEvt->SortJets(-2,&jets2);
2564 njets=ordered->GetEntries();
2565 jets2.Clear();
2566 for (Int_t icopy=0; icopy<njets; icopy++)
2567 {
2568 jets2.Add(ordered->At(icopy));
2569 }
2570 } // End of iterative while loop
2571 }
2572}
2573
2574Int_t IceDwalk::StoreTracks(TObjArray& jets2,Int_t minahits,Int_t minamods,Float_t jangmax,TString name,TString title,TObjArray& hits)
2575{
2591
2592 Int_t njets=jets2.GetEntries();
2593 NcTrack t;
2594 t.SetNameTitle(name.Data(),title.Data());
2595 t.SetCharge(fCharge);
2596 Nc3Vector p;
2597 Int_t nah=0;
2598 Int_t nam=0;
2599 Float_t qval=0;
2600 Float_t qcut=-1;
2601 Int_t ntk=0;
2602 for (Int_t jet=0; jet<njets; jet++)
2603 {
2604 NcJet* jx=(NcJet*)jets2.At(jet);
2605 if (!jx) continue;
2606 NcPosition* ref=jx->GetReferencePoint();
2607 if (!ref) continue;
2608
2609 // Keep only tracks with sufficient associated hits
2610 nah=jx->GetNsignals("IceGOM",2);
2611 if (nah<minahits) continue;
2612
2613 // Keep only tracks with sufficient associated (D)oms
2614 nam=fEvt->GetNmodules(*jx,"IceGOM");
2615 if (nam<minamods) continue;
2616
2617 // Keep only the tracks above a certain Qvalue threshold
2618 qval=jx->GetScalar();
2619 if (qcut<0) qcut=fQcut*qval; // The first jet has the highest Qvalue
2620 if (qval<qcut) continue;
2621
2622 // Create a new track in the event structure and retrieve its pointer
2623 fEvt->AddTrack(t);
2624 NcTrack* trk=fEvt->GetTrack(fEvt->GetNtracks());
2625 if (!trk) continue;
2626
2627 ntk++;
2628 trk->SetId(fEvt->GetNtracks(1)+1);
2629 p=jx->Get3Momentum();
2630 p/=p.GetNorm();
2631 trk->Set3Momentum(p);
2632 trk->SetReferencePoint(*ref);
2633 NcTimestamp* tt0=ref->GetTimestamp();
2634 if (tt0) trk->SetTimestamp(*tt0);
2635
2636 // Store the jet user data as track fit details
2637 NcSignal* usd=(NcSignal*)jx->GetUserData();
2638 if (usd) trk->SetFitDetails(usd);
2639
2640 // Link the associated hits to the created track
2641 for (Int_t jt=1; jt<=jx->GetNtracks(); jt++)
2642 {
2643 NcTrack* tx=jx->GetTrack(jt);
2644 if (!tx) continue;
2645 for (Int_t is=1; is<=tx->GetNsignals(); is++)
2646 {
2647 NcSignal* sx=tx->GetSignal(is);
2648 if (sx)
2649 {
2650 sx->AddTrack(*trk);
2651 if (fConditional>=6) hits.Remove(sx);
2652 }
2653 }
2654 }
2655
2656 // Check whether the track direction has to be reversed
2657 FlipTrack(trk);
2658
2659 // Only take the jet with the highest quality number
2660 // (i.e. the first jet in the list) when the user had selected
2661 // this reconstruction mode.
2662 if (jangmax<0) break;
2663 }
2664 if (fConditional>=6) hits.Compress();
2665
2666 return ntk;
2667}
2668
ClassImp(IceDwalk)
IceRecoBase derived TTask processor to perform (improved) direct walk reconstruction.
Definition IceDwalk.h:16
void SetQvalueCut(Float_t qcut)
Float_t fJangmaxIC
Definition IceDwalk.h:69
Float_t fDtminIC
Definition IceDwalk.h:51
Int_t fJinvolIC
Definition IceDwalk.h:81
Float_t fHitweight
Definition IceDwalk.h:91
Int_t fDtmargIC
Definition IceDwalk.h:41
Int_t DeepCore(TObjArray &hits)
void AssociateHits(TObjArray &tes, TObjArray &hits, Int_t astype, Float_t ws, Float_t dtmin, Float_t dtmax, Float_t maxdhit, Int_t vgroup, Int_t cln, Int_t slc, Float_t &qmax)
Int_t StoreTracks(TObjArray &jets, Int_t minahits, Int_t minamods, Float_t jangmax, TString name, TString title, TObjArray &hits)
Float_t fTdistmaxI
Definition IceDwalk.h:60
Int_t fJinvolA
Definition IceDwalk.h:79
Int_t fJiterateA
Definition IceDwalk.h:71
Int_t fAsTypeDC
Definition IceDwalk.h:86
Int_t fTinvolIC
Definition IceDwalk.h:65
Float_t fDtmaxDC
Definition IceDwalk.h:54
Float_t fTangmaxDC
Definition IceDwalk.h:58
Float_t fDminA
Definition IceDwalk.h:35
Float_t fTangmaxA
Definition IceDwalk.h:55
Int_t fJinvolDC
Definition IceDwalk.h:82
Float_t fDtmaxA
Definition IceDwalk.h:48
Float_t fMaxdhitA
Definition IceDwalk.h:43
Int_t IceCube(TObjArray &hits)
Int_t fAsTypeA
Definition IceDwalk.h:83
Float_t fMaxdhitI
Definition IceDwalk.h:44
void ClusterTracks(TObjArray &tes, TObjArray &jets, Float_t tangmax, Int_t tinvol, Float_t tdistmax, Float_t qmax)
Int_t fDtmargA
Definition IceDwalk.h:39
Int_t fTinvolA
Definition IceDwalk.h:63
Float_t fWstringA
Definition IceDwalk.h:87
Int_t fConditional
Definition IceDwalk.h:92
Int_t fAsTypeIC
Definition IceDwalk.h:85
void SetHitWeight(Float_t w)
Float_t fJangmaxDC
Definition IceDwalk.h:70
Int_t MakeTEs(Int_t cln, Int_t maxhits, Float_t dmin, Float_t dtmarg, Float_t dtmin, Float_t dtmax, TString domclass, TObjArray &tes, TObjArray &hits, Int_t gethits)
void SetTdistmax(Float_t d, TString s, Int_t invol=1)
Definition IceDwalk.cxx:731
Int_t fTinvolDC
Definition IceDwalk.h:66
Float_t fDtmaxIC
Definition IceDwalk.h:52
Float_t fJangmaxI
Definition IceDwalk.h:68
void SetDmin(Float_t d, TString s)
Definition IceDwalk.cxx:479
Float_t fMaxdhitIC
Definition IceDwalk.h:45
Float_t fTdistmaxA
Definition IceDwalk.h:59
Float_t fDtmaxI
Definition IceDwalk.h:50
Int_t InIce(TObjArray &hits)
Float_t fTdistmaxIC
Definition IceDwalk.h:61
Int_t fAsTypeI
Definition IceDwalk.h:84
Float_t fQcut
Definition IceDwalk.h:93
Float_t fJdistmaxDC
Definition IceDwalk.h:78
Int_t fTinvolI
Definition IceDwalk.h:64
void SetConditionalReco(Int_t flag)
Float_t fTangmaxIC
Definition IceDwalk.h:57
Int_t fJiterateI
Definition IceDwalk.h:72
Float_t fTangmaxI
Definition IceDwalk.h:56
Float_t fJangmaxA
Definition IceDwalk.h:67
void SetDthit(Float_t dtmin, Float_t dtmax, TString s)
Definition IceDwalk.cxx:606
Float_t fTdistmaxDC
Definition IceDwalk.h:62
void SetJdistmax(Float_t d, TString s, Int_t invol=1)
Definition IceDwalk.cxx:873
Float_t fDtminA
Definition IceDwalk.h:47
Int_t Amanda()
Float_t fJdistmaxI
Definition IceDwalk.h:76
Float_t fDminIC
Definition IceDwalk.h:37
Float_t fDtminI
Definition IceDwalk.h:49
Float_t fDtminDC
Definition IceDwalk.h:53
Float_t fJdistmaxA
Definition IceDwalk.h:75
void SetMaxDhit(Float_t d, TString s)
Definition IceDwalk.cxx:565
void SetTangmax(Float_t ang, TString s)
Definition IceDwalk.cxx:669
Float_t fJdistmaxIC
Definition IceDwalk.h:77
void SetJangmax(Float_t ang, TString s, Int_t iter=1)
Definition IceDwalk.cxx:797
IceDwalk(const char *name="IceDwalk", const char *title="Direct walk reconstruction")
Definition IceDwalk.cxx:355
Float_t fWstringIC
Definition IceDwalk.h:89
Int_t fDtmargI
Definition IceDwalk.h:40
void SetDtmarg(Int_t dt, TString s)
Definition IceDwalk.cxx:520
void SetAsType(Int_t flag, TString s, Float_t w=-1)
Definition IceDwalk.cxx:938
Int_t fJinvolI
Definition IceDwalk.h:80
Float_t fWstringI
Definition IceDwalk.h:88
Int_t fJiterateIC
Definition IceDwalk.h:73
Float_t fMaxdhitDC
Definition IceDwalk.h:46
virtual void Exec(Option_t *opt)
Float_t fDminDC
Definition IceDwalk.h:38
Float_t fDminI
Definition IceDwalk.h:36
Int_t fJiterateDC
Definition IceDwalk.h:74
virtual ~IceDwalk()
Definition IceDwalk.cxx:470
void MergeJets(TObjArray &jets, Float_t jangmax, Float_t jdistmax, Int_t jinvol, Int_t jiterate, Float_t qmax)
void SelectQvalue(TObjArray &tes, Float_t qmax)
Int_t fDtmargDC
Definition IceDwalk.h:42
Float_t fWstringDC
Definition IceDwalk.h:90
Handling of IceCube event data.
Definition IceEvent.h:20
Signal (Hit) handling of a generic IceCube Optical Module (GOM).
Definition IceGOM.h:12
Float_t fLambdaLD
Definition IceRecoBase.h:84
Int_t fMinahitsI
Definition IceRecoBase.h:69
void SetSingleHit(Int_t ndoms, TString s, Int_t ndoms1=0)
void SetScatteringLength(Float_t lambda, TString s)
IceRecoBase(const char *name="IceRecoBase", const char *title="Base class for IceCube reconstruction tasks")
Int_t fMinamodsI
Definition IceRecoBase.h:73
void SetSLChitUsage(Int_t flag, TString s)
void SetCleaned(Int_t flag, TString s)
Int_t fMinahitsIC
Definition IceRecoBase.h:70
Int_t fMinamodsA
Definition IceRecoBase.h:72
void SetVgroupUsage(Int_t flag, TString s)
Int_t fSingleIC
Definition IceRecoBase.h:61
Int_t fCleanI
Definition IceRecoBase.h:45
Int_t fCleanIC
Definition IceRecoBase.h:46
Int_t fMinahitsDC
Definition IceRecoBase.h:71
Int_t fVgroupI
Definition IceRecoBase.h:93
Int_t fVgroupDC
Definition IceRecoBase.h:95
void SetMinAmods(Int_t nmin, TString s)
Int_t fMaxmodA
Definition IceRecoBase.h:48
Int_t fCleanDC
Definition IceRecoBase.h:47
Int_t fSingle1I
Definition IceRecoBase.h:66
Int_t fSingleDC
Definition IceRecoBase.h:63
Float_t fLambdaDL
Definition IceRecoBase.h:83
Int_t fSingleI
Definition IceRecoBase.h:62
Int_t fSingle1DC
Definition IceRecoBase.h:67
void SetMinMod(Int_t nmin, TString s)
Int_t fCleanA
Definition IceRecoBase.h:44
Int_t fMaxmodIC
Definition IceRecoBase.h:50
Int_t fMaxhitsDC
Definition IceRecoBase.h:59
void SetMaxMod(Int_t nmax, TString s)
Int_t fMaxmodI
Definition IceRecoBase.h:49
Int_t fMaxhitsIC
Definition IceRecoBase.h:58
void SetMaxHits(Int_t nmax, TString s)
TString fTrackname
Definition IceRecoBase.h:96
NcDevice fParams
Float_t fCharge
Definition IceRecoBase.h:97
Int_t fSingle1A
Definition IceRecoBase.h:64
void SetMinAhits(Int_t nmin, TString s)
Int_t fMaxmodDC
Definition IceRecoBase.h:51
Int_t fVgroupA
Definition IceRecoBase.h:92
Int_t fMinamodsIC
Definition IceRecoBase.h:74
virtual void FlipTrack(NcTrack *t) const
Float_t fLambdaA
Definition IceRecoBase.h:81
Int_t fSingleA
Definition IceRecoBase.h:60
void SetFlipAngles(Float_t thetatrk, Float_t thetahits)
Int_t fSingle1IC
Definition IceRecoBase.h:65
Int_t fVgroupIC
Definition IceRecoBase.h:94
Int_t fMaxhitsA
Definition IceRecoBase.h:56
Int_t fMinamodsDC
Definition IceRecoBase.h:75
Int_t fMinahitsA
Definition IceRecoBase.h:68
Int_t fMaxhitsI
Definition IceRecoBase.h:57
IceEvent * fEvt
Definition IceRecoBase.h:43
Float_t fLambdaUD
Definition IceRecoBase.h:82
Handling of 3-vectors in various reference frames.
Definition Nc3Vector.h:15
Double_t GetX(Int_t i, TString f, TString u="rad")
Double_t Dot(Nc3Vector &q)
Int_t HasVector() const
Double_t GetNorm()
void SetScalar(Double_t v0, Double_t dv0=0)
virtual Double_t GetOpeningAngle(Nc4Vector &q, TString u="rad")
void SetUserData(NcSignal *s)
Double_t GetScalar()
NcSignal * GetUserData() const
void AddNamedSlot(TString s)
Int_t GetDeadValue(Int_t j=1) const
Signal (Hit) handling of a generic device.
Definition NcDevice.h:14
Int_t GetNhits() const
Definition NcDevice.cxx:437
NcSignal * GetHit(Int_t j) const
Definition NcDevice.cxx:489
TObjArray * SortHits(TString name, Int_t mode=-1, TObjArray *hits=0, Int_t mcal=1, Int_t deadcheck=1, TObjArray *ordered=0)
Definition NcDevice.cxx:984
Creation and investigation of a jet of particle tracks.
Definition NcJet.h:18
void SetReferencePoint(NcPosition &p)
Definition NcJet.cxx:1481
NcPosition * GetReferencePoint()
Definition NcJet.cxx:1501
Int_t GetNtracks(Int_t idmode=0, Int_t chmode=2, Int_t pcode=0)
Definition NcJet.cxx:564
NcTrack * GetTrack(Int_t i) const
Definition NcJet.cxx:751
Double_t GetDistance(NcPosition *p, Float_t scale=-1)
Definition NcJet.cxx:1703
Double_t GetMomentum(Float_t scale=-1)
Definition NcJet.cxx:659
TObjArray * GetSignals(TString classname, Int_t par=0, TObjArray *signals=0)
Definition NcJet.cxx:1897
Int_t GetNsignals(TString classname="TObject", Int_t par=0) const
Definition NcJet.cxx:1839
Nc3Vector Get3Momentum(Float_t scale=-1) const
Definition NcJet.cxx:684
void AddTrack(NcTrack &t)
Definition NcJet.cxx:313
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)
Sampling and statistics tools for various multi-dimensional data samples.
Definition NcSample.h:28
Double_t GetMinimum(Int_t i) const
Double_t GetSigma(Int_t i, Int_t model=0) const
Double_t GetMedian(Int_t i)
void Reset()
Definition NcSample.cxx:255
void Enter(Double_t x)
Definition NcSample.cxx:357
Double_t GetMean(Int_t i) const
void SetStoreMode(Int_t mode=1, Int_t nmax=0, Int_t i=0)
Double_t GetMaximum(Int_t i) const
Double_t GetSpread(Int_t i, Int_t model=0, Double_t vref=0)
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
void AddTrack(NcTrack &t, Int_t mode=1)
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
void SetCharge(Float_t q)
Definition NcTrack.cxx:444
void SetReferencePoint(NcPosition &p)
Definition NcTrack.cxx:1469
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
void AddSignal(NcSignal &s, Int_t mode=0)
Definition NcTrack.cxx:886
void Set3Momentum(Nc3Vector &p)
Definition NcTrack.cxx:401
void SetFitDetails(TObject *obj)
Definition NcTrack.cxx:1922
NcPosition * GetReferencePoint()
Definition NcTrack.cxx:1485
Nc3Vector Get3Momentum(Float_t scale=-1) const
Definition NcTrack.cxx:652
TObject * GetFitDetails()
Definition NcTrack.cxx:1962
void SetId(Int_t id)
Definition NcTrack.cxx:1772
void SetTimestamp(NcTimestamp &t)
Definition NcTrack.cxx:1973