CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/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   
00072   double clusEnMin_;
00073   double hitEnMin_;
00074   double trackPtMin_;
00075   double gsfPtMin_;
00076   double particlePtMin_;
00077   double genParticlePtMin_;
00078      
00079   bool drawHits_;
00080   bool drawTracks_;
00081   bool drawGsfTracks_;
00082   bool drawBrems_;
00083   bool drawClus_;
00084   bool drawClusterL_;
00085   bool drawParticles_;
00086   bool drawGenParticles_;
00087   bool drawPFBlocks_;
00088   bool drawHO_;
00089      
00090      
00091   //---------------------- new graphic Container ----------------
00092   //container of all the graphic Objects of one event 
00093   std::multimap<int,GPFBase *>  graphicMap_;
00094   //container of idents/elementNb  of objects within a PFBlock
00095   std::multimap<int , std::pair <int,int> >   blockIdentsMap_;
00096   
00097   //------------- graphic attributes ------------------------------------
00098   std::vector<float>      trackAttributes_;
00099   std::vector<float>      gsfAttributes_;
00100   std::vector<float>      bremAttributes_;
00101   std::vector<float>      clusterAttributes_;
00102   
00103   
00104   TAttMarker *clusPattern_;
00105   TAttMarker *clusPSPattern_;
00106   
00107   TAttMarker *clusPatternecal_;
00108   TAttMarker *clusPatternho_;
00109   TAttMarker *clusPatternhfem_;    
00110 
00111   TAttMarker *trackPatternM_;
00112   TAttLine   *trackPatternL_;
00113   TAttMarker *gsfPatternM_;
00114   TAttLine   *gsfPatternL_;
00115   TAttMarker *bremPatternM_;
00116   TAttLine   *bremPatternL_;
00117   TAttMarker *genPartPattern_;
00118   
00119   TAttLine   *simPartPatternL_;
00120   TAttMarker *simPartPatternPhoton_;
00121   TAttMarker *simPartPatternElec_ ;
00122   TAttMarker *simPartPatternMuon_;
00123   TAttMarker *simPartPatternK_;
00124   TAttMarker *simPartPatternPi_;
00125   TAttMarker *simPartPatternProton_;
00126   TAttMarker *simPartPatternNeutron_;
00127   TAttMarker *simPartPatternDefault_;
00128   
00129   std::vector<TAttMarker *> simPartPatternM_;
00130   
00131   
00132  private:
00133 
00134   PFRootEventManager *em_;
00135    
00137   IO*         options_;      
00138 
00139   double maxERecHitEcal_;
00140   double maxERecHitHcal_;
00141   double maxERecHitHo_;
00142   bool   isGraphicLoaded_;
00143   int    eventNumber_;
00144   int    maxEvents_;
00145   double zoomFactor_;
00146   
00150   int    shiftId_;
00151 
00152   //-------------- draw Canvas --------------------------------------
00154   std::vector<TCanvas*> displayView_;
00155 
00157   std::vector<int>      viewSize_; 
00158         
00160   std::vector<int>         viewSizeEtaPhi_; 
00161 
00163   std::vector<TH2F*>    displayHist_;
00164 
00166   TEllipse frontFaceECALXY_;
00167 
00169   TBox     frontFaceECALRZ_;
00170 
00172   TEllipse frontFaceHCALXY_;
00173 
00175   TEllipse frontFaceHOXY_;
00176   
00177   //----------------  end Draw Canvas ------------------------------------
00178     
00180   //std::vector<std::vector<TLine> >            vectGClusterLines_;
00181   //number of clusterLines by cluster 
00182   //std::vector<std::vector<int> >              vectClusLNb_;
00183     
00184   std::vector<int>                            selectedGObj_;
00185   std::vector<int>                            badBremsId_;
00186      
00187     
00188   // Display Options read from option file
00189   void  getDisplayOptions();
00190      
00191   //DisplayViews
00192   void createCanvas();
00193 
00194   void displayCanvas();
00195      
00196      
00197   //create graphicObjects
00198   void createGRecHit(reco::PFRecHit& rh,int ident, 
00199                      double maxe, double phi0=0. , int color=4);
00200 
00201   void createGCluster(const reco::PFCluster& cluster,
00202                       int ident, double phi0 = 0.);
00203 
00204   void createGTrack(reco::PFRecTrack &tr,
00205                     const std::vector<reco::PFTrajectoryPoint>& points,
00206                     int ident,double pt,double phi0, double sign, 
00207                     bool displayInitial, int linestyle, int kfgsfbrem=0);
00208 
00209   void createGPart(const reco::PFSimParticle &ptc, 
00210                    const std::vector<reco::PFTrajectoryPoint>& points, 
00211                    int ident,double pt,double phi0, double sign, 
00212                    bool displayInitial,int markerIndex);
00213                    
00214   //  void createGGenParticle(HepMC::GenEvent::particle_const_iterator p);                 
00215   void createGGenParticle(HepMC::GenParticle* p);                  
00216 
00217   //void createGClusterLines(const reco::PFCluster& cluster,int viewType);                      
00218   void drawGObject(int ident,int color,bool toInitialColor);
00219 
00220   //fill vectors with graphic Objects
00221   void loadGraphicObjects();
00222 
00223   void loadGRecHits();
00224 
00225   void loadGClusters();
00226 
00227   void loadGRecTracks();
00228 
00229   void loadGGsfRecTracks();
00230 
00231   void loadGSimParticles();
00232 
00233   void loadGPFBlocks();
00234   
00235   void loadGGenParticles();
00236      
00237   //void redraw();
00238   void rubOutGPFBlock();
00239   
00240   // 
00241   void retrieveBadBrems();
00242   bool findBadBremsId(int ident);
00243    
00244 
00245  
00246   // methods
00247   double getMaxE(int layer) const;
00248   double getMaxEEcal();
00249   double getMaxEHcal();
00250   double getMaxEHo();              
00251      
00252      
00253      
00254 };
00255 #endif