21 mInputCalo = iConfig.
getParameter<std::vector<edm::InputTag> >(
"srcCalo");
22 ecalLabels_=iConfig.
getParameter<std::vector<edm::InputTag> >(
"ecalInputs");
24 unsigned nLabels = mInputCalo.size();
25 for (
unsigned i=0;
i != nLabels;
i++ )
26 toks_calo_.push_back( consumes<reco::CaloJetCollection>( mInputCalo[
i] ) );
28 nLabels = ecalLabels_.size();
29 for (
unsigned i=0; i != nLabels; i++ )
30 toks_ecal_.push_back( consumes<EcalRecHitCollection>( ecalLabels_[i] ) );
34 correctedIslandBarrelSuperClusterCollection_ = iConfig.
getParameter<
std::string>(
"correctedIslandBarrelSuperClusterCollection");
35 correctedIslandBarrelSuperClusterProducer_ = iConfig.
getParameter<
std::string>(
"correctedIslandBarrelSuperClusterProducer");
36 tok_EBSC_ = consumes<reco::SuperClusterCollection>(
38 correctedIslandBarrelSuperClusterCollection_));
40 correctedIslandEndcapSuperClusterCollection_ = iConfig.
getParameter<
std::string>(
"correctedIslandEndcapSuperClusterCollection");
41 correctedIslandEndcapSuperClusterProducer_ = iConfig.
getParameter<
std::string>(
"correctedIslandEndcapSuperClusterProducer");
42 tok_EESC_ = consumes<reco::SuperClusterCollection>(
44 correctedIslandEndcapSuperClusterCollection_));
50 produces<reco::TrackCollection>(
"GammaJetTracksCollection");
51 produces<EcalRecHitCollection>(
"GammaJetEcalRecHitCollection");
52 produces<HBHERecHitCollection>(
"GammaJetHBHERecHitCollection");
53 produces<HORecHitCollection>(
"GammaJetHORecHitCollection");
54 produces<HFRecHitCollection>(
"GammaJetHFRecHitCollection");
55 produces<CaloJetCollection>(
"GammaJetJetBackToBackCollection");
56 produces<reco::SuperClusterCollection>(
"GammaJetGammaBackToBackCollection");
97 reco::SuperClusterCollection::const_iterator maxclusbarrel;
98 reco::SuperClusterCollection::const_iterator maxclusendcap;
100 double vetmax = -100.;
103 pCorrectedIslandBarrelSuperClusters);
104 if (!pCorrectedIslandBarrelSuperClusters.isValid()) {
106 if (!allowMissingInputs_) {
107 *pCorrectedIslandBarrelSuperClusters;
113 maxclusbarrel = correctedIslandBarrelSuperClusters->begin();
114 for(reco::SuperClusterCollection::const_iterator aClus = correctedIslandBarrelSuperClusters->begin();
115 aClus != correctedIslandBarrelSuperClusters->end(); aClus++) {
116 double vet = aClus->energy()/cosh(aClus->eta());
117 cout<<
" Barrel supercluster " << vet <<
" energy "<<aClus->energy()<<
" eta "<<aClus->eta()<<endl;
122 maxclusbarrel = aClus;
132 pCorrectedIslandEndcapSuperClusters);
133 if (!pCorrectedIslandEndcapSuperClusters.isValid()) {
135 if (!allowMissingInputs_) {
136 *pCorrectedIslandEndcapSuperClusters;
142 maxclusendcap = correctedIslandEndcapSuperClusters->end();
143 double vetmaxe = vetmax;
144 for(reco::SuperClusterCollection::const_iterator aClus = correctedIslandEndcapSuperClusters->begin();
145 aClus != correctedIslandEndcapSuperClusters->end(); aClus++) {
146 double vet = aClus->energy()/cosh(aClus->eta());
152 maxclusendcap = aClus;
159 cout<<
" Number of gammas "<<nclusb<<
" "<<ncluse<<endl;
161 if( nclusb == 0 && ncluse == 0 ) {
163 iEvent.
put( outputTColl,
"GammaJetTracksCollection");
164 iEvent.
put( miniEcalRecHitCollection,
"GammaJetEcalRecHitCollection");
165 iEvent.
put( miniHBHERecHitCollection,
"GammaJetHBHERecHitCollection");
166 iEvent.
put( miniHORecHitCollection,
"GammaJetHORecHitCollection");
167 iEvent.
put( miniHFRecHitCollection,
"GammaJetHFRecHitCollection");
168 iEvent.
put( result,
"GammaJetGammaBackToBackCollection");
169 iEvent.
put( resultjet,
"GammaJetJetBackToBackCollection");
174 double phigamma = -100.;
175 double etagamma = -100.;
178 result->push_back(*maxclusendcap);
179 phigamma = (*maxclusendcap).phi();
180 etagamma = (*maxclusendcap).eta();
184 result->push_back(*maxclusbarrel);
185 phigamma = (*maxclusbarrel).phi();
186 etagamma = (*maxclusbarrel).eta();
196 double phijet = -100.;
197 double etajet = -100.;
198 double phijet0 = -100.;
199 double etajet0 = -100.;
201 std::vector<edm::EDGetTokenT<reco::CaloJetCollection> >::const_iterator ic;
202 for (ic=toks_calo_.begin(); ic!=toks_calo_.end(); ic++) {
208 if (!allowMissingInputs_) {
212 reco::CaloJetCollection::const_iterator
jet = jets->begin ();
216 if( jets->size() == 0 )
continue;
221 for (; jet != jets->end (); jet++)
223 phijet0 = (*jet).phi();
224 etajet0 = (*jet).eta();
228 if(numjet > 3)
break;
230 cout<<
" phi,eta "<< phigamma<<
" "<< etagamma<<
" "<<phijet0<<
" "<<etajet0<<endl;
234 double dphi = fabs(phigamma-phijet0);
235 if(dphi > 4.*atan(1.)) dphi = 8.*atan(1.) - dphi;
236 double deta = fabs(etagamma-etajet0);
237 double dr =
sqrt(dphi*dphi+deta*deta);
238 if(dr < 0.5 )
continue;
239 resultjet->push_back ((*jet));
241 dphi = dphi*180./(4.*atan(1.));
242 if( fabs(dphi-180) < 30. )
246 phijet = (*jet).phi();
247 etajet = (*jet).eta();
250 if(iejet == 0) resultjet->clear();
254 if( resultjet->size() == 0 ) {
256 iEvent.
put( outputTColl,
"GammaJetTracksCollection");
257 iEvent.
put( miniEcalRecHitCollection,
"GammaJetEcalRecHitCollection");
258 iEvent.
put( miniHBHERecHitCollection,
"GammaJetHBHERecHitCollection");
259 iEvent.
put( miniHORecHitCollection,
"GammaJetHORecHitCollection");
260 iEvent.
put( miniHFRecHitCollection,
"GammaJetHFRecHitCollection");
261 iEvent.
put( result,
"GammaJetGammaBackToBackCollection");
262 iEvent.
put( resultjet,
"GammaJetJetBackToBackCollection");
274 std::vector<edm::EDGetTokenT<EcalRecHitCollection> >::const_iterator
i;
275 for (
i=toks_ecal_.begin();
i!=toks_ecal_.end();
i++) {
280 if (!allowMissingInputs_) {
281 cout<<
" No ECAL input "<<endl;
286 recHit != (*ec).end(); ++recHit)
289 GlobalPoint pos = geo->getPosition(recHit->detid());
290 double phihit = pos.
phi();
291 double etahit = pos.
eta();
293 double dphi = fabs(phigamma - phihit);
294 if(dphi > 4.*atan(1.)) dphi = 8.*atan(1.) - dphi;
295 double deta = fabs(etagamma - etahit);
296 double dr =
sqrt(dphi*dphi + deta*deta);
297 if(dr<1.) miniEcalRecHitCollection->push_back(*recHit);
299 dphi = fabs(phijet - phihit);
300 if(dphi > 4.*atan(1.)) dphi = 8.*atan(1.) - dphi;
301 deta = fabs(etajet - etahit);
302 dr =
sqrt(dphi*dphi + deta*deta);
303 if(dr<1.4) miniEcalRecHitCollection->push_back(*recHit);
313 if (!hbhe.isValid()) {
315 if (!allowMissingInputs_) {
322 GlobalPoint pos = geo->getPosition(hbheItr->detid());
323 double phihit = pos.
phi();
324 double etahit = pos.
eta();
326 double dphi = fabs(phigamma - phihit);
327 if(dphi > 4.*atan(1.)) dphi = 8.*atan(1.) - dphi;
328 double deta = fabs(etagamma - etahit);
329 double dr =
sqrt(dphi*dphi + deta*deta);
332 if(dr<1.) miniHBHERecHitCollection->push_back(*hbheItr);
333 dphi = fabs(phijet - phihit);
334 if(dphi > 4.*atan(1.)) dphi = 8.*atan(1.) - dphi;
335 deta = fabs(etajet - etahit);
336 dr =
sqrt(dphi*dphi + deta*deta);
337 if(dr<1.4) miniHBHERecHitCollection->push_back(*hbheItr);
347 if (!allowMissingInputs_) {
354 GlobalPoint pos = geo->getPosition(hoItr->detid());
355 double phihit = pos.
phi();
356 double etahit = pos.
eta();
358 double dphi = fabs(phigamma - phihit);
359 if(dphi > 4.*atan(1.)) dphi = 8.*atan(1.) - dphi;
360 double deta = fabs(etagamma - etahit);
361 double dr =
sqrt(dphi*dphi + deta*deta);
363 if(dr<1.) miniHORecHitCollection->push_back(*hoItr);
364 dphi = fabs(phijet - phihit);
365 if(dphi > 4.*atan(1.)) dphi = 8.*atan(1.) - dphi;
366 deta = fabs(etajet - etahit);
367 dr =
sqrt(dphi*dphi + deta*deta);
368 if(dr<1.4) miniHORecHitCollection->push_back(*hoItr);
379 if (!allowMissingInputs_) {
387 GlobalPoint pos = geo->getPosition(hfItr->detid());
389 double phihit = pos.
phi();
390 double etahit = pos.
eta();
392 double dphi = fabs(phigamma - phihit);
393 if(dphi > 4.*atan(1.)) dphi = 8.*atan(1.) - dphi;
394 double deta = fabs(etagamma - etahit);
395 double dr =
sqrt(dphi*dphi + deta*deta);
397 if(dr<1.) miniHFRecHitCollection->push_back(*hfItr);
398 dphi = fabs(phijet - phihit);
399 if(dphi > 4.*atan(1.)) dphi = 8.*atan(1.) - dphi;
400 deta = fabs(etajet - etahit);
401 dr =
sqrt(dphi*dphi + deta*deta);
403 if( dr < 1.4 ) miniHFRecHitCollection->push_back(*hfItr);
412 iEvent.
getByToken(tok_inputTrack_,trackCollection);
413 if (!trackCollection.isValid()) {
415 if (!allowMissingInputs_) {
424 for (reco::TrackCollection::const_iterator track=tC.begin(); track!=tC.end(); track++)
427 double deta = track->momentum().eta() - etagamma;
429 double dphi = fabs(track->momentum().phi() - phigamma);
431 if (dphi > atan(1.)*4.) dphi = 8.*atan(1.) - dphi;
432 double ddir1 =
sqrt(deta*deta+dphi*dphi);
436 deta = track->momentum().eta() - etajet;
437 dphi = fabs(track->momentum().phi() - phijet);
438 if (dphi > atan(1.)*4.) dphi = 8.*atan(1.) - dphi;
439 double ddir2 =
sqrt(deta*deta+dphi*dphi);
441 if( ddir1 < 1.4 || ddir2 < 1.4)
443 outputTColl->push_back(*track);
450 iEvent.
put( outputTColl,
"GammaJetTracksCollection");
451 iEvent.
put( miniEcalRecHitCollection,
"GammaJetEcalRecHitCollection");
452 iEvent.
put( miniHBHERecHitCollection,
"GammaJetHBHERecHitCollection");
453 iEvent.
put( miniHORecHitCollection,
"GammaJetHORecHitCollection");
454 iEvent.
put( miniHFRecHitCollection,
"GammaJetHFRecHitCollection");
455 iEvent.
put( result,
"GammaJetGammaBackToBackCollection");
456 iEvent.
put( resultjet,
"GammaJetJetBackToBackCollection");
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
virtual void produce(edm::Event &, const edm::EventSetup &)
Geom::Phi< T > phi() const
std::vector< Track > TrackCollection
collection of Tracks
std::vector< EcalRecHit >::const_iterator const_iterator
AlCaGammaJetProducer(const edm::ParameterSet &)
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
tuple correctedIslandEndcapSuperClusters
const_iterator end() const
tuple correctedIslandBarrelSuperClusters
const_iterator begin() const
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects