CMS 3D CMS Logo

BeamHaloSummaryProducer.cc
Go to the documentation of this file.
3 
4 /*
5  [class]: BeamHaloSummaryProducer
6  [authors]: R. Remington, The University of Florida
7  [description]: See BeamHaloSummaryProducer.h
8  [date]: October 15, 2009
9 */
10 
11 using namespace edm;
12 using namespace std;
13 using namespace reco;
14 
15 BeamHaloSummaryProducer::BeamHaloSummaryProducer(const edm::ParameterSet& iConfig) {
16  IT_CSCHaloData = iConfig.getParameter<edm::InputTag>("CSCHaloDataLabel");
17  IT_EcalHaloData = iConfig.getParameter<edm::InputTag>("EcalHaloDataLabel");
18  IT_HcalHaloData = iConfig.getParameter<edm::InputTag>("HcalHaloDataLabel");
19  IT_GlobalHaloData = iConfig.getParameter<edm::InputTag>("GlobalHaloDataLabel");
20 
21  L_EcalPhiWedgeEnergy = (float)iConfig.getParameter<double>("l_EcalPhiWedgeEnergy");
22  L_EcalPhiWedgeConstituents = iConfig.getParameter<int>("l_EcalPhiWedgeConstituents");
23  L_EcalPhiWedgeToF = (float)iConfig.getParameter<double>("l_EcalPhiWedgeToF");
24  L_EcalPhiWedgeConfidence = (float)iConfig.getParameter<double>("l_EcalPhiWedgeConfidence");
25  L_EcalShowerShapesRoundness = (float)iConfig.getParameter<double>("l_EcalShowerShapesRoundness");
26  L_EcalShowerShapesAngle = (float)iConfig.getParameter<double>("l_EcalShowerShapesAngle");
27  L_EcalSuperClusterSize = (int)iConfig.getParameter<int>("l_EcalSuperClusterSize");
28  L_EcalSuperClusterEnergy = (float)iConfig.getParameter<double>("l_EcalSuperClusterEnergy");
29 
30  T_EcalPhiWedgeEnergy = (float)iConfig.getParameter<double>("t_EcalPhiWedgeEnergy");
31  T_EcalPhiWedgeConstituents = iConfig.getParameter<int>("t_EcalPhiWedgeConstituents");
32  T_EcalPhiWedgeToF = (float)iConfig.getParameter<double>("t_EcalPhiWedgeToF");
33  T_EcalPhiWedgeConfidence = (float)iConfig.getParameter<double>("t_EcalPhiWedgeConfidence");
34  T_EcalShowerShapesRoundness = (float)iConfig.getParameter<double>("t_EcalShowerShapesRoundness");
35  T_EcalShowerShapesAngle = (float)iConfig.getParameter<double>("t_EcalShowerShapesAngle");
36  T_EcalSuperClusterSize = (int)iConfig.getParameter<int>("t_EcalSuperClusterSize");
37  T_EcalSuperClusterEnergy = (float)iConfig.getParameter<double>("t_EcalSuperClusterEnergy");
38 
39  L_HcalPhiWedgeEnergy = (float)iConfig.getParameter<double>("l_HcalPhiWedgeEnergy");
40  L_HcalPhiWedgeConstituents = iConfig.getParameter<int>("l_HcalPhiWedgeConstituents");
41  L_HcalPhiWedgeToF = (float)iConfig.getParameter<double>("l_HcalPhiWedgeToF");
42  L_HcalPhiWedgeConfidence = (float)iConfig.getParameter<double>("l_HcalPhiWedgeConfidence");
43 
44  T_HcalPhiWedgeEnergy = (float)iConfig.getParameter<double>("t_HcalPhiWedgeEnergy");
45  T_HcalPhiWedgeConstituents = iConfig.getParameter<int>("t_HcalPhiWedgeConstituents");
46  T_HcalPhiWedgeToF = (float)iConfig.getParameter<double>("t_HcalPhiWedgeToF");
47  T_HcalPhiWedgeConfidence = (float)iConfig.getParameter<double>("t_HcalPhiWedgeConfidence");
48 
49  problematicStripMinLength = (int)iConfig.getParameter<int>("problematicStripMinLength");
50 
51  cschalodata_token_ = consumes<CSCHaloData>(IT_CSCHaloData);
52  ecalhalodata_token_ = consumes<EcalHaloData>(IT_EcalHaloData);
53  hcalhalodata_token_ = consumes<HcalHaloData>(IT_HcalHaloData);
54  globalhalodata_token_ = consumes<GlobalHaloData>(IT_GlobalHaloData);
55 
56  produces<BeamHaloSummary>();
57 }
58 
59 void BeamHaloSummaryProducer::produce(Event& iEvent, const EventSetup& iSetup) {
60  // BeamHaloSummary object
61  auto TheBeamHaloSummary = std::make_unique<BeamHaloSummary>();
62 
63  // CSC Specific Halo Data
64  Handle<CSCHaloData> TheCSCHaloData;
65  // iEvent.getByLabel(IT_CSCHaloData, TheCSCHaloData);
66  iEvent.getByToken(cschalodata_token_, TheCSCHaloData);
67 
68  const CSCHaloData CSCData = (*TheCSCHaloData.product());
69 
70  //CSCLoose Id for 2011
71  if (CSCData.NumberOfHaloTriggers() || CSCData.NumberOfHaloTracks() ||
72  (CSCData.NOutOfTimeHits() > 10 && CSCData.NFlatHaloSegments() > 2) || CSCData.GetSegmentsInBothEndcaps() ||
73  CSCData.NTracksSmalldT())
74  TheBeamHaloSummary->GetCSCHaloReport()[0] = 1;
75 
76  //CSCTight Id for 2011
77  if ((CSCData.NumberOfHaloTriggers() && CSCData.NumberOfHaloTracks()) ||
78  (CSCData.NOutOfTimeHits() > 10 && CSCData.NumberOfHaloTriggers()) ||
79  (CSCData.NOutOfTimeHits() > 10 && CSCData.NumberOfHaloTracks()) || CSCData.GetSegmentsInBothEndcaps() ||
80  (CSCData.NTracksSmalldT() && CSCData.NumberOfHaloTracks()) ||
81  (CSCData.NFlatHaloSegments() > 3 && (CSCData.NumberOfHaloTriggers() || CSCData.NumberOfHaloTracks())))
82  TheBeamHaloSummary->GetCSCHaloReport()[1] = 1;
83 
84  //CSCLoose Id from 2010
85  if (CSCData.NumberOfHaloTriggers() || CSCData.NumberOfHaloTracks() || CSCData.NumberOfOutOfTimeTriggers())
86  TheBeamHaloSummary->GetCSCHaloReport()[2] = 1;
87 
88  //CSCTight Id from 2010
89  if ((CSCData.NumberOfHaloTriggers() && CSCData.NumberOfHaloTracks()) ||
90  (CSCData.NumberOfHaloTriggers() && CSCData.NumberOfOutOfTimeTriggers()) ||
91  (CSCData.NumberOfHaloTracks() && CSCData.NumberOfOutOfTimeTriggers()))
92  TheBeamHaloSummary->GetCSCHaloReport()[3] = 1;
93 
94  //CSCTight Id for 2015
95  if ((CSCData.NumberOfHaloTriggers_TrkMuUnVeto() && CSCData.NumberOfHaloTracks()) ||
96  (CSCData.NOutOfTimeHits() > 10 && CSCData.NumberOfHaloTriggers_TrkMuUnVeto()) ||
97  (CSCData.NOutOfTimeHits() > 10 && CSCData.NumberOfHaloTracks()) ||
98  CSCData.GetSegmentsInBothEndcaps_Loose_TrkMuUnVeto() ||
99  (CSCData.NTracksSmalldT() && CSCData.NumberOfHaloTracks()) ||
100  (CSCData.NFlatHaloSegments() > 3 && (CSCData.NumberOfHaloTriggers_TrkMuUnVeto() || CSCData.NumberOfHaloTracks())))
101  TheBeamHaloSummary->GetCSCHaloReport()[4] = 1;
102 
103  //Update
104  if ((CSCData.NumberOfHaloTriggers_TrkMuUnVeto() && CSCData.NFlatHaloSegments_TrkMuUnVeto()) ||
105  CSCData.GetSegmentsInBothEndcaps_Loose_dTcut_TrkMuUnVeto() || CSCData.GetSegmentIsCaloMatched())
106  TheBeamHaloSummary->GetCSCHaloReport()[5] = 1;
107 
108  //Ecal Specific Halo Data
109  Handle<EcalHaloData> TheEcalHaloData;
110  // iEvent.getByLabel(IT_EcalHaloData, TheEcalHaloData);
111  iEvent.getByToken(ecalhalodata_token_, TheEcalHaloData);
112 
113  const EcalHaloData EcalData = (*TheEcalHaloData.product());
114 
115  bool EcalLooseId = false, EcalTightId = false;
116  /* COMMENTED OUT, NEEDS TO BE TUNED
117  const std::vector<PhiWedge> EcalWedges = EcalData.GetPhiWedges();
118  for( std::vector<PhiWedge>::const_iterator iWedge = EcalWedges.begin() ; iWedge != EcalWedges.end() ; iWedge++ )
119  {
120  bool EcaliPhi = false;
121 
122  //Loose Id
123  if(iWedge-> Energy() > L_EcalPhiWedgeEnergy && iWedge->NumberOfConstituents() > L_EcalPhiWedgeConstituents && std::abs(iWedge->ZDirectionConfidence()) > L_EcalPhiWedgeConfidence)
124  {
125  EcalLooseId = true;
126  EcaliPhi = true;
127  }
128 
129  //Tight Id
130  if( iWedge-> Energy() > T_EcalPhiWedgeEnergy && iWedge->NumberOfConstituents() > T_EcalPhiWedgeConstituents && iWedge->ZDirectionConfidence() > L_EcalPhiWedgeConfidence )
131  {
132  EcalTightId = true;
133  EcaliPhi = true;
134  }
135 
136  for( unsigned int i = 0 ; i < TheBeamHaloSummary->GetEcaliPhiSuspects().size() ; i++ )
137  {
138  if( iWedge->iPhi() == TheBeamHaloSummary->GetEcaliPhiSuspects()[i] )
139  {
140  EcaliPhi = false; // already stored this iPhi
141  continue;
142  }
143  }
144 
145  if( EcaliPhi )
146  TheBeamHaloSummary->GetEcaliPhiSuspects().push_back( iWedge->iPhi() ) ;
147  }
148  */
149 
150  edm::ValueMap<float> vm_Angle = EcalData.GetShowerShapesAngle();
151  edm::ValueMap<float> vm_Roundness = EcalData.GetShowerShapesRoundness();
152 
153  //Access selected SuperClusters
154  for (unsigned int n = 0; n < EcalData.GetSuperClusters().size(); n++) {
156 
157  float angle = vm_Angle[cluster];
158  float roundness = vm_Roundness[cluster];
159 
160  //Loose Selection
161  if ((angle > 0. && angle < L_EcalShowerShapesAngle) &&
162  (roundness > 0. && roundness < L_EcalShowerShapesRoundness)) {
163  if (cluster->energy() > L_EcalSuperClusterEnergy && cluster->size() > (unsigned int)L_EcalSuperClusterSize)
164  EcalLooseId = true;
165  }
166 
167  //Tight Selection
168  if ((angle > 0. && angle < T_EcalShowerShapesAngle) &&
169  (roundness > 0. && roundness < T_EcalShowerShapesRoundness)) {
170  if (cluster->energy() > T_EcalSuperClusterEnergy && cluster->size() > (unsigned int)T_EcalSuperClusterSize)
171  EcalTightId = true;
172  }
173  }
174 
175  if (EcalLooseId)
176  TheBeamHaloSummary->GetEcalHaloReport()[0] = 1;
177  if (EcalTightId)
178  TheBeamHaloSummary->GetEcalHaloReport()[1] = 1;
179 
180  // Hcal Specific Halo Data
181  Handle<HcalHaloData> TheHcalHaloData;
182  // iEvent.getByLabel(IT_HcalHaloData, TheHcalHaloData);
183  iEvent.getByToken(hcalhalodata_token_, TheHcalHaloData);
184 
185  const HcalHaloData HcalData = (*TheHcalHaloData.product());
186  const std::vector<PhiWedge>& HcalWedges = HcalData.GetPhiWedges();
187  bool HcalLooseId = false, HcalTightId = false;
188  for (std::vector<PhiWedge>::const_iterator iWedge = HcalWedges.begin(); iWedge != HcalWedges.end(); iWedge++) {
189  bool HcaliPhi = false;
190  //Loose Id
191  if (iWedge->Energy() > L_HcalPhiWedgeEnergy && iWedge->NumberOfConstituents() > L_HcalPhiWedgeConstituents &&
192  std::abs(iWedge->ZDirectionConfidence()) > L_HcalPhiWedgeConfidence) {
193  HcalLooseId = true;
194  HcaliPhi = true;
195  }
196 
197  //Tight Id
198  if (iWedge->Energy() > T_HcalPhiWedgeEnergy && iWedge->NumberOfConstituents() > T_HcalPhiWedgeConstituents &&
199  std::abs(iWedge->ZDirectionConfidence()) > T_HcalPhiWedgeConfidence) {
200  HcalTightId = true;
201  HcaliPhi = true;
202  }
203 
204  for (unsigned int i = 0; i < TheBeamHaloSummary->GetHcaliPhiSuspects().size(); i++) {
205  if (iWedge->iPhi() == TheBeamHaloSummary->GetHcaliPhiSuspects()[i]) {
206  HcaliPhi = false; // already stored this iPhi
207  continue;
208  }
209  }
210  if (HcaliPhi)
211  TheBeamHaloSummary->GetHcaliPhiSuspects().push_back(iWedge->iPhi());
212  }
213 
214  if (HcalLooseId)
215  TheBeamHaloSummary->GetHcalHaloReport()[0] = 1;
216  if (HcalTightId)
217  TheBeamHaloSummary->GetHcalHaloReport()[1] = 1;
218 
219  for (unsigned int i = 0; i < HcalData.getProblematicStrips().size(); i++) {
220  auto const& problematicStrip = HcalData.getProblematicStrips()[i];
221  if (problematicStrip.cellTowerIds.size() < (unsigned int)problematicStripMinLength)
222  continue;
223 
224  TheBeamHaloSummary->getProblematicStrips().push_back(problematicStrip);
225  }
226 
227  // Global Halo Data
228  Handle<GlobalHaloData> TheGlobalHaloData;
229  // iEvent.getByLabel(IT_GlobalHaloData, TheGlobalHaloData);
230  iEvent.getByToken(globalhalodata_token_, TheGlobalHaloData);
231 
232  bool GlobalLooseId = false;
233  bool GlobalTightId = false;
234  const GlobalHaloData GlobalData = (*TheGlobalHaloData.product());
235  const std::vector<PhiWedge>& MatchedHcalWedges = GlobalData.GetMatchedHcalPhiWedges();
236  const std::vector<PhiWedge>& MatchedEcalWedges = GlobalData.GetMatchedEcalPhiWedges();
237 
238  //Loose Id
239  if (!MatchedEcalWedges.empty() || !MatchedHcalWedges.empty())
240  GlobalLooseId = true;
241 
242  //Tight Id
243  for (std::vector<PhiWedge>::const_iterator iWedge = MatchedEcalWedges.begin(); iWedge != MatchedEcalWedges.end();
244  iWedge++) {
245  if (iWedge->NumberOfConstituents() > T_EcalPhiWedgeConstituents)
246  GlobalTightId = true;
247  if (std::abs(iWedge->ZDirectionConfidence()) > T_EcalPhiWedgeConfidence)
248  GlobalTightId = true;
249  }
250 
251  for (std::vector<PhiWedge>::const_iterator iWedge = MatchedHcalWedges.begin(); iWedge != MatchedHcalWedges.end();
252  iWedge++) {
253  if (iWedge->NumberOfConstituents() > T_HcalPhiWedgeConstituents)
254  GlobalTightId = true;
255  if (std::abs(iWedge->ZDirectionConfidence()) > T_HcalPhiWedgeConfidence)
256  GlobalTightId = true;
257  }
258 
259  if (GlobalLooseId)
260  TheBeamHaloSummary->GetGlobalHaloReport()[0] = 1;
261  if (GlobalTightId)
262  TheBeamHaloSummary->GetGlobalHaloReport()[1] = 1;
263 
264  //GlobalTight Id for 2016
265  if ((GlobalData.GetSegmentIsEBCaloMatched() || GlobalData.GetHaloPatternFoundEB()) ||
266  (GlobalData.GetSegmentIsEECaloMatched() || GlobalData.GetHaloPatternFoundEE()) ||
267  (GlobalData.GetSegmentIsHBCaloMatched() || GlobalData.GetHaloPatternFoundHB()) ||
268  (GlobalData.GetSegmentIsHECaloMatched() || GlobalData.GetHaloPatternFoundHE()))
269  TheBeamHaloSummary->GetGlobalHaloReport()[2] = 1;
270 
271  //Global SuperTight Id for 2016
272  if ((GlobalData.GetSegmentIsEBCaloMatched() && GlobalData.GetHaloPatternFoundEB()) ||
273  (GlobalData.GetSegmentIsEECaloMatched() && GlobalData.GetHaloPatternFoundEE()) ||
274  (GlobalData.GetSegmentIsHBCaloMatched() && GlobalData.GetHaloPatternFoundHB()) ||
275  (GlobalData.GetSegmentIsHECaloMatched() && GlobalData.GetHaloPatternFoundHE()))
276  TheBeamHaloSummary->GetGlobalHaloReport()[3] = 1;
277 
278  iEvent.put(std::move(TheBeamHaloSummary));
279  return;
280 }
281 
282 BeamHaloSummaryProducer::~BeamHaloSummaryProducer() {}
mps_fire.i
i
Definition: mps_fire.py:428
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
reco::GlobalHaloData::GetHaloPatternFoundEE
bool GetHaloPatternFoundEE() const
Definition: GlobalHaloData.h:60
edm::Handle::product
T const * product() const
Definition: Handle.h:70
edm
HLT enums.
Definition: AlignableModifier.h:19
reco::EcalHaloData::GetShowerShapesAngle
edm::ValueMap< float > & GetShowerShapesAngle()
Definition: EcalHaloData.h:44
reco::HcalHaloData
Definition: HcalHaloData.h:37
reco::GlobalHaloData::GetSegmentIsEBCaloMatched
bool GetSegmentIsEBCaloMatched() const
Definition: GlobalHaloData.h:56
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
edm::Handle
Definition: AssociativeIterator.h:50
reco::GlobalHaloData::GetMatchedHcalPhiWedges
std::vector< PhiWedge > & GetMatchedHcalPhiWedges()
Definition: GlobalHaloData.h:39
edm::Ref< SuperClusterCollection >
reco::GlobalHaloData::GetHaloPatternFoundHE
bool GetHaloPatternFoundHE() const
Definition: GlobalHaloData.h:62
reco::GlobalHaloData::GetSegmentIsHBCaloMatched
bool GetSegmentIsHBCaloMatched() const
Definition: GlobalHaloData.h:54
BeamHaloSummaryProducer.h
BeamHaloSummary_cfi.problematicStripMinLength
problematicStripMinLength
Definition: BeamHaloSummary_cfi.py:46
reco::HcalHaloData::getProblematicStrips
const std::vector< HaloTowerStrip > & getProblematicStrips() const
Definition: HcalHaloData.h:49
edm::ParameterSet
Definition: ParameterSet.h:47
reco::GlobalHaloData
Definition: GlobalHaloData.h:17
createfilelist.int
int
Definition: createfilelist.py:10
iEvent
int iEvent
Definition: GenABIO.cc:224
reco::EcalHaloData
Definition: EcalHaloData.h:21
edm::EventSetup
Definition: EventSetup.h:58
reco::HcalHaloData::GetPhiWedges
const std::vector< PhiWedge > & GetPhiWedges() const
Definition: HcalHaloData.h:45
reco::GlobalHaloData::GetHaloPatternFoundHB
bool GetHaloPatternFoundHB() const
Definition: GlobalHaloData.h:61
reco::GlobalHaloData::GetSegmentIsEECaloMatched
bool GetSegmentIsEECaloMatched() const
Definition: GlobalHaloData.h:57
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
reco::GlobalHaloData::GetHaloPatternFoundEB
bool GetHaloPatternFoundEB() const
Definition: GlobalHaloData.h:59
edm::ValueMap< float >
reco::EcalHaloData::GetSuperClusters
edm::RefVector< reco::SuperClusterCollection > & GetSuperClusters()
Definition: EcalHaloData.h:37
angle
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11
reco::GlobalHaloData::GetSegmentIsHECaloMatched
bool GetSegmentIsHECaloMatched() const
Definition: GlobalHaloData.h:55
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
reco::CSCHaloData
Definition: CSCHaloData.h:24
ConsumesCollector.h
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
reco::EcalHaloData::GetShowerShapesRoundness
edm::ValueMap< float > & GetShowerShapesRoundness()
Definition: EcalHaloData.h:41
L1TMuon::TriggerPrimitive::CSCData
Definition: MuonTriggerPrimitive.h:93
reco::GlobalHaloData::GetMatchedEcalPhiWedges
std::vector< PhiWedge > & GetMatchedEcalPhiWedges()
Definition: GlobalHaloData.h:42
edm::Event
Definition: Event.h:73
edm::RefVector::size
size_type size() const
Size of the RefVector.
Definition: RefVector.h:102
edm::InputTag
Definition: InputTag.h:15