CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/RecoParticleFlow/PFRootEvent/src/GPFGenParticle.cc

Go to the documentation of this file.
00001 #include "RecoParticleFlow/PFRootEvent/interface/GPFGenParticle.h"
00002 #include "RecoParticleFlow/PFRootEvent/interface/DisplayManager.h"
00003 #include "TObject.h"
00004 #include "TPad.h"
00005 
00006 //________________________________________________________________
00007 GPFGenParticle::GPFGenParticle(DisplayManager * display,
00008                                int view,int ident,
00009                                double x,double y,double e, double pt,int barcode,
00010                                TAttMarker *attm,std::string name, std::string latexName)
00011   :  GPFBase(display,view,ident, attm ),
00012      TMarker(x,y,1),
00013      TLatex(x,y,latexName.c_str()),
00014      en_(e),pt_(pt),name_(name),barcode_(barcode),
00015      barcodeMother_(0),
00016      line_(0) {
00017     
00018   //ResetBit(kCanDelete);
00019   SetMarkerColor(markerAttr_->GetMarkerColor());
00020   SetMarkerStyle(markerAttr_->GetMarkerStyle());
00021   SetMarkerSize(markerAttr_->GetMarkerSize());
00022 }   
00023 //________________________________________________________________
00024 GPFGenParticle::GPFGenParticle(DisplayManager * display,
00025                                int view,int ident,
00026                                double *x,double *y,
00027                                double e, double pt,int barcode,int barcodeMother,
00028                                TAttMarker *attm,std::string name, std::string latexName)
00029   :  GPFBase(display,view,ident, attm ),
00030      TMarker(x[1],y[1],1),
00031      TLatex(x[1],y[1],latexName.c_str()),
00032      en_(e),pt_(pt),name_(name),barcode_(barcode),
00033      barcodeMother_(barcodeMother),
00034      line_(0) {
00035     
00036   //ResetBit(kCanDelete);
00037   SetMarkerColor(markerAttr_->GetMarkerColor());
00038   SetMarkerStyle(markerAttr_->GetMarkerStyle());
00039   SetMarkerSize(markerAttr_->GetMarkerSize());
00040   line_ = new TLine(x[0],y[0],x[1],y[1]);
00041   line_->SetLineColor(markerAttr_->GetMarkerColor());
00042 }
00043    
00044 //_________________________________________________________________
00045 void GPFGenParticle::Print()
00046 {
00047   display_->printGenParticleInfo(name_,barcode_,barcodeMother_);
00048 }
00049 //_________________________________________________________________
00050 void GPFGenParticle::ExecuteEvent(Int_t event, Int_t px, Int_t py)
00051 {
00052   // Execute action corresponding to a mouse click 
00053 
00054   gPad->SetCursor(kHand);
00055   switch (event) {
00056   case kButton1Down:
00057     Print();
00058     break;
00059   default:break;
00060   }    
00061 }
00062 //_________________________________________________________________ 
00063 void GPFGenParticle::draw()
00064 {
00065   TMarker::Draw();
00066   SetTextFont(42);
00067   SetTextSize(0.05);
00068   TLatex::Draw();
00069   if(line_) line_->Draw();
00070 }  
00071 //_________________________________________________________________
00072 void GPFGenParticle::setColor()
00073 {
00074   SetMarkerColor(markerAttr_->GetMarkerColor());
00075 }
00076 //_________________________________________________________________
00077 void GPFGenParticle::setColor(int newcol)
00078 {
00079   SetMarkerColor(newcol);
00080 }
00081 //_________________________________________________________________
00082 void GPFGenParticle::setInitialColor()
00083 {
00084   SetMarkerColor(markerAttr_->GetMarkerColor());
00085 }
00086 //_________________________________________________________________
00087 void GPFGenParticle::setNewStyle()
00088 {
00089   SetMarkerStyle(markerAttr_->GetMarkerStyle());
00090 }
00091 //_________________________________________________________________
00092 void GPFGenParticle::setNewSize()
00093 {
00094   SetMarkerSize(markerAttr_->GetMarkerSize());
00095 }
00096