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  for(vtag::const_iterator it = jetSrc.begin(); it != jetSrc.end(); ++it) {
15  edm::EDGetTokenT<reco::IsolatedTauTagInfoCollection> aToken = consumes<reco::IsolatedTauTagInfoCollection>(*it);
16  jetSrcToken.push_back(aToken);
17  }
18  pt_min_leadTrack = iConfig.getParameter<double>("MinimumTransverseMomentumLeadingTrack");
19  useIsolationDiscriminator = iConfig.getParameter<bool>("UseIsolationDiscriminator");
20  useInHLTOpen = iConfig.getParameter<bool>("UseInHLTOpen");
21 
22  produces<reco::CaloJetCollection>();
23  // produces<reco::IsolatedTauTagInfoCollection>();
24 }
25 
27 
29 {
30 
31  using namespace reco;
32  using namespace edm;
33  using namespace std;
34 
35  CaloJetCollection * jetCollectionTmp = new CaloJetCollection;
36 // IsolatedTauTagInfoCollection * extendedCollection = new IsolatedTauTagInfoCollection;
37 
38  typedef vector<EDGetTokenT<IsolatedTauTagInfoCollection> > vtag_token;
39  for( vtag_token::const_iterator s = jetSrcToken.begin(); s != jetSrcToken.end(); ++ s ) {
41  iEvent.getByToken( * s, tauJets );
42  IsolatedTauTagInfoCollection::const_iterator i = tauJets->begin();
43  for(;i !=tauJets->end(); i++ ) {
44 
45  if(useInHLTOpen) {
46  const CaloJet* pippo = dynamic_cast<const CaloJet*>((i->jet().get()));
47  CaloJet* mioPippo = const_cast<CaloJet*>(pippo);
48  mioPippo->setPdgId(15);
49  if(mioPippo)
50  jetCollectionTmp->push_back(*mioPippo);
51  // extendedCollection->push_back(*(i)); //to be used later
52  // delete pippo;
53  }else{
54  const TrackRef leadTk = i->leadingSignalTrack();
55  if( !leadTk )
56  {}else{
57  if(leadTk->pt() > pt_min_leadTrack) {
58  float discriminator = i->discriminator();
59  const CaloJet* pippo = dynamic_cast<const CaloJet*>((i->jet().get()));
60  CaloJet* mioPippo = const_cast<CaloJet*>(pippo);
61  mioPippo->setPdgId(15);
62  if(useIsolationDiscriminator && (discriminator > 0) ) {
63  if(mioPippo)
64  jetCollectionTmp->push_back(*mioPippo);
65  // delete pippo;
66  }else if(!useIsolationDiscriminator){
67  if(mioPippo)
68  jetCollectionTmp->push_back(*mioPippo);
69  }
70  }
71  }
72  }
73  }
74  }
75 
76 
77 
78  std::auto_ptr<reco::CaloJetCollection> selectedTaus(jetCollectionTmp);
79 
80  iEvent.put(selectedTaus);
81 
82 
83 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
std::vector< edm::EDGetTokenT< reco::IsolatedTauTagInfoCollection > > jetSrcToken
Jets made from CaloTowers.
Definition: CaloJet.h:29
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
int iEvent
Definition: GenABIO.cc:230
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
IsolatedTauJetsSelector(const edm::ParameterSet &)
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