CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/DataFormats/ParticleFlowReco/src/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 #include "DataFormats/ParticleFlowReco/interface/PFBlockElementSuperCluster.h"
00007 
00008 
00009 using namespace reco;
00010 
00011 // int PFBlockElement::instanceCounter_ = 0;
00012 
00013 // int PFBlockElement::instanceCounter() {
00014 //   return instanceCounter_;
00015 // }
00016 
00017 void PFBlockElement::Dump(std::ostream& out, 
00018                           const char* pad) const {
00019   if(!out) return;
00020   out<<pad<<"base element";
00021 }
00022 
00023 std::ostream& reco::operator<<( std::ostream& out, 
00024                                 const PFBlockElement& element ) {
00025   
00026   if(! out) return out;
00027   
00028   out<<"element "<<element.index()<<"- type "<<element.type_<<" ";
00029   
00030   try {
00031     switch(element.type_) {
00032     case PFBlockElement::TRACK:
00033       {
00034         const reco::PFBlockElementTrack& et =
00035           dynamic_cast<const reco::PFBlockElementTrack &>( element );
00036         et.Dump(out);
00037         if( et.trackType(PFBlockElement::T_FROM_DISP) ) out<<" from displaced;";
00038         if( et.trackType(PFBlockElement::T_TO_DISP) ) out<<" to displaced;";
00039         if( et.trackType(PFBlockElement::T_FROM_GAMMACONV) ) out<<" from gammaconv;";  
00040         if( et.trackType(PFBlockElement::T_FROM_V0) ) out<<" from v0 decay;";  
00041         break;
00042       }
00043     case PFBlockElement::ECAL:
00044     case PFBlockElement::HCAL:
00045     case PFBlockElement::HFEM:
00046     case PFBlockElement::HFHAD:
00047     case PFBlockElement::PS1:
00048     case PFBlockElement::PS2:    
00049       {
00050         const reco::PFBlockElementCluster& ec =
00051           dynamic_cast<const reco::PFBlockElementCluster &>( element );
00052         ec.Dump(out);
00053         break;
00054       }
00055     case PFBlockElement::GSF:
00056       {
00057         const reco::PFBlockElementGsfTrack& eg =
00058           dynamic_cast<const reco::PFBlockElementGsfTrack &>( element );
00059         eg.Dump(out);
00060         out<<" from gsf;";
00061         break;
00062       }
00063     case PFBlockElement::BREM:
00064       {
00065         const reco::PFBlockElementBrem& em =
00066           dynamic_cast<const reco::PFBlockElementBrem &>( element );
00067         em.Dump(out);
00068         out<<" from brem;";
00069         break;
00070       }
00071     case PFBlockElement::SC:
00072       {
00073         const reco::PFBlockElementSuperCluster& sc =
00074           dynamic_cast<const reco::PFBlockElementSuperCluster &>( element );
00075         sc.Dump(out);
00076         out<<" from SuperCluster;";
00077         break;
00078       }
00079     default:
00080       out<<" unknown type"<<std::endl;
00081       break;
00082     }
00083   }
00084   catch( std::exception& err) {
00085     out<<err.what()<<std::endl;
00086   }
00087   
00088   return out;
00089 }
00090