57 maxChi2_(iConfig.getParameter<double>(
"maxChi2")),
85 int id1=-1,
int id2=-1,
int id3=-1,
int id4=-1,
int id5=-1,
int id6=-1) ;
95 std::auto_ptr<edmNew::DetSetVector<T> >
117 using namespace reco;
121 int id1,
int id2,
int id3,
int id4,
int id5,
int id6)
123 if (iConfig.
exists(name)) {
126 fill(pblocks_, pblocks_+NumberOfParamBlocks, pblock);
128 pblocks_[id1] = pblock;
129 if (id2 != -1) pblocks_[id2] = pblock;
130 if (id3 != -1) pblocks_[id3] = pblock;
131 if (id4 != -1) pblocks_[id4] = pblock;
132 if (id5 != -1) pblocks_[id5] = pblock;
133 if (id6 != -1) pblocks_[id6] = pblock;
139 doTracks_(iConfig.exists(
"trajectories")),
140 doStrip_(iConfig.existsAs<bool>(
"doStrip") ? iConfig.getParameter<bool>(
"doStrip") :
true),
141 doPixel_(iConfig.existsAs<bool>(
"doPixel") ? iConfig.getParameter<bool>(
"doPixel") :
true),
142 mergeOld_(iConfig.exists(
"oldClusterRemovalInfo")),
143 clusterWasteSolution_(
true),
144 doStripChargeCheck_(iConfig.existsAs<bool>(
"doStripChargeCheck") ? iConfig.getParameter<bool>(
"doStripChargeCheck") :
false),
145 doPixelChargeCheck_(iConfig.existsAs<bool>(
"doPixelChargeCheck") ? iConfig.getParameter<bool>(
"doPixelChargeCheck") :
false),
146 stripRecHits_(doStripChargeCheck_ ? iConfig.getParameter<std::
string>(
"stripRecHits") : std::
string(
"siStripMatchedRecHits")),
147 pixelRecHits_(doPixelChargeCheck_ ? iConfig.getParameter<std::
string>(
"pixelRecHits") : std::
string(
"siPixelRecHits"))
149 if (iConfig.
exists(
"overrideTrkQuals"))
151 if (iConfig.
exists(
"clusterLessSolution"))
154 throw cms::Exception(
"Configuration Error") <<
"HITrackClusterRemover: Charge check asked without cluster collection ";
156 throw cms::Exception(
"Configuration Error") <<
"HITrackClusterRemover: Pixel cluster charge check not yet implemented";
170 readPSet(iConfig,
"Strip" ,2,3,4,5);
171 readPSet(iConfig,
"StripInner" ,2,3);
172 readPSet(iConfig,
"StripOuter" ,4,5);
179 bool usingCharge =
false;
181 if (!
pblocks_[
i].isSet_)
throw cms::Exception(
"Configuration Error") <<
"HITrackClusterRemover: Missing configuration for detector with subDetID = " << (
i+1);
182 if (
pblocks_[
i].usesCharge_ && !usingCharge) {
183 throw cms::Exception(
"Configuration Error") <<
"HITrackClusterRemover: Configuration for subDetID = " << (
i+1) <<
" uses cluster charge, which is not enabled.";
188 produces<edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster> > >();
189 produces<edm::ContainerMask<edmNew::DetSetVector<SiStripCluster> > >();
193 if (iConfig.
exists(
"TrackQuality")){
197 iConfig.
getParameter<
int>(
"minNumberOfLayersWithMeasBeforeFiltering") : 0;
225 for (
size_t i = 0,
n = refs.size();
i <
n; ++
i) {
226 refs[
i] = oldRefs[refs[
i]];
232 auto_ptr<edmNew::DetSetVector<T> >
238 auto_ptr<DSV>
output(
new DSV());
239 output->reserve(oldClusters.
size(), oldClusters.
dataSize());
241 unsigned int countOld=0;
242 unsigned int countNew=0;
245 const T * firstOffset = & oldClusters.
data().front();
246 for (
typename DSV::const_iterator itdet = oldClusters.
begin(), enddet = oldClusters.
end(); itdet != enddet; ++itdet) {
249 if (oldDS.empty())
continue;
251 uint32_t
id = oldDS.detId();
252 DSF outds(*output,
id);
254 for (
typename DS::const_iterator it = oldDS.begin(), ed = oldDS.end(); it != ed; ++it) {
255 uint32_t
index = ((&*it) - firstOffset);
258 outds.push_back(*it);
260 refs.push_back(index);
265 if (outds.empty()) outds.abort();
268 if (oldRefs != 0)
mergeOld(refs, *oldRefs);
287 "HITrackClusterRemover: strip cluster ref from Product ID = " << cluster.
id() <<
288 " does not match with source cluster collection (ID = " <<
stripSourceProdID <<
")\n.";
295 for( std::vector<uint8_t>::const_iterator iAmp = cluster->amplitudes().begin(); iAmp != cluster->amplitudes().end(); ++iAmp){
318 if (chi2 >
pblocks_[subdet-1].maxChi2_)
return;
328 "HITrackClusterRemover: pixel cluster ref from Product ID = " << cluster.
id() <<
329 " does not match with source cluster collection (ID = " <<
pixelSourceProdID <<
")\n.";
347 const type_info &hitType =
typeid(*hit);
364 }
else throw cms::Exception(
"NOT IMPLEMENTED") <<
"Don't know how to handle " << hitType.name() <<
" on detid " << detid.
rawId() <<
"\n";
382 ProductID pixelOldProdID, stripOldProdID;
401 auto_ptr<ClusterRemovalInfo> cri;
412 if ( (oldRemovalInfo->stripNewRefProd().
id() == stripClusters.
id()) &&
413 (oldRemovalInfo->pixelNewRefProd().
id() == pixelClusters.
id()) ) {
415 cri->getOldClustersFrom(*oldRemovalInfo);
417 pixelOldProdID = oldRemovalInfo->pixelRefProd().
id();
418 stripOldProdID = oldRemovalInfo->stripRefProd().
id();
424 throw cms::Exception(
"Inconsistent Data") <<
"HITrackClusterRemover: " <<
425 "Input collection product IDs are [pixel: " << pixelClusters.
id() <<
", strip: " << stripClusters.
id() <<
"] \n" <<
426 "\t but the *old* ClusterRemovalInfo " << labels.
productInstance <<
" refers as 'new product ids' to " <<
427 "[pixel: " << oldRemovalInfo->pixelNewRefProd().
id() <<
", strip: " << oldRemovalInfo->stripNewRefProd().
id() <<
"]\n" <<
428 "NOTA BENE: when running HITrackClusterRemover with an old ClusterRemovalInfo the hits in the trajectory MUST be already re-keyed.\n";
446 LogDebug(
"HITrackClusterRemover")<<
"to merge in, "<<oldStrMask->size()<<
" strp and "<<oldPxlMask->size()<<
" pxl";
461 std::vector<Handle<edm::ValueMap<int> > > quals;
469 for ( ; asst!=trajectories_totrack->end();++asst){
470 const Track & track = *(asst->val);
473 if ( quals.size()!=0) {
474 int qual=(*(quals[0]))[asst->val];
475 if ( qual < 0 ) {goodTk=
false;}
482 if ( !goodTk)
continue;
486 const vector<TrajectoryMeasurement> &tms = tj.
measurements();
487 vector<TrajectoryMeasurement>::const_iterator itm, endtm;
488 for (itm = tms.begin(), endtm = tms.end(); itm != endtm; ++itm) {
501 recHit = rphiRecHits->begin(); recHit!= rphiRecHits->end(); recHit++){
509 recHit = stereoRecHits->begin(); recHit!= stereoRecHits->end(); recHit++){
521 auto_ptr<edmNew::DetSetVector<SiPixelCluster> > newPixelClusters =
cleanup(*pixelClusters,
pixels,
522 cri->pixelIndices(),
mergeOld_ ? &oldRemovalInfo->pixelIndices() : 0);
525 cri->setNewPixelClusters(newPixels);
528 auto_ptr<edmNew::DetSetVector<SiStripCluster> > newStripClusters =
cleanup(*stripClusters,
strips,
529 cri->stripIndices(),
mergeOld_ ? &oldRemovalInfo->stripIndices() : 0);
532 cri->setNewStripClusters(newStrips);
549 std::auto_ptr<StripMaskContainer> removedStripClusterMask(
553 iEvent.
put( removedStripClusterMask );
555 std::auto_ptr<PixelMaskContainer> removedPixelClusterMask(
558 iEvent.
put( removedPixelClusterMask );
T getParameter(std::string const &) const
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const GeomDetEnumerators::SubDetector geomDetSubDetector(int subdet) const
const_iterator end(bool update=false) const
size_type dataSize() const
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
std::vector< edm::EDGetTokenT< edm::ValueMap< int > > > overrideTrkQuals_
float minGoodPixelCharge_
std::vector< data_type > DataContainer
friend struct const_iterator
bool getByToken(EDGetToken token, Handle< PROD > &result) const
TrackQuality
track quality
#define DEFINE_FWK_MODULE(type)
OmniClusterRef const & stereoClusterRef() const
HITrackClusterRemover(const edm::ParameterSet &iConfig)
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)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
std::vector< uint8_t > strips
static const unsigned int NumberOfParamBlocks
const char * productInstance
edm::EDGetTokenT< TrajTrackAssociationCollection > trajectories_
edm::ContainerMask< edmNew::DetSetVector< SiStripCluster > > StripMaskContainer
key_type key() const
Accessor for product key.
int trackerLayersWithMeasurement() const
ProductID id() const
Accessor for product ID.
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< reco::ClusterRemovalInfo > oldRemovalInfo_
std::string stripRecHits_
uint32_t rawId() const
get the raw id
DataContainer const & measurements() const
edm::EDGetTokenT< StripMaskContainer > oldStrMaskToken_
reco::TrackBase::TrackQuality trackQuality_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
ClusterStripRef cluster_strip() const
data_type const * data(size_t cell) const
int minNumberOfLayersWithMeasBeforeFiltering_
float minGoodStripCharge_
bool clusterWasteSolution_
OmniClusterRef const & monoClusterRef() const
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
std::vector< uint32_t > Indices
std::string pixelRecHits_
ParamBlock pblocks_[NumberOfParamBlocks]
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)
SiStripRecHit2D originalHit() const
Detector identifier class for the strip tracker.
OmniClusterRef const & omniClusterRef() const
edm::EDGetTokenT< PixelMaskContainer > oldPxlMaskToken_
static TrackQuality qualityByName(const std::string &name)
void mergeOld(reco::ClusterRemovalInfo::Indices &refs, const reco::ClusterRemovalInfo::Indices &oldRefs)
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > stripClusters_
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
ClusterRef cluster() const
T const * product() const
std::vector< bool > collectedStrips_
edm::EDGetTokenT< SiStripRecHit2DCollection > stereoRecHitToken_
edm::EDGetTokenT< SiStripRecHit2DCollection > rphiRecHitToken_
bool isTrackerPixel(const GeomDetEnumerators::SubDetector m)
bool quality(const TrackQuality) const
Track quality.
void labelsForToken(EDGetToken iToken, Labels &oLabels) const
edm::ContainerMask< edmNew::DetSetVector< SiPixelCluster > > PixelMaskContainer
std::vector< uint8_t > pixels
float sensorThickness(const SiStripDetId &detid) const
ParamBlock(const edm::ParameterSet &iConfig)
DetId geographicalId() const
volatile std::atomic< bool > shutdown_flag false
std::vector< bool > collectedPixels_
ModuleGeometry moduleGeometry() const
edm::ProductID stripSourceProdID
const_iterator begin(bool update=false) const
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClusters_
edm::ProductID pixelSourceProdID
void process(const TrackingRecHit *hit, float chi2, const TrackerGeometry *tg)