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