CMS 3D CMS Logo

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