CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HLTFiltCand.cc
Go to the documentation of this file.
1 
13 
15 
30 
35 
38 
40 
41 //
42 // constructors and destructor
43 //
44 
46  photTag_ (iConfig.getParameter<edm::InputTag>("photTag")),
47  elecTag_ (iConfig.getParameter<edm::InputTag>("elecTag")),
48  muonTag_ (iConfig.getParameter<edm::InputTag>("muonTag")),
49  tausTag_ (iConfig.getParameter<edm::InputTag>("tausTag")),
50  jetsTag_ (iConfig.getParameter<edm::InputTag>("jetsTag")),
51  metsTag_ (iConfig.getParameter<edm::InputTag>("metsTag")),
52  mhtsTag_ (iConfig.getParameter<edm::InputTag>("mhtsTag")),
53  trckTag_ (iConfig.getParameter<edm::InputTag>("trckTag")),
54  ecalTag_ (iConfig.getParameter<edm::InputTag>("ecalTag")),
55  min_Pt_ (iConfig.getParameter<double>("MinPt"))
56 {
57  LogDebug("") << "MinPt cut " << min_Pt_
58  << " g: " << photTag_.encode()
59  << " e: " << elecTag_.encode()
60  << " m: " << muonTag_.encode()
61  << " t: " << tausTag_.encode()
62  << " j: " << jetsTag_.encode()
63  << " M: " << metsTag_.encode()
64  << " H: " << mhtsTag_.encode()
65  <<" TR: " << trckTag_.encode()
66  <<" SC: " << ecalTag_.encode()
67  ;
68 }
69 
71 {
72 }
73 
74 //
75 // member functions
76 //
77 
78 // ------------ method called to produce the data ------------
79 bool
81 {
82  using namespace std;
83  using namespace edm;
84  using namespace reco;
85  using namespace trigger;
86 
87  // All HLT filters must create and fill an HLT filter object,
88  // recording any reconstructed physics objects satisfying (or not)
89  // this HLT filter, and place it in the Event.
90 
91  // The filter object
92  if (saveTags()) {
93  filterproduct.addCollectionTag(photTag_);
94  filterproduct.addCollectionTag(elecTag_);
95  filterproduct.addCollectionTag(muonTag_);
96  filterproduct.addCollectionTag(tausTag_);
97  filterproduct.addCollectionTag(jetsTag_);
98  filterproduct.addCollectionTag(metsTag_);
99  filterproduct.addCollectionTag(mhtsTag_);
100  filterproduct.addCollectionTag(trckTag_);
101  filterproduct.addCollectionTag(ecalTag_);
102  }
103 
104  // Specific filter code
105 
106  // get hold of products from Event
107 
117 
118  iEvent.getByLabel(photTag_,photons );
119  iEvent.getByLabel(elecTag_,electrons);
120  iEvent.getByLabel(muonTag_,muons );
121  iEvent.getByLabel(tausTag_,taus );
122  iEvent.getByLabel(jetsTag_,jets );
123  iEvent.getByLabel(metsTag_,mets );
124  iEvent.getByLabel(mhtsTag_,mhts );
125  iEvent.getByLabel(trckTag_,trcks );
126  iEvent.getByLabel(ecalTag_,ecals );
127 
128 
129  // look for at least one g,e,m,t,j,M,H,TR,SC above its pt cut
130 
131  // photons
132  int nphot(0);
133  RecoEcalCandidateCollection::const_iterator aphot(photons->begin());
134  RecoEcalCandidateCollection::const_iterator ophot(photons->end());
135  RecoEcalCandidateCollection::const_iterator iphot;
136  for (iphot=aphot; iphot!=ophot; iphot++) {
137  if (iphot->pt() >= min_Pt_) {
138  nphot++;
139  RecoEcalCandidateRef ref(RecoEcalCandidateRef(photons,distance(aphot,iphot)));
140  filterproduct.addObject(TriggerPhoton,ref);
141  }
142  }
143 
144  // electrons
145  int nelec(0);
146  ElectronCollection::const_iterator aelec(electrons->begin());
147  ElectronCollection::const_iterator oelec(electrons->end());
148  ElectronCollection::const_iterator ielec;
149  for (ielec=aelec; ielec!=oelec; ielec++) {
150  if (ielec->pt() >= min_Pt_) {
151  nelec++;
152  ElectronRef ref(ElectronRef(electrons,distance(aelec,ielec)));
153  filterproduct.addObject(-TriggerElectron,ref);
154  }
155  }
156 
157  // muon
158  int nmuon(0);
159  RecoChargedCandidateCollection::const_iterator amuon(muons->begin());
160  RecoChargedCandidateCollection::const_iterator omuon(muons->end());
161  RecoChargedCandidateCollection::const_iterator imuon;
162  for (imuon=amuon; imuon!=omuon; imuon++) {
163  if (imuon->pt() >= min_Pt_) {
164  nmuon++;
165  RecoChargedCandidateRef ref(RecoChargedCandidateRef(muons,distance(amuon,imuon)));
166  filterproduct.addObject(TriggerMuon,ref);
167  }
168  }
169 
170  // taus (are stored as jets)
171  int ntaus(0);
172  CaloJetCollection::const_iterator ataus(taus->begin());
173  CaloJetCollection::const_iterator otaus(taus->end());
174  CaloJetCollection::const_iterator itaus;
175  for (itaus=ataus; itaus!=otaus; itaus++) {
176  if (itaus->pt() >= min_Pt_) {
177  ntaus++;
178  CaloJetRef ref(CaloJetRef(taus,distance(ataus,itaus)));
179  filterproduct.addObject(-TriggerTau,ref);
180  }
181  }
182 
183  // jets
184  int njets(0);
185  CaloJetCollection::const_iterator ajets(jets->begin());
186  CaloJetCollection::const_iterator ojets(jets->end());
187  CaloJetCollection::const_iterator ijets;
188  for (ijets=ajets; ijets!=ojets; ijets++) {
189  if (ijets->pt() >= min_Pt_) {
190  njets++;
191  CaloJetRef ref(CaloJetRef(jets,distance(ajets,ijets)));
192  filterproduct.addObject(TriggerJet,ref);
193  }
194  }
195 
196  // mets
197  int nmets(0);
198  CaloMETCollection::const_iterator amets(mets->begin());
199  CaloMETCollection::const_iterator omets(mets->end());
200  CaloMETCollection::const_iterator imets;
201  for (imets=amets; imets!=omets; imets++) {
202  if (imets->pt() >= min_Pt_) {
203  nmets++;
204  CaloMETRef ref(CaloMETRef(mets,distance(amets,imets)));
205  filterproduct.addObject(TriggerMET,ref);
206  }
207  }
208 
209  // mhts
210  int nmhts(0);
211  METCollection::const_iterator amhts(mhts->begin());
212  METCollection::const_iterator omhts(mhts->end());
213  METCollection::const_iterator imhts;
214  for (imhts=amhts; imhts!=omhts; imhts++) {
215  if (imhts->pt() >= min_Pt_) {
216  nmhts++;
217  METRef ref(METRef(mhts,distance(amhts,imhts)));
218  filterproduct.addObject(TriggerMHT,ref);
219  }
220  }
221 
222  // trcks
223  int ntrck(0);
224  RecoChargedCandidateCollection::const_iterator atrcks(trcks->begin());
225  RecoChargedCandidateCollection::const_iterator otrcks(trcks->end());
226  RecoChargedCandidateCollection::const_iterator itrcks;
227  for (itrcks=atrcks; itrcks!=otrcks; itrcks++) {
228  if (itrcks->pt() >= min_Pt_) {
229  ntrck++;
230  RecoChargedCandidateRef ref(RecoChargedCandidateRef(trcks,distance(atrcks,itrcks)));
231  filterproduct.addObject(TriggerTrack,ref);
232  }
233  }
234 
235  // ecals
236  int necal(0);
237  RecoEcalCandidateCollection::const_iterator aecals(ecals->begin());
238  RecoEcalCandidateCollection::const_iterator oecals(ecals->end());
239  RecoEcalCandidateCollection::const_iterator iecals;
240  for (iecals=aecals; iecals!=oecals; iecals++) {
241  if (iecals->pt() >= min_Pt_) {
242  necal++;
243  RecoEcalCandidateRef ref(RecoEcalCandidateRef(ecals,distance(aecals,iecals)));
244  filterproduct.addObject(TriggerCluster,ref);
245  }
246  }
247 
248  // error case
249  // filterproduct.addObject(0,Ref<vector<int> >());
250 
251  // final filter decision:
252  const bool accept ( (nphot>0) && (nelec>0) && (nmuon>0) && (ntaus>0) &&
253  // (njets>0) && (nmets>0) && (nmhts>=0) && (ntrck>0) && (necal>0) );
254  (njets>0) && (nmets>0) && (ntrck>0) && (necal>0) );
255 
256  LogDebug("") << "Number of g/e/m/t/j/M/H/TR/SC objects accepted:"
257  << " " << nphot
258  << " " << nelec
259  << " " << nmuon
260  << " " << ntaus
261  << " " << njets
262  << " " << nmets
263  << " " << nmhts
264  << " " << ntrck
265  << " " << necal
266  ;
267 
268  // return with final filter decision
269  return accept;
270 }
#define LogDebug(id)
edm::InputTag elecTag_
Definition: HLTFiltCand.h:33
edm::InputTag muonTag_
Definition: HLTFiltCand.h:34
HLTFiltCand(const edm::ParameterSet &)
Definition: HLTFiltCand.cc:45
edm::Ref< RecoChargedCandidateCollection > RecoChargedCandidateRef
reference to an object in a collection of RecoChargedCandidate objects
edm::Ref< RecoEcalCandidateCollection > RecoEcalCandidateRef
reference to an object in a collection of RecoEcalCandidate objects
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:22
edm::Ref< ElectronCollection > ElectronRef
reference to an object in a collection of Electron objects
Definition: ElectronFwd.h:15
std::string encode() const
Definition: InputTag.cc:72
void addObject(int id, const reco::RecoEcalCandidateRef &ref)
setters for L3 collections: (id=physics type, and Ref&lt;C&gt;)
int iEvent
Definition: GenABIO.cc:243
edm::InputTag mhtsTag_
Definition: HLTFiltCand.h:38
vector< PseudoJet > jets
virtual bool hltFilter(edm::Event &, const edm::EventSetup &, trigger::TriggerFilterObjectWithRefs &filterproduct)
Definition: HLTFiltCand.cc:80
edm::InputTag metsTag_
Definition: HLTFiltCand.h:37
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
edm::Ref< CaloJetCollection > CaloJetRef
edm references
edm::InputTag photTag_
Definition: HLTFiltCand.h:32
void addCollectionTag(const edm::InputTag &collectionTag)
collectionTags
bool saveTags() const
Definition: HLTFilter.h:45
tuple muons
Definition: patZpeak.py:38
edm::InputTag jetsTag_
Definition: HLTFiltCand.h:36
edm::InputTag ecalTag_
Definition: HLTFiltCand.h:40
edm::Ref< CaloMETCollection > CaloMETRef
edm references
Definition: CaloMETFwd.h:14
edm::Ref< METCollection > METRef
edm references
Definition: METFwd.h:14
double min_Pt_
Definition: HLTFiltCand.h:42
edm::InputTag tausTag_
Definition: HLTFiltCand.h:35
edm::InputTag trckTag_
Definition: HLTFiltCand.h:39