CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/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   for(size_t ie=0;ie<15;++ie)
00034     ss << "\t " << tjS.startingState().error(ie);
00035   for(TrajectorySeed::const_iterator iter=tjS.recHits().first;iter!=tjS.recHits().second;++iter)
00036     ss << "\n\t TrackingRecHit on detid " << iter->geographicalId().rawId() << " \t localPos " << iter->localPosition();
00037   
00038 }
00039 
00040 void PrintRecoObjects::
00041 print(std::stringstream& ss, const uint32_t& detid) const{
00042   ss<< getString(detid);
00043 }
00044 
00045 std::string PrintRecoObjects::
00046 getString(uint32_t detid) const{
00047   std::string append=" ";
00048   char cindex[128];
00049   SiStripDetId a(detid);
00050   if ( a.subdetId() == 3 ){
00051     append+="_TIB_L";
00052     sprintf(cindex,"%d",TIBDetId(detid).layer()); 
00053   } else if ( a.subdetId() == 4 ) {
00054     if(TIDDetId(detid).side()==1){
00055       append+="_M_D";
00056     }else{
00057       append+="_M_P";
00058     }
00059     sprintf(cindex,"%d",TIDDetId(detid).wheel());
00060   } else if ( a.subdetId() == 5 ) {
00061     append+="_TOB_L";
00062     sprintf(cindex,"%d",TOBDetId(detid).layer());
00063   } else if ( a.subdetId() == 6 ) {
00064     if(TECDetId(detid).side()==1){
00065       append+="_TEC_M";
00066     }else{
00067       append+="_TEC_P";
00068     }
00069     sprintf(cindex,"%d",TECDetId(detid).wheel());
00070   } 
00071 
00072   append+=std::string(cindex);
00073   return append;  
00074 }
00075 
00076 void PrintRecoObjects::
00077 print(std::stringstream& ss, const reco::Track* track, const math::XYZPoint& vx){
00078   
00079   ss
00080     << "[PrintObject] " 
00081     << "\n\tcharge \t"          << track->charge()
00082     << "\talgo \t"              << track->algo() 
00083     << "\n\treferencePoint \t"  << track->referencePoint() << " \t r: " << track->referencePoint().rho()
00084     << "\n\tinnerpos \t"          << track->innerPosition() << " \t r: " << track->innerPosition().rho();
00085 
00086  
00087   ss
00088     << "\n\tmomentum \t"         << track->momentum()       << " pt " << track->momentum().rho()
00089     << "\n\tinnerMom \t"        << track->innerMomentum()  << " pt " << track->innerMomentum().rho();
00090   
00091 
00092   ss
00093     << "\n\tinnerok \t"         << track->innerOk()
00094     << "\n\tinnerdetid \t"      << track->innerDetId()
00095     << "\n\tdxy    \t"             << track->dxy() 
00096     << "\n\tdxy(vx) \t"         << track->dxy(vx)
00097     << "\t where vx \t"         << vx
00098     << std::endl;
00099 
00100 }