56 pn_(ps.getParameter<std::string>(
"processName")),
57 selector_(edm::ProcessNameSelector(pn_)),
59 filterTagsEvent_(pn_!=
"*"),
60 filterTagsGlobal_(pn_!=
"*"),
61 collectionTagsEvent_(pn_!=
"*"),
62 collectionTagsGlobal_(pn_!=
"*"),
79 edm::LogError(
"TriggerSummaryProducerAOD") <<
"HLT Error: TriggerNamesService pointer = 0!";
83 edm::LogError(
"TriggerSummaryProducerAOD") <<
"HLT Error: TriggerNamesService not available!";
92 LogDebug(
"TriggerSummaryProducerAOD") <<
"Using process name: '" <<
pn_ <<
"'";
97 produces<trigger::TriggerEvent>();
111 tokenizeTag(
const std::string&
tag, std::string&
label, std::string& instance, std::string&
process){
115 const char token(
':');
120 if (i1==string::npos) {
124 instance=label.substr(i1+1);
127 if (i2==string::npos) {
130 process=instance.substr(i2+1);
143 using namespace reco;
144 using namespace l1extra;
145 using namespace trigger;
151 const unsigned int nfob(
fobs_.size());
152 LogTrace(
"TriggerSummaryProducerAOD") <<
"Number of filter objects found: " << nfob;
154 string tagLabel,tagInstance,tagProcess;
166 for (
unsigned int ifob=0; ifob!=nfob; ++ifob) {
168 const vector<string>& collectionTags_(
fobs_[ifob]->getCollectionTagsAsStrings());
169 const unsigned int ncol(collectionTags_.size());
174 const string& instance (
fobs_[ifob].provenance()->productInstanceName());
175 const string&
process (
fobs_[ifob].provenance()->processName());
177 for (
unsigned int icol=0; icol!=ncol; ++icol) {
179 tokenizeTag(collectionTags_[icol],tagLabel,tagInstance,tagProcess);
186 LogError(
"TriggerSummaryProducerAOD")
187 <<
"Mismatch in number of filter tags: "
200 LogTrace(
"TriggerSummaryProducerAOD") <<
"Number of unique collections requested " << nc;
203 for ( InputTagSet::const_iterator ci=cb; ci!=ce; ++ci) {
204 LogTrace(
"TriggerSummaryProducerAOD") << distance(cb,ci) <<
" " << ci->encode();
207 LogTrace(
"TriggerSummaryProducerAOD") <<
"Number of unique filters requested " << nf;
210 for ( InputTagSet::const_iterator fi=
fb; fi!=fe; ++fi) {
211 LogTrace(
"TriggerSummaryProducerAOD") << distance(
fb,fi) <<
" " << fi->encode();
225 fillTriggerObjectCollections< RecoEcalCandidateCollection>(
iEvent);
226 fillTriggerObjectCollections< ElectronCollection>(
iEvent);
227 fillTriggerObjectCollections< RecoChargedCandidateCollection>(
iEvent);
228 fillTriggerObjectCollections< CaloJetCollection>(
iEvent);
229 fillTriggerObjectCollections< CompositeCandidateCollection>(
iEvent);
230 fillTriggerObjectCollections< METCollection>(
iEvent);
231 fillTriggerObjectCollections< CaloMETCollection>(
iEvent);
232 fillTriggerObjectCollections<IsolatedPixelTrackCandidateCollection>(
iEvent);
234 fillTriggerObjectCollections< L1EmParticleCollection>(
iEvent);
235 fillTriggerObjectCollections< L1MuonParticleCollection>(
iEvent);
236 fillTriggerObjectCollections< L1JetParticleCollection>(
iEvent);
237 fillTriggerObjectCollections< L1EtMissParticleCollection>(
iEvent);
238 fillTriggerObjectCollections< L1HFRingsCollection>(
iEvent);
240 const unsigned int nk(
tags_.size());
241 LogDebug(
"TriggerSummaryProducerAOD") <<
"Number of collections found: " << nk;
242 const unsigned int no(
toc_.size());
243 LogDebug(
"TriggerSummaryProducerAOD") <<
"Number of physics objects found: " << no;
251 product->addObjects(
toc_);
254 for (
unsigned int ifob=0; ifob!=nfob; ++ifob) {
257 const string& instance (
fobs_[ifob].provenance()->productInstanceName());
258 const string&
process (
fobs_[ifob].provenance()->processName());
275 product->addFilter(filterTag,
ids_,
keys_);
280 LogTrace(
"TriggerSummaryProducerAOD") <<
"Number of physics objects packed: " << ref->sizeObjects();
281 LogTrace(
"TriggerSummaryProducerAOD") <<
"Number of filter objects packed: " << ref->sizeFilters();
285 template <
typename C>
294 using namespace reco;
295 using namespace l1extra;
296 using namespace trigger;
298 vector<Handle<C> > collections;
300 const unsigned int nc(collections.size());
302 for (
unsigned int ic=0; ic!=nc; ++ic) {
303 const Provenance& provenance(*(collections[ic].provenance()));
307 const InputTag collectionTag(label,instance,process);
310 const ProductID pid(collections[ic].provenance()->productID());
312 LogError(
"TriggerSummaryProducerAOD") <<
"Duplicate pid!";
315 const unsigned int n(collections[ic]->
size());
316 for (
unsigned int i=0;
i!=
n; ++
i) {
319 tags_.push_back(collectionTag.encode());
326 template <
typename T>
329 using namespace trigger;
337 using namespace l1extra;
338 using namespace trigger;
341 object.hfEtSum(L1HFRings::kRing1PosEta),
342 object.hfEtSum(L1HFRings::kRing1NegEta),
343 object.hfEtSum(L1HFRings::kRing2PosEta),
344 object.hfEtSum(L1HFRings::kRing2NegEta) ) );
346 object.hfBitCount(L1HFRings::kRing1PosEta),
347 object.hfBitCount(L1HFRings::kRing1NegEta),
348 object.hfBitCount(L1HFRings::kRing2PosEta),
349 object.hfBitCount(L1HFRings::kRing2NegEta) ) );
356 using namespace l1extra;
357 using namespace trigger;
360 if (
object.
type()==L1EtMissParticle::kMET) {
362 }
else if (
object.
type()==L1EtMissParticle::kMHT) {
373 using namespace reco;
374 using namespace trigger;
386 using namespace reco;
387 using namespace trigger;
397 template <
typename C>
406 using namespace reco;
407 using namespace l1extra;
408 using namespace trigger;
410 if (ids.size()!=refs.size()) {
411 LogError(
"TriggerSummaryProducerAOD") <<
"Vector length is different: "
412 << ids.size() <<
" " << refs.size();
415 const unsigned int n(
min(ids.size(),refs.size()));
416 for (
unsigned int i=0;
i!=
n; ++
i) {
422 LogError(
"TriggerSummaryProducerAOD")
424 <<
" FilterTag/Key: " << tag.
encode()
426 <<
" CollectionTag/Key: "
428 <<
"/" << refs[
i].key()
429 <<
" CollectionType: " <<
typeid(
C).
name();
438 template <
typename C>
449 using namespace trigger;
452 keys_.push_back(offset+2*ref.
key()+1);
454 keys_.push_back(offset+2*ref.
key()+0);
463 using namespace trigger;
466 keys_.push_back(offset+2*ref.
key()+1);
468 keys_.push_back(offset+2*ref.
key()+0);
477 using namespace trigger;
480 keys_.push_back(offset+4*ref.
key()+1);
482 keys_.push_back(offset+4*ref.
key()+2);
484 keys_.push_back(offset+4*ref.
key()+3);
486 keys_.push_back(offset+4*ref.
key()+0);
495 using namespace trigger;
498 keys_.push_back(offset+4*ref.
key()+1);
500 keys_.push_back(offset+4*ref.
key()+2);
502 keys_.push_back(offset+4*ref.
key()+3);
504 keys_.push_back(offset+4*ref.
key()+0);
515 using namespace trigger;
518 LogVerbatim(
"TriggerSummaryProducerAOD") <<
"TriggerSummaryProducerAOD::endJob - accumulated tags:" << endl;
522 LogVerbatim(
"TriggerSummaryProducerAOD") <<
" Overall number of Collections/Filters: "
523 << nc <<
"/" << nf << endl;
525 LogVerbatim(
"TriggerSummaryProducerAOD") <<
" The collections: " << nc << endl;
528 for ( InputTagSet::const_iterator ci=cb; ci!=ce; ++ci) {
529 LogVerbatim(
"TriggerSummaryProducerAOD") <<
" " << distance(cb,ci) <<
" " << ci->encode() << endl;
532 LogVerbatim(
"TriggerSummaryProducerAOD") <<
" The filters:" << nf << endl;
535 for ( InputTagSet::const_iterator fi=
fb; fi!=fe; ++fi) {
536 LogVerbatim(
"TriggerSummaryProducerAOD") <<
" " << distance(
fb,fi) <<
" " << fi->encode() << endl;
539 LogVerbatim(
"TriggerSummaryProducerAOD") <<
"TriggerSummaryProducerAOD::endJob." << endl;
virtual void produce(edm::Event &, const edm::EventSetup &)
std::string const & getProcessName() const
The single EDProduct to be saved for each event (AOD case)
trigger::TriggerObjectCollection toc_
trigger object collection
~TriggerSummaryProducerAOD()
std::vector< bool > maskFilters_
packing decision
std::set< edm::InputTag, OrderInputTag > InputTagSet
edm::ProcessNameSelector selector_
selector for getMany methods
void fillFilterObjectMember(const int &, const int &, const edm::Ref< C > &)
edm::service::TriggerNamesService * tns_
the pointer to the current TriggerNamesService
void fillTriggerObjectCollections(const edm::Event &)
std::vector< std::string > tags_
std::string const & processName() const
Single trigger physics object (e.g., an isolated muon)
TriggerSummaryProducerAOD(const edm::ParameterSet &)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
void getMany(SelectorBase const &sel, std::vector< Handle< PROD > > &results) const
void fillTriggerObject(const T &)
std::map< edm::ProductID, unsigned int > offset_
global map for indices into toc_: offset per input L3 collection
unsigned int offset(bool)
void fillFilterObjectMembers(const edm::Event &, const edm::InputTag &tag, const trigger::Vids &, const std::vector< edm::Ref< C > > &)
std::vector< edm::Handle< trigger::TriggerFilterObjectWithRefs > > fobs_
handles to the filter objects
key_type key() const
Accessor for product key.
std::string const & moduleLabel() const
InputTagSet collectionTagsEvent_
list of L3 collection tags
std::string pn_
process name
InputTagSet collectionTagsGlobal_
InputTagSet filterTagsEvent_
list of L3 filter tags
std::string const & productInstanceName() const
Provenance getProvenance(BranchID const &theID) const
tuple size
Write out results.
InputTagSet filterTagsGlobal_
const std::string * moduleLabel() const