source: branches/MarsMoreSimulationTruth/mtemp/mpisa/macros/test_findstar.C

Last change on this file was 4427, checked in by stamerra, 20 years ago
*** empty log message ***
File size: 2.3 KB
Line 
1// This macro creates a fake MCerPhotEvt container (with some clusters
2// that simulate the starfield seen by the DC currents) and then applies
3// the image cleaning and the Hillas algorithm to recognize and classify
4// the clusters.
5//
6void test_findstar();
7{
8 // Empty container and task lists
9 MParList plist;
10 MTaskList tlist;
11
12 // cout << "0" <<endl;
13 plist.AddToList(&tlist);
14
15 MCerPhotEvt *DCEvt;
16
17 MGeomCamMagic *geom;
18
19 const Int_t gsNpix = 577;
20
21 TArrayF *startpixs(gsNpix);
22 Int_t cluster[gsNpix];
23 memset(cluster,-1,gsNpix*sizeof(Int_t));
24 memset(startpixs,-1,gsNpix*sizeof(Int_t));
25
26 // fill a fake MCerPhotEvt
27
28// loop over all pixels
29
30 for (Int_t pixid = 0; pixid <gsNpix ; pixid++)
31 {
32 MCerPhotPix dcpix = DCEvt[pixid];
33
34 cout << "1" <<endl;
35 // a fake cluster:
36 dcpix->SetNumPhotons(0.);
37
38 switch (pixid)
39 {
40 case 10:
41 dcpix->SetNumPhotons(1.5);
42 case 3:
43 dcpix->SetNumPhotons(1.1);
44 case 9:
45 dcpix->SetNumPhotons(1.1);
46 case 22:
47 dcpix->SetNumPhotons(1.1);
48 case 23:
49 dcpix->SetNumPhotons(1.1);
50 case 24:
51 dcpix->SetNumPhotons(1.1);
52 case 11:
53 dcpix->SetNumPhotons(1.1);
54 };
55 }; // end loop over pixels
56
57
58 if (!(FindStartPixels(DCEvt, startpixs, geom)))
59 cout << "Error calling the FindStartPixels function!!" << endl;
60
61 return;
62};
63
64Int_t FindStartPixels(MCerPhotEvt *evt, TArrayF *startpixs, MGeomCam *geom)
65{
66 // look for all the pixels with a DC higher than the DC of neighbour pixels
67
68 // loop over all pixels
69 MCerPhotEvtIter Next(evt, kFALSE);
70
71 for (Int_t pixid=0; pixid<gsNPix; pixid++)
72 {
73 MCerPhotPix dcpix = DCEvt[pixid]; // curren pix with DC
74
75 const MGeomPix &pix = (*geom)[pixid]; // MGeomCam pixel
76
77 currDC = dcpix->GetNumPhotons(); // DC of current pixel
78
79 // look for the max DC in the neighbors pixels
80 Float_t macDC = 0;
81 for (Int_t j=0; j<pix.GetNumNeighbors()-1; j++)
82 if ( evt[pix.GetNeighbor(j)]->GetNumPhotons() > maxDC)
83 maxDC = evt[pix.GetNeighbor(j)]->GetNumPhotons();
84
85 // a starting pixel was found: it is added to the array and the pointer
86 // to the array is increased by 1
87 if ( currDC > maxDC)
88 *(startpixs++) = currDC;
89 }
90
91 return 1;
92}
93
94Int_t FindCluster(Int_t startpix, Int_t cluster, MGeomCam *geom)
95{
96 return 1;
97
98} ;
Note: See TracBrowser for help on using the repository browser.