CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2/src/RecoParticleFlow/PFRootEvent/src/GPFSimParticle.cc

Go to the documentation of this file.
00001 #include "RecoParticleFlow/PFRootEvent/interface/GPFSimParticle.h"
00002 #include "RecoParticleFlow/PFRootEvent/interface/DisplayManager.h"
00003 #include "TPad.h"
00004 #include "TObject.h"
00005 #include "TGraph.h"
00006 #include <string>
00007 
00008 
00009 
00010 //________________________________________________________________________
00011 GPFSimParticle::GPFSimParticle(DisplayManager *display,int view, int ident, 
00012                                const reco::PFSimParticle *ptc, 
00013                                int size, double *x, double *y,
00014                                double pt,TAttMarker *attm, TAttLine *attl,
00015                                std::string option)
00016   : GPFBase(display,view,ident,attm,attl),
00017     TGraph(size,x,y), part_(ptc), pt_(pt), option_(option) 
00018 {
00019     
00020   ResetBit(kCanDelete);
00021   SetLineColor(lineAttr_->GetLineColor());
00022   SetLineStyle(lineAttr_->GetLineStyle());
00023   SetMarkerStyle(markerAttr_->GetMarkerStyle());
00024   SetMarkerSize(markerAttr_->GetMarkerSize());
00025   SetMarkerColor(markerAttr_->GetMarkerColor());
00026 }                    
00027 //____________________________________________________________________________________________________________
00028 void GPFSimParticle::Print()
00029 {
00030   std::cout<<*part_<<std::endl;
00031 }
00032 //_______________________________________________________________________________    
00033 void GPFSimParticle::ExecuteEvent(Int_t event, Int_t px, Int_t py)
00034 {
00035   // Execute action corresponding to a left mouse button click 
00036   //on a GPFSimParticle object in the window
00037 
00038   gPad->SetCursor(kHand);
00039   switch (event) {
00040   case kButton1Down:
00041     Print();
00042     display_->findAndDraw(origId_);
00043     break;
00044   default:break;
00045   }    
00046 }
00047 //______________________________________________________________________________
00048 void GPFSimParticle::draw()
00049 {
00050   TGraph::Draw(option_.data());
00051 }
00052 //_______________________________________________________________________________
00053 void GPFSimParticle::setColor()
00054 {
00055   if (option_=="f") SetFillColor(lineAttr_->GetLineColor());
00056   else              SetLineColor(lineAttr_->GetLineColor());
00057   SetMarkerColor(markerAttr_->GetMarkerColor());
00058 }
00059 //_______________________________________________________________________________
00060 void GPFSimParticle::setColor(int newcol)
00061 {
00062   if (option_=="f") SetFillColor(newcol);
00063   else              SetLineColor(newcol);
00064   SetMarkerColor(newcol);
00065 }
00066 //_____________________________________________________________________________
00067 void GPFSimParticle::setInitialColor()
00068 {
00069   if (option_=="f") SetFillColor(lineAttr_->GetLineColor());
00070   else              SetLineColor(lineAttr_->GetLineColor());
00071   SetMarkerColor(markerAttr_->GetMarkerColor());
00072 }
00073 //_____________________________________________________________________________
00074 void GPFSimParticle::setNewSize()
00075 {
00076   SetMarkerSize(markerAttr_->GetMarkerSize());
00077 }
00078 //____________________________________________________________________________
00079 void GPFSimParticle::setNewStyle()
00080 {
00081   SetMarkerStyle(markerAttr_->GetMarkerStyle());
00082 }
00083