Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

TrgTrackToTrack.cpp

Go to the documentation of this file.
00001 #include "TrgTrackToTrack.h"
00002 #include "TrgConverter/TrgTrackStreamer.h"
00003 #include "Event/TrackStreamer.h"
00004 
00005 #include "GaudiKernel/AlgFactory.h"
00006 #include "GaudiKernel/SmartDataPtr.h"
00007 #include "CLHEP/Units/SystemOfUnits.h"
00008 
00009 //-----------------------------------------------------------------------------
00010 // Implementation file for class : TrgTrackToTrack
00011 //
00012 // 13/01/2005 : Jose A. Hernando
00013 //-----------------------------------------------------------------------------
00014 
00015 // Declaration of the Algorithm Factory
00016 static const  AlgFactory<TrgTrackToTrack>           s_trgTrackToTrackFact ;
00017 const        IAlgFactory& TrgTrackToTrackFactory  = s_trgTrackToTrackFact ;
00018 
00019 
00020 TrgTrackToTrack::TrgTrackToTrack( const std::string& name,
00021                                   ISvcLocator* pSvcLocator)
00022   : GaudiAlgorithm ( name , pSvcLocator )
00023   , m_trgContainer()
00024 {
00025   declareProperty( "TrgTracksName" ,
00026                    m_trgTracksName  = TrgTrackLocation::Long );
00027 
00028   declareProperty( "TracksLocation" ,
00029                    m_tracksLocation = "/Event/Rec/Tr/NewTracks" );
00030 
00031 }
00032 
00033 TrgTrackToTrack::~TrgTrackToTrack() {};
00034 
00035 StatusCode TrgTrackToTrack::initialize() {
00036 
00037   // initialize the gaudi-algorithm
00038   StatusCode sc = GaudiAlgorithm::initialize();
00039   if ( sc.isFailure() ) return sc;
00040   
00041   // get the dataProvider
00042   TrgDataProvider* trgData = tool<TrgDataProvider>( "TrgDataProvider" );
00043   
00045   m_trgContainer = trgData->tracks(m_trgTracksName);
00046 
00048   release(trgData);
00049 
00050   info() << " -- parameters of TrgTrackToTrack -- " << endreq;
00051   info() << " TrgTrack input  container " << m_trgTracksName << endreq;
00052   info() << "    Track output contaner "  << m_tracksLocation << endreq;
00053   info() << " ----------------------------------- " << endreq;
00054 
00055   return StatusCode::SUCCESS;
00056 }
00057 
00058 StatusCode TrgTrackToTrack::execute() {
00059 
00060   StatusCode sc = StatusCode::SUCCESS;
00061 
00062   Tracks* tracks = new Tracks();
00063 
00064   for (TrgTrackIterator it = m_trgContainer->begin();
00065        it != m_trgContainer->end(); it++) {
00066     const TrgTrack& gtrack = *(*it);
00067     Track* track = new Track();
00068     TrgTrackConverter::toTrack(gtrack,*track);
00069     tracks->insert(track);
00070     testLHCbIDs(gtrack);
00071     debug() << str::trgTrack(gtrack) << endreq;
00072     debug() << str::track(*track) << endreq;
00073   }
00074 
00075   debug() << " number of TrgTracks " << m_trgContainer->size() << endreq;
00076   debug() << " number converted Tracks " << tracks->size() << endreq;
00077 
00078   // locate the tracks in the TES
00079   sc = put( tracks, m_tracksLocation);
00080 
00081   return sc;
00082   
00083 }
00084 
00085 StatusCode TrgTrackToTrack::finalize() {
00086   return StatusCode::SUCCESS;
00087 }
00088 
00089 
00090 void TrgTrackToTrack::testLHCbIDs(const TrgTrack& gtrack) {
00091 
00092   std::vector<LHCbID> ids = TrgTrackConverter::lhcbIDs(gtrack);
00093   int i = 0;
00094 
00095   const std::vector< std::pair<VeloChannelID,int> >& vref 
00096     = gtrack.veloReference();
00097   for (std::vector< std::pair<VeloChannelID,int> >::const_iterator
00098          it = vref.begin(); it != vref.end(); it++) {
00099     const std::pair<VeloChannelID,int>& velo = *it;
00100     LHCbID id = ids[i];
00101     debug() << " detector: velo " << velo.first << " size " << velo.second
00102             << endreq;
00103     debug() << " channelID " << velo.first.channelID() << endreq;
00104     debug() << " LHCbID " << id.detectorType() << ", "
00105             << id.channelID() <<"," << id.spareBits()<< endreq;
00106     // id.setSpareBits((unsigned) velo.second);
00107     i++;
00108   }
00109   
00110   const std::vector< std::pair<ITChannelID,int> >& itref 
00111     = gtrack.itReference();
00112   for (std::vector< std::pair<ITChannelID,int> >::const_iterator
00113          it = itref.begin(); it != itref.end(); it++) {
00114     const std::pair<ITChannelID,int>& si = *it;
00115     LHCbID id = ids[i];
00116     debug() << " detector: it " << si.first << " size " << si.second
00117             << endreq;
00118     debug() << " channelID " << si.first.channelID() << endreq;
00119     debug() << " LHCbID " << id.detectorType() << ", "
00120             << id.channelID() <<"," << id.spareBits()<< endreq;
00121     i++;
00122   }
00123   
00124   
00125   const std::vector< std::pair<OTChannelID,int> >& otref 
00126     = gtrack.otReference();
00127   for (std::vector< std::pair<OTChannelID,int> >::const_iterator
00128          it = otref.begin(); it != otref.end(); it++) {
00129     const std::pair<OTChannelID,int>& ot = *it;
00130     LHCbID id = ids[i];
00131     debug() << " detector: ot " << ot.first << " size " << ot.second
00132             << endreq;
00133     debug() << " channelID " << ot.first.channelID()  << endreq;
00134     debug() << " LHCbID " << id.detectorType() << ", "
00135             << id.channelID() <<"," << id.spareBits()<< endreq;
00136     // id.setSpareBits((unsigned) ot.second);
00137     i++;
00138   }
00139 }
00140 
00141 
00142 

Generated on Fri May 27 13:59:37 2005 for New Track Event Model by doxygen 1.4.1