48 maxChi2_(iConfig.getParameter<double>(
"maxChi2")),
74 int id1=-1,
int id2=-1,
int id3=-1,
int id4=-1,
int id5=-1,
int id6=-1) ;
83 std::auto_ptr<edmNew::DetSetVector<T> >
100 using namespace reco;
104 int id1,
int id2,
int id3,
int id4,
int id5,
int id6)
106 if (iConfig.
exists(name)) {
109 fill(pblocks_, pblocks_+NumberOfParamBlocks, pblock);
111 pblocks_[id1] = pblock;
112 if (id2 != -1) pblocks_[id2] = pblock;
113 if (id3 != -1) pblocks_[id3] = pblock;
114 if (id4 != -1) pblocks_[id4] = pblock;
115 if (id5 != -1) pblocks_[id5] = pblock;
116 if (id6 != -1) pblocks_[id6] = pblock;
122 : doTracks_(iConfig.exists(
"trajectories"))
123 , doStrip_ (iConfig.existsAs<bool>(
"doStrip") ? iConfig.getParameter<bool>(
"doStrip") :
true)
124 , doPixel_ (iConfig.existsAs<bool>(
"doPixel") ? iConfig.getParameter<bool>(
"doPixel") :
true)
126 , makeProducts_(
true)
127 , doStripChargeCheck_(iConfig.existsAs<bool>(
"doStripChargeCheck") ? iConfig.getParameter<bool>(
"doStripChargeCheck") :
false)
128 , doPixelChargeCheck_(iConfig.existsAs<bool>(
"doPixelChargeCheck") ? iConfig.getParameter<bool>(
"doPixelChargeCheck") :
false)
132 if (iConfig.
exists(
"oldClusterRemovalInfo"))
140 throw cms::Exception(
"Configuration Error") <<
"HLTTrackClusterRemoverNew: Charge check asked without cluster collection ";
142 throw cms::Exception(
"Configuration Error") <<
"HLTTrackClusterRemoverNew: Pixel cluster charge check not yet implemented";
152 readPSet(iConfig,
"Strip" , 2,3,4,5);
153 readPSet(iConfig,
"StripInner" ,2,3);
154 readPSet(iConfig,
"StripOuter" ,4,5);
161 bool usingCharge =
false;
163 if (!
pblocks_[
i].isSet_)
throw cms::Exception(
"Configuration Error") <<
"HLTTrackClusterRemoverNew: Missing configuration for detector with subDetID = " << (
i+1);
164 if (
pblocks_[
i].usesCharge_ && !usingCharge) {
165 throw cms::Exception(
"Configuration Error") <<
"HLTTrackClusterRemoverNew: Configuration for subDetID = " << (
i+1) <<
" uses cluster charge, which is not enabled.";
181 produces< edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster> > >();
182 produces< edm::ContainerMask<edmNew::DetSetVector<SiStripCluster> > >();
194 for (
size_t i = 0,
n = refs.size();
i <
n; ++
i) {
195 refs[
i] = oldRefs[refs[
i]];
201 auto_ptr<edmNew::DetSetVector<T> >
207 auto_ptr<DSV>
output(
new DSV());
208 output->reserve(oldClusters.
size(), oldClusters.
dataSize());
210 unsigned int countOld=0;
211 unsigned int countNew=0;
214 const T * firstOffset = & oldClusters.
data().front();
215 for (
typename DSV::const_iterator itdet = oldClusters.
begin(), enddet = oldClusters.
end(); itdet != enddet; ++itdet) {
218 if (oldDS.empty())
continue;
220 uint32_t
id = oldDS.detId();
221 DSF outds(*output,
id);
223 for (
typename DS::const_iterator it = oldDS.begin(), ed = oldDS.end(); it != ed; ++it) {
224 uint32_t
index = ((&*it) - firstOffset);
227 outds.push_back(*it);
229 refs.push_back(index);
234 if (outds.empty()) outds.abort();
238 if (oldRefs != 0)
mergeOld(refs, *oldRefs);
245 "HLTTrackClusterRemoverNew: strip cluster ref from Product ID = " << clusterReg.
id() <<
246 " does not match with source cluster collection (ID = " <<
stripSourceProdID <<
")\n.";
266 if (chi2 >
pblocks_[subdet-1].maxChi2_)
return;
274 SiPixelRecHit::ClusterRef cluster = pixelHit->cluster();
276 "HLTTrackClusterRemoverNew: pixel cluster ref from Product ID = " << cluster.id() <<
277 " does not match with source cluster collection (ID = " <<
pixelSourceProdID <<
")\n.";
291 const type_info &hitType =
typeid(*hit);
292 if (hitType ==
typeid(SiStripRecHit2D)) {
293 const SiStripRecHit2D *stripHit =
static_cast<const SiStripRecHit2D *
>(hit);
295 process(stripHit->omniClusterRef(),subdet);
299 }
else if (hitType ==
typeid(SiStripRecHit1D)) {
300 const SiStripRecHit1D *hit1D =
static_cast<const SiStripRecHit1D *
>(hit);
301 process(hit1D->omniClusterRef(),subdet);
305 }
else if (hitType ==
typeid(SiStripMatchedRecHit2D)) {
306 const SiStripMatchedRecHit2D *matchHit =
static_cast<const SiStripMatchedRecHit2D *
>(hit);
308 process(matchHit->monoClusterRef(), subdet);
313 process(matchHit->stereoClusterRef(),subdet);
318 }
else if (hitType ==
typeid(ProjectedSiStripRecHit2D)) {
319 const ProjectedSiStripRecHit2D *projHit =
static_cast<const ProjectedSiStripRecHit2D *
>(hit);
321 process(projHit->originalHit().omniClusterRef(),subdet);
325 }
else throw cms::Exception(
"NOT IMPLEMENTED") <<
"Don't know how to handle " << hitType.name() <<
" on detid " << detid.
rawId() <<
"\n";
343 ProductID pixelOldProdID, stripOldProdID;
366 LogDebug(
"TrackClusterRemover")<<
"to merge in, "<<oldStrMask->size()<<
" strp and "<<oldPxlMask->size()<<
" pxl";
379 for (std::vector<Trajectory>::const_iterator it = trajectories->begin(), ed = trajectories->end(); it != ed; ++it) {
381 const std::vector<TrajectoryMeasurement> &tms = tj.
measurements();
383 std::vector<TrajectoryMeasurement>::const_iterator itm, endtm;
384 for (itm = tms.begin(), endtm = tms.end(); itm != endtm; ++itm) {
389 process( hit, itm->estimate() );
400 auto const & clusters = stripClusters->data();
401 for (
auto const & item : stripClusters->ids()) {
403 if (!item.isValid())
continue;
407 if (!
pblocks_[subdet-1].cutOnStripCharge_)
continue;
411 for (
auto i = item.offset;
i<item.offset+
int(item.size); ++
i) {
413 for (
auto cAmp : clusters[
i].amplitudes() ) clusCharge+=cAmp;
424 std::auto_ptr<StripMaskContainer> removedStripClusterMask(
428 iEvent.
put( removedStripClusterMask );
430 std::auto_ptr<PixelMaskContainer> removedPixelClusterMask(
433 iEvent.
put( removedPixelClusterMask );
T getParameter(std::string const &) const
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > stripClusters_
const_iterator end(bool update=false) const
size_type dataSize() const
static const unsigned int NumberOfParamBlocks
std::auto_ptr< edmNew::DetSetVector< T > > cleanup(const edmNew::DetSetVector< T > &oldClusters, const std::vector< uint8_t > &isGood, reco::ClusterRemovalInfo::Indices &refs, const reco::ClusterRemovalInfo::Indices *oldRefs)
std::vector< bool > collectedPixels_
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClusters_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
std::vector< uint8_t > pixels
bool exists(std::string const ¶meterName) const
checks if a parameter exists
edm::EDGetTokenT< PixelMaskContainer > oldPxlMaskToken_
HLTTrackClusterRemoverNew(const edm::ParameterSet &iConfig)
edm::ContainerMask< edmNew::DetSetVector< SiStripCluster > > StripMaskContainer
uint32_t rawId() const
get the raw id
void readPSet(const edm::ParameterSet &iConfig, const std::string &name, int id1=-1, int id2=-1, int id3=-1, int id4=-1, int id5=-1, int id6=-1)
DataContainer const & measurements() const
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
ParamBlock pblocks_[NumberOfParamBlocks]
data_type const * data(size_t cell) const
edm::EDGetTokenT< std::vector< Trajectory > > trajectories_
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
std::vector< uint32_t > Indices
std::vector< bool > collectedRegStrips_
void mergeOld(reco::ClusterRemovalInfo::Indices &refs, const reco::ClusterRemovalInfo::Indices &oldRefs)
~HLTTrackClusterRemoverNew()
float minGoodStripCharge_
void process(const TrackingRecHit *hit, float chi2)
std::vector< uint8_t > strips
edm::ProductID stripSourceProdID
edm::ProductID id() const
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
ParamBlock(const edm::ParameterSet &iConfig)
DetId geographicalId() const
volatile std::atomic< bool > shutdown_flag false
edm::ContainerMask< edmNew::DetSetVector< SiPixelCluster > > PixelMaskContainer
edm::ProductID pixelSourceProdID
const_iterator begin(bool update=false) const
float minGoodPixelCharge_
edm::EDGetTokenT< StripMaskContainer > oldStrMaskToken_