CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
DirectMuonTrajectoryBuilder Class Reference

#include <DirectMuonTrajectoryBuilder.h>

Inheritance diagram for DirectMuonTrajectoryBuilder:
MuonTrajectoryBuilder

Public Member Functions

 DirectMuonTrajectoryBuilder (const edm::ParameterSet &, const MuonServiceProxy *, edm::ConsumesCollector)
 constructor More...
 
void setEvent (const edm::Event &event) override
 pass the Event to the algo at each event More...
 
TrajectoryContainer trajectories (const TrajectorySeed &) override
 return a container of the reconstructed trajectories compatible with a given seed More...
 
CandidateContainer trajectories (const TrackCand &) override
 return a container reconstructed muons starting from a given track More...
 
 ~DirectMuonTrajectoryBuilder () override
 destructor More...
 
- Public Member Functions inherited from MuonTrajectoryBuilder
 MuonTrajectoryBuilder ()
 constructor More...
 
virtual ~MuonTrajectoryBuilder ()
 destructor More...
 

Private Attributes

SeedTransformertheSeedTransformer
 
const MuonServiceProxytheService
 

Additional Inherited Members

- Public Types inherited from MuonTrajectoryBuilder
typedef
MuonCandidate::CandidateContainer 
CandidateContainer
 
typedef std::pair< const
Trajectory *, reco::TrackRef
TrackCand
 
typedef
MuonCandidate::TrajectoryContainer 
TrajectoryContainer
 

Detailed Description

Class which takes a trajectory seed and fit its hits, returning a Trajectory container

Author
R. Bellan - INFN Torino

Class which takes a trajectory seed and fit its hits, returning a Trajectory container

Author

Definition at line 24 of file DirectMuonTrajectoryBuilder.h.

Constructor & Destructor Documentation

DirectMuonTrajectoryBuilder::DirectMuonTrajectoryBuilder ( const edm::ParameterSet par,
const MuonServiceProxy service,
edm::ConsumesCollector  iC 
)

constructor

Definition at line 19 of file DirectMuonTrajectoryBuilder.cc.

References edm::ParameterSet::getParameter(), and theSeedTransformer.

22  : theService(service) {
23  // The seed transformer (used to refit the seed and get the seed transient state)
24  // ParameterSet seedTransformerPSet = par.getParameter<ParameterSet>("SeedTransformerParameters");
25  ParameterSet seedTransformerParameters = par.getParameter<ParameterSet>("SeedTransformerParameters");
26  theSeedTransformer = new SeedTransformer(seedTransformerParameters, iC);
27 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
DirectMuonTrajectoryBuilder::~DirectMuonTrajectoryBuilder ( )
override

destructor

Definition at line 29 of file DirectMuonTrajectoryBuilder.cc.

References LogTrace, and theSeedTransformer.

29  {
30  LogTrace("Muon|RecoMuon|DirectMuonTrajectoryBuilder") << "DirectMuonTrajectoryBuilder destructor called" << endl;
31 
33  delete theSeedTransformer;
34 }
#define LogTrace(id)

Member Function Documentation

void DirectMuonTrajectoryBuilder::setEvent ( const edm::Event event)
overridevirtual

pass the Event to the algo at each event

Implements MuonTrajectoryBuilder.

Definition at line 129 of file DirectMuonTrajectoryBuilder.cc.

129 {}
MuonTrajectoryBuilder::TrajectoryContainer DirectMuonTrajectoryBuilder::trajectories ( const TrajectorySeed seed)
overridevirtual

return a container of the reconstructed trajectories compatible with a given seed

Implements MuonTrajectoryBuilder.

Definition at line 36 of file DirectMuonTrajectoryBuilder.cc.

References LogTrace, metname, SeedTransformer::seedTransform(), SeedTransformer::setServices(), theSeedTransformer, and theService.

36  {
37  // Set the services for the seed transformer
39 
40  const string metname = "Muon|RecoMuon|DirectMuonTrajectoryBuilder";
41 
43 
44  vector<Trajectory> seedTrajectories = theSeedTransformer->seedTransform(seed);
45 
46  if (!seedTrajectories.empty())
47  for (vector<Trajectory>::const_iterator trajectory = seedTrajectories.begin(); trajectory != seedTrajectories.end();
48  ++trajectory)
49  trajectoryContainer.push_back(std::make_unique<Trajectory>(*trajectory));
50  else
51  LogTrace(metname) << "Seed not refitted";
52 
53  return trajectoryContainer;
54 
55  // std::pair<bool, Trajectory>
56  // SETFilter::bwfit_SET(const TrajectorySeed &trajectorySeed ,
57  // const TransientTrackingRecHit::ConstRecHitContainer & trajRH,
58  // const TrajectoryStateOnSurface & firstTsos) {
59  // // get the actual fitter - Kalman fit
60  // theService->eventSetup().get<TrajectoryFitter::Record>().get(theBWLightFitterName, theBWLightFitter);
61  // vector<Trajectory> refitted;
62  // Trajectory trajectory;
63  // // the actual Kalman Fit
64  // refitted = theBWLightFitter->fit(trajectorySeed, trajRH, firstTsos);
65  // if(!refitted.empty()){
66  // // under tests...
67  // bool applyPruning = false;
68  // if(applyPruning){
69  // double previousTheta = trajRH[0]->globalPosition().theta();
70  // double previousWeight = 0.;
71  // std::vector <double> weights(trajRH.size());
72  // std::vector <double> weight_diff(trajRH.size());
73  // for(unsigned int iRH = 0; iRH<trajRH.size();++iRH){
74  // double weight = trajRH[iRH]->globalPosition().theta() - previousTheta;
75  // weights.at(iRH)= weight;
76  // double weightDiff = weight + previousWeight;
77  // weight_diff.at(iRH) = weightDiff;
78  // std::cout<<" iRH = "<<iRH<<" globPos"<< trajRH[iRH]->globalPosition()<<" weight = "<<weight<<" weightDiff = "<<weightDiff<<std::endl;
79  // previousTheta = trajRH[iRH]->globalPosition().theta();
80  // previousWeight = weight;
81 
82  // }
83  // Trajectory::DataContainer measurements_segments = refitted.front().measurements();
84  // if(measurements_segments.size() != trajRH.size()){
85  // std::cout<<" measurements_segments.size() = "<<measurements_segments.size()<<
86  // " trajRH.size() = "<<trajRH.size()<<std::endl;
87  // std::cout<<" THIS IS NOT SUPPOSED TO HAPPEN! CHECK THE CODE (pruning)"<<std::endl;
88  // }
89  // std::vector <int> badHits;
90  // TransientTrackingRecHit::ConstRecHitContainer trajRH_pruned;
91  // for(unsigned int iMeas = 0; iMeas<measurements_segments.size();++iMeas){
92  // // we have to apply pruning on the base of intermed. chi2 of measurements
93  // // and then refit again!
94  // std::cout<<" after refitter : iMeas = "<<iMeas<<" estimate() = "<< measurements_segments[iMeas].estimate()<<
95  // " globPos = "<< measurements_segments[iMeas].recHit()->globalPosition()<<std::endl;
96  // //const TransientTrackingRecHit::ConstRecHitContainer trajRH_pruned;
97  // bool pruningCondition = fabs(weights[iMeas])>0.0011 && fabs(weight_diff[iMeas])>0.0011;
98  // std::cout<<" weights[iMeas] = "<<weights[iMeas]<<" weight_diff[iMeas] = "<<weight_diff[iMeas]<<" pruningCondition = "<<pruningCondition<<std::endl;
99  // //bool pruningCondition = (measurements_segments[iMeas].estimate()>50);
100  // if(iMeas && pruningCondition && measurements_segments.size() == trajRH.size()){// first is kept for technical reasons (for now)
101  // badHits.push_back(iMeas);
102  // }
103  // else{
104  // trajRH_pruned.push_back(trajRH[iMeas]);
105  // }
106  // }
107  // if(float(measurements_segments.size())/float(badHits.size()) >0.5 &&
108  // measurements_segments.size() - badHits.size() > 6){
109  // std::cout<<" this is pruning ; badHits.size() = "<<badHits.size()<<std::endl;
110  // refitted = theBWLightFitter->fit(trajectorySeed, trajRH_pruned, firstTsos);
111  // }
112  // }
113  // std::pair<bool, Trajectory> refitResult = make_pair(true,refitted.front());
114  // //return RefitResult(true,refitted.front());
115  // return refitResult;
116  // }
117  // else{
118  // // std::cout<<" refitted.empty() = "<<refitted.empty()<<std::endl;
119  // std::pair<bool, Trajectory> refitResult = make_pair(false,trajectory);
120  // //return RefitResult(false,trajectory);
121  // return refitResult;
122  // }
123 }
const std::string metname
void setServices(const edm::EventSetup &)
Set the services needed by the SeedTransformer.
MuonCandidate::TrajectoryContainer TrajectoryContainer
#define LogTrace(id)
std::vector< Trajectory > seedTransform(const TrajectorySeed &) const
Performs the fit.
MuonTrajectoryBuilder::CandidateContainer DirectMuonTrajectoryBuilder::trajectories ( const TrackCand )
overridevirtual

return a container reconstructed muons starting from a given track

Implements MuonTrajectoryBuilder.

Definition at line 125 of file DirectMuonTrajectoryBuilder.cc.

125  {
127 }
MuonCandidate::CandidateContainer CandidateContainer

Member Data Documentation

SeedTransformer* DirectMuonTrajectoryBuilder::theSeedTransformer
private
const MuonServiceProxy* DirectMuonTrajectoryBuilder::theService
private

Definition at line 42 of file DirectMuonTrajectoryBuilder.h.

Referenced by trajectories().