CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/RecoTracker/ConversionSeedGenerators/src/PrintRecoObjects.cc

Go to the documentation of this file.
00001 #include "RecoTracker/ConversionSeedGenerators/interface/PrintRecoObjects.h"
00002 #include "DataFormats/SiStripDetId/interface/SiStripDetId.h"
00003 #include "DataFormats/SiStripDetId/interface/TIBDetId.h"
00004 #include "DataFormats/SiStripDetId/interface/TOBDetId.h"
00005 #include "DataFormats/SiStripDetId/interface/TECDetId.h"
00006 #include "DataFormats/SiStripDetId/interface/TIDDetId.h"
00007 
00008 void PrintRecoObjects::
00009 print(std::stringstream& ss, const SiStripCluster& clus){
00010   ss << "\n\t"
00011      << " firstStrip " <<  clus.firstStrip()
00012      << " size " <<  clus.amplitudes().size();
00013   float charge=0;
00014   size_t idx=0;
00015   BOOST_FOREACH(const uint8_t& adc,clus.amplitudes()){
00016     charge+=adc;
00017     ss << "\n\t\t strip " << ++idx << " adc " << (size_t) adc;
00018   }
00019   ss << "\n\t\t charge " << charge
00020      << " barycenter " << clus.barycenter()
00021      << std::endl;
00022 }
00023 
00024 void 
00025 PrintRecoObjects::print(std::stringstream& ss, const TrajectorySeed& tjS){
00026 
00027   ss << "\n\t nHits "<< tjS.nHits() 
00028      << "\n\t PTrajectoryStateOnDet: detid " << tjS.startingState().detId()
00029      << " tsos momentum" << tjS.startingState().parameters().momentum()
00030      << " pt " << sqrt(tjS.startingState().parameters().momentum().mag2()-tjS.startingState().parameters().momentum().y()*tjS.startingState().parameters().momentum().y())
00031      << " charge " << tjS.startingState().parameters().charge()
00032      << "\n\t error ";
00033   std::vector<float> errors=tjS.startingState().errorMatrix();
00034   for(size_t ie=0;ie<errors.size();++ie)
00035     ss << "\t " << errors[ie];
00036   for(TrajectorySeed::const_iterator iter=tjS.recHits().first;iter!=tjS.recHits().second;++iter)
00037     ss << "\n\t TrackingRecHit on detid " << iter->geographicalId().rawId() << " \t localPos " << iter->localPosition();
00038   
00039 }
00040 
00041 void PrintRecoObjects::
00042 print(std::stringstream& ss, const uint32_t& detid) const{
00043   ss<< getString(detid);
00044 }
00045 
00046 std::string PrintRecoObjects::
00047 getString(uint32_t detid) const{
00048   std::string append=" ";
00049   char cindex[128];
00050   SiStripDetId a(detid);
00051   if ( a.subdetId() == 3 ){
00052     append+="_TIB_L";
00053     sprintf(cindex,"%d",TIBDetId(detid).layer()); 
00054   } else if ( a.subdetId() == 4 ) {
00055     if(TIDDetId(detid).side()==1){
00056       append+="_M_D";
00057     }else{
00058       append+="_M_P";
00059     }
00060     sprintf(cindex,"%d",TIDDetId(detid).wheel());
00061   } else if ( a.subdetId() == 5 ) {
00062     append+="_TOB_L";
00063     sprintf(cindex,"%d",TOBDetId(detid).layer());
00064   } else if ( a.subdetId() == 6 ) {
00065     if(TECDetId(detid).side()==1){
00066       append+="_TEC_M";
00067     }else{
00068       append+="_TEC_P";
00069     }
00070     sprintf(cindex,"%d",TECDetId(detid).wheel());
00071   } 
00072 
00073   append+=std::string(cindex);
00074   return append;  
00075 }
00076 
00077 void PrintRecoObjects::
00078 print(std::stringstream& ss, const reco::Track* track, const math::XYZPoint& vx){
00079   
00080   ss
00081     << "[PrintObject] " 
00082     << "\n\tcharge \t"          << track->charge()
00083     << "\talgo \t"              << track->algo() 
00084     << "\n\treferencePoint \t"  << track->referencePoint() << " \t r: " << track->referencePoint().rho()
00085     << "\n\tinnerpos \t"          << track->innerPosition() << " \t r: " << track->innerPosition().rho();
00086 
00087  
00088   ss
00089     << "\n\tmomentum \t"         << track->momentum()       << " pt " << track->momentum().rho()
00090     << "\n\tinnerMom \t"        << track->innerMomentum()  << " pt " << track->innerMomentum().rho();
00091   
00092 
00093   ss
00094     << "\n\tinnerok \t"         << track->innerOk()
00095     << "\n\tinnerdetid \t"      << track->innerDetId()
00096     << "\n\tdxy    \t"             << track->dxy() 
00097     << "\n\tdxy(vx) \t"         << track->dxy(vx)
00098     << "\t where vx \t"         << vx
00099     << std::endl;
00100 
00101 }