CMS 3D CMS Logo

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