CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GlobalHaloDataProducer.cc
Go to the documentation of this file.
2 
3 /*
4  [class]: GlobalHaloDataProducer
5  [authors]: R. Remington, The University of Florida
6  [description]: See GlobalHaloDataProducer.h
7  [date]: October 15, 2009
8 */
9 
10 using namespace edm;
11 using namespace std;
12 using namespace reco;
13 
14 GlobalHaloDataProducer::GlobalHaloDataProducer(const edm::ParameterSet& iConfig)
15 {
16  //Higher Level Reco
17  IT_met = iConfig.getParameter<edm::InputTag>("metLabel");
18  IT_CaloTower = iConfig.getParameter<edm::InputTag>("calotowerLabel");
19  IT_CSCSegment = iConfig.getParameter<edm::InputTag>("CSCSegmentLabel");
20  IT_CSCRecHit = iConfig.getParameter<edm::InputTag>("CSCRecHitLabel");
21 
22  //Halo Data from Sub-detectors
23  IT_CSCHaloData = iConfig.getParameter<edm::InputTag>("CSCHaloDataLabel");
24  IT_EcalHaloData = iConfig.getParameter<edm::InputTag> ("EcalHaloDataLabel");
25  IT_HcalHaloData = iConfig.getParameter<edm::InputTag> ("HcalHaloDataLabel");
26 
27  EcalMinMatchingRadius = (float)iConfig.getParameter<double>("EcalMinMatchingRadiusParam");
28  EcalMaxMatchingRadius = (float)iConfig.getParameter<double>("EcalMaxMatchingRadiusParam");
29  HcalMinMatchingRadius = (float)iConfig.getParameter<double>("HcalMinMatchingRadiusParam");
30  HcalMaxMatchingRadius = (float)iConfig.getParameter<double>("HcalMaxMatchingRadiusParam");
31  CaloTowerEtThreshold = (float)iConfig.getParameter<double>("CaloTowerEtThresholdParam");
32 
33  produces<GlobalHaloData>();
34 }
35 
36 void GlobalHaloDataProducer::produce(Event& iEvent, const EventSetup& iSetup)
37 {
38  //Get CSC Geometry
39  edm::ESHandle<CSCGeometry> TheCSCGeometry;
40  iSetup.get<MuonGeometryRecord>().get(TheCSCGeometry);
41 
42  //Get Global Tracking Geometry
43  edm::ESHandle<GlobalTrackingGeometry> TheGlobalTrackingGeometry;
44  iSetup.get<GlobalTrackingGeometryRecord>().get(TheGlobalTrackingGeometry);
45 
46  //Get CaloGeometry
47  edm::ESHandle<CaloGeometry> TheCaloGeometry;
48  iSetup.get<CaloGeometryRecord>().get(TheCaloGeometry);
49 
50  //Get CaloTowers
51  edm::Handle<edm::View<Candidate> > TheCaloTowers;
52  iEvent.getByLabel(IT_CaloTower,TheCaloTowers);
53 
54  //Get MET
56  iEvent.getByLabel(IT_met, TheCaloMET);
57 
58  //Get CSCSegments
59  edm::Handle<CSCSegmentCollection> TheCSCSegments;
60  iEvent.getByLabel(IT_CSCSegment, TheCSCSegments);
61 
62  //Get CSCRecHits
64  iEvent.getByLabel(IT_CSCRecHit, TheCSCRecHits );
65 
66  //Get CSCHaloData
67  edm::Handle<reco::CSCHaloData> TheCSCHaloData;
68  iEvent.getByLabel(IT_CSCHaloData, TheCSCHaloData );
69 
70  // Get EcalHaloData
71  edm::Handle<reco::EcalHaloData> TheEcalHaloData;
72  iEvent.getByLabel(IT_EcalHaloData, TheEcalHaloData );
73 
74  // Get HcalHaloData
75  edm::Handle<reco::HcalHaloData> TheHcalHaloData;
76  iEvent.getByLabel(IT_HcalHaloData, TheHcalHaloData );
77 
78  // Run the GlobalHaloAlgo to reconstruct the GlobalHaloData object
79  GlobalHaloAlgo GlobalAlgo;
80  GlobalAlgo.SetEcalMatchingRadius(EcalMinMatchingRadius,EcalMaxMatchingRadius);
81  GlobalAlgo.SetHcalMatchingRadius(HcalMinMatchingRadius,HcalMaxMatchingRadius);
82  GlobalAlgo.SetCaloTowerEtThreshold(CaloTowerEtThreshold);
83  // GlobalHaloData GlobalData;
84 
85  if(TheCaloGeometry.isValid() && TheCaloMET.isValid() && TheCaloTowers.isValid() && TheCSCHaloData.isValid() && TheEcalHaloData.isValid() && TheHcalHaloData.isValid() )
86  {
87  std::auto_ptr<GlobalHaloData> GlobalData( new GlobalHaloData(GlobalAlgo.Calculate(*TheCaloGeometry, *TheCSCGeometry, *(&TheCaloMET.product()->front()), TheCaloTowers, TheCSCSegments, TheCSCRecHits, *TheCSCHaloData.product(), *TheEcalHaloData.product(), *TheHcalHaloData.product() )) );
88  iEvent.put(GlobalData);
89  }
90  else
91  {
92  std::auto_ptr<GlobalHaloData> GlobalData( new GlobalHaloData() ) ;
93  iEvent.put(GlobalData);
94  }
95 
96  return;
97 }
98 
100 void GlobalHaloDataProducer::endJob(){return;}
101 void GlobalHaloDataProducer::beginRun(edm::Run&, const edm::EventSetup&){return;}
102 void GlobalHaloDataProducer::endRun(edm::Run&, const edm::EventSetup&){return;}
103 GlobalHaloDataProducer::~GlobalHaloDataProducer(){}
T getParameter(std::string const &) const
reco::GlobalHaloData Calculate(const CaloGeometry &TheCaloGeometry, const CSCGeometry &TheCSCGeometry, const reco::CaloMET &TheCaloMET, edm::Handle< edm::View< reco::Candidate > > &TheCaloTowers, edm::Handle< CSCSegmentCollection > &TheCSCSegments, edm::Handle< CSCRecHit2DCollection > &TheCSCRecHits, const reco::CSCHaloData &TheCSCHaloData, const reco::EcalHaloData &TheEcalHaloData, const reco::HcalHaloData &TheHcalHaloData)
void SetHcalMatchingRadius(float min, float max)
void beginJob()
Definition: Breakpoints.cc:15
int iEvent
Definition: GenABIO.cc:243
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
void SetEcalMatchingRadius(float min, float max)
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: Handle.h:74
void SetCaloTowerEtThreshold(float EtMin)
bool isValid() const
Definition: ESHandle.h:37
Definition: Run.h:33