CMS 3D CMS Logo

TriggerSummaryProducerAOD Class Reference

This class is an EDProducer making the HLT summary object for AOD. More...

#include <HLTrigger/HLTcore/interface/TriggerSummaryProducerAOD.h>

Inheritance diagram for TriggerSummaryProducerAOD:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

virtual void endJob ()
template<typename C>
void fillFilterObjects (const edm::Event &, const edm::InputTag &tag, const trigger::Vids &, const std::vector< edm::Ref< C > > &)
template<typename C>
void fillTriggerObjects (const edm::Event &)
virtual void produce (edm::Event &, const edm::EventSetup &)
 TriggerSummaryProducerAOD (const edm::ParameterSet &)
 ~TriggerSummaryProducerAOD ()

Private Attributes

std::vector< edm::InputTagcollectionTags_
 lists of L3 collection labels
InputTagSet collectionTagsEvent_
InputTagSet collectionTagsGlobal_
InputTagSet filterTagsEvent_
 list of L3 filter labels
InputTagSet filterTagsGlobal_
std::vector< edm::Handle
< trigger::TriggerFilterObjectWithRefs > > 
fobs_
 handles to the filter objects
trigger::Vids ids_
 ids
trigger::Keys keys_
 keys
std::vector< boolmaskFilters_
 packing decision
std::map< edm::ProductID, intoffset_
 global map for indices into toc_: offset per input L3 collection
std::string pn_
 process name
edm::ProcessNameSelector selector_
 selector for getMany methods
std::vector< edm::InputTagtags_
edm::service::TriggerNamesServicetns_
 the pointer to the current TriggerNamesService
trigger::TriggerObjectCollection toc_
 trigger object collection


Detailed Description

This class is an EDProducer making the HLT summary object for AOD.

See header file for documentation.

Date
2008/07/08 07:06:23
Revision
1.9

Author:
Martin Grunewald
Date
2008/10/11 13:13:58
Revision
1.29

Author:
Martin Grunewald

Definition at line 45 of file TriggerSummaryProducerAOD.h.


Constructor & Destructor Documentation

TriggerSummaryProducerAOD::TriggerSummaryProducerAOD ( const edm::ParameterSet ps  )  [explicit]

Definition at line 53 of file TriggerSummaryProducerAOD.cc.

References collectionTagsGlobal_, filterTagsGlobal_, edm::service::TriggerNamesService::getProcessName(), LogDebug, pn_, selector_, and tns_.

00053                                                                               : 
00054   pn_(ps.getParameter<std::string>("processName")),
00055   selector_(edm::ProcessNameSelector(pn_)),
00056   tns_(),
00057   collectionTags_(),
00058   collectionTagsEvent_(),
00059   collectionTagsGlobal_(),
00060   filterTagsEvent_(),
00061   filterTagsGlobal_(),
00062   toc_(),
00063   tags_(),
00064   offset_(),
00065   fobs_(),
00066   keys_(),
00067   ids_(),
00068   maskFilters_()
00069 {
00070   if (pn_=="@") {
00071     // use tns
00072     if (edm::Service<edm::service::TriggerNamesService>().isAvailable()) {
00073       // get tns pointer
00074       tns_ = edm::Service<edm::service::TriggerNamesService>().operator->();
00075       if (tns_!=0) {
00076         pn_=tns_->getProcessName();
00077       } else {
00078         LogDebug("") << "HLT Error: TriggerNamesService pointer = 0!";
00079         pn_="*";
00080       }
00081     } else {
00082       LogDebug("") << "HLT Error: TriggerNamesService not available!";
00083       pn_="*";
00084     }
00085     selector_=edm::ProcessNameSelector(pn_);
00086   }
00087   LogDebug("") << "Using process name: '" << pn_ <<"'";
00088 
00089   collectionTagsGlobal_.clear();
00090   filterTagsGlobal_.clear();
00091 
00092   produces<trigger::TriggerEvent>();
00093 
00094 }

TriggerSummaryProducerAOD::~TriggerSummaryProducerAOD (  ) 

Definition at line 96 of file TriggerSummaryProducerAOD.cc.

00097 {
00098 }


Member Function Documentation

void TriggerSummaryProducerAOD::endJob ( void   )  [virtual]

Reimplemented from edm::EDProducer.

Definition at line 367 of file TriggerSummaryProducerAOD.cc.

References ce, collectionTagsGlobal_, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), filterTagsGlobal_, and std.

00367                                        {
00368 
00369   using namespace std;
00370   using namespace edm;
00371   using namespace trigger;
00372 
00373   cout << "TriggerSummaryProducerAOD::endJob - accumulated tags:" << endl;
00374 
00375   const size_type nc(collectionTagsGlobal_.size());
00376   const size_type nf(filterTagsGlobal_.size());
00377   cout << " Overall number of Collections/Filters: "
00378        << nc << "/" << nf << endl;
00379 
00380   cout << " The collections:" << endl;
00381   const InputTagSet::const_iterator cb(collectionTagsGlobal_.begin());
00382   const InputTagSet::const_iterator ce(collectionTagsGlobal_.end());
00383   for (InputTagSet::const_iterator ci=cb; ci!=ce; ++ci) {
00384     cout << "  " << distance(cb,ci) << " " << ci->encode() << endl;
00385   }
00386 
00387   cout << " The filters:" << endl;
00388   const InputTagSet::const_iterator fb(filterTagsGlobal_.begin());
00389   const InputTagSet::const_iterator fe(filterTagsGlobal_.end());
00390   for (InputTagSet::const_iterator fi=fb; fi!=fe; ++fi) {
00391     cout << "  " << distance(fb,fi) << " " << fi->encode() << endl;
00392   }
00393 
00394   cout << "TriggerSummaryProducerAOD::endJob." << endl;
00395 
00396   return;
00397 
00398 }

template<typename C>
void TriggerSummaryProducerAOD::fillFilterObjects ( const edm::Event iEvent,
const edm::InputTag tag,
const trigger::Vids ids,
const std::vector< edm::Ref< C > > &  refs 
) [inline]

this routine takes a vector of Ref<C>s and determines the corresponding vector of keys (i.e., indices) into the TriggerObjectCollection

Definition at line 307 of file TriggerSummaryProducerAOD.cc.

References funct::C, GenMuonPlsPt100GeV_cfg::cout, edm::InputTag::encode(), lat::endl(), edm::Event::getProvenance(), i, ids_, getDQMSummary::key, keys_, label, n, name, offset_, process, HcalSimpleRecAlgoImpl::reco(), std, trigger::TriggerELongit, trigger::TriggerHT, trigger::TriggerL1ETT, trigger::TriggerL1HTT, and trigger::TriggerMETSig.

Referenced by produce().

00307                                                                                                                                                            {
00308 
00312 
00313   using namespace std;
00314   using namespace edm;
00315   using namespace reco;
00316   using namespace l1extra;
00317   using namespace trigger;
00318 
00319   assert(ids.size()==refs.size());
00320 
00321   const size_type n(ids.size());
00322   for (size_type i=0; i!=n; ++i) {
00323     const ProductID pid(refs[i].id());
00324     if (offset_.find(pid)==offset_.end()) {
00325       offset_[pid]=0;
00326       const string&    label(iEvent.getProvenance(pid).moduleLabel());
00327       const string& instance(iEvent.getProvenance(pid).productInstanceName());
00328       const string&  process(iEvent.getProvenance(pid).processName());
00329       cout << "#### Error in TriggerSummaryProducerAOD::fillFilterObject (unknown pid):"
00330            << " FilterTag/Key: " << tag.encode()
00331            << "/" << i
00332            << " CollectionTag/Key: "
00333            << InputTag(label,instance,process).encode()
00334            << "/" << refs[i].key()
00335            << " CollectionType: " << typeid(C).name()
00336            << endl;
00337     }
00338     assert(offset_.find(pid)!=offset_.end()); // else unknown pid
00339     // handle scalar L1EtMissParticle and [Calo]MET quantities
00340     if (typeid(C)==typeid(L1EtMissParticleCollection) ) {
00341       if (ids[i]==TriggerL1ETT) {
00342         keys_.push_back(offset_[pid]+3*refs[i].key()+1);
00343       } else if (ids[i]==TriggerL1HTT) {
00344         keys_.push_back(offset_[pid]+3*refs[i].key()+2);
00345       } else {
00346         keys_.push_back(offset_[pid]+3*refs[i].key()+0);
00347       }
00348     } else if ( (typeid(C)==typeid(    METCollection)) ||
00349                 (typeid(C)==typeid(CaloMETCollection)) ) {
00350       if (ids[i]==TriggerHT) {
00351         keys_.push_back(offset_[pid]+4*refs[i].key()+1);
00352       } else if (ids[i]==TriggerMETSig) {
00353         keys_.push_back(offset_[pid]+4*refs[i].key()+2);
00354       } else if (ids[i]==TriggerELongit) {
00355         keys_.push_back(offset_[pid]+4*refs[i].key()+3);
00356       } else {
00357         keys_.push_back(offset_[pid]+4*refs[i].key()+0);
00358       }
00359     } else {
00360       keys_.push_back(offset_[pid]+refs[i].key());
00361     }
00362     ids_.push_back(ids[i]);
00363   }
00364 
00365 }

template<typename C>
void TriggerSummaryProducerAOD::fillTriggerObjects ( const edm::Event iEvent  )  [inline]

this routine accesses the original (L3) collections (with C++ typename C), extracts 4-momentum and id, and packs this up

end loop over tags

end loop over handles

Definition at line 242 of file TriggerSummaryProducerAOD.cc.

References funct::C, collectionTagsEvent_, edm::Event::getMany(), i, keys_, label, CaloMET_cfi::met, moduleLabel(), n, offset_, pn_, process, HcalSimpleRecAlgoImpl::reco(), selector_, size, std, tags_, te, ti, toc_, trigger::TriggerELongit, trigger::TriggerHT, trigger::TriggerL1ETT, trigger::TriggerL1HTT, and trigger::TriggerMETSig.

00242                                                                          {
00243 
00246 
00247   using namespace std;
00248   using namespace edm;
00249   using namespace reco;
00250   using namespace l1extra;
00251   using namespace trigger;
00252 
00253   vector<Handle<C> > collections;
00254   iEvent.getMany(selector_,collections);
00255 
00256   const size_type nc(collections.size());
00257   for (size_type ic=0; ic!=nc; ++ic) {
00258     const string& label    (collections[ic].provenance()->moduleLabel());
00259     const string& instance (collections[ic].provenance()->productInstanceName());
00260     const string& process  (collections[ic].provenance()->processName());
00261     const InputTag collectionTag(InputTag(label,instance,process));
00262 
00263     const InputTagSet::const_iterator tb(collectionTagsEvent_.begin());
00264     const InputTagSet::const_iterator te(collectionTagsEvent_.end());
00265     for (InputTagSet::const_iterator ti=tb; ti!=te; ++ti) {
00266       const string& tagLabel    (ti->label());
00267       const string& tagInstance (ti->instance());
00268       const string& tagProcess  (ti->process());
00269       if (
00270           (label   ==tagLabel   ) &&
00271           (instance==tagInstance) &&
00272           ((process ==tagProcess )||(tagProcess=="")||(pn_=="*"))
00273           ) {
00274         const ProductID pid(collections[ic].provenance()->productID());
00275         assert(offset_.find(pid)==offset_.end()); // else duplicate pid
00276         offset_[pid]=toc_.size();
00277         const size_type n(collections[ic]->size());
00278         for (size_type i=0; i!=n; ++i) {
00279           toc_.push_back(TriggerObject( (*collections[ic])[i] ));
00280           if (typeid(C)==typeid(L1EtMissParticleCollection) ) {
00281             // add scalar L1EtMissParticle quntities
00282             const L1EtMissParticle* l1met(dynamic_cast<const L1EtMissParticle*>( &(*collections[ic])[i]) );
00283             // store each scalar L1EtMissParticle observable in the pt_
00284             // component of a new TriggerObject
00285             toc_.push_back(TriggerObject(TriggerL1ETT,l1met->etTotal(),0.0,0.0,0.0));
00286             toc_.push_back(TriggerObject(TriggerL1HTT,l1met->etHad()  ,0.0,0.0,0.0));
00287           } else if ( (typeid(C)==typeid(    METCollection)) ||
00288                       (typeid(C)==typeid(CaloMETCollection)) ) {
00289             // add scalar [Calo]MET quantities
00290             const MET* met(dynamic_cast<const MET*>( &(*collections[ic])[i]) );
00291             // store each scalar [Calo]MET observable in the pt_
00292             // component of a new TriggerObject
00293             toc_.push_back(TriggerObject(TriggerHT     ,met->sumEt()         ,0.0,0.0,0.0));
00294             toc_.push_back(TriggerObject(TriggerMETSig ,met->mEtSig()        ,0.0,0.0,0.0));
00295             toc_.push_back(TriggerObject(TriggerELongit,met->e_longitudinal(),0.0,0.0,0.0));
00296           }
00297         }
00298         tags_.push_back(collectionTag);
00299         keys_.push_back(toc_.size());
00300         break;
00301       }
00302     } 
00303   } 
00304 }

void TriggerSummaryProducerAOD::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

get hold of filter objects

check whether collection tags are recorded in filterobjects; if so, these are L3 collections to be packed up, and the corresponding filter is a L3 filter also to be packed up. Record the InputTags of those L3 filters and L3 collections.

Now the processing: first trigger objects from L3 collections, then L3 filter objects

create trigger objects, fill triggerobjectcollection and offset map

construct single AOD product, reserving capacity

fill trigger object collection

fill the L3 filter objects

Implements edm::EDProducer.

Definition at line 106 of file TriggerSummaryProducerAOD.cc.

References ce, collectionTags_, collectionTagsEvent_, collectionTagsGlobal_, fillFilterObjects(), filterTagsEvent_, filterTagsGlobal_, fobs_, edm::Event::getMany(), icol, ids_, keys_, label, LogDebug, LogTrace, maskFilters_, moduleLabel(), offset_, pn_, process, edm::Event::put(), HcalSimpleRecAlgoImpl::reco(), selector_, std, tags_, and toc_.

00107 {
00108    using namespace std;
00109    using namespace edm;
00110    using namespace reco;
00111    using namespace l1extra;
00112    using namespace trigger;
00113 
00116    fobs_.clear();
00117    iEvent.getMany(selector_,fobs_);
00118    const size_type nfob(fobs_.size());
00119    LogTrace("") << "Number of filter  objects found: " << nfob;
00120 
00126    maskFilters_.clear();
00127    maskFilters_.resize(nfob,false);
00128    collectionTagsEvent_.clear();
00129    filterTagsEvent_.clear();
00130    for (size_type ifob=0; ifob!=nfob; ++ifob) {
00131      maskFilters_[ifob]=false;
00132      collectionTags_.clear();
00133      fobs_[ifob]->getCollectionTags(collectionTags_);
00134      const size_type ncol(collectionTags_.size());
00135      if (ncol>0) {
00136        maskFilters_[ifob]=true;
00137        const string& label    (fobs_[ifob].provenance()->moduleLabel());
00138        const string& instance (fobs_[ifob].provenance()->productInstanceName());
00139        const string& process  (fobs_[ifob].provenance()->processName());
00140        filterTagsEvent_.insert(InputTag(label,instance,process));
00141 
00142        for (size_type icol=0; icol!=ncol; ++icol) {
00143          const string&    label(collectionTags_[icol].label());
00144          const string& instance(collectionTags_[icol].instance());
00145          collectionTagsEvent_.insert(InputTag(label,instance,pn_));
00146        }
00147      }
00148    }
00149    collectionTagsGlobal_.insert(collectionTagsEvent_.begin(),collectionTagsEvent_.end());
00150    filterTagsGlobal_.insert(filterTagsEvent_.begin(),filterTagsEvent_.end());
00151 
00153    const size_type nc(collectionTagsEvent_.size());
00154    LogTrace("") << "Number of unique collections requested " << nc;
00155    //   cout    << "Number of unique collections requested " << nc << endl;
00156    const InputTagSet::const_iterator cb(collectionTagsEvent_.begin());
00157    const InputTagSet::const_iterator ce(collectionTagsEvent_.end());
00158    for (InputTagSet::const_iterator ci=cb; ci!=ce; ++ci) {
00159      LogTrace("") << distance(cb,ci) << " " << ci->encode();
00160      //   cout    << distance(cb,ci) << " " << ci->encode() << endl;
00161    }
00162 
00164    const size_type nf(filterTagsEvent_.size());
00165    LogTrace("") << "Number of unique filters requested " << nf;
00166    //   cout    << "Number of unique filters requested " << nf << endl;
00167    const InputTagSet::const_iterator fb(filterTagsEvent_.begin());
00168    const InputTagSet::const_iterator fe(filterTagsEvent_.end());
00169    for (InputTagSet::const_iterator fi=fb; fi!=fe; ++fi) {
00170      LogTrace("") << distance(fb,fi) << " " << fi->encode();
00171      //   cout    << distance(fb,fi) << " " << fi->encode() << endl;
00172    }
00173 
00179    toc_.clear();
00180    tags_.clear();
00181    keys_.clear();
00182    offset_.clear();
00183    fillTriggerObjects<          RecoEcalCandidateCollection>(iEvent);
00184    fillTriggerObjects<                   ElectronCollection>(iEvent);
00185    fillTriggerObjects<       RecoChargedCandidateCollection>(iEvent);
00186    fillTriggerObjects<                    CaloJetCollection>(iEvent);
00187    fillTriggerObjects<         CompositeCandidateCollection>(iEvent);
00188    fillTriggerObjects<                        METCollection>(iEvent);
00189    fillTriggerObjects<                    CaloMETCollection>(iEvent);
00190    fillTriggerObjects<IsolatedPixelTrackCandidateCollection>(iEvent);
00192    fillTriggerObjects<               L1EmParticleCollection>(iEvent);
00193    fillTriggerObjects<             L1MuonParticleCollection>(iEvent);
00194    fillTriggerObjects<              L1JetParticleCollection>(iEvent);
00195    fillTriggerObjects<           L1EtMissParticleCollection>(iEvent);
00197    const size_type nk(tags_.size());
00198    LogDebug("") << "Number of collections found: " << nk;
00199    const size_type no(toc_.size());
00200    LogDebug("") << "Number of physics objects found: " << no;
00201 
00204    auto_ptr<TriggerEvent> product(new TriggerEvent(pn_,nk,no,nf));
00205 
00207    product->addCollections(tags_,keys_);
00208    product->addObjects(toc_);
00209 
00211    for (size_type ifob=0; ifob!=nfob; ++ifob) {
00212      if (maskFilters_[ifob]) {
00213        const string& label    (fobs_[ifob].provenance()->moduleLabel());
00214        const string& instance (fobs_[ifob].provenance()->productInstanceName());
00215        const string& process  (fobs_[ifob].provenance()->processName());
00216        const InputTag filterTag(InputTag(label,instance,process));
00217        ids_.clear();
00218        keys_.clear();
00219        fillFilterObjects(iEvent,filterTag,fobs_[ifob]->photonIds()   ,fobs_[ifob]->photonRefs());
00220        fillFilterObjects(iEvent,filterTag,fobs_[ifob]->electronIds() ,fobs_[ifob]->electronRefs());
00221        fillFilterObjects(iEvent,filterTag,fobs_[ifob]->muonIds()     ,fobs_[ifob]->muonRefs());
00222        fillFilterObjects(iEvent,filterTag,fobs_[ifob]->jetIds()      ,fobs_[ifob]->jetRefs());
00223        fillFilterObjects(iEvent,filterTag,fobs_[ifob]->compositeIds(),fobs_[ifob]->compositeRefs());
00224        fillFilterObjects(iEvent,filterTag,fobs_[ifob]->basemetIds()  ,fobs_[ifob]->basemetRefs());
00225        fillFilterObjects(iEvent,filterTag,fobs_[ifob]->calometIds()  ,fobs_[ifob]->calometRefs());
00226        fillFilterObjects(iEvent,filterTag,fobs_[ifob]->pixtrackIds() ,fobs_[ifob]->pixtrackRefs());
00227        fillFilterObjects(iEvent,filterTag,fobs_[ifob]->l1emIds()     ,fobs_[ifob]->l1emRefs());
00228        fillFilterObjects(iEvent,filterTag,fobs_[ifob]->l1muonIds()   ,fobs_[ifob]->l1muonRefs());
00229        fillFilterObjects(iEvent,filterTag,fobs_[ifob]->l1jetIds()    ,fobs_[ifob]->l1jetRefs());
00230        fillFilterObjects(iEvent,filterTag,fobs_[ifob]->l1etmissIds() ,fobs_[ifob]->l1etmissRefs());
00231        product->addFilter(filterTag,ids_,keys_);
00232      }
00233    }
00234 
00235    OrphanHandle<TriggerEvent> ref = iEvent.put(product);
00236    LogTrace("") << "Number of physics objects packed: " << ref->sizeObjects();
00237    LogTrace("") << "Number of filter  objects packed: " << ref->sizeFilters();
00238 
00239 }


Member Data Documentation

std::vector<edm::InputTag> TriggerSummaryProducerAOD::collectionTags_ [private]

lists of L3 collection labels

Definition at line 73 of file TriggerSummaryProducerAOD.h.

Referenced by produce().

InputTagSet TriggerSummaryProducerAOD::collectionTagsEvent_ [private]

Definition at line 75 of file TriggerSummaryProducerAOD.h.

Referenced by fillTriggerObjects(), and produce().

InputTagSet TriggerSummaryProducerAOD::collectionTagsGlobal_ [private]

Definition at line 76 of file TriggerSummaryProducerAOD.h.

Referenced by endJob(), produce(), and TriggerSummaryProducerAOD().

InputTagSet TriggerSummaryProducerAOD::filterTagsEvent_ [private]

list of L3 filter labels

Definition at line 78 of file TriggerSummaryProducerAOD.h.

Referenced by produce().

InputTagSet TriggerSummaryProducerAOD::filterTagsGlobal_ [private]

Definition at line 79 of file TriggerSummaryProducerAOD.h.

Referenced by endJob(), produce(), and TriggerSummaryProducerAOD().

std::vector<edm::Handle<trigger::TriggerFilterObjectWithRefs> > TriggerSummaryProducerAOD::fobs_ [private]

handles to the filter objects

Definition at line 88 of file TriggerSummaryProducerAOD.h.

Referenced by produce().

trigger::Vids TriggerSummaryProducerAOD::ids_ [private]

ids

Definition at line 92 of file TriggerSummaryProducerAOD.h.

Referenced by fillFilterObjects(), and produce().

trigger::Keys TriggerSummaryProducerAOD::keys_ [private]

keys

Definition at line 90 of file TriggerSummaryProducerAOD.h.

Referenced by fillFilterObjects(), fillTriggerObjects(), and produce().

std::vector<bool> TriggerSummaryProducerAOD::maskFilters_ [private]

packing decision

Definition at line 95 of file TriggerSummaryProducerAOD.h.

Referenced by produce().

std::map<edm::ProductID,int> TriggerSummaryProducerAOD::offset_ [private]

global map for indices into toc_: offset per input L3 collection

Definition at line 85 of file TriggerSummaryProducerAOD.h.

Referenced by fillFilterObjects(), fillTriggerObjects(), and produce().

std::string TriggerSummaryProducerAOD::pn_ [private]

process name

Definition at line 64 of file TriggerSummaryProducerAOD.h.

Referenced by fillTriggerObjects(), produce(), and TriggerSummaryProducerAOD().

edm::ProcessNameSelector TriggerSummaryProducerAOD::selector_ [private]

selector for getMany methods

Definition at line 67 of file TriggerSummaryProducerAOD.h.

Referenced by fillTriggerObjects(), produce(), and TriggerSummaryProducerAOD().

std::vector<edm::InputTag> TriggerSummaryProducerAOD::tags_ [private]

Definition at line 83 of file TriggerSummaryProducerAOD.h.

Referenced by fillTriggerObjects(), and produce().

edm::service::TriggerNamesService* TriggerSummaryProducerAOD::tns_ [private]

the pointer to the current TriggerNamesService

Definition at line 70 of file TriggerSummaryProducerAOD.h.

Referenced by TriggerSummaryProducerAOD().

trigger::TriggerObjectCollection TriggerSummaryProducerAOD::toc_ [private]

trigger object collection

Definition at line 82 of file TriggerSummaryProducerAOD.h.

Referenced by fillTriggerObjects(), and produce().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:34:35 2009 for CMSSW by  doxygen 1.5.4