CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/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::HO: 
00046     case PFBlockElement::HFEM:
00047     case PFBlockElement::HFHAD:
00048     case PFBlockElement::PS1:
00049     case PFBlockElement::PS2:    
00050       {
00051         const reco::PFBlockElementCluster& ec =
00052           dynamic_cast<const reco::PFBlockElementCluster &>( element );
00053         ec.Dump(out);
00054         break;
00055       }
00056     case PFBlockElement::GSF:
00057       {
00058         const reco::PFBlockElementGsfTrack& eg =
00059           dynamic_cast<const reco::PFBlockElementGsfTrack &>( element );
00060         eg.Dump(out);
00061         out<<" from gsf;";
00062         break;
00063       }
00064     case PFBlockElement::BREM:
00065       {
00066         const reco::PFBlockElementBrem& em =
00067           dynamic_cast<const reco::PFBlockElementBrem &>( element );
00068         em.Dump(out);
00069         out<<" from brem;";
00070         break;
00071       }
00072     case PFBlockElement::SC:
00073       {
00074         const reco::PFBlockElementSuperCluster& sc =
00075           dynamic_cast<const reco::PFBlockElementSuperCluster &>( element );
00076         sc.Dump(out);
00077         out<<" from SuperCluster;";
00078         break;
00079       }
00080     default:
00081       out<<" unknown type"<<std::endl;
00082       break;
00083     }
00084   }
00085   catch( std::exception& err) {
00086     out<<err.what()<<std::endl;
00087   }
00088   
00089   return out;
00090 }
00091