CMS 3D CMS Logo

CaloRecoTauProducer.cc
Go to the documentation of this file.
1 /* class CaloRecoTauProducer
2  * EDProducer of the CaloTauCollection, starting from the CaloTauTagInfoCollection,
3  * authors: Simone Gennai (simone.gennai@cern.ch), Ludovic Houchu (Ludovic.Houchu@cern.ch)
4  */
5 
14 
18 
21 
23 
25 
26 #include "CLHEP/Random/RandGauss.h"
27 
30 
31 #include <memory>
32 
33 using namespace reco;
34 using namespace edm;
35 using namespace std;
36 
38  public:
39  explicit CaloRecoTauProducer(const edm::ParameterSet& iConfig);
40  ~CaloRecoTauProducer() override;
41  void produce(edm::Event&,const edm::EventSetup&) override;
42  static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);
43  private:
49  double JetMinPt_;
51 };
52 
54  CaloRecoTauTagInfoProducer_ = iConfig.getParameter<edm::InputTag>("CaloRecoTauTagInfoProducer");
55  PVProducer_ = iConfig.getParameter<edm::InputTag>("PVProducer");
56  smearedPVsigmaX_ = iConfig.getParameter<double>("smearedPVsigmaX");
57  smearedPVsigmaY_ = iConfig.getParameter<double>("smearedPVsigmaY");
58  smearedPVsigmaZ_ = iConfig.getParameter<double>("smearedPVsigmaZ");
59  JetMinPt_ = iConfig.getParameter<double>("JetPtMin");
60  CaloRecoTauAlgo_=new CaloRecoTauAlgorithm(iConfig);
61  produces<CaloTauCollection>();
62  produces<DetIdCollection>();
63 }
65  delete CaloRecoTauAlgo_;
66 }
67 
69 
70  auto resultCaloTau = std::make_unique<CaloTauCollection>();
71  auto selectedDetIds = std::make_unique<DetIdCollection>();
72 
73  edm::ESHandle<TransientTrackBuilder> myTransientTrackBuilder;
74  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder",myTransientTrackBuilder);
75  CaloRecoTauAlgo_->setTransientTrackBuilder(myTransientTrackBuilder.product());
76 
78  iSetup.get<IdealMagneticFieldRecord>().get(myMF);
79  CaloRecoTauAlgo_->setMagneticField(myMF.product());
80 
81  // query a rec/sim PV
83  iEvent.getByLabel(PVProducer_,thePVs);
84  const VertexCollection vertCollection=*(thePVs.product());
85  Vertex thePV;
86  if(!vertCollection.empty()) thePV=*(vertCollection.begin());
87  else{
88  Vertex::Error SimPVError;
89  SimPVError(0,0)=smearedPVsigmaX_*smearedPVsigmaX_;
90  SimPVError(1,1)=smearedPVsigmaY_*smearedPVsigmaY_;
91  SimPVError(2,2)=smearedPVsigmaZ_*smearedPVsigmaZ_;
92  Vertex::Point SimPVPoint(CLHEP::RandGauss::shoot(0.,smearedPVsigmaX_),
93  CLHEP::RandGauss::shoot(0.,smearedPVsigmaY_),
94  CLHEP::RandGauss::shoot(0.,smearedPVsigmaZ_));
95  thePV=Vertex(SimPVPoint,SimPVError,1,1,1);
96  }
97 
98  edm::Handle<CaloTauTagInfoCollection> theCaloTauTagInfoCollection;
99  iEvent.getByLabel(CaloRecoTauTagInfoProducer_,theCaloTauTagInfoCollection);
100  int iinfo=0;
101  for(CaloTauTagInfoCollection::const_iterator i_info=theCaloTauTagInfoCollection->begin();i_info!=theCaloTauTagInfoCollection->end();i_info++) {
102  if(i_info->jetRef()->pt()>JetMinPt_){
103  CaloTau myCaloTau=CaloRecoTauAlgo_->buildCaloTau(iEvent,iSetup,Ref<CaloTauTagInfoCollection>(theCaloTauTagInfoCollection,iinfo),thePV);
104  resultCaloTau->push_back(myCaloTau);
105  }
106  ++iinfo;
107  }
108  for(unsigned int i =0;i<CaloRecoTauAlgo_->mySelectedDetId_.size();i++)
109  selectedDetIds->push_back(CaloRecoTauAlgo_->mySelectedDetId_[i]);
110 
111 
112  iEvent.put(std::move(resultCaloTau));
113  iEvent.put(std::move(selectedDetIds));
114 }
115 
116 void
118  // caloRecoTauProducer
120  desc.add<double>("LeadTrack_minPt", 0.5);
121  desc.add<double>("MatchingConeSize_min", 0.0);
122  desc.add<std::string>("ECALSignalConeSizeFormula", "0.15");
123  desc.add<std::string>("TrackerIsolConeMetric", "DR");
124  desc.add<std::string>("TrackerSignalConeMetric", "DR");
125  desc.add<edm::InputTag>("EBRecHitsSource", edm::InputTag("ecalRecHit","EcalRecHitsEB"));
126  desc.add<double>("IsolationTrack_minPt", 1.0);
127  desc.add<double>("ECALSignalConeSize_min", 0.0);
128  desc.add<double>("ECALRecHit_minEt", 0.5);
129  desc.add<std::string>("MatchingConeMetric", "DR");
130  desc.add<std::string>("TrackerSignalConeSizeFormula", "0.07");
131  desc.add<std::string>("MatchingConeSizeFormula", "0.10");
132  desc.add<double>("TrackerIsolConeSize_min", 0.0);
133  desc.add<double>("TrackerIsolConeSize_max", 0.6);
134  desc.add<double>("TrackerSignalConeSize_max", 0.6);
135  desc.add<edm::InputTag>("PVProducer", edm::InputTag("offlinePrimaryVertices"));
136  desc.add<edm::InputTag>("ESRecHitsSource", edm::InputTag("ecalPreshowerRecHit","EcalRecHitsES"));
137  desc.add<double>("TrackerSignalConeSize_min", 0.0);
138  desc.add<double>("ECALIsolConeSize_max", 0.6);
139  desc.add<double>("AreaMetric_recoElements_maxabsEta", 2.5);
140  desc.add<std::string>("ECALIsolConeMetric", "DR");
141  desc.add<std::string>("ECALIsolConeSizeFormula", "0.50");
142  desc.add<double>("JetPtMin", 0.0);
143  desc.add<edm::InputTag>("EERecHitsSource", edm::InputTag("ecalRecHit","EcalRecHitsEE"));
144  desc.add<unsigned int>("IsolationTrack_minHits", 0);
145  desc.add<std::string>("ECALSignalConeMetric", "DR");
146  desc.add<double>("TrackLeadTrack_maxDZ", 1.0);
147  desc.add<double>("Track_minPt", 0.5);
148  desc.add<std::string>("TrackerIsolConeSizeFormula", "0.50");
149  desc.add<double>("ECALSignalConeSize_max", 0.6);
150  desc.add<double>("ECALIsolConeSize_min", 0.0);
151  desc.add<bool>("UseTrackLeadTrackDZconstraint", true);
152  desc.add<double>("smearedPVsigmaY", 0.0015);
153  desc.add<double>("smearedPVsigmaX", 0.0015);
154  desc.add<double>("smearedPVsigmaZ", 0.005);
155  desc.add<edm::InputTag>("CaloRecoTauTagInfoProducer", edm::InputTag("caloRecoTauTagInfoProducer"));
156  desc.add<double>("MatchingConeSize_max", 0.6);
157  descriptions.add("caloRecoTauProducer", desc);
158 }
159 
T getParameter(std::string const &) const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
CaloRecoTauProducer(const edm::ParameterSet &iConfig)
math::Error< dimension >::type Error
covariance error matrix (3x3)
Definition: Vertex.h:43
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
CaloRecoTauAlgorithm * CaloRecoTauAlgo_
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::InputTag CaloRecoTauTagInfoProducer_
math::XYZPoint Point
point in the space
Definition: Vertex.h:39
void produce(edm::Event &, const edm::EventSetup &) override
ParameterDescriptionBase * add(U const &iLabel, T const &value)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:480
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
T const * product() const
Definition: Handle.h:74
void add(std::string const &label, ParameterSetDescription const &psetDescription)
fixed size matrix
HLT enums.
T get() const
Definition: EventSetup.h:71
T const * product() const
Definition: ESHandle.h:86
def move(src, dest)
Definition: eostools.py:511