Changeset 3957 for trunk/MagicSoft/Mars/macros/readMagic.C
- Timestamp:
- 05/04/04 15:27:25 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/macros/readMagic.C
r3682 r3957 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz 12/2000 <mailto:tbretz@ uni-sw.gwdg.de>19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 118 ! Author(s): Thomas Bretz 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de> 19 ! 20 ! Copyright: MAGIC Software Development, 2000-2004 21 21 ! 22 22 ! 23 23 \* ======================================================================== */ 24 24 25 /////////////////////////////////////////////////////////////////////////// 26 // 27 // readMagic.C 28 // =========== 29 // 30 // This is a demonstration program showing how to do particular processing 31 // on a single event basis. Here we simply display uncleand und cleand 32 // images. 33 // Therefor MInteractiveTask is used, which gives you the possibility 34 // to develop new tasks without the need of compilation. 35 // The input is a merpp raw-data file. 36 // 37 /////////////////////////////////////////////////////////////////////////// 25 38 26 39 Bool_t HandleInput() 27 40 { 41 // This must be there to get accesss to the GUI while the macro 42 // is still running! 43 28 44 TTimer timer("gSystem->ProcessEvents();", 50, kFALSE); 29 45 while (1) … … 46 62 } 47 63 64 // 65 // Setup the data-members of your 'virtual' class 66 // 48 67 MHCamera display[4]; 49 68 … … 52 71 MTaskList *fTaskList; 53 72 73 // 74 // Called like all PreProcess functions of tasks. Get the access to 75 // the containers necessary for you. 76 // 54 77 Int_t PreProcess(MParList *plist) 55 78 { 79 // Get parameter and tasklist, see Process 56 80 fParList = plist; 57 81 fTaskList = (MTaskList*)plist->FindObject("MTaskList"); 58 82 83 // Get camera geoemtry 59 84 MGeomCam *geomcam = (MGeomCam*)plist->FindObject("MGeomCam"); 60 85 86 // setup canvas and camera-histograms 61 87 c = new TCanvas("Events", "Real Events", 600, 600); 62 88 c->SetBorderMode(0); … … 73 99 } 74 100 101 // 102 // Called like all Process functions of tasks. Process a single 103 // event - here display it. 104 // 75 105 Int_t Process() 76 106 { 107 // For simplicity we search in the Process function for the 108 // objects. This is deprectaed! Store the pointers to the objects 109 // as data member and get the pointers in PreProcess. 77 110 MReadMarsFile *read = (MReadMarsFile*)fTaskList->FindObject("MRead"); 78 111 MClone *clone = (MClone*)fTaskList->FindObject("MClone"); … … 80 113 MGeomCam *geom = (MGeomCam*)fParList->FindObject("MGeomCam"); 81 114 115 // Ouput event number 82 116 cout << "Event #" << read->GetNumEntry() << ":" << endl; 83 117 118 // Fill the data into your camera-histograms 84 119 display[0].SetCamContent(*(MCerPhotEvt*)clone->GetClone()); 85 120 display[1].SetCamContent(*(MCerPhotEvt*)fParList->FindObject("MCerPhotEvt")); … … 87 122 display[3].SetCamContent(*(MCameraData*)fParList->FindObject("MCameraData")); 88 123 124 // Setup the cleaning level histogram 89 125 TArrayF lvl(2); 90 126 lvl[0] = clean->GetCleanLvl2(); … … 92 128 display[3].SetLevels(lvl); 93 129 130 // Update the display 94 131 for (int i=1; i<=4; i++) 95 132 { … … 98 135 } 99 136 137 // print the data on the console 100 138 ((MHillas*)fParList->FindObject("MHillas"))->Print(*geom); 101 139 ((MHillasExt*)fParList->FindObject("MHillasExt"))->Print(*geom); 102 140 ((MNewImagePar*)fParList->FindObject("MNewImagePar"))->Print(*geom); 103 141 142 // wait for 'return' 104 143 return HandleInput(); 105 144 } 106 145 146 // 147 // Called like all PostProcess functions of tasks. Delete 148 // instanciated objects. 149 // 107 150 Int_t PostProcess() 108 151 { … … 111 154 112 155 void readMagic(const char *fname="../Proton*.root") 113 { 156 { 157 // Setup parameter- and tasklist 114 158 MParList plist; 115 159 MTaskList tlist; … … 117 161 plist.AddToList(&tlist); 118 162 163 // setup reading task 119 164 MReadMarsFile read("Events", fname); 120 165 read.DisableAutoScheme(); 121 166 167 // setup a task making sure that all arrays are resized correctly 122 168 MGeomApply geomapl; 169 170 // Setup a print task calling TObject::Print 123 171 MPrint print1("MMcEvt"); 124 172 MPrint print2("MRawEvtHeader"); 173 // Skip them if conatainers are not found 125 174 print1.EnableSkip(); 126 175 print2.EnableSkip(); 127 176 177 // Copy MC pedestals to apropriate conatiners (if MC file) 128 178 MMcPedestalCopy pcopy; 129 179 MMcPedestalNSBAdd pnsb; 180 181 // Calculate signal and pedestal from data (use MCerPhotCalc 182 // in case of MC files) 130 183 MCerPhotAnal2 ncalc; 184 185 // Blind Pixel Treatment (deprecated, will be replaced by 186 // MBadPixel*) 131 187 MBlindPixelCalc blind; 132 188 blind.SetUseInterpolation(); 189 190 // Clone MCerPhotEvt befor eimage cleaning 133 191 MClone clone("MCerPhotEvt"); 192 193 // Setup image cleaning 134 194 MImgCleanStd clean; 195 196 // Setup calculation of Image parameters 135 197 MHillasCalc hcalc; 198 199 // Setup intercative task calling the functions defined above 136 200 MTaskInteractive mytask; 137 201 … … 139 203 mytask.SetProcess(Process); 140 204 205 // Setup your tasklist 141 206 tlist.AddToList(&read); 142 207 tlist.AddToList(&geomapl); … … 152 217 tlist.AddToList(&mytask); 153 218 219 // Run your analysis 154 220 MEvtLoop evtloop; 155 221 evtloop.SetParList(&plist); … … 158 224 return; 159 225 226 // Print statistics information about your loop 160 227 tlist.PrintStatistics(); 161 228 }
Note:
See TracChangeset
for help on using the changeset viewer.