1 #include "PerEventIPFitter.h"
4 #include <EVENT/LCCollection.h>
5 #include <EVENT/ReconstructedParticle.h>
6 #include <EVENT/Track.h>
7 #include <EVENT/Vertex.h>
8 #include <IMPL/LCCollectionVec.h>
9 #include <IMPL/LCRelationImpl.h>
11 #include <inc/lciointerface.h>
12 #include <algo/inc/pereventipfitter.h>
13 #include <util/inc/memorymanager.h>
18 using namespace marlin ;
20 using namespace vertex_lcfi;
24 PerEventIPFitterProcessor::PerEventIPFitterProcessor() : Processor(
"PerEventIPFitterProcessor") {
27 _description =
"Per Event IP fitter - trims tracks to reach probabililty threshold" ;
32 registerInputCollection( lcio::LCIO::RECONSTRUCTEDPARTICLE,
34 "Name of the ReconstructedParticle collection contains tracks to fit" ,
35 _InputRPCollectionName ,
36 std::string(
"EventTracks") ) ;
37 registerOutputCollection( lcio::LCIO::VERTEX,
38 "OutputVertexCollection" ,
39 "Name of the Vertex collection of the output ip vertex" ,
40 _VertexCollectionName ,
41 std::string(
"IPVertex") ) ;
43 DefaultPos.push_back(0.0);
44 DefaultPos.push_back(0.0);
45 DefaultPos.push_back(0.0);
46 registerProcessorParameter(
"DefaultIPPosition" ,
47 "Manually set default position of the IP vertex (cm)" ,
52 DefaultErr.push_back(pow(5.0/1000.0,2.0));
53 DefaultErr.push_back(0.0);
54 DefaultErr.push_back(pow(5.0/1000.0,2.0));
55 DefaultErr.push_back(0.0);
56 DefaultErr.push_back(0.0);
57 DefaultErr.push_back(pow(20.0/1000.0,2.0));
58 registerProcessorParameter(
"DefaultIPError" ,
59 "Manually set default error matrix of the primary vertex (cm) (lower symmetric)" ,
63 registerProcessorParameter(
"ProbabilityThreshold" ,
64 "Tracks are removed until this threshold is reached" ,
70 void PerEventIPFitterProcessor::init() {
82 _IPFitter->setDoubleParameter(
"ProbThreshold",_ProbThreshold);
85 void PerEventIPFitterProcessor::processRunHeader( LCRunHeader* run) {
89 void PerEventIPFitterProcessor::processEvent( LCEvent * evt ) {
91 LCCollection* RPCollection;
92 RPCollection = evt->getCollection( _InputRPCollectionName );
99 IPPos.x() = _DefaultIPPos[0];
100 IPPos.y() = _DefaultIPPos[1];
101 IPPos.z() = _DefaultIPPos[2];
102 IPErr(0,0) = _DefaultIPErr[0];
103 IPErr(1,0) = _DefaultIPErr[1];
104 IPErr(1,1) = _DefaultIPErr[2];
105 IPErr(2,0) = _DefaultIPErr[3];
106 IPErr(2,1) = _DefaultIPErr[4];
107 IPErr(2,2) = _DefaultIPErr[5];
114 int nRCP = RPCollection->getNumberOfElements() ;
116 for(
int i=0; i< nRCP ; i++)
118 MyEvent->
addTrack(trackFromLCIORP(MyEvent,dynamic_cast<ReconstructedParticle*>(RPCollection->getElementAt(i))) );
125 lcio::Vertex* LCIOIPResult = vertexFromLCFIVertex(IPResult);
127 std::vector<std::string>::const_iterator it = find(evt->getCollectionNames()->begin(),evt->getCollectionNames()->end(),_VertexCollectionName);
128 if (it == evt->getCollectionNames()->end())
131 LCCollection* MyCollection =
new LCCollectionVec(
"Vertex");
132 evt->addCollection(MyCollection,_VertexCollectionName);
134 evt->getCollection(_VertexCollectionName)->addElement(LCIOIPResult);
137 MetaMemoryManager::Event()->delAllObjects();
143 void PerEventIPFitterProcessor::check( LCEvent * evt ) {
148 void PerEventIPFitterProcessor::end(){
150 MetaMemoryManager::Run()->delAllObjects();
151 std::cout <<
"PerEventIPFitterProcessor::end() " << name()
152 <<
" processed " << _nEvt <<
" events in " << _nRun <<
" runs "
void registerObject(T *pointer)
Register an object for memory management.
void addTrack(Track *Track)
Add Track.
Example jet variable that returns the number of tracks in the jet.
Determine IP position and error from the tracks in an event by simple fit.