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