CMS 3D CMS Logo

DisplayManager Class Reference

#include <RecoParticleFlow/PFRootEvent/interface/DisplayManager.h>

List of all members.

Public Member Functions

void display (int ientry)
void displayAll (bool noRedraw=true)
 DisplayManager (PFRootEventManager *em, const char *optfile)
void displayNext ()
void displayNextInteresting (int ientry)
void displayPFBlock (int blockNb)
void displayPrevious ()
void drawWithNewGraphicAttributes ()
void enableDrawPFBlock (bool state)
void findAndDraw (int ident)
void findBlock (int ident)
void lookForGenParticle (unsigned barcode)
 look for particle with index i in MC truth.
void lookForMaxRecHit (bool ecal)
 look for rechit with max energy in ecal or hcal.
void printDisplay (const char *directory="") const
void printGenParticleInfo (std::string name, int barcode, int barcodeMother)
void readOptions (const char *file)
void reset ()
void setNewAttrToSimParticles ()
void unZoom ()
void updateDisplay ()
virtual ~DisplayManager ()

Public Attributes

std::multimap< int, std::pair
< int, int > > 
blockIdentsMap_
double clusEnMin_
TAttMarker * clusPattern_
TAttMarker * clusPSPattern_
std::vector< intclusterAttributes_
bool drawClus_
bool drawClusterL_
bool drawGenParticles_
bool drawHits_
bool drawParticles_
bool drawPFBlocks_
bool drawTracks_
double genParticlePtMin_
TAttMarker * genPartPattern_
std::multimap< int, GPFBase * > graphicMap_
double hitEnMin_
double particlePtMin_
TAttMarker * simPartPatternDefault_
TAttMarker * simPartPatternElec_
TAttMarker * simPartPatternK_
TAttLine * simPartPatternL_
std::vector< TAttMarker * > simPartPatternM_
TAttMarker * simPartPatternMuon_
TAttMarker * simPartPatternNeutron_
TAttMarker * simPartPatternPhoton_
TAttMarker * simPartPatternPi_
TAttMarker * simPartPatternProton_
std::vector< inttrackAttributes_
TAttLine * trackPatternL_
TAttMarker * trackPatternM_
double trackPtMin_

Private Member Functions

void createCanvas ()
void createGCluster (const reco::PFCluster &cluster, int ident, double phi0=0.)
void createGGenParticle (HepMC::GenParticle *p)
void createGPart (const reco::PFSimParticle &ptc, const std::vector< reco::PFTrajectoryPoint > &points, int ident, double pt, double phi0, double sign, bool displayInitial, int markerIndex)
void createGRecHit (reco::PFRecHit &rh, int ident, double maxe, double phi0=0., int color=4)
void createGTrack (reco::PFRecTrack &tr, const std::vector< reco::PFTrajectoryPoint > &points, int ident, double pt, double phi0, double sign, bool displayInitial, int linestyle)
void displayCanvas ()
void drawGObject (int ident, int color, bool toInitialColor)
void getDisplayOptions ()
double getMaxE (int layer) const
double getMaxEEcal ()
double getMaxEHcal ()
void loadGClusters ()
void loadGGenParticles ()
void loadGPFBlocks ()
void loadGraphicObjects ()
void loadGRecHits ()
void loadGRecTracks ()
void loadGSimParticles ()
void rubOutGPFBlock ()

Private Attributes

std::vector< TH2F * > displayHist_
 support histogram for x/y or r/z display.
std::vector< TCanvas * > displayView_
 vector of canvas for x/y or r/z display
PFRootEventManagerem_
int eventNumber_
TBox frontFaceECALRZ_
 ECAL in RZ view.
TEllipse frontFaceECALXY_
 ECAL in XY view.
TEllipse frontFaceHCALXY_
 HCAL in XY view.
bool isGraphicLoaded_
double maxERecHitEcal_
double maxERecHitHcal_
int maxEvents_
IOoptions_
 options file parser
std::vector< intselectedGObj_
 graphic object containers
int shiftId_
std::vector< intviewSize_
 display pad xy size for (x,y) or (r,z) display
std::vector< intviewSizeEtaPhi_
 display pad xy size for eta/phi view
double zoomFactor_


Detailed Description

Definition at line 23 of file DisplayManager.h.


Constructor & Destructor Documentation

DisplayManager::DisplayManager ( PFRootEventManager em,
const char *  optfile 
)

Definition at line 38 of file DisplayManager.cc.

References createCanvas(), em_, PFRootEventManager::eventNumber(), eventNumber_, maxEvents_, readOptions(), and PFRootEventManager::tree_.

00039                                                      : 
00040   em_(em), 
00041   options_(0),
00042   maxERecHitEcal_(-1),
00043   maxERecHitHcal_(-1),
00044   isGraphicLoaded_(false),
00045   shiftId_(27) {
00046         
00047   readOptions( optfile );
00048         
00049   eventNumber_  = em_->eventNumber();
00050   //TODOLIST: re_initialize if new option file- better in em
00051   maxEvents_= em_->tree_->GetEntries();  
00052         
00053   createCanvas();
00054 }

DisplayManager::~DisplayManager (  )  [virtual]

Definition at line 56 of file DisplayManager.cc.

References reset().

00057 {
00058   reset();
00059 } 


Member Function Documentation

void DisplayManager::createCanvas (  )  [private]

Definition at line 181 of file DisplayManager.cc.

References displayHist_, displayView_, PFGeometry::ECALBarrel, PFGeometry::ECALEndcap, EPE, EPH, frontFaceECALRZ_, frontFaceECALXY_, frontFaceHCALXY_, PFGeometry::HCALBarrel, PFGeometry::innerRadius(), PFGeometry::innerZ(), NViews, RZ, viewSize_, and XY.

Referenced by DisplayManager().

00182 {
00183         
00184   //TODOLIST: better TCanvas *displayView_[4]
00185   displayView_.resize(NViews);
00186   displayHist_.resize(NViews);
00187         
00188   // TODOLIST:Canvases size  
00189   // Add menu to mofify canvas size
00190   // Add menu of views to be drawn
00191         
00192         
00193   displayView_[XY] = new TCanvas("displayXY_", "XY view",viewSize_[0], viewSize_[1]);
00194   displayView_[RZ] = new TCanvas("displayRZ_", "RZ view",viewSize_[0], viewSize_[1]);
00195   displayView_[EPE] = new TCanvas("displayEPE_", "eta/phi view, ECAL",viewSize_[0], viewSize_[1]);
00196   displayView_[EPH] = new TCanvas("displayEPH_", "eta/phi view, HCAL",viewSize_[0], viewSize_[1]);
00197         
00198         
00199   for (int viewType=0;viewType<NViews;++viewType) {
00200     displayView_[viewType]->SetGrid(0, 0);
00201     displayView_[viewType]->SetLeftMargin(0.12);
00202     displayView_[viewType]->SetBottomMargin(0.12);
00203     displayView_[viewType]->ToggleToolBar();
00204   } 
00205     
00206   // Draw support histogram
00207   double zLow = -500.;
00208   double zUp  = +500.;
00209   double rLow = -300.;
00210   double rUp  = +300.;
00211   displayHist_[XY] = new TH2F("hdisplayHist_XY", "", 500, rLow, rUp, 
00212                               500, rLow, rUp);
00213   displayHist_[XY]->SetXTitle("X");
00214   displayHist_[XY]->SetYTitle("Y");
00215         
00216   displayHist_[RZ] = new TH2F("hdisplayHist_RZ", "",500, zLow, zUp, 
00217                               500, rLow, rUp); 
00218   displayHist_[RZ]->SetXTitle("Z");
00219   displayHist_[RZ]->SetYTitle("R");
00220         
00221   displayHist_[EPE] = new TH2F("hdisplayHist_EP", "", 500, -5, 5, 
00222                                500, -3.5, 3.5);
00223   displayHist_[EPE]->SetXTitle("#eta");
00224   displayHist_[EPE]->SetYTitle("#phi");
00225         
00226   displayHist_[EPH] = displayHist_[EPE];
00227         
00228   for (int viewType=0;viewType<NViews;++viewType){
00229     displayHist_[viewType]->SetStats(kFALSE);
00230   }  
00231         
00232   // Draw ECAL front face
00233   frontFaceECALXY_.SetX1(0);
00234   frontFaceECALXY_.SetY1(0);
00235   frontFaceECALXY_.SetR1(PFGeometry::innerRadius(PFGeometry::ECALBarrel));
00236   frontFaceECALXY_.SetR2(PFGeometry::innerRadius(PFGeometry::ECALBarrel));
00237   frontFaceECALXY_.SetFillStyle(0);
00238         
00239   // Draw HCAL front face
00240   frontFaceHCALXY_.SetX1(0);
00241   frontFaceHCALXY_.SetY1(0);
00242   frontFaceHCALXY_.SetR1(PFGeometry::innerRadius(PFGeometry::HCALBarrel));
00243   frontFaceHCALXY_.SetR2(PFGeometry::innerRadius(PFGeometry::HCALBarrel));
00244   frontFaceHCALXY_.SetFillStyle(0);
00245         
00246   // Draw ECAL side
00247   frontFaceECALRZ_.SetX1(-1.*PFGeometry::innerZ(PFGeometry::ECALEndcap));
00248   frontFaceECALRZ_.SetY1(-1.*PFGeometry::innerRadius(PFGeometry::ECALBarrel));
00249   frontFaceECALRZ_.SetX2(PFGeometry::innerZ(PFGeometry::ECALEndcap));
00250   frontFaceECALRZ_.SetY2(PFGeometry::innerRadius(PFGeometry::ECALBarrel));
00251   frontFaceECALRZ_.SetFillStyle(0);
00252         
00253 }

void DisplayManager::createGCluster ( const reco::PFCluster cluster,
int  ident,
double  phi0 = 0. 
) [private]

Definition at line 255 of file DisplayManager.cc.

References clusPattern_, clusPSPattern_, funct::cos(), EPE, EPH, eta, graphicMap_, reco::PFCluster::layer(), phi, reco::CaloCluster::position(), PFLayer::PS1, PFLayer::PS2, RZ, XY, and reco::CaloCluster::z().

Referenced by loadGClusters().

00258 {
00259 
00260   double eta = cluster.position().Eta();
00261   double phi = cluster.position().Phi();
00262   
00263   //   int type = cluster.type();
00264   //   if(algosToDisplay_.find(type) == algosToDisplay_.end() )
00265   //     return;
00266         
00267   //   TCutG* cutg = (TCutG*) gROOT->FindObject("CUTG");  
00268   //   if( cutg && !cutg->IsInside( eta, phi ) ) return;
00269         
00270         
00271   //int color = clusterAttributes_[2];
00272   //if ( cluster.layer()==PFLayer::PS1 || cluster.layer()==PFLayer::PS2 )
00273   //  color = clusterAttributes_[3];
00274     
00275   //int markerSize = clusterAttributes_[1];
00276   //int markerStyle = clusterAttributes_[0];
00277         
00278   int clusType=0;
00279         
00280   if ( cluster.layer()==PFLayer::PS1 || cluster.layer()==PFLayer::PS2 )
00281     clusType=1;  
00282 
00283   const math::XYZPoint& xyzPos = cluster.position();
00284 
00285   GPFCluster *gc;
00286         
00287   for (int viewType=0;viewType<4;viewType++){
00288                 
00289     switch(viewType) {
00290     case XY:
00291       {
00292         if (clusType==0) {
00293           gc = new  GPFCluster(this,
00294                                viewType,ident,
00295                                &cluster,
00296                                xyzPos.X(), xyzPos.Y(), clusPattern_);
00297         }
00298         else {
00299           gc = new  GPFCluster(this,
00300                                viewType,ident,
00301                                &cluster,
00302                                xyzPos.X(), xyzPos.Y(), clusPSPattern_);
00303         }                                     
00304         graphicMap_.insert(pair<int,GPFBase *> (ident, gc));
00305       }
00306       break;
00307     case RZ:
00308       {
00309         double sign = 1.;
00310         if (cos(phi0 - phi) < 0.)
00311           sign = -1.;
00312         if ( clusType==0) { 
00313           gc = new  GPFCluster(this,
00314                                viewType,ident,
00315                                &cluster,
00316                                xyzPos.z(),sign*xyzPos.Rho(),
00317                                clusPattern_);
00318         }
00319         else {
00320           gc = new  GPFCluster(this,
00321                                viewType,ident,
00322                                &cluster,
00323                                xyzPos.z(),sign*xyzPos.Rho(),
00324                                clusPattern_);
00325         }
00326                                          
00327         graphicMap_.insert(pair<int,GPFBase *>  (ident, gc));                    
00328 
00329       } 
00330       break;
00331     case EPE:
00332       {
00333         if( cluster.layer()<0 ) {
00334           if (clusType==0) {
00335             gc = new  GPFCluster(this,
00336                                  viewType,ident,
00337                                  &cluster,
00338                                  eta,phi,
00339                                  clusPattern_);
00340           }
00341           else {
00342             gc = new  GPFCluster(this,
00343                                  viewType,ident,
00344                                  &cluster,
00345                                  eta,phi,
00346                                  clusPSPattern_);
00347           }                              
00348                                          
00349           graphicMap_.insert(pair<int,GPFBase *>        (ident, gc));                    
00350         }
00351 
00352       } 
00353       break;
00354     case EPH:
00355       {
00356         if( cluster.layer()>0 ) {
00357           if (clusType==0) {
00358             gc = new  GPFCluster(this,
00359                                  viewType,ident,
00360                                  &cluster,
00361                                  eta,phi,clusPattern_);
00362           }
00363           else {
00364             gc = new  GPFCluster(this,
00365                                  viewType,ident,
00366                                  &cluster,
00367                                  eta,phi,clusPSPattern_);
00368           }
00369             
00370                                          
00371           graphicMap_.insert(pair<int,GPFBase *>        (ident, gc));          
00372         }
00373       } 
00374       break;
00375     default :break; 
00376     } 
00377   }      
00378 }

void DisplayManager::createGGenParticle ( HepMC::GenParticle *  p  )  [private]

Definition at line 1157 of file DisplayManager.cc.

References e, em_, eta, GENPARTICLEID, genPartPattern_, PFRootEventManager::getGenParticleName(), graphicMap_, name, NViews, phi, shiftId_, x, and y.

Referenced by loadGGenParticles().

01158 {
01159   // these are the beam protons
01160   if ( !p->production_vertex() && p->pdg_id() == 2212 ) return;
01161     
01162   int partId = p->pdg_id();
01163 
01164   std::string name;
01165   std::string latexStringName;
01166 
01167   name = em_->getGenParticleName(partId,latexStringName);
01168   int barcode = p->barcode();
01169   int genPartId=(GENPARTICLEID<<shiftId_) | barcode;
01170     
01171     
01172 //   int vertexId1 = 0;
01173 //   vertexId1 = p->production_vertex()->barcode();
01174     
01175 //   math::XYZVector vertex1 (p->production_vertex()->position().x()/10.,
01176 //                            p->production_vertex()->position().y()/10.,
01177 //                            p->production_vertex()->position().z()/10.);
01178                              
01179   math::XYZTLorentzVector momentum1(p->momentum().px(),
01180                                     p->momentum().py(),
01181                                     p->momentum().pz(),
01182                                     p->momentum().e());
01183                                       
01184   double eta = momentum1.eta();
01185   if ( eta > +10. ) eta = +10.;
01186   if ( eta < -10. ) eta = -10.;
01187     
01188   double phi = momentum1.phi();
01189     
01190   double pt = momentum1.pt();
01191   double e = momentum1.e();
01192     
01193   //mother ?    
01194 
01195   // Colin: the following line gives a segmentation fault when there is 
01196   // no particles entering the production vertex.
01197     
01198   // const HepMC::GenParticle* mother = 
01199   //  *(p->production_vertex()->particles_in_const_begin());
01200     
01201   // protecting against this in the following way:
01202   const HepMC::GenParticle* mother = 0;
01203   if(p->production_vertex() && 
01204      p->production_vertex()->particles_in_size() ) {
01205     mother = 
01206       *(p->production_vertex()->particles_in_const_begin()); 
01207   }
01208 
01209   // Colin: no need to declare this pointer in this context.
01210   // the declaration can be more local.
01211   // GPFGenParticle *gp; 
01212 
01213   if ( mother ) {
01214     int barcodeMother = mother->barcode();
01215     math::XYZTLorentzVector momentumMother(mother->momentum().px(),
01216                                            mother->momentum().py(),
01217                                            mother->momentum().pz(),
01218                                            mother->momentum().e());
01219     double etaMother = momentumMother.eta();                                  
01220     if ( etaMother > +10. ) etaMother = +10.;
01221     if ( etaMother < -10. ) etaMother = -10.;
01222     double phiMother = momentumMother.phi();
01223     
01224        
01225     double x[2],y[2];
01226     x[0]=etaMother;x[1]=eta;
01227     y[0]=phiMother;y[1]=phi;
01228        
01229     for (int view = 2; view< NViews; view++) {
01230       GPFGenParticle* gp   = new GPFGenParticle(this,             
01231                                                 view, genPartId,
01232                                                 x, y,              //double *, double *
01233                                                 e,pt,barcode,barcodeMother,
01234                                                 genPartPattern_, 
01235                                                 name,latexStringName);
01236       graphicMap_.insert(pair<int,GPFBase *>    (genPartId, gp));
01237     }
01238   }
01239   else {     //no Mother    
01240     for (int view = 2; view< NViews; view++) {
01241       GPFGenParticle* gp   = new GPFGenParticle(this,
01242                                                 view, genPartId,
01243                                                 eta, phi,                  //double double
01244                                                 e,pt,barcode,
01245                                                 genPartPattern_,
01246                                                 name, latexStringName);
01247       graphicMap_.insert(pair<int,GPFBase *>    (genPartId, gp));
01248     }                                         
01249   }
01250 }

void DisplayManager::createGPart ( const reco::PFSimParticle ptc,
const std::vector< reco::PFTrajectoryPoint > &  points,
int  ident,
double  pt,
double  phi0,
double  sign,
bool  displayInitial,
int  markerIndex 
) [private]

no point inside graphical cut.

Definition at line 380 of file DisplayManager.cc.

References reco::PFTrajectoryPoint::ClosestApproach, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), EPE, EPH, eta, graphicMap_, i, phi, RZ, simPartPatternL_, simPartPatternM_, and XY.

Referenced by loadGSimParticles().

00384 {
00385   //bool inside = false; 
00386   //TCutG* cutg = (TCutG*) gROOT->FindObject("CUTG");
00387   bool debug_createGpart = false;
00388   //    bool debug_createGpart = true;
00389   for (int viewType=0;viewType<4;++viewType) {
00390     // reserving space. nb not all trajectory points are valid
00391     vector<double> xPos;
00392     xPos.reserve( points.size() );
00393     vector<double> yPos;
00394     yPos.reserve( points.size() );
00395                 
00396     for(unsigned i=0; i<points.size(); i++) {
00397 
00398       if( !points[i].isValid() ) continue;
00399         
00400       const math::XYZPoint& xyzPos = points[i].position();      
00401 
00402       double eta = xyzPos.Eta();
00403       double phi = xyzPos.Phi();
00404                         
00405       // always take momentum for the first point 
00406       // otherwise decay products from resonances will have wrong eta, phi
00407       //calculated from position (0,0,0) (MDN 11 June 2008)
00408       if( points[i].layer() == reco::PFTrajectoryPoint::ClosestApproach ) {
00409                                 
00410         //      if( !displayInitial && 
00411         //              points[i].layer() == reco::PFTrajectoryPoint::ClosestApproach ) {
00412         const math::XYZTLorentzVector& mom = points[i].momentum();
00413         eta = mom.Eta();
00414         phi = mom.Phi();
00415       }
00416                         
00417       //if( !cutg || cutg->IsInside( eta, phi ) ) 
00418       //  inside = true;
00419                         
00420       switch(viewType) {
00421       case XY:
00422         xPos.push_back(xyzPos.X());
00423         yPos.push_back(xyzPos.Y());
00424         break;
00425       case RZ:
00426         xPos.push_back(xyzPos.Z());
00427         yPos.push_back(sign*xyzPos.Rho());
00428         break;
00429       case EPE:
00430       case EPH:
00431         xPos.push_back( eta );
00432         yPos.push_back( phi );
00433         break;
00434       default:break;
00435       }
00436     }  
00437     if (viewType == EPE && debug_createGpart) {
00438       cout << " display PFsim eta/phi view ECAL" << endl;
00439       cout << " nb of points for display " << xPos.size() << endl;
00440       for(unsigned i=0; i<xPos.size(); i++) {
00441         cout << " point " << i << " x/y " << xPos[i] <<"/" << yPos[i]<< endl;
00442       }
00443     }
00444                 
00446     //if( !inside ) return;
00447     //int color = 4;
00448     GPFSimParticle *gc   = new GPFSimParticle(this,
00449                                               viewType, ident,
00450                                               &ptc,
00451                                               xPos.size(),&xPos[0],&yPos[0],
00452                                               pt,
00453                                               simPartPatternM_[markerIndex],
00454                                               simPartPatternL_,
00455                                               "pl");
00456                                               
00457     graphicMap_.insert(pair<int,GPFBase *>      (ident, gc));                                 
00458     //graphicMap_.insert(pair<int,GPFBase *> (ident,new GPFSimParticle(this,viewType,ident,&ptc,xPos.size(),&xPos[0],&yPos[0],pt,simPartPattern_[indexMarker], "pl")));
00459   }
00460 }

void DisplayManager::createGRecHit ( reco::PFRecHit rh,
int  ident,
double  maxe,
double  phi0 = 0.,
int  color = 4 
) [private]

Definition at line 462 of file DisplayManager.cc.

References TestMuL1L2Filter_cff::cerr, PFRootEventManager::clusterAlgoECAL_, PFRootEventManager::clusterAlgoHCAL_, PFRootEventManager::clusterAlgoPS_, funct::cos(), PFLayer::ECAL_BARREL, PFLayer::ECAL_ENDCAP, em_, lat::endl(), reco::PFRecHit::energy(), EPE, EPH, eta, reco::PFRecHit::getCornersXYZ(), graphicMap_, PFLayer::HCAL_BARREL1, PFLayer::HCAL_BARREL2, PFLayer::HCAL_ENDCAP, PFLayer::HCAL_HF, i1, i2, reco::PFRecHit::layer(), funct::log(), me, phi, Pi, reco::PFRecHit::position(), PFLayer::PS1, PFLayer::PS2, r, RZ, PFClusterAlgo::threshBarrel(), PFClusterAlgo::threshEndcap(), x, XY, y, and z.

Referenced by loadGRecHits().

00463 {
00464         
00465   double me = maxe;
00466   double thresh = 0;
00467   int layer = rh.layer();
00468         
00469         
00470   switch(layer) {
00471   case PFLayer::ECAL_BARREL:
00472     thresh = em_->clusterAlgoECAL_.threshBarrel();
00473     break;     
00474   case PFLayer::ECAL_ENDCAP:
00475     thresh = em_->clusterAlgoECAL_.threshEndcap();
00476     break;     
00477   case PFLayer::HCAL_BARREL1:
00478   case PFLayer::HCAL_BARREL2:
00479     thresh = em_->clusterAlgoHCAL_.threshBarrel();
00480     break;           
00481   case PFLayer::HCAL_ENDCAP:
00482     thresh = em_->clusterAlgoHCAL_.threshEndcap();
00483     break;           
00484   case PFLayer::HCAL_HF: 
00485     // how to handle a different threshold for HF?
00486     thresh = em_->clusterAlgoHCAL_.threshEndcap();
00487     break;           
00488   case PFLayer::PS1:
00489   case PFLayer::PS2:
00490     me = -1;
00491     thresh = em_->clusterAlgoPS_.threshBarrel();
00492     break;
00493   default:
00494     {
00495       cerr<<"DisplayManager::createGRecHit : manage other layers."
00496           <<" GRechit notcreated."<<endl;
00497       return;
00498     }
00499   }
00500   if( rh.energy() < thresh ) return;
00501         
00502   //loop on all views
00503   for(int viewType=0;viewType<4;++viewType) {
00504   
00505     bool isHCAL = (layer == PFLayer::HCAL_BARREL1 || 
00506                    layer == PFLayer::HCAL_BARREL2 || 
00507                    layer == PFLayer::HCAL_ENDCAP || 
00508                    layer == PFLayer::HCAL_HF);
00509     
00510     if(  viewType == EPH && 
00511          ! isHCAL) {
00512       continue;
00513     }
00514     // on EPE view, draw only HCAL and preshower
00515     if(  viewType == EPE && isHCAL ) {
00516       continue;
00517     }
00518     double rheta = rh.position().Eta();
00519     double rhphi = rh.position().Phi();
00520 
00521     double sign = 1.;
00522     if (cos(phi0 - rhphi) < 0.) sign = -1.;
00523                 
00524                 
00525     double etaSize[4];
00526     double phiSize[4];
00527     double x[5];
00528     double y[5];
00529     double z[5];
00530     double r[5];
00531     double eta[5];
00532     double phi[5];
00533     double xprop[5];
00534     double yprop[5];
00535     double etaprop[5];
00536     double phiprop[5];
00537                 
00538                 
00539     const std::vector< math::XYZPoint >& corners = rh.getCornersXYZ();
00540     assert(corners.size() == 4);
00541     double propfact = 0.95; // so that the cells don't overlap ? 
00542     double ampl=0;
00543     if(me>0) ampl = (log(rh.energy() + 1.)/log(me + 1.));
00544     for ( unsigned jc=0; jc<4; ++jc ) { 
00545 
00546       phiSize[jc] = rhphi-corners[jc].Phi();
00547       etaSize[jc] = rheta-corners[jc].Eta();
00548       if ( phiSize[jc] > 1. ) phiSize[jc] -= 2.*TMath::Pi();  
00549       if ( phiSize[jc] < -1. ) phiSize[jc]+= 2.*TMath::Pi();
00550 
00551       phiSize[jc] *= propfact;
00552       etaSize[jc] *= propfact;
00553                         
00554       math::XYZPoint cornerposxyz = corners[jc];
00555                         
00556       x[jc] = cornerposxyz.X();
00557       y[jc] = cornerposxyz.Y();
00558       z[jc] = cornerposxyz.Z();
00559       r[jc] = sign*cornerposxyz.Rho();
00560       eta[jc] = rheta - etaSize[jc];
00561       phi[jc] = rhphi - phiSize[jc];
00562                         
00563                         
00564       // cell area is prop to log(E)
00565       // not drawn for preshower. 
00566       // otherwise, drawn for eta/phi view, and for endcaps in xy view
00567       if( layer != PFLayer::PS1 && 
00568           layer != PFLayer::PS2 && 
00569           ( viewType == EPE || 
00570             viewType == EPH || 
00571             ( viewType == XY &&  
00572               ( layer == PFLayer::ECAL_ENDCAP || 
00573                 layer == PFLayer::HCAL_ENDCAP || 
00574                 layer == PFLayer::HCAL_HF
00575                 ) ) ) ) {
00576       
00577       
00578         math::XYZPoint centreXYZrot = rh.position();
00579 
00580         math::XYZPoint centertocorner(x[jc] - centreXYZrot.X(), 
00581                                       y[jc] - centreXYZrot.Y(),
00582                                       0 );
00583                                 
00584         math::XYZPoint centertocornerep(eta[jc] - centreXYZrot.Eta(), 
00585                                         phi[jc] - centreXYZrot.Phi(),
00586                                         0 );
00587                                 
00588                                 
00589         // centertocorner -= centreXYZrot;
00590         xprop[jc] = centreXYZrot.X() + centertocorner.X()*ampl;
00591         yprop[jc] = centreXYZrot.Y() + centertocorner.Y()*ampl;
00592                                 
00593         etaprop[jc] = centreXYZrot.Eta() + centertocornerep.X()*ampl;
00594         phiprop[jc] = centreXYZrot.Phi() + centertocornerep.Y()*ampl;
00595       }
00596     }//loop on jc 
00597                 
00598     if(layer == PFLayer::ECAL_BARREL  || 
00599        layer == PFLayer::HCAL_BARREL1 || 
00600        layer == PFLayer::HCAL_BARREL2 || viewType == RZ) {
00601                         
00602       // we are in the barrel. Determining which corners to shift 
00603       // away from the center to represent the cell energy
00604                         
00605       int i1 = -1;
00606       int i2 = -1;
00607                         
00608       if(fabs(phiSize[1]-phiSize[0]) > 0.0001) {
00609         if (viewType == XY) {
00610           i1 = 2;
00611           i2 = 3;
00612         } else if (viewType == RZ) {
00613           i1 = 1;
00614           i2 = 2;
00615         }
00616       } else {
00617         if (viewType == XY) {
00618           i1 = 1;
00619           i2 = 2;
00620         } else if (viewType == RZ) {
00621           i1 = 2;
00622           i2 = 3;
00623         }
00624       }
00625                         
00626       x[i1] *= 1+ampl/2.;
00627       x[i2] *= 1+ampl/2.;
00628       y[i1] *= 1+ampl/2.;
00629       y[i2] *= 1+ampl/2.;
00630       z[i1] *= 1+ampl/2.;
00631       z[i2] *= 1+ampl/2.;
00632       r[i1] *= 1+ampl/2.;
00633       r[i2] *= 1+ampl/2.;
00634     }
00635     x[4]=x[0];
00636     y[4]=y[0]; // closing the polycell
00637     z[4]=z[0];
00638     r[4]=r[0]; // closing the polycell
00639     eta[4]=eta[0];
00640     phi[4]=phi[0]; // closing the polycell
00641                 
00642     int npoints=5;
00643                 
00644     switch( viewType ) {
00645     case  XY:
00646       {
00647         if(layer == PFLayer::ECAL_BARREL || 
00648            layer == PFLayer::HCAL_BARREL1 || 
00649            layer == PFLayer::HCAL_BARREL2) {
00650           graphicMap_.insert(pair<int,GPFBase *> (ident,new GPFRecHit(this, viewType,ident,&rh,npoints,x,y,color,"f")));
00651                                         
00652         } else {
00653           graphicMap_.insert(pair<int,GPFBase *> (ident,new GPFRecHit(this, viewType,ident,&rh,npoints,x,y,color,"l")));
00654           if( ampl>0 ) { // not for preshower
00655             xprop[4]=xprop[0];
00656             yprop[4]=yprop[0]; // closing the polycell    
00657             graphicMap_.insert(pair<int,GPFBase *> (ident,new GPFRecHit(this, viewType,ident,&rh,npoints,xprop,yprop,color,"f")));
00658           }
00659         }
00660       } 
00661       break;
00662                                 
00663     case RZ:
00664       graphicMap_.insert(pair<int,GPFBase *> (ident,new GPFRecHit(this, viewType,ident,&rh,npoints,z,r,color,"f")));
00665       break;
00666                                 
00667     case EPE:
00668       {
00669         graphicMap_.insert(pair<int,GPFBase *> (ident,new GPFRecHit(this, viewType,ident,&rh,npoints,eta,phi,color,"l")));
00670                                 
00671         if( ampl>0 ) { // not for preshower
00672           etaprop[4]=etaprop[0];
00673           phiprop[4]=phiprop[0]; // closing the polycell    
00674           graphicMap_.insert(pair<int,GPFBase *> (ident,new GPFRecHit(this, viewType,ident,&rh,npoints,etaprop,phiprop,color,"f")));
00675         }
00676       }  
00677       break;
00678     case EPH:
00679       {      
00680         graphicMap_.insert(pair<int,GPFBase *> (ident,new GPFRecHit(this, viewType,ident,&rh,npoints,eta,phi,color,"l")));
00681                                 
00682         if( ampl>0 ) { // not for preshower
00683           etaprop[4]=etaprop[0];
00684           phiprop[4]=phiprop[0]; // closing the polycell    
00685           graphicMap_.insert(pair<int,GPFBase *> (ident,new GPFRecHit(this, viewType,ident,&rh,npoints,etaprop,phiprop,color,"f")));
00686         }
00687       } 
00688       break;
00689                                 
00690     default: break;
00691     }//switch end
00692                 
00693   } //loop on views
00694 }

void DisplayManager::createGTrack ( reco::PFRecTrack tr,
const std::vector< reco::PFTrajectoryPoint > &  points,
int  ident,
double  pt,
double  phi0,
double  sign,
bool  displayInitial,
int  linestyle 
) [private]

no point inside graphical cut.

Definition at line 697 of file DisplayManager.cc.

References reco::PFTrajectoryPoint::ClosestApproach, EPE, EPH, eta, graphicMap_, i, phi, RZ, trackPatternL_, trackPatternM_, and XY.

Referenced by loadGRecTracks().

00701 {
00702         
00703   //   bool inside = false; 
00704   //TCutG* cutg = (TCutG*) gROOT->FindObject("CUTG");
00705         
00706   for (int viewType=0;viewType<4;++viewType) {
00707     // reserving space. nb not all trajectory points are valid
00708     vector<double> xPos;
00709     xPos.reserve( points.size() );
00710     vector<double> yPos;
00711     yPos.reserve( points.size() );
00712                 
00713     for(unsigned i=0; i<points.size(); i++) {
00714       if( !points[i].isValid() ) continue;
00715       
00716       const math::XYZPoint& xyzPos = points[i].position();      
00717 
00718       double eta = xyzPos.Eta();
00719       double phi = xyzPos.Phi();
00720                         
00721       if( !displayInitial && 
00722           points[i].layer() == reco::PFTrajectoryPoint::ClosestApproach ) {
00723         const math::XYZTLorentzVector& mom = points[i].momentum();
00724         eta = mom.Eta();
00725         phi = mom.Phi();
00726       }
00727                         
00728       //if( !cutg || cutg->IsInside( eta, phi ) ) 
00729       //  inside = true;
00730                         
00731                         
00732       switch(viewType) {
00733       case XY:
00734         xPos.push_back(xyzPos.X());
00735         yPos.push_back(xyzPos.Y());
00736         break;
00737       case RZ:
00738         xPos.push_back(xyzPos.Z());
00739         yPos.push_back(sign*xyzPos.Rho());
00740         break;
00741       case EPE:
00742       case EPH:
00743         xPos.push_back( eta );
00744         yPos.push_back( phi );
00745         break;
00746       }
00747     }  
00749     //if( !inside ) return;
00750                 
00751     //fill map with graphic objects
00752                 
00753     GPFTrack *gt = new  GPFTrack(this,
00754                                  viewType,ident,
00755                                  &tr,
00756                                  xPos.size(),&xPos[0],&yPos[0],pt,
00757                                  trackPatternM_,trackPatternL_,"pl");
00758     graphicMap_.insert(pair<int,GPFBase *> (ident, gt));
00759   }   
00760 }

void DisplayManager::display ( int  ientry  ) 

Definition at line 762 of file DisplayManager.cc.

References TestMuL1L2Filter_cff::cerr, displayAll(), em_, lat::endl(), PFRootEventManager::eventNumber(), eventNumber_, isGraphicLoaded_, loadGraphicObjects(), maxEvents_, PFRootEventManager::processEntry(), and reset().

Referenced by displayNext(), displayPrevious(), and DialogFrame::doReProcessEvent().

00763 {
00764   if (ientry<0 || ientry>maxEvents_) {
00765     std::cerr<<"DisplayManager::no event matching criteria"<<std::endl;
00766     return;
00767   }  
00768   reset();
00769   em_->processEntry(ientry);  
00770   eventNumber_= em_->eventNumber();
00771   loadGraphicObjects();
00772   isGraphicLoaded_= true;
00773   displayAll();
00774 }

void DisplayManager::displayAll ( bool  noRedraw = true  ) 

Definition at line 776 of file DisplayManager.cc.

References clusEnMin_, CLUSTERECALID, CLUSTERHCALID, CLUSTERIBID, CLUSTERPSID, GenMuonPlsPt100GeV_cfg::cout, displayCanvas(), displayView_, drawClus_, drawGenParticles_, drawHits_, drawParticles_, drawTracks_, lat::endl(), EPE, EPH, GENPARTICLEID, genParticlePtMin_, graphicMap_, hitEnMin_, i, parsecf::pyparsing::ident, isGraphicLoaded_, NViews, p, particlePtMin_, RECHITECALID, RECHITHCALID, RECHITPSID, RECTRACKID, shiftId_, SIMPARTICLEID, and trackPtMin_.

Referenced by display(), displayNextInteresting(), DialogFrame::doModifyOptions(), DialogFrame::doModifyPtThreshold(), drawWithNewGraphicAttributes(), and findAndDraw().

00777 {
00778   if (!isGraphicLoaded_) {
00779     std::cout<<" no Graphic Objects to draw"<<std::endl;
00780     return;
00781   }
00782   if (noRedraw) { 
00783     for (int viewType=0;viewType<NViews;++viewType) {
00784       displayView_[viewType]->cd();
00785       gPad->Clear();
00786     } 
00787     //TODOLIST: add test on view to draw 
00788     displayCanvas();
00789   }  
00790         
00791   std::multimap<int,GPFBase *>::iterator p;
00792         
00793   for (p=graphicMap_.begin();p!=graphicMap_.end();p++) {
00794     int ident=p->first;
00795     int type=ident >> shiftId_;
00796     int view = p->second->getView();
00797     switch (type) {
00798     case CLUSTERECALID: case CLUSTERHCALID: case  CLUSTERPSID: case CLUSTERIBID:
00799       {
00800         if (drawClus_)
00801           if (p->second->getEnergy() > clusEnMin_) {
00802             displayView_[view]->cd();
00803             p->second->draw();
00804           }        
00805       }
00806       break;
00807     case RECHITECALID: case  RECHITHCALID: case RECHITPSID:
00808       {
00809         if (!noRedraw) break; 
00810         if (drawHits_) 
00811           if(p->second->getEnergy() > hitEnMin_)  {
00812             displayView_[view]->cd();
00813             p->second->draw();
00814           }
00815         break;  
00816       }  
00817     case RECTRACKID:
00818       {
00819         if (drawTracks_) 
00820           if (p->second->getPt() > trackPtMin_) {
00821             displayView_[view]->cd();
00822             p->second->draw();
00823           }
00824       }
00825       break;
00826     case SIMPARTICLEID:
00827       {
00828         if (drawParticles_)
00829           if (p->second->getPt() > particlePtMin_) {
00830             displayView_[view]->cd();
00831             p->second->draw();
00832           }
00833       }
00834       break;
00835     case GENPARTICLEID:
00836       {  
00837         if (drawGenParticles_) 
00838           if (p->second->getPt() > genParticlePtMin_) 
00839             if (view == EPH || view ==EPE) {
00840               displayView_[view]->cd();
00841               p->second->draw();
00842             }  
00843       } 
00844       break;           
00845     default : std::cout<<"DisplayManager::displayAll()-- unknown object "<<std::endl;               
00846     }  //switch end
00847   }   //for end
00848   for (int i=0;i<NViews;i++) {
00849     displayView_[i]->cd();
00850     gPad->Modified();
00851     displayView_[i]->Update();
00852   }  
00853 }

void DisplayManager::displayCanvas (  )  [private]

Definition at line 887 of file DisplayManager.cc.

References displayHist_, displayView_, eta, gen_hydjet_hard_muon_trigger_cfg::etaMax, gen_hydjet_hard_muon_trigger_cfg::etaMin, frontFaceECALRZ_, frontFaceECALXY_, frontFaceHCALXY_, int, edm::es::l(), NViews, r, RZ, funct::tan(), muonGeometry::TVector3(), and XY.

Referenced by displayAll().

00888 {
00889   double zLow = -500.;
00890   double zUp  = +500.;
00891   double rUp  = +300.;
00892         
00893   //TODOLIST : test wether view on/off
00894   //if (!displayView_[viewType] || !gROOT->GetListOfCanvases()->FindObject(displayView_[viewType]) ) {
00895   //   assert(viewSize_.size() == 2);
00896         
00897   for (int viewType=0;viewType<NViews;++viewType) {
00898     displayView_[viewType]->cd();
00899     displayHist_[viewType]->Draw();
00900     switch(viewType) {
00901     case XY: 
00902       frontFaceECALXY_.Draw();
00903       frontFaceHCALXY_.Draw();
00904       break;
00905     case RZ:    
00906       {// Draw lines at different etas
00907         TLine l;
00908         l.SetLineColor(1);
00909         l.SetLineStyle(3);
00910         TLatex etaLeg;
00911         etaLeg.SetTextSize(0.02);
00912         float etaMin = -3.;
00913         float etaMax = +3.;
00914         float etaBin = 0.2;
00915         int nEtas = int((etaMax - etaMin)/0.2) + 1;
00916         for (int iEta = 0; iEta <= nEtas; iEta++) {
00917           float eta = etaMin + iEta*etaBin;
00918           float r = 0.9*rUp;
00919           TVector3 etaImpact;
00920           etaImpact.SetPtEtaPhi(r, eta, 0.);
00921           etaLeg.SetTextAlign(21);
00922           if (eta <= -1.39) {
00923             etaImpact.SetXYZ(0.,0.85*zLow*tan(etaImpact.Theta()),0.85*zLow);
00924             etaLeg.SetTextAlign(31);
00925           } else if (eta >= 1.39) {
00926             etaImpact.SetXYZ(0.,0.85*zUp*tan(etaImpact.Theta()),0.85*zUp);
00927             etaLeg.SetTextAlign(11);
00928           }
00929           l.DrawLine(0., 0., etaImpact.Z(), etaImpact.Perp());
00930           etaLeg.DrawLatex(etaImpact.Z(), etaImpact.Perp(), Form("%2.1f", eta));
00931         }
00932         frontFaceECALRZ_.Draw();
00933       } 
00934       break;
00935     default: break;
00936     } //end switch
00937   }
00938 }

void DisplayManager::displayNext (  ) 

Definition at line 940 of file DisplayManager.cc.

References display(), em_, PFRootEventManager::eventNumber(), and eventNumber_.

Referenced by DialogFrame::doNextEvent().

00941 {
00942   int eventNumber_=em_->eventNumber();
00943   display(++eventNumber_);
00944 }

void DisplayManager::displayNextInteresting ( int  ientry  ) 

Definition at line 946 of file DisplayManager.cc.

References TestMuL1L2Filter_cff::cerr, displayAll(), em_, lat::endl(), PFRootEventManager::eventNumber(), eventNumber_, isGraphicLoaded_, loadGraphicObjects(), PFRootEventManager::processEntry(), and reset().

00947 {
00948   bool ok=false;
00949   while (!ok && ientry<em_->tree_->GetEntries() ) {
00950     ok = em_->processEntry(ientry);
00951     ientry++;
00952   }
00953   eventNumber_ = em_->eventNumber();
00954   if (ok) {
00955     reset();
00956     loadGraphicObjects();
00957     isGraphicLoaded_= true;
00958     displayAll();
00959   }
00960   else 
00961     std::cerr<<"DisplayManager::dislayNextInteresting : no event matching criteria"<<std::endl;
00962 }

void DisplayManager::displayPFBlock ( int  blockNb  ) 

Definition at line 979 of file DisplayManager.cc.

References blockIdentsMap_, GenMuonPlsPt100GeV_cfg::cout, drawGObject(), drawPFBlocks_, lat::endl(), first, parsecf::pyparsing::ident, p, rubOutGPFBlock(), and selectedGObj_.

Referenced by findBlock().

00980 {
00981   rubOutGPFBlock();
00982   selectedGObj_.clear();
00983   if (!drawPFBlocks_) return;
00984   int color=1;
00985   multimap<int,pair <int,int > >::const_iterator p;
00986   p= blockIdentsMap_.find(blockNb);
00987   if (p !=blockIdentsMap_.end()) {
00988     do {
00989       int ident=(p->second).first;
00990       drawGObject(ident,color,false);
00991       p++;
00992     } while (p!=blockIdentsMap_.upper_bound(blockNb));
00993   }
00994   else 
00995     cout<<"DisplayManager::displayPFBlock :not found"<<endl;    
00996 }  

void DisplayManager::displayPrevious (  ) 

Definition at line 964 of file DisplayManager.cc.

References display(), em_, PFRootEventManager::eventNumber(), and eventNumber_.

Referenced by DialogFrame::doPreviousEvent().

00965 {
00966   int eventNumber_=em_->eventNumber();
00967   display(--eventNumber_);
00968 }

void DisplayManager::drawGObject ( int  ident,
int  color,
bool  toInitialColor 
) [private]

Definition at line 998 of file DisplayManager.cc.

References displayView_, graphicMap_, iter, p, HLT_VtxMuL3::result, and selectedGObj_.

Referenced by displayPFBlock(), findAndDraw(), and rubOutGPFBlock().

00999 {
01000   typedef std::multimap<int,GPFBase *>::const_iterator iter;
01001   iter p;
01002   std::pair<iter, iter > result = graphicMap_.equal_range(ident);
01003   if(result.first == graphicMap_.end()) {
01004     return;
01005   }
01006   p=result.first;
01007   while (p != result.second) {
01008     int view=p->second->getView();
01009     displayView_[view]->cd();
01010     if (toInitial) p->second->setInitialColor();
01011     else p->second->setColor(color);
01012     p->second->draw();
01013     gPad->Modified();
01014     //      displayView_[view]->Update();
01015     if (!toInitial) selectedGObj_.push_back(ident);
01016     p++; 
01017   }
01018 }

void DisplayManager::drawWithNewGraphicAttributes (  ) 

Definition at line 855 of file DisplayManager.cc.

References CLUSTERECALID, CLUSTERHCALID, CLUSTERIBID, CLUSTERPSID, displayAll(), graphicMap_, parsecf::pyparsing::ident, p, RECTRACKID, shiftId_, and SIMPARTICLEID.

Referenced by DialogFrame::modifyAttr().

00856 {
00857   std::multimap<int,GPFBase *>::iterator p;
00858         
00859   for (p=graphicMap_.begin();p!=graphicMap_.end();p++) {
00860     int ident=p->first;
00861     int type=ident >> shiftId_;
00862     switch (type) {
00863     case CLUSTERECALID: case CLUSTERHCALID: case  CLUSTERPSID: case CLUSTERIBID:
00864       {
00865         p->second->setNewStyle();
00866         p->second->setNewSize();
00867         p->second->setColor();  
00868       }
00869       break;
00870     case RECTRACKID:
00871       {
00872         p->second->setColor();
00873         p->second->setNewStyle();
00874         p->second->setNewSize();
00875       }
00876       break;
00877     case SIMPARTICLEID:
00878       {
00879       }
00880       break;
00881     default : break;            
00882     }  //switch end
00883   }   //for end
00884   displayAll(false);
00885 }

void DisplayManager::enableDrawPFBlock ( bool  state  ) 

Definition at line 1020 of file DisplayManager.cc.

References drawPFBlocks_.

Referenced by DialogFrame::isPFBlockVisible().

01021 {
01022   drawPFBlocks_=state;
01023 }  

void DisplayManager::findAndDraw ( int  ident  ) 

Definition at line 1025 of file DisplayManager.cc.

References GenMuonPlsPt100GeV_cfg::cout, displayAll(), drawGObject(), drawPFBlocks_, lat::endl(), rubOutGPFBlock(), selectedGObj_, shiftId_, and updateDisplay().

Referenced by GPFCluster::ExecuteEvent(), GPFRecHit::ExecuteEvent(), GPFSimParticle::ExecuteEvent(), and GPFTrack::ExecuteEvent().

01026 {
01027         
01028   int type=ident >> shiftId_;
01029   int color=1;
01030   if (type>8) {
01031     std ::cout<<"DisplayManager::findAndDraw :object Type unknown"<<std::endl;
01032     return;
01033   }  
01034   if (drawPFBlocks_==0  || type<3 || type==8) {
01035     rubOutGPFBlock();
01036     selectedGObj_.clear();
01037     bool toInitial=false;
01038     drawGObject(ident,color,toInitial);
01039     if (type<3) {
01040       //redrawWithoutHits_=true;
01041       displayAll(false);
01042       //redrawWithoutHits_=false;
01043     }
01044   }     
01045   updateDisplay();
01046 }

void DisplayManager::findBlock ( int  ident  ) 

Definition at line 1048 of file DisplayManager.cc.

References parseConfig::block, blockIdentsMap_, PFRootEventManager::blocks(), GenMuonPlsPt100GeV_cfg::cout, displayPFBlock(), em_, lat::endl(), first, p, edm::second(), and updateDisplay().

Referenced by GPFCluster::ExecuteEvent(), and GPFTrack::ExecuteEvent().

01049 {
01050   int blockNb=-1;
01051   int elemNb=-1;
01052   multimap<int, pair <int,int > >::const_iterator p;
01053   for (p=blockIdentsMap_.begin();p!=blockIdentsMap_.end();p++) {
01054     int id=(p->second).first;
01055     if (id == ident) {
01056       blockNb=p->first;
01057       elemNb=(p->second).second;
01058       break;
01059     }   
01060   }
01061   if (blockNb > -1) {
01062     std::cout<<"this object is element "<<elemNb<<" of PFblock nb "<<blockNb<<std::endl;
01063     assert( blockNb < static_cast<int>(em_->blocks().size()) );
01064     const reco::PFBlock& block = em_->blocks()[blockNb];
01065     std::cout<<block<<std::endl;
01066     displayPFBlock(blockNb);
01067   }   
01068   updateDisplay();
01069 }  

void DisplayManager::getDisplayOptions (  )  [private]

double DisplayManager::getMaxE ( int  layer  )  const [private]

Definition at line 1083 of file DisplayManager.cc.

References TestMuL1L2Filter_cff::cerr, PFLayer::ECAL_BARREL, PFLayer::ECAL_ENDCAP, em_, lat::endl(), PFLayer::HCAL_BARREL1, PFLayer::HCAL_BARREL2, PFLayer::HCAL_ENDCAP, PFLayer::HCAL_HF, i, PFLayer::PS1, PFLayer::PS2, PFRootEventManager::rechitsECAL_, PFRootEventManager::rechitsHCAL_, and PFRootEventManager::rechitsPS_.

Referenced by getMaxEEcal(), and getMaxEHcal().

01084 {
01085         
01086   double maxe = -9999;
01087         
01088   // in which vector should we look for these rechits ?
01089         
01090   const reco::PFRecHitCollection* vec = 0;
01091   switch(layer) {
01092   case PFLayer::ECAL_ENDCAP:
01093   case PFLayer::ECAL_BARREL:
01094     vec = &(em_->rechitsECAL_);
01095     break;
01096   case PFLayer::HCAL_ENDCAP:
01097   case PFLayer::HCAL_BARREL1:
01098   case PFLayer::HCAL_BARREL2:
01099   case PFLayer::HCAL_HF:
01100     vec = &(em_->rechitsHCAL_);
01101     break;
01102   case PFLayer::PS1:
01103   case PFLayer::PS2:
01104     vec = &(em_->rechitsPS_);
01105     break;
01106   default:
01107     cerr<<"DisplayManager::getMaxE : manage other layers"<<endl;
01108     return maxe;
01109   }
01110         
01111   for( unsigned i=0; i<vec->size(); i++) {
01112     if( (*vec)[i].layer() != layer ) continue;
01113     if( (*vec)[i].energy() > maxe)
01114       maxe = (*vec)[i].energy();
01115   }
01116         
01117   return maxe;
01118 }

double DisplayManager::getMaxEEcal (  )  [private]

Definition at line 1120 of file DisplayManager.cc.

References PFLayer::ECAL_BARREL, PFLayer::ECAL_ENDCAP, getMaxE(), and maxERecHitEcal_.

Referenced by loadGRecHits().

01120                                    {
01121         
01122   if( maxERecHitEcal_<0 ) {
01123     double maxeec = getMaxE( PFLayer::ECAL_ENDCAP );
01124     double maxeb =  getMaxE( PFLayer::ECAL_BARREL );
01125     maxERecHitEcal_ = maxeec > maxeb ? maxeec:maxeb; 
01126     // max of both barrel and endcap
01127   }
01128   return  maxERecHitEcal_;
01129 }

double DisplayManager::getMaxEHcal (  )  [private]

Definition at line 1131 of file DisplayManager.cc.

References getMaxE(), PFLayer::HCAL_BARREL1, PFLayer::HCAL_ENDCAP, PFLayer::HCAL_HF, and maxERecHitHcal_.

Referenced by loadGRecHits().

01131                                    {
01132         
01133   if(maxERecHitHcal_ < 0) {
01134     double maxehf = getMaxE( PFLayer::HCAL_HF );
01135     double maxeec = getMaxE( PFLayer::HCAL_ENDCAP );
01136     double maxeb =  getMaxE( PFLayer::HCAL_BARREL1 );
01137     maxERecHitHcal_ =  maxeec>maxeb  ?  maxeec:maxeb;
01138     maxERecHitHcal_ = maxERecHitHcal_>maxehf ? maxERecHitHcal_:maxehf;
01139   }
01140   return maxERecHitHcal_;
01141 } 

void DisplayManager::loadGClusters (  )  [private]

Definition at line 1252 of file DisplayManager.cc.

References CLUSTERECALID, CLUSTERHCALID, CLUSTERIBID, CLUSTERPSID, PFRootEventManager::clustersECAL_, PFRootEventManager::clustersHCAL_, PFRootEventManager::clustersIslandBarrel_, PFRootEventManager::clustersPS_, createGCluster(), PFLayer::ECAL_BARREL, em_, i, and shiftId_.

Referenced by loadGraphicObjects().

01253 {
01254   double phi0=0;
01255         
01256   for(unsigned i=0; i<em_->clustersECAL_->size(); i++){
01257     //int clusId=(i<<shiftId_) | CLUSTERECALID;
01258     int clusId=(CLUSTERECALID<<shiftId_) | i;
01259     createGCluster( (*(em_->clustersECAL_))[i],clusId, phi0);
01260   }    
01261   for(unsigned i=0; i<em_->clustersHCAL_->size(); i++) {
01262     //int clusId=(i<<shiftId_) | CLUSTERHCALID;
01263     int clusId=(CLUSTERHCALID<<shiftId_) | i;
01264     createGCluster( (*(em_->clustersHCAL_))[i],clusId, phi0);
01265   }    
01266   for(unsigned i=0; i<em_->clustersPS_->size(); i++){ 
01267     //int clusId=(i<<shiftId_) | CLUSTERPSID;
01268     int clusId=(CLUSTERPSID<<shiftId_) | i;
01269     createGCluster( (*(em_->clustersPS_))[i],clusId,phi0);
01270   }
01271   for(unsigned i=0; i<em_->clustersIslandBarrel_.size(); i++) {
01272     PFLayer::Layer layer = PFLayer::ECAL_BARREL;
01273     //int clusId=(i<<shiftId_) | CLUSTERIBID;
01274     int clusId=(CLUSTERIBID<<shiftId_) | i;
01275                 
01276     reco::PFCluster cluster( layer, 
01277                              em_->clustersIslandBarrel_[i].energy(),
01278                              em_->clustersIslandBarrel_[i].x(),
01279                              em_->clustersIslandBarrel_[i].y(),
01280                              em_->clustersIslandBarrel_[i].z() ); 
01281     createGCluster( cluster,clusId, phi0);
01282   }  
01283 }

void DisplayManager::loadGGenParticles (  )  [private]

Definition at line 1143 of file DisplayManager.cc.

References createGGenParticle(), em_, edm::HepMCProduct::GetEvent(), PFRootEventManager::MCTruth_, and p.

Referenced by loadGraphicObjects().

01144 {
01145   
01146   const HepMC::GenEvent* myGenEvent = em_->MCTruth_.GetEvent();
01147   if(!myGenEvent) return;
01148   for ( HepMC::GenEvent::particle_const_iterator piter  = myGenEvent->particles_begin();
01149         piter != myGenEvent->particles_end(); 
01150         ++piter ) {
01151     HepMC::GenParticle* p = *piter;
01152 
01153     createGGenParticle(p);
01154   } 
01155 }

void DisplayManager::loadGPFBlocks (  )  [private]

Definition at line 1285 of file DisplayManager.cc.

References begin, blockIdentsMap_, CLUSTERECALID, CLUSTERHCALID, CLUSTERPSID, GenMuonPlsPt100GeV_cfg::cout, reco::PFBlockElement::ECAL, em_, end, lat::endl(), reco::PFBlockElement::HCAL, parsecf::pyparsing::ident, edm::Ref< C, T, F >::isNull(), iter, edm::Ref< C, T, F >::key(), reco::PFBlockElement::NONE, PFRootEventManager::pfBlocks_, reco::PFBlockElement::PS1, reco::PFBlockElement::PS2, RECTRACKID, shiftId_, size, and reco::PFBlockElement::TRACK.

Referenced by loadGraphicObjects().

01286 {
01287   int size = em_->pfBlocks_->size();
01288   for (int ibl=0;ibl<size;ibl++) {
01289     //int elemNb=((*(em_->pfBlocks_))[ibl].elements()).size();
01290     //std::cout<<"block "<<ibl<<":"<<elemNb<<" elements"<<std::flush<<std::endl;
01291     edm::OwnVector< reco::PFBlockElement >::const_iterator iter;
01292     for( iter =((*(em_->pfBlocks_))[ibl].elements()).begin();
01293          iter != ((*(em_->pfBlocks_))[ibl].elements()).end();iter++) {
01294 
01295       //COLIN
01296 //       std::cout<<"elem index "<<(*iter).index()<<"-type:"
01297 //            <<(*iter).type()<<std::flush<<std::endl;
01298       int ident=-1;  
01299        
01300       reco::PFBlockElement::Type type = (*iter).type();
01301       switch (type) {
01302       case reco::PFBlockElement::NONE :
01303         assert(0);
01304         break;
01305       case reco::PFBlockElement::TRACK:
01306         {
01307           reco::PFRecTrackRef trackref =(*iter).trackRefPF();  
01308           assert( !trackref.isNull() );
01309           // std::cout<<" - key "<<trackref.key()<<std::flush<<std::endl<<std::endl;
01310           ident=(RECTRACKID <<shiftId_) | trackref.key();
01311         }
01312       break;
01313       case reco::PFBlockElement::PS1:
01314         {
01315           reco::PFClusterRef clusref=(*iter).clusterRef();
01316           assert( !clusref.isNull() );
01317           //std::cout<<"- key "<<clusref.key()<<std::flush<<std::endl<<std::endl;
01318           ident=(CLUSTERPSID <<shiftId_) |clusref.key();
01319         }
01320       break;
01321       case reco::PFBlockElement::PS2:
01322         {
01323           reco::PFClusterRef clusref=(*iter).clusterRef();
01324           assert( !clusref.isNull() );
01325           //std::cout<<"key "<<clusref.key()<<std::flush<<std::endl<<std::endl;
01326           ident=(CLUSTERPSID <<shiftId_) |clusref.key();
01327         }
01328       break;
01329       case reco::PFBlockElement::ECAL:
01330         {
01331           reco::PFClusterRef clusref=(*iter).clusterRef();
01332           assert( !clusref.isNull() );
01333           //std::cout<<"key "<<clusref.key()<<std::flush<<std::endl<<std::endl;
01334           ident=(CLUSTERECALID <<shiftId_) |clusref.key();
01335         }
01336       break;
01337       case reco::PFBlockElement::HCAL:
01338         {
01339           reco::PFClusterRef clusref=(*iter).clusterRef();
01340           assert( !clusref.isNull() );
01341           //std::cout<<"key "<<clusref.key()<<std::flush<<std::endl<<std::endl;
01342           ident=(CLUSTERHCALID <<shiftId_) |clusref.key();
01343         }
01344       break;
01345       default: 
01346         std::cout<<"unknown PFBlock element of type "<<type<<std::endl;
01347         break; 
01348       } //end switch 
01349       pair <int, int> idElem;
01350       idElem.first=ident;
01351       idElem.second=(*iter).index();
01352       if (ident != -1) blockIdentsMap_.insert(pair<int,pair <int,int> > (ibl,idElem));            
01353     }   //end for elements
01354   }   //end for blocks
01355         
01356 }

void DisplayManager::loadGraphicObjects (  )  [private]

Definition at line 1358 of file DisplayManager.cc.

References loadGClusters(), loadGGenParticles(), loadGPFBlocks(), loadGRecHits(), loadGRecTracks(), and loadGSimParticles().

Referenced by display(), and displayNextInteresting().

01359 {
01360   loadGClusters();
01361   loadGRecHits();
01362   loadGRecTracks();
01363   loadGSimParticles();
01364   loadGPFBlocks();
01365   loadGGenParticles();
01366 }

void DisplayManager::loadGRecHits (  )  [private]

Definition at line 1368 of file DisplayManager.cc.

References TestMuL1L2Filter_cff::cerr, PFRootEventManager::clusterAlgoECAL_, PFRootEventManager::clusterAlgoHCAL_, PFRootEventManager::clusterAlgoPS_, parsecf::pyparsing::col(), PFClusterAlgo::color(), createGRecHit(), em_, lat::endl(), getMaxEEcal(), getMaxEHcal(), i, RECHITHCALID, recHitId, RECHITPSID, PFRootEventManager::rechitsECAL_, PFRootEventManager::rechitsHCAL_, PFRootEventManager::rechitsPS_, PFClusterAlgo::SEED, shiftId_, and PFClusterAlgo::SPECIAL.

Referenced by loadGraphicObjects().

01369 {
01370   double phi0=0;
01371         
01372   double maxee = getMaxEEcal();
01373   double maxeh = getMaxEHcal();
01374   double maxe = maxee>maxeh ? maxee : maxeh;
01375         
01376   int color = TColor::GetColor(210,210,210);
01377   int seedcolor = TColor::GetColor(145,145,145);
01378   int specialcolor = TColor::GetColor(255,140,0);
01379         
01380   for(unsigned i=0; i<em_->rechitsECAL_.size(); i++) { 
01381     int rhcolor = color;
01382     if( unsigned col = em_->clusterAlgoECAL_.color(i) ) {
01383       switch(col) {
01384       case PFClusterAlgo::SEED: rhcolor = seedcolor; break;
01385       case PFClusterAlgo::SPECIAL: rhcolor = specialcolor; break;
01386       default:
01387         cerr<<"DisplayManager::loadGRecHits: unknown color"<<endl;
01388       }
01389     }
01390     //int recHitId=(i<<shiftId_) | RECHITECALID;
01391     int recHitId=i;
01392     createGRecHit(em_->rechitsECAL_[i],recHitId, maxe, phi0, rhcolor);
01393   }
01394         
01395   for(unsigned i=0; i<em_->rechitsHCAL_.size(); i++) { 
01396     int rhcolor = color;
01397     if(unsigned col = em_->clusterAlgoHCAL_.color(i) ) {
01398       switch(col) {
01399       case PFClusterAlgo::SEED: rhcolor = seedcolor; break;
01400       case PFClusterAlgo::SPECIAL: rhcolor = specialcolor; break;
01401       default:
01402         cerr<<"DisplayManager::loadGRecHits: unknown color"<<endl;
01403       }
01404     }
01405     //int recHitId=(i<<shiftId_) | RECHITHCALID;
01406     int recHitId=(RECHITHCALID <<shiftId_) | i;
01407     createGRecHit(em_->rechitsHCAL_[i],recHitId, maxe, phi0, rhcolor);
01408   }
01409         
01410   for(unsigned i=0; i<em_->rechitsPS_.size(); i++) { 
01411     int rhcolor = color;
01412     if( unsigned col = em_->clusterAlgoPS_.color(i) ) {
01413       switch(col) {
01414       case PFClusterAlgo::SEED: rhcolor = seedcolor; break;
01415       case PFClusterAlgo::SPECIAL: rhcolor = specialcolor; break;
01416       default:
01417         cerr<<"DisplayManager::loadGRecHits: unknown color"<<endl;
01418       }
01419     }
01420     //int recHitId=(i<<shiftId_) | RECHITPSID;
01421     int recHitId=(RECHITPSID<<shiftId_) | i;
01422                 
01423     createGRecHit(em_->rechitsPS_[i],recHitId, maxe, phi0, rhcolor);
01424   }
01425 } 

void DisplayManager::loadGRecTracks (  )  [private]

Definition at line 1427 of file DisplayManager.cc.

References reco::PFTrajectoryPoint::ClosestApproach, funct::cos(), createGTrack(), reco::PFTrajectoryPoint::ECALEntrance, em_, reco::PFTrajectoryPoint::momentum(), RECTRACKID, PFRootEventManager::recTracks_, and shiftId_.

Referenced by loadGraphicObjects().

01428 {
01429   double phi0=0;
01430         
01431   int ind=-1;
01432   std::vector<reco::PFRecTrack>::iterator itRecTrack;
01433   for (itRecTrack = em_->recTracks_.begin(); itRecTrack != em_->recTracks_.end();itRecTrack++) {
01434     double sign = 1.;
01435     const reco::PFTrajectoryPoint& tpinitial 
01436       = itRecTrack->extrapolatedPoint(reco::PFTrajectoryPoint::ClosestApproach);
01437     double pt = tpinitial.momentum().Pt();
01438     //if( pt<em_->displayRecTracksPtMin_ ) continue;
01439                 
01440     const reco::PFTrajectoryPoint& tpatecal 
01441       = itRecTrack->trajectoryPoint(itRecTrack->nTrajectoryMeasurements() +
01442                                     reco::PFTrajectoryPoint::ECALEntrance );
01443                 
01444     if ( cos(phi0 - tpatecal.momentum().Phi()) < 0.)
01445       sign = -1.;
01446                 
01447     const std::vector<reco::PFTrajectoryPoint>& points = 
01448       itRecTrack->trajectoryPoints();
01449                 
01450     int    linestyle = itRecTrack->algoType();
01451     ind++;
01452     //int recTrackId=(ind<<shiftId_) | RECTRACKID;
01453     int recTrackId=(RECTRACKID <<shiftId_) | ind; 
01454                 
01455     createGTrack(*itRecTrack,points,recTrackId, pt, phi0, sign, false,linestyle);
01456   }
01457 }

void DisplayManager::loadGSimParticles (  )  [private]

Definition at line 1459 of file DisplayManager.cc.

References funct::abs(), reco::PFTrajectoryPoint::ClosestApproach, createGPart(), em_, reco::PFTrack::extrapolatedPoint(), i, reco::PFTrajectoryPoint::momentum(), reco::PFSimParticle::motherId(), reco::PFSimParticle::pdgCode(), reco::PFTrajectoryPoint::position(), shiftId_, SIMPARTICLEID, reco::PFTrack::trajectoryPoint(), reco::PFTrack::trajectoryPoints(), and PFRootEventManager::trueParticles_.

Referenced by loadGraphicObjects().

01460 {
01461   double phi0=0;
01462   //    bool debug_loadGSim = true;
01463   unsigned simParticlesVSize = em_->trueParticles_.size();
01464         
01465   for(unsigned i=0; i<simParticlesVSize; i++) {
01466                 
01467     const reco::PFSimParticle& ptc = em_->trueParticles_[i];
01468                 
01469     const reco::PFTrajectoryPoint& tpinitial 
01470       = ptc.extrapolatedPoint( reco::PFTrajectoryPoint::ClosestApproach );
01471                 
01472     double pt = tpinitial.momentum().Pt();
01473     //if( pt<em_->getDisplayTrueParticlesPtMin()) continue;
01474                 
01475     double sign = 1.;
01476     const reco::PFTrajectoryPoint& tpFirst = ptc.trajectoryPoint(0);
01477     if ( tpFirst.position().X() < 0. )
01478       sign = -1.;
01479     //double sign2 = 1.;
01480     // if position vector is 0,0,0: X component is undefined  (MDN 11 June 2008)
01481     // const reco::PFTrajectoryPoint& tpFirst = ptc.trajectoryPoint(0);
01482     //  if ( tpFirst.positionXYZ().X() < 0. )
01483     //   sign2 = -1.;
01484                 
01485     const std::vector<reco::PFTrajectoryPoint>& points = 
01486       ptc.trajectoryPoints();
01487       
01488 
01489     int markerstyle;
01490     int indexMarker;
01491     switch( abs(ptc.pdgCode() ) ) {
01492     case 22:   markerstyle = 3 ; indexMarker=0; break; // photons
01493     case 11:   markerstyle = 5 ; indexMarker=1;  break; // electrons 
01494     case 13:   markerstyle = 2 ; indexMarker=2;  break; // muons 
01495     case 130:  
01496     case 321:  markerstyle = 24; indexMarker=3; break; // K
01497     case 211:  markerstyle = 25; indexMarker=4; break; // pi+/pi-
01498     case 2212: markerstyle = 26; indexMarker=5; break; // protons
01499     case 2112: markerstyle = 27; indexMarker=6; break; // neutrons  
01500     default:   markerstyle = 30; indexMarker=7; break; 
01501     }
01502 
01503     bool displayInitial=true;
01504     if( ptc.motherId() < 0 ) displayInitial=false;
01505     int partId=(SIMPARTICLEID << shiftId_) | i; 
01506     createGPart(ptc, points,partId, pt, phi0, sign, displayInitial,indexMarker);
01507     //cout << " sign " << sign << " sign2 " << sign2 << endl;
01508     //if ( sign*sign2 <0 ) cout << " ++++++Warning sign*sign2 <0 ++++++++++++++++++ " << endl;
01509                 
01510   }
01511 }

void DisplayManager::lookForGenParticle ( unsigned  barcode  ) 

look for particle with index i in MC truth.

Definition at line 1567 of file DisplayManager.cc.

References TestMuL1L2Filter_cff::cerr, displayHist_, displayView_, em_, lat::endl(), EPE, EPH, eta, event(), edm::HepMCProduct::GetEvent(), PFRootEventManager::MCTruth_, phi, and zoomFactor_.

Referenced by DialogFrame::doLookForGenParticle().

01567                                                         {
01568         
01569   const HepMC::GenEvent* event = em_->MCTruth_.GetEvent();
01570   if(!event) {
01571     cerr<<"no GenEvent"<<endl;
01572     return;
01573   }
01574         
01575   const HepMC::GenParticle* particle = event->barcode_to_particle(barcode);
01576   if(!particle) {
01577     cerr<<"no particle with barcode "<<barcode<<endl;
01578     return;
01579   }
01580         
01581   math::XYZTLorentzVector momentum(particle->momentum().px(),
01582                                    particle->momentum().py(),
01583                                    particle->momentum().pz(),
01584                                    particle->momentum().e());
01585         
01586   double eta = momentum.Eta();
01587   double phi = momentum.phi();
01588         
01589   double phisize = 0.05;
01590   double etasize = 0.05;
01591         
01592   double etagate = zoomFactor_ * etasize;
01593   double phigate = zoomFactor_ * phisize;
01594         
01595   if(displayHist_[EPE]) {
01596     displayHist_[EPE]->GetXaxis()->SetRangeUser(eta-etagate, eta+etagate);
01597     displayHist_[EPE]->GetYaxis()->SetRangeUser(phi-phigate, phi+phigate);
01598     displayView_[EPE]->Modified();
01599     displayView_[EPE]->Update();
01600                 
01601   }
01602   if(displayHist_[EPH]) {
01603     displayHist_[EPH]->GetXaxis()->SetRangeUser(eta-etagate, eta+etagate);
01604     displayHist_[EPH]->GetYaxis()->SetRangeUser(phi-phigate, phi+phigate);
01605     displayView_[EPH]->Modified();
01606     displayView_[EPH]->Update();
01607   }
01608 }

void DisplayManager::lookForMaxRecHit ( bool  ecal  ) 

look for rechit with max energy in ecal or hcal.

Definition at line 1513 of file DisplayManager.cc.

References displayHist_, displayView_, em_, relval_parameters_module::energy, EPE, EPH, eta, i, phi, reco::PFRecHit::position(), PFRootEventManager::rechitsECAL_, PFRootEventManager::rechitsHCAL_, reco::PFRecHit::size(), and zoomFactor_.

01514 {
01515   // look for the rechit with max e in ecal or hcal
01516   double maxe = -999;
01517   reco::PFRecHit* maxrh = 0;
01518         
01519   reco::PFRecHitCollection* rechits = 0;
01520   if(ecal) rechits = &(em_->rechitsECAL_);
01521   else rechits = &(em_->rechitsHCAL_);
01522   assert(rechits);
01523         
01524   for(unsigned i=0; i<(*rechits).size(); i++) {
01525                 
01526     double energy = (*rechits)[i].energy();
01527                 
01528     if(energy > maxe ) {
01529       maxe = energy;
01530       maxrh = &((*rechits)[i]);
01531     }      
01532   }
01533         
01534   if(!maxrh) return;
01535         
01536   // center view on this rechit
01537         
01538         
01539   // get the cell size to set the eta and phi width 
01540   // of the display window from one of the cells
01541         
01542   double phisize = -1;
01543   double etasize = -1;
01544   maxrh->size(phisize, etasize);
01545         
01546   double etagate = zoomFactor_ * etasize;
01547   double phigate = zoomFactor_ * phisize;
01548   
01549   double eta =  maxrh->position().Eta();
01550   double phi =  maxrh->position().Phi();
01551   
01552   if(displayHist_[EPE]) {
01553     displayHist_[EPE]->GetXaxis()->SetRangeUser(eta-etagate, eta+etagate);
01554     displayHist_[EPE]->GetYaxis()->SetRangeUser(phi-phigate, phi+phigate);
01555     displayView_[EPE]->Modified();
01556     displayView_[EPE]->Update();
01557   }
01558         
01559   if(displayHist_[EPH]) {
01560     displayHist_[EPH]->GetXaxis()->SetRangeUser(eta-etagate, eta+etagate);
01561     displayHist_[EPH]->GetYaxis()->SetRangeUser(phi-phigate, phi+phigate);
01562     displayView_[EPH]->Modified();
01563     displayView_[EPH]->Update();
01564   }
01565 }

void DisplayManager::printDisplay ( const char *  directory = ""  )  const

Definition at line 1610 of file DisplayManager.cc.

References TestMuL1L2Filter_cff::cerr, code, GenMuonPlsPt100GeV_cfg::cout, displayView_, em_, lat::endl(), eventNumber_, name, funct::num(), out, and PFRootEventManager::print().

01611 {
01612   string directory = sdirectory;
01613   if( directory.empty() ) {   
01614     directory = "Event_";
01615   }
01616   char num[10];
01617   sprintf(num,"%d", eventNumber_);
01618   directory += num;
01619         
01620   string mkdir = "mkdir "; mkdir += directory;
01621   int code = system( mkdir.c_str() );
01622         
01623   if( code ) {
01624     cerr<<"cannot create directory "<<directory<<endl;
01625     return;
01626   }
01627         
01628   cout<<"Event display printed in directory "<<directory<<endl;
01629         
01630   directory += "/";
01631         
01632   for(unsigned iView=0; iView<displayView_.size(); iView++) {
01633     if( !displayView_[iView] ) continue;
01634                 
01635     string name = directory;
01636     name += displayView_[iView]->GetName();
01637                 
01638     cout<<displayView_[iView]->GetName()<<endl;
01639                 
01640     string eps = name; eps += ".eps";
01641     displayView_[iView]->SaveAs( eps.c_str() );
01642                 
01643     string png = name; png += ".png";
01644     displayView_[iView]->SaveAs( png.c_str() );
01645   }
01646         
01647   string txt = directory;
01648   txt += "event.txt";
01649   ofstream out( txt.c_str() );
01650   if( !out ) 
01651     cerr<<"cannot open "<<txt<<endl;
01652   em_->print( out );
01653 }

void DisplayManager::printGenParticleInfo ( std::string  name,
int  barcode,
int  barcodeMother 
)

Definition at line 1696 of file DisplayManager.cc.

References GenMuonPlsPt100GeV_cfg::cout, em_, lat::endl(), flush(), edm::HepMCProduct::GetEvent(), PFRootEventManager::MCTruth_, and p.

Referenced by GPFGenParticle::Print().

01697 { 
01698   const HepMC::GenEvent* myGenEvent = em_->MCTruth_.GetEvent();
01699   HepMC::GenParticle *p = myGenEvent->barcode_to_particle(barcode);
01700   std::cout<<"genParticle "<<name<<" with barcode "<<barcode<<std::flush<<std::endl;
01701   p->print();
01702   if (barcodeMother) { 
01703     HepMC:: GenParticle *mother = myGenEvent->barcode_to_particle(barcodeMother);
01704     std::cout<<"mother particle with barcode "<<barcodeMother<<std::flush<<std::endl;
01705     mother->print();
01706   }    
01707 }

void DisplayManager::readOptions ( const char *  file  ) 

Definition at line 62 of file DisplayManager.cc.

References TestMuL1L2Filter_cff::cerr, clusEnMin_, clusPattern_, clusPSPattern_, clusterAttributes_, GenMuonPlsPt100GeV_cfg::cout, drawClus_, drawClusterL_, drawGenParticles_, drawHits_, drawParticles_, drawPFBlocks_, drawTracks_, lat::endl(), err, genParticlePtMin_, genPartPattern_, IO::GetOpt(), hitEnMin_, options_, particlePtMin_, setNewAttrToSimParticles(), simPartPatternDefault_, simPartPatternElec_, simPartPatternK_, simPartPatternL_, simPartPatternM_, simPartPatternMuon_, simPartPatternNeutron_, simPartPatternPhoton_, simPartPatternPi_, simPartPatternProton_, trackAttributes_, trackPatternL_, trackPatternM_, trackPtMin_, viewSize_, viewSizeEtaPhi_, and zoomFactor_.

Referenced by DisplayManager().

00062                                                       {
00063         
00064   try {
00065     delete options_;
00066     options_ = new IO(optfile);
00067   }
00068   catch( const string& err ) {
00069     cout<<err<<endl;
00070     return;
00071   }
00072         
00073   viewSizeEtaPhi_.clear();
00074   options_->GetOpt("display", "viewsize_etaphi", viewSizeEtaPhi_);
00075   if(viewSizeEtaPhi_.size() != 2) {
00076     cerr<<"PFRootEventManager::ReadOptions, bad display/viewsize_etaphi tag...using 700/350"
00077         <<endl;
00078     viewSizeEtaPhi_.clear();
00079     viewSizeEtaPhi_.push_back(700); 
00080     viewSizeEtaPhi_.push_back(350); 
00081   }
00082         
00083   viewSize_.clear();
00084   options_->GetOpt("display", "viewsize_xy", viewSize_);
00085   if(viewSize_.size() != 2) {
00086     cerr<<"PFRootEventManager::ReadOptions, bad display/viewsize_xy tag...using 700/350"
00087         <<endl;
00088     viewSize_.clear();
00089     viewSize_.push_back(600); 
00090     viewSize_.push_back(600); 
00091   } 
00092         
00093   clusterAttributes_.clear();
00094   options_->GetOpt("display", "cluster_attributes", clusterAttributes_);
00095   if(clusterAttributes_.size() != 4) {
00096     cerr<<"PFRootEventManager::::ReadOptions, bad display/cluster_attributes tag...using 20 10 2 5"
00097         <<endl;
00098     clusterAttributes_.clear();
00099     clusterAttributes_.push_back(2); //color
00100     clusterAttributes_.push_back(5);  // color if clusterPS
00101     clusterAttributes_.push_back(20); // marker style
00102     clusterAttributes_.push_back(10); //markersize *10
00103   }
00104   trackAttributes_.clear();
00105   options_->GetOpt("display", "track_attributes", trackAttributes_);
00106   if(trackAttributes_.size() != 4) {
00107     cerr<<"PFRootEventManager::::ReadOptions, bad display/track_attributes tag...using 103 1 8 8"
00108         <<endl;
00109     trackAttributes_.clear();
00110     trackAttributes_.push_back(103); //color Line and Marker
00111     trackAttributes_.push_back(1);  //line style
00112     trackAttributes_.push_back(8);   //Marker style
00113     trackAttributes_.push_back(8);   //Marker size *10
00114   }
00115         
00116         
00117   clusPattern_ = new TAttMarker(clusterAttributes_[0],clusterAttributes_[2],(double)clusterAttributes_[3]/10);
00118   clusPSPattern_ = new TAttMarker(clusterAttributes_[1],clusterAttributes_[2],(double)clusterAttributes_[3]/10);
00119   trackPatternL_ = new TAttLine(trackAttributes_[0],trackAttributes_[1],1);
00120   trackPatternM_ = new TAttMarker(trackAttributes_[0],trackAttributes_[2],(double)trackAttributes_[3]/10);
00121   
00122   genPartPattern_= new TAttMarker(kGreen-1,22,1.);
00123   
00124   simPartPatternPhoton_ = new TAttMarker(4,3,.8);
00125   simPartPatternElec_   = new TAttMarker(4,5,.8);
00126   simPartPatternMuon_   = new TAttMarker(4,2,.8);
00127   simPartPatternK_      = new TAttMarker(4,24,.8);
00128   simPartPatternPi_     = new TAttMarker(4,25,.8);
00129   simPartPatternProton_ = new TAttMarker(4,26,.8);
00130   simPartPatternNeutron_= new TAttMarker(4,27,.8);
00131   simPartPatternDefault_= new TAttMarker(4,30,.8);
00132         
00133   simPartPatternL_ = new TAttLine(4,2,1);
00134   simPartPatternM_.resize(8);
00135         
00136   setNewAttrToSimParticles();
00137         
00138   drawHits_= true;
00139   options_->GetOpt("display", "rechits",drawHits_);
00140         
00141   drawClus_ = true;
00142   options_->GetOpt("display", "clusters",drawClus_);
00143         
00144   drawClusterL_ = false;
00145   options_->GetOpt("display", "cluster_lines", drawClusterL_);
00146         
00147   drawTracks_ = true;
00148   options_->GetOpt("display", "rectracks", drawTracks_);
00149         
00150   drawParticles_ = true;
00151   options_->GetOpt("display", "particles", drawParticles_);
00152         
00153   particlePtMin_ = -1;
00154   options_->GetOpt("display", "particles_ptmin", particlePtMin_);
00155   
00156   
00157   drawGenParticles_=false;
00158   genParticlePtMin_ = 0;
00159   
00160   
00161   trackPtMin_ = -1;
00162   options_->GetOpt("display", "rectracks_ptmin", trackPtMin_);
00163         
00164   hitEnMin_ = -1;
00165   options_->GetOpt("display","rechits_enmin",hitEnMin_);
00166         
00167   clusEnMin_ = -1;
00168   options_->GetOpt("display","clusters_enmin",clusEnMin_);
00169         
00170         
00171   drawPFBlocks_  = false;
00172   options_->GetOpt("display","drawPFBlock",drawPFBlocks_);
00173   //redrawWithoutHits_=false;
00174         
00175   zoomFactor_ = 10;  
00176   options_->GetOpt("display", "zoom_factor", zoomFactor_);
00177         
00178 }

void DisplayManager::reset ( void   ) 

Definition at line 1655 of file DisplayManager.cc.

References blockIdentsMap_, graphicMap_, isGraphicLoaded_, maxERecHitEcal_, maxERecHitHcal_, p, and selectedGObj_.

Referenced by display(), displayNextInteresting(), and ~DisplayManager().

01656 {
01657   maxERecHitEcal_=-1;
01658   maxERecHitHcal_=-1;
01659   isGraphicLoaded_= false;
01660   
01661   std::multimap<int,GPFBase *>::iterator p;
01662   for (p=graphicMap_.begin();p!=graphicMap_.end();p++)
01663     delete p->second;
01664   graphicMap_.clear();
01665 
01666   blockIdentsMap_.clear(); 
01667   selectedGObj_.clear();
01668 
01669 }

void DisplayManager::rubOutGPFBlock (  )  [private]

Definition at line 970 of file DisplayManager.cc.

References drawGObject(), i, selectedGObj_, and size.

Referenced by displayPFBlock(), and findAndDraw().

00971 {
00972   int size = selectedGObj_.size();
00973   bool toInitial=true;
00974   int color=0;
00975   for (int i=0;i<size;i++) 
00976     drawGObject(selectedGObj_[i],color,toInitial);
00977 }

void DisplayManager::setNewAttrToSimParticles (  ) 

Definition at line 1682 of file DisplayManager.cc.

References simPartPatternDefault_, simPartPatternElec_, simPartPatternK_, simPartPatternM_, simPartPatternMuon_, simPartPatternNeutron_, simPartPatternPhoton_, simPartPatternPi_, and simPartPatternProton_.

Referenced by readOptions().

void DisplayManager::unZoom (  ) 

Definition at line 1671 of file DisplayManager.cc.

References displayHist_, i, and updateDisplay().

Referenced by DialogFrame::unZoom().

01672 {
01673   for( unsigned i=0; i<displayHist_.size(); i++) {
01674     // the corresponding view was not requested
01675     if( ! displayHist_[i] ) continue;
01676     displayHist_[i]->GetXaxis()->UnZoom();
01677     displayHist_[i]->GetYaxis()->UnZoom();
01678   }
01679   updateDisplay();
01680 }

void DisplayManager::updateDisplay (  ) 

Definition at line 1072 of file DisplayManager.cc.

References displayView_, i, and p.

Referenced by findAndDraw(), findBlock(), unZoom(), and DialogFrame::updateDisplay().

01072                                    {
01073   for(unsigned i=0; i<displayView_.size(); i++) {
01074     TPad* p =  displayView_[i];
01075     assert( p );
01076     p->Modified();
01077     p->Update();
01078   }
01079 }


Member Data Documentation

std::multimap<int , std::pair <int,int> > DisplayManager::blockIdentsMap_

Definition at line 77 of file DisplayManager.h.

Referenced by displayPFBlock(), findBlock(), loadGPFBlocks(), and reset().

double DisplayManager::clusEnMin_

Definition at line 58 of file DisplayManager.h.

Referenced by DialogFrame::createCmdFrame(), displayAll(), DialogFrame::doModifyPtThreshold(), and readOptions().

TAttMarker* DisplayManager::clusPattern_

Definition at line 84 of file DisplayManager.h.

Referenced by DialogFrame::createCanvasAttr(), createGCluster(), DialogFrame::modifyAttr(), and readOptions().

TAttMarker* DisplayManager::clusPSPattern_

Definition at line 85 of file DisplayManager.h.

Referenced by createGCluster(), and readOptions().

std::vector<int> DisplayManager::clusterAttributes_

Definition at line 81 of file DisplayManager.h.

Referenced by readOptions().

std::vector<TH2F*> DisplayManager::displayHist_ [private]

support histogram for x/y or r/z display.

Definition at line 132 of file DisplayManager.h.

Referenced by createCanvas(), displayCanvas(), lookForGenParticle(), lookForMaxRecHit(), and unZoom().

std::vector<TCanvas*> DisplayManager::displayView_ [private]

vector of canvas for x/y or r/z display

Definition at line 123 of file DisplayManager.h.

Referenced by createCanvas(), displayAll(), displayCanvas(), drawGObject(), lookForGenParticle(), lookForMaxRecHit(), printDisplay(), and updateDisplay().

bool DisplayManager::drawClus_

Definition at line 66 of file DisplayManager.h.

Referenced by DialogFrame::createCmdFrame(), displayAll(), DialogFrame::doModifyOptions(), and readOptions().

bool DisplayManager::drawClusterL_

Definition at line 67 of file DisplayManager.h.

Referenced by readOptions().

bool DisplayManager::drawGenParticles_

Definition at line 69 of file DisplayManager.h.

Referenced by DialogFrame::createCmdFrame(), displayAll(), DialogFrame::doModifyOptions(), and readOptions().

bool DisplayManager::drawHits_

Definition at line 64 of file DisplayManager.h.

Referenced by DialogFrame::createCmdFrame(), displayAll(), DialogFrame::doModifyOptions(), and readOptions().

bool DisplayManager::drawParticles_

Definition at line 68 of file DisplayManager.h.

Referenced by DialogFrame::createCmdFrame(), displayAll(), DialogFrame::doModifyOptions(), and readOptions().

bool DisplayManager::drawPFBlocks_

Definition at line 70 of file DisplayManager.h.

Referenced by DialogFrame::createCmdFrame(), displayPFBlock(), enableDrawPFBlock(), findAndDraw(), and readOptions().

bool DisplayManager::drawTracks_

Definition at line 65 of file DisplayManager.h.

Referenced by DialogFrame::createCmdFrame(), displayAll(), DialogFrame::doModifyOptions(), and readOptions().

PFRootEventManager* DisplayManager::em_ [private]

Definition at line 107 of file DisplayManager.h.

Referenced by createGGenParticle(), createGRecHit(), display(), DisplayManager(), displayNext(), displayNextInteresting(), displayPrevious(), findBlock(), getMaxE(), loadGClusters(), loadGGenParticles(), loadGPFBlocks(), loadGRecHits(), loadGRecTracks(), loadGSimParticles(), lookForGenParticle(), lookForMaxRecHit(), printDisplay(), and printGenParticleInfo().

int DisplayManager::eventNumber_ [private]

Definition at line 115 of file DisplayManager.h.

Referenced by display(), DisplayManager(), displayNext(), displayNextInteresting(), displayPrevious(), and printDisplay().

TBox DisplayManager::frontFaceECALRZ_ [private]

ECAL in RZ view.

Todo:
should be attribute ?

Definition at line 138 of file DisplayManager.h.

Referenced by createCanvas(), and displayCanvas().

TEllipse DisplayManager::frontFaceECALXY_ [private]

ECAL in XY view.

Todo:
should be attribute ?

Definition at line 135 of file DisplayManager.h.

Referenced by createCanvas(), and displayCanvas().

TEllipse DisplayManager::frontFaceHCALXY_ [private]

HCAL in XY view.

Todo:
should be attribute ?

Definition at line 141 of file DisplayManager.h.

Referenced by createCanvas(), and displayCanvas().

double DisplayManager::genParticlePtMin_

Definition at line 62 of file DisplayManager.h.

Referenced by DialogFrame::createCmdFrame(), displayAll(), DialogFrame::doModifyPtThreshold(), and readOptions().

TAttMarker* DisplayManager::genPartPattern_

Definition at line 90 of file DisplayManager.h.

Referenced by createGGenParticle(), and readOptions().

std::multimap<int,GPFBase *> DisplayManager::graphicMap_

Definition at line 75 of file DisplayManager.h.

Referenced by createGCluster(), createGGenParticle(), createGPart(), createGRecHit(), createGTrack(), displayAll(), drawGObject(), drawWithNewGraphicAttributes(), and reset().

double DisplayManager::hitEnMin_

Definition at line 59 of file DisplayManager.h.

Referenced by DialogFrame::createCmdFrame(), displayAll(), DialogFrame::doModifyPtThreshold(), and readOptions().

bool DisplayManager::isGraphicLoaded_ [private]

Definition at line 114 of file DisplayManager.h.

Referenced by display(), displayAll(), displayNextInteresting(), and reset().

double DisplayManager::maxERecHitEcal_ [private]

Definition at line 112 of file DisplayManager.h.

Referenced by getMaxEEcal(), and reset().

double DisplayManager::maxERecHitHcal_ [private]

Definition at line 113 of file DisplayManager.h.

Referenced by getMaxEHcal(), and reset().

int DisplayManager::maxEvents_ [private]

Definition at line 116 of file DisplayManager.h.

Referenced by display(), and DisplayManager().

IO* DisplayManager::options_ [private]

options file parser

Definition at line 110 of file DisplayManager.h.

Referenced by readOptions().

double DisplayManager::particlePtMin_

Definition at line 61 of file DisplayManager.h.

Referenced by DialogFrame::createCmdFrame(), displayAll(), DialogFrame::doModifyPtThreshold(), and readOptions().

std::vector<int> DisplayManager::selectedGObj_ [private]

graphic object containers

Definition at line 150 of file DisplayManager.h.

Referenced by displayPFBlock(), drawGObject(), findAndDraw(), reset(), and rubOutGPFBlock().

int DisplayManager::shiftId_ [private]

Definition at line 119 of file DisplayManager.h.

Referenced by createGGenParticle(), displayAll(), drawWithNewGraphicAttributes(), findAndDraw(), loadGClusters(), loadGPFBlocks(), loadGRecHits(), loadGRecTracks(), and loadGSimParticles().

TAttMarker* DisplayManager::simPartPatternDefault_

Definition at line 100 of file DisplayManager.h.

Referenced by readOptions(), and setNewAttrToSimParticles().

TAttMarker* DisplayManager::simPartPatternElec_

Definition at line 94 of file DisplayManager.h.

Referenced by readOptions(), and setNewAttrToSimParticles().

TAttMarker* DisplayManager::simPartPatternK_

Definition at line 96 of file DisplayManager.h.

Referenced by readOptions(), and setNewAttrToSimParticles().

TAttLine* DisplayManager::simPartPatternL_

Definition at line 92 of file DisplayManager.h.

Referenced by createGPart(), and readOptions().

std::vector<TAttMarker *> DisplayManager::simPartPatternM_

Definition at line 102 of file DisplayManager.h.

Referenced by createGPart(), readOptions(), and setNewAttrToSimParticles().

TAttMarker* DisplayManager::simPartPatternMuon_

Definition at line 95 of file DisplayManager.h.

Referenced by readOptions(), and setNewAttrToSimParticles().

TAttMarker* DisplayManager::simPartPatternNeutron_

Definition at line 99 of file DisplayManager.h.

Referenced by readOptions(), and setNewAttrToSimParticles().

TAttMarker* DisplayManager::simPartPatternPhoton_

Definition at line 93 of file DisplayManager.h.

Referenced by readOptions(), and setNewAttrToSimParticles().

TAttMarker* DisplayManager::simPartPatternPi_

Definition at line 97 of file DisplayManager.h.

Referenced by readOptions(), and setNewAttrToSimParticles().

TAttMarker* DisplayManager::simPartPatternProton_

Definition at line 98 of file DisplayManager.h.

Referenced by readOptions(), and setNewAttrToSimParticles().

std::vector<int> DisplayManager::trackAttributes_

Definition at line 80 of file DisplayManager.h.

Referenced by readOptions().

TAttLine* DisplayManager::trackPatternL_

Definition at line 88 of file DisplayManager.h.

Referenced by DialogFrame::createCanvasAttr(), createGTrack(), DialogFrame::modifyAttr(), and readOptions().

TAttMarker* DisplayManager::trackPatternM_

Definition at line 87 of file DisplayManager.h.

Referenced by DialogFrame::createCanvasAttr(), createGTrack(), DialogFrame::modifyAttr(), and readOptions().

double DisplayManager::trackPtMin_

Definition at line 60 of file DisplayManager.h.

Referenced by DialogFrame::createCmdFrame(), displayAll(), DialogFrame::doModifyPtThreshold(), and readOptions().

std::vector<int> DisplayManager::viewSize_ [private]

display pad xy size for (x,y) or (r,z) display

Definition at line 126 of file DisplayManager.h.

Referenced by createCanvas(), and readOptions().

std::vector<int> DisplayManager::viewSizeEtaPhi_ [private]

display pad xy size for eta/phi view

Definition at line 129 of file DisplayManager.h.

Referenced by readOptions().

double DisplayManager::zoomFactor_ [private]

Definition at line 117 of file DisplayManager.h.

Referenced by lookForGenParticle(), lookForMaxRecHit(), and readOptions().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:18:29 2009 for CMSSW by  doxygen 1.5.4