CMS 3D CMS Logo

GlobalHaloDataProducer.cc
Go to the documentation of this file.
3 
4 /*
5  [class]: GlobalHaloDataProducer
6  [authors]: R. Remington, The University of Florida
7  [description]: See GlobalHaloDataProducer.h
8  [date]: October 15, 2009
9 */
10 
11 using namespace edm;
12 using namespace std;
13 using namespace reco;
14 
15 GlobalHaloDataProducer::GlobalHaloDataProducer(const edm::ParameterSet& iConfig) {
16  ishlt = iConfig.getParameter<bool>("IsHLT");
17 
18  //Higher Level Reco
19  IT_met = iConfig.getParameter<edm::InputTag>("metLabel");
20  IT_CaloTower = iConfig.getParameter<edm::InputTag>("calotowerLabel");
21  IT_CSCSegment = iConfig.getParameter<edm::InputTag>("CSCSegmentLabel");
22  IT_CSCRecHit = iConfig.getParameter<edm::InputTag>("CSCRecHitLabel");
23  IT_Muon = iConfig.getParameter<edm::InputTag>("MuonLabel");
24  //Halo Data from Sub-detectors
25  IT_CSCHaloData = iConfig.getParameter<edm::InputTag>("CSCHaloDataLabel");
26  IT_EcalHaloData = iConfig.getParameter<edm::InputTag>("EcalHaloDataLabel");
27  IT_HcalHaloData = iConfig.getParameter<edm::InputTag>("HcalHaloDataLabel");
28 
29  EcalMinMatchingRadius = (float)iConfig.getParameter<double>("EcalMinMatchingRadiusParam");
30  EcalMaxMatchingRadius = (float)iConfig.getParameter<double>("EcalMaxMatchingRadiusParam");
31  HcalMinMatchingRadius = (float)iConfig.getParameter<double>("HcalMinMatchingRadiusParam");
32  HcalMaxMatchingRadius = (float)iConfig.getParameter<double>("HcalMaxMatchingRadiusParam");
33  CaloTowerEtThreshold = (float)iConfig.getParameter<double>("CaloTowerEtThresholdParam");
34 
35  //Parameters for CSC-calo matching
36  //Flat segment theta condition:
37  GlobalAlgo.SetMaxSegmentTheta((float)iConfig.getParameter<double>("MaxSegmentTheta"));
38  //EB
39  GlobalAlgo.setEtThresholdforCSCCaloMatchingEB((float)iConfig.getParameter<double>("rh_et_threshforcscmatching_eb"));
40  GlobalAlgo.setRcaloMinRsegmLowThresholdforCSCCaloMatchingEB(
41  (float)iConfig.getParameter<double>("rcalominrsegm_lowthresh_eb"));
42  GlobalAlgo.setRcaloMinRsegmHighThresholdforCSCCaloMatchingEB(
43  (float)iConfig.getParameter<double>("rcalominrsegm_highthresh_eb"));
44  GlobalAlgo.setDtcalosegmThresholdforCSCCaloMatchingEB((float)iConfig.getParameter<double>("dtcalosegm_thresh_eb"));
45  GlobalAlgo.setDPhicalosegmThresholdforCSCCaloMatchingEB(
46  (float)iConfig.getParameter<double>("dphicalosegm_thresh_eb"));
47  //EE
48  GlobalAlgo.setEtThresholdforCSCCaloMatchingEE((float)iConfig.getParameter<double>("rh_et_threshforcscmatching_ee"));
49  GlobalAlgo.setRcaloMinRsegmLowThresholdforCSCCaloMatchingEE(
50  (float)iConfig.getParameter<double>("rcalominrsegm_lowthresh_ee"));
51  GlobalAlgo.setRcaloMinRsegmHighThresholdforCSCCaloMatchingEE(
52  (float)iConfig.getParameter<double>("rcalominrsegm_highthresh_ee"));
53  GlobalAlgo.setDtcalosegmThresholdforCSCCaloMatchingEE((float)iConfig.getParameter<double>("dtcalosegm_thresh_ee"));
54  GlobalAlgo.setDPhicalosegmThresholdforCSCCaloMatchingEE(
55  (float)iConfig.getParameter<double>("dphicalosegm_thresh_ee"));
56  //HB
57  GlobalAlgo.setEtThresholdforCSCCaloMatchingHB((float)iConfig.getParameter<double>("rh_et_threshforcscmatching_hb"));
58  GlobalAlgo.setRcaloMinRsegmLowThresholdforCSCCaloMatchingHB(
59  (float)iConfig.getParameter<double>("rcalominrsegm_lowthresh_hb"));
60  GlobalAlgo.setRcaloMinRsegmHighThresholdforCSCCaloMatchingHB(
61  (float)iConfig.getParameter<double>("rcalominrsegm_highthresh_hb"));
62  GlobalAlgo.setDtcalosegmThresholdforCSCCaloMatchingHB((float)iConfig.getParameter<double>("dtcalosegm_thresh_hb"));
63  GlobalAlgo.setDPhicalosegmThresholdforCSCCaloMatchingHB(
64  (float)iConfig.getParameter<double>("dphicalosegm_thresh_hb"));
65  //HE
66  GlobalAlgo.setEtThresholdforCSCCaloMatchingHE((float)iConfig.getParameter<double>("rh_et_threshforcscmatching_he"));
67  GlobalAlgo.setRcaloMinRsegmLowThresholdforCSCCaloMatchingHE(
68  (float)iConfig.getParameter<double>("rcalominrsegm_lowthresh_he"));
69  GlobalAlgo.setRcaloMinRsegmHighThresholdforCSCCaloMatchingHE(
70  (float)iConfig.getParameter<double>("rcalominrsegm_highthresh_he"));
71  GlobalAlgo.setDtcalosegmThresholdforCSCCaloMatchingHE((float)iConfig.getParameter<double>("dtcalosegm_thresh_he"));
72  GlobalAlgo.setDPhicalosegmThresholdforCSCCaloMatchingHE(
73  (float)iConfig.getParameter<double>("dphicalosegm_thresh_he"));
74 
75  calotower_token_ = consumes<edm::View<Candidate> >(IT_CaloTower);
76  calomet_token_ = consumes<reco::CaloMETCollection>(IT_met);
77  cscsegment_token_ = consumes<CSCSegmentCollection>(IT_CSCSegment);
78  cscrechit_token_ = consumes<CSCRecHit2DCollection>(IT_CSCRecHit);
79  muon_token_ = consumes<reco::MuonCollection>(IT_Muon);
80  cschalo_token_ = consumes<CSCHaloData>(IT_CSCHaloData);
81  ecalhalo_token_ = consumes<EcalHaloData>(IT_EcalHaloData);
82  hcalhalo_token_ = consumes<HcalHaloData>(IT_HcalHaloData);
83 
84  produces<GlobalHaloData>();
85 }
86 
87 void GlobalHaloDataProducer::produce(Event& iEvent, const EventSetup& iSetup) {
88  //Get CSC Geometry
89  edm::ESHandle<CSCGeometry> TheCSCGeometry;
90  iSetup.get<MuonGeometryRecord>().get(TheCSCGeometry);
91 
92  //Get Global Tracking Geometry
93  edm::ESHandle<GlobalTrackingGeometry> TheGlobalTrackingGeometry;
94  iSetup.get<GlobalTrackingGeometryRecord>().get(TheGlobalTrackingGeometry);
95 
96  //Get CaloGeometry
97  edm::ESHandle<CaloGeometry> TheCaloGeometry;
98  iSetup.get<CaloGeometryRecord>().get(TheCaloGeometry);
99 
100  //Get CaloTowers
101  edm::Handle<edm::View<Candidate> > TheCaloTowers;
102  // iEvent.getByLabel(IT_CaloTower,TheCaloTowers);
103  iEvent.getByToken(calotower_token_, TheCaloTowers);
104 
105  //Get MET
107  // iEvent.getByLabel(IT_met, TheCaloMET);
108  iEvent.getByToken(calomet_token_, TheCaloMET);
109 
110  //Get CSCSegments
111  edm::Handle<CSCSegmentCollection> TheCSCSegments;
112  // iEvent.getByLabel(IT_CSCSegment, TheCSCSegments);
113  iEvent.getByToken(cscsegment_token_, TheCSCSegments);
114 
115  //Get CSCRecHits
117  // iEvent.getByLabel(IT_CSCRecHit, TheCSCRecHits );
118  iEvent.getByToken(cscrechit_token_, TheCSCRecHits);
119 
120  //Collision Muon Collection
122  iEvent.getByToken(muon_token_, TheMuons);
123 
124  //Get CSCHaloData
125  edm::Handle<reco::CSCHaloData> TheCSCHaloData;
126  // iEvent.getByLabel(IT_CSCHaloData, TheCSCHaloData );
127  iEvent.getByToken(cschalo_token_, TheCSCHaloData);
128 
129  // Get EcalHaloData
130  edm::Handle<reco::EcalHaloData> TheEcalHaloData;
131  // iEvent.getByLabel(IT_EcalHaloData, TheEcalHaloData );
132  iEvent.getByToken(ecalhalo_token_, TheEcalHaloData);
133 
134  // Get HcalHaloData
135  edm::Handle<reco::HcalHaloData> TheHcalHaloData;
136  // iEvent.getByLabel(IT_HcalHaloData, TheHcalHaloData );
137  iEvent.getByToken(hcalhalo_token_, TheHcalHaloData);
138 
139  // Run the GlobalHaloAlgo to reconstruct the GlobalHaloData object
140  GlobalAlgo.SetEcalMatchingRadius(EcalMinMatchingRadius, EcalMaxMatchingRadius);
141  GlobalAlgo.SetHcalMatchingRadius(HcalMinMatchingRadius, HcalMaxMatchingRadius);
142  GlobalAlgo.SetCaloTowerEtThreshold(CaloTowerEtThreshold);
143  // GlobalHaloData GlobalData;
144 
145  if (TheCaloGeometry.isValid() && TheCaloMET.isValid() && TheCaloTowers.isValid() && TheCSCHaloData.isValid() &&
146  TheEcalHaloData.isValid() && TheHcalHaloData.isValid()) {
147  iEvent.put(std::make_unique<GlobalHaloData>(GlobalHaloData(GlobalAlgo.Calculate(*TheCaloGeometry,
148  *TheCSCGeometry,
149  *(&TheCaloMET.product()->front()),
150  TheCaloTowers,
151  TheCSCSegments,
152  TheCSCRecHits,
153  TheMuons,
154  *TheCSCHaloData.product(),
155  *TheEcalHaloData.product(),
156  *TheHcalHaloData.product(),
157  ishlt))));
158  } else {
159  iEvent.put(std::make_unique<GlobalHaloData>());
160  }
161 
162  return;
163 }
164 
165 GlobalHaloDataProducer::~GlobalHaloDataProducer() {}
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
T const * product() const
Definition: Handle.h:69
fixed size matrix
HLT enums.
T get() const
Definition: EventSetup.h:73
bool isValid() const
Definition: ESHandle.h:44