EventDisplay Class Reference

#include <EventDisplay.hh>

Inheritance diagram for EventDisplay:

Inheritance graph
[legend]
Collaboration diagram for EventDisplay:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 EventDisplay (const TGWindow *p, UInt_t w, UInt_t h)
 EventDisplay (std::string &rootfileName, const TGWindow *p, UInt_t w, UInt_t h)
 EventDisplay (std::string &rootfileName, std::string &xmlfileName, const TGWindow *p, UInt_t w, UInt_t h)
 ~EventDisplay ()
Bool_t ProcessMessage (Long_t msg, Long_t parm1, Long_t parm2)
void PrevEvent ()
void NextEvent ()
void SetEventNum ()
void HandleMenu (int)
void Zoom ()
void UnZoom ()
void DoSlider ()

Private Member Functions

void Display ()
void Init ()
void DisplayMTEvent ()
void DisplayCaloEvent ()
void adjustSlider ()
void fillTreeInfo (const TFile &file)
TreeInfo_tgetTreeInfo (UInt_t eventNum)

Private Attributes

TGMenuBar * fMenuBar
TGPopupMenu * fMenuFile
TGPopupMenu * fMenuHelp
TGLabel * fLbRootFile
TGNumberEntryField * LbEventNum
TGNumberEntryField * deltaTMin
TGNumberEntryField * deltaTMax
TGTextButton * prevButton
TGTextButton * exitButton
TGTextButton * nextButton
TGTextButton * zoomup
TGTextButton * zoomdown
TGCheckButton * fChkBut
TGCheckButton * fCaloTypeCheckBut
TGLayoutHints * fLayout
TGDoubleHSlider * slider
UInt_t eventNum
TFile * file
string steername
UInt_t eventType
TCanvas * c1
TCanvas * histCan
TH1I * dtHist
TGeoMaterial * mat
TGeoMedium * med
TGeoVolume * world
TGeoManager * frame
std::map< string, TGeoVolume * > nodes
std::map< string, TGeoTranslation * > trans
std::vector< TreeInfo_t * > treeInfos

Detailed Description

Definition at line 65 of file EventDisplay.hh.


Constructor & Destructor Documentation

EventDisplay::EventDisplay ( const TGWindow *  p,
UInt_t  w,
UInt_t  h 
)

Definition at line 92 of file EventDisplay.cpp.

Referenced by G__GuiClass_857_0_33(), G__GuiClass_857_0_34(), and G__GuiClass_857_0_35().

00093     : TGMainFrame(p, w, h), eventNum(0) , file(NULL), steername("") , c1(NULL) , dtHist(NULL) 
00094 {
00095 //  cout << "dtHist[" << dtHist <<"]" << endl;
00096   this->Init();
00097 }

EventDisplay::EventDisplay ( std::string &  rootfileName,
const TGWindow *  p,
UInt_t  w,
UInt_t  h 
)

Definition at line 82 of file EventDisplay.cpp.

00083    : TGMainFrame(p, w, h), eventNum(0), c1(NULL), dtHist(NULL) , eventType(UNDEFINED)
00084 {
00085   file = new TFile(rootfileName.c_str(),"READONLY");
00086   fillTreeInfo(*file);
00087   this->Init();
00088   fLbRootFile->SetText(rootfileName.c_str());
00089 }

EventDisplay::EventDisplay ( std::string &  rootfileName,
std::string &  xmlfileName,
const TGWindow *  p,
UInt_t  w,
UInt_t  h 
)

Definition at line 73 of file EventDisplay.cpp.

00074    : TGMainFrame(p, w, h), eventNum(0), steername(xmlfileName) , c1(NULL), dtHist(NULL) , eventType(UNDEFINED)
00075 {
00076   file = new TFile(rootfileName.c_str(),"READONLY");
00077   fillTreeInfo(*file);
00078   this->Init();
00079   fLbRootFile->SetText(rootfileName.c_str());
00080 }

EventDisplay::~EventDisplay (  ) 

Definition at line 234 of file EventDisplay.cpp.

00235 {
00236   if ( file != NULL )
00237   {
00238     file->Close();
00239     delete file;
00240   }
00241 }


Member Function Documentation

void EventDisplay::Display (  )  [private]

Definition at line 406 of file EventDisplay.cpp.

Referenced by DoSlider(), NextEvent(), PrevEvent(), ProcessMessage(), and SetEventNum().

00407 {
00408   if ( file == NULL ) { return ; }
00409   if ( file->IsZombie()) {
00410     exit(-1);
00411   }
00412 
00413 //   world->ClearNodes();
00414   
00415 
00416   if ( fChkBut->IsDown())
00417   {
00418     Detector detector;
00419     SteerDesc steerDesc;
00420     XMLTool xml;
00421     xml.parse(steerDesc, steername); // parse steer file and fill steerDesc
00422 
00423     if ( ! detector.build(steerDesc) == steerDesc.chambers.size() )
00424     {
00425       FILE_LOG(logERROR) << "Geometry Error. Please check your XML file."  << endl;
00426       exit(-1);
00427     }
00428     ChamberMap_t chambers = detector.getChambers();
00429     for ( ChamberMap_t::const_iterator iter = chambers.begin(); iter!=chambers.end(); iter++)
00430     {
00431       Chamber *chamber = (*iter).second;
00432       TGeoVolume *pad = frame->MakeBox("1" ,med,chamber->getYLength(),chamber->getXLength(),96 );
00433       int color = 17;
00434       cout << "chamber->getX(): " << chamber->getX() << "chamber->getY(): " << chamber->getY() << "chamber->getZ(): " << chamber->getZ() << endl;
00435 
00436  
00437       world->AddNode(pad,1,new TGeoTranslation(chamber->getX(),chamber->getY(),chamber->getZ()));
00438       pad->SetLineColor(color);
00439     }
00440   }
00441   
00442     TreeInfo_t* info = getTreeInfo(eventNum);
00443     if ( info != NULL ) 
00444     {
00445       if ( info->type == CALOEVENT ) 
00446       {
00447         this->DisplayCaloEvent();
00448       }
00449       else if  ( info->type == MTEVENT )  
00450       {
00451         this->DisplayMTEvent();
00452       }
00453     }
00454 }

void EventDisplay::Init (  )  [private]

Definition at line 99 of file EventDisplay.cpp.

Referenced by EventDisplay().

00100 {
00101   gSystem->Load("libGeom");
00102 
00103   histCan = new TCanvas("dt", "dt", 600, 600);
00104   c1 = new TCanvas("Event Display", "Event Display", 600, 600);
00105   c1->SetFillColor(kBlack);
00106 
00107   frame =new TGeoManager("Frame","mM event displayer");
00108   mat = new TGeoMaterial("SomeMaterial",1,1,1);
00109   med = new TGeoMedium("SomeMedium",1,mat);
00110   world = frame->MakeBox("World", med, 1, 1, 1); // x, y , z size unit cm
00111 
00112   // construct Menu Bar
00113   fMenuBar = new TGMenuBar(this, 35, 50, kHorizontalFrame);
00114   fMenuFile = new TGPopupMenu(gClient->GetRoot());
00115 
00116   fMenuFile->AddEntry(" &Open Event file...", M_FILE_EVENT_OPEN, 0, gClient->GetPicture("bld_open.png"));
00117   fMenuFile->AddEntry(" &Open XML steer file...", M_FILE_XML_OPEN,0,gClient->GetPicture("bld_open.png"));
00118   fMenuFile->AddEntry(" &Exit ...", M_FILE_EXIT);
00119 
00120   fMenuFile->Connect("Activated(Int_t)", "EventDisplay", this,
00121                       "HandleMenu(int)");
00122 
00123   fMenuBar->AddPopup("&File", fMenuFile, new TGLayoutHints(kLHintsTop|kLHintsLeft, 0, 4, 0, 0));
00124 
00125   this->AddFrame(fMenuBar, new TGLayoutHints(kLHintsTop | kLHintsExpandX|kLHintsExpandY, 2, 2, 2, 5));
00126 
00127 
00128   // Construct Root file label
00129   const TGFont *font = gClient->GetFont("-*-times-r-*-*-10-*-*-*-*-*-*-*");
00130   if (!font)
00131      font = gClient->GetResourcePool()->GetDefaultFont();
00132   GCValues_t   gval;
00133   gval.fMask = kGCBackground | kGCFont | kGCForeground;
00134   gval.fFont = font->GetFontHandle();
00135   FontStruct_t labelfont = font->GetFontStruct();
00136   TGGC *fTextGC = gClient->GetGC(&gval, kTRUE);
00137   ULong_t bcolor, ycolor;
00138   gClient->GetColorByName("white", ycolor);
00139   gClient->GetColorByName("black", bcolor);
00140 
00141   fLbRootFile = new TGLabel(this, "file name", fTextGC->GetGC(), labelfont, kChildFrame, bcolor);
00142   AddFrame(fLbRootFile, new TGLayoutHints(kLHintsExpandX|kLHintsExpandY, 1, 5, 3, 4));
00143 
00144 
00145 
00146 // Event Control
00147   // Construct event information  prev and next button
00148   TGHorizontalFrame *controls = new TGHorizontalFrame(this);
00149   AddFrame(controls, new TGLayoutHints(kLHintsExpandX|kLHintsExpandY));
00150 
00151   TGLabel *fLbEvent = new TGLabel(controls, "Event");
00152   LbEventNum = new TGNumberEntryField(controls);
00153 
00154   prevButton = new TGTextButton(controls, "&<<", PREVID);
00155   nextButton = new TGTextButton(controls, "&>>", NEXTID);
00156   exitButton = new TGTextButton(this, "&Exit", 2);
00157 
00158   controls->AddFrame(fLbEvent, new TGLayoutHints(kLHintsLeft|kLHintsCenterY, 5, 2, 2, 2));
00159   controls->AddFrame(LbEventNum, new TGLayoutHints(kLHintsLeft|kLHintsCenterY, 5, 2, 2, 2));
00160   controls->AddFrame(prevButton, new TGLayoutHints(kLHintsLeft|kLHintsCenterY, 5, 2, 2, 2));
00161   controls->AddFrame(nextButton, new TGLayoutHints(kLHintsLeft|kLHintsCenterY, 5, 2, 2, 2));
00162   prevButton->Connect("Clicked()", "EventDisplay", this, "PrevEvent()");
00163   nextButton->Connect("Clicked()", "EventDisplay", this, "NextEvent()");
00164   LbEventNum->Connect(" ReturnPressed()", "EventDisplay", this, "SetEventNum()");
00165   
00166 
00167 
00168  // Zoom
00169   TGHorizontalFrame *zoomZone = new TGHorizontalFrame(this);
00170   AddFrame(zoomZone, new TGLayoutHints(kLHintsExpandX|kLHintsExpandY));
00171   zoomup = new TGTextButton(zoomZone, "&Zoom +", 2);
00172   zoomdown = new TGTextButton(zoomZone, "&Zoom -", 2);
00173   zoomZone->AddFrame(zoomup, new TGLayoutHints(kLHintsExpandX));
00174   zoomup->Connect("Clicked()", "EventDisplay", this, "Zoom()");
00175   zoomZone->AddFrame(zoomdown, new TGLayoutHints(kLHintsExpandX));
00176   zoomdown->Connect("Clicked()", "EventDisplay", this, "UnZoom()");
00177 
00178 // DeltaT Control
00179   // Construct DeltaT information Min/Max and slider
00180   slider = new TGDoubleHSlider(this, 200, kDoubleScaleBoth, 10,
00181                                    kHorizontalFrame,
00182                                    GetDefaultFrameBackground(),
00183                                    kFALSE, kFALSE);
00184   slider->Connect("PositionChanged()", "EventDisplay",
00185                       this, "DoSlider()");
00186 
00187   // BCID_DIF et BCID_HIT sont code sur 24 bits
00188   // donc DT  max = ( BCID_DIF - BCID_HIT ) = 0xffffff
00189   //slider->SetRange(0,0xffffff);
00190   //slider->SetPosition(0,0xffffff);
00191   slider->SetRange(0,1);
00192   slider->SetPosition(0,1);
00193 
00194 
00195   TGLabel *deltaTLabel = new TGLabel(this, "DeltaT");
00196   this->AddFrame(deltaTLabel, new TGLayoutHints(kLHintsExpandX));
00197   this->AddFrame(slider, new TGLayoutHints(kLHintsExpandX|kLHintsExpandY));
00198 
00199   TGHorizontalFrame *deltaT = new TGHorizontalFrame(this);
00200   AddFrame(deltaT, new TGLayoutHints(kLHintsExpandX|kLHintsExpandY));
00201 
00202   deltaTMin = new TGNumberEntryField(deltaT);
00203   deltaTMax = new TGNumberEntryField(deltaT);
00204 
00205   TGLabel *deltaTMinLabel = new TGLabel(deltaT, "Min");
00206   TGLabel *deltaTMaxLabel = new TGLabel(deltaT, "Max");
00207   deltaT->AddFrame(deltaTMinLabel, new TGLayoutHints(kLHintsExpandX));
00208   deltaT->AddFrame(deltaTMin, new TGLayoutHints(kLHintsExpandX));
00209   deltaT->AddFrame(deltaTMaxLabel, new TGLayoutHints(kLHintsExpandX));
00210   deltaT->AddFrame(deltaTMax, new TGLayoutHints(kLHintsExpandX));
00211   deltaTMin->SetState(false);
00212   deltaTMax->SetState(false);
00213 
00214 
00215   // check and exit button
00216   exitButton->SetCommand(".q" );
00217   fChkBut = new TGCheckButton(this, "Show chambers", 4);
00218   
00219   fLbRootFile->SetTextColor(ycolor);
00220   fLbRootFile->Resize(350, 80);
00221   fLayout = new TGLayoutHints(kLHintsCenterX | kLHintsCenterY);
00222   AddFrame(fChkBut, fLayout);
00223   AddFrame(exitButton, new TGLayoutHints(kLHintsExpandX|kLHintsExpandY, 5, 5, 3, 4));
00224 
00225 
00226 
00227   MapSubwindows();
00228   Layout();
00229   SetWindowName("Micromegas LAPP Event Viewer");
00230   SetIconName("Micromegas LAPP Event Viewer");
00231   MapWindow();
00232 }

void EventDisplay::DisplayMTEvent (  )  [private]

Definition at line 564 of file EventDisplay.cpp.

Referenced by Display().

00565 {
00566 
00567   //if ( world != NULL ) { delete world; }
00568   //if ( frame != NULL ) { delete frame; }
00569   //frame =new TGeoManager("Frame","mM event displayer");
00570   //world = frame->MakeBox("World", med, 1, 1, 1); // x, y , z size unit cm
00571 
00572 
00573 
00574 
00575 //  world->ClearNodes();
00576   if ( dtHist != NULL ) { delete dtHist; }
00577   dtHist = new TH1I("dt", "dt", 
00578                     slider->GetMaxPosition()-slider->GetMinPosition(),
00579                     slider->GetMinPosition(),slider->GetMaxPosition() );
00580   MTEvent *mtEvt = NULL;
00581   int padNumber = 0;
00582   UInt_t curEvent = 0;
00583 
00584   TTree *tree =  NULL;
00585   TBranch *branch= NULL;
00586   Int_t nbEvent = 0;
00587 
00588   mtEvt = new MTEvent();
00589   TreeInfo_t* info = getTreeInfo(eventNum);
00590   if ( info != NULL )
00591   {
00592     tree = info->tree;
00593     branch= tree->GetBranch("MTEvent");
00594     branch->SetAddress(&mtEvt);
00595   }
00596   else { return; }
00597 
00598   tree->GetEntry(this->eventNum-info->min);
00599 
00600   Int_t NC = mtEvt->GetNchannel();
00601   NC = 3000;
00602   frame->SetMaxVisNodes(NC+100);
00603 
00604   UInt_t minSlider = slider->GetMinPosition();
00605   UInt_t maxSlider = slider->GetMaxPosition();
00606 
00607   float x,y,z;
00608   for(int i=0;i<NC  ;i++)
00609   {
00610 //    if ( padNumber < 169300)
00611     {
00612       cout << "compute channel " << i << " / " << NC << "\t\t\t\t\t\t\t\t\t\t\t\r" << flush;
00613       MTChannel* mtChannel=NULL;
00614       //the only known way to get the information from the channels number i
00615       mtChannel = (MTChannel*)mtEvt->GetChannels()->UncheckedAt(i);
00616       
00617       UInt_t t2 = mtChannel->GetBcId_Dif();
00618       UInt_t t3 = mtChannel->GetBcId_Hit();
00619       UInt_t dt = t2 - t3;
00620       if (  dt < minSlider || dt > maxSlider ) { continue; }
00621 
00622       dtHist->Fill(dt);
00623       float xLength = 9600 ;  //micron 
00624       float yLength = 9600 ;  //micron
00625       float zLength = 10;     //micron
00626       // ChannelPad name
00627       string padID="";
00628       stringstream currentpad;// (stringstream::in | stringstream::out);
00629       padNumber++;
00630       currentpad<<padNumber;
00631       padID="pad_"+currentpad.str();
00632 
00633       x=mtChannel->GetX() ;
00634       y=mtChannel->GetY() ;
00635       z=mtChannel->GetZ() ;
00636       //set now the color of the pad
00637       int color;
00638       int sMax = 30;//set to limit of saturation
00639       stringstream ch;
00640       ch<<i;
00641 
00642       if ( mtChannel->GetDigitalValue() == 1 ) { color = 5; }
00643       else  if ( mtChannel->GetDigitalValue() == 2 ) { color = 6; }
00644       else  if ( mtChannel->GetDigitalValue() == 3 ) { color = 2; }
00645 
00646       ostringstream ox,oy,oz;
00647       ox << x; oy << y; oz <<z ;
00648       string key = "x[" + ox.str() + "]y[" + oy.str() + "]z[" + oz.str() +"]" ;
00649       TGeoVolume *pad = NULL;
00650       TGeoTranslation *tr = NULL;
00651       if ( nodes.find(key) == nodes.end()   )
00652       {
00653         pad = frame->MakeBox(padID.c_str(),med,yLength/2,xLength/2,zLength/2 );
00654         nodes.insert(make_pair(key,pad));
00655         tr = new TGeoTranslation(x,y,z);
00656         trans.insert(make_pair(key,tr));
00657       world->AddNode(pad,1,tr);
00658       }
00659       else
00660       {
00661         pad = nodes[key];
00662         tr = trans[key];
00663       }
00664       pad->SetLineColor(color);
00665       pad->SetFillColor(color);
00666       pad->SetFillStyle(4100);
00667     }
00668   }
00669   frame->SetTopVolume(world);
00670 
00671   if ( !frame->IsClosed() ) frame->CloseGeometry();
00672   histCan->cd();
00673   dtHist->Draw();
00674   c1->cd();
00675   world->Draw();
00676   histCan->Update();
00677   c1->Update();
00678   
00679   delete mtEvt;
00680 }

void EventDisplay::DisplayCaloEvent (  )  [private]

Definition at line 457 of file EventDisplay.cpp.

Referenced by Display().

00458 {
00459   if ( dtHist != NULL ) { delete dtHist ;}
00460   dtHist = new TH1I("dt", "dt", slider->GetMaxPosition()-slider->GetMinPosition(), slider->GetMinPosition(), slider->GetMaxPosition() );
00461   CaloEvent *caloEvt = NULL;
00462  // TKey *key;
00463   int padNumber = 0;
00464   UInt_t curEvent = 0;
00465 
00466   TTree *tree =  NULL;
00467   TBranch *branch= NULL;
00468   Int_t nbEvent = 0;
00469 
00470   caloEvt = new CaloEvent();
00471   TreeInfo_t* info = getTreeInfo(eventNum);
00472   if ( info != NULL )
00473   {
00474     tree = info->tree;
00475     branch= tree->GetBranch("CaloEvent");
00476     branch->SetAddress(&caloEvt);
00477   }
00478   else { return; }
00479   cout << "Get tree[" << tree << "]" << endl;
00480     
00481     
00482   tree->GetEntry(this->eventNum-info->min);
00483 
00484   Int_t NC=caloEvt->GetNHits();
00485   frame->SetMaxVisNodes(NC+100);
00486 
00487 
00488   float x,y,z;
00489   for(int i=0;i<NC  ;i++)
00490   {
00491     if ( padNumber < 169300)
00492     {
00493       CaloHit* caloChannel = NULL;
00494       //the only known way to get the information from the channels number i
00495       caloChannel = (CaloHit*)caloEvt->GetHits()->UncheckedAt(i);
00496 
00497   
00498 /*
00499       Int_t dt= caloChannel->GetDeltaT();
00500       if (  dt < slider->GetMinPosition() || dt> slider->GetMaxPosition())
00501       { 
00502         continue;
00503       }
00504 */
00505 
00506       //dtHist->Fill(dt);
00507       float xLength = 9600 ;  //micron 
00508       float yLength = 9600 ;  //micron
00509       float zLength = 10;     //micron
00510       // ChannelPad name
00511       string padID="";
00512       stringstream currentpad;// (stringstream::in | stringstream::out);
00513       padNumber++;
00514       currentpad<<padNumber;
00515       padID="pad_"+currentpad.str();
00516 
00517 cout <<  "xLength: " << xLength <<  "yLength: " << yLength <<  "zLength: " << zLength << endl;
00518       TGeoVolume *pad = frame->MakeBox(padID.c_str(),med,yLength/2,xLength/2,zLength/2 );
00519       x=caloChannel->GetX();//*10000 ;
00520       y=caloChannel->GetY();//*10000 ;
00521       z=caloChannel->GetZ();//*10000 ;
00522 cout <<  "x: " << x <<  "y: " << y <<  "z: " << z << endl;
00523       //set now the color of the pad
00524       int color;
00525       int sMax = 30;//set to limit of saturation
00526       stringstream ch;
00527       ch<<i;
00528 
00529       if ( caloChannel->GetThreshold() == 1 ) { color = 5; }
00530       else  if ( caloChannel->GetThreshold() == 2 ) { color = 6; }
00531       else  if ( caloChannel->GetThreshold() == 3 ) { color = 2; }
00532 
00533       ostringstream ox,oy,oz;
00534       ox << x; oy << y; oz <<z ;
00535       string key = "x[" + ox.str() + "]y[" + oy.str() + "]z[" + oz.str() +"]" ;
00536 //        if ( node[key]==false)
00537       {
00538         world->AddNode(pad,1,new TGeoTranslation(x,y,z));
00539       //  node[key] = true;
00540       //  color = color * 2;
00541       }
00542       pad->SetLineColor(color);
00543       pad->SetFillColor(color);
00544       pad->SetFillStyle(4100);
00545     }
00546     else
00547     {
00548       break;
00549     }
00550   }
00551   frame->SetTopVolume(world);
00552   
00553   frame->CloseGeometry();
00554   histCan->cd();
00555   dtHist->Draw();
00556   c1->cd();
00557   world->Draw();
00558   c1->Update();
00559   histCan->Update();
00560 delete caloEvt;
00561 
00562 }

void EventDisplay::adjustSlider (  )  [private]

Definition at line 303 of file EventDisplay.cpp.

Referenced by NextEvent(), PrevEvent(), and SetEventNum().

00304 {
00305   Int_t min = 0;
00306   Int_t max = 0xffffffff;
00307   slider->SetRange(min, max);
00308   deltaTMin->SetNumber(min);
00309   deltaTMax->SetNumber(max);
00310   slider->SetPosition(min,max);
00311   return ;
00312   TTree *tree =  NULL;
00313   TBranch *branch= NULL;
00314   Int_t nbEvent = 0;
00315 
00316   TreeInfo_t* info = getTreeInfo(eventNum);
00317   
00318   if ( info->type == CALOEVENT )
00319   {
00320     CaloEvent* caloEvt = new CaloEvent();
00321     tree = info->tree;
00322     branch= tree->GetBranch("CaloEvent");
00323     branch->SetAddress(&caloEvt);
00324     tree->GetEntry(this->eventNum-info->min);
00325 
00326     Int_t NC=caloEvt->GetNHits();
00327     Int_t min = 0xffffffff;
00328     Int_t max = 0;
00329 
00330     for(int i=0;i<NC  ;i++)
00331     {
00332     CaloHit* caloChannel = (CaloHit*)caloEvt->GetHits()->UncheckedAt(i);
00333     UInt_t dt= caloChannel->GetDeltaT();
00334     if ( dt < min ) { min = dt; }
00335     if ( dt > max ) { max = dt; }
00336     }
00337 
00338     cout << "min[" << min << "] max[" << max <<"]" << endl;
00339     slider->SetRange(min, max);
00340     deltaTMin->SetNumber(min);
00341     deltaTMax->SetNumber(max);
00342     slider->SetPosition(min,max);
00343     delete caloEvt;
00344   }
00345   else
00346   {
00347     MTEvent* caloEvt = new MTEvent();
00348     tree = info->tree;
00349     branch= tree->GetBranch("MTEvent");
00350     branch->SetAddress(&caloEvt);
00351     tree->GetEntry(this->eventNum-info->min);
00352 
00353     Int_t NC=caloEvt->GetNchannel();
00354     Int_t min = 0xffffffff;
00355     Int_t max = 0;
00356 
00357     for(int i=0;i<NC  ;i++)
00358     {
00359       MTChannel* caloChannel = (MTChannel*)caloEvt->GetChannels()->UncheckedAt(i);
00360       UInt_t t2 = caloChannel->GetBcId_Dif();
00361       UInt_t t3 = caloChannel->GetBcId_Hit();
00362       UInt_t dt = t2 - t3;
00363 
00364       
00365       if ( dt < min ) { min = dt; }
00366       if ( dt > max ) { max = dt; }
00367     }
00368 
00369     cout << "min[" << min << "] max[" << max <<"]" << endl;
00370     slider->SetRange(min, max);
00371     deltaTMin->SetNumber(min);
00372     deltaTMax->SetNumber(max);
00373     slider->SetPosition(min,max);
00374     delete caloEvt;
00375   }
00376 }

void EventDisplay::fillTreeInfo ( const TFile &  file  )  [private]

Definition at line 747 of file EventDisplay.cpp.

Referenced by EventDisplay(), and HandleMenu().

00748 {
00749   treeInfos.clear();
00750   
00751   TIter nextkey(file.GetListOfKeys());
00752   TKey *key;
00753   UInt_t nbEvent = 0;
00754   while (key = (TKey*)nextkey()) 
00755   {
00756     TreeInfo_t *foo = new TreeInfo_t();
00757 
00758     TTree *tree = (TTree*)key->ReadObj();
00759     foo->min=nbEvent;
00760     foo->max=foo->min+tree->GetEntries()-1;
00761     nbEvent = foo->max+1;
00762     foo->tree = tree;
00763     if ( tree->FindBranch("CaloEvent")!= NULL)
00764     {
00765       foo->type = CALOEVENT;
00766     }
00767     else if ( tree->FindBranch("MTEvent")!= NULL)
00768     {
00769       foo->type = MTEVENT;
00770     }
00771 
00772     treeInfos.push_back(foo);
00773   }
00774 }

TreeInfo_t * EventDisplay::getTreeInfo ( UInt_t  eventNum  )  [private]

Definition at line 777 of file EventDisplay.cpp.

Referenced by adjustSlider(), Display(), DisplayCaloEvent(), and DisplayMTEvent().

00778 {
00779   
00780   
00781   std::vector<TreeInfo_t*>::const_iterator iter;
00782 
00783   for( iter = treeInfos.begin(); iter != treeInfos.end(); iter++)
00784   {
00785     TreeInfo_t* info= *iter;
00786     if ( eventNum >= info->min && eventNum <= info->max )
00787     {
00788       return info;
00789     }
00790   }
00791   return NULL;
00792 }

Bool_t EventDisplay::ProcessMessage ( Long_t  msg,
Long_t  parm1,
Long_t  parm2 
)

Definition at line 382 of file EventDisplay.cpp.

00383 {
00384     // Process events generated by the buttons in the frame.
00385     switch (GET_MSG(msg)) {
00386         case kC_COMMAND:
00387             switch (GET_SUBMSG(msg)) {
00388                 case kCM_CHECKBUTTON:
00389                     this->Display();
00390                     break;
00391                 default:
00392                     break;
00393             }
00394         default:
00395             break;
00396     }
00397     return kTRUE;
00398 }

void EventDisplay::PrevEvent (  ) 

Definition at line 281 of file EventDisplay.cpp.

Referenced by G__GuiClass_857_0_37().

00282 {
00283   if ( file == NULL ) { return ; }
00284   if ( eventNum == 0 ) eventNum = 1; 
00285   eventNum--;
00286 
00287   LbEventNum->SetIntNumber(eventNum);
00288   adjustSlider();
00289   this->Display();
00290 }

void EventDisplay::NextEvent (  ) 

Definition at line 293 of file EventDisplay.cpp.

Referenced by G__GuiClass_857_0_38().

00294 {
00295   if ( file == NULL ) { return ; }
00296   eventNum++;
00297   LbEventNum->SetIntNumber(eventNum);
00298   adjustSlider();
00299   this->Display();
00300 }

void EventDisplay::SetEventNum (  ) 

Definition at line 271 of file EventDisplay.cpp.

Referenced by G__GuiClass_857_0_39().

00272 {
00273   if ( file == NULL ) { return ; }
00274   eventNum = LbEventNum->GetIntNumber();
00275   adjustSlider();
00276   this->Display();
00277 }

void EventDisplay::HandleMenu ( int   ) 

Definition at line 683 of file EventDisplay.cpp.

Referenced by G__GuiClass_857_0_40().

00684 {
00685    // Handle menu events.
00686 
00687    TRootHelpDialog *hd;
00688    static TString dir(".");
00689    TGFileInfo fi;
00690    fi.fFileTypes = dnd_types;
00691    fi.fIniDir    = StrDup(dir);
00692 
00693 
00694    switch (menu_id) {
00695           gApplication->Terminate(0);
00696       case M_FILE_EXIT:
00697          // close the window and quit application
00698          gApplication->Terminate(0);
00699          break;
00700       case M_FILE_EVENT_OPEN:
00701            fi.fFileTypes = filetypes;
00702            new TGFileDialog(gClient->GetRoot(), this, kFDOpen, &fi);
00703            if ( fi.fFilename != NULL )
00704            {
00705             string *full;
00706             full  = new string(fi.fFilename);
00707             if ( file != NULL ) 
00708             {
00709               std::vector<TreeInfo_t*>::const_iterator iter;
00710               for( iter = treeInfos.begin(); iter != treeInfos.end(); iter++)
00711               {
00712                 TreeInfo_t* info= *iter;
00713                 {
00714                   delete info;
00715                 }
00716               }
00717               treeInfos.clear();
00718               delete dtHist;
00719               dtHist = NULL;
00720               file->Close();
00721               delete file;
00722               eventNum = 0;
00723             }
00724  
00725     
00726             file = new TFile(full->c_str(),"READONLY");
00727             fLbRootFile->SetText(full->c_str());
00728             fCaloTypeCheckBut = 0;
00729             fillTreeInfo(*file);
00730 
00731           }
00732         break;
00733       case M_FILE_XML_OPEN:
00734            fi.fFileTypes = filetypes;
00735            new TGFileDialog(gClient->GetRoot(), this, kFDOpen, &fi);
00736            if ( fi.fFilename != NULL ) steername  = fi.fFilename;
00737         break;
00738       case M_HELP_ABOUT:
00739          hd = new TRootHelpDialog(this, "About Drag and Drop...", 550, 250);
00740          //hd->SetText(gHelpDND);
00741          hd->Popup();
00742          break;
00743    }
00744 }

void EventDisplay::Zoom (  ) 

Definition at line 263 of file EventDisplay.cpp.

Referenced by G__GuiClass_857_0_41().

00264 {
00265   c1->cd();
00266   gPad->GetView()->ZoomIn();
00267   c1->SetCanvasSize((UInt_t)(c1->GetWw()*1.1),(UInt_t)(c1->GetWh()*1.1));
00268   
00269 }

void EventDisplay::UnZoom (  ) 

Definition at line 255 of file EventDisplay.cpp.

Referenced by G__GuiClass_857_0_42().

00256 {
00257   c1->cd();
00258   gPad->GetView()->ZoomOut();
00259   c1->SetCanvasSize((UInt_t)(c1->GetWw()*.9),(UInt_t)(c1->GetWh()*.9));
00260   
00261 }

void EventDisplay::DoSlider (  ) 

Definition at line 246 of file EventDisplay.cpp.

Referenced by G__GuiClass_857_0_43().

00247 {
00248  deltaTMin->SetNumber(slider->GetMinPosition());
00249  deltaTMax->SetNumber(slider->GetMaxPosition());
00250  this->Display();
00251 
00252 
00253 }


Member Data Documentation

TGMenuBar* EventDisplay::fMenuBar [private]

Definition at line 69 of file EventDisplay.hh.

Referenced by Init().

TGPopupMenu* EventDisplay::fMenuFile [private]

Definition at line 70 of file EventDisplay.hh.

Referenced by Init().

TGPopupMenu* EventDisplay::fMenuHelp [private]

Definition at line 71 of file EventDisplay.hh.

TGLabel* EventDisplay::fLbRootFile [private]

Definition at line 72 of file EventDisplay.hh.

Referenced by EventDisplay(), HandleMenu(), and Init().

TGNumberEntryField* EventDisplay::LbEventNum [private]

Definition at line 73 of file EventDisplay.hh.

Referenced by Init(), NextEvent(), PrevEvent(), and SetEventNum().

TGNumberEntryField* EventDisplay::deltaTMin [private]

Definition at line 74 of file EventDisplay.hh.

Referenced by adjustSlider(), DoSlider(), and Init().

TGNumberEntryField* EventDisplay::deltaTMax [private]

Definition at line 75 of file EventDisplay.hh.

Referenced by adjustSlider(), DoSlider(), and Init().

TGTextButton* EventDisplay::prevButton [private]

Definition at line 77 of file EventDisplay.hh.

Referenced by Init().

TGTextButton * EventDisplay::exitButton [private]

Definition at line 77 of file EventDisplay.hh.

Referenced by Init().

TGTextButton * EventDisplay::nextButton [private]

Definition at line 77 of file EventDisplay.hh.

Referenced by Init().

TGTextButton * EventDisplay::zoomup [private]

Definition at line 77 of file EventDisplay.hh.

Referenced by Init().

TGTextButton * EventDisplay::zoomdown [private]

Definition at line 77 of file EventDisplay.hh.

Referenced by Init().

TGCheckButton* EventDisplay::fChkBut [private]

Definition at line 78 of file EventDisplay.hh.

Referenced by Display(), and Init().

TGCheckButton* EventDisplay::fCaloTypeCheckBut [private]

Definition at line 79 of file EventDisplay.hh.

Referenced by HandleMenu().

TGLayoutHints* EventDisplay::fLayout [private]

Definition at line 80 of file EventDisplay.hh.

Referenced by Init().

TGDoubleHSlider* EventDisplay::slider [private]

Definition at line 88 of file EventDisplay.hh.

Referenced by adjustSlider(), DisplayCaloEvent(), DisplayMTEvent(), DoSlider(), and Init().

UInt_t EventDisplay::eventNum [private]

Definition at line 91 of file EventDisplay.hh.

Referenced by adjustSlider(), Display(), DisplayCaloEvent(), DisplayMTEvent(), HandleMenu(), NextEvent(), PrevEvent(), and SetEventNum().

TFile* EventDisplay::file [private]

Definition at line 92 of file EventDisplay.hh.

Referenced by Display(), EventDisplay(), HandleMenu(), NextEvent(), PrevEvent(), SetEventNum(), and ~EventDisplay().

string EventDisplay::steername [private]

Definition at line 93 of file EventDisplay.hh.

Referenced by Display(), and HandleMenu().

UInt_t EventDisplay::eventType [private]

Definition at line 95 of file EventDisplay.hh.

TCanvas* EventDisplay::c1 [private]

Definition at line 97 of file EventDisplay.hh.

Referenced by DisplayCaloEvent(), DisplayMTEvent(), Init(), UnZoom(), and Zoom().

TCanvas* EventDisplay::histCan [private]

Definition at line 98 of file EventDisplay.hh.

Referenced by DisplayCaloEvent(), DisplayMTEvent(), and Init().

TH1I* EventDisplay::dtHist [private]

Definition at line 99 of file EventDisplay.hh.

Referenced by DisplayCaloEvent(), DisplayMTEvent(), and HandleMenu().

TGeoMaterial* EventDisplay::mat [private]

Definition at line 100 of file EventDisplay.hh.

Referenced by Init().

TGeoMedium* EventDisplay::med [private]

Definition at line 101 of file EventDisplay.hh.

Referenced by Display(), DisplayCaloEvent(), DisplayMTEvent(), and Init().

TGeoVolume* EventDisplay::world [private]

Definition at line 102 of file EventDisplay.hh.

Referenced by Display(), DisplayCaloEvent(), DisplayMTEvent(), and Init().

TGeoManager* EventDisplay::frame [private]

Definition at line 103 of file EventDisplay.hh.

Referenced by Display(), DisplayCaloEvent(), DisplayMTEvent(), and Init().

std::map<string, TGeoVolume*> EventDisplay::nodes [private]

Definition at line 104 of file EventDisplay.hh.

Referenced by DisplayMTEvent().

std::map<string, TGeoTranslation*> EventDisplay::trans [private]

Definition at line 105 of file EventDisplay.hh.

Referenced by DisplayMTEvent().

std::vector<TreeInfo_t*> EventDisplay::treeInfos [private]

Definition at line 107 of file EventDisplay.hh.

Referenced by fillTreeInfo(), getTreeInfo(), and HandleMenu().


The documentation for this class was generated from the following files:
Generated on Mon Jun 11 16:58:25 2012 for MicromegasFramework by  doxygen 1.4.7