Skip to content

Commit

Permalink
Merge pull request #28 from mark-grimes/for-75X-GEM-CSC-Trigger_smart…
Browse files Browse the repository at this point in the history
…Pointers

Change pointer array to an array of unique_ptrs
  • Loading branch information
Sven Dildick committed Jun 3, 2015
2 parents 12fd46e + 432fa24 commit 7307d73
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 26 deletions.
32 changes: 7 additions & 25 deletions L1Trigger/CSCTriggerPrimitives/src/CSCTriggerPrimitivesBuilder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ CSCTriggerPrimitivesBuilder::CSCTriggerPrimitivesBuilder(const edm::ParameterSet
// When the motherboard is instantiated, it instantiates ALCT
// and CLCT processors.
if (stat==1 && ring==1 && smartME1aME1b && !runME11ILT_)
tmb_[endc-1][stat-1][sect-1][subs-1][cham-1] = new CSCMotherboardME11(endc, stat, sect, subs, cham, conf);
tmb_[endc-1][stat-1][sect-1][subs-1][cham-1].reset( new CSCMotherboardME11(endc, stat, sect, subs, cham, conf) );
else if (stat==1 && ring==1 && smartME1aME1b && runME11ILT_)
tmb_[endc-1][stat-1][sect-1][subs-1][cham-1] = new CSCMotherboardME11GEM(endc, stat, sect, subs, cham, conf);
tmb_[endc-1][stat-1][sect-1][subs-1][cham-1].reset( new CSCMotherboardME11GEM(endc, stat, sect, subs, cham, conf) );
else if (stat==2 && ring==1 && runME21ILT_)
tmb_[endc-1][stat-1][sect-1][subs-1][cham-1] = new CSCMotherboardME21GEM(endc, stat, sect, subs, cham, conf);
tmb_[endc-1][stat-1][sect-1][subs-1][cham-1].reset( new CSCMotherboardME21GEM(endc, stat, sect, subs, cham, conf) );
else if ((stat==3 || stat==4) && ring==1 && runME3141ILT_)
tmb_[endc-1][stat-1][sect-1][subs-1][cham-1] = new CSCMotherboardME3141RPC(endc, stat, sect, subs, cham, conf);
tmb_[endc-1][stat-1][sect-1][subs-1][cham-1].reset( new CSCMotherboardME3141RPC(endc, stat, sect, subs, cham, conf) );
else
tmb_[endc-1][stat-1][sect-1][subs-1][cham-1] = new CSCMotherboard(endc, stat, sect, subs, cham, conf);
tmb_[endc-1][stat-1][sect-1][subs-1][cham-1].reset( new CSCMotherboard(endc, stat, sect, subs, cham, conf) );
}
}
}
Expand All @@ -119,23 +119,6 @@ CSCTriggerPrimitivesBuilder::CSCTriggerPrimitivesBuilder(const edm::ParameterSet
//------------
CSCTriggerPrimitivesBuilder::~CSCTriggerPrimitivesBuilder()
{
for (int endc = min_endcap; endc <= max_endcap; endc++)
{
for (int stat = min_station; stat <= max_station; stat++)
{
int numsubs = ((stat == 1) ? max_subsector : 1);
for (int sect = min_sector; sect <= max_sector; sect++)
{
for (int subs = min_subsector; subs <= numsubs; subs++)
{
for (int cham = min_chamber; cham <= max_chamber; cham++)
{
delete tmb_[endc-1][stat-1][sect-1][subs-1][cham-1];
}
}
}
}
}
}

//------------
Expand All @@ -157,8 +140,7 @@ void CSCTriggerPrimitivesBuilder::setConfigParameters(const CSCDBL1TPParameters*
{
for (int cham = min_chamber; cham <= max_chamber; cham++)
{
CSCMotherboard* tmb = tmb_[endc-1][stat-1][sect-1][subs-1][cham-1];
tmb->setConfigParameters(conf);
tmb_[endc-1][stat-1][sect-1][subs-1][cham-1]->setConfigParameters(conf);
}
}
}
Expand Down Expand Up @@ -207,7 +189,7 @@ void CSCTriggerPrimitivesBuilder::build(const CSCBadChambers* badChambers,

if (disableME42 && stat==4 && ring==2) continue;

CSCMotherboard* tmb = tmb_[endc-1][stat-1][sect-1][subs-1][cham-1];
CSCMotherboard* tmb = tmb_[endc-1][stat-1][sect-1][subs-1][cham-1].get();

// Run processors only if chamber exists in geometry.
if (tmb == 0 || theGeom->chamber(endc, stat, sect, subs, cham) == 0) continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class CSCTriggerPrimitivesBuilder
int m_minBX, m_maxBX; // min and max BX to sort.

/** Pointers to TMB processors for all possible chambers. */
CSCMotherboard*
std::unique_ptr<CSCMotherboard>
tmb_[MAX_ENDCAPS][MAX_STATIONS][MAX_SECTORS][MAX_SUBSECTORS][MAX_CHAMBERS];

const CSCGeometry* csc_g;
Expand Down

0 comments on commit 7307d73

Please sign in to comment.