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  //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 serviceParameters = iConfig.getParameter<edm::ParameterSet>("ServiceParameters");
41  TheService = new MuonServiceProxy(serviceParameters);
42  edm::ParameterSet matchParameters = iConfig.getParameter<edm::ParameterSet>("MatchParameters");
43  edm::ConsumesCollector iC = consumesCollector();
44  TheMatcher = new MuonSegmentMatcher(matchParameters, TheService,iC);
45 
46  // Cosmic track selection parameters
47  CSCAlgo.SetDetaThreshold( (float) iConfig.getParameter<double>("DetaParam"));
48  CSCAlgo.SetDphiThreshold( (float) iConfig.getParameter<double>("DphiParam"));
49  CSCAlgo.SetMinMaxInnerRadius( (float) iConfig.getParameter<double>("InnerRMinParam") , (float) iConfig.getParameter<double>("InnerRMaxParam") );
50  CSCAlgo.SetMinMaxOuterRadius( (float) iConfig.getParameter<double>("OuterRMinParam"), (float) iConfig.getParameter<double>("OuterRMaxParam"));
51  CSCAlgo.SetNormChi2Threshold( (float) iConfig.getParameter<double>("NormChi2Param") );
52 
53  // MLR
54  CSCAlgo.SetMaxSegmentRDiff( (float) iConfig.getParameter<double>("MaxSegmentRDiff") );
55  CSCAlgo.SetMaxSegmentPhiDiff( (float) iConfig.getParameter<double>("MaxSegmentPhiDiff") );
56  CSCAlgo.SetMaxSegmentTheta( (float) iConfig.getParameter<double>("MaxSegmentTheta") );
57  // End MLR
58 
59  CSCAlgo.SetMaxDtMuonSegment( (float) iConfig.getParameter<double>("MaxDtMuonSegment") );
60  CSCAlgo.SetMaxFreeInverseBeta( (float) iConfig.getParameter<double>("MaxFreeInverseBeta") );
61  CSCAlgo.SetExpectedBX( (short int) iConfig.getParameter<int>("ExpectedBX") );
62  CSCAlgo.SetRecHitTime0( (float) iConfig.getParameter<double>("RecHitTime0") );
63  CSCAlgo.SetRecHitTimeWindow( (float) iConfig.getParameter<double>("RecHitTimeWindow") );
64  CSCAlgo.SetMinMaxOuterMomentumTheta( (float)iConfig.getParameter<double>("MinOuterMomentumTheta"), (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 {
86  //Get CSC Geometry
87  edm::ESHandle<CSCGeometry> TheCSCGeometry;
88  iSetup.get<MuonGeometryRecord>().get(TheCSCGeometry);
89 
90  //Get Muons Collection from Cosmic Reconstruction
92  // iEvent.getByLabel(IT_CosmicMuon, TheCosmics);
93  iEvent.getByToken(cosmicmuon_token_, TheCosmics);
94 
95  //Get Muon Time Information from Cosmic Reconstruction
97  // iEvent.getByLabel(IT_CosmicMuon.label(),"csc",TheCSCTimeMap);
98  iEvent.getByToken(csctimemap_token_, TheCSCTimeMap);
99 
100  //Collision Muon Collection
102  // iEvent.getByLabel(IT_Muon, TheMuons);
103  iEvent.getByToken(muon_token_, TheMuons);
104 
105  //Get CSC Segments
106  edm::Handle<CSCSegmentCollection> TheCSCSegments;
107  // iEvent.getByLabel(IT_CSCSegment, TheCSCSegments);
108  iEvent.getByToken(cscsegment_token_, TheCSCSegments);
109 
110  //Get CSC RecHits
111  Handle<CSCRecHit2DCollection> TheCSCRecHits;
112  // iEvent.getByLabel(IT_CSCRecHit, TheCSCRecHits);
113  iEvent.getByToken(cscrechit_token_, TheCSCRecHits);
114 
115  //Get L1MuGMT
117  // iEvent.getByLabel (IT_L1MuGMTReadout, TheL1GMTReadout);
118  iEvent.getByToken(l1mugmtro_token_, TheL1GMTReadout);
119 
120  //Get Chamber Anode Trigger Information
122  // iEvent.getByLabel (IT_ALCT, TheALCTs);
123  iEvent.getByToken(cscalct_token_, TheALCTs);
124 
125  //Calo rec hits
127  iEvent.getByToken(hbhereco_token_,hbhehits);
128  Handle<EcalRecHitCollection> ecalebhits;
129  iEvent.getByToken(EcalRecHitsEB_token_, ecalebhits);// iEvent.getByToken("ecalRecHit","EcalRecHitsEB",ecalebhits);
130  Handle<EcalRecHitCollection> ecaleehits;
131  iEvent.getByToken(EcalRecHitsEE_token_,ecaleehits); // iEvent.getByToken("ecalRecHit","EcalRecHitsEE",ecaleehits);
132 
133 
134 
135  //Get HLT Results
136  edm::Handle<edm::TriggerResults> TheHLTResults;
137  // iEvent.getByLabel( IT_HLTResult , TheHLTResults);
138  iEvent.getByToken(hltresult_token_, TheHLTResults);
139 
140  const edm::TriggerNames * triggerNames = 0;
141  if (TheHLTResults.isValid()) {
142  triggerNames = &iEvent.triggerNames(*TheHLTResults);
143  }
144 
145  std::auto_ptr<CSCHaloData> TheCSCData(new CSCHaloData( CSCAlgo.Calculate(*TheCSCGeometry, TheCosmics, TheCSCTimeMap, TheMuons, TheCSCSegments, TheCSCRecHits, TheL1GMTReadout, hbhehits,ecalebhits,ecaleehits,TheHLTResults, triggerNames, TheALCTs, TheMatcher, iEvent, iSetup) ) );
146  // Put it in the event
147  iEvent.put(TheCSCData);
148  return;
149 }
150 
151 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