CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
IsolatedTauJetsSelector.cc
Go to the documentation of this file.
4 #include "Math/GenVector/VectorUtil.h"
5 //
6 // class decleration
7 //
8 
9 
11 {
12 
13  jetSrc = iConfig.getParameter<vtag>("JetSrc");
14  pt_min_leadTrack = iConfig.getParameter<double>("MinimumTransverseMomentumLeadingTrack");
15 useIsolationDiscriminator = iConfig.getParameter<bool>("UseIsolationDiscriminator");
16  useInHLTOpen = iConfig.getParameter<bool>("UseInHLTOpen");
17 
18  produces<reco::CaloJetCollection>();
19  // produces<reco::IsolatedTauTagInfoCollection>();
20 }
21 
23 
25 {
26 
27  using namespace reco;
28  using namespace edm;
29  using namespace std;
30 
31  CaloJetCollection * jetCollectionTmp = new CaloJetCollection;
32 // IsolatedTauTagInfoCollection * extendedCollection = new IsolatedTauTagInfoCollection;
33 
34  for( vtag::const_iterator s = jetSrc.begin(); s != jetSrc.end(); ++ s ) {
36  iEvent.getByLabel( * s, tauJets );
37  IsolatedTauTagInfoCollection::const_iterator i = tauJets->begin();
38  for(;i !=tauJets->end(); i++ ) {
39 
40  if(useInHLTOpen) {
41  const CaloJet* pippo = dynamic_cast<const CaloJet*>((i->jet().get()));
42  CaloJet* mioPippo = const_cast<CaloJet*>(pippo);
43  mioPippo->setPdgId(15);
44  if(mioPippo)
45  jetCollectionTmp->push_back(*mioPippo);
46  // extendedCollection->push_back(*(i)); //to be used later
47  // delete pippo;
48  }else{
49  const TrackRef leadTk = i->leadingSignalTrack();
50  if( !leadTk )
51  {}else{
52  if(leadTk->pt() > pt_min_leadTrack) {
53  float discriminator = i->discriminator();
54  const CaloJet* pippo = dynamic_cast<const CaloJet*>((i->jet().get()));
55  CaloJet* mioPippo = const_cast<CaloJet*>(pippo);
56  mioPippo->setPdgId(15);
57  if(useIsolationDiscriminator && (discriminator > 0) ) {
58  if(mioPippo)
59  jetCollectionTmp->push_back(*mioPippo);
60  // delete pippo;
61  }else if(!useIsolationDiscriminator){
62  if(mioPippo)
63  jetCollectionTmp->push_back(*mioPippo);
64  }
65  }
66  }
67  }
68  }
69  }
70 
71 
72 
73  std::auto_ptr<reco::CaloJetCollection> selectedTaus(jetCollectionTmp);
74 
75  iEvent.put(selectedTaus);
76 
77 
78 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
Jets made from CaloTowers.
Definition: CaloJet.h:29
int iEvent
Definition: GenABIO.cc:243
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
IsolatedTauJetsSelector(const edm::ParameterSet &)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
std::vector< edm::InputTag > vtag
virtual void produce(edm::Event &, const edm::EventSetup &) override
virtual void setPdgId(int pdgId) GCC11_FINAL
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects