CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/RecoParticleFlow/PFRootEvent/interface/DisplayManager.h

Go to the documentation of this file.
00001 #ifndef PF_DisplayManager_h
00002 #define PF_DisplayManager_h
00003 
00004 #include "RecoParticleFlow/PFRootEvent/interface/DisplayCommon.h"
00005 #include "DataFormats/ParticleFlowReco/interface/PFBrem.h"
00006 #include "DataFormats/ParticleFlowReco/interface/PFRecHit.h"
00007 #include "DataFormats/ParticleFlowReco/interface/PFRecTrack.h"
00008 #include "DataFormats/ParticleFlowReco/interface/PFSimParticle.h"
00009 #include "DataFormats/ParticleFlowReco/interface/PFBrem.h"
00010 #include "DataFormats/ParticleFlowReco/interface/PFCluster.h"
00011 #include "DataFormats/ParticleFlowReco/interface/PFCluster.h"
00012 
00013 #include "DataFormats/HepMCCandidate/interface/GenParticle.h"
00014 
00015 #include <TCanvas.h>
00016 #include <TObject.h>
00017 #include <TLine.h>
00018 #include <TBox.h>
00019 #include <TEllipse.h>
00020 #include <string>
00021 #include <map>
00022 
00023 class IO;
00024 
00025 class GPFRecHit;
00026 class GPFCluster;
00027 class GPFTrack;
00028 class GPFSimParticle;
00029 class GPFBase;
00030 class GPFGenParticle;
00031 class PFRootEventManager;
00032 class TH2F; 
00033 
00034 class DisplayManager {
00035   
00036  public:
00037   DisplayManager( PFRootEventManager *em, 
00038                   const char* optfile );
00039   virtual ~DisplayManager();
00040      
00041   void readOptions( const char* file );
00042 
00043   void display(int ientry);
00044   void displayEvent( int run, int lumi, int event); 
00045   void displayAll(bool noRedraw = true);
00046   void displayNext();
00047   void displayNextInteresting(int ientry);
00048   void displayPrevious();
00049   void displayPFBlock(int blockNb) ;
00050   void enableDrawPFBlock(bool state);
00051   void enableDrawBrem(bool state);
00052   void findAndDraw(int ident);
00053   //void findAndDrawbis(const int ident);
00054   void findBlock(int ident) ;
00056   void lookForGenParticle(unsigned barcode);
00058   void lookForMaxRecHit(bool ecal);
00059   void reset();
00060   void updateDisplay();
00061   void unZoom();
00062   void printDisplay(const char* directory="" ) const;
00063   void printGenParticleInfo(std::string name, int barcode, int barcodeMother);
00064   void drawWithNewGraphicAttributes();
00065   void setNewAttrToSimParticles();
00066      
00067   //bool getGLoaded() {return isGraphicLoaded_;}  //util to DialogFrame ?
00068      
00069   //variables
00070   //----------------------graphic options variable ---------------------
00071   double clusEnMin_;
00072   double hitEnMin_;
00073   double trackPtMin_;
00074   double gsfPtMin_;
00075   double particlePtMin_;
00076   double genParticlePtMin_;
00077      
00078   bool drawHits_;
00079   bool drawTracks_;
00080   bool drawGsfTracks_;
00081   bool drawBrems_;
00082   bool drawClus_;
00083   bool drawClusterL_;
00084   bool drawParticles_;
00085   bool drawGenParticles_;
00086   bool drawPFBlocks_;
00087      
00088      
00089   //---------------------- new graphic Container ----------------
00090   //container of all the graphic Objects of one event 
00091   std::multimap<int,GPFBase *>  graphicMap_;
00092   //container of idents/elementNb  of objects within a PFBlock
00093   std::multimap<int , std::pair <int,int> >   blockIdentsMap_;
00094   
00095   //------------- graphic attributes ------------------------------------
00096   std::vector<float>      trackAttributes_;
00097   std::vector<float>      gsfAttributes_;
00098   std::vector<float>      bremAttributes_;
00099   std::vector<float>      clusterAttributes_;
00100   
00101   
00102   TAttMarker *clusPattern_;
00103   TAttMarker *clusPSPattern_;
00104   
00105   TAttMarker *trackPatternM_;
00106   TAttLine   *trackPatternL_;
00107   TAttMarker *gsfPatternM_;
00108   TAttLine   *gsfPatternL_;
00109   TAttMarker *bremPatternM_;
00110   TAttLine   *bremPatternL_;
00111   TAttMarker *genPartPattern_;
00112   
00113   TAttLine   *simPartPatternL_;
00114   TAttMarker *simPartPatternPhoton_;
00115   TAttMarker *simPartPatternElec_ ;
00116   TAttMarker *simPartPatternMuon_;
00117   TAttMarker *simPartPatternK_;
00118   TAttMarker *simPartPatternPi_;
00119   TAttMarker *simPartPatternProton_;
00120   TAttMarker *simPartPatternNeutron_;
00121   TAttMarker *simPartPatternDefault_;
00122   
00123   std::vector<TAttMarker *> simPartPatternM_;
00124   
00125   
00126  private:
00127 
00128   PFRootEventManager *em_;
00129    
00131   IO*         options_;      
00132 
00133   double maxERecHitEcal_;
00134   double maxERecHitHcal_;
00135   bool   isGraphicLoaded_;
00136   int    eventNumber_;
00137   int    maxEvents_;
00138   double zoomFactor_;
00139   
00143   int    shiftId_;
00144 
00145   //-------------- draw Canvas --------------------------------------
00147   std::vector<TCanvas*> displayView_;
00148 
00150   std::vector<int>      viewSize_; 
00151         
00153   std::vector<int>         viewSizeEtaPhi_; 
00154 
00156   std::vector<TH2F*>    displayHist_;
00157 
00159   TEllipse frontFaceECALXY_;
00160 
00162   TBox     frontFaceECALRZ_;
00163 
00165   TEllipse frontFaceHCALXY_;
00166   
00167   //----------------  end Draw Canvas ------------------------------------
00168     
00170   //std::vector<std::vector<TLine> >            vectGClusterLines_;
00171   //number of clusterLines by cluster 
00172   //std::vector<std::vector<int> >              vectClusLNb_;
00173     
00174   std::vector<int>                            selectedGObj_;
00175   std::vector<int>                            badBremsId_;
00176      
00177     
00178   // Display Options read from option file
00179   void  getDisplayOptions();
00180      
00181   //DisplayViews
00182   void createCanvas();
00183 
00184   void displayCanvas();
00185      
00186      
00187   //create graphicObjects
00188   void createGRecHit(reco::PFRecHit& rh,int ident, 
00189                      double maxe, double phi0=0. , int color=4);
00190 
00191   void createGCluster(const reco::PFCluster& cluster,
00192                       int ident, double phi0 = 0.);
00193 
00194   void createGTrack(reco::PFRecTrack &tr,
00195                     const std::vector<reco::PFTrajectoryPoint>& points,
00196                     int ident,double pt,double phi0, double sign, 
00197                     bool displayInitial, int linestyle, int kfgsfbrem=0);
00198 
00199   void createGPart(const reco::PFSimParticle &ptc, 
00200                    const std::vector<reco::PFTrajectoryPoint>& points, 
00201                    int ident,double pt,double phi0, double sign, 
00202                    bool displayInitial,int markerIndex);
00203                    
00204   //  void createGGenParticle(HepMC::GenEvent::particle_const_iterator p);                 
00205   void createGGenParticle(HepMC::GenParticle* p);                  
00206 
00207   //void createGClusterLines(const reco::PFCluster& cluster,int viewType);                      
00208   void drawGObject(int ident,int color,bool toInitialColor);
00209 
00210   //fill vectors with graphic Objects
00211   void loadGraphicObjects();
00212 
00213   void loadGRecHits();
00214 
00215   void loadGClusters();
00216 
00217   void loadGRecTracks();
00218 
00219   void loadGGsfRecTracks();
00220 
00221   void loadGSimParticles();
00222 
00223   void loadGPFBlocks();
00224   
00225   void loadGGenParticles();
00226      
00227   //void redraw();
00228   void rubOutGPFBlock();
00229   
00230   // 
00231   void retrieveBadBrems();
00232   bool findBadBremsId(int ident);
00233    
00234 
00235  
00236   // methods
00237   double getMaxE(int layer) const;
00238   double getMaxEEcal();
00239   double getMaxEHcal();
00240                
00241      
00242      
00243      
00244 };
00245 #endif