CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
SETMuonSeedProducer Class Reference

#include <SETMuonSeedProducer.h>

Inheritance diagram for SETMuonSeedProducer:
edm::stream::EDProducer<>

Public Types

typedef MuonTransientTrackingRecHit::MuonRecHitContainer MuonRecHitContainer
 
typedef std::vector< Trajectory * > TrajectoryContainer
 
- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Public Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 
 SETMuonSeedProducer (const edm::ParameterSet &)
 Constructor with Parameter set. More...
 
 ~SETMuonSeedProducer () override
 Destructor. More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Member Functions

SETFilterfilter () const
 pre-filter More...
 
void setEvent (const edm::Event &)
 

Private Attributes

bool apply_prePruning
 
edm::EDGetTokenT< reco::BeamSpotbeamspotToken
 
edm::InputTag theBeamSpotTag
 
SETFiltertheFilter
 
SETPatternRecognitionthePatternRecognition
 
SETSeedFinder theSeedFinder
 
MuonServiceProxytheService
 
bool useSegmentsInTrajectory
 

Detailed Description

I. Bloch, E. James, S. Stoynev

Definition at line 30 of file SETMuonSeedProducer.h.

Member Typedef Documentation

◆ MuonRecHitContainer

Definition at line 32 of file SETMuonSeedProducer.h.

◆ TrajectoryContainer

Definition at line 33 of file SETMuonSeedProducer.h.

Constructor & Destructor Documentation

◆ SETMuonSeedProducer()

SETMuonSeedProducer::SETMuonSeedProducer ( const edm::ParameterSet parameterSet)

Constructor with Parameter set.

Definition at line 31 of file SETMuonSeedProducer.cc.

33  edm::ConsumesCollector iC = consumesCollector();
35 
36  const string metname = "Muon|RecoMuon|SETMuonSeedSeed";
37  //std::cout<<" The SET SEED producer started."<<std::endl;
38 
39  ParameterSet serviceParameters = parameterSet.getParameter<ParameterSet>("ServiceParameters");
40  theService = new MuonServiceProxy(serviceParameters, consumesCollector());
43  // Parameter set for the Builder
44  ParameterSet trajectoryBuilderParameters = parameterSet.getParameter<ParameterSet>("SETTrajBuilderParameters");
45 
46  LogTrace(metname) << "constructor called" << endl;
47 
48  apply_prePruning = trajectoryBuilderParameters.getParameter<bool>("Apply_prePruning");
49 
50  useSegmentsInTrajectory = trajectoryBuilderParameters.getParameter<bool>("UseSegmentsInTrajectory");
51 
52  // The inward-outward fitter (starts from seed state)
53  ParameterSet filterPSet = trajectoryBuilderParameters.getParameter<ParameterSet>("FilterParameters");
54  filterPSet.addUntrackedParameter("UseSegmentsInTrajectory", useSegmentsInTrajectory);
55  theFilter = new SETFilter(filterPSet, theService);
56 
57  //----
58 
59  beamspotToken = consumes<reco::BeamSpot>(theBeamSpotTag);
60  produces<TrajectorySeedCollection>();
61 }

References edm::ParameterSet::addUntrackedParameter(), apply_prePruning, beamspotToken, edm::ParameterSet::getParameter(), LogTrace, metname, MuonServiceProxy_cff::MuonServiceProxy, edm::parameterSet(), SETPatternRecognition::setServiceProxy(), SETSeedFinder::setServiceProxy(), theBeamSpotTag, theFilter, thePatternRecognition, theSeedFinder, theService, and useSegmentsInTrajectory.

◆ ~SETMuonSeedProducer()

SETMuonSeedProducer::~SETMuonSeedProducer ( )
override

Destructor.

Definition at line 63 of file SETMuonSeedProducer.cc.

63  {
64  LogTrace("Muon|RecoMuon|SETMuonSeedProducer") << "SETMuonSeedProducer destructor called" << endl;
65 
66  if (theFilter)
67  delete theFilter;
68  if (theService)
69  delete theService;
71  delete thePatternRecognition;
72 }

References LogTrace, theFilter, thePatternRecognition, and theService.

Member Function Documentation

◆ filter()

SETFilter* SETMuonSeedProducer::filter ( ) const
inlineprivate

pre-filter

Definition at line 48 of file SETMuonSeedProducer.h.

48 { return theFilter; }

References theFilter.

Referenced by produce().

◆ produce()

void SETMuonSeedProducer::produce ( edm::Event event,
const edm::EventSetup eventSetup 
)
override

Definition at line 74 of file SETMuonSeedProducer.cc.

74  {
75  //std::cout<<" start producing..."<<std::endl;
76  const string metname = "Muon|RecoMuon|SETMuonSeedSeed";
77 
79 
80  //Get the CSC Geometry :
81  theService->update(eventSetup);
82 
83  auto output = std::make_unique<TrajectorySeedCollection>();
84 
86 
87  setEvent(event);
88 
90  edm::Handle<reco::BeamSpot> beamSpotHandle;
91  event.getByToken(beamspotToken, beamSpotHandle);
92  if (beamSpotHandle.isValid()) {
93  beamSpot = *beamSpotHandle;
94 
95  } else {
96  edm::LogInfo("MuonSeedGenerator") << "No beam spot available from EventSetup \n";
97  }
98 
99  // make it a vector so we can subtract it from position vectors
100  GlobalVector gv(beamSpot.x0(), beamSpot.y0(), beamSpot.z0());
102 
103  bool fwFitFailed = true;
104 
105  std::vector<SeedCandidate> seedCandidates_AllChosen;
106  std::vector<MuonRecHitContainer> MuonRecHitContainer_clusters;
107  //---- this is "clustering"; later a trajectory can not use hits from different clusters
108  thePatternRecognition->produce(event, eventSetup, MuonRecHitContainer_clusters);
109 
110  //std::cout<<"We have formed "<<MuonRecHitContainer_clusters.size()<<" clusters"<<std::endl;
111  //---- for each cluster,
112  for (unsigned int cluster = 0; cluster < MuonRecHitContainer_clusters.size(); ++cluster) {
113  //std::cout<<" This is cluster number : "<<cluster<<std::endl;
114  std::vector<SeedCandidate> seedCandidates_inCluster;
115  //---- group hits in detector layers (if in same layer); the idea is that
116  //---- some hits could not belong to a track simultaneously - these will be in a
117  //---- group; two hits from one and the same group will not go to the same track
118  std::vector<MuonRecHitContainer> MuonRecHitContainer_perLayer =
119  theSeedFinder.sortByLayer(MuonRecHitContainer_clusters[cluster]);
120  //---- Add protection against huge memory consumption
121  //---- Delete busy layers if needed (due to combinatorics)
122  theSeedFinder.limitCombinatorics(MuonRecHitContainer_perLayer);
123  //---- build all possible combinations (valid sets)
124  std::vector<MuonRecHitContainer> allValidSets = theSeedFinder.findAllValidSets(MuonRecHitContainer_perLayer);
125  if (apply_prePruning) {
126  //---- remove "wild" segments from the combination
127  theSeedFinder.validSetsPrePruning(allValidSets);
128  }
129 
130  //---- build the appropriate output: seedCandidates_inCluster
131  //---- if too many (?) valid sets in a cluster - skip it
132  if (allValidSets.size() < 500) { // hardcoded - remove it
133  seedCandidates_inCluster = theSeedFinder.fillSeedCandidates(allValidSets);
134  }
135  //---- find the best valid combinations using simple (no propagation errors) chi2-fit
136  //std::cout<<" Found "<<seedCandidates_inCluster.size()<<" valid sets in the current cluster."<<std::endl;
137  if (!seedCandidates_inCluster.empty()) {
138  //---- this is the forward fitter (segments); choose which of the SETs in a cluster to be considered further
139  std::vector<SeedCandidate> bestSets_inCluster;
140  fwFitFailed = !(filter()->fwfit_SET(seedCandidates_inCluster, bestSets_inCluster));
141 
142  //---- has the fit failed? continue to the next cluster instead of returning the empty trajectoryContainer and stop the loop IBL 080903
143  if (fwFitFailed) {
144  //std::cout<<" fwfit_SET failed!"<<std::endl;
145  continue;
146  }
147  for (unsigned int iSet = 0; iSet < bestSets_inCluster.size(); ++iSet) {
148  seedCandidates_AllChosen.push_back(bestSets_inCluster[iSet]);
149  }
150  }
151  }
152  //---- loop over all the SETs candidates
153  for (unsigned int iMuon = 0; iMuon < seedCandidates_AllChosen.size(); ++iMuon) {
154  //std::cout<<" chosen iMuon = "<<iMuon<<std::endl;
155  Trajectory::DataContainer finalCandidate;
156  SeedCandidate* aFinalSet = &(seedCandidates_AllChosen[iMuon]);
157  fwFitFailed = !(filter()->buildTrajectoryMeasurements(aFinalSet, finalCandidate));
158  if (fwFitFailed) {
159  //std::cout<<" buildTrajectoryMeasurements failed!"<<std::endl;
160  continue;
161  }
162  //---- are there measurements (or detLayers) used at all?
163  if (!filter()->layers().empty())
164  LogTrace(metname) << debug.dumpLayer(filter()->lastDetLayer());
165  else {
166  continue;
167  }
168  //std::cout<<" chambers used - all : "<<filter()->getTotalChamberUsed()<<", DT : "<<filter()->getDTChamberUsed()<<
169  //", CSC : "<<filter()->getCSCChamberUsed()<<", RPC : "<<filter()->getRPCChamberUsed()<<std::endl;
170  //---- ask for some "reasonable" conditions to build a STA muon;
171  //---- (totalChambers >= 2, dtChambers + cscChambers >0)
172  if (filter()->goodState()) {
174  TrajectoryStateOnSurface firstTSOS;
175  bool conversionPassed = false;
177  //---- transforms set of segment measurements to a set of rechit measurements
178  conversionPassed = filter()->transform(finalCandidate, hitContainer, firstTSOS);
179  } else {
180  //---- transforms set of segment measurements to a set of segment measurements
181  conversionPassed = filter()->transformLight(finalCandidate, hitContainer, firstTSOS);
182  }
183  if (conversionPassed && !finalCandidate.empty() && !hitContainer.empty()) {
184  //---- doesn't work...
185  //output->push_back( theSeedFinder.makeSeed(firstTSOS, hitContainer) );
186 
187  edm::OwnVector<TrackingRecHit> recHitsContainer;
188  for (unsigned int iHit = 0; iHit < hitContainer.size(); ++iHit) {
189  recHitsContainer.push_back(hitContainer.at(iHit)->hit()->clone());
190  }
193  dir = alongMomentum; // why forward (for rechits) later?
194  }
195 
196  PTrajectoryStateOnDet seedTSOS =
197  trajectoryStateTransform::persistentState(firstTSOS, hitContainer.at(0)->geographicalId().rawId());
198  TrajectorySeed seed(seedTSOS, recHitsContainer, dir);
199 
200  //MuonPatternRecoDumper debug;
201  //std::cout<<" firstTSOS (not IP) = "<<debug.dumpTSOS(firstTSOS)<<std::endl;
202  //std::cout<<" hits(from range) = "<<range.second-range.first<<" hits (from size) = "<<hitContainer.size()<<std::endl;
203  //for(unsigned int iRH=0;iRH<hitContainer.size();++iRH){
204  //std::cout<<" RH = "<<iRH+1<<" globPos = "<<hitContainer.at(iRH)->globalPosition()<<std::endl;
205  //}
206  output->push_back(seed);
207  } else {
208  //std::cout<<" Transformation from TrajectoryMeasurements to RecHitContainer faild - skip "<<std::endl;
209  continue;
210  }
211  } else {
212  //std::cout<<" Not enough (as defined) measurements to build trajectory - skip"<<std::endl;
213  continue;
214  }
215  }
216  event.put(std::move(output));
217  theFilter->reset();
218 }

References alongMomentum, apply_prePruning, pwdgSkimBPark_cfi::beamSpot, beamspotToken, SETFilter::buildTrajectoryMeasurements(), debug, DeadROC_duringRun::dir, SETSeedFinder::fillSeedCandidates(), filter(), SETSeedFinder::findAllValidSets(), SETFilter::fwfit_SET(), edm::HandleBase::isValid(), SETFilter::layers(), SETSeedFinder::limitCombinatorics(), LogTrace, metname, eostools::move(), oppositeToMomentum, convertSQLitetoXML_cfg::output, trajectoryStateTransform::persistentState(), SETPatternRecognition::produce(), edm::OwnVector< T, P >::push_back(), SETFilter::reset(), SurveyInfoScenario_cff::seed, InitialStep_cff::seeds, MuonSeedVFinder::setBeamSpot(), setEvent(), SETSeedFinder::sortByLayer(), theFilter, thePatternRecognition, theSeedFinder, theService, SETFilter::transform(), SETFilter::transformLight(), useSegmentsInTrajectory, and SETSeedFinder::validSetsPrePruning().

◆ setEvent()

void SETMuonSeedProducer::setEvent ( const edm::Event event)
private

Definition at line 221 of file SETMuonSeedProducer.cc.

221 { theFilter->setEvent(event); }

References SETFilter::setEvent(), and theFilter.

Referenced by produce().

Member Data Documentation

◆ apply_prePruning

bool SETMuonSeedProducer::apply_prePruning
private

Definition at line 58 of file SETMuonSeedProducer.h.

Referenced by produce(), and SETMuonSeedProducer().

◆ beamspotToken

edm::EDGetTokenT<reco::BeamSpot> SETMuonSeedProducer::beamspotToken
private

Definition at line 66 of file SETMuonSeedProducer.h.

Referenced by produce(), and SETMuonSeedProducer().

◆ theBeamSpotTag

edm::InputTag SETMuonSeedProducer::theBeamSpotTag
private

Definition at line 65 of file SETMuonSeedProducer.h.

Referenced by SETMuonSeedProducer().

◆ theFilter

SETFilter* SETMuonSeedProducer::theFilter
private

◆ thePatternRecognition

SETPatternRecognition* SETMuonSeedProducer::thePatternRecognition
private

Definition at line 62 of file SETMuonSeedProducer.h.

Referenced by produce(), SETMuonSeedProducer(), and ~SETMuonSeedProducer().

◆ theSeedFinder

SETSeedFinder SETMuonSeedProducer::theSeedFinder
private

Definition at line 63 of file SETMuonSeedProducer.h.

Referenced by produce(), and SETMuonSeedProducer().

◆ theService

MuonServiceProxy* SETMuonSeedProducer::theService
private

Definition at line 60 of file SETMuonSeedProducer.h.

Referenced by produce(), SETMuonSeedProducer(), and ~SETMuonSeedProducer().

◆ useSegmentsInTrajectory

bool SETMuonSeedProducer::useSegmentsInTrajectory
private

Definition at line 59 of file SETMuonSeedProducer.h.

Referenced by produce(), and SETMuonSeedProducer().

Vector3DBase
Definition: Vector3DBase.h:8
SETFilter
Definition: SETFilter.h:52
SETSeedFinder::validSetsPrePruning
void validSetsPrePruning(std::vector< MuonRecHitContainer > &allValidSets)
Definition: SETSeedFinder.cc:306
SETFilter::setEvent
virtual void setEvent(const edm::Event &event)
Pass the Event to the algo at each event.
Definition: SETFilter.cc:60
SETSeedFinder::setServiceProxy
void setServiceProxy(MuonServiceProxy *service)
Definition: SETSeedFinder.h:29
SETSeedFinder::findAllValidSets
std::vector< MuonRecHitContainer > findAllValidSets(const std::vector< MuonRecHitContainer > &MuonRecHitContainer_perLayer)
Definition: SETSeedFinder.cc:146
pwdgSkimBPark_cfi.beamSpot
beamSpot
Definition: pwdgSkimBPark_cfi.py:5
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:32
SETMuonSeedProducer::theBeamSpotTag
edm::InputTag theBeamSpotTag
Definition: SETMuonSeedProducer.h:65
trajectoryStateTransform::persistentState
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
Definition: TrajectoryStateTransform.cc:14
SETSeedFinder::sortByLayer
std::vector< MuonRecHitContainer > sortByLayer(MuonRecHitContainer &cluster) const
Definition: SETSeedFinder.cc:45
edm::LogInfo
Definition: MessageLogger.h:254
SETFilter::transform
bool transform(Trajectory::DataContainer &measurements_segments, TransientTrackingRecHit::ConstRecHitContainer &hitContainer, TrajectoryStateOnSurface &firstTSOS)
transforms "segment trajectory" to "rechit container"
Definition: SETFilter.cc:158
SETMuonSeedProducer::setEvent
void setEvent(const edm::Event &)
Definition: SETMuonSeedProducer.cc:221
oppositeToMomentum
Definition: PropagationDirection.h:4
SETMuonSeedProducer::useSegmentsInTrajectory
bool useSegmentsInTrajectory
Definition: SETMuonSeedProducer.h:59
SETMuonSeedProducer::theService
MuonServiceProxy * theService
Definition: SETMuonSeedProducer.h:60
edm::Handle
Definition: AssociativeIterator.h:50
edm::ParameterSet::addUntrackedParameter
void addUntrackedParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:181
SeedCandidate
Definition: SETFilter.h:33
MuonServiceProxy_cff.MuonServiceProxy
MuonServiceProxy
Definition: MuonServiceProxy_cff.py:15
SETMuonSeedProducer::apply_prePruning
bool apply_prePruning
Definition: SETMuonSeedProducer.h:58
SETPatternRecognition::setServiceProxy
void setServiceProxy(MuonServiceProxy *service)
Definition: SETPatternRecognition.h:22
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
debug
#define debug
Definition: HDRShower.cc:19
MuonPatternRecoDumper
Definition: MuonPatternRecoDumper.h:18
Trajectory::DataContainer
std::vector< TrajectoryMeasurement > DataContainer
Definition: Trajectory.h:40
reco::BeamSpot
Definition: BeamSpot.h:21
SETFilter::reset
void reset()
Definition: SETFilter.cc:62
SETMuonSeedProducer::theSeedFinder
SETSeedFinder theSeedFinder
Definition: SETMuonSeedProducer.h:63
InitialStep_cff.seeds
seeds
Definition: InitialStep_cff.py:232
SETFilter::buildTrajectoryMeasurements
bool buildTrajectoryMeasurements(SeedCandidate *validSegmentsSet, Trajectory::DataContainer &finalCandidate)
from SeedCandidate to DataContainer only
Definition: SETFilter.cc:124
edm::ParameterSet
Definition: ParameterSet.h:36
SETFilter::fwfit_SET
bool fwfit_SET(std::vector< SeedCandidate > &validSegmentsSet_in, std::vector< SeedCandidate > &validSegmentsSet_out)
Perform the SET inner-outward fitting.
Definition: SETFilter.cc:89
TrackingRecHit::ConstRecHitContainer
std::vector< ConstRecHitPointer > ConstRecHitContainer
Definition: TrackingRecHit.h:32
SETSeedFinder::fillSeedCandidates
std::vector< SeedCandidate > fillSeedCandidates(std::vector< MuonRecHitContainer > &allValidSets)
Definition: SETSeedFinder.cc:404
SETPatternRecognition
Definition: SETPatternRecognition.h:13
MuonSeedVFinder::setBeamSpot
void setBeamSpot(const GlobalVector &gv)
Definition: MuonSeedVFinder.h:27
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
SETMuonSeedProducer::filter
SETFilter * filter() const
pre-filter
Definition: SETMuonSeedProducer.h:48
SETPatternRecognition::produce
void produce(const edm::Event &event, const edm::EventSetup &eSetup, std::vector< MuonRecHitContainer > &result) override
Definition: SETPatternRecognition.cc:40
eostools.move
def move(src, dest)
Definition: eostools.py:511
SETMuonSeedProducer::theFilter
SETFilter * theFilter
Definition: SETMuonSeedProducer.h:54
SETMuonSeedProducer::beamspotToken
edm::EDGetTokenT< reco::BeamSpot > beamspotToken
Definition: SETMuonSeedProducer.h:66
PropagationDirection
PropagationDirection
Definition: PropagationDirection.h:4
edm::parameterSet
ParameterSet const & parameterSet(Provenance const &provenance, ProcessHistory const &history)
Definition: Provenance.cc:11
TrajectorySeed
Definition: TrajectorySeed.h:17
edm::OwnVector::push_back
void push_back(D *&d)
Definition: OwnVector.h:326
SETSeedFinder::limitCombinatorics
void limitCombinatorics(std::vector< MuonRecHitContainer > &MuonRecHitContainer_perLayer)
Definition: SETSeedFinder.cc:110
SETMuonSeedProducer::thePatternRecognition
SETPatternRecognition * thePatternRecognition
Definition: SETMuonSeedProducer.h:62
SETFilter::layers
std::vector< const DetLayer * > layers() const
return the layer used for the refit
Definition: SETFilter.h:100
SETFilter::transformLight
bool transformLight(Trajectory::DataContainer &measurements_segments, TransientTrackingRecHit::ConstRecHitContainer &hitContainer, TrajectoryStateOnSurface &firstTSOS)
transforms "segment trajectory" to "segment container"
Definition: SETFilter.cc:207
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:671
PTrajectoryStateOnDet
Definition: PTrajectoryStateOnDet.h:10
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
event
Definition: event.py:1
edm::InputTag
Definition: InputTag.h:15
edm::ConsumesCollector
Definition: ConsumesCollector.h:39
alongMomentum
Definition: PropagationDirection.h:4
SurveyInfoScenario_cff.seed
seed
Definition: SurveyInfoScenario_cff.py:295
edm::OwnVector< TrackingRecHit >
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23
metname
const std::string metname
Definition: MuonSeedOrcaPatternRecognition.cc:43