| 1 | //
|
|---|
| 2 | //
|
|---|
| 3 | //
|
|---|
| 4 | #define START_DIRECTORY "."
|
|---|
| 5 | #define S_ISDIR(m) (((m)&(0170000)) == (0040000))
|
|---|
| 6 | #define PI 3.1415926
|
|---|
| 7 |
|
|---|
| 8 | #include <TApplication.h>
|
|---|
| 9 | #include <TGMsgBox.h>
|
|---|
| 10 |
|
|---|
| 11 | #include "MainFrameSimone.hxx"
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 | char NtupName[5][20] = {"WaveLen", "PosY:PosX", "Height", "Time", "DireY:DireX" } ;
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 | MainFrameSimone::MainFrameSimone(const TGWindow *p, UInt_t w, UInt_t h)
|
|---|
| 18 | : TGMainFrame(p, w, h)
|
|---|
| 19 | {
|
|---|
| 20 | sprintf (fInputPath, "\0" ) ;
|
|---|
| 21 | fNumEvents = 0 ;
|
|---|
| 22 |
|
|---|
| 23 | fEvtNb = 0 ;
|
|---|
| 24 |
|
|---|
| 25 | //
|
|---|
| 26 | // set up the NTuples
|
|---|
| 27 | //
|
|---|
| 28 | fNtup = new TNtuple ("fNtup", "Ntuple with Run distributions",
|
|---|
| 29 | "PartID:Energy:CoreX:CoreY:Theta:Phi:FirstInt") ;
|
|---|
| 30 |
|
|---|
| 31 | fNtupEvt = new TNtuple ("fNtupEvt", "Ntuple with Event distributions",
|
|---|
| 32 | "WaveLen:PosX:PosY:Height:Time:DireX:DireY") ;
|
|---|
| 33 |
|
|---|
| 34 | //
|
|---|
| 35 | // Create a main frame with a number of different buttons.
|
|---|
| 36 | //
|
|---|
| 37 |
|
|---|
| 38 | //
|
|---|
| 39 | // First create the MenuBar.
|
|---|
| 40 | //
|
|---|
| 41 |
|
|---|
| 42 | fLayMenuBar = new TGLayoutHints ( kLHintsTop | kLHintsLeft | kLHintsExpandX,
|
|---|
| 43 | 2, 2, 2, 2 ) ;
|
|---|
| 44 | fLayMenuItem = new TGLayoutHints ( kLHintsTop | kLHintsLeft ,
|
|---|
| 45 | 0, 4, 0, 0 ) ;
|
|---|
| 46 |
|
|---|
| 47 |
|
|---|
| 48 | fFileMenu = new TGPopupMenu ( fClient->GetRoot() ) ;
|
|---|
| 49 | fFileMenu->AddEntry ("Exit", M_FILE_EXIT ) ;
|
|---|
| 50 |
|
|---|
| 51 |
|
|---|
| 52 | //
|
|---|
| 53 | // the button messages are handled by main frame (this)
|
|---|
| 54 | //
|
|---|
| 55 | fFileMenu->Associate(this) ;
|
|---|
| 56 |
|
|---|
| 57 | fMenuBar = new TGMenuBar ( this, 1, 1, kHorizontalFrame ) ;
|
|---|
| 58 | fMenuBar->AddPopup("File", fFileMenu, fLayMenuItem ) ;
|
|---|
| 59 |
|
|---|
| 60 | AddFrame(fMenuBar, fLayMenuBar ) ;
|
|---|
| 61 |
|
|---|
| 62 |
|
|---|
| 63 | //
|
|---|
| 64 | // create the Tab
|
|---|
| 65 | //
|
|---|
| 66 |
|
|---|
| 67 | fFrame = new TGCompositeFrame (this, 300,300, kHorizontalFrame ) ;
|
|---|
| 68 |
|
|---|
| 69 | fLayTab = new TGLayoutHints ( kLHintsTop | kLHintsLeft | kLHintsExpandX , 5, 5, 5, 5 ) ;
|
|---|
| 70 | fTab = new TGTab ( fFrame, 400, 400 ) ;
|
|---|
| 71 |
|
|---|
| 72 | TGCompositeFrame *tf = fTab->AddTab("Input") ;
|
|---|
| 73 | fTabF1 = new TGCompositeFrame (tf, 100, 100, kHorizontalFrame) ;
|
|---|
| 74 |
|
|---|
| 75 | tf->AddFrame(fTabF1, fLayTab ) ;
|
|---|
| 76 |
|
|---|
| 77 | fTabF1a = new TGCompositeFrame (tf, 100, 100, kHorizontalFrame) ;
|
|---|
| 78 | tf->AddFrame(fTabF1a, new TGLayoutHints ( kLHintsTop | kLHintsLeft | kLHintsExpandX, 5, 5, 5, 5 ) ) ;
|
|---|
| 79 |
|
|---|
| 80 | fTabF1b = new TGCompositeFrame (tf, 100, 100, kVerticalFrame) ;
|
|---|
| 81 | tf->AddFrame(fTabF1b, new TGLayoutHints ( kLHintsTop | kLHintsLeft | kLHintsExpandX | kLHintsExpandY , 5, 5, 5, 5 ) ) ;
|
|---|
| 82 |
|
|---|
| 83 | fDir = new TGListBox(fTabF1, -1) ;
|
|---|
| 84 | fDir->Resize(350,20) ;
|
|---|
| 85 | char temp[100] ;
|
|---|
| 86 | // sprintf ( temp, "%s", START_DIRECTORY ) ;
|
|---|
| 87 | sprintf ( temp, "%s", gSystem->WorkingDirectory() ) ;
|
|---|
| 88 | fDir->AddEntry(temp, 1) ;
|
|---|
| 89 | fTabF1->AddFrame( fDir, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 5, 5, 5, 5 ) ) ;
|
|---|
| 90 |
|
|---|
| 91 |
|
|---|
| 92 | fPicCdup = fClient->GetPicture("tb_uplevel.xpm") ;
|
|---|
| 93 | fCdup = new TGPictureButton(fTabF1, fPicCdup, M_CDIR_UP ) ;
|
|---|
| 94 | fCdup->SetToolTipText("One Level up!") ;
|
|---|
| 95 | fCdup->Associate(this) ;
|
|---|
| 96 | fTabF1->AddFrame (fCdup, new TGLayoutHints(kLHintsLeft | kLHintsTop, 5, 5, 5, 5) ) ;
|
|---|
| 97 |
|
|---|
| 98 | fPicList = fClient->GetPicture("tb_list.xpm") ;
|
|---|
| 99 | fListMode = new TGPictureButton(fTabF1, fPicList, M_LIST_MODE ) ;
|
|---|
| 100 | fListMode->SetToolTipText("List Mode") ;
|
|---|
| 101 | fListMode->Associate(this) ;
|
|---|
| 102 | fListMode->SetState(kButtonUp) ;
|
|---|
| 103 | fListMode->AllowStayDown(kTRUE) ;
|
|---|
| 104 | fTabF1->AddFrame (fListMode, new TGLayoutHints(kLHintsLeft | kLHintsTop, 5, 5, 5, 5) ) ;
|
|---|
| 105 |
|
|---|
| 106 | fPicDetail = fClient->GetPicture("tb_details.xpm") ;
|
|---|
| 107 | fDetail = new TGPictureButton(fTabF1, fPicDetail, M_DETAIL_MODE ) ;
|
|---|
| 108 | fDetail->SetToolTipText("Details Mode") ;
|
|---|
| 109 | fDetail->Associate(this) ;
|
|---|
| 110 | fDetail->SetState(kButtonEngaged) ;
|
|---|
| 111 | fDetail->AllowStayDown(kTRUE) ;
|
|---|
| 112 | fTabF1->AddFrame (fDetail, new TGLayoutHints(kLHintsLeft | kLHintsTop, 5, 5, 5, 5) ) ;
|
|---|
| 113 |
|
|---|
| 114 |
|
|---|
| 115 | fSelectButton = new TGTextButton(fTabF1b, "Select", M_BUTTON_SELECT );
|
|---|
| 116 | fSelectButton->SetToolTipText("To select a path with Mmcs data files!");
|
|---|
| 117 | fSelectButton->SetState(kButtonDisabled);
|
|---|
| 118 | fSelectButton->Associate(this) ;
|
|---|
| 119 |
|
|---|
| 120 | fTabF1b->AddFrame(fSelectButton,
|
|---|
| 121 | new TGLayoutHints(kLHintsTop | kLHintsCenterX, 5, 5, 5, 5) ) ;
|
|---|
| 122 |
|
|---|
| 123 | fFileView = new TGListView(fTabF1b, 540, 380 ) ;
|
|---|
| 124 | fFileCont = new TGFileContainer(fFileView->GetViewPort(), 100, 100,
|
|---|
| 125 | kVerticalFrame, fgWhitePixel) ;
|
|---|
| 126 |
|
|---|
| 127 | fFileCont->Associate(this) ;
|
|---|
| 128 | fFileView->GetViewPort()->SetBackgroundColor(fgWhitePixel) ;
|
|---|
| 129 | fFileView->SetContainer(fFileCont) ;
|
|---|
| 130 | fFileCont->SetFilter("*") ;
|
|---|
| 131 | // fFileCont->ChangeDirectory(START_DIRECTORY) ;
|
|---|
| 132 | fFileCont->ChangeDirectory(gSystem->WorkingDirectory()) ;
|
|---|
| 133 | fFileView->SetViewMode(kLVDetails);
|
|---|
| 134 | fFileCont->Sort(kSortByName) ;
|
|---|
| 135 |
|
|---|
| 136 | fTabF1b->AddFrame(fFileView, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 5, 5, 5, 5) ) ;
|
|---|
| 137 |
|
|---|
| 138 | //
|
|---|
| 139 | // create Tab 2
|
|---|
| 140 | //
|
|---|
| 141 |
|
|---|
| 142 | tf = fTab->AddTab("Run Dist") ;
|
|---|
| 143 | fTabF2 = new TGCompositeFrame (tf, 100, 100, kVerticalFrame) ;
|
|---|
| 144 |
|
|---|
| 145 | tf->AddFrame(fTabF2, new TGLayoutHints(kLHintsTop | kLHintsExpandX | kLHintsExpandY, 5, 5, 5, 5)) ;
|
|---|
| 146 |
|
|---|
| 147 | // create the vertical subframes
|
|---|
| 148 |
|
|---|
| 149 | fTabF2a = new TGCompositeFrame (fTabF2, 100, 100, kHorizontalFrame) ;
|
|---|
| 150 | fTabF2->AddFrame(fTabF2a, fLayTab ) ;
|
|---|
| 151 |
|
|---|
| 152 | fTabF2b = new TGCompositeFrame (fTabF2, 300, 300, kHorizontalFrame) ;
|
|---|
| 153 | fTabF2->AddFrame(fTabF2b,
|
|---|
| 154 | new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX |kLHintsExpandY, 5, 5, 5, 5 ) ) ;
|
|---|
| 155 |
|
|---|
| 156 | fTabF2c = new TGCompositeFrame (fTabF2, 100, 100, kHorizontalFrame) ;
|
|---|
| 157 | fTabF2->AddFrame(fTabF2c,new TGLayoutHints(kLHintsBottom | kLHintsLeft | kLHintsExpandX, 5, 5, 5, 5 ) ) ;
|
|---|
| 158 |
|
|---|
| 159 | // create the entries in first subframe
|
|---|
| 160 |
|
|---|
| 161 | fLabelInput = new TGLabel(fTabF2a, new TGString("Title:") );
|
|---|
| 162 | fTabF2a->AddFrame( fLabelInput, new TGLayoutHints(kLHintsTop | kLHintsLeft , 5, 5, 5, 5 ) ) ;
|
|---|
| 163 |
|
|---|
| 164 | fDir2 = new TGListBox(fTabF2a, -1) ;
|
|---|
| 165 | fDir2->Resize(350,20) ;
|
|---|
| 166 | sprintf ( temp, "%s", fInputPath ) ;
|
|---|
| 167 | fDir2->AddEntry(temp, 1) ;
|
|---|
| 168 | fTabF2a->AddFrame( fDir2, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 5, 5, 5, 5 ) ) ;
|
|---|
| 169 |
|
|---|
| 170 | fLabelNumEvts = new TGLabel(fTabF2a, new TGString("Number of Events:") );
|
|---|
| 171 | fTabF2a->AddFrame( fLabelNumEvts, new TGLayoutHints(kLHintsTop | kLHintsLeft , 5, 5, 5, 5 ) ) ;
|
|---|
| 172 |
|
|---|
| 173 | fDirNum = new TGListBox(fTabF2a, -1) ;
|
|---|
| 174 | fDirNum->Resize(50,20) ;
|
|---|
| 175 | fTabF2a->AddFrame( fDirNum,
|
|---|
| 176 | new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5 ) ) ;
|
|---|
| 177 |
|
|---|
| 178 | fButtonPrint = new TGTextButton(fTabF2a, "Print", M_BUTTON_PRINT );
|
|---|
| 179 | fButtonPrint->Associate(this) ;
|
|---|
| 180 | fTabF2a->AddFrame (fButtonPrint, new TGLayoutHints(kLHintsTop | kLHintsLeft, 50, 50, 5, 5) );
|
|---|
| 181 |
|
|---|
| 182 | // create the entries in the second subframe
|
|---|
| 183 |
|
|---|
| 184 | fCanvasRun = new TRootEmbeddedCanvas("fCanvasRun", fTabF2b, 300, 300 ) ;
|
|---|
| 185 | fTabF2b->AddFrame(fCanvasRun, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandY | kLHintsExpandX, 5, 5, 5, 5 ) ) ;
|
|---|
| 186 |
|
|---|
| 187 | // create the entries in the third subframe
|
|---|
| 188 |
|
|---|
| 189 | fButtonPartID = new TGTextButton(fTabF2c, "PartId", M_BUTTON_PARTID );
|
|---|
| 190 | fButtonPartID->Associate(this) ;
|
|---|
| 191 | fTabF2c->AddFrame (fButtonPartID, new TGLayoutHints(kLHintsBottom | kLHintsLeft, 2, 2, 2, 2) );
|
|---|
| 192 |
|
|---|
| 193 | fButtonEnergy = new TGTextButton(fTabF2c, "Energy", M_BUTTON_ENERGY );
|
|---|
| 194 | fButtonEnergy->Associate(this) ;
|
|---|
| 195 | fTabF2c->AddFrame (fButtonEnergy, new TGLayoutHints(kLHintsBottom | kLHintsLeft, 2, 2, 2, 2) );
|
|---|
| 196 |
|
|---|
| 197 | fButtonCore = new TGTextButton(fTabF2c, "Core", M_BUTTON_CORE );
|
|---|
| 198 | fButtonCore->Associate(this) ;
|
|---|
| 199 | fTabF2c->AddFrame (fButtonCore, new TGLayoutHints(kLHintsBottom | kLHintsLeft, 2, 2, 2, 2) );
|
|---|
| 200 |
|
|---|
| 201 | fButtonTheta = new TGTextButton(fTabF2c, "Theta", M_BUTTON_THETA );
|
|---|
| 202 | fButtonTheta->Associate(this) ;
|
|---|
| 203 | fTabF2c->AddFrame (fButtonTheta, new TGLayoutHints(kLHintsBottom | kLHintsLeft, 2, 2, 2, 2) );
|
|---|
| 204 |
|
|---|
| 205 | fButtonPhi = new TGTextButton(fTabF2c, " Phi ", M_BUTTON_PHI );
|
|---|
| 206 | fButtonPhi->Associate(this) ;
|
|---|
| 207 | fTabF2c->AddFrame (fButtonPhi, new TGLayoutHints(kLHintsBottom | kLHintsLeft, 2, 2, 2, 2) );
|
|---|
| 208 |
|
|---|
| 209 | fButtonFirst = new TGTextButton(fTabF2c, "FirstInt", M_BUTTON_FIRSTINT );
|
|---|
| 210 | fButtonFirst->Associate(this) ;
|
|---|
| 211 | fTabF2c->AddFrame (fButtonFirst, new TGLayoutHints(kLHintsBottom | kLHintsLeft, 2, 2, 2, 2) );
|
|---|
| 212 |
|
|---|
| 213 | //
|
|---|
| 214 | // create Tab 3
|
|---|
| 215 | //
|
|---|
| 216 |
|
|---|
| 217 | tf = fTab->AddTab("Event Dist") ;
|
|---|
| 218 | fTabF3 = new TGCompositeFrame (tf, 100, 100, kVerticalFrame) ;
|
|---|
| 219 |
|
|---|
| 220 | tf->AddFrame(fTabF3, new TGLayoutHints(kLHintsTop | kLHintsExpandX | kLHintsExpandY, 5, 5, 5, 5)) ;
|
|---|
| 221 |
|
|---|
| 222 |
|
|---|
| 223 | // create the vertical subframes
|
|---|
| 224 |
|
|---|
| 225 | fTabF3a = new TGCompositeFrame (fTabF3, 100, 100, kHorizontalFrame) ;
|
|---|
| 226 | fTabF3->AddFrame(fTabF3a, fLayTab ) ;
|
|---|
| 227 |
|
|---|
| 228 | fTabF3b = new TGCompositeFrame (fTabF3, 300, 300, kHorizontalFrame) ;
|
|---|
| 229 | fTabF3->AddFrame(fTabF3b,
|
|---|
| 230 | new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX |kLHintsExpandY, 5, 5, 5, 5 ) ) ;
|
|---|
| 231 |
|
|---|
| 232 | fTabF3c = new TGCompositeFrame (fTabF3, 100, 100, kHorizontalFrame) ;
|
|---|
| 233 | fTabF3->AddFrame(fTabF3c,new TGLayoutHints(kLHintsBottom | kLHintsLeft | kLHintsExpandX, 5, 5, 5, 5 ) ) ;
|
|---|
| 234 |
|
|---|
| 235 | // create the entries in first subframe
|
|---|
| 236 |
|
|---|
| 237 | fLabel3 = new TGLabel(fTabF3a, new TGString("Input:") );
|
|---|
| 238 | fTabF3a->AddFrame( fLabel3, new TGLayoutHints(kLHintsTop | kLHintsLeft , 5, 5, 5, 5 ) ) ;
|
|---|
| 239 |
|
|---|
| 240 | fDir3 = new TGListBox(fTabF3a, -1) ;
|
|---|
| 241 | fDir3->Resize(350,20) ;
|
|---|
| 242 | sprintf ( temp, "%s", fInputPath ) ;
|
|---|
| 243 | fDir3->AddEntry(temp, 1) ;
|
|---|
| 244 | fTabF3a->AddFrame( fDir3, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 5, 5, 5, 5 ) ) ;
|
|---|
| 245 |
|
|---|
| 246 | fLabel4 = new TGLabel(fTabF3a, new TGString("EventNb:") );
|
|---|
| 247 | fTabF3a->AddFrame( fLabel4, new TGLayoutHints(kLHintsTop | kLHintsLeft , 5, 5, 5, 5 ) ) ;
|
|---|
| 248 |
|
|---|
| 249 | fDirEvtNb = new TGListBox(fTabF3a, -1) ;
|
|---|
| 250 | fDirEvtNb->Resize(50,20) ;
|
|---|
| 251 | fTabF3a->AddFrame( fDirEvtNb,
|
|---|
| 252 | new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5 ) ) ;
|
|---|
| 253 |
|
|---|
| 254 | fButtonPrev = new TGTextButton(fTabF3a, "Prev", M_BUTTON_PREV );
|
|---|
| 255 | fButtonPrev->Associate(this) ;
|
|---|
| 256 | fTabF3a->AddFrame (fButtonPrev, new TGLayoutHints(kLHintsTop | kLHintsLeft, 10, 10, 5, 5) );
|
|---|
| 257 |
|
|---|
| 258 | fButtonNext = new TGTextButton(fTabF3a, "Next", M_BUTTON_NEXT );
|
|---|
| 259 | fButtonNext->Associate(this) ;
|
|---|
| 260 | fTabF3a->AddFrame (fButtonNext, new TGLayoutHints(kLHintsTop | kLHintsLeft, 10, 10, 5, 5) );
|
|---|
| 261 |
|
|---|
| 262 |
|
|---|
| 263 | //
|
|---|
| 264 | // create the entries in the second subframe
|
|---|
| 265 | //
|
|---|
| 266 |
|
|---|
| 267 | fTabF3bI = new TGCompositeFrame (fTabF3b, 300, 300, kVerticalFrame) ;
|
|---|
| 268 | fTabF3b->AddFrame(fTabF3bI,
|
|---|
| 269 | new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandY, 5, 5, 5, 5 ) ) ;
|
|---|
| 270 |
|
|---|
| 271 |
|
|---|
| 272 | fTabF3bII = new TGCompositeFrame (fTabF3b, 300, 300, kVerticalFrame) ;
|
|---|
| 273 | fTabF3b->AddFrame(fTabF3bII,
|
|---|
| 274 | new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandY, 5, 5, 5, 5 ) ) ;
|
|---|
| 275 |
|
|---|
| 276 | fTabF3bIII = new TGCompositeFrame (fTabF3b, 300, 300, kVerticalFrame) ;
|
|---|
| 277 | fTabF3b->AddFrame(fTabF3bIII,
|
|---|
| 278 | new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 5, 5, 5, 5 ) ) ;
|
|---|
| 279 |
|
|---|
| 280 | fLabelId = new TGLabel(fTabF3bI, new TGString("PartId:") );
|
|---|
| 281 | fTabF3bI->AddFrame( fLabelId, new TGLayoutHints(kLHintsTop | kLHintsLeft , 5, 5, 11, 5 ) ) ;
|
|---|
| 282 |
|
|---|
| 283 | fLabelEner = new TGLabel(fTabF3bI, new TGString("Energy:") );
|
|---|
| 284 | fTabF3bI->AddFrame( fLabelEner, new TGLayoutHints(kLHintsTop | kLHintsLeft , 5, 5, 11, 5 ) ) ;
|
|---|
| 285 |
|
|---|
| 286 | fLabelNbPhot = new TGLabel(fTabF3bI, new TGString("NbPhot:") );
|
|---|
| 287 | fTabF3bI->AddFrame( fLabelNbPhot, new TGLayoutHints(kLHintsTop | kLHintsLeft , 5, 5, 11, 5 ) ) ;
|
|---|
| 288 |
|
|---|
| 289 | fLabelCoreX = new TGLabel(fTabF3bI, new TGString("CoreX:") );
|
|---|
| 290 | fTabF3bI->AddFrame( fLabelCoreX, new TGLayoutHints(kLHintsTop | kLHintsLeft , 5, 5, 11, 5 ) ) ;
|
|---|
| 291 |
|
|---|
| 292 | fLabelCoreY = new TGLabel(fTabF3bI, new TGString("CoreY:") );
|
|---|
| 293 | fTabF3bI->AddFrame( fLabelCoreY, new TGLayoutHints(kLHintsTop | kLHintsLeft , 5, 5, 11, 5 ) ) ;
|
|---|
| 294 |
|
|---|
| 295 | fLabelTheta = new TGLabel(fTabF3bI, new TGString("Theta:") );
|
|---|
| 296 | fTabF3bI->AddFrame( fLabelTheta, new TGLayoutHints(kLHintsTop | kLHintsLeft , 5, 5, 11, 5 ) ) ;
|
|---|
| 297 |
|
|---|
| 298 | fLabelPhi = new TGLabel(fTabF3bI, new TGString("Phi:") );
|
|---|
| 299 | fTabF3bI->AddFrame( fLabelPhi, new TGLayoutHints(kLHintsTop | kLHintsLeft , 5, 5, 11, 5 ) ) ;
|
|---|
| 300 |
|
|---|
| 301 | fLabelDireX = new TGLabel(fTabF3bI, new TGString("DireX:") );
|
|---|
| 302 | fTabF3bI->AddFrame( fLabelDireX, new TGLayoutHints(kLHintsTop | kLHintsLeft , 5, 5, 11, 5 ) ) ;
|
|---|
| 303 |
|
|---|
| 304 | fLabelDireY = new TGLabel(fTabF3bI, new TGString("DireY:") );
|
|---|
| 305 | fTabF3bI->AddFrame( fLabelDireY, new TGLayoutHints(kLHintsTop | kLHintsLeft , 5, 5, 11, 5 ) ) ;
|
|---|
| 306 |
|
|---|
| 307 |
|
|---|
| 308 | //
|
|---|
| 309 | // huschel
|
|---|
| 310 | //
|
|---|
| 311 |
|
|---|
| 312 | fInfoId = new TGTextEntry ( fTabF3bII , fTextId = new TGTextBuffer(20) ) ;
|
|---|
| 313 | fTabF3bII->AddFrame ( fInfoId, new TGLayoutHints(kLHintsTop | kLHintsLeft , 5, 5, 5, 5 ) ) ;
|
|---|
| 314 | fInfoId->Resize( 70, fInfoId->GetDefaultHeight() ) ;
|
|---|
| 315 |
|
|---|
| 316 | fInfoEner = new TGTextEntry ( fTabF3bII , fTextEner = new TGTextBuffer(20) ) ;
|
|---|
| 317 | fTabF3bII->AddFrame ( fInfoEner, new TGLayoutHints(kLHintsTop | kLHintsLeft , 5, 5, 5, 5 ) ) ;
|
|---|
| 318 | fInfoEner->Resize( 70, fInfoEner->GetDefaultHeight() ) ;
|
|---|
| 319 |
|
|---|
| 320 | fInfoNbPhot = new TGTextEntry ( fTabF3bII , fTextNbPhot = new TGTextBuffer(20) ) ;
|
|---|
| 321 | fTabF3bII->AddFrame ( fInfoNbPhot, new TGLayoutHints(kLHintsTop | kLHintsLeft , 5, 5, 5, 5 ) ) ;
|
|---|
| 322 | fInfoNbPhot->Resize( 70, fInfoNbPhot->GetDefaultHeight() ) ;
|
|---|
| 323 |
|
|---|
| 324 | fInfoCoreX = new TGTextEntry ( fTabF3bII , fTextCoreX = new TGTextBuffer(20) ) ;
|
|---|
| 325 | fTabF3bII->AddFrame ( fInfoCoreX, new TGLayoutHints(kLHintsTop | kLHintsLeft , 5, 5, 5, 5 ) ) ;
|
|---|
| 326 | fInfoCoreX->Resize( 70, fInfoCoreX->GetDefaultHeight() ) ;
|
|---|
| 327 |
|
|---|
| 328 | fInfoCoreY = new TGTextEntry ( fTabF3bII , fTextCoreY = new TGTextBuffer(20) ) ;
|
|---|
| 329 | fTabF3bII->AddFrame ( fInfoCoreY, new TGLayoutHints(kLHintsTop | kLHintsLeft , 5, 5, 5, 5 ) ) ;
|
|---|
| 330 | fInfoCoreY->Resize( 70, fInfoCoreY->GetDefaultHeight() ) ;
|
|---|
| 331 |
|
|---|
| 332 | fInfoTheta = new TGTextEntry ( fTabF3bII , fTextTheta = new TGTextBuffer(20) ) ;
|
|---|
| 333 | fTabF3bII->AddFrame ( fInfoTheta, new TGLayoutHints(kLHintsTop | kLHintsLeft , 5, 5, 5, 5 ) ) ;
|
|---|
| 334 | fInfoTheta->Resize( 70, fInfoTheta->GetDefaultHeight() ) ;
|
|---|
| 335 |
|
|---|
| 336 | fInfoPhi = new TGTextEntry ( fTabF3bII , fTextPhi = new TGTextBuffer(20) ) ;
|
|---|
| 337 | fTabF3bII->AddFrame ( fInfoPhi, new TGLayoutHints(kLHintsTop | kLHintsLeft , 5, 5, 5, 5 ) ) ;
|
|---|
| 338 | fInfoPhi->Resize( 70, fInfoPhi->GetDefaultHeight() ) ;
|
|---|
| 339 |
|
|---|
| 340 | fInfoDireX = new TGTextEntry ( fTabF3bII , fTextDireX = new TGTextBuffer(20) ) ;
|
|---|
| 341 | fTabF3bII->AddFrame ( fInfoDireX, new TGLayoutHints(kLHintsTop | kLHintsLeft , 5, 5, 5, 5 ) ) ;
|
|---|
| 342 | fInfoDireX->Resize( 70, fInfoDireX->GetDefaultHeight() ) ;
|
|---|
| 343 |
|
|---|
| 344 | fInfoDireY = new TGTextEntry ( fTabF3bII , fTextDireY = new TGTextBuffer(20) ) ;
|
|---|
| 345 | fTabF3bII->AddFrame ( fInfoDireY, new TGLayoutHints(kLHintsTop | kLHintsLeft , 5, 5, 5, 5 ) ) ;
|
|---|
| 346 | fInfoDireY->Resize( 70, fInfoDireY->GetDefaultHeight() ) ;
|
|---|
| 347 |
|
|---|
| 348 |
|
|---|
| 349 |
|
|---|
| 350 | fCanvasEvt = new TRootEmbeddedCanvas("fCanvasEvt", fTabF3bIII, 300, 300 ) ;
|
|---|
| 351 | fTabF3bIII->AddFrame(fCanvasEvt, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandY | kLHintsExpandX, 5, 5, 5, 5 ) ) ;
|
|---|
| 352 |
|
|---|
| 353 |
|
|---|
| 354 | // create the entries in the third subframe
|
|---|
| 355 |
|
|---|
| 356 | //
|
|---|
| 357 | // set up the Radio Button
|
|---|
| 358 | //
|
|---|
| 359 |
|
|---|
| 360 | fRadioEvt[0] = new TGRadioButton(fTabF3c, new TGHotString("WaveLen") , M_BUTTON_WAVELEN );
|
|---|
| 361 | fRadioEvt[1] = new TGRadioButton(fTabF3c, new TGHotString("Position"), M_BUTTON_POSIT );
|
|---|
| 362 | fRadioEvt[2] = new TGRadioButton(fTabF3c, new TGHotString("Height") , M_BUTTON_HEIGHT );
|
|---|
| 363 | fRadioEvt[3] = new TGRadioButton(fTabF3c, new TGHotString("Time") , M_BUTTON_TIME );
|
|---|
| 364 | fRadioEvt[4] = new TGRadioButton(fTabF3c, new TGHotString("Direction"),M_BUTTON_DIRE);
|
|---|
| 365 |
|
|---|
| 366 | for (Int_t i = 0; i < 5; i++ ) {
|
|---|
| 367 | fTabF3c->AddFrame(fRadioEvt[i], new TGLayoutHints(kLHintsBottom | kLHintsLeft, 2, 10, 2, 2) );
|
|---|
| 368 | fRadioEvt[i]->Associate(this);
|
|---|
| 369 | }
|
|---|
| 370 |
|
|---|
| 371 | fRadioEvt[0]->SetState(kButtonDown) ;
|
|---|
| 372 |
|
|---|
| 373 |
|
|---|
| 374 |
|
|---|
| 375 | //
|
|---|
| 376 | // create Tab 4
|
|---|
| 377 | //
|
|---|
| 378 |
|
|---|
| 379 | tf = fTab->AddTab("Control") ;
|
|---|
| 380 | fTabF4 = new TGCompositeFrame (tf, 100, 100, kVerticalFrame) ;
|
|---|
| 381 |
|
|---|
| 382 | fButton1 = new TGTextButton(fTabF4, "&Exit", M_CTRL_EXIT);
|
|---|
| 383 | fButton2 = new TGTextButton(fTabF4, "Working Directory", M_CTRL_PWD);
|
|---|
| 384 | fButton3 = new TGTextButton(fTabF4, "Input Path", M_CTRL_PATH);
|
|---|
| 385 |
|
|---|
| 386 | fButton1->Associate(this) ;
|
|---|
| 387 | fButton2->Associate(this) ;
|
|---|
| 388 | fButton3->Associate(this) ;
|
|---|
| 389 |
|
|---|
| 390 | fLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 10, 10, 10, 10);
|
|---|
| 391 |
|
|---|
| 392 | fTabF4->AddFrame (fButton1, fLayout ) ;
|
|---|
| 393 | fTabF4->AddFrame (fButton2, fLayout ) ;
|
|---|
| 394 | fTabF4->AddFrame (fButton3, fLayout ) ;
|
|---|
| 395 |
|
|---|
| 396 | tf->AddFrame(fTabF4, fLayTab) ;
|
|---|
| 397 |
|
|---|
| 398 | fFrame->AddFrame ( fTab, new TGLayoutHints(kLHintsBottom | kLHintsExpandX | kLHintsExpandY, 5, 5, 5, 5) );
|
|---|
| 399 |
|
|---|
| 400 | AddFrame(fFrame, new TGLayoutHints (kLHintsExpandX|kLHintsExpandY) ) ;
|
|---|
| 401 |
|
|---|
| 402 | //
|
|---|
| 403 | //
|
|---|
| 404 | //
|
|---|
| 405 |
|
|---|
| 406 | MapSubwindows();
|
|---|
| 407 |
|
|---|
| 408 | Layout();
|
|---|
| 409 |
|
|---|
| 410 | SetWindowName("MainSimone");
|
|---|
| 411 | SetIconName("MainSimone");
|
|---|
| 412 |
|
|---|
| 413 | MapWindow();
|
|---|
| 414 | }
|
|---|
| 415 |
|
|---|
| 416 | // ======================================================================
|
|---|
| 417 | // ======================================================================
|
|---|
| 418 |
|
|---|
| 419 | MainFrameSimone::~MainFrameSimone() {
|
|---|
| 420 |
|
|---|
| 421 | // first delete all entries in the tab frames
|
|---|
| 422 |
|
|---|
| 423 | // Tab 1
|
|---|
| 424 |
|
|---|
| 425 | delete fFileView, fFileCont ;
|
|---|
| 426 | delete fCdup, fListMode, fDetail ;
|
|---|
| 427 | delete fDir, fSelectButton ;
|
|---|
| 428 | delete fTabF1a, fTabF1b ;
|
|---|
| 429 |
|
|---|
| 430 | // Tab 2
|
|---|
| 431 |
|
|---|
| 432 | delete fButtonTheta, fButtonPhi, fButtonFirst;
|
|---|
| 433 | delete fButtonPartID, fButtonEnergy, fButtonCore;
|
|---|
| 434 | delete fCanvasRun ;
|
|---|
| 435 | delete fButtonPrint ;
|
|---|
| 436 | delete fDir2, fDirNum ;
|
|---|
| 437 | delete fLabelInput, fLabelNumEvts ;
|
|---|
| 438 | delete fTabF2a, fTabF2b, fTabF2c ;
|
|---|
| 439 |
|
|---|
| 440 | // Tab 3
|
|---|
| 441 |
|
|---|
| 442 | delete fRadioEvt[0], fRadioEvt[1], fRadioEvt[2], fRadioEvt[3], fRadioEvt[4];
|
|---|
| 443 | delete fButtonPrev, fButtonNext ;
|
|---|
| 444 | delete fCanvasEvt;
|
|---|
| 445 | delete fLabelTheta, fLabelPhi, fLabelDireX, fLabelDireY ;
|
|---|
| 446 | delete fLabelCoreX, fLabelCoreY ;
|
|---|
| 447 | delete fLabelNbPhot ;
|
|---|
| 448 | delete fLabelId, fLabelEner ;
|
|---|
| 449 | delete fDir3, fDirEvtNb ;
|
|---|
| 450 | delete fLabel3, fLabel4;
|
|---|
| 451 | delete fTabF3bI, fTabF3bII, fTabF3bIII ;
|
|---|
| 452 | delete fTabF3a, fTabF3b, fTabF3c ;
|
|---|
| 453 |
|
|---|
| 454 | // Tab4
|
|---|
| 455 |
|
|---|
| 456 | delete fButton1 ;
|
|---|
| 457 | delete fButton2 ;
|
|---|
| 458 | delete fButton3 ;
|
|---|
| 459 | delete fFrame, fTab, fTabF1, fTabF2, fTabF4 ;
|
|---|
| 460 |
|
|---|
| 461 |
|
|---|
| 462 | // then delete the rest of the main frame
|
|---|
| 463 |
|
|---|
| 464 | delete fFileMenu, fMenuBar;
|
|---|
| 465 | delete fTabF1, fTabF2, fTabF3, fTabF4 ;
|
|---|
| 466 | delete fFrame, fTab;
|
|---|
| 467 |
|
|---|
| 468 | delete fLayout, fLayMenuBar, fLayMenuItem, fLayTab ;
|
|---|
| 469 |
|
|---|
| 470 | delete fPicCdup, fPicList, fPicDetail ;
|
|---|
| 471 |
|
|---|
| 472 |
|
|---|
| 473 | delete fNtup, fNtupEvt ;
|
|---|
| 474 |
|
|---|
| 475 |
|
|---|
| 476 | }
|
|---|
| 477 |
|
|---|
| 478 | // ======================================================================
|
|---|
| 479 | // ======================================================================
|
|---|
| 480 |
|
|---|
| 481 | void MainFrameSimone::CloseWindow()
|
|---|
| 482 | {
|
|---|
| 483 | // Got close message for this MainFrame. Calls parent CloseWindow()
|
|---|
| 484 | // (which destroys the window) and terminate the application.
|
|---|
| 485 | // The close message is generated by the window manager when its close
|
|---|
| 486 | // window menu item is selected.
|
|---|
| 487 |
|
|---|
| 488 | TGMainFrame::CloseWindow();
|
|---|
| 489 | gROOT->GetApplication()->Terminate(0) ;
|
|---|
| 490 |
|
|---|
| 491 | }
|
|---|
| 492 |
|
|---|
| 493 | // ======================================================================
|
|---|
| 494 | // ======================================================================
|
|---|
| 495 |
|
|---|
| 496 | Bool_t MainFrameSimone::CerFileExist(Char_t *dir)
|
|---|
| 497 | {
|
|---|
| 498 | Char_t testfile[110] ;
|
|---|
| 499 | FILE *unit ;
|
|---|
| 500 |
|
|---|
| 501 | sprintf (testfile, "%s/%s/cer000001",
|
|---|
| 502 | gSystem->WorkingDirectory(), dir ) ;
|
|---|
| 503 | //
|
|---|
| 504 | // try to open the testfile
|
|---|
| 505 | //
|
|---|
| 506 |
|
|---|
| 507 | if ( (unit = fopen (testfile, "r" )) == 0 ) {
|
|---|
| 508 | //
|
|---|
| 509 | // doesn't exist --> kFALSE
|
|---|
| 510 | return (kFALSE) ;
|
|---|
| 511 | }
|
|---|
| 512 | else {
|
|---|
| 513 | fclose ( unit ) ;
|
|---|
| 514 |
|
|---|
| 515 | return ( kTRUE ) ;
|
|---|
| 516 | }
|
|---|
| 517 |
|
|---|
| 518 | }
|
|---|
| 519 |
|
|---|
| 520 | // ======================================================================
|
|---|
| 521 | // ======================================================================
|
|---|
| 522 |
|
|---|
| 523 | Bool_t MainFrameSimone::DrawRunParam (Char_t *paraName) {
|
|---|
| 524 |
|
|---|
| 525 | TCanvas *canvas = fCanvasRun->GetCanvas();
|
|---|
| 526 |
|
|---|
| 527 | canvas->cd() ;
|
|---|
| 528 |
|
|---|
| 529 | if ( CheckNtup() )
|
|---|
| 530 | {
|
|---|
| 531 | fNtup->Draw(paraName) ;
|
|---|
| 532 | canvas->Modified() ;
|
|---|
| 533 | canvas->Update() ;
|
|---|
| 534 |
|
|---|
| 535 | return(kTRUE) ;
|
|---|
| 536 | }
|
|---|
| 537 | else
|
|---|
| 538 | {
|
|---|
| 539 | canvas->Clear() ;
|
|---|
| 540 | canvas->Modified() ;
|
|---|
| 541 | canvas->Update() ;
|
|---|
| 542 | }
|
|---|
| 543 | return (kFALSE) ;
|
|---|
| 544 | }
|
|---|
| 545 |
|
|---|
| 546 |
|
|---|
| 547 | // ======================================================================
|
|---|
| 548 | // ======================================================================
|
|---|
| 549 |
|
|---|
| 550 | Bool_t MainFrameSimone::DrawEvtParam () {
|
|---|
| 551 |
|
|---|
| 552 | TCanvas *canvas = fCanvasEvt->GetCanvas();
|
|---|
| 553 |
|
|---|
| 554 | canvas->cd() ;
|
|---|
| 555 |
|
|---|
| 556 | char paraName[20] ;
|
|---|
| 557 |
|
|---|
| 558 | for ( Int_t i=0 ; i<5 ; i++ ) {
|
|---|
| 559 | if ( fRadioEvt[i]->GetState() == kButtonDown) {
|
|---|
| 560 | sprintf( paraName, "%s\0", NtupName[i] ) ;
|
|---|
| 561 | break ;
|
|---|
| 562 | }
|
|---|
| 563 | }
|
|---|
| 564 |
|
|---|
| 565 | if ( fNtupEvt->GetEntries() > 0 ) {
|
|---|
| 566 |
|
|---|
| 567 | fNtupEvt->Draw(paraName) ;
|
|---|
| 568 | canvas->Modified() ;
|
|---|
| 569 | canvas->Update() ;
|
|---|
| 570 |
|
|---|
| 571 | return(kTRUE) ;
|
|---|
| 572 | }
|
|---|
| 573 | else {
|
|---|
| 574 |
|
|---|
| 575 | canvas->Clear() ;
|
|---|
| 576 | canvas->Modified() ;
|
|---|
| 577 | canvas->Update() ;
|
|---|
| 578 |
|
|---|
| 579 | return (kFALSE) ;
|
|---|
| 580 | }
|
|---|
| 581 | }
|
|---|
| 582 |
|
|---|
| 583 | // ======================================================================
|
|---|
| 584 | // ======================================================================
|
|---|
| 585 |
|
|---|
| 586 | Bool_t MainFrameSimone::CheckNtup()
|
|---|
| 587 | {
|
|---|
| 588 | Int_t buttons = 4, retval ;
|
|---|
| 589 |
|
|---|
| 590 | if ( ! strcmp( fInputPath, "\0") ) {
|
|---|
| 591 |
|
|---|
| 592 |
|
|---|
| 593 | new TGMsgBox(fClient->GetRoot(), this,
|
|---|
| 594 | "Warning",
|
|---|
| 595 | "No Input Path specified\n Do this before!!",
|
|---|
| 596 | kMBIconExclamation, buttons, &retval);
|
|---|
| 597 |
|
|---|
| 598 | return (kFALSE) ;
|
|---|
| 599 | }
|
|---|
| 600 |
|
|---|
| 601 |
|
|---|
| 602 | if ( ! strcmp ( fInputPath, fNtupPath ) ) {
|
|---|
| 603 | return (kTRUE) ;
|
|---|
| 604 | }
|
|---|
| 605 | else {
|
|---|
| 606 |
|
|---|
| 607 | if ( ReadDataToNtup() ) {
|
|---|
| 608 | return (kTRUE) ;
|
|---|
| 609 | }
|
|---|
| 610 | }
|
|---|
| 611 |
|
|---|
| 612 | return (kFALSE) ;
|
|---|
| 613 | }
|
|---|
| 614 |
|
|---|
| 615 | // ======================================================================
|
|---|
| 616 | // ======================================================================
|
|---|
| 617 |
|
|---|
| 618 | Bool_t MainFrameSimone::ReadDataToNtup()
|
|---|
| 619 | {
|
|---|
| 620 | FILE *unit ;
|
|---|
| 621 | Char_t rootfile[256] ;
|
|---|
| 622 | Char_t cername[256] ;
|
|---|
| 623 | Char_t datname[256] ;
|
|---|
| 624 |
|
|---|
| 625 | ifstream cerfile ;
|
|---|
| 626 |
|
|---|
| 627 | COREventHeader Event ;
|
|---|
| 628 |
|
|---|
| 629 | fNtup->Reset() ;
|
|---|
| 630 |
|
|---|
| 631 | sprintf (rootfile, "%s/simone.root", fInputPath ) ;
|
|---|
| 632 |
|
|---|
| 633 | //
|
|---|
| 634 | // check if there is a file simone.root in the directory fInputPath
|
|---|
| 635 | //
|
|---|
| 636 | // if the file is there open it an read the ntuple in,
|
|---|
| 637 | // else open all cerenkov files and fill the histograms and store
|
|---|
| 638 | // the ntuple as simone.root in the directory fInputPath
|
|---|
| 639 | //
|
|---|
| 640 |
|
|---|
| 641 | if ( ( unit = fopen (rootfile, "r" )) != 0 ) {
|
|---|
| 642 | fclose (unit) ;
|
|---|
| 643 |
|
|---|
| 644 | //
|
|---|
| 645 | // open the file as a root file
|
|---|
| 646 | //
|
|---|
| 647 |
|
|---|
| 648 | TFile *hfile = new TFile ( rootfile ) ;
|
|---|
| 649 |
|
|---|
| 650 | //
|
|---|
| 651 | // connect the ntuple from the file
|
|---|
| 652 | //
|
|---|
| 653 |
|
|---|
| 654 | fNtup = (TNtuple *) hfile->Get("fNtup") ;
|
|---|
| 655 |
|
|---|
| 656 | fNtup->Read("fNtup") ;
|
|---|
| 657 |
|
|---|
| 658 | //
|
|---|
| 659 | // close the root file
|
|---|
| 660 | //
|
|---|
| 661 |
|
|---|
| 662 | //hfile->Close() ;
|
|---|
| 663 |
|
|---|
| 664 | //delete hfile ;
|
|---|
| 665 |
|
|---|
| 666 |
|
|---|
| 667 |
|
|---|
| 668 | fNumEvents = (Int_t) fNtup->GetEntries() ;
|
|---|
| 669 |
|
|---|
| 670 | sprintf ( datname, "%d", fNumEvents ) ;
|
|---|
| 671 |
|
|---|
| 672 | fDirNum->RemoveEntry(1) ;
|
|---|
| 673 | fDirNum->AddEntry(datname,1) ;
|
|---|
| 674 | fDirNum->MapSubwindows() ;
|
|---|
| 675 | fDirNum->Layout() ;
|
|---|
| 676 | }
|
|---|
| 677 | else {
|
|---|
| 678 | //
|
|---|
| 679 | // create the root file
|
|---|
| 680 | //
|
|---|
| 681 |
|
|---|
| 682 | TFile *hfile = new TFile ( rootfile, "NEW" ) ;
|
|---|
| 683 |
|
|---|
| 684 |
|
|---|
| 685 | for (int i_cer = 1; i_cer <= 100000; i_cer++ ) {
|
|---|
| 686 |
|
|---|
| 687 | // inform about progress
|
|---|
| 688 |
|
|---|
| 689 | if (!( i_cer %1000) )
|
|---|
| 690 | {
|
|---|
| 691 | cout << i_cer << endl ;
|
|---|
| 692 | sprintf ( datname, "%d", fNumEvents ) ;
|
|---|
| 693 |
|
|---|
| 694 | fDirNum->RemoveEntry(1) ;
|
|---|
| 695 | fDirNum->AddEntry(datname,1) ;
|
|---|
| 696 | fDirNum->MapSubwindows() ;
|
|---|
| 697 | fDirNum->Layout() ;
|
|---|
| 698 | }
|
|---|
| 699 |
|
|---|
| 700 |
|
|---|
| 701 | // create the file names
|
|---|
| 702 |
|
|---|
| 703 | sprintf ( cername, "%s/cer%06d", fInputPath, i_cer ) ;
|
|---|
| 704 | sprintf ( datname, "%s/dat%06d", fInputPath, i_cer ) ;
|
|---|
| 705 |
|
|---|
| 706 | // try to open the files
|
|---|
| 707 |
|
|---|
| 708 | cerfile.open( cername );
|
|---|
| 709 |
|
|---|
| 710 | if ( cerfile.bad() ) {
|
|---|
| 711 |
|
|---|
| 712 | fNumEvents = i_cer -1 ;
|
|---|
| 713 |
|
|---|
| 714 | sprintf ( datname, "%d", fNumEvents ) ;
|
|---|
| 715 |
|
|---|
| 716 | fDirNum->RemoveEntry(1) ;
|
|---|
| 717 | fDirNum->AddEntry(datname,1) ;
|
|---|
| 718 | fDirNum->MapSubwindows() ;
|
|---|
| 719 | fDirNum->Layout() ;
|
|---|
| 720 |
|
|---|
| 721 | break ;
|
|---|
| 722 | }
|
|---|
| 723 |
|
|---|
| 724 | Event.read( cerfile );
|
|---|
| 725 |
|
|---|
| 726 | //
|
|---|
| 727 | // fill Ntuple
|
|---|
| 728 | //
|
|---|
| 729 |
|
|---|
| 730 | fNtup->Fill( Event.get_primary() ,
|
|---|
| 731 | Event.get_energy() ,
|
|---|
| 732 | Event.get_coreX(),
|
|---|
| 733 | Event.get_coreY(),
|
|---|
| 734 | Event.get_theta(),
|
|---|
| 735 | Event.get_phi(),
|
|---|
| 736 | Event.get_firstInt() ) ;
|
|---|
| 737 |
|
|---|
| 738 |
|
|---|
| 739 | cerfile.close();
|
|---|
| 740 |
|
|---|
| 741 | }
|
|---|
| 742 |
|
|---|
| 743 | //
|
|---|
| 744 | // write Ntuple to the file
|
|---|
| 745 | //
|
|---|
| 746 | fNtup->Write() ;
|
|---|
| 747 |
|
|---|
| 748 | //
|
|---|
| 749 | // write the root file
|
|---|
| 750 | //
|
|---|
| 751 | hfile->Write();
|
|---|
| 752 |
|
|---|
| 753 | delete hfile ;
|
|---|
| 754 | }
|
|---|
| 755 |
|
|---|
| 756 |
|
|---|
| 757 | //
|
|---|
| 758 | // set some value of this class
|
|---|
| 759 | //
|
|---|
| 760 | sprintf ( fNtupPath, "%s", fInputPath) ;
|
|---|
| 761 |
|
|---|
| 762 | return (kTRUE) ;
|
|---|
| 763 | }
|
|---|
| 764 |
|
|---|
| 765 |
|
|---|
| 766 | // ======================================================================
|
|---|
| 767 | // ======================================================================
|
|---|
| 768 |
|
|---|
| 769 | Bool_t MainFrameSimone::ReadinEvt()
|
|---|
| 770 | {
|
|---|
| 771 | Int_t buttons =4 , retval ;
|
|---|
| 772 |
|
|---|
| 773 | Char_t wort[256] ;
|
|---|
| 774 | FILE *unit ;
|
|---|
| 775 | Char_t filename[256] ;
|
|---|
| 776 |
|
|---|
| 777 | ifstream cerfile ;
|
|---|
| 778 |
|
|---|
| 779 | COREventHeader Event ;
|
|---|
| 780 | CORParticle Photon ;
|
|---|
| 781 |
|
|---|
| 782 | Int_t iPhotonInShower ;
|
|---|
| 783 | Float_t lambda ;
|
|---|
| 784 |
|
|---|
| 785 | //
|
|---|
| 786 | // check the input Path
|
|---|
| 787 | //
|
|---|
| 788 |
|
|---|
| 789 | if ( ! strcmp( fInputPath, "\0") ) {
|
|---|
| 790 |
|
|---|
| 791 | new TGMsgBox(fClient->GetRoot(), this,
|
|---|
| 792 | "Warning",
|
|---|
| 793 | "No Input Path specified\n Do this before!!",
|
|---|
| 794 | kMBIconExclamation, buttons, &retval);
|
|---|
| 795 |
|
|---|
| 796 | return (kFALSE) ;
|
|---|
| 797 | }
|
|---|
| 798 |
|
|---|
| 799 | if ( fEvtNb == 0 ) {
|
|---|
| 800 | printf ("Don't press the Prev Button at the first time!!\n") ;
|
|---|
| 801 | return (kFALSE) ;
|
|---|
| 802 | }
|
|---|
| 803 |
|
|---|
| 804 | sprintf ( filename, "%s/cer%06d", fInputPath, fEvtNb ) ;
|
|---|
| 805 |
|
|---|
| 806 | fNtupEvt->Reset() ;
|
|---|
| 807 |
|
|---|
| 808 | //
|
|---|
| 809 | // open the file
|
|---|
| 810 | //
|
|---|
| 811 |
|
|---|
| 812 | cerfile.open( filename );
|
|---|
| 813 |
|
|---|
| 814 | if ( cerfile.bad() ) {
|
|---|
| 815 |
|
|---|
| 816 | new TGMsgBox(fClient->GetRoot(), this,
|
|---|
| 817 | "ERROR",
|
|---|
| 818 | "Can't open the cer file!!",
|
|---|
| 819 | kMBIconExclamation, buttons, &retval);
|
|---|
| 820 |
|
|---|
| 821 | return (kFALSE) ;
|
|---|
| 822 | }
|
|---|
| 823 |
|
|---|
| 824 | //
|
|---|
| 825 | // read in the header
|
|---|
| 826 | //
|
|---|
| 827 |
|
|---|
| 828 | Event.read( cerfile );
|
|---|
| 829 |
|
|---|
| 830 |
|
|---|
| 831 | //
|
|---|
| 832 | // fill the information labels
|
|---|
| 833 | //
|
|---|
| 834 |
|
|---|
| 835 | sprintf( wort," %8.0f", Event.get_primary() ) ;
|
|---|
| 836 | fInfoId->SetText( wort ) ;
|
|---|
| 837 |
|
|---|
| 838 | sprintf( wort," %9.1f", Event.get_energy() ) ;
|
|---|
| 839 | fInfoEner->SetText( wort ) ;
|
|---|
| 840 |
|
|---|
| 841 | sprintf( wort," %9.1f", Event.get_coreX() ) ;
|
|---|
| 842 | fInfoCoreX->SetText( wort ) ;
|
|---|
| 843 |
|
|---|
| 844 | sprintf( wort," %9.1f", Event.get_coreY() ) ;
|
|---|
| 845 | fInfoCoreY->SetText( wort ) ;
|
|---|
| 846 |
|
|---|
| 847 | sprintf( wort," %9.1f", Event.get_theta()*180./PI ) ;
|
|---|
| 848 | fInfoTheta->SetText( wort ) ;
|
|---|
| 849 |
|
|---|
| 850 | sprintf( wort," %9.1f", Event.get_phi()*180./PI ) ;
|
|---|
| 851 | fInfoPhi->SetText( wort ) ;
|
|---|
| 852 |
|
|---|
| 853 | sprintf( wort," %9.3f", Event.get_direX() ) ;
|
|---|
| 854 | fInfoDireX->SetText( wort ) ;
|
|---|
| 855 |
|
|---|
| 856 | sprintf( wort," %9.3f", Event.get_direY() ) ;
|
|---|
| 857 | fInfoDireY->SetText( wort ) ;
|
|---|
| 858 |
|
|---|
| 859 | //
|
|---|
| 860 | // loop over the particles
|
|---|
| 861 | //
|
|---|
| 862 |
|
|---|
| 863 |
|
|---|
| 864 | iPhotonInShower = 0 ;
|
|---|
| 865 |
|
|---|
| 866 | while( ! (cerfile.eof() || cerfile.bad() )) {
|
|---|
| 867 |
|
|---|
| 868 | //
|
|---|
| 869 | // read in the particles
|
|---|
| 870 | //
|
|---|
| 871 |
|
|---|
| 872 | Photon.read ( cerfile ) ;
|
|---|
| 873 | //
|
|---|
| 874 | // only if the wavelength lambda is greater than
|
|---|
| 875 | // 1.0 it is a real cerenkov photon
|
|---|
| 876 | //
|
|---|
| 877 |
|
|---|
| 878 | lambda = Photon.get_wl() ;
|
|---|
| 879 |
|
|---|
| 880 | if ( lambda < 1.0 )
|
|---|
| 881 | break ;
|
|---|
| 882 |
|
|---|
| 883 | iPhotonInShower++ ;
|
|---|
| 884 |
|
|---|
| 885 | fNtupEvt->Fill(Photon.get_wl(),
|
|---|
| 886 | Photon.get_x(),
|
|---|
| 887 | Photon.get_y(),
|
|---|
| 888 | Photon.get_h(),
|
|---|
| 889 | Photon.get_t(),
|
|---|
| 890 | Photon.get_u(),
|
|---|
| 891 | Photon.get_v() ) ;
|
|---|
| 892 |
|
|---|
| 893 | }
|
|---|
| 894 |
|
|---|
| 895 |
|
|---|
| 896 | //
|
|---|
| 897 | // close the file
|
|---|
| 898 | //
|
|---|
| 899 |
|
|---|
| 900 | cerfile.close();
|
|---|
| 901 |
|
|---|
| 902 | sprintf( wort," %10d", iPhotonInShower ) ;
|
|---|
| 903 | fInfoNbPhot->SetText( wort ) ;
|
|---|
| 904 |
|
|---|
| 905 | return (kTRUE) ;
|
|---|
| 906 |
|
|---|
| 907 | }
|
|---|
| 908 | // ======================================================================
|
|---|
| 909 | // ======================================================================
|
|---|
| 910 |
|
|---|
| 911 | Bool_t MainFrameSimone::ProcessMessage(Long_t msg, Long_t parm1, Long_t)
|
|---|
| 912 | {
|
|---|
| 913 | Int_t buttons = 4, retval = 0 ;
|
|---|
| 914 | Char_t wort[100] ;
|
|---|
| 915 | Char_t wort2[10] ;
|
|---|
| 916 | Char_t testfile[100] ;
|
|---|
| 917 | Char_t extens[5] ;
|
|---|
| 918 | Char_t command[110] ;
|
|---|
| 919 |
|
|---|
| 920 | TGFileItem *item ; // to process items in the file view container
|
|---|
| 921 | void *np = NULL ; // null pointer
|
|---|
| 922 |
|
|---|
| 923 | TCanvas *canvas = fCanvasRun->GetCanvas();
|
|---|
| 924 |
|
|---|
| 925 | // Process events generated by the buttons in the frame.
|
|---|
| 926 |
|
|---|
| 927 | switch (GET_MSG(msg)) {
|
|---|
| 928 | case kC_COMMAND:
|
|---|
| 929 | switch (GET_SUBMSG(msg)) {
|
|---|
| 930 | case kCM_BUTTON:
|
|---|
| 931 |
|
|---|
| 932 | switch (parm1) {
|
|---|
| 933 | case M_CDIR_UP :
|
|---|
| 934 | sprintf ( fInputPath, "\0") ;
|
|---|
| 935 | fSelectButton->SetState(kButtonDisabled) ;
|
|---|
| 936 |
|
|---|
| 937 | fDir2->RemoveEntry(1) ;
|
|---|
| 938 | fDir2->AddEntry(fInputPath,1) ;
|
|---|
| 939 | fDir2->MapSubwindows() ;
|
|---|
| 940 | fDir2->Layout() ;
|
|---|
| 941 |
|
|---|
| 942 | fDir3->RemoveEntry(1) ;
|
|---|
| 943 | fDir3->AddEntry(fInputPath,1) ;
|
|---|
| 944 | fDir3->MapSubwindows() ;
|
|---|
| 945 | fDir3->Layout() ;
|
|---|
| 946 |
|
|---|
| 947 |
|
|---|
| 948 | sprintf (wort2, "\0" ) ;
|
|---|
| 949 | fDirEvtNb->RemoveEntry(1) ;
|
|---|
| 950 | fDirEvtNb->AddEntry( wort2, 1 ) ;
|
|---|
| 951 | fDirEvtNb->MapSubwindows() ;
|
|---|
| 952 | fDirEvtNb->Layout() ;
|
|---|
| 953 |
|
|---|
| 954 |
|
|---|
| 955 |
|
|---|
| 956 | //
|
|---|
| 957 | // goto the parent directory
|
|---|
| 958 | //
|
|---|
| 959 | gSystem->ChangeDirectory("..") ;
|
|---|
| 960 | fDir->RemoveEntry(1) ;
|
|---|
| 961 | sprintf (wort, "%s", gSystem->WorkingDirectory() ) ;
|
|---|
| 962 | fDir->AddEntry(wort,1) ;
|
|---|
| 963 | fDir->MapSubwindows() ;
|
|---|
| 964 | fDir->Layout() ;
|
|---|
| 965 | fFileCont->ChangeDirectory( wort ) ;
|
|---|
| 966 | fFileCont->DisplayDirectory() ;
|
|---|
| 967 |
|
|---|
| 968 | break ;
|
|---|
| 969 |
|
|---|
| 970 | case M_LIST_MODE:
|
|---|
| 971 | fFileView->SetViewMode(kLVList) ;
|
|---|
| 972 | fDetail->SetState(kButtonUp) ;
|
|---|
| 973 | break ;
|
|---|
| 974 |
|
|---|
| 975 | case M_DETAIL_MODE:
|
|---|
| 976 | fFileView->SetViewMode(kLVDetails) ;
|
|---|
| 977 | fListMode->SetState(kButtonUp) ;
|
|---|
| 978 | break ;
|
|---|
| 979 |
|
|---|
| 980 | case M_BUTTON_SELECT:
|
|---|
| 981 |
|
|---|
| 982 | if ( fFileCont->NumSelected() == 1 ) {
|
|---|
| 983 | //
|
|---|
| 984 | // one file selected
|
|---|
| 985 | //
|
|---|
| 986 | item = (TGFileItem *) fFileCont->GetNextSelected(&np) ;
|
|---|
| 987 |
|
|---|
| 988 | if ( S_ISDIR(item->GetType()) ) { // file is directory
|
|---|
| 989 |
|
|---|
| 990 | sprintf (fInputPath, "%s/%s",
|
|---|
| 991 | gSystem->WorkingDirectory(),
|
|---|
| 992 | item->GetItemName()->GetString()) ;
|
|---|
| 993 |
|
|---|
| 994 | fDir2->RemoveEntry(1) ;
|
|---|
| 995 | fDir2->AddEntry(fInputPath,1) ;
|
|---|
| 996 | fDir2->MapSubwindows() ;
|
|---|
| 997 | fDir2->Layout() ;
|
|---|
| 998 |
|
|---|
| 999 | fDir3->RemoveEntry(1) ;
|
|---|
| 1000 | fDir3->AddEntry(fInputPath,1) ;
|
|---|
| 1001 | fDir3->MapSubwindows() ;
|
|---|
| 1002 | fDir3->Layout() ;
|
|---|
| 1003 |
|
|---|
| 1004 | fEvtNb = 0 ;
|
|---|
| 1005 | sprintf (wort2, "%d", fEvtNb ) ;
|
|---|
| 1006 | fDirEvtNb->RemoveEntry(1) ;
|
|---|
| 1007 | fDirEvtNb->AddEntry( wort2, 1 ) ;
|
|---|
| 1008 | fDirEvtNb->MapSubwindows() ;
|
|---|
| 1009 | fDirEvtNb->Layout() ;
|
|---|
| 1010 |
|
|---|
| 1011 | }
|
|---|
| 1012 | }
|
|---|
| 1013 | break;
|
|---|
| 1014 |
|
|---|
| 1015 | case M_BUTTON_PRINT:
|
|---|
| 1016 | canvas->Print("simone.ps") ;
|
|---|
| 1017 | gSystem->Exec("lpr simone.ps") ;
|
|---|
| 1018 | gSystem->Exec("rm -f simone.ps") ;
|
|---|
| 1019 | break;
|
|---|
| 1020 |
|
|---|
| 1021 | case M_BUTTON_PARTID:
|
|---|
| 1022 | DrawRunParam("PartID") ;
|
|---|
| 1023 | break ;
|
|---|
| 1024 |
|
|---|
| 1025 | case M_BUTTON_ENERGY:
|
|---|
| 1026 | DrawRunParam("log10(Energy)") ;
|
|---|
| 1027 | break;
|
|---|
| 1028 |
|
|---|
| 1029 | case M_BUTTON_CORE:
|
|---|
| 1030 | DrawRunParam("CoreY:CoreX") ;
|
|---|
| 1031 | break;
|
|---|
| 1032 |
|
|---|
| 1033 | case M_BUTTON_THETA:
|
|---|
| 1034 | DrawRunParam("Theta") ;
|
|---|
| 1035 | break;
|
|---|
| 1036 |
|
|---|
| 1037 | case M_BUTTON_PHI:
|
|---|
| 1038 | DrawRunParam("Phi") ;
|
|---|
| 1039 | break;
|
|---|
| 1040 |
|
|---|
| 1041 | case M_BUTTON_FIRSTINT:
|
|---|
| 1042 | DrawRunParam("FirstInt") ;
|
|---|
| 1043 | break;
|
|---|
| 1044 |
|
|---|
| 1045 |
|
|---|
| 1046 |
|
|---|
| 1047 | case M_BUTTON_PREV:
|
|---|
| 1048 | fEvtNb-- ;
|
|---|
| 1049 |
|
|---|
| 1050 | if (fEvtNb < 1 ) {
|
|---|
| 1051 | fEvtNb++ ;
|
|---|
| 1052 |
|
|---|
| 1053 | }
|
|---|
| 1054 |
|
|---|
| 1055 | sprintf (wort2, "%d", fEvtNb ) ;
|
|---|
| 1056 | fDirEvtNb->RemoveEntry(1) ;
|
|---|
| 1057 | fDirEvtNb->AddEntry( wort2, 1 ) ;
|
|---|
| 1058 | fDirEvtNb->MapSubwindows() ;
|
|---|
| 1059 | fDirEvtNb->Layout() ;
|
|---|
| 1060 |
|
|---|
| 1061 | ReadinEvt() ;
|
|---|
| 1062 |
|
|---|
| 1063 | DrawEvtParam() ;
|
|---|
| 1064 |
|
|---|
| 1065 | break;
|
|---|
| 1066 |
|
|---|
| 1067 |
|
|---|
| 1068 | case M_BUTTON_NEXT:
|
|---|
| 1069 | fEvtNb++ ;
|
|---|
| 1070 |
|
|---|
| 1071 | sprintf (wort2, "%d", fEvtNb ) ;
|
|---|
| 1072 | fDirEvtNb->RemoveEntry(1) ;
|
|---|
| 1073 | fDirEvtNb->AddEntry( wort2, 1 ) ;
|
|---|
| 1074 | fDirEvtNb->MapSubwindows() ;
|
|---|
| 1075 | fDirEvtNb->Layout() ;
|
|---|
| 1076 |
|
|---|
| 1077 | ReadinEvt() ;
|
|---|
| 1078 |
|
|---|
| 1079 | DrawEvtParam() ;
|
|---|
| 1080 |
|
|---|
| 1081 | break;
|
|---|
| 1082 |
|
|---|
| 1083 |
|
|---|
| 1084 |
|
|---|
| 1085 | case M_CTRL_EXIT:
|
|---|
| 1086 | CloseWindow() ;
|
|---|
| 1087 | break;
|
|---|
| 1088 |
|
|---|
| 1089 | case M_CTRL_PWD:
|
|---|
| 1090 | printf ("WorkingDirectory -> %s <- \n", gSystem->WorkingDirectory() ) ;
|
|---|
| 1091 | break ;
|
|---|
| 1092 |
|
|---|
| 1093 | case M_CTRL_PATH:
|
|---|
| 1094 | printf ("Input Path: -> %s <- \n", fInputPath ) ;
|
|---|
| 1095 | break ;
|
|---|
| 1096 | }
|
|---|
| 1097 |
|
|---|
| 1098 | break;
|
|---|
| 1099 |
|
|---|
| 1100 | case kCM_CHECKBUTTON:
|
|---|
| 1101 |
|
|---|
| 1102 | break;
|
|---|
| 1103 |
|
|---|
| 1104 | case kCM_RADIOBUTTON:
|
|---|
| 1105 | if (parm1 >= M_BUTTON_WAVELEN && parm1 <= M_BUTTON_DIRE)
|
|---|
| 1106 | {
|
|---|
| 1107 | for (Int_t i=0; i<5; ++i)
|
|---|
| 1108 | if (fRadioEvt[i]->WidgetId() != parm1)
|
|---|
| 1109 | fRadioEvt[i]->SetState(kButtonUp);
|
|---|
| 1110 | }
|
|---|
| 1111 |
|
|---|
| 1112 | DrawEvtParam() ;
|
|---|
| 1113 |
|
|---|
| 1114 | break;
|
|---|
| 1115 |
|
|---|
| 1116 |
|
|---|
| 1117 | case kCM_MENU:
|
|---|
| 1118 | switch (parm1) {
|
|---|
| 1119 | case M_FILE_EXIT:
|
|---|
| 1120 | CloseWindow() ;
|
|---|
| 1121 | break;
|
|---|
| 1122 |
|
|---|
| 1123 | }
|
|---|
| 1124 | break ;
|
|---|
| 1125 |
|
|---|
| 1126 | default:
|
|---|
| 1127 | break;
|
|---|
| 1128 |
|
|---|
| 1129 | }
|
|---|
| 1130 |
|
|---|
| 1131 | case kC_CONTAINER:
|
|---|
| 1132 | switch (GET_SUBMSG(msg)) {
|
|---|
| 1133 |
|
|---|
| 1134 | // case kCT_ITEMCLICK:
|
|---|
| 1135 | // printf ("itemclick\n");
|
|---|
| 1136 | // break;
|
|---|
| 1137 |
|
|---|
| 1138 |
|
|---|
| 1139 | case kCT_ITEMDBLCLICK:
|
|---|
| 1140 | //
|
|---|
| 1141 | // process the double click in the file view container
|
|---|
| 1142 | //
|
|---|
| 1143 |
|
|---|
| 1144 | if ( parm1 == kButton1) {
|
|---|
| 1145 | if ( fFileCont->NumSelected() == 1 ) {
|
|---|
| 1146 | //
|
|---|
| 1147 | // one file selected
|
|---|
| 1148 | //
|
|---|
| 1149 | item = (TGFileItem *) fFileCont->GetNextSelected(&np) ;
|
|---|
| 1150 |
|
|---|
| 1151 | if ( S_ISDIR(item->GetType()) ) { // file is directory
|
|---|
| 1152 |
|
|---|
| 1153 | sprintf (wort, "%s", item->GetItemName()->GetString()) ;
|
|---|
| 1154 |
|
|---|
| 1155 | //
|
|---|
| 1156 | // check if in this directory the file cer000001 exits
|
|---|
| 1157 | // if it exists, do not open the stuff
|
|---|
| 1158 | //
|
|---|
| 1159 |
|
|---|
| 1160 | if ( CerFileExist( wort ) ) {
|
|---|
| 1161 |
|
|---|
| 1162 | fSelectButton->SetState(kButtonUp) ;
|
|---|
| 1163 |
|
|---|
| 1164 | new TGMsgBox(fClient->GetRoot(), this,
|
|---|
| 1165 | "Information",
|
|---|
| 1166 | "This is a directory containing cer files\n click on select to chose it!",
|
|---|
| 1167 | kMBIconAsterisk, buttons, &retval);
|
|---|
| 1168 |
|
|---|
| 1169 | }
|
|---|
| 1170 | else {
|
|---|
| 1171 | sprintf (fInputPath,"\0") ;
|
|---|
| 1172 | fSelectButton->SetState(kButtonDisabled) ;
|
|---|
| 1173 | fDir2->RemoveEntry(1) ;
|
|---|
| 1174 | fDir2->AddEntry(fInputPath,1) ;
|
|---|
| 1175 | fDir2->MapSubwindows() ;
|
|---|
| 1176 | fDir2->Layout() ;
|
|---|
| 1177 |
|
|---|
| 1178 | fDir3->RemoveEntry(1) ;
|
|---|
| 1179 | fDir3->AddEntry(fInputPath,1) ;
|
|---|
| 1180 | fDir3->MapSubwindows() ;
|
|---|
| 1181 | fDir3->Layout() ;
|
|---|
| 1182 |
|
|---|
| 1183 | sprintf (wort2, "\0" ) ;
|
|---|
| 1184 | fDirEvtNb->RemoveEntry(1) ;
|
|---|
| 1185 | fDirEvtNb->AddEntry( wort2, 1 ) ;
|
|---|
| 1186 | fDirEvtNb->MapSubwindows() ;
|
|---|
| 1187 | fDirEvtNb->Layout() ;
|
|---|
| 1188 |
|
|---|
| 1189 | //
|
|---|
| 1190 | // goto directory
|
|---|
| 1191 | //
|
|---|
| 1192 | fFileCont->ChangeDirectory ( wort ) ;
|
|---|
| 1193 | gSystem->ChangeDirectory( wort ) ;
|
|---|
| 1194 |
|
|---|
| 1195 | sprintf (wort, "%s", gSystem->WorkingDirectory() ) ;
|
|---|
| 1196 | fDir->RemoveEntry(1) ;
|
|---|
| 1197 | fDir->AddEntry( wort, 1 ) ;
|
|---|
| 1198 | fDir->MapSubwindows() ;
|
|---|
| 1199 | fDir->Layout() ;
|
|---|
| 1200 | }
|
|---|
| 1201 |
|
|---|
| 1202 | }
|
|---|
| 1203 | else { // item is a file
|
|---|
| 1204 | sprintf (testfile, "%s", item->GetItemName()->GetString() ) ;
|
|---|
| 1205 |
|
|---|
| 1206 | //
|
|---|
| 1207 | // determine the file type by extensions
|
|---|
| 1208 | //
|
|---|
| 1209 |
|
|---|
| 1210 | for (Int_t i = 0 ; i<5; i++)
|
|---|
| 1211 | extens[i] = '\0' ;
|
|---|
| 1212 |
|
|---|
| 1213 | for ( Int_t i=0; testfile[i] != '\0'; i++) {
|
|---|
| 1214 | if ( testfile[i] == '.') {
|
|---|
| 1215 | strncpy (extens, &testfile[i+1], 4 ) ;
|
|---|
| 1216 | break ;
|
|---|
| 1217 | }
|
|---|
| 1218 | }
|
|---|
| 1219 |
|
|---|
| 1220 | //
|
|---|
| 1221 | // postscript file
|
|---|
| 1222 | //
|
|---|
| 1223 |
|
|---|
| 1224 | if ( ! strcmp(extens, "ps") ) {
|
|---|
| 1225 | sprintf ( command, "gv %s/%s &",
|
|---|
| 1226 | gSystem->WorkingDirectory(),
|
|---|
| 1227 | testfile ) ;
|
|---|
| 1228 | gSystem->Exec(command) ;
|
|---|
| 1229 | break ;
|
|---|
| 1230 | }
|
|---|
| 1231 |
|
|---|
| 1232 |
|
|---|
| 1233 |
|
|---|
| 1234 |
|
|---|
| 1235 | }
|
|---|
| 1236 | }
|
|---|
| 1237 | }
|
|---|
| 1238 | else if ( parm1 == kButton3) { // right mouse double click
|
|---|
| 1239 | printf ("huschel kButton3\n");
|
|---|
| 1240 | }
|
|---|
| 1241 |
|
|---|
| 1242 | break;
|
|---|
| 1243 |
|
|---|
| 1244 | }
|
|---|
| 1245 | break ;
|
|---|
| 1246 |
|
|---|
| 1247 |
|
|---|
| 1248 | default:
|
|---|
| 1249 | break;
|
|---|
| 1250 | }
|
|---|
| 1251 | return kTRUE;
|
|---|
| 1252 | }
|
|---|
| 1253 |
|
|---|
| 1254 |
|
|---|