@@ -40,13 +40,6 @@ UCTSummaryCard::UCTSummaryCard(const std::vector<std::vector<std::vector<uint32_
4040 }
4141}
4242
43- UCTSummaryCard::~UCTSummaryCard () {
44- for (uint32_t i = 0 ; i < regions.size (); i++) {
45- if (regions[i] != nullptr )
46- delete regions[i];
47- }
48- }
49-
5043bool UCTSummaryCard::process () {
5144 clearEvent ();
5245 UCTGeometry g;
@@ -126,10 +119,10 @@ bool UCTSummaryCard::process() {
126119 double mhtPhi = (atan2 (sumHy, sumHx) * 180 . / 3.1415927 ) + 180 .;
127120 int mhtIPhi = (int )(72 . * (mhtPhi / 360 .));
128121
129- ET = new UCTObject (UCTObject::ET, etValue, 0 , metIPhi, pileup, 0 , 0 );
130- HT = new UCTObject (UCTObject::HT, htValue, 0 , mhtIPhi, pileup, 0 , 0 );
131- MET = new UCTObject (UCTObject::MET, metValue, 0 , metIPhi, pileup, 0 , 0 );
132- MHT = new UCTObject (UCTObject::MHT, mhtValue, 0 , mhtIPhi, pileup, 0 , 0 );
122+ ET = std::make_shared< UCTObject> (UCTObject::ET, etValue, 0 , metIPhi, pileup, 0 , 0 );
123+ HT = std::make_shared< UCTObject> (UCTObject::HT, htValue, 0 , mhtIPhi, pileup, 0 , 0 );
124+ MET = std::make_shared< UCTObject> (UCTObject::MET, metValue, 0 , metIPhi, pileup, 0 , 0 );
125+ MHT = std::make_shared< UCTObject> (UCTObject::MHT, mhtValue, 0 , mhtIPhi, pileup, 0 , 0 );
133126
134127 // Then sort the candidates for output usage
135128 emObjs.sort ();
@@ -365,12 +358,16 @@ bool UCTSummaryCard::processRegion(UCTRegionIndex center) {
365358 if (centralET >= northET && centralET >= nwET && centralET >= westET && centralET >= swET && centralET > southET &&
366359 centralET > seET && centralET > eastET && centralET > neET && centralET > jetSeed) {
367360 if (centralRegion)
368- centralJetObjs.push_back (new UCTObject (UCTObject::jet, jetET, hitCaloEta, hitCaloPhi, pu3x3, 0 , et3x3));
361+ centralJetObjs.push_back (
362+ std::make_shared<UCTObject>(UCTObject::jet, jetET, hitCaloEta, hitCaloPhi, pu3x3, 0 , et3x3));
369363 else
370- forwardJetObjs.push_back (new UCTObject (UCTObject::jet, jetET, hitCaloEta, hitCaloPhi, pu3x3, 0 , et3x3));
364+ forwardJetObjs.push_back (
365+ std::make_shared<UCTObject>(UCTObject::jet, jetET, hitCaloEta, hitCaloPhi, pu3x3, 0 , et3x3));
371366 }
372367
373- auto boostedJet = new UCTObject (UCTObject::jet, jetET, hitCaloEta, hitCaloPhi, pu3x3, 0 , et3x3);
368+ // auto boostedJet = new UCTObject(UCTObject::jet, jetET, hitCaloEta, hitCaloPhi, pu3x3, 0, et3x3);
369+ std::shared_ptr<UCTObject> boostedJet =
370+ std::make_shared<UCTObject>(UCTObject::jet, jetET, hitCaloEta, hitCaloPhi, pu3x3, 0 , et3x3);
374371 boostedJet->setNTaus (nTauLike);
375372 boostedJet->setBoostedJetRegionET (boostedJetRegionET);
376373 boostedJet->setBoostedJetRegionTauVeto (boostedJetRegionTauVeto);
@@ -419,13 +416,15 @@ bool UCTSummaryCard::processRegion(UCTRegionIndex center) {
419416 }
420417 }
421418 if (tauET != 0 ) {
422- tauObjs.push_back (new UCTObject (UCTObject::tau, tauET, hitCaloEta, hitCaloPhi, tauPU, 0xDEADBEEF , et3x3));
419+ tauObjs.push_back (
420+ std::make_shared<UCTObject>(UCTObject::tau, tauET, hitCaloEta, hitCaloPhi, tauPU, 0xDEADBEEF , et3x3));
423421 // Subtract footprint
424422 uint32_t isolation = 0 ;
425423 if (et3x3 > tauET)
426424 isolation = et3x3 - tauET;
427425 if (isolation < ((uint32_t )(tauIsolationFactor * (double )tauET))) {
428- isoTauObjs.push_back (new UCTObject (UCTObject::isoTau, tauET, hitCaloEta, hitCaloPhi, pu3x3, isolation, et3x3));
426+ isoTauObjs.push_back (
427+ std::make_shared<UCTObject>(UCTObject::isoTau, tauET, hitCaloEta, hitCaloPhi, pu3x3, isolation, et3x3));
429428 }
430429 }
431430 }
@@ -474,13 +473,14 @@ bool UCTSummaryCard::processRegion(UCTRegionIndex center) {
474473 }
475474 }
476475 if (eGammaET != 0 ) {
477- emObjs.push_back (new UCTObject (UCTObject::eGamma, eGammaET, hitCaloEta, hitCaloPhi, eGammaPU, 0xDEADBEEF , et3x3));
476+ emObjs.push_back (std::make_shared<UCTObject>(
477+ UCTObject::eGamma, eGammaET, hitCaloEta, hitCaloPhi, eGammaPU, 0xDEADBEEF , et3x3));
478478 uint32_t isolation = 0 ;
479479 if (et3x3 > eGammaET)
480480 isolation = et3x3 - eGammaET;
481481 if (isolation < ((uint32_t )(eGammaIsolationFactor * (double )eGammaET))) {
482- isoEMObjs.push_back (
483- new UCTObject ( UCTObject::isoEGamma, eGammaET, hitCaloEta, hitCaloPhi, pu3x3, isolation, et3x3));
482+ isoEMObjs.push_back (std::make_shared<UCTObject>(
483+ UCTObject::isoEGamma, eGammaET, hitCaloEta, hitCaloPhi, pu3x3, isolation, et3x3));
484484 }
485485 }
486486 }
@@ -528,10 +528,10 @@ const UCTRegion* UCTSummaryCard::getRegion(int regionEtaIndex, uint32_t regionPh
528528 edm::LogError (" L1TCaloSummary" ) << " UCTSummaryCard: Incorrect region requested -- bailing" << std::endl;
529529 exit (1 );
530530 }
531- return regions[i];
531+ return & regions[i];
532532}
533533
534- bool UCTSummaryCard::setRegionData (std::vector<UCTRegion* > inputRegions) {
534+ bool UCTSummaryCard::setRegionData (std::vector<UCTRegion> inputRegions) {
535535 for (long unsigned int i = 0 ; i < inputRegions.size (); i++) {
536536 regions.push_back (inputRegions[i]);
537537 }
0 commit comments