CMS 3D CMS Logo

PFBlockElement.cc

Go to the documentation of this file.
00001 #include "DataFormats/ParticleFlowReco/interface/PFBlockElement.h"
00002 #include "DataFormats/ParticleFlowReco/interface/PFBlockElementTrack.h"
00003 #include "DataFormats/ParticleFlowReco/interface/PFBlockElementGsfTrack.h"
00004 #include "DataFormats/ParticleFlowReco/interface/PFBlockElementBrem.h"     
00005 #include "DataFormats/ParticleFlowReco/interface/PFBlockElementCluster.h"
00006 
00007 
00008 using namespace reco;
00009 
00010 // int PFBlockElement::instanceCounter_ = 0;
00011 
00012 // int PFBlockElement::instanceCounter() {
00013 //   return instanceCounter_;
00014 // }
00015 
00016 void PFBlockElement::Dump(std::ostream& out, 
00017                           const char* pad) const {
00018   if(!out) return;
00019   out<<pad<<"base element";
00020 }
00021 
00022 std::ostream& reco::operator<<( std::ostream& out, 
00023                                 const PFBlockElement& element ) {
00024   
00025   if(! out) return out;
00026   
00027   out<<"element "<<element.index()<<"- type "<<element.type_<<" ";
00028   
00029   try {
00030     switch(element.type_) {
00031     case PFBlockElement::TRACK:
00032       {
00033         const reco::PFBlockElementTrack& et =
00034           dynamic_cast<const reco::PFBlockElementTrack &>( element );
00035         et.Dump(out);
00036         if( et.trackType(PFBlockElement::T_FROM_NUCL) ) out<<" from nucl;";
00037         if( et.trackType(PFBlockElement::T_TO_NUCL) ) out<<" to nucl;";
00038         if( et.trackType(PFBlockElement::T_FROM_GAMMACONV) ) out<<" from gammaconv;";  
00039         break;
00040       }
00041     case PFBlockElement::ECAL:
00042     case PFBlockElement::HCAL:
00043     case PFBlockElement::PS1:
00044     case PFBlockElement::PS2:    
00045       {
00046         const reco::PFBlockElementCluster& ec =
00047           dynamic_cast<const reco::PFBlockElementCluster &>( element );
00048         ec.Dump(out);
00049         break;
00050       }
00051     case PFBlockElement::GSF:
00052       {
00053         const reco::PFBlockElementGsfTrack& eg =
00054           dynamic_cast<const reco::PFBlockElementGsfTrack &>( element );
00055         eg.Dump(out);
00056         out<<" from gsf;";
00057         break;
00058       }
00059     case PFBlockElement::BREM:
00060       {
00061         const reco::PFBlockElementBrem& em =
00062           dynamic_cast<const reco::PFBlockElementBrem &>( element );
00063         em.Dump(out);
00064         out<<" from brem;";
00065         break;
00066       }
00067     default:
00068       out<<" unknown type"<<std::endl;
00069       break;
00070     }
00071   }
00072   catch( std::exception& err) {
00073     out<<err.what()<<std::endl;
00074   }
00075   
00076   return out;
00077 }
00078 

Generated on Tue Jun 9 17:31:23 2009 for CMSSW by  doxygen 1.5.4