Changeset 3141 for trunk/MagicSoft/Mars/macros
- Timestamp:
- 02/13/04 16:04:33 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/macros/readMagic.C
r2624 r3141 46 46 } 47 47 48 MHCamera display[4]; 49 50 TCanvas *c; 51 MParList *fParList; 52 MTaskList *fTaskList; 53 54 Int_t PreProcess(MParList *plist) 55 { 56 fParList = plist; 57 fTaskList = (MTaskList*)plist->FindObject("MTaskList"); 58 59 MGeomCam *geomcam = (MGeomCam*)plist->FindObject("MGeomCam"); 60 61 c = new TCanvas("Events", "Real Events", 600, 600); 62 c->SetBorderMode(0); 63 c->Divide(2,2); 64 for (int i=0; i<4; i++) 65 { 66 display[i].SetGeometry(*geomcam); 67 c->cd(i+1); 68 display[i].Draw(); 69 gPad->cd(1); 70 plist->FindObject("MHillas")->Draw(); 71 } 72 return kTRUE; 73 } 74 75 Int_t Process() 76 { 77 MReadMarsFile *read = (MReadMarsFile*)fTaskList->FindObject("MRead"); 78 MClone *clone = (MClone*)fTaskList->FindObject("MClone"); 79 MImgCleanStd *clean = (MImgCleanStd*)fTaskList->FindObject("MImgCleanStd"); 80 MGeomCam *geom = (MGeomCam*)fParList->FindObject("MGeomCam"); 81 82 cout << "Event #" << read->GetNumEntry() << ":" << endl; 83 84 display[0].SetCamContent(*(MCerPhotEvt*)clone->GetClone()); 85 display[1].SetCamContent(*(MCerPhotEvt*)fParList->FindObject("MCerPhotEvt")); 86 display[2].SetCamContent(*(MCameraData*)fParList->FindObject("MCameraData")); 87 display[3].SetCamContent(*(MCameraData*)fParList->FindObject("MCameraData")); 88 89 TArrayF lvl(2); 90 lvl[0] = clean->GetCleanLvl2(); 91 lvl[1] = clean->GetCleanLvl1(); 92 display[3].SetLevels(lvl); 93 94 for (int i=1; i<=4; i++) 95 { 96 c->GetPad(i)->GetPad(1)->Modified(); 97 c->GetPad(i)->GetPad(1)->Update(); 98 } 99 100 ((MHillas*)fParList->FindObject("MHillas"))->Print(*geom); 101 ((MHillasExt*)fParList->FindObject("MHillasExt"))->Print(*geom); 102 fParList->FindObject("MNewImagePar")->Print(); 103 104 return HandleInput(); 105 } 106 107 Int_t PostProcess() 108 { 109 delete c; 110 } 111 48 112 void readMagic(const char *fname="../Proton*.root") 49 { 50 MParList plist; 113 { 114 MParList plist; 115 MTaskList tlist; 51 116 52 MHillas hillas;53 MHillasExt hillasext;54 MNewImagePar newimgpar;55 MTaskList tlist;56 57 plist.AddToList(&hillas);58 plist.AddToList(&hillasext);59 plist.AddToList(&newimgpar);60 117 plist.AddToList(&tlist); 61 118 … … 71 128 MMcPedestalCopy pcopy; 72 129 MMcPedestalNSBAdd pnsb; 73 MCerPhot Calcncalc;130 MCerPhotAnal2 ncalc; 74 131 MBlindPixelCalc blind; 75 132 blind.SetUseInterpolation(); … … 77 134 MImgCleanStd clean; 78 135 MHillasCalc hcalc; 136 MTaskInteractive mytask; 137 138 mytask.SetPreProcess(PreProcess); 139 mytask.SetProcess(Process); 79 140 80 141 tlist.AddToList(&read); … … 89 150 tlist.AddToList(&clean); 90 151 tlist.AddToList(&hcalc); 152 tlist.AddToList(&mytask); 91 153 92 154 MEvtLoop evtloop; 93 155 evtloop.SetParList(&plist); 94 156 95 if (!evtloop. PreProcess())157 if (!evtloop.Eventloop()) 96 158 return; 97 159 98 MGeomCam *geomcam = (MGeomCam*)plist->FindObject("MGeomCam"); 99 100 MHCamera display[4]; 101 TCanvas c("Events", "Real Events", 600, 600); 102 c.SetBorderMode(0); 103 c.Divide(2,2); 104 for (int i=0; i<4; i++) 105 { 106 display[i].SetGeometry(*geomcam); 107 c.cd(i+1); 108 display[i].Draw(); 109 gPad->cd(1); 110 hillas.Draw(); 111 } 112 113 // Use this if you don't want the event to be autoscaled 114 //display.SetMinimum(0); 115 //display.SetMaximum(100); 116 117 while (tlist.Process()) 118 { 119 cout << "Event #" << read.GetNumEntry() ":" << endl; 120 121 display[0].SetCamContent(*(MCerPhotEvt*)clone.GetClone()); 122 display[1].SetCamContent(*(MCerPhotEvt*)plist.FindObject("MCerPhotEvt")); 123 display[2].SetCamContent(*(MCamEvent*)plist.FindObject("MCameraData")); 124 display[3].SetCamContent(*(MCamEvent*)plist.FindObject("MCameraData")); 125 TArrayF lvl(2); 126 lvl[0] = clean.GetCleanLvl2(); 127 lvl[1] = clean.GetCleanLvl1(); 128 display[3].SetLevels(lvl); 129 130 for (int i=1; i<=4; i++) 131 { 132 c.GetPad(i)->GetPad(1)->Modified(); 133 c.GetPad(i)->GetPad(1)->Update(); 134 } 135 136 hillas.Print(*geomcam); 137 hillasext.Print(*geomcam); 138 newimgpar.Print(); 139 140 if (!HandleInput()) 141 break; 142 } 143 144 evtloop.PostProcess(); 160 tlist.PrintStatistics(); 145 161 } 146 162
Note:
See TracChangeset
for help on using the changeset viewer.