CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DirectMuonTrajectoryBuilder.cc
Go to the documentation of this file.
1 
11 
13 
16 
17 using namespace edm;
18 using namespace std;
19 
20 
22  const MuonServiceProxy* service):theService(service){
23 
24  // The seed transformer (used to refit the seed and get the seed transient state)
25  // ParameterSet seedTransformerPSet = par.getParameter<ParameterSet>("SeedTransformerParameters");
26  ParameterSet seedTransformerParameters = par.getParameter<ParameterSet>("SeedTransformerParameters");
27  theSeedTransformer = new SeedTransformer(seedTransformerParameters);
28 }
29 
31 
32  LogTrace("Muon|RecoMuon|DirectMuonTrajectoryBuilder")
33  << "DirectMuonTrajectoryBuilder destructor called" << endl;
34 
36 }
37 
40 
41  // Set the services for the seed transformer
43 
44  const string metname = "Muon|RecoMuon|DirectMuonTrajectoryBuilder";
45 
47 
48  vector<Trajectory> seedTrajectories = theSeedTransformer->seedTransform(seed);
49 
50  if(!seedTrajectories.empty())
51  for(vector<Trajectory>::const_iterator trajectory = seedTrajectories.begin(); trajectory!=seedTrajectories.end(); ++trajectory)
52  trajectoryContainer.push_back(new Trajectory(*trajectory));
53  else LogTrace(metname) << "Seed not refitted";
54 
55 
56  return trajectoryContainer;
57 
58 
59 // std::pair<bool, Trajectory>
60 // SETFilter::bwfit_SET(const TrajectorySeed &trajectorySeed ,
61 // const TransientTrackingRecHit::ConstRecHitContainer & trajRH,
62 // const TrajectoryStateOnSurface & firstTsos) {
63 // // get the actual fitter - Kalman fit
64 // theService->eventSetup().get<TrajectoryFitter::Record>().get(theBWLightFitterName, theBWLightFitter);
65 // vector<Trajectory> refitted;
66 // Trajectory trajectory;
67 // // the actual Kalman Fit
68 // refitted = theBWLightFitter->fit(trajectorySeed, trajRH, firstTsos);
69 // if(!refitted.empty()){
70 // // under tests...
71 // bool applyPruning = false;
72 // if(applyPruning){
73 // double previousTheta = trajRH[0]->globalPosition().theta();
74 // double previousWeight = 0.;
75 // std::vector <double> weights(trajRH.size());
76 // std::vector <double> weight_diff(trajRH.size());
77 // for(unsigned int iRH = 0; iRH<trajRH.size();++iRH){
78 // double weight = trajRH[iRH]->globalPosition().theta() - previousTheta;
79 // weights.at(iRH)= weight;
80 // double weightDiff = weight + previousWeight;
81 // weight_diff.at(iRH) = weightDiff;
82 // std::cout<<" iRH = "<<iRH<<" globPos"<< trajRH[iRH]->globalPosition()<<" weight = "<<weight<<" weightDiff = "<<weightDiff<<std::endl;
83 // previousTheta = trajRH[iRH]->globalPosition().theta();
84 // previousWeight = weight;
85 
86 // }
87 // Trajectory::DataContainer measurements_segments = refitted.front().measurements();
88 // if(measurements_segments.size() != trajRH.size()){
89 // std::cout<<" measurements_segments.size() = "<<measurements_segments.size()<<
90 // " trajRH.size() = "<<trajRH.size()<<std::endl;
91 // std::cout<<" THIS IS NOT SUPPOSED TO HAPPEN! CHECK THE CODE (pruning)"<<std::endl;
92 // }
93 // std::vector <int> badHits;
94 // TransientTrackingRecHit::ConstRecHitContainer trajRH_pruned;
95 // for(unsigned int iMeas = 0; iMeas<measurements_segments.size();++iMeas){
96 // // we have to apply pruning on the base of intermed. chi2 of measurements
97 // // and then refit again!
98 // std::cout<<" after refitter : iMeas = "<<iMeas<<" estimate() = "<< measurements_segments[iMeas].estimate()<<
99 // " globPos = "<< measurements_segments[iMeas].recHit()->globalPosition()<<std::endl;
100 // //const TransientTrackingRecHit::ConstRecHitContainer trajRH_pruned;
101 // bool pruningCondition = fabs(weights[iMeas])>0.0011 && fabs(weight_diff[iMeas])>0.0011;
102 // std::cout<<" weights[iMeas] = "<<weights[iMeas]<<" weight_diff[iMeas] = "<<weight_diff[iMeas]<<" pruningCondition = "<<pruningCondition<<std::endl;
103 // //bool pruningCondition = (measurements_segments[iMeas].estimate()>50);
104 // if(iMeas && pruningCondition && measurements_segments.size() == trajRH.size()){// first is kept for technical reasons (for now)
105 // badHits.push_back(iMeas);
106 // }
107 // else{
108 // trajRH_pruned.push_back(trajRH[iMeas]);
109 // }
110 // }
111 // if(float(measurements_segments.size())/float(badHits.size()) >0.5 &&
112 // measurements_segments.size() - badHits.size() > 6){
113 // std::cout<<" this is pruning ; badHits.size() = "<<badHits.size()<<std::endl;
114 // refitted = theBWLightFitter->fit(trajectorySeed, trajRH_pruned, firstTsos);
115 // }
116 // }
117 // std::pair<bool, Trajectory> refitResult = make_pair(true,refitted.front());
118 // //return RefitResult(true,refitted.front());
119 // return refitResult;
120 // }
121 // else{
122 // // std::cout<<" refitted.empty() = "<<refitted.empty()<<std::endl;
123 // std::pair<bool, Trajectory> refitResult = make_pair(false,trajectory);
124 // //return RefitResult(false,trajectory);
125 // return refitResult;
126 // }
127 }
128 
129 
132 {
134 }
135 
136 
137 
139 }
140 
141 
T getParameter(std::string const &) const
MuonCandidate::CandidateContainer CandidateContainer
std::pair< const Trajectory *, reco::TrackRef > TrackCand
const std::string metname
void setServices(const edm::EventSetup &)
Set the services needed by the SeedTransformer.
MuonCandidate::TrajectoryContainer TrajectoryContainer
std::vector< Trajectory > seedTransform(const TrajectorySeed &) const
Performs the fit.
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
#define LogTrace(id)
virtual TrajectoryContainer trajectories(const TrajectorySeed &)
return a container of the reconstructed trajectories compatible with a given seed ...
virtual ~DirectMuonTrajectoryBuilder()
destructor
virtual void setEvent(const edm::Event &event)
pass the Event to the algo at each event
DirectMuonTrajectoryBuilder(const edm::ParameterSet &, const MuonServiceProxy *)
constructor