CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HLTJetCollectionsForLeptonPlusJets.cc
Go to the documentation of this file.
2 
4 
11 
13 
15 
17 
20 
21 
22 
23 
24 template <typename jetType>
26  hltLeptonTag(iConfig.getParameter< edm::InputTag > ("HltLeptonTag")),
27  sourceJetTag(iConfig.getParameter< edm::InputTag > ("SourceJetTag")),
28  minDeltaR_(iConfig.getParameter< double > ("minDeltaR"))
29 {
30  using namespace edm;
31  using namespace std;
32  typedef vector<RefVector<vector<jetType>,jetType,refhelper::FindUsingAdvance<vector<jetType>,jetType> > > JetCollectionVector;
33  produces<JetCollectionVector> ();
34 }
35 
36 template <typename jetType>
38 {
39  // do anything here that needs to be done at desctruction time
40  // (e.g. close files, deallocate resources etc.)
41 
42 }
43 
44 template <typename jetType>
45 void
48  desc.add<edm::InputTag> ("HltLeptonTag", edm::InputTag("triggerFilterObjectWithRefs"));
49  desc.add<edm::InputTag> ("SourceJetTag", edm::InputTag("caloJetCollection"));
50  desc.add<double> ("minDeltaR", 0.5);
51  descriptions.add(std::string("hlt")+std::string(typeid(HLTJetCollectionsForLeptonPlusJets<jetType>).name()),desc);
52 }
53 
54 //
55 // member functions
56 //
57 
58 
59 // ------------ method called to produce the data ------------
60 // template <typename T>
61 template <typename jetType>
62 void
64 {
65  using namespace edm;
66  using namespace std;
67 
68  typedef vector<RefVector<vector<jetType>,jetType,refhelper::FindUsingAdvance<vector<jetType>,jetType> > > JetCollectionVector;
69  typedef vector<jetType> JetCollection;
72 
74  iEvent.getByLabel(hltLeptonTag,PrevFilterOutput);
75 
76  //its easier on the if statement flow if I try everything at once, shouldnt add to timing
77  vector<Ref<reco::RecoEcalCandidateCollection> > clusCands;
78  PrevFilterOutput->getObjects(trigger::TriggerCluster,clusCands);
79 
80  vector<Ref<reco::ElectronCollection> > eleCands;
81  PrevFilterOutput->getObjects(trigger::TriggerElectron,eleCands);
82 
83  vector<reco::RecoChargedCandidateRef> muonCands;
84  PrevFilterOutput->getObjects(trigger::TriggerMuon,muonCands);
85 
86  Handle<JetCollection> theJetCollectionHandle;
87  iEvent.getByLabel(sourceJetTag, theJetCollectionHandle);
88 
89  const JetCollection & theJetCollection = *theJetCollectionHandle;
90 
91  auto_ptr < JetCollectionVector > allSelections(new JetCollectionVector());
92 
93  if(!clusCands.empty()){ //try trigger cluster
94  for(size_t candNr=0;candNr<clusCands.size();candNr++){
95  JetRefVector refVector;
96  for (unsigned int j = 0; j < theJetCollection.size(); j++) {
97  if (deltaR(clusCands[candNr]->superCluster()->position(),theJetCollection[j]) > minDeltaR_) refVector.push_back(JetRef(theJetCollectionHandle, j));
98  }
99  allSelections->push_back(refVector);
100  }
101  }
102 
103  if(!eleCands.empty()){ //try trigger cluster
104  for(size_t candNr=0;candNr<eleCands.size();candNr++){
105  JetRefVector refVector;
106  for (unsigned int j = 0; j < theJetCollection.size(); j++) {
107  if (deltaR(eleCands[candNr]->superCluster()->position(),theJetCollection[j]) > minDeltaR_) refVector.push_back(JetRef(theJetCollectionHandle, j));
108  }
109  allSelections->push_back(refVector);
110  }
111  }
112 
113  if(!muonCands.empty()){ //try trigger cluster
114  for(size_t candNr=0;candNr<muonCands.size();candNr++){
115  JetRefVector refVector;
116  for (unsigned int j = 0; j < theJetCollection.size(); j++) {
117  if (deltaR(muonCands[candNr]->p4(),theJetCollection[j]) > minDeltaR_) refVector.push_back(JetRef(theJetCollectionHandle, j));
118  }
119  allSelections->push_back(refVector);
120  }
121  }
122 
123 
124 
125 
126  iEvent.put(allSelections);
127 
128  return;
129 
130 }
131 
std::vector< Jet > JetCollection
Definition: Jet.h:49
edm::Ref< JetCollection > JetRef
Definition: Jet.h:51
static int position[TOTALCHAMBERS][3]
Definition: ReadPGInfo.cc:509
edm::RefVector< JetCollection > JetRefVector
Definition: Jet.h:52
int iEvent
Definition: GenABIO.cc:243
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
double p4[4]
Definition: TauolaWrapper.h:92
int j
Definition: DBlmapReader.cc:9
ParameterDescriptionBase * add(U const &iLabel, T const &value)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
virtual void produce(edm::Event &, const edm::EventSetup &)