CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
BeamHaloAnalyzer.cc
Go to the documentation of this file.
3 //author : Ronny Remington, University of Florida
4 //date : 11/11/09
5 
6 using namespace edm;
7 using namespace reco;
8 
9 int Phi_To_iPhi(float phi) {
10  phi = phi < 0 ? phi + 2. * TMath::Pi() : phi;
11  float phi_degrees = phi * (360.) / (2. * TMath::Pi());
12  int iPhi = (int)((phi_degrees / 5.) + 1.);
13 
14  return iPhi < 73 ? iPhi : 73;
15 }
16 
18  OutputFileName = iConfig.getParameter<std::string>("OutputFile");
19  TextFileName = iConfig.getParameter<std::string>("TextFile");
20 
21  if (!TextFileName.empty())
22  out = new std::ofstream(TextFileName.c_str());
23 
24  if (iConfig.exists(
25  "StandardDQM")) // If StandardDQM == true , coarse binning is used on selected (important) histograms
26  StandardDQM = iConfig.getParameter<bool>("StandardDQM");
27  else
28  StandardDQM = false;
29 
30  //Get Input Tags
31  //Digi Level
32  IT_L1MuGMTReadout = iConfig.getParameter<edm::InputTag>("L1MuGMTReadoutLabel");
33 
34  //RecHit Level
35  IT_CSCRecHit = consumes<CSCRecHit2DCollection>(iConfig.getParameter<edm::InputTag>("CSCRecHitLabel"));
36  IT_EBRecHit = consumes<EBRecHitCollection>(iConfig.getParameter<edm::InputTag>("EBRecHitLabel"));
37  IT_EERecHit = consumes<EERecHitCollection>(iConfig.getParameter<edm::InputTag>("EERecHitLabel"));
38  IT_ESRecHit = consumes<ESRecHitCollection>(iConfig.getParameter<edm::InputTag>("ESRecHitLabel"));
39  IT_HBHERecHit = consumes<HBHERecHitCollection>(iConfig.getParameter<edm::InputTag>("HBHERecHitLabel"));
40  IT_HFRecHit = consumes<HFRecHitCollection>(iConfig.getParameter<edm::InputTag>("HFRecHitLabel"));
41  IT_HORecHit = consumes<HORecHitCollection>(iConfig.getParameter<edm::InputTag>("HORecHitLabel"));
42 
43  //Higher Level Reco
44  IT_CSCSegment = consumes<CSCSegmentCollection>(iConfig.getParameter<edm::InputTag>("CSCSegmentLabel"));
45  IT_CosmicStandAloneMuon =
46  consumes<reco::MuonCollection>(iConfig.getParameter<edm::InputTag>("CosmicStandAloneMuonLabel"));
47  IT_BeamHaloMuon = consumes<reco::MuonCollection>(iConfig.getParameter<edm::InputTag>("BeamHaloMuonLabel"));
48  IT_CollisionMuon = consumes<reco::MuonCollection>(iConfig.getParameter<edm::InputTag>("CollisionMuonLabel"));
49  IT_CollisionStandAloneMuon =
50  consumes<reco::MuonCollection>(iConfig.getParameter<edm::InputTag>("CollisionStandAloneMuonLabel"));
51  IT_met = consumes<reco::CaloMETCollection>(iConfig.getParameter<edm::InputTag>("metLabel"));
52  IT_CaloTower = consumes<edm::View<reco::Candidate> >(iConfig.getParameter<edm::InputTag>("CaloTowerLabel"));
53  IT_SuperCluster = consumes<SuperClusterCollection>(iConfig.getParameter<edm::InputTag>("SuperClusterLabel"));
54  IT_Photon = consumes<reco::PhotonCollection>(iConfig.getParameter<edm::InputTag>("PhotonLabel"));
55 
56  //Halo Data
57  IT_CSCHaloData = consumes<reco::CSCHaloData>(iConfig.getParameter<edm::InputTag>("CSCHaloDataLabel"));
58  IT_EcalHaloData = consumes<reco::EcalHaloData>(iConfig.getParameter<edm::InputTag>("EcalHaloDataLabel"));
59  IT_HcalHaloData = consumes<reco::HcalHaloData>(iConfig.getParameter<edm::InputTag>("HcalHaloDataLabel"));
60  IT_GlobalHaloData = consumes<reco::GlobalHaloData>(iConfig.getParameter<edm::InputTag>("GlobalHaloDataLabel"));
61  IT_BeamHaloSummary = consumes<BeamHaloSummary>(iConfig.getParameter<edm::InputTag>("BeamHaloSummaryLabel"));
62 
63  cscGeomToken_ = esConsumes();
64 
65  edm::InputTag CosmicSAMuonLabel = iConfig.getParameter<edm::InputTag>("CosmicStandAloneMuonLabel");
66  IT_CSCTimeMapToken = consumes<reco::MuonTimeExtraMap>(edm::InputTag(CosmicSAMuonLabel.label(), std::string("csc")));
67  FolderName = iConfig.getParameter<std::string>("folderName");
68  DumpMET = iConfig.getParameter<double>("DumpMET");
69 
70  //Muon to Segment Matching
71  edm::ParameterSet matchParameters = iConfig.getParameter<edm::ParameterSet>("MatchParameters");
72  edm::ConsumesCollector iC = consumesCollector();
73  TheMatcher = new MuonSegmentMatcher(matchParameters, iC);
74 }
75 
77  // EcalHaloData
78  ibooker.setCurrentFolder(FolderName + "/EcalHaloData");
79  if (StandardDQM) {
80  hEcalHaloData_PhiWedgeMultiplicity = ibooker.book1D("EcalHaloData_PhiWedgeMultiplicity", "", 20, -0.5, 19.5);
81  hEcalHaloData_PhiWedgeConstituents = ibooker.book1D("EcalHaloData_PhiWedgeConstituents", "", 20, -0.5, 19.5);
82  // hEcalHaloData_PhiWedgeiPhi = ibooker.book1D("EcalHaloData_PhiWedgeiPhi","", 360, 0.5, 360.5) ;
83  hEcalHaloData_PhiWedgeZDirectionConfidence =
84  ibooker.book1D("EcalHaloData_ZDirectionConfidence", "", 120, -1.2, 1.2);
85  hEcalHaloData_SuperClusterShowerShapes =
86  ibooker.book2D("EcalHaloData_SuperClusterShowerShapes", "", 30, 0, 3.2, 25, 0.0, 2.0);
87  hEcalHaloData_SuperClusterEnergy = ibooker.book1D("EcalHaloData_SuperClusterEnergy", "", 50, -0.5, 99.5);
88  hEcalHaloData_SuperClusterNHits = ibooker.book1D("EcalHaloData_SuperClusterNHits", "", 20, -0.5, 19.5);
89  } else {
90  hEcalHaloData_PhiWedgeMultiplicity = ibooker.book1D("EcalHaloData_PhiWedgeMultiplicity", "", 20, -0.5, 19.5);
91  hEcalHaloData_PhiWedgeEnergy = ibooker.book1D("EcalHaloData_PhiWedgeEnergy", "", 50, -0.5, 199.5);
92  hEcalHaloData_PhiWedgeConstituents = ibooker.book1D("EcalHaloData_PhiWedgeConstituents", "", 20, -0.5, 19.5);
93  hEcalHaloData_PhiWedgeMinTime = ibooker.book1D("EcalHaloData_PhiWedgeMinTime", "", 100, -225.0, 225.0);
94  hEcalHaloData_PhiWedgeMaxTime = ibooker.book1D("EcalHaloData_PhiWedgeMaxTime", "", 100, -225.0, 225.0);
95  hEcalHaloData_PhiWedgeiPhi = ibooker.book1D("EcalHaloData_PhiWedgeiPhi", "", 360, 0.5, 360.5);
96  hEcalHaloData_PhiWedgePlusZDirectionConfidence =
97  ibooker.book1D("EcalHaloData_PlusZDirectionConfidence", "", 50, 0., 1.0);
98  hEcalHaloData_PhiWedgeZDirectionConfidence =
99  ibooker.book1D("EcalHaloData_ZDirectionConfidence", "", 120, -1.2, 1.2);
100  hEcalHaloData_PhiWedgeMinVsMaxTime =
101  ibooker.book2D("EcalHaloData_PhiWedgeMinVsMaxTime", "", 50, -100.0, 100.0, 50, -100.0, 100.0);
102  hEcalHaloData_SuperClusterShowerShapes =
103  ibooker.book2D("EcalHaloData_SuperClusterShowerShapes", "", 30, 0, 3.2, 25, 0.0, 2.0);
104  hEcalHaloData_SuperClusterEnergy = ibooker.book1D("EcalHaloData_SuperClusterEnergy", "", 100, -0.5, 99.5);
105  hEcalHaloData_SuperClusterNHits = ibooker.book1D("EcalHaloData_SuperClusterNHits", "", 20, -0.5, 19.5);
106  hEcalHaloData_SuperClusterPhiVsEta =
107  ibooker.book2D("EcalHaloData_SuperClusterPhiVsEta", "", 60, -3.0, 3.0, 60, -3.2, 3.2);
108  }
109 
110  // HcalHaloData
111  ibooker.setCurrentFolder(FolderName + "/HcalHaloData");
112  if (StandardDQM) {
113  hHcalHaloData_PhiWedgeMultiplicity = ibooker.book1D("HcalHaloData_PhiWedgeMultiplicity", "", 20, -0.5, 19.5);
114  hHcalHaloData_PhiWedgeConstituents = ibooker.book1D("HcalHaloData_PhiWedgeConstituents", "", 20, -0.5, 19.5);
115  //hHcalHaloData_PhiWedgeiPhi = ibooker.book1D("HcalHaloData_PhiWedgeiPhi","", 72, 0.5,72.5);
116  hHcalHaloData_PhiWedgeZDirectionConfidence =
117  ibooker.book1D("HcalHaloData_ZDirectionConfidence", "", 120, -1.2, 1.2);
118  } else {
119  hHcalHaloData_PhiWedgeMultiplicity = ibooker.book1D("HcalHaloData_PhiWedgeMultiplicity", "", 20, -0.5, 19.5);
120  hHcalHaloData_PhiWedgeEnergy = ibooker.book1D("HcalHaloData_PhiWedgeEnergy", "", 50, -0.5, 199.5);
121  hHcalHaloData_PhiWedgeConstituents = ibooker.book1D("HcalHaloData_PhiWedgeConstituents", "", 20, -0.5, 19.5);
122  hHcalHaloData_PhiWedgeiPhi = ibooker.book1D("HcalHaloData_PhiWedgeiPhi", "", 72, 0.5, 72.5);
123  hHcalHaloData_PhiWedgeMinTime = ibooker.book1D("HcalHaloData_PhiWedgeMinTime", "", 50, -100.0, 100.0);
124  hHcalHaloData_PhiWedgeMaxTime = ibooker.book1D("HcalHaloData_PhiWedgeMaxTime", "", 50, -100.0, 100.0);
125  hHcalHaloData_PhiWedgePlusZDirectionConfidence =
126  ibooker.book1D("HcalHaloData_PlusZDirectionConfidence", "", 50, 0., 1.0);
127  hHcalHaloData_PhiWedgeZDirectionConfidence =
128  ibooker.book1D("HcalHaloData_ZDirectionConfidence", "", 120, -1.2, 1.2);
129  hHcalHaloData_PhiWedgeMinVsMaxTime =
130  ibooker.book2D("HcalHaloData_PhiWedgeMinVsMaxTime", "", 50, -100.0, 100.0, 50, -100.0, 100.0);
131  }
132 
133  // CSCHaloData
134  ibooker.setCurrentFolder(FolderName + "/CSCHaloData");
135  if (StandardDQM) {
136  hCSCHaloData_TrackMultiplicity = ibooker.book1D("CSCHaloData_TrackMultiplicity", "", 15, -0.5, 14.5);
137  hCSCHaloData_TrackMultiplicityMEPlus = ibooker.book1D("CSCHaloData_TrackMultiplicityMEPlus", "", 15, -0.5, 14.5);
138  hCSCHaloData_TrackMultiplicityMEMinus = ibooker.book1D("CSCHaloData_TrackMultiplicityMEMinus", "", 15, -0.5, 14.5);
139  hCSCHaloData_InnerMostTrackHitR = ibooker.book1D("CSCHaloData_InnerMostTrackHitR", "", 70, 99.5, 799.5);
140  hCSCHaloData_InnerMostTrackHitPhi = ibooker.book1D("CSCHaloData_InnerMostTrackHitPhi", "", 60, -3.2, 3.2);
141  hCSCHaloData_L1HaloTriggersMEPlus = ibooker.book1D("CSCHaloData_L1HaloTriggersMEPlus", "", 10, -0.5, 9.5);
142  hCSCHaloData_L1HaloTriggersMEMinus = ibooker.book1D("CSCHaloData_L1HaloTriggersMEMinus", "", 10, -0.5, 9.5);
143  hCSCHaloData_L1HaloTriggers = ibooker.book1D("CSCHaloData_L1HaloTriggers", "", 10, -0.5, 9.5);
144  hCSCHaloData_HLHaloTriggers = ibooker.book1D("CSCHaloData_HLHaloTriggers", "", 2, -0.5, 1.5);
145  hCSCHaloData_NOutOfTimeTriggersvsL1HaloExists =
146  ibooker.book2D("CSCHaloData_NOutOfTimeTriggersvsL1HaloExists", "", 20, -0.5, 19.5, 2, -0.5, 1.5);
147  hCSCHaloData_NOutOfTimeTriggersMEPlus = ibooker.book1D("CSCHaloData_NOutOfTimeTriggersMEPlus", "", 20, -0.5, 19.5);
148  hCSCHaloData_NOutOfTimeTriggersMEMinus =
149  ibooker.book1D("CSCHaloData_NOutOfTimeTriggersMEMinus", "", 20, -0.5, 19.5);
150  hCSCHaloData_NOutOfTimeTriggers = ibooker.book1D("CSCHaloData_NOutOfTimeTriggers", "", 20, -0.5, 19.5);
151  hCSCHaloData_NOutOfTimeHits = ibooker.book1D("CSCHaloData_NOutOfTimeHits", "", 60, -0.5, 59.5);
152  hCSCHaloData_NTracksSmalldT = ibooker.book1D("CSCHaloData_NTracksSmalldT", "", 15, -0.5, 14.5);
153  hCSCHaloData_NTracksSmallBeta = ibooker.book1D("CSCHaloData_NTracksSmallBeta", "", 15, -0.5, 14.5);
154  hCSCHaloData_NTracksSmallBetaAndSmalldT =
155  ibooker.book1D("CSCHaloData_NTracksSmallBetaAndSmalldT", "", 15, -0.5, 14.5);
156  hCSCHaloData_NTracksSmalldTvsNHaloTracks =
157  ibooker.book2D("CSCHaloData_NTracksSmalldTvsNHaloTracks", "", 15, -0.5, 14.5, 15, -0.5, 14.5);
158  hCSCHaloData_SegmentdT = ibooker.book1D("CSCHaloData_SegmentdT", "", 100, -100, 100);
159  hCSCHaloData_FreeInverseBeta = ibooker.book1D("CSCHaloData_FreeInverseBeta", "", 80, -4, 4);
160  hCSCHaloData_FreeInverseBetaVsSegmentdT =
161  ibooker.book2D("CSCHaloData_FreeInverseBetaVsSegmentdT", "", 100, -100, 100, 80, -4, 4);
162  // MLR
163  hCSCHaloData_NFlatHaloSegments = ibooker.book1D("CSCHaloData_NFlatHaloSegments", "", 20, 0, 20);
164  hCSCHaloData_SegmentsInBothEndcaps = ibooker.book1D("CSCHaloData_SegmentsInBothEndcaps", "", 2, 0, 2);
165  hCSCHaloData_NFlatSegmentsInBothEndcaps = ibooker.book1D("CSCHaloData_NFlatSegmentsInBothEndcaps", "", 20, 0, 20);
166  // End MLR
167  } else {
168  hCSCHaloData_TrackMultiplicity = ibooker.book1D("CSCHaloData_TrackMultiplicity", "", 15, -0.5, 14.5);
169  hCSCHaloData_TrackMultiplicityMEPlus = ibooker.book1D("CSCHaloData_TrackMultiplicityMEPlus", "", 15, -0.5, 14.5);
170  hCSCHaloData_TrackMultiplicityMEMinus = ibooker.book1D("CSCHaloData_TrackMultiplicityMEMinus", "", 15, -0.5, 14.5);
171  hCSCHaloData_InnerMostTrackHitXY =
172  ibooker.book2D("CSCHaloData_InnerMostTrackHitXY", "", 100, -700, 700, 100, -700, 700);
173  hCSCHaloData_InnerMostTrackHitR = ibooker.book1D("CSCHaloData_InnerMostTrackHitR", "", 400, -0.5, 799.5);
174  hCSCHaloData_InnerMostTrackHitRPlusZ =
175  ibooker.book2D("CSCHaloData_InnerMostTrackHitRPlusZ", "", 400, 400, 1200, 400, -0.5, 799.5);
176  hCSCHaloData_InnerMostTrackHitRMinusZ =
177  ibooker.book2D("CSCHaloData_InnerMostTrackHitRMinusZ", "", 400, -1200, -400, 400, -0.5, 799.5);
178  hCSCHaloData_InnerMostTrackHitiPhi = ibooker.book1D("CSCHaloData_InnerMostTrackHitiPhi", "", 72, 0.5, 72.5);
179  hCSCHaloData_InnerMostTrackHitPhi = ibooker.book1D("CSCHaloData_InnerMostTrackHitPhi", "", 60, -3.2, 3.2);
180  hCSCHaloData_L1HaloTriggersMEPlus = ibooker.book1D("CSCHaloData_L1HaloTriggersMEPlus", "", 10, -0.5, 9.5);
181  hCSCHaloData_L1HaloTriggersMEMinus = ibooker.book1D("CSCHaloData_L1HaloTriggersMEMinus", "", 10, -0.5, 9.5);
182  hCSCHaloData_L1HaloTriggers = ibooker.book1D("CSCHaloData_L1HaloTriggers", "", 10, -0.5, 9.5);
183  hCSCHaloData_HLHaloTriggers = ibooker.book1D("CSCHaloData_HLHaloTriggers", "", 2, -0.5, 1.5);
184  hCSCHaloData_NOutOfTimeTriggersvsL1HaloExists =
185  ibooker.book2D("CSCHaloData_NOutOfTimeTriggersvsL1HaloExists", "", 20, -0.5, 19.5, 2, -0.5, 1.5);
186  hCSCHaloData_NOutOfTimeTriggers = ibooker.book1D("CSCHaloData_NOutOfTimeTriggers", "", 20, -0.5, 19.5);
187  hCSCHaloData_NOutOfTimeHits = ibooker.book1D("CSCHaloData_NOutOfTimeHits", "", 60, -0.5, 59.5);
188  hCSCHaloData_NTracksSmalldT = ibooker.book1D("CSCHaloData_NTracksSmalldT", "", 15, -0.5, 14.5);
189  hCSCHaloData_NTracksSmallBeta = ibooker.book1D("CSCHaloData_NTracksSmallBeta", "", 15, -0.5, 14.5);
190  hCSCHaloData_NTracksSmallBetaAndSmalldT =
191  ibooker.book1D("CSCHaloData_NTracksSmallBetaAndSmalldT", "", 15, -0.5, 14.5);
192  hCSCHaloData_NTracksSmalldTvsNHaloTracks =
193  ibooker.book2D("CSCHaloData_NTracksSmalldTvsNHaloTracks", "", 15, -0.5, 14.5, 15, -0.5, 14.5);
194  hCSCHaloData_SegmentdT = ibooker.book1D("CSCHaloData_SegmentdT", "", 100, -100, 100);
195  hCSCHaloData_FreeInverseBeta = ibooker.book1D("CSCHaloData_FreeInverseBeta", "", 80, -4, 4);
196  hCSCHaloData_FreeInverseBetaVsSegmentdT =
197  ibooker.book2D("CSCHaloData_FreeInverseBetaVsSegmentdT", "", 100, -100, 100, 80, -4, 4);
198  // MLR
199  hCSCHaloData_NFlatHaloSegments = ibooker.book1D("CSCHaloData_NFlatHaloSegments", "", 20, 0, 20);
200  hCSCHaloData_SegmentsInBothEndcaps = ibooker.book1D("CSCHaloData_SegmentsInBothEndcaps", "", 2, 0, 2);
201  hCSCHaloData_NFlatSegmentsInBothEndcaps = ibooker.book1D("CSCHaloData_NFlatSegmentsInBothEndcaps", "", 20, 0, 20);
202  // End MLR
203  }
204 
205  // GlobalHaloData
206  ibooker.setCurrentFolder(FolderName + "/GlobalHaloData");
207  if (!StandardDQM) {
208  hGlobalHaloData_MExCorrection = ibooker.book1D("GlobalHaloData_MExCorrection", "", 200, -200., 200.);
209  hGlobalHaloData_MEyCorrection = ibooker.book1D("GlobalHaloData_MEyCorrection", "", 200, -200., 200.);
210  hGlobalHaloData_SumEtCorrection = ibooker.book1D("GlobalHaloData_SumEtCorrection", "", 200, -0.5, 399.5);
211  hGlobalHaloData_HaloCorrectedMET = ibooker.book1D("GlobalHaloData_HaloCorrectedMET", "", 500, -0.5, 1999.5);
212  hGlobalHaloData_RawMETMinusHaloCorrectedMET =
213  ibooker.book1D("GlobalHaloData_RawMETMinusHaloCorrectedMET", "", 250, -500., 500.);
214  hGlobalHaloData_RawMETOverSumEt = ibooker.book1D("GlobalHaloData_RawMETOverSumEt", "", 100, 0.0, 1.0);
215  hGlobalHaloData_MatchedHcalPhiWedgeMultiplicity =
216  ibooker.book1D("GlobalHaloData_MatchedHcalPhiWedgeMultiplicity", "", 15, -0.5, 14.5);
217  hGlobalHaloData_MatchedHcalPhiWedgeEnergy =
218  ibooker.book1D("GlobalHaloData_MatchedHcalPhiWedgeEnergy", "", 50, -0.5, 199.5);
219  hGlobalHaloData_MatchedHcalPhiWedgeConstituents =
220  ibooker.book1D("GlobalHaloData_MatchedHcalPhiWedgeConstituents", "", 20, -0.5, 19.5);
221  hGlobalHaloData_MatchedHcalPhiWedgeiPhi =
222  ibooker.book1D("GlobalHaloData_MatchedHcalPhiWedgeiPhi", "", 1, 0.5, 72.5);
223  hGlobalHaloData_MatchedHcalPhiWedgeMinTime =
224  ibooker.book1D("GlobalHaloData_MatchedHcalPhiWedgeMinTime", "", 50, -100.0, 100.0);
225  hGlobalHaloData_MatchedHcalPhiWedgeMaxTime =
226  ibooker.book1D("GlobalHaloData_MatchedHcalPhiWedgeMaxTime", "", 50, -100.0, 100.0);
227  hGlobalHaloData_MatchedHcalPhiWedgeZDirectionConfidence =
228  ibooker.book1D("GlobalHaloData_MatchedHcalPhiWedgeZDirectionConfidence", "", 120, -1.2, 1.2);
229  hGlobalHaloData_MatchedEcalPhiWedgeMultiplicity =
230  ibooker.book1D("GlobalHaloData_MatchedEcalPhiWedgeMultiplicity", "", 15, -0.5, 14.5);
231  hGlobalHaloData_MatchedEcalPhiWedgeEnergy =
232  ibooker.book1D("GlobalHaloData_MatchedEcalPhiWedgeEnergy", "", 50, -0.5, 199.5);
233  hGlobalHaloData_MatchedEcalPhiWedgeConstituents =
234  ibooker.book1D("GlobalHaloData_MatchedEcalPhiWedgeConstituents", "", 20, -0.5, 19.5);
235  hGlobalHaloData_MatchedEcalPhiWedgeiPhi =
236  ibooker.book1D("GlobalHaloData_MatchedEcalPhiWedgeiPhi", "", 360, 0.5, 360.5);
237  hGlobalHaloData_MatchedEcalPhiWedgeMinTime =
238  ibooker.book1D("GlobalHaloData_MatchedEcalPhiWedgeMinTime", "", 50, -100.0, 100.0);
239  hGlobalHaloData_MatchedEcalPhiWedgeMaxTime =
240  ibooker.book1D("GlobalHaloData_MatchedEcalPhiWedgeMaxTime", "", 50, -100.0, 100.0);
241  hGlobalHaloData_MatchedEcalPhiWedgeZDirectionConfidence =
242  ibooker.book1D("GlobalHaloData_MatchedEcalPhiWedgeZDirectionConfidence", "", 120, 1.2, 1.2);
243  }
244  // BeamHaloSummary
245  ibooker.setCurrentFolder(FolderName + "/BeamHaloSummary");
246 
247  hBeamHaloSummary_Id = ibooker.book1D("BeamHaloSumamry_Id", "", 11, 0.5, 11.5);
248  hBeamHaloSummary_Id->setBinLabel(1, "CSC Loose");
249  hBeamHaloSummary_Id->setBinLabel(2, "CSC Tight");
250  hBeamHaloSummary_Id->setBinLabel(3, "Ecal Loose");
251  hBeamHaloSummary_Id->setBinLabel(4, "Ecal Tight");
252  hBeamHaloSummary_Id->setBinLabel(5, "Hcal Loose");
253  hBeamHaloSummary_Id->setBinLabel(6, "Hcal Tight");
254  hBeamHaloSummary_Id->setBinLabel(7, "Global Loose");
255  hBeamHaloSummary_Id->setBinLabel(8, "Global Tight");
256  hBeamHaloSummary_Id->setBinLabel(9, "Event Loose");
257  hBeamHaloSummary_Id->setBinLabel(10, "Event Tight");
258  hBeamHaloSummary_Id->setBinLabel(11, "Nothing");
259  if (!StandardDQM) {
260  hBeamHaloSummary_BXN = ibooker.book2D("BeamHaloSummary_BXN", "", 11, 0.5, 11.5, 4000, -0.5, 3999.5);
261  hBeamHaloSummary_BXN->setBinLabel(1, "CSC Loose");
262  hBeamHaloSummary_BXN->setBinLabel(2, "CSC Tight");
263  hBeamHaloSummary_BXN->setBinLabel(3, "Ecal Loose");
264  hBeamHaloSummary_BXN->setBinLabel(4, "Ecal Tight");
265  hBeamHaloSummary_BXN->setBinLabel(5, "Hcal Loose");
266  hBeamHaloSummary_BXN->setBinLabel(6, "Hcal Tight");
267  hBeamHaloSummary_BXN->setBinLabel(7, "Global Loose");
268  hBeamHaloSummary_BXN->setBinLabel(8, "Global Tight");
269  hBeamHaloSummary_BXN->setBinLabel(9, "Event Loose");
270  hBeamHaloSummary_BXN->setBinLabel(10, "Event Tight");
271  hBeamHaloSummary_BXN->setBinLabel(11, "Nothing");
272  }
273  // Extra
274  ibooker.setCurrentFolder(FolderName + "/ExtraHaloData");
275  if (StandardDQM) {
276  hExtra_CSCTrackInnerOuterDPhi = ibooker.book1D("Extra_CSCTrackInnerOuterDPhi", "", 30, 0, 3.2);
277  hExtra_CSCTrackInnerOuterDEta = ibooker.book1D("Extra_CSCTrackInnerOuterDEta", "", 100, 0, 3.0);
278  hExtra_CSCTrackChi2Ndof = ibooker.book1D("Extra_CSCTrackChi2Ndof", "", 25, 0, 10);
279  hExtra_CSCTrackNHits = ibooker.book1D("Extra_CSCTrackNHits", "", 75, 0, 75);
280  hExtra_CSCActivityWithMET = ibooker.book2D("Extra_CSCActivityWithMET", "", 4, 0.5, 4.5, 4, 0.5, 4.5);
281  hExtra_CSCActivityWithMET->setBinLabel(1, "Track", 1);
282  hExtra_CSCActivityWithMET->setBinLabel(1, "Track", 2);
283  hExtra_CSCActivityWithMET->setBinLabel(2, "Segments", 1);
284  hExtra_CSCActivityWithMET->setBinLabel(2, "Segments", 2);
285  hExtra_CSCActivityWithMET->setBinLabel(3, "RecHits", 1);
286  hExtra_CSCActivityWithMET->setBinLabel(3, "RecHits", 2);
287  hExtra_CSCActivityWithMET->setBinLabel(4, "Nothing", 1);
288  hExtra_CSCActivityWithMET->setBinLabel(4, "Nothing", 2);
289  hExtra_InnerMostTrackHitR = ibooker.book1D("Extra_InnerMostTrackHitR", "", 70, 99.5, 799.5);
290  hExtra_InnerMostTrackHitPhi = ibooker.book1D("Extra_InnerMostTrackHitPhi", "", 60, -3.2, 3.2);
291  } else {
292  hExtra_CSCActivityWithMET = ibooker.book2D("Extra_CSCActivityWithMET", "", 4, 0.5, 4.5, 4, 0.5, 4.5);
293  hExtra_CSCActivityWithMET->setBinLabel(1, "Track", 1);
294  hExtra_CSCActivityWithMET->setBinLabel(1, "Track", 2);
295  hExtra_CSCActivityWithMET->setBinLabel(2, "Segments", 1);
296  hExtra_CSCActivityWithMET->setBinLabel(2, "Segments", 2);
297  hExtra_CSCActivityWithMET->setBinLabel(3, "RecHits", 1);
298  hExtra_CSCActivityWithMET->setBinLabel(3, "RecHits", 2);
299  hExtra_CSCActivityWithMET->setBinLabel(4, "Nothing", 1);
300  hExtra_CSCActivityWithMET->setBinLabel(4, "Nothing", 2);
301  hExtra_HcalToF = ibooker.book2D("Extra_HcalToF", "", 83, -41.5, 41.5, 1000, -125., 125.);
302  hExtra_HcalToF_HaloId = ibooker.book2D("Extra_HcalToF_HaloId", "", 83, -41.5, 41.5, 1000, -125., 125.);
303  hExtra_EcalToF = ibooker.book2D("Extra_EcalToF", "", 171, -85.5, 85.5, 2000, -225., 225.);
304  hExtra_EcalToF_HaloId = ibooker.book2D("Extra_EcalToF_HaloId", "", 171, -85.5, 85.5, 2000, -225., 225.);
305  hExtra_CSCTrackInnerOuterDPhi = ibooker.book1D("Extra_CSCTrackInnerOuterDPhi", "", 30, 0, 3.2);
306  hExtra_CSCTrackInnerOuterDEta = ibooker.book1D("Extra_CSCTrackInnerOuterDEta", "", 30, 0, 3.2);
307  hExtra_CSCTrackChi2Ndof = ibooker.book1D("Extra_CSCTrackChi2Ndof", "", 100, 0, 10);
308  hExtra_CSCTrackNHits = ibooker.book1D("Extra_CSCTrackNHits", "", 75, 0, 75);
309  hExtra_InnerMostTrackHitXY = ibooker.book2D("Extra_InnerMostTrackHitXY", "", 100, -700, 700, 100, -700, 700);
310  hExtra_InnerMostTrackHitR = ibooker.book1D("Extra_InnerMostTrackHitR", "", 400, -0.5, 799.5);
311  hExtra_InnerMostTrackHitRPlusZ =
312  ibooker.book2D("Extra_InnerMostTrackHitRPlusZ", "", 400, 400, 1200, 400, -0.5, 799.5);
313  hExtra_InnerMostTrackHitRMinusZ =
314  ibooker.book2D("Extra_InnerMostTrackHitRMinusZ", "", 400, -1200, -400, 400, -0.5, 799.5);
315  hExtra_InnerMostTrackHitiPhi = ibooker.book1D("Extra_InnerMostTrackHitiPhi", "", 72, 0.5, 72.5);
316  hExtra_InnerMostTrackHitPhi = ibooker.book1D("Extra_InnerMostTrackHitPhi", "", 60, -3.2, 3.2);
317  hExtra_BXN = ibooker.book1D("Extra_BXN", "BXN Occupancy", 4000, 0.5, 4000.5);
318  }
319 }
320 
322  EventID TheEvent = iEvent.id();
323  int BXN = iEvent.bunchCrossing();
324  bool Dump = !TextFileName.empty();
325  edm::EventNumber_t TheEventNumber = TheEvent.event();
327  edm::RunNumber_t Run = iEvent.run();
328 
329  //Get CSC Geometry
330  const auto& TheCSCGeometry = iSetup.getHandle(cscGeomToken_);
331  //Note - removed getting calogeometry since it was unused
332  //Get Stand-alone Muons from Cosmic Muon Reconstruction
334  iEvent.getByToken(IT_CosmicStandAloneMuon, TheCosmics);
336  iEvent.getByToken(IT_CSCTimeMapToken, TheCSCTimeMap);
337  bool CSCTrackPlus = false;
338  bool CSCTrackMinus = false;
339  int imucount = 0;
340  if (TheCosmics.isValid()) {
341  for (reco::MuonCollection::const_iterator iMuon = TheCosmics->begin(); iMuon != TheCosmics->end();
342  iMuon++, imucount++) {
343  reco::TrackRef Track = iMuon->outerTrack();
344  if (!Track)
345  continue;
346 
347  if (!CSCTrackPlus || !CSCTrackMinus) {
348  if (Track->eta() > 0 || Track->outerPosition().z() > 0 || Track->innerPosition().z() > 0)
349  CSCTrackPlus = true;
350  else if (Track->eta() < 0 || Track->outerPosition().z() < 0 || Track->innerPosition().z() < 0)
351  CSCTrackMinus = true;
352  }
353 
354  float innermost_phi = 0.;
355  float outermost_phi = 0.;
356  float innermost_z = 99999.;
357  float outermost_z = 0.;
358  float innermost_eta = 0.;
359  float outermost_eta = 0.;
360  float innermost_x = 0.;
361  float innermost_y = 0.;
362  float innermost_r = 0.;
363  for (unsigned int j = 0; j < Track->extra()->recHitsSize(); j++) {
364  auto hit = Track->extra()->recHitRef(j);
365  DetId TheDetUnitId(hit->geographicalId());
366  if (TheDetUnitId.det() != DetId::Muon)
367  continue;
368  if (TheDetUnitId.subdetId() != MuonSubdetId::CSC)
369  continue;
370 
371  const GeomDetUnit* TheUnit = TheCSCGeometry->idToDetUnit(TheDetUnitId);
372  LocalPoint TheLocalPosition = hit->localPosition();
373  const BoundPlane& TheSurface = TheUnit->surface();
374  const GlobalPoint TheGlobalPosition = TheSurface.toGlobal(TheLocalPosition);
375 
376  float z = TheGlobalPosition.z();
377  if (TMath::Abs(z) < innermost_z) {
378  innermost_phi = TheGlobalPosition.phi();
379  innermost_eta = TheGlobalPosition.eta();
380  innermost_z = TheGlobalPosition.z();
381  innermost_x = TheGlobalPosition.x();
382  innermost_y = TheGlobalPosition.y();
383  innermost_r = TMath::Sqrt(innermost_x * innermost_x + innermost_y * innermost_y);
384  }
385  if (TMath::Abs(z) > outermost_z) {
386  outermost_phi = TheGlobalPosition.phi();
387  outermost_eta = TheGlobalPosition.eta();
388  outermost_z = TheGlobalPosition.z();
389  }
390  }
391  float dphi = TMath::Abs(outermost_phi - innermost_phi);
392  float deta = TMath::Abs(outermost_eta - innermost_eta);
393  hExtra_CSCTrackInnerOuterDPhi->Fill(dphi);
394  hExtra_CSCTrackInnerOuterDEta->Fill(deta);
395  hExtra_CSCTrackChi2Ndof->Fill(Track->normalizedChi2());
396  hExtra_CSCTrackNHits->Fill(Track->numberOfValidHits());
397  hExtra_InnerMostTrackHitR->Fill(innermost_r);
398  hExtra_InnerMostTrackHitPhi->Fill(innermost_phi);
399  if (!StandardDQM) {
400  hExtra_InnerMostTrackHitXY->Fill(innermost_x, innermost_y);
401  hExtra_InnerMostTrackHitiPhi->Fill(Phi_To_iPhi(innermost_phi));
402  if (innermost_z > 0)
403  hExtra_InnerMostTrackHitRPlusZ->Fill(innermost_z, innermost_r);
404  else
405  hExtra_InnerMostTrackHitRMinusZ->Fill(innermost_z, innermost_r);
406  }
407 
408  std::vector<const CSCSegment*> MatchedSegments = TheMatcher->matchCSC(*Track, iEvent);
409  // Find the inner and outer segments separately in case they don't agree completely with recHits
410  // Plan for the possibility segments in both endcaps
411  float InnerSegmentTime[2] = {0, 0};
412  float OuterSegmentTime[2] = {0, 0};
413  float innermost_seg_z[2] = {1500, 1500};
414  float outermost_seg_z[2] = {0, 0};
415  for (std::vector<const CSCSegment*>::const_iterator segment = MatchedSegments.begin();
416  segment != MatchedSegments.end();
417  ++segment) {
418  CSCDetId TheCSCDetId((*segment)->cscDetId());
419  const CSCChamber* TheCSCChamber = TheCSCGeometry->chamber(TheCSCDetId);
420  LocalPoint TheLocalPosition = (*segment)->localPosition();
421  const GlobalPoint TheGlobalPosition = TheCSCChamber->toGlobal(TheLocalPosition);
422  float z = TheGlobalPosition.z();
423  int TheEndcap = TheCSCDetId.endcap();
424  if (TMath::Abs(z) < innermost_seg_z[TheEndcap - 1]) {
425  innermost_seg_z[TheEndcap - 1] = TMath::Abs(z);
426  InnerSegmentTime[TheEndcap - 1] = (*segment)->time();
427  }
428  if (TMath::Abs(z) > outermost_seg_z[TheEndcap - 1]) {
429  outermost_seg_z[TheEndcap - 1] = TMath::Abs(z);
430  OuterSegmentTime[TheEndcap - 1] = (*segment)->time();
431  }
432  }
433 
434  float dT_Segment = 0; // default safe value, looks like collision muon
435  if (innermost_seg_z[0] < outermost_seg_z[0]) // two segments in ME+
436  dT_Segment = OuterSegmentTime[0] - InnerSegmentTime[0];
437  if (innermost_seg_z[1] < outermost_seg_z[1]) // two segments in ME-
438  {
439  // replace the measurement if there weren't segments in ME+ or
440  // if the track in ME- has timing more consistent with an incoming particle
441  if (dT_Segment == 0.0 || OuterSegmentTime[1] - InnerSegmentTime[1] < dT_Segment)
442  dT_Segment = OuterSegmentTime[1] - InnerSegmentTime[1];
443  }
444  hCSCHaloData_SegmentdT->Fill(dT_Segment);
445 
446  // Analyze the MuonTimeExtra information
447  reco::MuonRef muonR(TheCosmics, imucount);
448  if (TheCSCTimeMap.isValid()) {
449  const reco::MuonTimeExtraMap& timeMapCSC = *TheCSCTimeMap;
450  reco::MuonTimeExtra timecsc = timeMapCSC[muonR];
451  float freeInverseBeta = timecsc.freeInverseBeta();
452  hCSCHaloData_FreeInverseBeta->Fill(freeInverseBeta);
453  hCSCHaloData_FreeInverseBetaVsSegmentdT->Fill(dT_Segment, freeInverseBeta);
454  }
455  }
456  }
457 
458  //Get CSC Segments
459  edm::Handle<CSCSegmentCollection> TheCSCSegments;
460  iEvent.getByToken(IT_CSCSegment, TheCSCSegments);
461 
462  // Group segments according to endcaps
463  std::vector<CSCSegment> vCSCSegments_Plus;
464  std::vector<CSCSegment> vCSCSegments_Minus;
465 
466  bool CSCSegmentPlus = false;
467  bool CSCSegmentMinus = false;
468  if (TheCSCSegments.isValid()) {
469  for (CSCSegmentCollection::const_iterator iSegment = TheCSCSegments->begin(); iSegment != TheCSCSegments->end();
470  iSegment++) {
471  const std::vector<CSCRecHit2D> vCSCRecHits = iSegment->specificRecHits();
472  CSCDetId iDetId = (CSCDetId)(*iSegment).cscDetId();
473 
474  if (iDetId.endcap() == 1)
475  vCSCSegments_Plus.push_back(*iSegment);
476  else
477  vCSCSegments_Minus.push_back(*iSegment);
478  }
479  }
480 
481  // Are there segments on the plus/minus side?
482  if (!vCSCSegments_Plus.empty())
483  CSCSegmentPlus = true;
484  if (!vCSCSegments_Minus.empty())
485  CSCSegmentMinus = true;
486 
487  //Get CSC RecHits
488  Handle<CSCRecHit2DCollection> TheCSCRecHits;
489  iEvent.getByToken(IT_CSCRecHit, TheCSCRecHits);
490  bool CSCRecHitPlus = false;
491  bool CSCRecHitMinus = false;
492  if (TheCSCRecHits.isValid()) {
493  for (CSCRecHit2DCollection::const_iterator iCSCRecHit = TheCSCRecHits->begin(); iCSCRecHit != TheCSCRecHits->end();
494  iCSCRecHit++) {
495  DetId TheDetUnitId(iCSCRecHit->geographicalId());
496  const GeomDetUnit* TheUnit = (*TheCSCGeometry).idToDetUnit(TheDetUnitId);
497  LocalPoint TheLocalPosition = iCSCRecHit->localPosition();
498  const BoundPlane& TheSurface = TheUnit->surface();
499  GlobalPoint TheGlobalPosition = TheSurface.toGlobal(TheLocalPosition);
500 
501  //Are there hits on the plus/minus side?
502  if (TheGlobalPosition.z() > 0)
503  CSCRecHitPlus = true;
504  else
505  CSCRecHitMinus = true;
506  }
507  }
508 
509  //Get EB RecHits
510  edm::Handle<EBRecHitCollection> TheEBRecHits;
511  iEvent.getByToken(IT_EBRecHit, TheEBRecHits);
512  int EBHits = 0;
513  if (TheEBRecHits.isValid()) {
514  for (EBRecHitCollection::const_iterator iEBRecHit = TheEBRecHits->begin(); iEBRecHit != TheEBRecHits->end();
515  iEBRecHit++) {
516  if (iEBRecHit->energy() < 0.5)
517  continue;
518  DetId id = DetId(iEBRecHit->id());
519  EBDetId EcalId(id.rawId());
520  int ieta = EcalId.ieta();
521  if (!StandardDQM)
522  hExtra_EcalToF->Fill(ieta, iEBRecHit->time());
523  EBHits++;
524  }
525  }
526 
527  //Get HB/HE RecHits
528  edm::Handle<HBHERecHitCollection> TheHBHERecHits;
529  iEvent.getByToken(IT_HBHERecHit, TheHBHERecHits);
530  if (TheHBHERecHits.isValid()) {
531  for (HBHERecHitCollection::const_iterator iHBHERecHit = TheHBHERecHits->begin();
532  iHBHERecHit != TheHBHERecHits->end();
533  iHBHERecHit++) {
534  if (iHBHERecHit->energy() < 1.)
535  continue;
536  HcalDetId id = HcalDetId(iHBHERecHit->id());
537  if (!StandardDQM)
538  hExtra_HcalToF->Fill(id.ieta(), iHBHERecHit->time());
539  }
540  }
541 
542  //Get MET
544  iEvent.getByToken(IT_met, TheCaloMET);
545 
546  //Get CSCHaloData
547  edm::Handle<reco::CSCHaloData> TheCSCDataHandle;
548  iEvent.getByToken(IT_CSCHaloData, TheCSCDataHandle);
549  int TheHaloOrigin = 0;
550  if (TheCSCDataHandle.isValid()) {
551  const CSCHaloData CSCData = (*TheCSCDataHandle.product());
553  TheHaloOrigin = 1;
555  TheHaloOrigin = -1;
556 
557  for (std::vector<GlobalPoint>::const_iterator i = CSCData.GetCSCTrackImpactPositions().begin();
558  i != CSCData.GetCSCTrackImpactPositions().end();
559  i++) {
560  float r = TMath::Sqrt(i->x() * i->x() + i->y() * i->y());
561  if (!StandardDQM) {
562  hCSCHaloData_InnerMostTrackHitXY->Fill(i->x(), i->y());
563  hCSCHaloData_InnerMostTrackHitiPhi->Fill(Phi_To_iPhi(i->phi()));
564  if (i->z() > 0)
565  hCSCHaloData_InnerMostTrackHitRPlusZ->Fill(i->z(), r);
566  else
567  hCSCHaloData_InnerMostTrackHitRMinusZ->Fill(i->z(), r);
568  }
569  hCSCHaloData_InnerMostTrackHitR->Fill(r);
570  hCSCHaloData_InnerMostTrackHitPhi->Fill(i->phi());
571  }
572  hCSCHaloData_L1HaloTriggersMEPlus->Fill(CSCData.NumberOfHaloTriggers(HaloData::plus));
573  hCSCHaloData_L1HaloTriggersMEMinus->Fill(CSCData.NumberOfHaloTriggers(HaloData::minus));
574  hCSCHaloData_L1HaloTriggers->Fill(CSCData.NumberOfHaloTriggers(HaloData::both));
575  hCSCHaloData_HLHaloTriggers->Fill(CSCData.CSCHaloHLTAccept());
576  hCSCHaloData_TrackMultiplicityMEPlus->Fill(CSCData.NumberOfHaloTracks(HaloData::plus));
577  hCSCHaloData_TrackMultiplicityMEMinus->Fill(CSCData.NumberOfHaloTracks(HaloData::minus));
578  hCSCHaloData_TrackMultiplicity->Fill(CSCData.GetTracks().size());
579  hCSCHaloData_NOutOfTimeTriggersMEPlus->Fill(CSCData.NOutOfTimeTriggers(HaloData::plus));
580  hCSCHaloData_NOutOfTimeTriggersMEMinus->Fill(CSCData.NOutOfTimeTriggers(HaloData::minus));
581  hCSCHaloData_NOutOfTimeTriggers->Fill(CSCData.NOutOfTimeTriggers(HaloData::both));
582  hCSCHaloData_NOutOfTimeHits->Fill(CSCData.NOutOfTimeHits());
583  hCSCHaloData_NOutOfTimeTriggersvsL1HaloExists->Fill(CSCData.NOutOfTimeTriggers(HaloData::both),
584  CSCData.NumberOfHaloTriggers(HaloData::both) > 0);
585  hCSCHaloData_NTracksSmalldT->Fill(CSCData.NTracksSmalldT());
586  hCSCHaloData_NTracksSmallBeta->Fill(CSCData.NTracksSmallBeta());
587  hCSCHaloData_NTracksSmallBetaAndSmalldT->Fill(CSCData.NTracksSmallBetaAndSmalldT());
588  hCSCHaloData_NTracksSmalldTvsNHaloTracks->Fill(CSCData.GetTracks().size(), CSCData.NTracksSmalldT());
589  // MLR
590  hCSCHaloData_NFlatHaloSegments->Fill(CSCData.NFlatHaloSegments());
591  hCSCHaloData_SegmentsInBothEndcaps->Fill(CSCData.GetSegmentsInBothEndcaps());
592  if (CSCData.GetSegmentsInBothEndcaps())
593  hCSCHaloData_NFlatSegmentsInBothEndcaps->Fill(CSCData.NFlatHaloSegments());
594  // End MLR
595  }
596 
597  //Get EcalHaloData
598  edm::Handle<reco::EcalHaloData> TheEcalHaloData;
599  iEvent.getByToken(IT_EcalHaloData, TheEcalHaloData);
600  if (TheEcalHaloData.isValid()) {
601  const EcalHaloData EcalData = (*TheEcalHaloData.product());
602  std::vector<PhiWedge> EcalWedges = EcalData.GetPhiWedges();
603  for (std::vector<PhiWedge>::const_iterator iWedge = EcalWedges.begin(); iWedge != EcalWedges.end(); iWedge++) {
604  if (!StandardDQM) {
605  hEcalHaloData_PhiWedgeEnergy->Fill(iWedge->Energy());
606  hEcalHaloData_PhiWedgeMinTime->Fill(iWedge->MinTime());
607  hEcalHaloData_PhiWedgeMaxTime->Fill(iWedge->MaxTime());
608  hEcalHaloData_PhiWedgeMinVsMaxTime->Fill(iWedge->MinTime(), iWedge->MaxTime());
609  hEcalHaloData_PhiWedgePlusZDirectionConfidence->Fill(iWedge->PlusZDirectionConfidence());
610  hEcalHaloData_PhiWedgeiPhi->Fill(iWedge->iPhi());
611  }
612  hEcalHaloData_PhiWedgeZDirectionConfidence->Fill(iWedge->ZDirectionConfidence());
613  hEcalHaloData_PhiWedgeConstituents->Fill(iWedge->NumberOfConstituents());
614  }
615 
616  hEcalHaloData_PhiWedgeMultiplicity->Fill(EcalWedges.size());
617 
618  edm::ValueMap<float> vm_Angle = EcalData.GetShowerShapesAngle();
619  edm::ValueMap<float> vm_Roundness = EcalData.GetShowerShapesRoundness();
620  //Access selected SuperClusters
621  for (unsigned int n = 0; n < EcalData.GetSuperClusters().size(); n++) {
623  float angle = vm_Angle[cluster];
624  float roundness = vm_Roundness[cluster];
625  hEcalHaloData_SuperClusterShowerShapes->Fill(angle, roundness);
626  hEcalHaloData_SuperClusterNHits->Fill(cluster->size());
627  hEcalHaloData_SuperClusterEnergy->Fill(cluster->energy());
628 
629  if (!StandardDQM) {
630  hEcalHaloData_SuperClusterPhiVsEta->Fill(cluster->eta(), cluster->phi());
631  }
632  }
633  }
634 
635  //Get HcalHaloData
636  edm::Handle<reco::HcalHaloData> TheHcalHaloData;
637  iEvent.getByToken(IT_HcalHaloData, TheHcalHaloData);
638  if (TheHcalHaloData.isValid()) {
639  const HcalHaloData HcalData = (*TheHcalHaloData.product());
640  std::vector<PhiWedge> HcalWedges = HcalData.GetPhiWedges();
641  hHcalHaloData_PhiWedgeMultiplicity->Fill(HcalWedges.size());
642  for (std::vector<PhiWedge>::const_iterator iWedge = HcalWedges.begin(); iWedge != HcalWedges.end(); iWedge++) {
643  if (!StandardDQM) {
644  hHcalHaloData_PhiWedgeEnergy->Fill(iWedge->Energy());
645  hHcalHaloData_PhiWedgeMinTime->Fill(iWedge->MinTime());
646  hHcalHaloData_PhiWedgeMaxTime->Fill(iWedge->MaxTime());
647  hHcalHaloData_PhiWedgePlusZDirectionConfidence->Fill(iWedge->PlusZDirectionConfidence());
648  hHcalHaloData_PhiWedgeMinVsMaxTime->Fill(iWedge->MinTime(), iWedge->MaxTime());
649  hHcalHaloData_PhiWedgeiPhi->Fill(iWedge->iPhi());
650  }
651 
652  hHcalHaloData_PhiWedgeConstituents->Fill(iWedge->NumberOfConstituents());
653  hHcalHaloData_PhiWedgeZDirectionConfidence->Fill(iWedge->ZDirectionConfidence());
654  }
655  }
656 
657  if (!StandardDQM) {
658  //Get GlobalHaloData
659  edm::Handle<reco::GlobalHaloData> TheGlobalHaloData;
660  iEvent.getByToken(IT_GlobalHaloData, TheGlobalHaloData);
661  if (TheGlobalHaloData.isValid()) {
662  const GlobalHaloData GlobalData = (*TheGlobalHaloData.product());
663  if (TheCaloMET.isValid()) {
664  // Get Raw Uncorrected CaloMET
665  const CaloMETCollection* calometcol = TheCaloMET.product();
666  const CaloMET* RawMET = &(calometcol->front());
667 
668  // Get BeamHalo Corrected CaloMET
669  const CaloMET CorrectedMET = GlobalData.GetCorrectedCaloMET(*RawMET);
670  hGlobalHaloData_MExCorrection->Fill(GlobalData.DeltaMEx());
671  hGlobalHaloData_MEyCorrection->Fill(GlobalData.DeltaMEy());
672  hGlobalHaloData_HaloCorrectedMET->Fill(CorrectedMET.pt());
673  hGlobalHaloData_RawMETMinusHaloCorrectedMET->Fill(RawMET->pt() - CorrectedMET.pt());
674  if (RawMET->sumEt())
675  hGlobalHaloData_RawMETOverSumEt->Fill(RawMET->pt() / RawMET->sumEt());
676  }
677 
678  // Get Matched Hcal Phi Wedges
679  std::vector<PhiWedge> HcalWedges = GlobalData.GetMatchedHcalPhiWedges();
680  hGlobalHaloData_MatchedHcalPhiWedgeMultiplicity->Fill(HcalWedges.size());
681  // Loop over Matched Hcal Phi Wedges
682  for (std::vector<PhiWedge>::const_iterator iWedge = HcalWedges.begin(); iWedge != HcalWedges.end(); iWedge++) {
683  hGlobalHaloData_MatchedHcalPhiWedgeEnergy->Fill(iWedge->Energy());
684  hGlobalHaloData_MatchedHcalPhiWedgeConstituents->Fill(iWedge->NumberOfConstituents());
685  hGlobalHaloData_MatchedHcalPhiWedgeiPhi->Fill(iWedge->iPhi());
686  hGlobalHaloData_MatchedHcalPhiWedgeMinTime->Fill(iWedge->MinTime());
687  hGlobalHaloData_MatchedHcalPhiWedgeMaxTime->Fill(iWedge->MaxTime());
688  hGlobalHaloData_MatchedHcalPhiWedgeZDirectionConfidence->Fill(iWedge->ZDirectionConfidence());
689  if (TheHBHERecHits.isValid()) {
690  for (HBHERecHitCollection::const_iterator iHBHERecHit = TheHBHERecHits->begin();
691  iHBHERecHit != TheHBHERecHits->end();
692  iHBHERecHit++) {
693  HcalDetId id = HcalDetId(iHBHERecHit->id());
694  int iphi = id.iphi();
695  if (iphi != iWedge->iPhi())
696  continue;
697  if (iHBHERecHit->energy() < 1.0)
698  continue; // Otherwise there are thousands of hits per event (even with negative energies)
699 
700  float time = iHBHERecHit->time();
701  int ieta = id.ieta();
702  hExtra_HcalToF_HaloId->Fill(ieta, time);
703  }
704  }
705  }
706 
707  // Get Matched Hcal Phi Wedges
708  std::vector<PhiWedge> EcalWedges = GlobalData.GetMatchedEcalPhiWedges();
709  hGlobalHaloData_MatchedEcalPhiWedgeMultiplicity->Fill(EcalWedges.size());
710  for (std::vector<PhiWedge>::const_iterator iWedge = EcalWedges.begin(); iWedge != EcalWedges.end(); iWedge++) {
711  hGlobalHaloData_MatchedEcalPhiWedgeEnergy->Fill(iWedge->Energy());
712  hGlobalHaloData_MatchedEcalPhiWedgeConstituents->Fill(iWedge->NumberOfConstituents());
713  hGlobalHaloData_MatchedEcalPhiWedgeiPhi->Fill(iWedge->iPhi());
714  hGlobalHaloData_MatchedEcalPhiWedgeMinTime->Fill(iWedge->MinTime());
715  hGlobalHaloData_MatchedEcalPhiWedgeMaxTime->Fill(iWedge->MaxTime());
716  hGlobalHaloData_MatchedEcalPhiWedgeZDirectionConfidence->Fill(iWedge->ZDirectionConfidence());
717  if (TheEBRecHits.isValid()) {
718  for (EBRecHitCollection::const_iterator iEBRecHit = TheEBRecHits->begin(); iEBRecHit != TheEBRecHits->end();
719  iEBRecHit++) {
720  if (iEBRecHit->energy() < 0.5)
721  continue;
722  DetId id = DetId(iEBRecHit->id());
723  EBDetId EcalId(id.rawId());
724  int iPhi = EcalId.iphi();
725  iPhi = (iPhi - 1) / 5 + 1;
726  if (iPhi != iWedge->iPhi())
727  continue;
728  hExtra_EcalToF_HaloId->Fill(EcalId.ieta(), iEBRecHit->time());
729  }
730  }
731  }
732  }
733  }
734 
735  // Get BeamHaloSummary
736  edm::Handle<BeamHaloSummary> TheBeamHaloSummary;
737  iEvent.getByToken(IT_BeamHaloSummary, TheBeamHaloSummary);
738  if (TheBeamHaloSummary.isValid()) {
739  const BeamHaloSummary TheSummary = (*TheBeamHaloSummary.product());
740  if (TheSummary.CSCLooseHaloId()) {
741  hBeamHaloSummary_Id->Fill(1);
742  if (!StandardDQM)
743  hBeamHaloSummary_BXN->Fill(1, BXN);
744  if (Dump)
745  *out << std::setw(15) << "CSCLoose" << std::setw(15) << Run << std::setw(15) << Lumi << std::setw(15)
746  << TheEventNumber << std::endl;
747  }
748  if (TheSummary.CSCTightHaloId()) {
749  hBeamHaloSummary_Id->Fill(2);
750  if (!StandardDQM)
751  hBeamHaloSummary_BXN->Fill(2, BXN);
752  }
753  if (TheSummary.EcalLooseHaloId()) {
754  hBeamHaloSummary_Id->Fill(3);
755  if (!StandardDQM)
756  hBeamHaloSummary_BXN->Fill(3, BXN);
757  if (Dump)
758  *out << std::setw(15) << "EcalLoose" << std::setw(15) << Run << std::setw(15) << Lumi << std::setw(15)
759  << TheEventNumber << std::endl;
760  }
761  if (TheSummary.EcalTightHaloId()) {
762  hBeamHaloSummary_Id->Fill(4);
763  if (!StandardDQM)
764  hBeamHaloSummary_BXN->Fill(4, BXN);
765  }
766  if (TheSummary.HcalLooseHaloId()) {
767  hBeamHaloSummary_Id->Fill(5);
768  if (!StandardDQM)
769  hBeamHaloSummary_BXN->Fill(5, BXN);
770  if (Dump)
771  *out << std::setw(15) << "HcalLoose" << std::setw(15) << Run << std::setw(15) << Lumi << std::setw(15)
772  << TheEventNumber << std::endl;
773  }
774  if (TheSummary.HcalTightHaloId()) {
775  hBeamHaloSummary_Id->Fill(6);
776  if (!StandardDQM)
777  hBeamHaloSummary_BXN->Fill(6, BXN);
778  }
779  if (TheSummary.GlobalLooseHaloId()) {
780  hBeamHaloSummary_Id->Fill(7);
781  if (!StandardDQM)
782  hBeamHaloSummary_BXN->Fill(7, BXN);
783  if (Dump)
784  *out << std::setw(15) << "GlobalLoose" << std::setw(15) << Run << std::setw(15) << Lumi << std::setw(15)
785  << TheEventNumber << std::endl;
786  }
787  if (TheSummary.GlobalTightHaloId()) {
788  hBeamHaloSummary_Id->Fill(8);
789  if (!StandardDQM)
790  hBeamHaloSummary_BXN->Fill(8, BXN);
791  }
792  if (TheSummary.LooseId()) {
793  hBeamHaloSummary_Id->Fill(9);
794  if (!StandardDQM)
795  hBeamHaloSummary_BXN->Fill(9, BXN);
796  }
797  if (TheSummary.TightId()) {
798  hBeamHaloSummary_Id->Fill(10);
799  if (!StandardDQM)
800  hBeamHaloSummary_BXN->Fill(10, BXN);
801  }
802  if (!TheSummary.EcalLooseHaloId() && !TheSummary.HcalLooseHaloId() && !TheSummary.CSCLooseHaloId() &&
803  !TheSummary.GlobalLooseHaloId()) {
804  hBeamHaloSummary_Id->Fill(11);
805  if (!StandardDQM)
806  hBeamHaloSummary_BXN->Fill(11, BXN);
807  }
808  }
809 
810  if (TheCaloMET.isValid()) {
811  const CaloMETCollection* calometcol = TheCaloMET.product();
812  const CaloMET* calomet = &(calometcol->front());
813 
814  if (calomet->pt() > DumpMET)
815  if (Dump)
816  *out << std::setw(15) << "HighMET" << std::setw(15) << Run << std::setw(15) << Lumi << std::setw(15)
817  << TheEventNumber << std::endl;
818 
819  //Fill CSC Activity Plot
820  if (calomet->pt() > 15.0) {
821  if (TheHaloOrigin > 0) {
822  if (CSCTrackPlus && CSCTrackMinus)
823  hExtra_CSCActivityWithMET->Fill(1, 1);
824  else if (CSCTrackPlus && CSCSegmentMinus)
825  hExtra_CSCActivityWithMET->Fill(1, 2);
826  else if (CSCTrackPlus && CSCRecHitMinus)
827  hExtra_CSCActivityWithMET->Fill(1, 3);
828  else if (CSCTrackPlus)
829  hExtra_CSCActivityWithMET->Fill(1, 4);
830  else if (CSCSegmentPlus && CSCTrackMinus)
831  hExtra_CSCActivityWithMET->Fill(2, 1);
832  else if (CSCSegmentPlus && CSCSegmentMinus)
833  hExtra_CSCActivityWithMET->Fill(2, 2);
834  else if (CSCSegmentPlus && CSCRecHitMinus)
835  hExtra_CSCActivityWithMET->Fill(2, 3);
836  else if (CSCSegmentPlus)
837  hExtra_CSCActivityWithMET->Fill(2, 4);
838  else if (CSCRecHitPlus && CSCTrackMinus)
839  hExtra_CSCActivityWithMET->Fill(3, 1);
840  else if (CSCRecHitPlus && CSCSegmentMinus)
841  hExtra_CSCActivityWithMET->Fill(3, 2);
842  else if (CSCRecHitPlus && CSCRecHitMinus)
843  hExtra_CSCActivityWithMET->Fill(3, 3);
844  else if (CSCRecHitPlus)
845  hExtra_CSCActivityWithMET->Fill(3, 4);
846  else
847  hExtra_CSCActivityWithMET->Fill(4, 4);
848  } else if (TheHaloOrigin < 0) {
849  if (CSCTrackMinus && CSCTrackPlus)
850  hExtra_CSCActivityWithMET->Fill(1, 1);
851  else if (CSCTrackMinus && CSCSegmentPlus)
852  hExtra_CSCActivityWithMET->Fill(1, 2);
853  else if (CSCTrackMinus && CSCRecHitPlus)
854  hExtra_CSCActivityWithMET->Fill(1, 3);
855  else if (CSCTrackMinus)
856  hExtra_CSCActivityWithMET->Fill(1, 4);
857  else if (CSCSegmentMinus && CSCTrackPlus)
858  hExtra_CSCActivityWithMET->Fill(2, 1);
859  else if (CSCSegmentMinus && CSCSegmentPlus)
860  hExtra_CSCActivityWithMET->Fill(2, 2);
861  else if (CSCSegmentMinus && CSCRecHitPlus)
862  hExtra_CSCActivityWithMET->Fill(2, 3);
863  else if (CSCSegmentMinus)
864  hExtra_CSCActivityWithMET->Fill(2, 4);
865  else if (CSCRecHitMinus && CSCTrackPlus)
866  hExtra_CSCActivityWithMET->Fill(3, 1);
867  else if (CSCRecHitMinus && CSCSegmentPlus)
868  hExtra_CSCActivityWithMET->Fill(3, 2);
869  else if (CSCRecHitMinus && CSCRecHitPlus)
870  hExtra_CSCActivityWithMET->Fill(3, 3);
871  else if (CSCRecHitMinus)
872  hExtra_CSCActivityWithMET->Fill(3, 4);
873  else
874  hExtra_CSCActivityWithMET->Fill(4, 4);
875  }
876  }
877  }
878 }
879 
881 
882 //DEFINE_FWK_MODULE(CMSEventAnalyzer);
short int NOutOfTimeTriggers(HaloData::Endcap z=HaloData::both) const
Definition: CSCHaloData.h:45
const double Pi
string OutputFileName
const bool EcalTightHaloId() const
EventNumber_t event() const
Definition: EventID.h:40
~BeamHaloAnalyzer() override
int NumberOfHaloTracks(HaloData::Endcap z=HaloData::both) const
Definition: CSCHaloData.cc:71
edm::ValueMap< float > & GetShowerShapesRoundness()
Definition: EcalHaloData.h:41
double pt() const final
transverse momentum
const bool HcalTightHaloId() const
const bool GlobalLooseHaloId() const
const std::vector< PhiWedge > & GetPhiWedges() const
Definition: EcalHaloData.h:33
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
edm::RefVector< reco::SuperClusterCollection > & GetSuperClusters()
Definition: EcalHaloData.h:37
const bool LooseId() const
edm::ValueMap< float > & GetShowerShapesAngle()
Definition: EcalHaloData.h:44
bool CSCHaloHLTAccept() const
Definition: CSCHaloData.h:41
short int NTracksSmallBetaAndSmalldT() const
Definition: CSCHaloData.h:52
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
std::vector< EcalRecHit >::const_iterator const_iterator
T y() const
Definition: PV3DBase.h:60
bool exists(std::string const &parameterName) const
checks if a parameter exists
int bunchCrossing() const
Definition: EventBase.h:64
unsigned long long EventNumber_t
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:61
short int NumberOfOutOfTimeTriggers(HaloData::Endcap z=HaloData::both) const
Definition: CSCHaloData.cc:62
const bool TightId() const
const bool GlobalTightHaloId() const
std::vector< PhiWedge > & GetMatchedEcalPhiWedges()
short int NFlatHaloSegments() const
Definition: CSCHaloData.h:55
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
unsigned int LuminosityBlockNumber_t
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
bool GetSegmentsInBothEndcaps() const
Definition: CSCHaloData.h:56
const bool HcalLooseHaloId() const
int endcap() const
Definition: CSCDetId.h:85
Collection of Calo MET.
const bool CSCTightHaloId() const
int Phi_To_iPhi(float phi)
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:43
short int NTracksSmallBeta() const
Definition: CSCHaloData.h:51
int iEvent
Definition: GenABIO.cc:224
double sumEt() const
Definition: MET.h:56
float DeltaMEx() const
float DeltaMEy() const
constexpr int iphi() const
get the cell iphi
Definition: HcalDetId.h:157
short int NTracksSmalldT() const
Definition: CSCHaloData.h:50
T z() const
Definition: PV3DBase.h:61
RunNumber_t run() const
Definition: Event.h:109
const std::vector< GlobalPoint > & GetCSCTrackImpactPositions() const
Definition: CSCHaloData.h:100
void analyze(const edm::Event &, const edm::EventSetup &) override
short int NOutOfTimeHits() const
Definition: CSCHaloData.h:48
bool isValid() const
Definition: HandleBase.h:70
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
int NumberOfHaloTriggers(HaloData::Endcap z=HaloData::both) const
Definition: CSCHaloData.cc:44
reco::CaloMET GetCorrectedCaloMET(const reco::CaloMET &RawMET) const
Definition: DetId.h:17
T const * product() const
Definition: Handle.h:70
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::string const & label() const
Definition: InputTag.h:36
T eta() const
Definition: PV3DBase.h:73
const bool CSCLooseHaloId() const
edm::EventID id() const
Definition: EventBase.h:59
float freeInverseBeta() const
Definition: MuonTimeExtra.h:36
std::vector< PhiWedge > & GetMatchedHcalPhiWedges()
size_type size() const
Size of the RefVector.
Definition: RefVector.h:102
const std::vector< PhiWedge > & GetPhiWedges() const
Definition: HcalHaloData.h:45
unsigned int RunNumber_t
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
static constexpr int CSC
Definition: MuonSubdetId.h:12
T x() const
Definition: PV3DBase.h:59
BeamHaloAnalyzer(const edm::ParameterSet &)
const bool EcalLooseHaloId() const
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
Definition: Run.h:45
edm::RefVector< reco::TrackCollection > & GetTracks()
Definition: CSCHaloData.h:69
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11