001
002
003
004
005
006
007
008
009 #include "AtlfastAlgs/JetMaker.h"
010 #include "AtlfastAlgs/JetSmearer.h"
011 #include "AtlfastAlgs/MissingMomentum.h"
012 #include "AtlfastAlgs/GlobalEventData.h"
013
014 #include "AtlfastEvent/ContainerAssocsDispatcher.h"
015 #include "AtlfastEvent/Jet.h"
016 #include "AtlfastEvent/ICell.h"
017 #include "AtlfastEvent/CollectionDefs.h"
018 #include "AtlfastEvent/ReconstructedParticle.h"
019 #include "AtlfastEvent/ParticleCodes.h"
020 #include "AtlfastEvent/MsgStreamDefs.h"
021 #include "AtlfastEvent/ICluster.h"
022 #include "AtlfastEvent/MCparticleCollection.h"
023 #include "AtlfastEvent/SimpleKinematic.h"
024 #include "AtlfastEvent/Phi.h"
025
026 #include "AtlfastUtils/TesIO.h"
027 #include "AtlfastUtils/HeaderPrinter.h"
028 #include "AtlfastUtils/FunctionObjects.h"
029 #include "AtlfastUtils/IsAssociated.h"
030 #include "AtlfastUtils/SmearCell.h"
031
032 #include "TruthHelper/GenIMCselector.h"
033 #include "TruthHelper/IsGenType.h"
034 #include "TruthHelper/IsGenStable.h"
035 #include "TruthHelper/NCutter.h"
036
037 #include <cmath>
038 #include <algorithm>
039 #include <numeric>
040 #include <assert.h>
041
042
043 #include "GaudiKernel/DataSvc.h"
044 #include "GaudiKernel/ISvcLocator.h"
045 #include "GaudiKernel/MsgStream.h"
046
047
048 #include "GeneratorObjects/McEventCollection.h"
049 #include "HepMC/GenEvent.h"
050 #include "HepMC/GenVertex.h"
051
052 #include "CLHEP/Units/SystemOfUnits.h"
053
054
055
056
057
058
059
060
061
062
063 namespace Atlfast{
064
065
066
067
068 using std::abs;
069 using std::sort;
070 using std::partition;
071
072 JetMaker::JetMaker
073 ( const std::string& name, ISvcLocator* pSvcLocator )
074 : Algorithm( name, pSvcLocator ),
075 m_bSelector(0),
076 m_cSelector(0),
077 m_tauSelector(0),
078 m_smearer(0),
079 m_cellSmearer(0),
080 m_tesIO(0)
081 {
082
083
084 m_minPT = 10*GeV;
085 m_maxEta = 5.0;
086 m_doSmearing = true;
087 m_rconeb = 0.400;
088 m_rconef = 0.400;
089
090 m_bPtMin = 5.0*GeV;
091 m_bMaxDeltaR = 0.3;
092
093 m_cPtMin = 5.0*GeV;
094 m_cMaxDeltaR = 0.3;
095
096 m_tauPtMin = 10.0*GeV;
097 m_tauMaxDeltaR = 0.3;
098
099 m_etaTagMax = 2.5;
100
101 m_tauJetPtRatio = 0;
102
103 m_adjustMissETForIsolation = true;
104
105
106 m_inputLocation = "/Event/AtlfastClusters";
107 m_outputLocation = "/Event/AtlfastJets";
108 m_muonLocation = "/Event/AtlfastNonIsolatedMuons";
109 m_unusedCellLocation = "/Event/AtlfastUnusedCells";
110 m_missingMomentumLocation = "/Event/AtlfastMissingMomentum";
111 m_isolatedElectronLocation = "/Event/AtlfastIsolatedElectrons";
112 m_isolatedPhotonLocation = "/Event/AtlfastIsolatedPhotons";
113
114
115
116 declareProperty( "MinimumPT", m_minPT ) ;
117 declareProperty( "MaximumEta", m_maxEta ) ;
118 declareProperty( "DoSmearing", m_doSmearing );
119 declareProperty( "RconeB", m_rconeb );
120 declareProperty( "RconeF", m_rconef );
121 declareProperty( "bPtMin", m_bPtMin );
122 declareProperty( "bMaxDeltaR", m_bMaxDeltaR );
123 declareProperty( "cPtMin", m_cPtMin );
124 declareProperty( "cMaxDeltaR", m_cMaxDeltaR );
125 declareProperty( "tauPtMin", m_tauPtMin );
126 declareProperty( "tauMaxDeltaR", m_tauMaxDeltaR );
127 declareProperty( "etaTagMax", m_etaTagMax );
128 declareProperty( "tauJetPtRatio", m_tauJetPtRatio);
129 declareProperty( "adjustMissETForIsolation", m_adjustMissETForIsolation);
130
131 declareProperty( "InputLocation", m_inputLocation ) ;
132 declareProperty( "OutputLocation", m_outputLocation ) ;
133 declareProperty( "UnusedCellLocation", m_unusedCellLocation ) ;
134 declareProperty( "MuonLocation", m_muonLocation );
135 declareProperty( "MissingMomentumLocation", m_missingMomentumLocation );
136 declareProperty( "IsolatedElectronLocation", m_isolatedElectronLocation );
137 declareProperty( "IsolatedPhotonLocation", m_isolatedPhotonLocation );
138
139 }
140
141 JetMaker::~JetMaker() {
142
143 MsgStream log( messageService(), name() ) ;
144 log << MSG::INFO << "Destructor Called" << endreq;
145
146 if (m_smearer) {
147 log << MSG::INFO << "Deleting jet Smearer" << endreq;
148 delete m_smearer;
149 }
150 if (m_cellSmearer) {
151 log << MSG::INFO << "Deleting Cell Smearer" << endreq;
152 delete m_cellSmearer;
153 }
154 if (m_tesIO) {
155 delete m_tesIO;
156 }
157 }
158
159
160
161
162
163 StatusCode JetMaker::initialize(){
164 MsgStream log( messageService(), name() ) ;
165
166 log << MSG::DEBUG << "instantiating a JetSmearer" << endreq;
167
168
169
170 GlobalEventData* ged = GlobalEventData::Instance();
171 int lumi = ged->lumi();
172 int randSeed = ged->randSeed() ;
173 m_barrelForwardEta = ged->barrelForwardEta();
174 m_mcLocation = ged->mcLocation();
175
176
177 ged->set_adjustMissEtForIsolation(m_adjustMissETForIsolation);
178
179
180 m_tesIO = new TesIO(m_mcLocation, ged->justHardScatter());
181
182 if(m_doSmearing){
183 m_smearer = new JetSmearer(randSeed,
184 lumi,
185 m_rconeb,
186 m_rconef,
187 m_barrelForwardEta);
188 m_cellSmearer = new JetSmearer(randSeed,
189 lumi,
190 0.,
191 0.,
192 m_barrelForwardEta);
193 } else {
194 m_smearer = 0;
195 m_cellSmearer = 0;
196 }
197
198 const int BQUARK(ParticleCodes::BQUARK);
199 const int CQUARK(ParticleCodes::CQUARK);
200
201
202
203
204 TruthHelper::GenIMCselector* selector;
205
206 std::vector<TruthHelper::GenIMCselector*> bSelectors;
207 selector = new HepMC_helper::SelectJetTag(BQUARK, m_bPtMin, m_etaTagMax);
208 bSelectors.push_back( selector );
209 m_bSelector = new TruthHelper::NCutter(bSelectors);
210
211 std::vector<TruthHelper::GenIMCselector*> cSelectors;
212 selector = new HepMC_helper::SelectJetTag(CQUARK, m_cPtMin, m_etaTagMax);
213 cSelectors.push_back( selector );
214 m_cSelector = new TruthHelper::NCutter(cSelectors);
215
216 std::vector<TruthHelper::GenIMCselector*> tauSelectors;
217 selector = new HepMC_helper::SelectTauTag(m_tauPtMin, m_etaTagMax);
218 tauSelectors.push_back( selector );
219 m_tauSelector = new TruthHelper::NCutter(tauSelectors);
220
221
222
223 std::vector<TruthHelper::GenIMCselector*>::iterator iter;
224 for(iter=bSelectors.begin(); iter!=bSelectors.end(); delete *iter, ++iter);
225 for(iter=cSelectors.begin(); iter!=cSelectors.end(); delete *iter, ++iter);
226 for(iter=tauSelectors.begin(); iter!=tauSelectors.end(); delete *iter, ++iter);
227
228
229
230 HeaderPrinter hp("Atlfast JetMaker:", log);
231
232 hp.add("TES Locations: ");
233 hp.add(" Muons from ", m_muonLocation);
234 hp.add(" Clusters from ", m_inputLocation);
235 hp.add(" MC Input Location ", m_mcLocation);
236 hp.add(" Jets to ", m_outputLocation);
237 hp.add(" unused cell,cluster sum to ", m_missingMomentumLocation);
238 hp.add("Smearing on ", m_doSmearing);
239 hp.add("Cluster min Pt ", m_minPT);
240 hp.add("Cluster max Eta ", m_maxEta);
241 hp.add("Luminosity ", lumi);
242 hp.add("Initial random seed ", randSeed);
243 hp.add("End cap Cone size ", m_rconef);
244 hp.add("Barrel Cone size ", m_rconeb);
245 hp.add("Eta of start of end cap ", m_barrelForwardEta);
246 hp.add("Parameters for labels ", " ");
247 hp.add(" Max eta ", m_etaTagMax);
248 hp.add(" b-quark min pt ", m_bPtMin);
249 hp.add(" b-quark max DeltaR ", m_bMaxDeltaR);
250 hp.add(" c-quark min pt ", m_cPtMin);
251 hp.add(" c-quark max DeltaR ", m_cMaxDeltaR);
252 hp.add(" tau lep min pt ", m_tauPtMin);
253 hp.add(" tau lep max DeltaR ", m_tauMaxDeltaR);
254 hp.add(" tau/Jet Pt Ratio ", m_tauJetPtRatio);
255 hp.print();
256
257
258
259 return StatusCode::SUCCESS ;
260 }
261
262
263
264
265
266 StatusCode JetMaker::finalize(){
267
268 MsgStream log( messageService(), name() ) ;
269 log << MSG::INFO << "finalizing" << endreq;
270
271 if (m_bSelector) delete m_bSelector;
272 if (m_cSelector) delete m_cSelector;
273 if (m_tauSelector) delete m_tauSelector;
274
275 return StatusCode::SUCCESS ;
276 }
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295 StatusCode JetMaker::execute( ){
296
297 MsgStream log( messageService(), name() ) ;
298
299 std::string mess;
300
301
302
303
304
305
306
307 localClusterCollection my_Clusters ;
308 MuonCollection my_Muons ;
309
310
311
312 if( ! m_tesIO->copy<IClusterCollection> ( my_Clusters, m_inputLocation ) ) {
313 log << MSG::INFO << "No Clusters in TES " << endreq;
314 } else {
315 log << MSG::DEBUG << my_Clusters.size()<<" Clusters from TES " << endreq;
316 }
317
318
319 if( ! m_tesIO->copy<ReconstructedParticleCollection>
320 ( my_Muons, m_muonLocation ) ) {
321 log << MSG::DEBUG << "No muons in TES " << endreq;
322 }
323
324
325
326
327
328
329
330
331 JetCollection* myJets = new JetCollection ;
332
333
334
335
336
337 Jet* candidate ;
338 localClusterIterator src ;
339 m_sumET = 0.;
340 HepLorentzVector missingMomentum(0.,0.,0.,0.);
341
342 MCparticleCollection mcParticles_b ;
343 MCparticleCollection mcParticles_c ;
344 MCparticleCollection mcParticles_tau ;
345
346
347
348
349 TesIoStat stat = m_tesIO->getMC( mcParticles_b, m_bSelector ) ;
350 if(!stat){
351 log << MSG::ERROR <<"Problem getting b-quarks" << endreq;
352 return stat;
353 }
354 stat = m_tesIO->getMC( mcParticles_c, m_cSelector ) ;
355 if(!stat){
356 log << MSG::ERROR <<"Problem getting c-quarks" << endreq;
357 return stat;
358 }
359 stat = m_tesIO->getMC( mcParticles_tau, m_tauSelector ) ;
360 if(!stat){
361 log << MSG::ERROR <<"Problem getting taus" << endreq;
362 return stat;
363 }
364
365 for( src = my_Clusters.begin() ; src != my_Clusters.end() ; ++src ) {
366
367
368
369
370
371
372 if ( !IsAssociated<ReconstructedParticle>( *src ) ){
373
374 candidate = this->create( *src );
375
376
377
378 HepLorentzVector temp4Vec = candidate->momentum();
379
380
381 this->addMuons(candidate, my_Muons);
382
383
384
385
386 if( this->isAcceptable( candidate ) ) {
387
388
389 this->label(candidate,mcParticles_b,mcParticles_c,mcParticles_tau);
390
391 log << MSG::DEBUG << "Pushing back a Jet" << endreq;
392 myJets->push_back( candidate ) ;
393 log<<MSG::DEBUG<<"jet "<<*candidate<<endreq;
394 }else {
395 log << MSG::DEBUG << "Jet fails cuts" << endreq;
396
397 missingMomentum += temp4Vec;
398 m_sumET += temp4Vec.perp();
399 delete candidate;
400 }
401 }else{
402 log << MSG::DEBUG << "Cluster is associated, so ignored" << endreq;
403 }
404 }
405
406 log<<MSG::DEBUG<<"Missing momentum: clusters "<<missingMomentum<<endreq;
407 missingMomentum += addCells(log);
408 log << MSG::DEBUG << "sumET after adding cells: " << m_sumET << endreq;
409 log<<MSG::DEBUG<<"Missing momentum: cells+clstrs "
410 <<missingMomentum<<endreq;
411
412
413
414
415
416 log<<MSG::DEBUG<<"Storing "<< myJets->size() <<" Jets"<<endreq;
417 stat = m_tesIO->store( myJets, m_outputLocation, true) ;
418 if(!stat){
419 log<<MSG::ERROR<<"Could not store jets"<<endreq;
420 return stat;
421 }
422
423
424 MissingMomentum* mm = new MissingMomentum(missingMomentum,m_sumET);
425 stat = m_tesIO->store(mm,m_missingMomentumLocation ) ;
426 std::string message = stat? "Stored missing mom":"Failed to store missing mom";
427 log<<MSG::DEBUG<<message<<endreq;
428
429
430 return StatusCode::SUCCESS;
431 }
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446 Jet* JetMaker::create ( ICluster* src )
447 {
448 Jet* jet;
449 MsgStream log( messageService(), name() ) ;
450 HepLorentzVector vec = src->momentum();
451
452 if (m_doSmearing)
453 {
454
455 vec = m_smearer->smear(vec);
456 }
457
458 jet = new Jet(vec, *src);
459 log << MSG::DEBUG << "Unsmeared Cluster: " << *src << endreq;
460 log << MSG::DEBUG << "Smeared Jet : " << jet << endreq ;
461
462
463
464
465 return jet;
466
467
468 }
469
470
471
472
473
474
475 void JetMaker::addMuons(Jet* jet, MuonCollection& muons )
476 {
477
478 MsgStream log( messageService(), name() ) ;
479
480 if (muons.size() == 0) return;
481
482 MuonIterator first = muons.begin() ;
483 MuonIterator last = muons.end() ;
484
485
486
487 MuonIterator partitionLast =
488 partition(first,last,PartitionCondition::BelowThresholdDeltaR
489 (jet,m_rconeb,m_rconef,m_barrelForwardEta));
490
491 if (partitionLast == first){
492 log << MSG::DEBUG << "No muons in R cone" << endreq;
493 return;
494 }
495
496 log << MSG::DEBUG << "Adding " << partitionLast-first << " muons to Jet" << endreq;
497
498
499 for (MuonIterator muItr = first; muItr != partitionLast;++muItr) jet->addMuon(*muItr);
500
501
502 muons.erase(first,partitionLast);
503
504 }
505
506
507
508
509
510
511
512
513
514 bool JetMaker::isAcceptable ( Jet* candidate)
515 {
516
517 MsgStream log( messageService(), name() ) ;
518
519
520
521 if( candidate->pT() < m_minPT ) {
522 log << MSG::DEBUG << "Candidate failed pt cut: pt " << candidate->pT()
523 << " min was " << m_minPT << endreq;
524 return false ;
525 }
526
527 if( abs(candidate->eta()) > m_maxEta ) {
528 log << MSG::DEBUG << "Candidate failed max eta cut: eta "
529 << candidate->eta()
530 << " max was " << m_maxEta << endreq;
531 return false ;
532 }
533
534 return true ;
535 }
536
537
538
539
540
541
542 void JetMaker::label(Jet* jet,
543 MCparticleCollection& mcParticles_b,
544 MCparticleCollection& mcParticles_c,
545 MCparticleCollection& mcParticles_tau)const {
546
547 MsgStream log( messageService(), name() ) ;
548
549 double dR = 0.;
550
551
552
553
554
555 int bLabel = getJetLabel(mcParticles_b, jet, m_bMaxDeltaR, dR);
556 jet->setdRbquark(dR);
557 int cLabel = getJetLabel(mcParticles_c, jet, m_cMaxDeltaR, dR);
558 jet->setdRcquark(dR);
559 int tauLabel = getTauLabel( mcParticles_tau, jet, m_tauMaxDeltaR, dR);
560 jet->setdRhadtau(dR);
561
562
563 if(bLabel){
564 jet->setPdg_id(bLabel);
565 return;
566 }
567 if(cLabel){
568 jet->setPdg_id(cLabel);
569 return;
570 }
571 if(tauLabel){
572 jet->setPdg_id(tauLabel);
573 return;
574 }
575
576 jet->setPdg_id(0);
577 return;
578
579 }
580
581
582
583 int JetMaker::getJetLabel(MCparticleCollection& mcParticles,
584 Jet* jet,
585 double maxDeltaR,
586 double &deltaR) const {
587
588 MsgStream log( messageService(), name() ) ;
589
590 int pdgId = 0;
591 double drMin = 999.;
592
593
594 PartitionCondition::BelowThresholdDeltaR labelSelector(jet, maxDeltaR);
595 MCparticleCollectionCIter src ;
596 for( src = mcParticles.begin(); src != mcParticles.end(); ++src ){
597 SimpleKinematic sk(*src);
598 if(labelSelector(sk)){
599 pdgId = (*src)->pdg_id();
600 }
601 Phi dPhi( sk.phi() - jet->phi() );
602 double dR = sqrt((dPhi*dPhi) +
603 (sk.eta()-jet->eta())*(sk.eta()-jet->eta()));
604 if (dR < drMin) drMin = dR;
605 }
606 deltaR = drMin;
607 return pdgId;
608 }
609
610
611
612 int JetMaker::getTauLabel(MCparticleCollection& mcParticles,
613 Jet* jet,
614 double maxDeltaR,
615 double &deltaR) const {
616
617 MsgStream log( messageService(), name() ) ;
618
619 int pdgId = 0;
620 double drMin = 999.;
621
622
623 PartitionCondition::BelowThresholdDeltaR labelSelector(jet, maxDeltaR);
624 MCparticleCollectionCIter src ;
625 for( src = mcParticles.begin() ; src != mcParticles.end() ; ++src )
626 {
627 HepLorentzVector tauHlv((*src)->momentum().px(),(*src)->momentum().py()
628 ,(*src)->momentum().pz(),(*src)->momentum().e());
629 HepLorentzVector neuHlv;
630
631
632 HepMC::GenVertex* endVertex = (*src)->end_vertex();
633 if(!endVertex) continue;
634
635 HepMC::GenVertex::particle_iterator firstChild =
636 endVertex->particles_begin(HepMC::children);
637
638 HepMC::GenVertex::particle_iterator endChild =
639 endVertex->particles_end(HepMC::children);
640
641 HepMC::GenVertex::particle_iterator thisChild = firstChild;
642
643
644 for(; thisChild!=endChild; ++thisChild){
645 if( abs((*thisChild)->pdg_id()) == 16){
646 neuHlv.setPx((*thisChild)->momentum().px());
647 neuHlv.setPy((*thisChild)->momentum().py());
648 neuHlv.setPz((*thisChild)->momentum().pz());
649 neuHlv.setE((*thisChild)->momentum().e());
650 }
651 }
652 double sigma;
653 double sqrtene = sqrt(jet->momentum().e()/GeV);
654 if ( fabs(jet->eta()) < m_barrelForwardEta )
655 sigma = 0.5/sqrtene;
656 else
657 sigma = 1.0/sqrtene;
658
659 double cutQuantity = (m_tauJetPtRatio) ? m_tauJetPtRatio : 1.0 - 2*sigma;
660
661 log << MSG::DEBUG << "m_tauJetPtRatio = " << m_tauJetPtRatio
662 << ", cutQuantity = " << cutQuantity << endreq;
663
664 HepMC::GenParticle trueHadSystem;
665 trueHadSystem.set_momentum(tauHlv-neuHlv);
666 SimpleKinematic sk(trueHadSystem);
667 if (labelSelector(sk) &&
668 (tauHlv-neuHlv).perp()/jet->pT() >= cutQuantity){
669 Phi dPhi( sk.phi() - jet->phi() );
670 deltaR = sqrt((dPhi*dPhi) +
671 (sk.eta()-jet->eta())*(sk.eta()-jet->eta()));
672 pdgId = (*src)->pdg_id();
673 }
674 Phi dPhi( sk.phi() - jet->phi() );
675 double dR = sqrt((dPhi*dPhi) +
676 (sk.eta()-jet->eta())*(sk.eta()-jet->eta()));
677 if (dR < drMin) drMin = dR;
678 }
679
680 deltaR = drMin;
681 return pdgId;
682 }
683
684 HepLorentzVector JetMaker::addCells(MsgStream& log){
685
686 std::vector<const ITwoCptCell*> cellsToSmear(0);
687 std::vector<const ITwoCptCell*> newCellsVector(0);
688
689 getUnusedCells(cellsToSmear,log);
690
691 if (m_adjustMissETForIsolation){
692 getIsolationCorrectionCells(cellsToSmear,newCellsVector,m_isolatedElectronLocation,log);
693 getIsolationCorrectionCells(cellsToSmear,newCellsVector,m_isolatedPhotonLocation,log);
694 }
695
696 log << MSG::DEBUG << "Smearing a total of " << cellsToSmear.size() << " cells" << endreq;
697 log << MSG::DEBUG << "sumET before adding cells: " << m_sumET << endreq;
698
699
700
701 HepLorentzVector temp(0., 0., 0., 0.);
702 HepLorentzVector sum = std::accumulate(cellsToSmear.begin(),
703 cellsToSmear.end(),
704 temp,
705 SmearCell(m_cellSmearer,&m_sumET));
706
707
708 std::vector<const ITwoCptCell*>::iterator itccItr = newCellsVector.begin();
709 std::vector<const ITwoCptCell*>::iterator itccItrE = newCellsVector.end();
710
711 for (;itccItr!=itccItrE;++itccItr) delete *itccItr;
712 newCellsVector.clear();
713
714 return sum;
715 }
716
717 void JetMaker::getUnusedCells(std::vector<const ITwoCptCell*> &cellsToSmear, MsgStream& log){
718
719 std::vector<const TwoCptCell*> unusedCells(0);
720 if( !m_tesIO->copy<std::vector<const TwoCptCell*> >(unusedCells,
721 m_unusedCellLocation)){
722 log << MSG::INFO << "No unused cells in TES " << endreq;
723 return;
724 }
725
726 log << MSG::DEBUG << unusedCells.size() << " unused cells in TES" << endreq;
727
728 std::copy(unusedCells.begin(),unusedCells.end(),std::back_inserter(cellsToSmear));
729
730 log << MSG::DEBUG << "Added " << unusedCells.size() << " unused cells to cellToSmear" << endreq;
731
732 return;
733
734 }
735
736 void JetMaker::getIsolationCorrectionCells(std::vector<const ITwoCptCell*> &cellsToSmear,
737 std::vector<const ITwoCptCell*> &newcellsVector,
738 std::string tesAddress,
739 MsgStream& log){
740
741
742 std::vector<const ITwoCptCell*> isolationCorrectionCells(0);
743
744 const ReconstructedParticleCollection* dh(0);
745 if( !m_tesIO->getDH(dh, tesAddress) ) throw "Error in numberInList";
746
747 ReconstructedParticleCollection::const_iterator iter = dh->begin();
748
749 for (; iter != dh->end(); ++iter){
750
751 const HepMC::GenParticle* gp = (*iter)->truth();
752
753
754 const IAOO* iaooRP = (*iter);
755 TypeVisitor tv =
756 ContainerAssocsDispatcher( iaooRP->begin(), iaooRP->end(), TypeVisitor() );
757
758
759 std::vector<const TwoCptCell*> tccv = tv.typeVector(TwoCptCell());
760 log << MSG::DEBUG << "TypeVisitor found " << tccv.size()
761 << " TwoCptCells in this cluster" << endreq;
762
763 std::vector<const TwoCptCell*>::iterator tccvi;
764
765 for ( tccvi = tccv.begin(); tccvi != tccv.end();){
766 const ICell* ic = (*tccvi);
767
768
769
770 std::vector<const GenParticle*> gpv = ic->particles();
771 std::vector<const GenParticle*>::iterator gpi;
772 gpi = std::find(gpv.begin(),gpv.end(),gp);
773
774 if ( gpi == gpv.end() ) ++tccvi;
775 else{
776 log << MSG::DEBUG << "GenParticle found in this cell, one of "
777 << gpv.size() << " GenParticles" << endreq;
778 log << MSG::DEBUG << "GenParticle momentum = " << (*gpi)->momentum() << endreq;
779 log << MSG::DEBUG << "Cell momentum = " << ic->momentum() << endreq;
780
781 if ( gpv.size() > 1){
782
783 ITwoCptCell* newcell_itcc = (*tccvi)->cloneITCC();
784 newcell_itcc->resetCell();
785 ICell* newcell = newcell_itcc;
786 double newpT = ic->momentum().perp() - (*gpi)->momentum().perp();
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802 if( fabs(newpT) < 1e-10 ){ newcell->newHit( 0. ); }
803 else{
804 newcell->setPtSum( ic->momentum().perp() );
805 newcell->newHit( -1*((*gpi)->momentum().perp()) );
806 }
807
808
809 isolationCorrectionCells.push_back(newcell_itcc);
810 newcellsVector.push_back(newcell_itcc);
811 }
812
813
814 tccvi = tccv.erase(tccvi);
815
816 }
817 }
818
819 std::copy(tccv.begin(),tccv.end(),std::back_inserter(isolationCorrectionCells));
820 }
821
822 log << MSG::DEBUG << "Added " << isolationCorrectionCells.size()
823 << " isolation correction cells to cellsToSmear" << endreq;
824
825
826 std::copy(isolationCorrectionCells.begin(),
827 isolationCorrectionCells.end(),
828 std::back_inserter(cellsToSmear));
829
830 return;
831
832 }
833
834 }
835
| Due to the LXR bug, the updates fail sometimes to remove references to deleted files. The Saturday's full rebuilds fix these problems |
|
This page was automatically generated by the
LXR engine.
|
|