CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

typedef
MuonTransientTrackingRecHit::MuonRecHitContainer 
MuonRecHitContainer
 
typedef std::vector< Trajectory * > TrajectoryContainer
 
- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 

Public Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &)
 
 SETMuonSeedProducer (const edm::ParameterSet &)
 Constructor with Parameter set. More...
 
virtual ~SETMuonSeedProducer ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

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

Private Attributes

bool apply_prePruning
 
edm::InputTag theBeamSpotTag
 
SETFiltertheFilter
 
SETPatternRecognition thePatternRecognition
 
SETSeedFinder theSeedFinder
 
MuonServiceProxytheService
 
bool useSegmentsInTrajectory
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

I. Bloch, E. James, S. Stoynev

Definition at line 29 of file SETMuonSeedProducer.h.

Member Typedef Documentation

Definition at line 32 of file SETMuonSeedProducer.h.

Definition at line 33 of file SETMuonSeedProducer.h.

Constructor & Destructor Documentation

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

Constructor with Parameter set.

Definition at line 31 of file SETMuonSeedProducer.cc.

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

32 : thePatternRecognition(parameterSet),
33  theSeedFinder(parameterSet),
34  theBeamSpotTag(parameterSet.getParameter<edm::InputTag>("beamSpotTag"))
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);
42  theSeedFinder.setServiceProxy(theService);
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  produces<TrajectorySeedCollection>();
60 
61 }
void setServiceProxy(MuonServiceProxy *service)
Definition: SETSeedFinder.h:32
SETSeedFinder theSeedFinder
T getParameter(std::string const &) const
const std::string metname
SETPatternRecognition thePatternRecognition
edm::InputTag theBeamSpotTag
void setServiceProxy(MuonServiceProxy *service)
#define LogTrace(id)
void addUntrackedParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:209
MuonServiceProxy * theService
SETMuonSeedProducer::~SETMuonSeedProducer ( )
virtual

Destructor.

Definition at line 63 of file SETMuonSeedProducer.cc.

References LogTrace, theFilter, and theService.

63  {
64 
65  LogTrace("Muon|RecoMuon|SETMuonSeedProducer")
66  << "SETMuonSeedProducer destructor called" << endl;
67 
68  if(theFilter) delete theFilter;
69  if (theService) delete theService;
70 }
#define LogTrace(id)
MuonServiceProxy * theService

Member Function Documentation

SETFilter* SETMuonSeedProducer::filter ( ) const
inlineprivate

pre-filter

Definition at line 50 of file SETMuonSeedProducer.h.

References theFilter.

Referenced by produce().

50 {return theFilter;}
void SETMuonSeedProducer::produce ( edm::Event event,
const edm::EventSetup eventSetup 
)
virtual

Implements edm::EDProducer.

Definition at line 72 of file SETMuonSeedProducer.cc.

References alongMomentum, apply_prePruning, SiPixelRawToDigiRegional_cfi::beamSpot, SETFilter::buildTrajectoryMeasurements(), debug, dir, MuonPatternRecoDumper::dumpLayer(), SETSeedFinder::fillSeedCandidates(), filter(), SETSeedFinder::findAllValidSets(), SETFilter::fwfit_SET(), edm::HandleBase::isValid(), SETFilter::layers(), SETSeedFinder::limitCombinatorics(), LogTrace, metname, oppositeToMomentum, convertSQLitetoXML_cfg::output, trajectoryStateTransform::persistentState(), SETPatternRecognition::produce(), edm::OwnVector< T, P >::push_back(), SETFilter::reset(), MuonSeedVFinder::setBeamSpot(), setEvent(), SETSeedFinder::sortByLayer(), theBeamSpotTag, theFilter, thePatternRecognition, theSeedFinder, theService, SETFilter::transform(), SETFilter::transformLight(), useSegmentsInTrajectory, SETSeedFinder::validSetsPrePruning(), reco::BeamSpot::x0(), reco::BeamSpot::y0(), and reco::BeamSpot::z0().

72  {
73  //std::cout<<" start producing..."<<std::endl;
74  const string metname = "Muon|RecoMuon|SETMuonSeedSeed";
75 
77 
78  //Get the CSC Geometry :
79  theService->update(eventSetup);
80 
81  std::auto_ptr<TrajectorySeedCollection> output(new TrajectorySeedCollection());
82 
84 
85  setEvent(event);
86 
88  edm::Handle<reco::BeamSpot> beamSpotHandle;
89  event.getByLabel(theBeamSpotTag, beamSpotHandle);
90  if ( beamSpotHandle.isValid() )
91  {
92  beamSpot = *beamSpotHandle;
93 
94  } else
95  {
96  edm::LogInfo("MuonSeedGenerator")
97  << "No beam spot available from EventSetup \n";
98  }
99 
100  // make it a vector so we can subtract it from position vectors
101  GlobalVector gv(beamSpot.x0(), beamSpot.y0(), beamSpot.z0());
103 
104  bool fwFitFailed = true;
105 
106  std::vector <SeedCandidate> seedCandidates_AllChosen;
107  std::vector< MuonRecHitContainer > MuonRecHitContainer_clusters;
108  //---- this is "clustering"; later a trajectory can not use hits from different clusters
109  thePatternRecognition.produce(event, eventSetup, MuonRecHitContainer_clusters);
110 
111  //std::cout<<"We have formed "<<MuonRecHitContainer_clusters.size()<<" clusters"<<std::endl;
112  //---- for each cluster,
113  for(unsigned int cluster = 0; cluster < MuonRecHitContainer_clusters.size(); ++cluster) {
114  //std::cout<<" This is cluster number : "<<cluster<<std::endl;
115  std::vector <SeedCandidate> seedCandidates_inCluster;
116  //---- group hits in detector layers (if in same layer); the idea is that
117  //---- some hits could not belong to a track simultaneously - these will be in a
118  //---- group; two hits from one and the same group will not go to the same track
119  std::vector< MuonRecHitContainer > MuonRecHitContainer_perLayer = 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().size() )
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  }
180  else{
181  //---- transforms set of segment measurements to a set of segment measurements
182  conversionPassed = filter()->transformLight(finalCandidate, hitContainer, firstTSOS);
183  }
184  if ( conversionPassed && !finalCandidate.empty() && !hitContainer.empty()) {
185  //---- doesn't work...
186  //output->push_back( theSeedFinder.makeSeed(firstTSOS, hitContainer) );
187 
188  edm::OwnVector<TrackingRecHit> recHitsContainer;
189  for(unsigned int iHit = 0;iHit < hitContainer.size();++iHit){
190  recHitsContainer.push_back(hitContainer.at(iHit)->hit()->clone());
191  }
194  dir = alongMomentum;// why forward (for rechits) later?
195  }
196 
197  PTrajectoryStateOnDet seedTSOS =
198  trajectoryStateTransform::persistentState( firstTSOS, hitContainer.at(0)->geographicalId().rawId());
199  TrajectorySeed seed(seedTSOS,recHitsContainer,dir);
200 
201  //MuonPatternRecoDumper debug;
202  //std::cout<<" firstTSOS (not IP) = "<<debug.dumpTSOS(firstTSOS)<<std::endl;
203  //std::cout<<" hits(from range) = "<<range.second-range.first<<" hits (from size) = "<<hitContainer.size()<<std::endl;
204  //for(unsigned int iRH=0;iRH<hitContainer.size();++iRH){
205  //std::cout<<" RH = "<<iRH+1<<" globPos = "<<hitContainer.at(iRH)->globalPosition()<<std::endl;
206  //}
207  output->push_back(seed);
208  }
209  else{
210  //std::cout<<" Transformation from TrajectoryMeasurements to RecHitContainer faild - skip "<<std::endl;
211  continue;
212  }
213  }else{
214  //std::cout<<" Not enough (as defined) measurements to build trajectory - skip"<<std::endl;
215  continue;
216  }
217  }
218  event.put(output);
219  theFilter->reset();
220 }
SETSeedFinder theSeedFinder
void setBeamSpot(const GlobalVector &gv)
bool transform(Trajectory::DataContainer &measurements_segments, TransientTrackingRecHit::ConstRecHitContainer &hitContainer, TrajectoryStateOnSurface &firstTSOS)
transforms &quot;segment trajectory&quot; to &quot;rechit container&quot;
Definition: SETFilter.cc:166
double z0() const
z coordinate
Definition: BeamSpot.h:69
bool transformLight(Trajectory::DataContainer &measurements_segments, TransientTrackingRecHit::ConstRecHitContainer &hitContainer, TrajectoryStateOnSurface &firstTSOS)
transforms &quot;segment trajectory&quot; to &quot;segment container&quot;
Definition: SETFilter.cc:214
std::string dumpLayer(const DetLayer *layer) const
const std::string metname
void reset()
Definition: SETFilter.cc:68
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
bool buildTrajectoryMeasurements(SeedCandidate *validSegmentsSet, Trajectory::DataContainer &finalCandidate)
from SeedCandidate to DataContainer only
Definition: SETFilter.cc:132
PropagationDirection
std::vector< MuonRecHitContainer > sortByLayer(MuonRecHitContainer &cluster) const
std::vector< const DetLayer * > layers() const
return the layer used for the refit
Definition: SETFilter.h:104
SETPatternRecognition thePatternRecognition
void push_back(D *&d)
Definition: OwnVector.h:273
std::vector< TrajectoryMeasurement > DataContainer
Definition: Trajectory.h:42
bool fwfit_SET(std::vector< SeedCandidate > &validSegmentsSet_in, std::vector< SeedCandidate > &validSegmentsSet_out)
Perform the SET inner-outward fitting.
Definition: SETFilter.cc:97
std::vector< TrajectorySeed > TrajectorySeedCollection
edm::InputTag theBeamSpotTag
bool isValid() const
Definition: HandleBase.h:76
#define LogTrace(id)
std::vector< ConstRecHitPointer > ConstRecHitContainer
void limitCombinatorics(std::vector< MuonRecHitContainer > &MuonRecHitContainer_perLayer)
void setEvent(const edm::Event &)
std::vector< MuonRecHitContainer > findAllValidSets(const std::vector< MuonRecHitContainer > &MuonRecHitContainer_perLayer)
MuonServiceProxy * theService
virtual void produce(const edm::Event &event, const edm::EventSetup &eSetup, std::vector< MuonRecHitContainer > &result)
void validSetsPrePruning(std::vector< MuonRecHitContainer > &allValidSets)
double y0() const
y coordinate
Definition: BeamSpot.h:67
dbl *** dir
Definition: mlp_gen.cc:35
std::vector< SeedCandidate > fillSeedCandidates(std::vector< MuonRecHitContainer > &allValidSets)
#define debug
Definition: MEtoEDMFormat.h:34
SETFilter * filter() const
pre-filter
double x0() const
x coordinate
Definition: BeamSpot.h:65
void SETMuonSeedProducer::setEvent ( const edm::Event event)
private

Definition at line 223 of file SETMuonSeedProducer.cc.

References SETFilter::setEvent(), and theFilter.

Referenced by produce().

223  {
224  theFilter->setEvent(event);
225 }
virtual void setEvent(const edm::Event &event)
Pass the Event to the algo at each event.
Definition: SETFilter.cc:65

Member Data Documentation

bool SETMuonSeedProducer::apply_prePruning
private

Definition at line 60 of file SETMuonSeedProducer.h.

Referenced by produce(), and SETMuonSeedProducer().

edm::InputTag SETMuonSeedProducer::theBeamSpotTag
private

Definition at line 67 of file SETMuonSeedProducer.h.

Referenced by produce().

SETFilter* SETMuonSeedProducer::theFilter
private
SETPatternRecognition SETMuonSeedProducer::thePatternRecognition
private

Definition at line 64 of file SETMuonSeedProducer.h.

Referenced by produce(), and SETMuonSeedProducer().

SETSeedFinder SETMuonSeedProducer::theSeedFinder
private

Definition at line 65 of file SETMuonSeedProducer.h.

Referenced by produce(), and SETMuonSeedProducer().

MuonServiceProxy* SETMuonSeedProducer::theService
private

Definition at line 62 of file SETMuonSeedProducer.h.

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

bool SETMuonSeedProducer::useSegmentsInTrajectory
private

Definition at line 61 of file SETMuonSeedProducer.h.

Referenced by produce(), and SETMuonSeedProducer().