Changeset 596 for trunk/MagicSoft/Mars
- Timestamp:
- 02/06/01 09:44:16 (24 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r587 r596 1 1 -*-*- END -*-*- 2 2 3 2000/02/06: Harald Kornmayer 4 5 * the first running version with a eventdisplay. Now we are able 6 to display an Event on the photo electron level. To do this, run 7 the macro "macros/readCT1.C" after changing the file name. 8 9 changed: 10 macros/readCT1.C 11 manalysis/MNphotEvent.cc, manalysis/MNphotEvent.h 12 analysis/MReadCT1Ascii.cc 13 mgui/MCamDisplay.cc, mgui/MCamDisplay.h 14 15 3 16 2000/01/23: Harald Kornmayer 4 17 -
trunk/MagicSoft/Mars/NEWS
r466 r596 1 1 -*-*- END -*-*- 2 2001/02/06: 3 4 * Now we are able to display events in a first version of the 5 Camera event display. To do this we must run the macro 6 "macros/readCT1.C" to read data from CT1. 7 8 2 9 2001/01/11: 3 10 … … 19 26 * Put the first version of the Mars code into the repository 20 27 28 -
trunk/MagicSoft/Mars/macros/readCT1.C
r595 r596 15 15 16 16 17 MReadCT1Ascii *readct1 = new MReadCT1Ascii("/hd10/www/Anal_MAGIC/MCCT1_99_ga20.dat") ;17 //MReadCT1Ascii *readct1 = new MReadCT1Ascii("/hd10/www/Anal_MAGIC/MCCT1_99_ga20.dat") ; 18 18 19 //MReadCT1Ascii *readct1 = new MReadCT1Ascii("/hd10/www/Anal_MAGIC/CT1_99_on1.dat") ;19 MReadCT1Ascii *readct1 = new MReadCT1Ascii("/hd10/www/Anal_MAGIC/CT1_99_on1.dat") ; 20 20 21 21 cout << readct1->PreProcess(plist) << endl ; … … 25 25 MCamDisplay display(0) ; 26 26 27 //display.SetAutoScale(kFALSE) ; 28 27 29 while ( readct1->Process() == kTRUE ) 28 30 { 29 31 cout << "Event: " << icount++ << endl ; 30 32 31 if ( icount == 3 ) 33 if ( icount == 3 ) { 32 34 phevt->Print() ; 33 35 } 36 34 37 display->Draw( phevt ) ; 38 // display->DrawError( phevt ) ; 35 39 36 40 gClient->HandleInput(); 37 if(getchar()=='e') break; 41 42 if(getchar()=='q') 43 break; 38 44 } 39 45 -
trunk/MagicSoft/Mars/manalysis/MNphotEvent.cc
r595 r596 111 111 { 112 112 return ( ( (MNphotPix *) fPixels->At(i))->GetPhotons() ) ; 113 } 114 115 Float_t MNphotEvent::GetErrorPhot(Int_t i ) 116 { 117 return ( ( (MNphotPix *) fPixels->At(i))->GetErrorPhot() ) ; 113 118 } 119 120 121 Float_t MNphotEvent::GetMinimumPhoton() 122 { 123 if ( fNbPixels <= 0 ) 124 return -5. ; 125 126 Float_t minWert ; 127 minWert = ((MNphotPix *) fPixels->At(0))->GetPhotons() ; 128 129 Float_t testWert ; 130 131 for ( Int_t i =0 ; i<fNbPixels ; i++ ) { 132 testWert = ((MNphotPix *) fPixels->At(i))->GetPhotons() ; 133 134 if ( minWert >= testWert ) 135 minWert = testWert ; 136 } 137 138 return minWert ; 139 } 140 141 Float_t MNphotEvent::GetMaximumPhoton() 142 { 143 if ( fNbPixels <= 0 ) 144 return 50. ; 145 146 Float_t maxWert ; 147 maxWert = ((MNphotPix *) fPixels->At(0))->GetPhotons() ; 148 149 Float_t testWert ; 150 151 for ( Int_t i =0 ; i<fNbPixels ; i++ ) { 152 testWert = ((MNphotPix *) fPixels->At(i))->GetPhotons() ; 153 154 if ( maxWert <= testWert ) 155 maxWert = testWert ; 156 } 157 158 return maxWert ; 159 } 160 -
trunk/MagicSoft/Mars/manalysis/MNphotEvent.h
r595 r596 74 74 Int_t GetPixelId(Int_t i ) ; 75 75 Float_t GetPhotons(Int_t i ) ; 76 Float_t GetErrorPhot(Int_t i ) ; 76 77 77 ClassDef(MNphotEvent, 1) // class for Nphotons Events 78 Float_t GetMinimumPhoton() ; 79 Float_t GetMaximumPhoton() ; 80 81 ClassDef(MNphotEvent, 1) // class for Nphotons Events 78 82 }; 79 83 -
trunk/MagicSoft/Mars/manalysis/MReadCT1Ascii.cc
r592 r596 80 80 81 81 if ( dummyF > 0.0 ) { 82 fNphot->AddPixel(i, dummyF, 0.) ;82 fNphot->AddPixel(i, dummyF, sqrt(dummyF) ) ; 83 83 } 84 84 -
trunk/MagicSoft/Mars/mgui/MCamDisplay.cc
r595 r596 3 3 #include <math.h> 4 4 #include <TClonesArray.h> 5 #include "TCanvas.h" 6 #include "TStyle.h" 5 #include <TCanvas.h> 6 #include <TStyle.h> 7 #include <TBox.h> 8 #include <TText.h> 7 9 8 10 #include "MHexagon.h" … … 17 19 { 18 20 // default constructor 19 20 21 22 // set the color palette 23 24 gStyle->SetPalette(1,0) ; 25 26 fAutoScale = kTRUE ; 27 21 28 MCamGeom *geometry = new MCamGeom( type ) ; 22 29 … … 25 32 26 33 // create the hexagons of the display 27 //28 34 29 35 TClonesArray &obj = *fPixels ; … … 35 41 geometry->GetR(i) ) ; 36 42 } 43 44 // set the range to default 45 46 fMinPhe = -2. ; 47 fMaxPhe = 50. ; 48 49 // set up the Legend 50 51 fLegend = new TClonesArray("TBox", ITEMS_LEGEND ) ; 52 TClonesArray &obj1 = *fLegend ; 53 54 fLegText = new TClonesArray("TText", ITEMS_LEGEND ) ; 55 TClonesArray &obj2 = *fLegText ; 56 57 char text[100] ; 58 59 Float_t help ; 60 61 help = 50. / ITEMS_LEGEND ; 62 63 for ( Int_t il = 0 ; il < ITEMS_LEGEND ; il++ ) 64 { 65 new ( obj1[il] ) TBox(650, il*40-500 , 700, il*40-460 ) ; 66 ( (TBox*) fLegend->At(il))->SetFillColor( GetColor ( (Float_t) help*il) ) ; 67 68 sprintf ( text, "%5.1f", (Float_t) help * il ) ; 69 new ( obj2[il] ) TText(720, il*40-480, text ) ; 70 ( (TText*) fLegText->At(il))->SetTextSize (0.025) ; 71 ( (TText*) fLegText->At(il))->SetTextAlign(12) ; 72 } 37 73 } 38 74 … … 45 81 void MCamDisplay::Init() 46 82 { 47 if ( ! gPad ) new TCanvas("display", "MAGIC display", 0, 0, 600, 500) ; 48 83 84 // Set the right colors 85 86 gStyle->SetPalette(1, 0) ; 87 88 if ( ! gPad ) new TCanvas("display", "MAGIC display", 0, 0, 650, 500) ; 89 49 90 for (Int_t i=0; i< fNbPixels; i++) 50 91 { … … 52 93 } 53 94 95 for (Int_t i=0; i< ITEMS_LEGEND; i++) 96 { 97 98 ( (TBox*) fLegend->At(i))->Draw() ; 99 100 ( (TText*) fLegText->At(i))->Draw() ; 101 } 102 54 103 } 55 104 … … 63 112 if ( ! gPad ) Init() ; 64 113 65 gPad->Range (-600, -600, 600, 600) ;114 gPad->Range (-600, -600, 900, 600) ; 66 115 gPad->SetFillColor(22) ; 67 68 gStyle->SetPalette(1, 0) ; 69 70 116 117 // 71 118 72 119 gPad->Modified() ; … … 77 124 78 125 void MCamDisplay::Draw( MNphotEvent *event) 126 { 127 128 // loop over all pixels in the MNphotEvent and 129 // determine the Pixel Id and the content 130 131 Reset() ; 132 133 // if the autoscale is true, set the values for the range for 134 // each event 135 136 if ( fAutoScale == kTRUE ) 137 { 138 fMinPhe = event->GetMinimumPhoton() ; 139 fMaxPhe = event->GetMaximumPhoton() ; 140 141 if ( fMaxPhe < 20. ) fMaxPhe = 20. ; 142 143 144 UpdateLegend() ; 145 } 146 147 148 149 cout << fMinPhe << "/" << fMaxPhe << endl ; 150 151 for (Int_t i=0 ; i<event->GetNbPixels() ; i++ ) 152 { 153 ( (MHexagon*) fPixels->At( event->GetPixelId(i) ))->SetFillColor( GetColor(event->GetPhotons(i))) ; 154 } 155 156 Draw() ; 157 158 } 159 160 void MCamDisplay::DrawError( MNphotEvent *event) 79 161 { 80 162 // … … 86 168 for (Int_t i=0 ; i<event->GetNbPixels() ; i++ ) 87 169 { 88 ( (MHexagon*) fPixels->At( event->GetPixelId(i) ))->SetFillColor( (Int_t) event->GetPhotons(i)) ;170 ( (MHexagon*) fPixels->At( event->GetPixelId(i) ))->SetFillColor( GetColor(event->GetErrorPhot(i)) ) ; 89 171 } 90 172 … … 103 185 } 104 186 105 void MCamDisplay::TestColor() 106 { 107 for ( Int_t i=0 ; i< 500 ; i++ ) 108 { 109 ( (MHexagon*) fPixels->At(i))->SetFillColor(i) ; 110 } 111 112 } 187 Int_t MCamDisplay::GetColor(Float_t wert ) 188 { 189 // Here we calculate the color index for the current value. 190 // The color index is defined with the class TStyle and the 191 // Color palette inside. We use the command gStyle->SetPalette(1,0) 192 // for the display. So we have to convert the value "wert" into 193 // a color index that fits the color palette. 194 // The range of the color palette is defined by the values fMinPhe 195 // and fMaxRange. Between this values we have 50 color index, starting 196 // with 0 up to 49. 197 // 198 199 // first treat the over- and under-flows 200 201 if ( wert >= fMaxPhe ) 202 return gStyle->GetColorPalette( 49 ) ; 203 204 if ( wert <= fMinPhe ) 205 return gStyle->GetColorPalette( 0 ) ; 206 207 // calculate the color index 208 209 Int_t ColIndex ; 210 211 ColIndex = (Int_t) wert ; 212 213 ColIndex = (Int_t) ( .5 + ( (wert-fMinPhe) * 49. / (fMaxPhe-fMinPhe) ) ) ; 214 215 return (gStyle->GetColorPalette(ColIndex) ) ; 216 217 } 218 219 220 void MCamDisplay::UpdateLegend() 221 { 222 // change the text on the legend according to the range of the 223 // Display 224 225 char text[100] ; 226 227 Float_t x, y, wert, help ; 228 229 help = 50./ITEMS_LEGEND ; 230 231 for (Int_t il=0; il < ITEMS_LEGEND; il++) 232 { 233 wert = fMinPhe + (il*help)/50 * (fMaxPhe-fMinPhe) ; 234 235 sprintf ( text, "%5.1f", wert ) ; 236 237 x = ( (TText*) fLegText->At(il))->GetX () ; 238 y = ( (TText*) fLegText->At(il))->GetY () ; 239 ( (TText*) fLegText->At(il))->SetText (x, y, text ) ; 240 } 241 242 } -
trunk/MagicSoft/Mars/mgui/MCamDisplay.h
r595 r596 6 6 #include "MAGIC.h" 7 7 8 #define ITEMS_LEGEND 25 9 8 10 class TClonesArray ; 9 11 class MNphotEvent ; … … 12 14 { 13 15 private: 16 Bool_t fAutoScale ; // indicating the autoscale function 17 14 18 Int_t fNbPixels ; // 15 19 TClonesArray *fPixels ; //! 16 20 21 Float_t fMinPhe ; // The minimal number of Phe 22 Float_t fMaxPhe ; // The maximum number of Phe 23 24 TClonesArray *fLegend ; //! 25 TClonesArray *fLegText ; //! 26 17 27 public: 18 28 … … 24 34 25 35 void Draw(Option_t *option = "" ) ; 26 36 27 37 void Draw( MNphotEvent *event) ; 38 void DrawError( MNphotEvent *event) ; 28 39 29 40 void Reset() ; 30 void TestColor() ; 41 42 Int_t GetColor( Float_t wert ) ; 43 44 void UpdateLegend() ; 45 46 void SetAutoScale (Bool_t input = kTRUE ) 47 { 48 fAutoScale = input ; 49 } 31 50 32 51 //Int_t GetNbPixels() ; 33 52 34 53 ClassDef(MCamDisplay, 1) // Base (abstract) class for a task 35 54 }; 36 55 37 56 #endif 38
Note:
See TracChangeset
for help on using the changeset viewer.