Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ParticleDisplay.cxx

Go to the documentation of this file.
00001 #include "TList.h"
00002 #include "TH2D.h"
00003 #include "THStack.h"
00004 #include "TVector3.h"
00005 #include <deque>
00006 #include "TCanvas.h"
00007 #include "TNtuple.h"
00008 #include "TPad.h"
00009 #include "TEllipse.h"
00010 #include "TText.h"
00011 #include "TLatex.h"
00012 #include "TMarker.h"
00013 #include "TButton.h"
00014 #include "TLine.h"
00015 #include "TLegend.h"
00016 #include "TGraph.h"
00017 #include "TMultiGraph.h"
00018 #include "TPaveText.h"
00019 #include "TArrow.h"
00020 #include "TStyle.h"
00021 #include "TPolyLine.h"
00022 #include "TDirectory.h"
00023 #include "TList.h"
00024 
00025 #include "NueAna/ParticlePID/ParticleFinder/Display/ParticleDisplay.h"
00026 #include "NueAna/Display/SelectPad.h"
00027 #include "NueAna/NueRecord.h"
00028 //#include "NueAna/NuePID.h"
00029 #include "NueAna/NueAnaTools/SntpHelpers.h"
00030 
00031 #include "CandSubShowerSR/ClusterType.h"
00032 #include "CandNtupleSR/NtpSRRecord.h"
00033 #include "CandNtupleSR/NtpSREvent.h"
00034 #include "CandNtupleSR/NtpSRTrack.h"
00035 #include "CandNtupleSR/NtpSRShower.h"
00036 #include "CandNtupleSR/NtpSRCluster.h"
00037 #include "CandNtupleSR/NtpSRStrip.h"
00038 #include "CandNtupleSR/NtpSRShieldStrip.h"
00039 #include "CandNtupleSR/NtpSRShowerPulseHeight.h"
00040 #include "MCNtuple/NtpMCRecord.h"
00041 #include "MCNtuple/NtpMCTruth.h"
00042 #include "MCNtuple/NtpMCStdHep.h"
00043 #include "TruthHelperNtuple/NtpTHRecord.h"
00044 #include "TruthHelperNtuple/NtpTHEvent.h"
00045 #include "StandardNtuple/NtpStRecord.h"
00046 #include "Conventions/Detector.h"
00047 #include "Conventions/SimFlag.h"
00048 
00049 #include "Midad/Base/Mint.h"
00050 #include "Midad/Base/PageDisplay.h"
00051 #include "Midad/Base/CanvasSignals.h"
00052 #include "Midad/Base/SteelOutline.h"
00053 #include "Midad/Base/TimeHist.h"
00054 #include "Midad/Gui/GuiButton.h"
00055 #include "Midad/Gui/GuiBox.h"
00056 #include "Midad/Gui/GuiTextEntry.h"
00057 #include "Midad/Gui/GuiTextView.h"
00058 #include "Midad/Gui/GuiTab.h"
00059 #include "Midad/Gui/GuiLabel.h"
00060 #include "Midad/Gui/GuiMainWindow.h"
00061 #include <sigc++/sigc++.h>
00062 #include <sigc++/class_slot.h>
00063 
00064 #include "JobControl/JobC.h"
00065 #include "MinosObjectMap/MomNavigator.h"
00066 
00067 #include "DataUtil/GetDetectorType.h"
00068 #include "DataUtil/CDL2STL.h"
00069 #include "DataUtil/GetRunSnarlEvent.h"
00070 #include "DataUtil/PlaneOutline.h"
00071 
00072 #include "Calibrator/CalMIPCalibration.h"
00073 #include "Record/RecRecordImp.h"
00074 #include "Record/RecCandHeader.h"
00075 
00076 #include "Plex/PlexStripEndId.h"
00077 
00078 #include "RecoBase/PropagationVelocity.h"
00079 
00080 #include "UgliGeometry/UgliStripHandle.h"
00081 #include "UgliGeometry/UgliGeomHandle.h"
00082 
00083 #include "CandFitShowerEM/FitterEM.h"
00084 
00085 
00086 #include "NueAna/NueAnaTools/NueConvention.h"
00087 #include "NueAna/ParticlePID/ParticleAna/ParticlesAna.h"
00088 
00089 #include <fstream>
00090 #include <cmath>
00091 
00092 using namespace DataUtil;
00093 using namespace SigC;
00094 
00095 // Boiler plate for using the Message Service.
00096 #include "MessageService/MsgService.h"
00097 CVSID("$Id: ParticleDisplay.cxx,v 1.3 2009/06/23 22:42:25 scavan Exp $");
00098 
00099 // Boiler plate needed for us to be a Job Module.
00100 #include "JobControl/JobCModuleRegistry.h"
00101 JOBMODULE(ParticleDisplay,"ParticleDisplay","Example of adding a Midad display in a Job Module\n");
00102 
00103 #include "DatabaseInterface/DbiResultPtr.tpl"
00104 
00105 const string evtpcode[] = {"N/A", "mu","e","NC","mu/NC?","e/NC?","???"};
00106 const string topocode[] = {"N/A", "QE","RES","DIS","???"};
00107 
00108 
00109 ParticleDisplay::ParticleDisplay()
00110   : clickbutton(0)
00111   , fSlice(-1)
00112   , fNumSlices(-1)
00113   , fEvent(-1)
00114   , fEvent_old(-1)
00115   , fNumEvents(-1)
00116   , fSnarl(-1)
00117   , RunNo_old(-1)
00118   , SubRunNo_old(-1)
00119   , imctruth(0)
00120   , ifixmcinfo(0)
00121   , kDPlaneCut(-1)
00122   , kLoPhNStripCut(-1)
00123   , kLoPhNPlaneCut(-1)
00124   , kPhStripCut(-1)
00125   , kPhPlaneCut(-1)
00126   , kCPhPlaneCut(-1.)
00127   , kPIDCut(-1)
00128   , kScanMode(0)
00129   , kTestMode(0)
00130   , kHideRunSnarl(0)
00131   , kDrawClu(0)
00132   , kIntReco(0)
00133   , foundmeu(false)
00134   , SIGCORRMEU(1.)
00135   , fHBox(0)
00136   , fVBox1(0)
00137   , fVBox2(0)
00138   , fVBox3(0)
00139   , fHBox1(0)
00140   , fHBox2(0)
00141   , fHBox3(0)
00142   , fHBox4(0)
00143   , fHBox5(0)
00144   , ievtp(0)
00145   , itopo(0)
00146 
00147 
00148 
00149   , selecevtp(0)
00150   , selectopo(0)
00151   , fRel(ReleaseType::kUnknown)
00152 {        
00153  
00154   for (int i = 0; i<7; i++){ iEvtp[i] = 0;}
00155   for (int i = 0; i<5; i++){ iTopo[i] = 0;}
00156 
00157   showStpTrueMu = false;
00158   showStpTrueShw = false;
00159   showStpScaled = false;
00160   showStpRecoTrk = false;
00161   showStpAll = true;
00162 
00163 
00164   showOrigEvent = true;
00165   showNewEvent = true;
00166 }
00167 
00168 ParticleDisplay::~ParticleDisplay()
00169 {
00170 
00171 }
00172 
00173 void ParticleDisplay::BeginRun()
00174 {
00175   cout<<"In ParticleDisplay beginrun()"<<endl;
00176   if (gMint ) this->BuildDisplay(); //must check to see if its already built!
00177 }
00178 
00179 JobCResult ParticleDisplay::Ana(const MomNavigator *mom)
00180 {
00181   if (gMint) {                // paranoia
00182     if (&gMint->GetJobC().Mom != mom) {
00183       MSG("ParticleDisplay",Msg::kError) << "Module's mom and JobC's mom differ: "
00184                                      << (void*)&gMint->GetJobC().Mom << " != "
00185                                      << (void*) mom << endl;
00186     }
00187   }
00188   //get data from mom
00189   foundPOH=false;
00190   foundST=false;
00191  
00192   st = 0;
00193   poh = 0;
00194 
00195 
00196 
00197   VldContext vc;  
00198   
00199   hft = mom->GetFragmentList("ParticleObjectHolder");
00200   
00201   std::vector<TObject* > precord  = mom->GetFragmentList("PRecord");
00202   
00203   cout <<" there are "<<precord.size()<< " ana records\n";
00204   
00205   cout <<"particles in each: ";
00206   for(unsigned int i=0;i<precord.size();i++)
00207         cout << ((PRecord*)precord[i])->particles.ntot;
00208   cout <<"\n";
00209   
00210   if(hft.size()>0)poh=(ParticleObjectHolder *)hft[0];
00211   
00212   st =(NtpStRecord*)mom->GetFragment("NtpStRecord","Primary");
00213   
00214   
00215   if(poh){
00216     foundPOH=true;
00217     vc=st->GetHeader().GetVldContext();
00218 
00219     string relName = st->GetTitle();
00220     string reco = relName.substr(0,relName.find_first_of("("));
00221     if(reco == "CEDAR") fRel = ReleaseType::kCedar;
00222     else fRel = ReleaseType::kBirch;
00223     if(vc.GetSimFlag() == SimFlag::kMC){
00224  //    NtpMCGenInfo* genInfo = &(st->mchdr.geninfo);
00225    //   if(strstr(genInfo->codename.c_str(), "daikon") == 0)
00226 //      fRel += ReleaseType::kCarrot;
00227 //      if(strstr(genInfo->codename.c_str(), "daikon") != 0)
00228 //      fRel += ReleaseType::kDaikon;
00229     }
00230     if(vc.GetSimFlag() != SimFlag::kMC) fRel += ReleaseType::kData;
00231   }
00232   
00233   
00234     if(!foundPOH) {
00235     MSG("ParticleDisplay",Msg::kError)<<"Got Nothing to display"<<endl;
00236       return JobCResult::kFailed;
00237    }
00238 
00239 
00240    
00241   fEvent = 0;
00242   this->UpdateDisplay(1,1);
00243   
00244   return JobCResult::kAOK;
00245 }
00246 
00247 void ParticleDisplay::BuildDisplay()
00248 {
00249   MSG("ParticleDisplay",Msg::kDebug)<<"In BuildDisplay"<<endl;
00250 
00251 
00253   //do some resets...
00254   //
00255   int run=0, subrun = 0, snarl = 0, evt = 0;
00256   DataUtil::GetRunSnarlEvent(&(gMint->GetJobC().Mom),run,snarl,evt);
00257   RecRecordImp<RecCandHeader> *rr = 
00258     dynamic_cast<RecRecordImp<RecCandHeader>*>
00259     ((gMint->GetJobC().Mom).GetFragment("RecRecordImp<RecCandHeader>"));
00260   if ( rr ) {
00261     subrun   = rr->GetHeader().GetSubRun();
00262     fDetectorType = rr->GetHeader().GetVldContext().GetDetector();
00263     fSimFlag = rr->GetHeader().GetVldContext().GetSimFlag();
00264   }
00265   RunNo = run;
00266   SubRunNo = subrun;
00267 
00268   fSnarl = -1; //reset snarl no at the beginning of each run
00269   if (RunNo_old==-1&&SubRunNo_old==-1){
00270     RunNo_old = RunNo;
00271     SubRunNo_old = SubRunNo;
00272   }
00274 
00275   //generate main display
00276 
00277   const int width = 1000, height = 680;
00278 
00279   PageDisplay* pd = gMint->GetDisplay();
00280   //get Button Box on the left
00281   GuiBox *fBBox = pd->GetButtonBox();
00282   // No pre-existing display, so make one to our size
00283   if (!pd) {
00284     MSG("ParticleDisplay",Msg::kDebug)<<"No display, making one"<<endl;
00285     pd = gMint->SpawnDisplay(width,height);
00286   }
00287 
00289 
00290   //add buttons in the Button Box
00291   //"Next Event" "Prev Event"
00292   fNextEventbut = pd->AddButton("Next Event ");
00293   fNextEventbut->clicked.connect(slot_class(*this,&ParticleDisplay::NextEvent));
00294   fNextEventbut = pd->AddButton("Prev Event ");
00295   fNextEventbut->clicked.connect(slot_class(*this,&ParticleDisplay::PrevEvent));
00296 
00297   //Event No
00298   fEventNo = manage(new GuiLabel(*fBBox," "));
00299   fEventNo->SetLayoutHints(kLHintsExpandX);
00300   fBBox->Add(*fEventNo);
00301   fEventEntry = pd->AddEntry(" ");
00302   fEventEntry->activated.connect(slot_class(*this,&ParticleDisplay::GotoEvent));
00303   
00304   //"NextSelEvt" "PreSelEvt"
00305   fNextSelEvt = pd->AddButton("NextSelEvt");
00306   fNextSelEvt->clicked.connect(slot_class(*this,&ParticleDisplay::NextSelEvt));
00307   fPrevSelEvt = pd->AddButton("PrevSelEvt");
00308   fPrevSelEvt->clicked.connect(slot_class(*this,&ParticleDisplay::PrevSelEvt));
00309 
00310   if(!kTestMode){
00311     fMCTruth = pd->AddButton("MC Truth");
00312     fMCTruth->clicked.connect(slot_class(*this,&ParticleDisplay::showmctruth));
00313 
00314     fFixMCInfo = pd->AddButton("Fix MC Info");
00315     fFixMCInfo->clicked.connect(slot_class(*this,&ParticleDisplay::fixmcinfo));
00316   }
00317 
00318 
00320 
00321   //construct frame for voting and I/O facilities
00322 
00323   //main box fHBox
00324   if(!fHBox){
00325     fHBox = manage(new GuiBox(*pd,kHorizontalFrame));
00326     fHBox->SetHeight(140);
00327     pd->SetWidth(pd->GetWidth());
00328     fHBox->SetWidth(pd->GetWidth());
00329     fHBox->SetLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX);
00330     pd->Add(*fHBox);
00331   } 
00332   
00333 
00334 
00335   //reco info
00336   fHBox2 = manage(new GuiBox(*fHBox,kHorizontalFrame));
00337   fHBox->Add(*fHBox2);
00338 
00339   fRecoInfo = manage(new GuiTextView(*fHBox2,1,1));
00340   fHBox2->Add(*fRecoInfo);
00341   fRecoInfo->AddLine("Reco Information");
00342 
00343 
00344 
00346 
00347   //add user-defined canvas
00348   
00349   
00350     
00351   CanvasSignals* cs0 = 0;
00352   CanvasSignals* cs1 = 0;
00353   CanvasSignals* cs2 = 0;
00354   //CanvasSignals* cs3 = 0;
00355   cs0 = dynamic_cast<CanvasSignals*>(pd->AddPage("UserCanvas"));
00356   cs1 = dynamic_cast<CanvasSignals*>(pd->AddPage("UserCanvas"));
00357   cs2 = dynamic_cast<CanvasSignals*>(pd->AddPage("UserCanvas"));  
00358   
00359 /*  hitview.BuildDisplay(&cs0->GetCanvas());
00360       gPad->Modified();
00361     cs0->GetCanvas().Update();
00362 */
00363 /*  fitview.BuildDisplay(&cs0->GetCanvas());
00364       gPad->Modified();
00365     cs0->GetCanvas().Update();
00366 */
00367 
00368   chainview.BuildDisplay(&cs1->GetCanvas());
00369       gPad->Modified();
00370     cs1->GetCanvas().Update();
00371     
00372   view3d.BuildDisplay(&cs2->GetCanvas());
00373         gPad->Modified();
00374     cs2->GetCanvas().Update();
00375 
00376 
00377     
00378   houghview.BuildDisplay(&cs0->GetCanvas());
00379         gPad->Modified();
00380     cs0->GetCanvas().Update();
00381   
00382     fEvent = 0;    
00383 }
00384 
00385 /*
00386 static void clear_hist(TH2D* hist)
00387 {
00388     hist->Reset();
00389     hist->GetXaxis()->UnZoom();
00390     hist->GetYaxis()->UnZoom();
00391     hist->SetMaximum(-1111);
00392     hist->SetMinimum(-1111);
00393 }
00394 */
00395 void ParticleDisplay::UpdateDisplay(bool /*foundnr*/, bool /*foundpid*/)
00396 {
00397   //MSG("ParticleDisplay",Msg::kDebug)
00398   cout<<"In UpdateDisplay"<<endl;
00399   
00400   
00401    
00402   int run=0, subrun = 0, snarl = 0, evt = 0;
00403   DataUtil::GetRunSnarlEvent(&(gMint->GetJobC().Mom),run,snarl,evt);
00404   RecRecordImp<RecCandHeader> *rr = 
00405     dynamic_cast<RecRecordImp<RecCandHeader>*>
00406     ((gMint->GetJobC().Mom).GetFragment("RecRecordImp<RecCandHeader>"));
00407   if ( rr ) {
00408     subrun   = rr->GetHeader().GetSubRun();
00409     fDetectorType = rr->GetHeader().GetVldContext().GetDetector();
00410     fSimFlag = rr->GetHeader().GetVldContext().GetSimFlag();
00411   }
00412   RunNo = run;
00413   SubRunNo = subrun;
00414 
00415 
00416 
00417 
00418 
00419 
00420 
00421   if (imctruth||ifixmcinfo){
00422     imctruth = 0;
00423     fMCTruth->SetDown(false);
00424    
00425   }
00426   if (foundPOH) {
00427     fNumEvents = hft.size();//st->fHeader.nevent;
00428   }
00429  
00430   if (clickbutton == -2 && fNumEvents){
00431     fEvent = fNumEvents-1;
00432     clickbutton = -1;
00433   }
00434   else if (clickbutton == -2){
00435     gMint->Prev();
00436     return;
00437   }
00438 
00439   if (!GetEvent(fEvent)){
00440     if (foundPOH){
00441       MSG("ParticleDisplay",Msg::kError)<<"Couldn't get event "<<fEvent
00442                                          <<" from Snarl "<<st->GetHeader().GetSnarl()<<endl;
00443       if (clickbutton == -1) gMint->Prev();
00444       if (clickbutton ==  1) gMint->Next();
00445       return;
00446     }
00447 
00448   }
00449  
00450   
00451   
00452   if(st)
00453   cout <<  st->GetHeader().GetSnarl()<<" "<<st->GetHeader().GetEvent()<<endl;
00454   
00455  
00456      fEventEntry->SetText(Form("%d",fEvent));
00457     fEventNo->SetText(Form("Event: %d(%d)",fEvent,fNumEvents));
00458  
00459  
00460         double particleE=0;
00461         std::vector<Particle3D>  particles3d = poh->particles3d;
00462         for(unsigned int ik=0;ik<particles3d.size();ik++)
00463         {
00464                 Particle3D * p3 = (Particle3D *)&particles3d[ik];
00465                 if(p3 <=0)continue;
00466                 particleE+=p3->sum_e;
00467         }
00468 
00469 
00470 
00471 
00472  
00473         cout <<"#################################\n";
00474         cout <<"###### RUN " << RunNo <<" SNARL "<<snarl << " EVENT "<<fEvent<<"\n";
00475         cout <<"###### totE " << poh->event.visenergy << " particleE "<< particleE;
00476         if(particleE>poh->event.visenergy) cout <<" !!!energy mismatch!";
00477         cout <<"\n";
00478         cout <<"###### Vertex U,V,Z "<< poh->event.vtx_u<<", "<<poh->event.vtx_v<<", "<<poh->event.vtx_z<<"\n";
00479         cout <<"#################################\n";
00480         
00481 
00482 
00483 
00484   poh=0;
00485 
00486   if(fEvent>-1 && (int)hft.size()>fEvent)poh=(ParticleObjectHolder*)hft[fEvent];
00487 
00488  // hitview.DrawEvent(poh,st,fEvent);
00489  // fitview.DrawEvent(poh,st,fEvent);  
00490   chainview.DrawEvent(poh,st,fEvent);
00491   view3d.DrawEvent(poh,st,fEvent);
00492    houghview.DrawEvent(poh,st,fEvent);
00493   
00494   return;
00495 
00496  
00497 }
00498 
00499 Int_t ParticleDisplay::GetEvent(Int_t /*evt*/){
00500 
00501   // Get Ugli for later.  Bail immediately if fail
00502 
00503 /*
00504   if (foundST) {
00505     event = SntpHelpers::GetEvent(evt,st);
00506   }
00507   else if(foundSR){
00508     event = SntpHelpers::GetEvent(evt,sr);
00509   }
00510 */
00511 
00512 
00513   return 1;
00514 }
00515   
00516     
00517 
00518 
00519 void ParticleDisplay::NextEvent(){
00520   clickbutton = 1;
00521 
00522   if(fNumEvents>0){
00523     fEvent++;
00524     if(fEvent>=fNumEvents){
00525       fEvent = 0;
00526       gMint->Next();
00527       return;
00528     }
00529     this->UpdateDisplay(1, 1);
00530   }
00531   else {
00532     gMint->Next();
00533     return;
00534   }
00535 }
00536 
00537 
00538 void ParticleDisplay::PrevEvent(){
00539 
00540   if(fNumEvents>0){
00541     fEvent--;
00542     if(fEvent<0){
00543       clickbutton = -2;
00544       gMint->Prev();
00545       return;
00546     }
00547     this->UpdateDisplay(1, 1);
00548   }
00549   else {
00550     gMint->Prev();
00551     return;
00552   }
00553 }
00554 
00555 void ParticleDisplay::GotoEvent()
00556 {
00557   if (!gMint) return;
00558 
00559   string eventno = fEventEntry->GetText();
00560   if (atoi(eventno.c_str())<fNumEvents && atoi(eventno.c_str())>=0){
00561     fEvent = atoi(eventno.c_str());
00562     this->UpdateDisplay(1, 1);
00563   }
00564   else {
00565     return;
00566   }
00567 }
00568 
00569 void ParticleDisplay::showmctruth()
00570 {
00571   
00572 //  if (imctruth) {
00573 //    fMCTruth->SetDown(true);
00574 //    return;
00575 //  }
00576   if (fSimFlag!=SimFlag::kMC) return;
00577   if (ifixmcinfo) return;
00578   if (!imctruth){//not pressed yet
00579     imctruth = 1;
00580     fMCTruth->SetDown(true);
00581 
00582   }
00583   else {
00584     imctruth = 0;
00585     fMCTruth->SetDown(false);
00586 
00587   }
00588 }
00589 void ParticleDisplay::fixmcinfo()
00590 {
00591   if (fSimFlag!=SimFlag::kMC) return;
00592   if (!ifixmcinfo){
00593     fFixMCInfo->SetDown(true);
00594     ifixmcinfo = 1;
00595     if (!imctruth){
00596 
00597     }
00598     else {
00599       fMCTruth->SetDown(false);
00600       imctruth = 0;
00601     }
00602   }
00603   else {
00604     fFixMCInfo->SetDown(false);
00605     ifixmcinfo = 0;
00606 
00607   }
00608 }
00609   
00610 const Registry& ParticleDisplay::DefaultConfig() const
00611 {
00612 //======================================================================
00613 // Supply the default configuration for the module
00614 //======================================================================
00615    MSG("ParticleDisplay",Msg::kDebug)<<"In ParticleDisplay::DefaultConfig"<<endl;
00616 
00617   static Registry r = fCut.DefaultConfig();
00618 
00619   // Set name of config
00620   std::string name = this->GetName();
00621   name += ".config.default";
00622   r.SetName(name.c_str());
00623 
00624   // Set values in configuration
00625   r.UnLockValues();
00626   r.Set("DPlaneCut",-1);
00627   r.Set("LoPhNStripCut",-1);
00628   r.Set("LoPhNPlaneCut",-1);
00629   r.Set("PhStripCut",-1);
00630   r.Set("PhPlaneCut",-1);
00631   r.Set("ContPhPlaneCut",-1);
00632 
00633   r.Set("PIDCut",-1);
00634   r.Set("ScanMode",0);
00635   r.Set("TestMode",0);
00636   r.Set("HideRunSnarl",0);
00637   r.Set("DrawClu",0);
00638   r.Set("IntReco",0);
00639   r.LockValues();
00640 
00641   return r;
00642 }
00643 
00644 //......................................................................
00645 
00646 void ParticleDisplay::Config(const Registry& r)
00647 {
00648 //======================================================================
00649 // Configure the module given the Registry r
00650 //======================================================================
00651   MSG("ParticleDisplay",Msg::kDebug)<<"In ParticleDisplay::Config"<<endl;
00652 
00653   fCut.Config(r);
00654 
00655   int imps;
00656   if(r.Get("DPlaneCut",imps)) { kDPlaneCut=imps;}
00657   if(r.Get("LoPhNStripCut",imps)) { kLoPhNStripCut=imps;}
00658   if(r.Get("LoPhNPlaneCut",imps)) { kLoPhNPlaneCut=imps;}
00659 
00660   if(r.Get("ScanMode",imps)) {kScanMode=imps;}
00661   if(r.Get("TestMode",imps)) {kTestMode=imps;}
00662   if(r.Get("HideRunSnarl",imps)) {kHideRunSnarl=imps;}
00663   if(r.Get("DrawClu",imps)) {kDrawClu=imps;}
00664   if(r.Get("IntReco",imps)) {kIntReco=imps;}
00665   double fmps;
00666   if(r.Get("PhStripCut",fmps)) { kPhStripCut=fmps;}
00667   if(r.Get("PhPlaneCut",fmps)) { kPhPlaneCut=fmps;}
00668   if(r.Get("ContPhPlaneCut",fmps)) { kCPhPlaneCut=fmps;}
00669 
00670   if(r.Get("PIDCut",fmps)) { kPIDCut=fmps;}
00671 }
00672 
00673 void ParticleDisplay::NextSelEvt(){
00674   if (snarlno.size()){
00675     /*
00676       cout<<*runnoitr<<" "<<*subrunnoitr<<" "
00677       <<fSnarl<<" "<<fEvent
00678       <<" "<<*snarlnoitr<<" "<<*eventnoitr<<endl;
00679 
00680     if(runnoitr<runno.end()&&runnoitr>=runno.begin()&&
00681        subrunnoitr<subrunno.end()&&subrunnoitr>=subrunno.begin()&&
00682        snarlnoitr<snarlno.end()&&snarlnoitr>=snarlno.begin()
00683        &&(fSnarl < *snarlnoitr || fSnarl == *snarlnoitr && 
00684        fEvent < *eventnoitr)){
00685     if(fSnarl == *snarlnoitr && fEvent < *eventnoitr){
00686       if ((!selecevtp||iEvtp[*typeitr])&&(!selectopo||iTopo[*topoitr])){
00687         fEvent = *eventnoitr;
00688         ievtp = *typeitr;
00689         itopo = *topoitr;
00690         //gMint->GoTo(*runnoitr,*snarlnoitr);
00691         if (*typeitr>=0&&*typeitr<7&&*topoitr>=0&&*topoitr<5){
00692           string tmp = evtpcode[*typeitr] + " | " + topocode[*topoitr];
00693           fTYPETOPO->SetText(tmp.c_str());
00694         }
00695         fComment->SetText((*commitr).c_str());
00696       }
00697     }
00698     else 
00699     */
00700     if (snarlnoitr != snarlno.end() && snarlnoitr != snarlno.end() - 1){    
00701       runnoitr++;
00702       subrunnoitr++;
00703       snarlnoitr++;
00704       eventnoitr++;
00705       typeitr++;
00706       topoitr++;
00707       commitr++;
00708       if ((!selecevtp||iEvtp[*typeitr])&&(!selectopo||iTopo[*topoitr])){
00709         fEvent = *eventnoitr;
00710         ievtp = *typeitr;
00711         itopo = *topoitr;
00712         gMint->GoTo(*runnoitr,*snarlnoitr);
00713         if (*typeitr>=0&&*typeitr<7&&*topoitr>=0&&*topoitr<5){
00714           string tmp = evtpcode[*typeitr] + " | " + topocode[*topoitr];
00715           fTYPETOPO->SetText(tmp.c_str());
00716         }
00717         fComment->SetText((*commitr).c_str());
00718       }
00719       else {this->NextSelEvt();}
00720     }
00721   }
00722 }
00723 
00724 void ParticleDisplay::PrevSelEvt(){
00725   if (snarlno.size()){
00726     /*
00727     cout<<*runnoitr<<" "<<*subrunnoitr<<" "
00728         <<fSnarl<<" "<<fEvent<<" "
00729         <<*snarlnoitr<<" "<<*eventnoitr<<endl;
00730     if(runnoitr<runno.end()&&runnoitr>=runno.begin()&&
00731        subrunnoitr<subrunno.end()&&subrunnoitr>=subrunno.begin()&&
00732        snarlnoitr<snarlno.end()&&snarlnoitr>=snarlno.begin()&&
00733        (fSnarl > *snarlnoitr || fSnarl == *snarlnoitr && 
00734         fEvent > *eventnoitr)){
00735       if ((!selecevtp||iEvtp[*typeitr])&&(!selectopo||iTopo[*topoitr])){
00736         fEvent = *eventnoitr;
00737         ievtp = *typeitr;
00738         itopo = *topoitr;
00739         gMint->GoTo(*runnoitr,*snarlnoitr);
00740         if (*typeitr>=0&&*typeitr<7&&*topoitr>=0&&*topoitr<5){
00741           string tmp = evtpcode[*typeitr] + " | " + topocode[*topoitr];
00742           fTYPETOPO->SetText(tmp.c_str());
00743         }
00744         fComment->SetText((*commitr).c_str());
00745       }
00746     }
00747     else */
00748     if (snarlnoitr != snarlno.begin() && snarlnoitr != snarlno.begin() -1){
00749       runnoitr--;
00750       subrunnoitr--;
00751       snarlnoitr--;
00752       eventnoitr--;
00753       typeitr--;
00754       topoitr--;
00755       commitr--;
00756       if ((!selecevtp||iEvtp[*typeitr])&&(!selectopo||iTopo[*topoitr])){
00757         fEvent = *eventnoitr;
00758         gMint->GoTo(*runnoitr,*snarlnoitr);
00759         if (*typeitr>=0&&*typeitr<7&&*topoitr>=0&&*topoitr<5){
00760           string tmp = evtpcode[*typeitr] + " | " + topocode[*topoitr];
00761           fTYPETOPO->SetText(tmp.c_str());
00762         }
00763         fComment->SetText((*commitr).c_str());
00764       }
00765       else {this->PrevSelEvt();}
00766     }
00767   }
00768 }
00769 
00770 
00771 void ParticleDisplay::GhostGraph(TGraph *gr)
00772 {
00773   if(gr == 0) return;
00774 
00775   gr->SetMarkerSize(0);
00776   gr->SetMarkerStyle(8);
00777   gr->SetMarkerColor(kWhite);
00778 }
00779 
00780 void ParticleDisplay::ColorGraph(TGraph *gr, int color, 
00781                                    int style, Double_t size)
00782 {
00783   if(gr == 0) return;
00784 
00785   gr->SetMarkerSize(size);
00786   gr->SetMarkerStyle(style);
00787   gr->SetMarkerColor(color);
00788 }

Generated on Mon Feb 15 11:07:18 2010 for loon by  doxygen 1.3.9.1