EUTelTrack::EUTelTrack(const EUTelTrack& track): IMPL::TrackImpl(){ setChi2(track.getChi2()); setNdf(track.getNdf()); for(size_t i=0; i<track.getTracks().size();++i){ addTrack(track.getTracks().at(i)); } }
EUTelTrack::EUTelTrack(const EUTelTrack& track, bool copyContents): _chi2(0), _nDF(0), _radPerTotal(0) { setChi2(track.getChi2()); setNdf(track.getNdf()); setRadPerTotal(track.getRadPerTotal()); setQOverP(track.getQOverP()); }
EUTelTrack::EUTelTrack(const EUTelTrack& track): _chi2(0), _nDF(0), _radPerTotal(0) { setChi2(track.getChi2()); setNdf(track.getNdf()); setStates(track.getStatesCopy()); setRadPerTotal(track.getRadPerTotal()); setQOverP(track.getQOverP()); }
void EUTelTrackAnalysis::plotIncidenceAngles(EUTelTrack track) { streamlog_out(DEBUG2) << " EUTelTrackAnalysis::plotIncidenceAngles------------------------------BEGIN"<< std::endl; std::vector<EUTelState> states = track.getStates(); for(size_t i=0; i<states.size(); ++i) { EUTelState state = states.at(i); state.print(); TVectorD stateVec = state.getStateVec(); float incidenceXZ = stateVec[1]; typedef std::map<int , AIDA::IHistogram1D * >::iterator it_type; for(it_type iterator =_mapFromSensorIDToIncidenceXZ.begin(); iterator != _mapFromSensorIDToIncidenceXZ.end(); iterator++) { if(iterator->first == state.getLocation()) { streamlog_out(DEBUG2) << "Add incidence XZ : " << incidenceXZ << std::endl; _mapFromSensorIDToIncidenceXZ[ state.getLocation() ] ->fill(incidenceXZ); break; } } } for(size_t i=0; i<states.size(); ++i) { EUTelState state = states.at(i); state.print(); TVectorD stateVec = state.getStateVec(); float incidenceYZ = stateVec[2]; typedef std::map<int , AIDA::IHistogram1D * >::iterator it_type; for(it_type iterator =_mapFromSensorIDToIncidenceYZ.begin(); iterator != _mapFromSensorIDToIncidenceYZ.end(); iterator++) { if(iterator->first == state.getLocation()) { streamlog_out(DEBUG2) << "Add incidence YZ : " << incidenceYZ << std::endl; _mapFromSensorIDToIncidenceYZ[ state.getLocation() ] ->fill(incidenceYZ); break; } } } streamlog_out(DEBUG2) << " EUTelTrackAnalysis::plotIncidenceAngles------------------------------END"<< std::endl; }
void EUTelProcessorTrackAnalysis::processEvent(LCEvent * evt){ try{ EUTelEventImpl * event = static_cast<EUTelEventImpl*> (evt); ///We change the class so we can use EUTelescope functions if (event->getEventType() == kEORE) { streamlog_out(DEBUG4) << "EORE found: nothing else to do." << std::endl; return; }else if (event->getEventType() == kUNKNOWN) { streamlog_out(WARNING2) << "Event number " << event->getEventNumber() << " in run " << event->getRunNumber() << " is of unknown type. Continue considering it as a normal Data Event." << std::endl; } LCCollection* eventCollection = NULL; try { eventCollection = evt->getCollection(_trackInputCollectionName); streamlog_out(DEBUG1) << "collection : " << _trackInputCollectionName << " retrieved" << std::endl; }catch (DataNotAvailableException e) { streamlog_out(MESSAGE0) << _trackInputCollectionName << " collection not available" << std::endl; throw marlin::SkipEventException(this); } if (eventCollection != NULL) { streamlog_out(DEBUG2) << "Collection contains data! Continue!" << std::endl; for (int iTrack = 0; iTrack < eventCollection->getNumberOfElements(); ++iTrack){ EUTelTrack track = *(static_cast<EUTelTrack*> (eventCollection->getElementAt(iTrack))); _analysis->plotResidualVsPosition(track); _analysis->plotIncidenceAngles(track); if(track.getChi2()/track.getNdf() < 5.0){ _analysis->plotBeamEnergy(track); _analysis->plotPValueVsBeamEnergy(track); } _analysis->plotPValueWithPosition(track); _analysis->plotPValueWithIncidenceAngles(track); } } }catch(...){ streamlog_out(MESSAGE9)<<"There is an unknown error in EUTelProcessorTrackAnalysis-processEvent" <<std::endl; throw marlin::StopProcessingException( this ) ; } }
EUTelTrack::EUTelTrack(const EUTelTrack& track, bool copyContents){ if( track.getChi2()== 0 or track.getNdf() == 0){ streamlog_out(MESSAGE5)<<"Chi: "<<track.getChi2() <<" ndf: "<<track.getNdf() << std::endl; throw(lcio::Exception("You are trying to create a track that is empty. With another track that has not chi2 or degrees of freedom.")); } setChi2(track.getChi2()); setNdf(track.getNdf()); }
void EUTelTrackAnalysis::plotResidualVsPosition(EUTelTrack track) { streamlog_out(DEBUG2) << " EUTelTrackAnalysis::plotResidualVsPosition------------------------------BEGIN"<< std::endl; std::vector<EUTelState> states = track.getStates(); for(size_t i=0; i<states.size(); ++i) { EUTelState state = states.at(i); state.print(); if(!state.getIsThereAHit()) { continue; } EVENT::TrackerHit* hit = state.getHit(); float* statePosition = state.getPosition(); const double* hitPosition = hit->getPosition(); float residual[2]; streamlog_out(DEBUG2) << "State position: " << statePosition[0]<<","<<statePosition[1]<<","<<statePosition[2]<< std::endl; streamlog_out(DEBUG2) << "Hit position: " << hitPosition[0]<<","<<hitPosition[1]<<","<<hitPosition[2]<< std::endl; typedef std::map<int ,AIDA::IProfile2D* >::iterator it_type; for(it_type iterator = _mapFromSensorIDToHistogramX.begin(); iterator != _mapFromSensorIDToHistogramX.end(); iterator++) { if(iterator->first == state.getLocation()) { residual[0]=statePosition[0]-hitPosition[0]; streamlog_out(DEBUG2) << "Add residual X : " << residual[0]<< std::endl; _mapFromSensorIDToHistogramX[ state.getLocation() ] -> fill( hitPosition[0], hitPosition[1], residual[0], 1 ); break; } } for(it_type iterator = _mapFromSensorIDToHistogramY.begin(); iterator != _mapFromSensorIDToHistogramY.end(); iterator++) { if(iterator->first == state.getLocation()) { residual[1]=statePosition[1]-hitPosition[1]; streamlog_out(DEBUG2) << "Add residual Y : " << residual[1]<< std::endl; _mapFromSensorIDToHistogramY[ state.getLocation() ] -> fill( hitPosition[0], hitPosition[1], residual[1], 1 ); break; } } } streamlog_out(DEBUG2) << " EUTelTrackAnalysis::plotResidualVsPosition------------------------------END"<< std::endl; }