CMS 3D CMS Logo

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  //Calo RecHit
29  IT_HBHErh = iConfig.getParameter<edm::InputTag>("HBHErhLabel");
30  IT_ECALBrh= iConfig.getParameter<edm::InputTag>("ECALBrhLabel");
31  IT_ECALErh= iConfig.getParameter<edm::InputTag>("ECALErhLabel");
32  //Higher Level Reco
33  IT_CSCSegment = iConfig.getParameter<edm::InputTag>("CSCSegmentLabel");
34  IT_CosmicMuon = iConfig.getParameter<edm::InputTag>("CosmicMuonLabel");
35  IT_Muon = iConfig.getParameter<edm::InputTag>("MuonLabel");
36  IT_SA = iConfig.getParameter<edm::InputTag>("SALabel");
37  IT_ALCT = iConfig.getParameter<edm::InputTag>("ALCTDigiLabel");
38 
39  //Muon to Segment Matching
40  edm::ParameterSet matchParameters = iConfig.getParameter<edm::ParameterSet>("MatchParameters");
41  edm::ConsumesCollector iC = consumesCollector();
42  TheMatcher = new MuonSegmentMatcher(matchParameters, iC);
43 
44  // Cosmic track selection parameters
45  CSCAlgo.SetDetaThreshold( (float) iConfig.getParameter<double>("DetaParam"));
46  CSCAlgo.SetDphiThreshold( (float) iConfig.getParameter<double>("DphiParam"));
47  CSCAlgo.SetMinMaxInnerRadius( (float) iConfig.getParameter<double>("InnerRMinParam") , (float) iConfig.getParameter<double>("InnerRMaxParam") );
48  CSCAlgo.SetMinMaxOuterRadius( (float) iConfig.getParameter<double>("OuterRMinParam"), (float) iConfig.getParameter<double>("OuterRMaxParam"));
49  CSCAlgo.SetNormChi2Threshold( (float) iConfig.getParameter<double>("NormChi2Param") );
50 
51  // MLR
52  CSCAlgo.SetMaxSegmentRDiff( (float) iConfig.getParameter<double>("MaxSegmentRDiff") );
53  CSCAlgo.SetMaxSegmentPhiDiff( (float) iConfig.getParameter<double>("MaxSegmentPhiDiff") );
54  CSCAlgo.SetMaxSegmentTheta( (float) iConfig.getParameter<double>("MaxSegmentTheta") );
55  // End MLR
56 
57  CSCAlgo.SetMaxDtMuonSegment( (float) iConfig.getParameter<double>("MaxDtMuonSegment") );
58  CSCAlgo.SetMaxFreeInverseBeta( (float) iConfig.getParameter<double>("MaxFreeInverseBeta") );
59  CSCAlgo.SetExpectedBX( (short int) iConfig.getParameter<int>("ExpectedBX") );
60  CSCAlgo.SetRecHitTime0( (float) iConfig.getParameter<double>("RecHitTime0") );
61  CSCAlgo.SetRecHitTimeWindow( (float) iConfig.getParameter<double>("RecHitTimeWindow") );
62  CSCAlgo.SetMinMaxOuterMomentumTheta( (float)iConfig.getParameter<double>("MinOuterMomentumTheta"), (float)iConfig.getParameter<double>("MaxOuterMomentumTheta") );
63  CSCAlgo.SetMatchingDPhiThreshold( (float)iConfig.getParameter<double>("MatchingDPhiThreshold") );
64  CSCAlgo.SetMatchingDEtaThreshold( (float)iConfig.getParameter<double>("MatchingDEtaThreshold") );
65  CSCAlgo.SetMatchingDWireThreshold(iConfig.getParameter<int>("MatchingDWireThreshold") );
66 
67  cosmicmuon_token_ = consumes<reco::MuonCollection>(IT_CosmicMuon);
68  csctimemap_token_ = consumes<reco::MuonTimeExtraMap>(edm::InputTag(IT_CosmicMuon.label(), "csc"));
69  muon_token_ = consumes<reco::MuonCollection>(IT_Muon);
70  cscsegment_token_ = consumes<CSCSegmentCollection>(IT_CSCSegment);
71  cscrechit_token_ = consumes<CSCRecHit2DCollection>(IT_CSCRecHit);
72  cscalct_token_ = consumes<CSCALCTDigiCollection>(IT_ALCT);
73  l1mugmtro_token_ = consumes<L1MuGMTReadoutCollection>(IT_L1MuGMTReadout);
74  hbhereco_token_ = consumes<HBHERecHitCollection>(IT_HBHErh);
75  EcalRecHitsEB_token_ = consumes<EcalRecHitCollection>(IT_ECALBrh);
76  EcalRecHitsEE_token_ = consumes<EcalRecHitCollection>(IT_ECALErh);
77  hltresult_token_ = consumes<edm::TriggerResults>(IT_HLTResult);
78 
79  produces<CSCHaloData>();
80 }
81 
82 void CSCHaloDataProducer::produce(Event& iEvent, const EventSetup& iSetup)
83 {
84  //Get CSC Geometry
85  edm::ESHandle<CSCGeometry> TheCSCGeometry;
86  iSetup.get<MuonGeometryRecord>().get(TheCSCGeometry);
87 
88  //Get Muons Collection from Cosmic Reconstruction
90  // iEvent.getByLabel(IT_CosmicMuon, TheCosmics);
91  iEvent.getByToken(cosmicmuon_token_, TheCosmics);
92 
93  //Get Muon Time Information from Cosmic Reconstruction
95  // iEvent.getByLabel(IT_CosmicMuon.label(),"csc",TheCSCTimeMap);
96  iEvent.getByToken(csctimemap_token_, TheCSCTimeMap);
97 
98  //Collision Muon Collection
100  // iEvent.getByLabel(IT_Muon, TheMuons);
101  iEvent.getByToken(muon_token_, TheMuons);
102 
103  //Get CSC Segments
104  edm::Handle<CSCSegmentCollection> TheCSCSegments;
105  // iEvent.getByLabel(IT_CSCSegment, TheCSCSegments);
106  iEvent.getByToken(cscsegment_token_, TheCSCSegments);
107 
108  //Get CSC RecHits
109  Handle<CSCRecHit2DCollection> TheCSCRecHits;
110  // iEvent.getByLabel(IT_CSCRecHit, TheCSCRecHits);
111  iEvent.getByToken(cscrechit_token_, TheCSCRecHits);
112 
113  //Get L1MuGMT
115  // iEvent.getByLabel (IT_L1MuGMTReadout, TheL1GMTReadout);
116  iEvent.getByToken(l1mugmtro_token_, TheL1GMTReadout);
117 
118  //Get Chamber Anode Trigger Information
120  // iEvent.getByLabel (IT_ALCT, TheALCTs);
121  iEvent.getByToken(cscalct_token_, TheALCTs);
122 
123  //Calo rec hits
125  iEvent.getByToken(hbhereco_token_,hbhehits);
126  Handle<EcalRecHitCollection> ecalebhits;
127  iEvent.getByToken(EcalRecHitsEB_token_, ecalebhits);
128  Handle<EcalRecHitCollection> ecaleehits;
129  iEvent.getByToken(EcalRecHitsEE_token_,ecaleehits);
130 
131  //Get HLT Results
132  edm::Handle<edm::TriggerResults> TheHLTResults;
133  // iEvent.getByLabel( IT_HLTResult , TheHLTResults);
134  iEvent.getByToken(hltresult_token_, TheHLTResults);
135 
136  const edm::TriggerNames * triggerNames = 0;
137  if (TheHLTResults.isValid()) {
138  triggerNames = &iEvent.triggerNames(*TheHLTResults);
139  }
140 
141 
142  // Put it in the event
143  iEvent.put(std::make_unique<CSCHaloData>(CSCAlgo.Calculate(*TheCSCGeometry, TheCosmics, TheCSCTimeMap, TheMuons, TheCSCSegments, TheCSCRecHits, TheL1GMTReadout, hbhehits,ecalebhits,ecaleehits,TheHLTResults, triggerNames, TheALCTs, TheMatcher, iEvent, iSetup)));
144  return;
145 }
146 
147 CSCHaloDataProducer::~CSCHaloDataProducer(){}
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
int iEvent
Definition: GenABIO.cc:230
bool isValid() const
Definition: HandleBase.h:74
const T & get() const
Definition: EventSetup.h:56
std::string const & label() const
Definition: InputTag.h:36
fixed size matrix
HLT enums.
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
Definition: Event.cc:239