CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CSCHaloDataProducer.cc
Go to the documentation of this file.
4 
5 /*
6  [class]: CSCHaloDataProducer
7  [authors]: R. Remington, The University of Florida
8  [description]: See CSCHaloDataProducer.h
9  [date]: October 15, 2009
10 */
11 
12 using namespace edm;
13 using namespace std;
14 using namespace reco;
15 
16 CSCHaloDataProducer::CSCHaloDataProducer(const edm::ParameterSet& iConfig)
17 {
18  //Digi Level
19  IT_L1MuGMTReadout = iConfig.getParameter<edm::InputTag>("L1MuGMTReadoutLabel");
20 
21  //HLT Level
22  IT_HLTResult = iConfig.getParameter<edm::InputTag>("HLTResultLabel");
23  CSCAlgo.vIT_HLTBit = iConfig.getParameter< std::vector< edm::InputTag> >("HLTBitLabel");
24 
25  //RecHit Level
26  IT_CSCRecHit = iConfig.getParameter<edm::InputTag>("CSCRecHitLabel");
27 
28  //Higher Level Reco
29  IT_CSCSegment = iConfig.getParameter<edm::InputTag>("CSCSegmentLabel");
30  IT_CosmicMuon = iConfig.getParameter<edm::InputTag>("CosmicMuonLabel");
31  IT_Muon = iConfig.getParameter<edm::InputTag>("MuonLabel");
32  IT_SA = iConfig.getParameter<edm::InputTag>("SALabel");
33  IT_ALCT = iConfig.getParameter<edm::InputTag>("ALCTDigiLabel");
34 
35  //Muon to Segment Matching
36  edm::ParameterSet serviceParameters = iConfig.getParameter<edm::ParameterSet>("ServiceParameters");
37  TheService = new MuonServiceProxy(serviceParameters);
38  edm::ParameterSet matchParameters = iConfig.getParameter<edm::ParameterSet>("MatchParameters");
39  edm::ConsumesCollector iC = consumesCollector();
40  TheMatcher = new MuonSegmentMatcher(matchParameters, TheService,iC);
41 
42  // Cosmic track selection parameters
43  CSCAlgo.SetDetaThreshold( (float) iConfig.getParameter<double>("DetaParam"));
44  CSCAlgo.SetDphiThreshold( (float) iConfig.getParameter<double>("DphiParam"));
45  CSCAlgo.SetMinMaxInnerRadius( (float) iConfig.getParameter<double>("InnerRMinParam") , (float) iConfig.getParameter<double>("InnerRMaxParam") );
46  CSCAlgo.SetMinMaxOuterRadius( (float) iConfig.getParameter<double>("OuterRMinParam"), (float) iConfig.getParameter<double>("OuterRMaxParam"));
47  CSCAlgo.SetNormChi2Threshold( (float) iConfig.getParameter<double>("NormChi2Param") );
48 
49  // MLR
50  CSCAlgo.SetMaxSegmentRDiff( (float) iConfig.getParameter<double>("MaxSegmentRDiff") );
51  CSCAlgo.SetMaxSegmentPhiDiff( (float) iConfig.getParameter<double>("MaxSegmentPhiDiff") );
52  CSCAlgo.SetMaxSegmentTheta( (float) iConfig.getParameter<double>("MaxSegmentTheta") );
53  // End MLR
54 
55  CSCAlgo.SetMaxDtMuonSegment( (float) iConfig.getParameter<double>("MaxDtMuonSegment") );
56  CSCAlgo.SetMaxFreeInverseBeta( (float) iConfig.getParameter<double>("MaxFreeInverseBeta") );
57  CSCAlgo.SetExpectedBX( (short int) iConfig.getParameter<int>("ExpectedBX") );
58  CSCAlgo.SetRecHitTime0( (float) iConfig.getParameter<double>("RecHitTime0") );
59  CSCAlgo.SetRecHitTimeWindow( (float) iConfig.getParameter<double>("RecHitTimeWindow") );
60  CSCAlgo.SetMinMaxOuterMomentumTheta( (float)iConfig.getParameter<double>("MinOuterMomentumTheta"), (float)iConfig.getParameter<double>("MaxOuterMomentumTheta") );
61  CSCAlgo.SetMatchingDPhiThreshold( (float)iConfig.getParameter<double>("MatchingDPhiThreshold") );
62  CSCAlgo.SetMatchingDEtaThreshold( (float)iConfig.getParameter<double>("MatchingDEtaThreshold") );
63  CSCAlgo.SetMatchingDWireThreshold(iConfig.getParameter<int>("MatchingDWireThreshold") );
64 
65  cosmicmuon_token_ = consumes<reco::MuonCollection>(IT_CosmicMuon);
66  csctimemap_token_ = consumes<reco::MuonTimeExtraMap>(edm::InputTag(IT_CosmicMuon.label(), "csc"));
67  muon_token_ = consumes<reco::MuonCollection>(IT_Muon);
68  cscsegment_token_ = consumes<CSCSegmentCollection>(IT_CSCSegment);
69  cscrechit_token_ = consumes<CSCRecHit2DCollection>(IT_CSCRecHit);
70  cscalct_token_ = consumes<CSCALCTDigiCollection>(IT_ALCT);
71  l1mugmtro_token_ = consumes<L1MuGMTReadoutCollection>(IT_L1MuGMTReadout);
72  hltresult_token_ = consumes<edm::TriggerResults>(IT_HLTResult);
73 
74  produces<CSCHaloData>();
75 }
76 
77 void CSCHaloDataProducer::produce(Event& iEvent, const EventSetup& iSetup)
78 {
79  //Get CSC Geometry
80  edm::ESHandle<CSCGeometry> TheCSCGeometry;
81  iSetup.get<MuonGeometryRecord>().get(TheCSCGeometry);
82 
83  //Get Muons Collection from Cosmic Reconstruction
85  // iEvent.getByLabel(IT_CosmicMuon, TheCosmics);
86  iEvent.getByToken(cosmicmuon_token_, TheCosmics);
87 
88  //Get Muon Time Information from Cosmic Reconstruction
90  // iEvent.getByLabel(IT_CosmicMuon.label(),"csc",TheCSCTimeMap);
91  iEvent.getByToken(csctimemap_token_, TheCSCTimeMap);
92 
93  //Collision Muon Collection
95  // iEvent.getByLabel(IT_Muon, TheMuons);
96  iEvent.getByToken(muon_token_, TheMuons);
97 
98  //Get CSC Segments
99  edm::Handle<CSCSegmentCollection> TheCSCSegments;
100  // iEvent.getByLabel(IT_CSCSegment, TheCSCSegments);
101  iEvent.getByToken(cscsegment_token_, TheCSCSegments);
102 
103  //Get CSC RecHits
104  Handle<CSCRecHit2DCollection> TheCSCRecHits;
105  // iEvent.getByLabel(IT_CSCRecHit, TheCSCRecHits);
106  iEvent.getByToken(cscrechit_token_, TheCSCRecHits);
107 
108  //Get L1MuGMT
110  // iEvent.getByLabel (IT_L1MuGMTReadout, TheL1GMTReadout);
111  iEvent.getByToken(l1mugmtro_token_, TheL1GMTReadout);
112 
113  //Get Chamber Anode Trigger Information
115  // iEvent.getByLabel (IT_ALCT, TheALCTs);
116  iEvent.getByToken(cscalct_token_, TheALCTs);
117 
118  //Get HLT Results
119  edm::Handle<edm::TriggerResults> TheHLTResults;
120  // iEvent.getByLabel( IT_HLTResult , TheHLTResults);
121  iEvent.getByToken(hltresult_token_, TheHLTResults);
122 
123  const edm::TriggerNames * triggerNames = 0;
124  if (TheHLTResults.isValid()) {
125  triggerNames = &iEvent.triggerNames(*TheHLTResults);
126  }
127 
128  std::auto_ptr<CSCHaloData> TheCSCData(new CSCHaloData( CSCAlgo.Calculate(*TheCSCGeometry, TheCosmics, TheCSCTimeMap, TheMuons, TheCSCSegments, TheCSCRecHits, TheL1GMTReadout, TheHLTResults, triggerNames, TheALCTs, TheMatcher, iEvent) ) );
129  // Put it in the event
130  iEvent.put(TheCSCData);
131  return;
132 }
133 
134 CSCHaloDataProducer::~CSCHaloDataProducer(){}
T getParameter(std::string const &) const
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
Definition: Event.cc:213
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
int iEvent
Definition: GenABIO.cc:230
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:115
bool isValid() const
Definition: HandleBase.h:75
const T & get() const
Definition: EventSetup.h:55
std::string const & label() const
Definition: InputTag.h:43