47 maxChi2_(iConfig.getParameter<double>(
"maxChi2")),
65 int id1=-1,
int id2=-1,
int id3=-1,
int id4=-1,
int id5=-1,
int id6=-1) ;
75 std::auto_ptr<edmNew::DetSetVector<T> >
97 int id1,
int id2,
int id3,
int id4,
int id5,
int id6)
99 if (iConfig.
exists(name)) {
102 fill(pblocks_, pblocks_+NumberOfParamBlocks, pblock);
104 pblocks_[id1] = pblock;
105 if (id2 != -1) pblocks_[id2] = pblock;
106 if (id3 != -1) pblocks_[id3] = pblock;
107 if (id4 != -1) pblocks_[id4] = pblock;
108 if (id5 != -1) pblocks_[id5] = pblock;
109 if (id6 != -1) pblocks_[id6] = pblock;
115 trajectories_(iConfig.getParameter<
InputTag>(
"trajectories")),
116 doStrip_(iConfig.existsAs<bool>(
"doStrip") ? iConfig.getParameter<bool>(
"doStrip") :
true),
117 doPixel_(iConfig.existsAs<bool>(
"doPixel") ? iConfig.getParameter<bool>(
"doPixel") :
true),
118 stripClusters_(doStrip_ ? iConfig.getParameter<
InputTag>(
"stripClusters") :
InputTag(
"NONE")),
119 pixelClusters_(doPixel_ ? iConfig.getParameter<
InputTag>(
"pixelClusters") :
InputTag(
"NONE")),
120 mergeOld_(iConfig.exists(
"oldClusterRemovalInfo")),
121 oldRemovalInfo_(mergeOld_ ? iConfig.getParameter<
InputTag>(
"oldClusterRemovalInfo") :
InputTag(
"NONE")),
122 clusterWasteSolution_(
true)
124 if (iConfig.
exists(
"overrideTrkQuals"))
126 if (iConfig.
exists(
"clusterLessSolution"))
140 readPSet(iConfig,
"Strip" ,2,3,4,5);
141 readPSet(iConfig,
"StripInner" ,2,3);
142 readPSet(iConfig,
"StripOuter" ,4,5);
149 bool usingCharge =
false;
151 if (!
pblocks_[
i].isSet_)
throw cms::Exception(
"Configuration Error") <<
"TrackClusterRemover: Missing configuration for detector with subDetID = " << (
i+1);
152 if (
pblocks_[
i].usesCharge_ && !usingCharge) {
153 throw cms::Exception(
"Configuration Error") <<
"TrackClusterRemover: Configuration for subDetID = " << (
i+1) <<
" uses cluster charge, which is not enabled.";
158 produces<edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster> > >();
159 produces<edm::ContainerMask<edmNew::DetSetVector<SiStripCluster> > >();
163 if (iConfig.
exists(
"TrackQuality")){
167 iConfig.
getParameter<
int>(
"minNumberOfLayersWithMeasBeforeFiltering") : 0;
180 for (
size_t i = 0,
n = refs.size();
i <
n; ++
i) {
181 refs[
i] = oldRefs[refs[
i]];
187 auto_ptr<edmNew::DetSetVector<T> >
193 auto_ptr<DSV>
output(
new DSV());
194 output->reserve(oldClusters.
size(), oldClusters.
dataSize());
196 unsigned int countOld=0;
197 unsigned int countNew=0;
200 const T * firstOffset = & oldClusters.
data().front();
201 for (
typename DSV::const_iterator itdet = oldClusters.
begin(), enddet = oldClusters.
end(); itdet != enddet; ++itdet) {
204 if (oldDS.empty())
continue;
206 uint32_t
id = oldDS.detId();
207 DSF outds(*output,
id);
209 for (
typename DS::const_iterator it = oldDS.begin(), ed = oldDS.end(); it != ed; ++it) {
210 uint32_t
index = ((&*it) - firstOffset);
213 outds.push_back(*it);
215 refs.push_back(index);
220 if (outds.empty()) outds.abort();
223 if (oldRefs != 0)
mergeOld(refs, *oldRefs);
231 "TrackClusterRemover: strip cluster ref from Product ID = " << cluster.
id() <<
232 " does not match with source cluster collection (ID = " <<
stripSourceProdID <<
")\n.";
252 if (chi2 >
pblocks_[subdet-1].maxChi2_)
return;
262 "TrackClusterRemover: pixel cluster ref from Product ID = " << cluster.
id() <<
263 " does not match with source cluster collection (ID = " <<
pixelSourceProdID <<
")\n.";
281 const type_info &hitType =
typeid(*hit);
298 }
else throw cms::Exception(
"NOT IMPLEMENTED") <<
"Don't know how to handle " << hitType.name() <<
" on detid " << detid.
rawId() <<
"\n";
316 ProductID pixelOldProdID, stripOldProdID;
332 auto_ptr<ClusterRemovalInfo> cri;
343 if ( (oldRemovalInfo->stripNewRefProd().
id() == stripClusters.
id()) &&
344 (oldRemovalInfo->pixelNewRefProd().
id() == pixelClusters.
id()) ) {
346 cri->getOldClustersFrom(*oldRemovalInfo);
348 pixelOldProdID = oldRemovalInfo->pixelRefProd().
id();
349 stripOldProdID = oldRemovalInfo->stripRefProd().
id();
352 throw cms::Exception(
"Inconsistent Data") <<
"TrackClusterRemover: " <<
353 "Input collection product IDs are [pixel: " << pixelClusters.
id() <<
", strip: " << stripClusters.
id() <<
"] \n" <<
354 "\t but the *old* ClusterRemovalInfo " <<
oldRemovalInfo_.
encode() <<
" refers as 'new product ids' to " <<
355 "[pixel: " << oldRemovalInfo->pixelNewRefProd().
id() <<
", strip: " << oldRemovalInfo->stripNewRefProd().
id() <<
"]\n" <<
356 "NOTA BENE: when running TrackClusterRemover with an old ClusterRemovalInfo the hits in the trajectory MUST be already re-keyed.\n";
366 std::vector<Handle<edm::ValueMap<int> > > quals;
385 LogDebug(
"TrackClusterRemover")<<
"to merge in, "<<oldStrMask->size()<<
" strp and "<<oldPxlMask->size()<<
" pxl";
394 for ( ; asst!=trajectories_totrack->end();++asst){
398 if ( quals.size()!=0) {
399 int qual=(*(quals[0]))[asst->
val];
400 if ( qual < 0 ) {goodTk=
false;}
407 if ( !goodTk)
continue;
411 const vector<TrajectoryMeasurement> &tms = tj.
measurements();
412 vector<TrajectoryMeasurement>::const_iterator itm, endtm;
413 for (itm = tms.begin(), endtm = tms.end(); itm != endtm; ++itm) {
416 process( hit, itm->estimate() );
422 auto_ptr<edmNew::DetSetVector<SiPixelCluster> > newPixelClusters =
cleanup(*pixelClusters,
pixels,
423 cri->pixelIndices(),
mergeOld_ ? &oldRemovalInfo->pixelIndices() : 0);
426 cri->setNewPixelClusters(newPixels);
429 auto_ptr<edmNew::DetSetVector<SiStripCluster> > newStripClusters =
cleanup(*stripClusters,
strips,
430 cri->stripIndices(),
mergeOld_ ? &oldRemovalInfo->stripIndices() : 0);
433 cri->setNewStripClusters(newStrips);
450 std::auto_ptr<StripMaskContainer> removedStripClusterMask(
453 iEvent.
put( removedStripClusterMask );
455 std::auto_ptr<PixelMaskContainer> removedPixelClusterMask(
458 iEvent.
put( removedPixelClusterMask );
T getParameter(std::string const &) const
edm::InputTag stripClusters_
const_iterator begin() const
size_type dataSize() const
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
static const unsigned int NumberOfParamBlocks
ParamBlock pblocks_[NumberOfParamBlocks]
edm::InputTag pixelClusters_
ParamBlock(const edm::ParameterSet &iConfig)
TrackQuality
track quality
#define DEFINE_FWK_MODULE(type)
OmniClusterRef const & stereoClusterRef() const
bool exists(std::string const ¶meterName) const
checks if a parameter exists
void process(const TrackingRecHit *hit, float chi2)
reco::TrackBase::TrackQuality trackQuality_
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)
TrackClusterRemover(const edm::ParameterSet &iConfig)
edm::InputTag oldRemovalInfo_
uint32_t rawId() const
get the raw id
DataContainer const & measurements() const
edm::ProductID stripSourceProdID
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
int minNumberOfLayersWithMeasBeforeFiltering_
int trackerLayersWithMeasurement() const
ClusterStripRef cluster_strip() const
data_type const * data(size_t cell) const
std::vector< uint8_t > pixels
const_iterator end() const
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
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
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
bool clusterWasteSolution_
OmniClusterRef const & omniClusterRef() const
static TrackQuality qualityByName(const std::string &name)
edm::InputTag trajectories_
void mergeOld(reco::ClusterRemovalInfo::Indices &refs, const reco::ClusterRemovalInfo::Indices &oldRefs)
std::vector< uint8_t > strips
ClusterRef cluster() const
key_type key() const
Accessor for product key.
std::vector< bool > collectedStrips_
bool quality(const TrackQuality) const
Track quality.
std::vector< edm::InputTag > overrideTrkQuals_
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup)
edm::ProductID pixelSourceProdID
ProductID id() const
Accessor for product ID.
DetId geographicalId() const
const SiStripRecHit2D & originalHit() const
std::vector< bool > collectedPixels_
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)