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") <<
"HLTTrackClusterRemover: Charge check asked without cluster collection ";
142 throw cms::Exception(
"Configuration Error") <<
"HLTTrackClusterRemover: 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") <<
"HLTTrackClusterRemover: Missing configuration for detector with subDetID = " << (
i+1);
164 if (
pblocks_[
i].usesCharge_ && !usingCharge) {
165 throw cms::Exception(
"Configuration Error") <<
"HLTTrackClusterRemover: Configuration for subDetID = " << (
i+1) <<
" uses cluster charge, which is not enabled.";
181 produces< edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster> > >();
182 produces< edm::ContainerMask<edm::LazyGetter<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 "HLTTrackClusterRemover: 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 "HLTTrackClusterRemover: 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);
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 for (std::vector<SiStripCluster>::const_iterator icluster = stripClusters->begin_record(), ecluster = stripClusters->end_record();
401 icluster!=ecluster; ++icluster, i++){
406 if (!
pblocks_[subdet-1].cutOnStripCharge_)
continue;
409 for (
auto cAmp : icluster->amplitudes() ) clusCharge+=cAmp;
412 if(clusCharge >
pblocks_[subdet-1].minGoodStripCharge_)
continue;
420 std::auto_ptr<StripMaskContainer> removedStripClusterMask(
424 iEvent.
put( removedStripClusterMask );
426 std::auto_ptr<PixelMaskContainer> removedPixelClusterMask(
429 iEvent.
put( removedPixelClusterMask );
T getParameter(std::string const &) const
float minGoodPixelCharge_
float minGoodStripCharge_
size_type dataSize() const
edm::ContainerMask< edmNew::DetSetVector< SiPixelCluster > > PixelMaskContainer
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
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)
std::vector< uint8_t > strips
bool exists(std::string const ¶meterName) const
checks if a parameter exists
edm::EDGetTokenT< PixelMaskContainer > oldPxlMaskToken_
std::vector< uint8_t > pixels
std::vector< bool > collectedRegStrips_
edm::ContainerMask< edm::LazyGetter< SiStripCluster > > StripMaskContainer
uint32_t rawId() const
get the raw id
DataContainer const & measurements() const
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
static const unsigned int 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
ParamBlock pblocks_[NumberOfParamBlocks]
void mergeOld(reco::ClusterRemovalInfo::Indices &refs, const reco::ClusterRemovalInfo::Indices &oldRefs)
ParamBlock(const edm::ParameterSet &iConfig)
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
std::vector< bool > collectedPixels_
edm::EDGetTokenT< edm::LazyGetter< SiStripCluster > > stripClusters_
HLTTrackClusterRemover(const edm::ParameterSet &iConfig)
edm::ProductID id() const
const_iterator end(bool update=true) const
edm::ProductID stripSourceProdID
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)
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClusters_
void process(const TrackingRecHit *hit, float chi2)
DetId geographicalId() const
volatile std::atomic< bool > shutdown_flag false
const_iterator begin(bool update=true) const
const SiStripRecHit2D & originalHit() const
edm::EDGetTokenT< StripMaskContainer > oldStrMaskToken_
~HLTTrackClusterRemover()
edm::ProductID pixelSourceProdID