00001 #include <iostream>
00002 #include <fstream>
00003 #include <stdlib.h>
00004
00005 #include "RecoParticleFlow/PFRootEvent/interface/IO.h"
00006
00007 #include "DataFormats/ParticleFlowReco/interface/PFBlock.h"
00008 #include "RecoParticleFlow/PFProducer/interface/PFGeometry.h"
00009 #include "DataFormats/ParticleFlowReco/interface/PFBlockElement.h"
00010 #include "DataFormats/ParticleFlowReco/interface/PFClusterFwd.h"
00011
00012
00013 #include "DataFormats/Math/interface/Point3D.h"
00014
00015 #include "DataFormats/FWLite/interface/ChainEvent.h"
00016
00017 #include "RecoParticleFlow/PFRootEvent/interface/PFRootEventManager.h"
00018 #include "RecoParticleFlow/PFRootEvent/interface/DisplayManager.h"
00019 #include "RecoParticleFlow/PFRootEvent/interface/GPFRecHit.h"
00020 #include "RecoParticleFlow/PFRootEvent/interface/GPFCluster.h"
00021 #include "RecoParticleFlow/PFRootEvent/interface/GPFTrack.h"
00022 #include "RecoParticleFlow/PFRootEvent/interface/GPFSimParticle.h"
00023 #include "RecoParticleFlow/PFRootEvent/interface/GPFGenParticle.h"
00024 #include "RecoParticleFlow/PFRootEvent/interface/GPFBase.h"
00025
00026 #include <TH2.h>
00027 #include <TTree.h>
00028 #include <TVector3.h>
00029 #include <TH2F.h>
00030 #include <TEllipse.h>
00031 #include <TLine.h>
00032 #include <TLatex.h>
00033 #include <TList.h>
00034 #include <TColor.h>
00035 #include <TMath.h>
00036 #include <TApplication.h>
00037
00038 using namespace std;
00039
00040
00041
00042 DisplayManager::DisplayManager(PFRootEventManager *em,
00043 const char* optfile ) :
00044 em_(em),
00045 options_(0),
00046 maxERecHitEcal_(-1),
00047 maxERecHitHcal_(-1),
00048 isGraphicLoaded_(false),
00049 shiftId_(SHIFTID) {
00050
00051 readOptions( optfile );
00052
00053 eventNumber_ = em_->eventNumber();
00054
00055 maxEvents_= em_->ev_->size();
00056
00057 createCanvas();
00058 }
00059
00060 DisplayManager::~DisplayManager()
00061 {
00062 reset();
00063 }
00064
00065
00066 void DisplayManager::readOptions( const char* optfile ) {
00067
00068 try {
00069 delete options_;
00070 options_ = new IO(optfile);
00071 }
00072 catch( const string& err ) {
00073 cout<<err<<endl;
00074 return;
00075 }
00076
00077 viewSizeEtaPhi_.clear();
00078 options_->GetOpt("display", "viewsize_etaphi", viewSizeEtaPhi_);
00079 if(viewSizeEtaPhi_.size() != 2) {
00080 cerr<<"PFRootEventManager::ReadOptions, bad display/viewsize_etaphi tag...using 700/350"
00081 <<endl;
00082 viewSizeEtaPhi_.clear();
00083 viewSizeEtaPhi_.push_back(700);
00084 viewSizeEtaPhi_.push_back(350);
00085 }
00086
00087 viewSize_.clear();
00088 options_->GetOpt("display", "viewsize_xy", viewSize_);
00089 if(viewSize_.size() != 2) {
00090 cerr<<"PFRootEventManager::ReadOptions, bad display/viewsize_xy tag...using 700/350"
00091 <<endl;
00092 viewSize_.clear();
00093 viewSize_.push_back(600);
00094 viewSize_.push_back(600);
00095 }
00096
00097 clusterAttributes_.clear();
00098 options_->GetOpt("display", "cluster_attributes", clusterAttributes_);
00099 if(clusterAttributes_.size() != 4) {
00100 cerr<<"PFRootEventManager::::ReadOptions, bad display/cluster_attributes tag...using 20 10 2 5"
00101 <<endl;
00102 clusterAttributes_.clear();
00103 clusterAttributes_.push_back(2);
00104 clusterAttributes_.push_back(5);
00105 clusterAttributes_.push_back(20);
00106 clusterAttributes_.push_back(1);
00107 }
00108 trackAttributes_.clear();
00109 options_->GetOpt("display", "track_attributes", trackAttributes_);
00110 if(trackAttributes_.size() != 4) {
00111 cerr<<"PFRootEventManager::::ReadOptions, bad display/track_attributes tag...using 103 1 8 8"
00112 <<endl;
00113 trackAttributes_.clear();
00114 trackAttributes_.push_back(103);
00115 trackAttributes_.push_back(1);
00116 trackAttributes_.push_back(8);
00117 trackAttributes_.push_back(0.8);
00118 }
00119 gsfAttributes_.clear();
00120 options_->GetOpt("display", "gsf_attributes", gsfAttributes_);
00121 if(gsfAttributes_.size() != 4) {
00122 cerr<<"PFRootEventManager::::ReadOptions, bad display/gsf_attributes tag...using 105 1 8 8"
00123 <<endl;
00124 gsfAttributes_.clear();
00125 gsfAttributes_.push_back(105);
00126 gsfAttributes_.push_back(1);
00127 gsfAttributes_.push_back(8);
00128 gsfAttributes_.push_back(0.8);
00129 }
00130 bremAttributes_.clear();
00131 options_->GetOpt("display", "brem_attributes", bremAttributes_);
00132 if(bremAttributes_.size() != 4) {
00133 cerr<<"PFRootEventManager::::ReadOptions, bad display/gsf_attributes tag...using 106 1 8 8"
00134 <<endl;
00135 bremAttributes_.clear();
00136 bremAttributes_.push_back(106);
00137 bremAttributes_.push_back(1);
00138 bremAttributes_.push_back(8);
00139 bremAttributes_.push_back(0.8);
00140 }
00141
00142 clusPattern_ = new TAttMarker( (int)clusterAttributes_[0],
00143 (int)clusterAttributes_[2],
00144 clusterAttributes_[3]);
00145 clusPSPattern_ = new TAttMarker( (int)clusterAttributes_[1],
00146 (int)clusterAttributes_[2],
00147 clusterAttributes_[3]);
00148 trackPatternL_ = new TAttLine( (int)trackAttributes_[0],
00149 (int)trackAttributes_[1],
00150 1);
00151 trackPatternM_ = new TAttMarker( (int)trackAttributes_[0],
00152 (int)trackAttributes_[2],
00153 trackAttributes_[3]);
00154
00155 gsfPatternL_ = new TAttLine( (int)gsfAttributes_[0],
00156 (int)gsfAttributes_[1],
00157 1);
00158 gsfPatternM_ = new TAttMarker( (int)gsfAttributes_[0],
00159 (int)gsfAttributes_[2],
00160 gsfAttributes_[3]);
00161
00162 bremPatternL_ = new TAttLine( (int)bremAttributes_[0],
00163 (int)bremAttributes_[1],
00164 1);
00165 bremPatternM_ = new TAttMarker( (int)bremAttributes_[0],
00166 (int)bremAttributes_[2],
00167 bremAttributes_[3]);
00168
00169 genPartPattern_= new TAttMarker(kGreen-1,22,1.);
00170
00171
00172 std::vector<float> simPartAttributes;
00173 options_->GetOpt("display", "simPart_attributes", simPartAttributes);
00174 if(simPartAttributes.size() != 3) {
00175 cerr<<"PFRootEventManager::::ReadOptions, bad display/simPart_attributes tag...using 103 1 8 8"
00176 <<endl;
00177 simPartAttributes.push_back(4);
00178 simPartAttributes.push_back(2);
00179 simPartAttributes.push_back(1);
00180 }
00181
00182 int simColor = (int)simPartAttributes[0];
00183 int simLStyle = (int)simPartAttributes[1];
00184 float simMSize = simPartAttributes[2];
00185
00186 simPartPatternPhoton_ = new TAttMarker(simColor,3,simMSize);
00187 simPartPatternElec_ = new TAttMarker(simColor,5,simMSize);
00188 simPartPatternMuon_ = new TAttMarker(simColor,2,simMSize);
00189 simPartPatternK_ = new TAttMarker(simColor,24,simMSize);
00190 simPartPatternPi_ = new TAttMarker(simColor,25,simMSize);
00191 simPartPatternProton_ = new TAttMarker(simColor,26,simMSize);
00192 simPartPatternNeutron_= new TAttMarker(simColor,27,simMSize);
00193 simPartPatternDefault_= new TAttMarker(simColor,30,simMSize);
00194
00195 simPartPatternL_ = new TAttLine(simColor,simLStyle,1);
00196 simPartPatternM_.resize(8);
00197
00198 setNewAttrToSimParticles();
00199
00200 drawHits_= true;
00201 options_->GetOpt("display", "rechits",drawHits_);
00202
00203 drawClus_ = true;
00204 options_->GetOpt("display", "clusters",drawClus_);
00205
00206 drawClusterL_ = false;
00207 options_->GetOpt("display", "cluster_lines", drawClusterL_);
00208
00209 drawTracks_ = true;
00210 options_->GetOpt("display", "rectracks", drawTracks_);
00211
00212 drawGsfTracks_ = true;
00213 options_->GetOpt("display", "gsftracks", drawGsfTracks_);
00214
00215 drawBrems_ = false;
00216 options_->GetOpt("display", "brems", drawBrems_);
00217
00218 drawParticles_ = true;
00219 options_->GetOpt("display", "particles", drawParticles_);
00220
00221 particlePtMin_ = -1;
00222 options_->GetOpt("display", "particles_ptmin", particlePtMin_);
00223
00224
00225 drawGenParticles_=false;
00226 genParticlePtMin_ = 0;
00227
00228
00229 trackPtMin_ = -1;
00230 options_->GetOpt("display", "rectracks_ptmin", trackPtMin_);
00231
00232 gsfPtMin_ = -1;
00233 options_->GetOpt("display", "gsfrectracks_ptmin", gsfPtMin_);
00234
00235 hitEnMin_ = -1;
00236 options_->GetOpt("display","rechits_enmin",hitEnMin_);
00237
00238 clusEnMin_ = -1;
00239 options_->GetOpt("display","clusters_enmin",clusEnMin_);
00240
00241
00242 drawPFBlocks_ = false;
00243 options_->GetOpt("display","drawPFBlock",drawPFBlocks_);
00244
00245
00246 zoomFactor_ = 10;
00247 options_->GetOpt("display", "zoom_factor", zoomFactor_);
00248
00249 }
00250
00251
00252 void DisplayManager::createCanvas()
00253 {
00254
00255
00256 displayView_.resize(NViews);
00257 displayHist_.resize(NViews);
00258
00259
00260
00261
00262
00263
00264 displayView_[XY] = new TCanvas("displayXY_", "XY view",viewSize_[0], viewSize_[1]);
00265 displayView_[RZ] = new TCanvas("displayRZ_", "RZ view",viewSize_[0], viewSize_[1]);
00266 displayView_[EPE] = new TCanvas("displayEPE_", "eta/phi view, ECAL",viewSize_[0], viewSize_[1]);
00267 displayView_[EPH] = new TCanvas("displayEPH_", "eta/phi view, HCAL",viewSize_[0], viewSize_[1]);
00268
00269
00270 for (int viewType=0;viewType<NViews;++viewType) {
00271 displayView_[viewType]->SetGrid(0, 0);
00272 displayView_[viewType]->SetBottomMargin(0.14);
00273 displayView_[viewType]->SetLeftMargin(0.15);
00274 displayView_[viewType]->SetRightMargin(0.05);
00275 displayView_[viewType]->ToggleToolBar();
00276 }
00277
00278
00279 double zLow = -500.;
00280 double zUp = +500.;
00281 double rLow = -300.;
00282 double rUp = +300.;
00283 displayHist_[XY] = new TH2F("hdisplayHist_XY", "", 500, rLow, rUp,
00284 500, rLow, rUp);
00285 displayHist_[XY]->SetXTitle("X [cm]");
00286 displayHist_[XY]->SetYTitle("Y [cm]");
00287
00288 displayHist_[RZ] = new TH2F("hdisplayHist_RZ", "",500, zLow, zUp,
00289 500, rLow, rUp);
00290 displayHist_[RZ]->SetXTitle("Z [cm]");
00291 displayHist_[RZ]->SetYTitle("R [cm]");
00292
00293 displayHist_[EPE] = new TH2F("hdisplayHist_EP", "", 500, -5, 5,
00294 500, -3.5, 3.5);
00295 displayHist_[EPE]->SetXTitle("#eta");
00296 displayHist_[EPE]->SetYTitle("#phi [rad]");
00297
00298 displayHist_[EPH] = displayHist_[EPE];
00299
00300 for (int viewType=0;viewType<NViews;++viewType){
00301 displayHist_[viewType]->SetStats(kFALSE);
00302 displayHist_[viewType]->GetYaxis()->SetTitleSize(0.06);
00303 displayHist_[viewType]->GetYaxis()->SetTitleOffset(1.2);
00304 displayHist_[viewType]->GetXaxis()->SetTitleSize(0.06);
00305 displayHist_[viewType]->GetYaxis()->SetLabelSize(0.045);
00306 displayHist_[viewType]->GetXaxis()->SetLabelSize(0.045);
00307 }
00308
00309
00310 frontFaceECALXY_.SetX1(0);
00311 frontFaceECALXY_.SetY1(0);
00312 frontFaceECALXY_.SetR1(PFGeometry::innerRadius(PFGeometry::ECALBarrel));
00313 frontFaceECALXY_.SetR2(PFGeometry::innerRadius(PFGeometry::ECALBarrel));
00314 frontFaceECALXY_.SetFillStyle(0);
00315
00316
00317 frontFaceHCALXY_.SetX1(0);
00318 frontFaceHCALXY_.SetY1(0);
00319 frontFaceHCALXY_.SetR1(PFGeometry::innerRadius(PFGeometry::HCALBarrel));
00320 frontFaceHCALXY_.SetR2(PFGeometry::innerRadius(PFGeometry::HCALBarrel));
00321 frontFaceHCALXY_.SetFillStyle(0);
00322
00323
00324 frontFaceECALRZ_.SetX1(-1.*PFGeometry::innerZ(PFGeometry::ECALEndcap));
00325 frontFaceECALRZ_.SetY1(-1.*PFGeometry::innerRadius(PFGeometry::ECALBarrel));
00326 frontFaceECALRZ_.SetX2(PFGeometry::innerZ(PFGeometry::ECALEndcap));
00327 frontFaceECALRZ_.SetY2(PFGeometry::innerRadius(PFGeometry::ECALBarrel));
00328 frontFaceECALRZ_.SetFillStyle(0);
00329
00330 }
00331
00332 void DisplayManager::createGCluster(const reco::PFCluster& cluster,
00333 int ident,
00334 double phi0)
00335 {
00336
00337 double eta = cluster.position().Eta();
00338 double phi = cluster.position().Phi();
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355 int clusType=0;
00356
00357 if ( cluster.layer()==PFLayer::PS1 || cluster.layer()==PFLayer::PS2 )
00358 clusType=1;
00359
00360 const math::XYZPoint& xyzPos = cluster.position();
00361
00362 GPFCluster *gc;
00363
00364 for (int viewType=0;viewType<4;viewType++){
00365
00366 switch(viewType) {
00367 case XY:
00368 {
00369 if (clusType==0) {
00370 gc = new GPFCluster(this,
00371 viewType,ident,
00372 &cluster,
00373 xyzPos.X(), xyzPos.Y(), clusPattern_);
00374 }
00375 else {
00376 gc = new GPFCluster(this,
00377 viewType,ident,
00378 &cluster,
00379 xyzPos.X(), xyzPos.Y(), clusPSPattern_);
00380 }
00381 graphicMap_.insert(pair<int,GPFBase *> (ident, gc));
00382 }
00383 break;
00384 case RZ:
00385 {
00386 double sign = 1.;
00387 if (cos(phi0 - phi) < 0.)
00388 sign = -1.;
00389 if ( clusType==0) {
00390 gc = new GPFCluster(this,
00391 viewType,ident,
00392 &cluster,
00393 xyzPos.z(),sign*xyzPos.Rho(),
00394 clusPattern_);
00395 }
00396 else {
00397 gc = new GPFCluster(this,
00398 viewType,ident,
00399 &cluster,
00400 xyzPos.z(),sign*xyzPos.Rho(),
00401 clusPattern_);
00402 }
00403
00404 graphicMap_.insert(pair<int,GPFBase *> (ident, gc));
00405
00406 }
00407 break;
00408 case EPE:
00409 {
00410 if( cluster.layer()<0 || cluster.layer()==PFLayer::HF_EM) {
00411 if (clusType==0) {
00412 gc = new GPFCluster(this,
00413 viewType,ident,
00414 &cluster,
00415 eta,phi,
00416 clusPattern_);
00417 }
00418 else {
00419 gc = new GPFCluster(this,
00420 viewType,ident,
00421 &cluster,
00422 eta,phi,
00423 clusPSPattern_);
00424 }
00425
00426 graphicMap_.insert(pair<int,GPFBase *> (ident, gc));
00427 }
00428
00429 }
00430 break;
00431 case EPH:
00432 {
00433 if( cluster.layer()>0 && cluster.layer()!=PFLayer::HF_EM) {
00434 if (clusType==0) {
00435 gc = new GPFCluster(this,
00436 viewType,ident,
00437 &cluster,
00438 eta,phi,clusPattern_);
00439 }
00440 else {
00441 gc = new GPFCluster(this,
00442 viewType,ident,
00443 &cluster,
00444 eta,phi,clusPSPattern_);
00445 }
00446
00447
00448 graphicMap_.insert(pair<int,GPFBase *> (ident, gc));
00449 }
00450 }
00451 break;
00452 default :break;
00453 }
00454 }
00455 }
00456
00457 void DisplayManager::createGPart( const reco::PFSimParticle &ptc,
00458 const std::vector<reco::PFTrajectoryPoint>& points,
00459 int ident,double pt,double phi0, double sign, bool displayInitial,
00460 int markerIndex)
00461 {
00462
00463
00464 bool debug_createGpart = false;
00465
00466 for (int viewType=0;viewType<4;++viewType) {
00467
00468 vector<double> xPos;
00469 xPos.reserve( points.size() );
00470 vector<double> yPos;
00471 yPos.reserve( points.size() );
00472
00473 for(unsigned i=0; i<points.size(); i++) {
00474
00475 if( !points[i].isValid() ) continue;
00476
00477 const math::XYZPoint& xyzPos = points[i].position();
00478
00479 double eta = xyzPos.Eta();
00480 double phi = xyzPos.Phi();
00481
00482
00483
00484
00485 if( points[i].layer() == reco::PFTrajectoryPoint::ClosestApproach ) {
00486
00487
00488
00489 const math::XYZTLorentzVector& mom = points[i].momentum();
00490 eta = mom.Eta();
00491 phi = mom.Phi();
00492 }
00493
00494
00495
00496
00497 switch(viewType) {
00498 case XY:
00499 xPos.push_back(xyzPos.X());
00500 yPos.push_back(xyzPos.Y());
00501 break;
00502 case RZ:
00503 xPos.push_back(xyzPos.Z());
00504 yPos.push_back(sign*xyzPos.Rho());
00505 break;
00506 case EPE:
00507 case EPH:
00508 xPos.push_back( eta );
00509 yPos.push_back( phi );
00510 break;
00511 default:break;
00512 }
00513 }
00514 if (viewType == EPE && debug_createGpart) {
00515 cout << " display PFsim eta/phi view ECAL" << endl;
00516 cout << " nb of points for display " << xPos.size() << endl;
00517 for(unsigned i=0; i<xPos.size(); i++) {
00518 cout << " point " << i << " x/y " << xPos[i] <<"/" << yPos[i]<< endl;
00519 }
00520 }
00521
00523
00524
00525 GPFSimParticle *gc = new GPFSimParticle(this,
00526 viewType, ident,
00527 &ptc,
00528 xPos.size(),&xPos[0],&yPos[0],
00529 pt,
00530 simPartPatternM_[markerIndex],
00531 simPartPatternL_,
00532 "pl");
00533
00534 graphicMap_.insert(pair<int,GPFBase *> (ident, gc));
00535
00536 }
00537 }
00538
00539 void DisplayManager::createGRecHit(reco::PFRecHit& rh,int ident, double maxe, double phi0, int color)
00540 {
00541
00542 double me = maxe;
00543 double thresh = 0;
00544 int layer = rh.layer();
00545
00546
00547 switch(layer) {
00548 case PFLayer::ECAL_BARREL:
00549 thresh = em_->clusterAlgoECAL_.threshBarrel();
00550 break;
00551 case PFLayer::ECAL_ENDCAP:
00552 thresh = em_->clusterAlgoECAL_.threshEndcap();
00553 break;
00554 case PFLayer::HCAL_BARREL1:
00555 case PFLayer::HCAL_BARREL2:
00556 thresh = em_->clusterAlgoHCAL_.threshBarrel();
00557 break;
00558 case PFLayer::HCAL_ENDCAP:
00559 thresh = em_->clusterAlgoHCAL_.threshEndcap();
00560 break;
00561 case PFLayer::HF_HAD:
00562
00563 thresh = em_->clusterAlgoHFHAD_.threshEndcap();
00564 break;
00565 case PFLayer::HF_EM:
00566
00567 thresh = em_->clusterAlgoHFEM_.threshEndcap();
00568 break;
00569 case PFLayer::PS1:
00570 case PFLayer::PS2:
00571 me = -1;
00572 thresh = em_->clusterAlgoPS_.threshBarrel();
00573 break;
00574 default:
00575 {
00576 cerr<<"DisplayManager::createGRecHit : manage other layers."
00577 <<" GRechit notcreated."<<endl;
00578 return;
00579 }
00580 }
00581 if( rh.energy() < thresh ) return;
00582
00583
00584 for(int viewType=0;viewType<4;++viewType) {
00585
00586 bool isHCAL = (layer == PFLayer::HCAL_BARREL1 ||
00587 layer == PFLayer::HCAL_BARREL2 ||
00588 layer == PFLayer::HCAL_ENDCAP ||
00589 layer == PFLayer::HF_HAD);
00590
00591 if( viewType == EPH &&
00592 ! isHCAL) {
00593 continue;
00594 }
00595
00596 if( viewType == EPE && isHCAL ) {
00597 continue;
00598 }
00599 double rheta = rh.position().Eta();
00600 double rhphi = rh.position().Phi();
00601
00602 double sign = 1.;
00603 if (cos(phi0 - rhphi) < 0.) sign = -1.;
00604
00605
00606 double etaSize[4];
00607 double phiSize[4];
00608 double x[5];
00609 double y[5];
00610 double z[5];
00611 double r[5];
00612 double eta[5];
00613 double phi[5];
00614 double xprop[5];
00615 double yprop[5];
00616 double etaprop[5];
00617 double phiprop[5];
00618
00619
00620 const std::vector< math::XYZPoint >& corners = rh.getCornersXYZ();
00621 assert(corners.size() == 4);
00622 double propfact = 0.95;
00623 double ampl=0;
00624 if(me>0) ampl = (log(rh.energy() + 1.)/log(me + 1.));
00625 for ( unsigned jc=0; jc<4; ++jc ) {
00626
00627 phiSize[jc] = rhphi-corners[jc].Phi();
00628 etaSize[jc] = rheta-corners[jc].Eta();
00629 if ( phiSize[jc] > 1. ) phiSize[jc] -= 2.*TMath::Pi();
00630 if ( phiSize[jc] < -1. ) phiSize[jc]+= 2.*TMath::Pi();
00631
00632 phiSize[jc] *= propfact;
00633 etaSize[jc] *= propfact;
00634
00635 math::XYZPoint cornerposxyz = corners[jc];
00636
00637 x[jc] = cornerposxyz.X();
00638 y[jc] = cornerposxyz.Y();
00639 z[jc] = cornerposxyz.Z();
00640 r[jc] = sign*cornerposxyz.Rho();
00641 eta[jc] = rheta - etaSize[jc];
00642 phi[jc] = rhphi - phiSize[jc];
00643
00644
00645
00646
00647
00648 if( layer != PFLayer::PS1 &&
00649 layer != PFLayer::PS2 &&
00650 ( viewType == EPE ||
00651 viewType == EPH ||
00652 ( viewType == XY &&
00653 ( layer == PFLayer::ECAL_ENDCAP ||
00654 layer == PFLayer::HCAL_ENDCAP ||
00655 layer == PFLayer::HF_HAD
00656 ) ) ) ) {
00657
00658
00659 math::XYZPoint centreXYZrot = rh.position();
00660
00661 math::XYZPoint centertocorner(x[jc] - centreXYZrot.X(),
00662 y[jc] - centreXYZrot.Y(),
00663 0 );
00664
00665 math::XYZPoint centertocornerep(eta[jc] - centreXYZrot.Eta(),
00666 phi[jc] - centreXYZrot.Phi(),
00667 0 );
00668
00669
00670
00671 xprop[jc] = centreXYZrot.X() + centertocorner.X()*ampl;
00672 yprop[jc] = centreXYZrot.Y() + centertocorner.Y()*ampl;
00673
00674 etaprop[jc] = centreXYZrot.Eta() + centertocornerep.X()*ampl;
00675 phiprop[jc] = centreXYZrot.Phi() + centertocornerep.Y()*ampl;
00676 }
00677 }
00678
00679 if(layer == PFLayer::ECAL_BARREL ||
00680 layer == PFLayer::HCAL_BARREL1 ||
00681 layer == PFLayer::HCAL_BARREL2 || viewType == RZ) {
00682
00683
00684
00685
00686 int i1 = -1;
00687 int i2 = -1;
00688
00689 if(fabs(phiSize[1]-phiSize[0]) > 0.0001) {
00690 if (viewType == XY) {
00691 i1 = 2;
00692 i2 = 3;
00693 } else if (viewType == RZ) {
00694 i1 = 1;
00695 i2 = 2;
00696 }
00697 } else {
00698 if (viewType == XY) {
00699 i1 = 1;
00700 i2 = 2;
00701 } else if (viewType == RZ) {
00702 i1 = 2;
00703 i2 = 3;
00704 }
00705 }
00706
00707 x[i1] *= 1+ampl/2.;
00708 x[i2] *= 1+ampl/2.;
00709 y[i1] *= 1+ampl/2.;
00710 y[i2] *= 1+ampl/2.;
00711 z[i1] *= 1+ampl/2.;
00712 z[i2] *= 1+ampl/2.;
00713 r[i1] *= 1+ampl/2.;
00714 r[i2] *= 1+ampl/2.;
00715 }
00716 x[4]=x[0];
00717 y[4]=y[0];
00718 z[4]=z[0];
00719 r[4]=r[0];
00720 eta[4]=eta[0];
00721 phi[4]=phi[0];
00722
00723 int npoints=5;
00724
00725 switch( viewType ) {
00726 case XY:
00727 {
00728 if(layer == PFLayer::ECAL_BARREL ||
00729 layer == PFLayer::HCAL_BARREL1 ||
00730 layer == PFLayer::HCAL_BARREL2) {
00731 graphicMap_.insert(pair<int,GPFBase *> (ident,new GPFRecHit(this, viewType,ident,&rh,npoints,x,y,color,"f")));
00732
00733 } else {
00734 graphicMap_.insert(pair<int,GPFBase *> (ident,new GPFRecHit(this, viewType,ident,&rh,npoints,x,y,color,"l")));
00735 if( ampl>0 ) {
00736 xprop[4]=xprop[0];
00737 yprop[4]=yprop[0];
00738 graphicMap_.insert(pair<int,GPFBase *> (ident,new GPFRecHit(this, viewType,ident,&rh,npoints,xprop,yprop,color,"f")));
00739 }
00740 }
00741 }
00742 break;
00743
00744 case RZ:
00745 graphicMap_.insert(pair<int,GPFBase *> (ident,new GPFRecHit(this, viewType,ident,&rh,npoints,z,r,color,"f")));
00746 break;
00747
00748 case EPE:
00749 {
00750 graphicMap_.insert(pair<int,GPFBase *> (ident,new GPFRecHit(this, viewType,ident,&rh,npoints,eta,phi,color,"l")));
00751
00752 if( ampl>0 ) {
00753 etaprop[4]=etaprop[0];
00754 phiprop[4]=phiprop[0];
00755 graphicMap_.insert(pair<int,GPFBase *> (ident,new GPFRecHit(this, viewType,ident,&rh,npoints,etaprop,phiprop,color,"f")));
00756 }
00757 }
00758 break;
00759 case EPH:
00760 {
00761 graphicMap_.insert(pair<int,GPFBase *> (ident,new GPFRecHit(this, viewType,ident,&rh,npoints,eta,phi,color,"l")));
00762
00763 if( ampl>0 ) {
00764 etaprop[4]=etaprop[0];
00765 phiprop[4]=phiprop[0];
00766 graphicMap_.insert(pair<int,GPFBase *> (ident,new GPFRecHit(this, viewType,ident,&rh,npoints,etaprop,phiprop,color,"f")));
00767 }
00768 }
00769 break;
00770
00771 default: break;
00772 }
00773
00774 }
00775 }
00776
00777
00778 void DisplayManager::createGTrack( reco::PFRecTrack &tr,
00779 const std::vector<reco::PFTrajectoryPoint>& points,
00780 int ident,double pt,double phi0, double sign, bool displayInitial,
00781 int linestyle,int kfgsfbrem)
00782 {
00783
00784
00785
00786
00787 for (int viewType=0;viewType<4;++viewType) {
00788
00789 vector<double> xPos;
00790 xPos.reserve( points.size() );
00791 vector<double> yPos;
00792 yPos.reserve( points.size() );
00793
00794 for(unsigned i=0; i<points.size(); i++) {
00795 if( !points[i].isValid() ) continue;
00796
00797 const math::XYZPoint& xyzPos = points[i].position();
00798
00799
00800
00801 double eta = xyzPos.Eta();
00802 double phi = xyzPos.Phi();
00803
00804 if( !displayInitial &&
00805 points[i].layer() == reco::PFTrajectoryPoint::ClosestApproach ) {
00806 const math::XYZTLorentzVector& mom = points[i].momentum();
00807 eta = mom.Eta();
00808 phi = mom.Phi();
00809 }
00810
00811
00812
00813
00814
00815 switch(viewType) {
00816 case XY:
00817 xPos.push_back(xyzPos.X());
00818 yPos.push_back(xyzPos.Y());
00819 break;
00820 case RZ:
00821 xPos.push_back(xyzPos.Z());
00822 yPos.push_back(sign*xyzPos.Rho());
00823 break;
00824 case EPE:
00825 case EPH:
00826 xPos.push_back( eta );
00827 yPos.push_back( phi );
00828 break;
00829 }
00830 }
00832
00833
00834
00835 GPFTrack *gt=0;
00836 if(kfgsfbrem==0) {
00837 gt = new GPFTrack(this,
00838 viewType,ident,
00839 &tr,
00840 xPos.size(),&xPos[0],&yPos[0],pt,
00841 trackPatternM_,trackPatternL_,"pl");
00842 }
00843 else if (kfgsfbrem==1) {
00844
00845 gt = new GPFTrack(this,
00846 viewType,ident,
00847 &tr,
00848 xPos.size(),&xPos[0],&yPos[0],pt,
00849 gsfPatternM_,gsfPatternL_,"pl");
00850 }
00851 else if (kfgsfbrem==2) {
00852
00853
00854 gt = new GPFTrack(this,
00855 viewType,ident,
00856 &tr,
00857 xPos.size(),&xPos[0],&yPos[0],pt,
00858 bremPatternM_,bremPatternL_,"pl");
00859 }
00860 graphicMap_.insert(pair<int,GPFBase *> (ident, gt));
00861 }
00862 }
00863
00864
00865 void DisplayManager::displayEvent(int run, int lumi, int event) {
00866 reset();
00867 em_->processEvent(run, lumi, event);
00868 eventNumber_= em_->eventNumber();
00869 loadGraphicObjects();
00870 isGraphicLoaded_= true;
00871 displayAll();
00872 }
00873
00874
00875
00876 void DisplayManager::display(int ientry)
00877 {
00878 if (ientry<0 || ientry>maxEvents_) {
00879 std::cerr<<"DisplayManager::no event matching criteria"<<std::endl;
00880 return;
00881 }
00882 reset();
00883 em_->processEntry(ientry);
00884 eventNumber_= em_->eventNumber();
00885 loadGraphicObjects();
00886 isGraphicLoaded_= true;
00887 displayAll();
00888 }
00889
00890 void DisplayManager::displayAll(bool noRedraw)
00891 {
00892 if (!isGraphicLoaded_) {
00893 std::cout<<" no Graphic Objects to draw"<<std::endl;
00894 return;
00895 }
00896 if (noRedraw) {
00897 for (int viewType=0;viewType<NViews;++viewType) {
00898 displayView_[viewType]->cd();
00899 gPad->Clear();
00900 }
00901
00902 displayCanvas();
00903 }
00904
00905 std::multimap<int,GPFBase *>::iterator p;
00906
00907 for (p=graphicMap_.begin();p!=graphicMap_.end();p++) {
00908 int ident=p->first;
00909 int type=ident >> shiftId_;
00910 int view = p->second->getView();
00911 switch (type) {
00912 case CLUSTERECALID:
00913 case CLUSTERHCALID:
00914 case CLUSTERHFEMID:
00915 case CLUSTERHFHADID:
00916 case CLUSTERPSID:
00917 case CLUSTERIBID:
00918 {
00919
00920 if (drawClus_)
00921 if (p->second->getEnergy() > clusEnMin_) {
00922 displayView_[view]->cd();
00923 p->second->draw();
00924 }
00925 }
00926 break;
00927 case RECHITECALID:
00928 case RECHITHCALID:
00929 case RECHITHFEMID:
00930 case RECHITHFHADID:
00931 case RECHITPSID:
00932 {
00933 if (!noRedraw) break;
00934 if (drawHits_)
00935 if(p->second->getEnergy() > hitEnMin_) {
00936 displayView_[view]->cd();
00937 p->second->draw();
00938 }
00939 break;
00940 }
00941 case RECTRACKID:
00942 {
00943 if (drawTracks_)
00944 if (p->second->getPt() > trackPtMin_) {
00945 displayView_[view]->cd();
00946 p->second->draw();
00947 }
00948 }
00949 break;
00950 case GSFRECTRACKID:
00951 {
00952 if (drawGsfTracks_)
00953 if (p->second->getPt() > gsfPtMin_) {
00954 displayView_[view]->cd();
00955 p->second->draw();
00956 }
00957 }
00958 break;
00959 case BREMID:
00960 {
00961 if (drawBrems_)
00962 {
00963 displayView_[view]->cd();
00964 p->second->draw();
00965 }
00966 }
00967 break;
00968 case SIMPARTICLEID:
00969 {
00970 if (drawParticles_)
00971 if (p->second->getPt() > particlePtMin_) {
00972 displayView_[view]->cd();
00973 p->second->draw();
00974 }
00975 }
00976 break;
00977 case GENPARTICLEID:
00978 {
00979 if (drawGenParticles_)
00980 if (p->second->getPt() > genParticlePtMin_)
00981 if (view == EPH || view ==EPE) {
00982 displayView_[view]->cd();
00983 p->second->draw();
00984 }
00985 }
00986 break;
00987 default : std::cout<<"DisplayManager::displayAll()-- unknown object "<<std::endl;
00988 }
00989 }
00990 for (int i=0;i<NViews;i++) {
00991 displayView_[i]->cd();
00992 gPad->Modified();
00993 displayView_[i]->Update();
00994 }
00995 }
00996
00997 void DisplayManager::drawWithNewGraphicAttributes()
00998 {
00999 std::multimap<int,GPFBase *>::iterator p;
01000
01001 for (p=graphicMap_.begin();p!=graphicMap_.end();p++) {
01002 int ident=p->first;
01003 int type=ident >> shiftId_;
01004 switch (type) {
01005 case CLUSTERECALID: case CLUSTERHCALID: case CLUSTERPSID: case CLUSTERIBID:
01006 {
01007 p->second->setNewStyle();
01008 p->second->setNewSize();
01009 p->second->setColor();
01010 }
01011 break;
01012 case RECTRACKID:
01013 {
01014 p->second->setColor();
01015 p->second->setNewStyle();
01016 p->second->setNewSize();
01017 }
01018 break;
01019 case SIMPARTICLEID:
01020 {
01021 }
01022 break;
01023 default : break;
01024 }
01025 }
01026 displayAll(false);
01027 }
01028
01029 void DisplayManager::displayCanvas()
01030 {
01031 double zLow = -500.;
01032 double zUp = +500.;
01033 double rUp = +300.;
01034
01035
01036
01037
01038
01039 for (int viewType=0;viewType<NViews;++viewType) {
01040 displayView_[viewType]->cd();
01041 displayHist_[viewType]->Draw();
01042 switch(viewType) {
01043 case XY:
01044 frontFaceECALXY_.Draw();
01045 frontFaceHCALXY_.Draw();
01046 break;
01047 case RZ:
01048 {
01049 TLine l;
01050 l.SetLineColor(1);
01051 l.SetLineStyle(3);
01052 TLatex etaLeg;
01053 etaLeg.SetTextSize(0.02);
01054 float etaMin = -3.;
01055 float etaMax = +3.;
01056 float etaBin = 0.2;
01057 int nEtas = int((etaMax - etaMin)/0.2) + 1;
01058 for (int iEta = 0; iEta <= nEtas; iEta++) {
01059 float eta = etaMin + iEta*etaBin;
01060 float r = 0.9*rUp;
01061 TVector3 etaImpact;
01062 etaImpact.SetPtEtaPhi(r, eta, 0.);
01063 etaLeg.SetTextAlign(21);
01064 if (eta <= -1.39) {
01065 etaImpact.SetXYZ(0.,0.85*zLow*tan(etaImpact.Theta()),0.85*zLow);
01066 etaLeg.SetTextAlign(31);
01067 } else if (eta >= 1.39) {
01068 etaImpact.SetXYZ(0.,0.85*zUp*tan(etaImpact.Theta()),0.85*zUp);
01069 etaLeg.SetTextAlign(11);
01070 }
01071 l.DrawLine(0., 0., etaImpact.Z(), etaImpact.Perp());
01072 etaLeg.DrawLatex(etaImpact.Z(), etaImpact.Perp(), Form("%2.1f", eta));
01073 }
01074 frontFaceECALRZ_.Draw();
01075 }
01076 break;
01077 default: break;
01078 }
01079 }
01080 }
01081
01082 void DisplayManager::displayNext()
01083 {
01084 int eventNumber_=em_->eventNumber();
01085 display(++eventNumber_);
01086 }
01087
01088 void DisplayManager::displayNextInteresting(int ientry)
01089 {
01090 bool ok=false;
01091 while (!ok && ientry<em_->ev_->size() ) {
01092 ok = em_->processEntry(ientry);
01093 ientry++;
01094 }
01095 eventNumber_ = em_->eventNumber();
01096 if (ok) {
01097 reset();
01098 loadGraphicObjects();
01099 isGraphicLoaded_= true;
01100 displayAll();
01101 }
01102 else
01103 std::cerr<<"DisplayManager::dislayNextInteresting : no event matching criteria"<<std::endl;
01104 }
01105
01106 void DisplayManager::displayPrevious()
01107 {
01108 int eventNumber_=em_->eventNumber();
01109 display(--eventNumber_);
01110 }
01111
01112 void DisplayManager::rubOutGPFBlock()
01113 {
01114 int size = selectedGObj_.size();
01115 bool toInitial=true;
01116 int color=0;
01117 for (int i=0;i<size;i++)
01118 drawGObject(selectedGObj_[i],color,toInitial);
01119 }
01120
01121 void DisplayManager::displayPFBlock(int blockNb)
01122 {
01123 rubOutGPFBlock();
01124 selectedGObj_.clear();
01125 if (!drawPFBlocks_) return;
01126 int color=1;
01127 multimap<int,pair <int,int > >::const_iterator p;
01128 p= blockIdentsMap_.find(blockNb);
01129 if (p !=blockIdentsMap_.end()) {
01130 do {
01131 int ident=(p->second).first;
01132 drawGObject(ident,color,false);
01133 p++;
01134 } while (p!=blockIdentsMap_.upper_bound(blockNb));
01135 }
01136 else
01137 cout<<"DisplayManager::displayPFBlock :not found"<<endl;
01138 }
01139
01140 void DisplayManager::drawGObject(int ident,int color,bool toInitial)
01141 {
01142 typedef std::multimap<int,GPFBase *>::const_iterator iter;
01143 iter p;
01144 std::pair<iter, iter > result = graphicMap_.equal_range(ident);
01145 if(result.first == graphicMap_.end()) {
01146 std::cout<<"pas d'objet avec cet ident: "<<ident<<std::flush<<std::endl;
01147 return;
01148 }
01149 p=result.first;
01150 while (p != result.second) {
01151 int view=p->second->getView();
01152 displayView_[view]->cd();
01153 if (toInitial) p->second->setInitialColor();
01154 else p->second->setColor(color);
01155 p->second->draw();
01156 gPad->Modified();
01157
01158 if (!toInitial) selectedGObj_.push_back(ident);
01159 p++;
01160 }
01161 }
01162
01163 void DisplayManager::enableDrawPFBlock(bool state)
01164 {
01165 drawPFBlocks_=state;
01166 }
01167
01168 void DisplayManager::enableDrawBrem(bool state)
01169 {
01170 drawBrems_=state;
01171 }
01172
01173 void DisplayManager::findAndDraw(int ident)
01174 {
01175
01176 int type=ident >> shiftId_;
01177 int color=1;
01178 if (type>15) {
01179 std ::cout<<"DisplayManager::findAndDraw :object Type unknown"<<std::endl;
01180 return;
01181 }
01182 if (drawPFBlocks_==0 ||
01183 type==RECHITECALID || type==RECHITHCALID ||
01184 type==RECHITHFEMID || type==RECHITHFHADID ||
01185 type==RECHITPSID || type==SIMPARTICLEID) {
01186 rubOutGPFBlock();
01187 selectedGObj_.clear();
01188 bool toInitial=false;
01189 drawGObject(ident,color,toInitial);
01190 if (type<HITTYPES) {
01191
01192 displayAll(false);
01193
01194 }
01195 }
01196 updateDisplay();
01197 }
01198
01199 void DisplayManager::findBlock(int ident)
01200 {
01201 int blockNb=-1;
01202 int elemNb=-1;
01203 multimap<int, pair <int,int > >::const_iterator p;
01204 for (p=blockIdentsMap_.begin();p!=blockIdentsMap_.end();p++) {
01205 int id=(p->second).first;
01206 if (id == ident) {
01207 blockNb=p->first;
01208 elemNb=(p->second).second;
01209 break;
01210 }
01211 }
01212 if (blockNb > -1) {
01213 std::cout<<"this object is element "<<elemNb<<" of PFblock nb "<<blockNb<<std::endl;
01214 assert( blockNb < static_cast<int>(em_->blocks().size()) );
01215 const reco::PFBlock& block = em_->blocks()[blockNb];
01216 std::cout<<block<<std::endl;
01217 displayPFBlock(blockNb);
01218 }
01219 updateDisplay();
01220 }
01221
01222 bool DisplayManager::findBadBremsId(int ident)
01223 {
01224 for (unsigned i=0;i<badBremsId_.size();i++)
01225 if (badBremsId_[i]==ident) return true;
01226 return false;
01227 }
01228
01229
01230 void DisplayManager::updateDisplay() {
01231 for(unsigned i=0; i<displayView_.size(); i++) {
01232 TPad* p = displayView_[i];
01233 assert( p );
01234 p->Modified();
01235 p->Update();
01236 }
01237 }
01238
01239
01240
01241 double DisplayManager::getMaxE(int layer) const
01242 {
01243
01244 double maxe = -9999;
01245
01246
01247
01248 const reco::PFRecHitCollection* vec = 0;
01249 switch(layer) {
01250 case PFLayer::ECAL_ENDCAP:
01251 case PFLayer::ECAL_BARREL:
01252 vec = &(em_->rechitsECAL_);
01253 break;
01254 case PFLayer::HCAL_ENDCAP:
01255 case PFLayer::HCAL_BARREL1:
01256 case PFLayer::HCAL_BARREL2:
01257 vec = &(em_->rechitsHCAL_);
01258 break;
01259 case PFLayer::HF_EM:
01260 vec = &(em_->rechitsHFEM_);
01261 break;
01262 case PFLayer::HF_HAD:
01263 vec = &(em_->rechitsHFHAD_);
01264 break;
01265 case PFLayer::PS1:
01266 case PFLayer::PS2:
01267 vec = &(em_->rechitsPS_);
01268 break;
01269 default:
01270 cerr<<"DisplayManager::getMaxE : manage other layers"<<endl;
01271 return maxe;
01272 }
01273
01274 for( unsigned i=0; i<vec->size(); i++) {
01275 if( (*vec)[i].layer() != layer ) continue;
01276 if( (*vec)[i].energy() > maxe)
01277 maxe = (*vec)[i].energy();
01278 }
01279
01280 return maxe;
01281 }
01282
01283 double DisplayManager::getMaxEEcal() {
01284
01285 if( maxERecHitEcal_<0 ) {
01286 double maxeec = getMaxE( PFLayer::ECAL_ENDCAP );
01287 double maxeb = getMaxE( PFLayer::ECAL_BARREL );
01288 double maxehf = getMaxE( PFLayer::HF_EM );
01289 maxERecHitEcal_ = maxeec>maxeb ? maxeec:maxeb;
01290 maxERecHitEcal_ = maxERecHitEcal_>maxehf ? maxERecHitEcal_:maxehf;
01291
01292 }
01293 return maxERecHitEcal_;
01294 }
01295
01296 double DisplayManager::getMaxEHcal() {
01297
01298 if(maxERecHitHcal_ < 0) {
01299 double maxehf = getMaxE( PFLayer::HF_HAD );
01300 double maxeec = getMaxE( PFLayer::HCAL_ENDCAP );
01301 double maxeb = getMaxE( PFLayer::HCAL_BARREL1 );
01302 maxERecHitHcal_ = maxeec>maxeb ? maxeec:maxeb;
01303 maxERecHitHcal_ = maxERecHitHcal_>maxehf ? maxERecHitHcal_:maxehf;
01304 }
01305 return maxERecHitHcal_;
01306 }
01307
01308 void DisplayManager::loadGGenParticles()
01309 {
01310
01311 const HepMC::GenEvent* myGenEvent = em_->MCTruth_.GetEvent();
01312 if(!myGenEvent) return;
01313 for ( HepMC::GenEvent::particle_const_iterator piter = myGenEvent->particles_begin();
01314 piter != myGenEvent->particles_end();
01315 ++piter ) {
01316 HepMC::GenParticle* p = *piter;
01317
01318 createGGenParticle(p);
01319 }
01320 }
01321
01322 void DisplayManager::createGGenParticle(HepMC::GenParticle* p)
01323 {
01324
01325 if ( !p->production_vertex() && p->pdg_id() == 2212 ) return;
01326
01327 int partId = p->pdg_id();
01328
01329 std::string name;
01330 std::string latexStringName;
01331
01332 name = em_->getGenParticleName(partId,latexStringName);
01333 int barcode = p->barcode();
01334 int genPartId=(GENPARTICLEID<<shiftId_) | barcode;
01335
01336
01337
01338
01339
01340
01341
01342
01343
01344 math::XYZTLorentzVector momentum1(p->momentum().px(),
01345 p->momentum().py(),
01346 p->momentum().pz(),
01347 p->momentum().e());
01348
01349 double eta = momentum1.eta();
01350 if ( eta > +10. ) eta = +10.;
01351 if ( eta < -10. ) eta = -10.;
01352
01353 double phi = momentum1.phi();
01354
01355 double pt = momentum1.pt();
01356 double e = momentum1.e();
01357
01358
01359
01360
01361
01362
01363
01364
01365
01366
01367 const HepMC::GenParticle* mother = 0;
01368 if(p->production_vertex() &&
01369 p->production_vertex()->particles_in_size() ) {
01370 mother =
01371 *(p->production_vertex()->particles_in_const_begin());
01372 }
01373
01374
01375
01376
01377
01378 if ( mother ) {
01379 int barcodeMother = mother->barcode();
01380 math::XYZTLorentzVector momentumMother(mother->momentum().px(),
01381 mother->momentum().py(),
01382 mother->momentum().pz(),
01383 mother->momentum().e());
01384 double etaMother = momentumMother.eta();
01385 if ( etaMother > +10. ) etaMother = +10.;
01386 if ( etaMother < -10. ) etaMother = -10.;
01387 double phiMother = momentumMother.phi();
01388
01389
01390 double x[2],y[2];
01391 x[0]=etaMother;x[1]=eta;
01392 y[0]=phiMother;y[1]=phi;
01393
01394 for (int view = 2; view< NViews; view++) {
01395 GPFGenParticle* gp = new GPFGenParticle(this,
01396 view, genPartId,
01397 x, y,
01398 e,pt,barcode,barcodeMother,
01399 genPartPattern_,
01400 name,latexStringName);
01401 graphicMap_.insert(pair<int,GPFBase *> (genPartId, gp));
01402 }
01403 }
01404 else {
01405 for (int view = 2; view< NViews; view++) {
01406 GPFGenParticle* gp = new GPFGenParticle(this,
01407 view, genPartId,
01408 eta, phi,
01409 e,pt,barcode,
01410 genPartPattern_,
01411 name, latexStringName);
01412 graphicMap_.insert(pair<int,GPFBase *> (genPartId, gp));
01413 }
01414 }
01415 }
01416
01417 void DisplayManager::loadGClusters()
01418 {
01419 double phi0=0;
01420
01421 for(unsigned i=0; i<em_->clustersECAL_->size(); i++){
01422
01423 int clusId=(CLUSTERECALID<<shiftId_) | i;
01424 createGCluster( (*(em_->clustersECAL_))[i],clusId, phi0);
01425 }
01426 for(unsigned i=0; i<em_->clustersHCAL_->size(); i++) {
01427
01428 int clusId=(CLUSTERHCALID<<shiftId_) | i;
01429 createGCluster( (*(em_->clustersHCAL_))[i],clusId, phi0);
01430 }
01431 for(unsigned i=0; i<em_->clustersHFEM_->size(); i++) {
01432
01433 int clusId=(CLUSTERHFEMID<<shiftId_) | i;
01434 createGCluster( (*(em_->clustersHFEM_))[i],clusId, phi0);
01435 }
01436 for(unsigned i=0; i<em_->clustersHFHAD_->size(); i++) {
01437
01438 int clusId=(CLUSTERHFHADID<<shiftId_) | i;
01439 createGCluster( (*(em_->clustersHFHAD_))[i],clusId, phi0);
01440 }
01441 for(unsigned i=0; i<em_->clustersPS_->size(); i++){
01442
01443 int clusId=(CLUSTERPSID<<shiftId_) | i;
01444 createGCluster( (*(em_->clustersPS_))[i],clusId,phi0);
01445 }
01446
01447
01448
01449
01450
01451
01452
01453
01454
01455
01456
01457
01458 }
01459
01460 void DisplayManager::retrieveBadBrems()
01461 {
01462
01463
01464
01465 int size = em_->pfBlocks_->size();
01466 for (int ibl=0;ibl<size;ibl++) {
01467 edm::OwnVector< reco::PFBlockElement >::const_iterator iter;
01468 for( iter =((*(em_->pfBlocks_))[ibl].elements()).begin();
01469 iter != ((*(em_->pfBlocks_))[ibl].elements()).end();iter++) {
01470 int ident=-1;
01471 reco::PFBlockElement::Type type = (*iter).type();
01472 if (type == reco::PFBlockElement::BREM) {
01473 std::multimap<double, unsigned> ecalElems;
01474
01475 (*(em_->pfBlocks_))[ibl].associatedElements( (*iter).index(),(*(em_->pfBlocks_))[ibl].linkData(),
01476 ecalElems ,
01477 reco::PFBlockElement::ECAL,
01478 reco::PFBlock::LINKTEST_ALL );
01479
01480
01481 if (ecalElems.size()==0) {
01482
01483 const reco::PFBlockElementBrem * Brem = dynamic_cast<const reco::PFBlockElementBrem*>(&(*iter));
01484 reco::GsfPFRecTrackRef trackref = Brem->GsftrackRefPF();
01485 unsigned ind=trackref.key()*40+Brem->indTrajPoint();
01486 ident = (BREMID << shiftId_ ) | ind ;
01487 badBremsId_.push_back(ident);
01488 }
01489 }
01490 }
01491 }
01492 }
01493
01494 void DisplayManager::loadGPFBlocks()
01495 {
01496 int size = em_->pfBlocks_->size();
01497 for (int ibl=0;ibl<size;ibl++) {
01498
01499
01500 edm::OwnVector< reco::PFBlockElement >::const_iterator iter;
01501 for( iter =((*(em_->pfBlocks_))[ibl].elements()).begin();
01502 iter != ((*(em_->pfBlocks_))[ibl].elements()).end();iter++) {
01503
01504
01505
01506
01507 int ident=-1;
01508
01509 reco::PFBlockElement::Type type = (*iter).type();
01510 switch (type) {
01511 case reco::PFBlockElement::NONE :
01512 assert(0);
01513 break;
01514 case reco::PFBlockElement::TRACK:
01515 {
01516 reco::PFRecTrackRef trackref =(*iter).trackRefPF();
01517 assert( !trackref.isNull() );
01518
01519 ident=(RECTRACKID <<shiftId_) | trackref.key();
01520 }
01521 break;
01522 case reco::PFBlockElement::PS1:
01523 {
01524 reco::PFClusterRef clusref=(*iter).clusterRef();
01525 assert( !clusref.isNull() );
01526
01527 ident=(CLUSTERPSID <<shiftId_) |clusref.key();
01528 }
01529 break;
01530 case reco::PFBlockElement::PS2:
01531 {
01532 reco::PFClusterRef clusref=(*iter).clusterRef();
01533 assert( !clusref.isNull() );
01534
01535 ident=(CLUSTERPSID <<shiftId_) |clusref.key();
01536 }
01537 break;
01538 case reco::PFBlockElement::ECAL:
01539 {
01540 reco::PFClusterRef clusref=(*iter).clusterRef();
01541 assert( !clusref.isNull() );
01542
01543 ident=(CLUSTERECALID <<shiftId_) |clusref.key();
01544 }
01545 break;
01546 case reco::PFBlockElement::HCAL:
01547 {
01548 reco::PFClusterRef clusref=(*iter).clusterRef();
01549 assert( !clusref.isNull() );
01550
01551 ident=(CLUSTERHCALID <<shiftId_) |clusref.key();
01552 }
01553 break;
01554 case reco::PFBlockElement::HFEM:
01555 {
01556 reco::PFClusterRef clusref=(*iter).clusterRef();
01557 assert( !clusref.isNull() );
01558
01559 ident=(CLUSTERHFEMID <<shiftId_) |clusref.key();
01560 }
01561 break;
01562 case reco::PFBlockElement::HFHAD:
01563 {
01564 reco::PFClusterRef clusref=(*iter).clusterRef();
01565 assert( !clusref.isNull() );
01566
01567 ident=(CLUSTERHFHADID <<shiftId_) |clusref.key();
01568 }
01569 break;
01570 case reco::PFBlockElement::GSF:
01571 {
01572 const reco::PFBlockElementGsfTrack * GsfEl =
01573 dynamic_cast<const reco::PFBlockElementGsfTrack*>(&(*iter));
01574
01575 reco::GsfPFRecTrackRef trackref=GsfEl->GsftrackRefPF();
01576 assert( !trackref.isNull() );
01577 ident=(GSFRECTRACKID << shiftId_) | trackref.key();
01578 }
01579 break;
01580 case reco::PFBlockElement::BREM:
01581 {
01582 const reco::PFBlockElementBrem * Brem = dynamic_cast<const reco::PFBlockElementBrem*>(&(*iter));
01583 reco::GsfPFRecTrackRef trackref = Brem->GsftrackRefPF();
01584 unsigned index=trackref.key()*40+Brem->indTrajPoint();
01585 ident = (BREMID << shiftId_ ) | index ;
01586 if (findBadBremsId(ident)) ident=-1;
01587 }
01588 break;
01589
01590 default:
01591 std::cout<<"unknown PFBlock element of type "<<type<<std::endl;
01592 break;
01593 }
01594 pair <int, int> idElem;
01595 idElem.first=ident;
01596 idElem.second=(*iter).index();
01597 if (ident != -1) blockIdentsMap_.insert(pair<int,pair <int,int> > (ibl,idElem));
01598 }
01599 }
01600
01601 }
01602
01603 void DisplayManager::loadGraphicObjects()
01604 {
01605 loadGClusters();
01606 loadGRecHits();
01607 loadGRecTracks();
01608 loadGGsfRecTracks();
01609 loadGSimParticles();
01610 loadGPFBlocks();
01611 loadGGenParticles();
01612 }
01613
01614 void DisplayManager::loadGRecHits()
01615 {
01616 double phi0=0;
01617
01618 double maxee = getMaxEEcal();
01619 double maxeh = getMaxEHcal();
01620 double maxe = maxee>maxeh ? maxee : maxeh;
01621
01622 int color = TColor::GetColor(210,210,210);
01623 int seedcolor = TColor::GetColor(145,145,145);
01624 int specialcolor = TColor::GetColor(255,140,0);
01625
01626 for(unsigned i=0; i<em_->rechitsECAL_.size(); i++) {
01627 int rhcolor = color;
01628 if( unsigned col = em_->clusterAlgoECAL_.color(i) ) {
01629 switch(col) {
01630 case PFClusterAlgo::SEED: rhcolor = seedcolor; break;
01631 case PFClusterAlgo::SPECIAL: rhcolor = specialcolor; break;
01632 default:
01633 cerr<<"DisplayManager::loadGRecHits: unknown color"<<endl;
01634 }
01635 }
01636
01637 int recHitId=i;
01638 createGRecHit(em_->rechitsECAL_[i],recHitId, maxe, phi0, rhcolor);
01639 }
01640
01641 for(unsigned i=0; i<em_->rechitsHCAL_.size(); i++) {
01642 int rhcolor = color;
01643 if(unsigned col = em_->clusterAlgoHCAL_.color(i) ) {
01644 switch(col) {
01645 case PFClusterAlgo::SEED: rhcolor = seedcolor; break;
01646 case PFClusterAlgo::SPECIAL: rhcolor = specialcolor; break;
01647 default:
01648 cerr<<"DisplayManager::loadGRecHits: unknown color"<<endl;
01649 }
01650 }
01651
01652 int recHitId=(RECHITHCALID <<shiftId_) | i;
01653 createGRecHit(em_->rechitsHCAL_[i],recHitId, maxe, phi0, rhcolor);
01654 }
01655
01656 for(unsigned i=0; i<em_->rechitsHFEM_.size(); i++) {
01657 int rhcolor = color;
01658 if(unsigned col = em_->clusterAlgoHFEM_.color(i) ) {
01659 switch(col) {
01660 case PFClusterAlgo::SEED: rhcolor = seedcolor; break;
01661 case PFClusterAlgo::SPECIAL: rhcolor = specialcolor; break;
01662 default:
01663 cerr<<"DisplayManager::loadGRecHits: unknown color"<<endl;
01664 }
01665 }
01666
01667 int recHitId=(RECHITHFEMID <<shiftId_) | i;
01668 createGRecHit(em_->rechitsHFEM_[i],recHitId, maxe, phi0, rhcolor);
01669 }
01670
01671 for(unsigned i=0; i<em_->rechitsHFHAD_.size(); i++) {
01672 int rhcolor = color;
01673 if(unsigned col = em_->clusterAlgoHFHAD_.color(i) ) {
01674 switch(col) {
01675 case PFClusterAlgo::SEED: rhcolor = seedcolor; break;
01676 case PFClusterAlgo::SPECIAL: rhcolor = specialcolor; break;
01677 default:
01678 cerr<<"DisplayManager::loadGRecHits: unknown color"<<endl;
01679 }
01680 }
01681
01682 int recHitId=(RECHITHFHADID <<shiftId_) | i;
01683 createGRecHit(em_->rechitsHFHAD_[i],recHitId, maxe, phi0, rhcolor);
01684 }
01685
01686 for(unsigned i=0; i<em_->rechitsPS_.size(); i++) {
01687 int rhcolor = color;
01688 if( unsigned col = em_->clusterAlgoPS_.color(i) ) {
01689 switch(col) {
01690 case PFClusterAlgo::SEED: rhcolor = seedcolor; break;
01691 case PFClusterAlgo::SPECIAL: rhcolor = specialcolor; break;
01692 default:
01693 cerr<<"DisplayManager::loadGRecHits: unknown color"<<endl;
01694 }
01695 }
01696
01697 int recHitId=(RECHITPSID<<shiftId_) | i;
01698
01699 createGRecHit(em_->rechitsPS_[i],recHitId, maxe, phi0, rhcolor);
01700 }
01701 }
01702
01703 void DisplayManager::loadGRecTracks()
01704 {
01705 double phi0=0;
01706
01707 int ind=-1;
01708 std::vector<reco::PFRecTrack>::iterator itRecTrack;
01709 for (itRecTrack = em_->recTracks_.begin(); itRecTrack != em_->recTracks_.end();itRecTrack++) {
01710 double sign = 1.;
01711 const reco::PFTrajectoryPoint& tpinitial
01712 = itRecTrack->extrapolatedPoint(reco::PFTrajectoryPoint::ClosestApproach);
01713 double pt = tpinitial.momentum().Pt();
01714
01715
01716 const reco::PFTrajectoryPoint& tpatecal
01717 = itRecTrack->trajectoryPoint(itRecTrack->nTrajectoryMeasurements() +
01718 reco::PFTrajectoryPoint::ECALEntrance );
01719
01720 if ( cos(phi0 - tpatecal.momentum().Phi()) < 0.)
01721 sign = -1.;
01722
01723 const std::vector<reco::PFTrajectoryPoint>& points =
01724 itRecTrack->trajectoryPoints();
01725
01726 int linestyle = itRecTrack->algoType();
01727 ind++;
01728
01729 int recTrackId=(RECTRACKID <<shiftId_) | ind;
01730
01731 createGTrack(*itRecTrack,points,recTrackId, pt, phi0, sign, false,linestyle);
01732 }
01733 }
01734
01735
01736 void DisplayManager::loadGGsfRecTracks()
01737 {
01738 double phi0=0;
01739
01740 int ind=-1;
01741 int indbrem=-1;
01742
01743
01744 retrieveBadBrems();
01745
01746 std::vector<reco::GsfPFRecTrack>::iterator itRecTrack;
01747 for (itRecTrack = em_->gsfrecTracks_.begin(); itRecTrack != em_->gsfrecTracks_.end();itRecTrack++) {
01748 double sign = 1.;
01749 const reco::PFTrajectoryPoint& tpinitial
01750 = itRecTrack->extrapolatedPoint(reco::PFTrajectoryPoint::ClosestApproach);
01751 double pt = tpinitial.momentum().Pt();
01752
01753
01754 const reco::PFTrajectoryPoint& tpatecal
01755 = itRecTrack->trajectoryPoint(itRecTrack->nTrajectoryMeasurements() +
01756 reco::PFTrajectoryPoint::ECALEntrance );
01757
01758 if ( cos(phi0 - tpatecal.momentum().Phi()) < 0.)
01759 sign = -1.;
01760
01761 const std::vector<reco::PFTrajectoryPoint>& points =
01762 itRecTrack->trajectoryPoints();
01763
01764 int linestyle = itRecTrack->algoType();
01765 ind++;
01766 int recTrackId=(GSFRECTRACKID <<shiftId_) | ind;
01767
01768 createGTrack(*itRecTrack,points,recTrackId, pt, phi0, sign, false,linestyle,1);
01769
01770
01771 std::vector<reco::PFBrem> brems=itRecTrack->PFRecBrem();
01772 unsigned nbrems=brems.size();
01773 for(unsigned ibrem=0;ibrem<nbrems;++ibrem)
01774 {
01775 unsigned indTrajPoint=brems[ibrem].indTrajPoint();
01776 if(indTrajPoint==99) continue;
01777 double signBrem = 1. ;
01778 int linestyleBrem = brems[ibrem].algoType();
01779 indbrem++;
01780
01781
01782 unsigned indexBrem= ind*40+brems[ibrem].indTrajPoint();
01783 int recTrackIdBrem=(BREMID << shiftId_ ) | indexBrem;
01784
01785
01786
01787 if (!findBadBremsId(recTrackIdBrem)) {
01788
01789
01790 std::vector<reco::PFTrajectoryPoint> pointsBrem;
01791
01792 pointsBrem.push_back(brems[ibrem].trajectoryPoints()[0]);
01793 pointsBrem.push_back(brems[ibrem].trajectoryPoints()[1]);
01794
01795
01796 pointsBrem.push_back(itRecTrack->trajectoryPoint(indTrajPoint));
01797
01798 unsigned ntp=brems[ibrem].trajectoryPoints().size();
01799 for(unsigned itp=2;itp<ntp;++itp)
01800 {
01801 pointsBrem.push_back(brems[ibrem].trajectoryPoints()[itp]);
01802 }
01803
01804 double deltaP=brems[ibrem].DeltaP();
01805 const reco::PFTrajectoryPoint& tpatecalbrem
01806 = brems[ibrem].trajectoryPoint(brems[ibrem].nTrajectoryMeasurements() +
01807 reco::PFTrajectoryPoint::ECALEntrance );
01808
01809 if ( cos(phi0 - tpatecalbrem.momentum().Phi()) < 0.)
01810 signBrem = -1.;
01811
01812 createGTrack(brems[ibrem],pointsBrem,recTrackIdBrem,deltaP,phi0,signBrem,false,linestyleBrem,2);
01813 }
01814 }
01815 }
01816
01817 }
01818
01819
01820 void DisplayManager::loadGSimParticles()
01821 {
01822 double phi0=0;
01823
01824 unsigned simParticlesVSize = em_->trueParticles_.size();
01825
01826 for(unsigned i=0; i<simParticlesVSize; i++) {
01827
01828 const reco::PFSimParticle& ptc = em_->trueParticles_[i];
01829
01830 const reco::PFTrajectoryPoint& tpinitial
01831 = ptc.extrapolatedPoint( reco::PFTrajectoryPoint::ClosestApproach );
01832
01833 double pt = tpinitial.momentum().Pt();
01834
01835
01836 double sign = 1.;
01837 const reco::PFTrajectoryPoint& tpFirst = ptc.trajectoryPoint(0);
01838 if ( tpFirst.position().X() < 0. )
01839 sign = -1.;
01840
01841
01842
01843
01844
01845
01846 const std::vector<reco::PFTrajectoryPoint>& points =
01847 ptc.trajectoryPoints();
01848
01849
01850 int markerstyle;
01851 int indexMarker;
01852 switch( std::abs(ptc.pdgCode() ) ) {
01853 case 22: markerstyle = 3 ; indexMarker=0; break;
01854 case 11: markerstyle = 5 ; indexMarker=1; break;
01855 case 13: markerstyle = 2 ; indexMarker=2; break;
01856 case 130:
01857 case 321: markerstyle = 24; indexMarker=3; break;
01858 case 211: markerstyle = 25; indexMarker=4; break;
01859 case 2212: markerstyle = 26; indexMarker=5; break;
01860 case 2112: markerstyle = 27; indexMarker=6; break;
01861 default: markerstyle = 30; indexMarker=7; break;
01862 }
01863
01864 bool displayInitial=true;
01865 if( ptc.motherId() < 0 ) displayInitial=false;
01866 int partId=(SIMPARTICLEID << shiftId_) | i;
01867 createGPart(ptc, points,partId, pt, phi0, sign, displayInitial,indexMarker);
01868
01869
01870
01871 }
01872 }
01873
01874 void DisplayManager::lookForMaxRecHit(bool ecal)
01875 {
01876
01877 double maxe = -999;
01878 reco::PFRecHit* maxrh = 0;
01879
01880 reco::PFRecHitCollection* rechits = 0;
01881 if(ecal) rechits = &(em_->rechitsECAL_);
01882 else rechits = &(em_->rechitsHCAL_);
01883 assert(rechits);
01884
01885 for(unsigned i=0; i<(*rechits).size(); i++) {
01886
01887 double energy = (*rechits)[i].energy();
01888
01889 if(energy > maxe ) {
01890 maxe = energy;
01891 maxrh = &((*rechits)[i]);
01892 }
01893 }
01894
01895 if(!maxrh) return;
01896
01897
01898
01899
01900
01901
01902
01903 double phisize = -1;
01904 double etasize = -1;
01905 maxrh->size(phisize, etasize);
01906
01907 double etagate = zoomFactor_ * etasize;
01908 double phigate = zoomFactor_ * phisize;
01909
01910 double eta = maxrh->position().Eta();
01911 double phi = maxrh->position().Phi();
01912
01913 if(displayHist_[EPE]) {
01914 displayHist_[EPE]->GetXaxis()->SetRangeUser(eta-etagate, eta+etagate);
01915 displayHist_[EPE]->GetYaxis()->SetRangeUser(phi-phigate, phi+phigate);
01916 displayView_[EPE]->Modified();
01917 displayView_[EPE]->Update();
01918 }
01919
01920 if(displayHist_[EPH]) {
01921 displayHist_[EPH]->GetXaxis()->SetRangeUser(eta-etagate, eta+etagate);
01922 displayHist_[EPH]->GetYaxis()->SetRangeUser(phi-phigate, phi+phigate);
01923 displayView_[EPH]->Modified();
01924 displayView_[EPH]->Update();
01925 }
01926 }
01927
01928 void DisplayManager::lookForGenParticle(unsigned barcode) {
01929
01930 const HepMC::GenEvent* event = em_->MCTruth_.GetEvent();
01931 if(!event) {
01932 cerr<<"no GenEvent"<<endl;
01933 return;
01934 }
01935
01936 const HepMC::GenParticle* particle = event->barcode_to_particle(barcode);
01937 if(!particle) {
01938 cerr<<"no particle with barcode "<<barcode<<endl;
01939 return;
01940 }
01941
01942 math::XYZTLorentzVector momentum(particle->momentum().px(),
01943 particle->momentum().py(),
01944 particle->momentum().pz(),
01945 particle->momentum().e());
01946
01947 double eta = momentum.Eta();
01948 double phi = momentum.phi();
01949
01950 double phisize = 0.05;
01951 double etasize = 0.05;
01952
01953 double etagate = zoomFactor_ * etasize;
01954 double phigate = zoomFactor_ * phisize;
01955
01956 if(displayHist_[EPE]) {
01957 displayHist_[EPE]->GetXaxis()->SetRangeUser(eta-etagate, eta+etagate);
01958 displayHist_[EPE]->GetYaxis()->SetRangeUser(phi-phigate, phi+phigate);
01959 displayView_[EPE]->Modified();
01960 displayView_[EPE]->Update();
01961
01962 }
01963 if(displayHist_[EPH]) {
01964 displayHist_[EPH]->GetXaxis()->SetRangeUser(eta-etagate, eta+etagate);
01965 displayHist_[EPH]->GetYaxis()->SetRangeUser(phi-phigate, phi+phigate);
01966 displayView_[EPH]->Modified();
01967 displayView_[EPH]->Update();
01968 }
01969 }
01970
01971 void DisplayManager::printDisplay(const char* sdirectory ) const
01972 {
01973 string directory = sdirectory;
01974 if( directory.empty() ) {
01975 directory = "Event_";
01976 }
01977 char num[10];
01978 sprintf(num,"%d", eventNumber_);
01979 directory += num;
01980
01981 string mkdir = "mkdir "; mkdir += directory;
01982 int code = system( mkdir.c_str() );
01983
01984 if( code ) {
01985 cerr<<"cannot create directory "<<directory<<endl;
01986 return;
01987 }
01988
01989 cout<<"Event display printed in directory "<<directory<<endl;
01990
01991 directory += "/";
01992
01993 for(unsigned iView=0; iView<displayView_.size(); iView++) {
01994 if( !displayView_[iView] ) continue;
01995
01996 string name = directory;
01997 name += displayView_[iView]->GetName();
01998
01999 cout<<displayView_[iView]->GetName()<<endl;
02000
02001 string eps = name; eps += ".eps";
02002 displayView_[iView]->SaveAs( eps.c_str() );
02003
02004 string png = name; png += ".png";
02005 displayView_[iView]->SaveAs( png.c_str() );
02006 }
02007
02008 string txt = directory;
02009 txt += "event.txt";
02010 ofstream out( txt.c_str() );
02011 if( !out )
02012 cerr<<"cannot open "<<txt<<endl;
02013 em_->print( out );
02014 }
02015
02016 void DisplayManager::reset()
02017 {
02018 maxERecHitEcal_=-1;
02019 maxERecHitHcal_=-1;
02020 isGraphicLoaded_= false;
02021
02022 std::multimap<int,GPFBase *>::iterator p;
02023 for (p=graphicMap_.begin();p!=graphicMap_.end();p++)
02024 delete p->second;
02025 graphicMap_.clear();
02026
02027 blockIdentsMap_.clear();
02028 selectedGObj_.clear();
02029 badBremsId_.clear();
02030
02031
02032 }
02033
02034 void DisplayManager::unZoom()
02035 {
02036 for( unsigned i=0; i<displayHist_.size(); i++) {
02037
02038 if( ! displayHist_[i] ) continue;
02039 displayHist_[i]->GetXaxis()->UnZoom();
02040 displayHist_[i]->GetYaxis()->UnZoom();
02041 }
02042 updateDisplay();
02043 }
02044
02045 void DisplayManager::setNewAttrToSimParticles()
02046 {
02047 simPartPatternM_.clear();
02048 simPartPatternM_.push_back(simPartPatternPhoton_);
02049 simPartPatternM_.push_back(simPartPatternElec_);
02050 simPartPatternM_.push_back(simPartPatternMuon_);
02051 simPartPatternM_.push_back(simPartPatternK_);
02052 simPartPatternM_.push_back(simPartPatternPi_);
02053 simPartPatternM_.push_back(simPartPatternProton_);
02054 simPartPatternM_.push_back(simPartPatternNeutron_);
02055 simPartPatternM_.push_back(simPartPatternDefault_);
02056 }
02057
02058
02059 void DisplayManager::printGenParticleInfo(std::string name,int barcode,int barcodeMother)
02060 {
02061 const HepMC::GenEvent* myGenEvent = em_->MCTruth_.GetEvent();
02062 HepMC::GenParticle *p = myGenEvent->barcode_to_particle(barcode);
02063 std::cout<<"genParticle "<<name<<" with barcode "<<barcode<<std::flush<<std::endl;
02064 p->print();
02065 if (barcodeMother) {
02066 HepMC:: GenParticle *mother = myGenEvent->barcode_to_particle(barcodeMother);
02067 std::cout<<"mother particle with barcode "<<barcodeMother<<std::flush<<std::endl;
02068 mother->print();
02069 }
02070 }