45 maxChi2_(iConfig.getParameter<double>(
"maxChi2")),
62 int id1=-1,
int id2=-1,
int id3=-1,
int id4=-1,
int id5=-1,
int id6=-1) ;
72 std::auto_ptr<edmNew::DetSetVector<T> >
93 int id1,
int id2,
int id3,
int id4,
int id5,
int id6)
95 if (iConfig.
exists(name)) {
98 fill(pblocks_, pblocks_+NumberOfParamBlocks, pblock);
100 pblocks_[id1] = pblock;
101 if (id2 != -1) pblocks_[id2] = pblock;
102 if (id3 != -1) pblocks_[id3] = pblock;
103 if (id4 != -1) pblocks_[id4] = pblock;
104 if (id5 != -1) pblocks_[id5] = pblock;
105 if (id6 != -1) pblocks_[id6] = pblock;
111 trajectories_(iConfig.getParameter<
InputTag>(
"trajectories")),
112 doStrip_(iConfig.existsAs<bool>(
"doStrip") ? iConfig.getParameter<bool>(
"doStrip") :
true),
113 doPixel_(iConfig.existsAs<bool>(
"doPixel") ? iConfig.getParameter<bool>(
"doPixel") :
true),
114 stripClusters_(doStrip_ ? iConfig.getParameter<
InputTag>(
"stripClusters") :
InputTag(
"NONE")),
115 pixelClusters_(doPixel_ ? iConfig.getParameter<
InputTag>(
"pixelClusters") :
InputTag(
"NONE")),
116 mergeOld_(iConfig.exists(
"oldClusterRemovalInfo")),
117 oldRemovalInfo_(mergeOld_ ? iConfig.getParameter<
InputTag>(
"oldClusterRemovalInfo") :
InputTag(
"NONE")),
118 clusterWasteSolution_(
true)
120 if (iConfig.
exists(
"clusterLessSolution"))
134 readPSet(iConfig,
"Strip" ,2,3,4,5);
135 readPSet(iConfig,
"StripInner" ,2,3);
136 readPSet(iConfig,
"StripOuter" ,4,5);
143 bool usingCharge =
false;
145 if (!
pblocks_[
i].isSet_)
throw cms::Exception(
"Configuration Error") <<
"TrackClusterRemover: Missing configuration for detector with subDetID = " << (
i+1);
146 if (
pblocks_[
i].usesCharge_ && !usingCharge) {
147 throw cms::Exception(
"Configuration Error") <<
"TrackClusterRemover: Configuration for subDetID = " << (
i+1) <<
" uses cluster charge, which is not enabled.";
152 produces<edmNew::DetSetVector<SiPixelClusterRefNew> >();
153 produces<edmNew::DetSetVector<SiStripRecHit1D::ClusterRef> >();
157 if (iConfig.
exists(
"TrackQuality")){
172 for (
size_t i = 0,
n = refs.size();
i <
n; ++
i) {
173 refs[
i] = oldRefs[refs[
i]];
179 auto_ptr<edmNew::DetSetVector<T> >
185 auto_ptr<DSV>
output(
new DSV());
186 output->reserve(oldClusters.
size(), oldClusters.
dataSize());
188 unsigned int countOld=0;
189 unsigned int countNew=0;
192 const T * firstOffset = & oldClusters.
data().front();
193 for (
typename DSV::const_iterator itdet = oldClusters.
begin(), enddet = oldClusters.
end(); itdet != enddet; ++itdet) {
196 if (oldDS.empty())
continue;
198 uint32_t
id = oldDS.detId();
199 DSF outds(*output,
id);
201 for (
typename DS::const_iterator it = oldDS.begin(), ed = oldDS.end(); it != ed; ++it) {
202 uint32_t
index = ((&*it) - firstOffset);
205 outds.push_back(*it);
207 refs.push_back(index);
212 if (outds.empty()) outds.abort();
215 if (oldRefs != 0)
mergeOld(refs, *oldRefs);
223 "TrackClusterRemover: strip cluster ref from Product ID = " << cluster.
id() <<
224 " does not match with source cluster collection (ID = " <<
stripSourceProdID <<
")\n.";
236 "TrackClusterRemover: strip cluster ref from Product ID = " << cluster.
id() <<
237 " does not match with source cluster collection (ID = " <<
stripSourceProdID <<
")\n.";
257 if (chi2 >
pblocks_[subdet-1].maxChi2_)
return;
267 "TrackClusterRemover: pixel cluster ref from Product ID = " << cluster.
id() <<
268 " does not match with source cluster collection (ID = " <<
pixelSourceProdID <<
")\n.";
282 const type_info &hitType =
typeid(*hit);
299 }
else throw cms::Exception(
"NOT IMPLEMENTED") <<
"Don't know how to handle " << hitType.name() <<
" on detid " << detid.
rawId() <<
"\n";
317 ProductID pixelOldProdID, stripOldProdID;
333 auto_ptr<ClusterRemovalInfo> cri;
344 if ( (oldRemovalInfo->stripNewRefProd().
id() == stripClusters.
id()) &&
345 (oldRemovalInfo->pixelNewRefProd().
id() == pixelClusters.
id()) ) {
347 cri->getOldClustersFrom(*oldRemovalInfo);
349 pixelOldProdID = oldRemovalInfo->pixelRefProd().
id();
350 stripOldProdID = oldRemovalInfo->stripRefProd().
id();
353 throw cms::Exception(
"Inconsistent Data") <<
"TrackClusterRemover: " <<
354 "Input collection product IDs are [pixel: " << pixelClusters.
id() <<
", strip: " << stripClusters.
id() <<
"] \n" <<
355 "\t but the *old* ClusterRemovalInfo " <<
oldRemovalInfo_.
encode() <<
" refers as 'new product ids' to " <<
356 "[pixel: " << oldRemovalInfo->pixelNewRefProd().
id() <<
", strip: " << oldRemovalInfo->stripNewRefProd().
id() <<
"]\n" <<
357 "NOTA BENE: when running TrackClusterRemover with an old ClusterRemovalInfo the hits in the trajectory MUST be already re-keyed.\n";
375 for (;asst!=trajectories_totrack->end();++asst){
380 const vector<TrajectoryMeasurement> &tms = tj.
measurements();
381 vector<TrajectoryMeasurement>::const_iterator itm, endtm;
382 for (itm = tms.begin(), endtm = tms.end(); itm != endtm; ++itm) {
385 process( hit, itm->estimate() );
391 auto_ptr<edmNew::DetSetVector<SiPixelCluster> > newPixelClusters =
cleanup(*pixelClusters,
pixels,
392 cri->pixelIndices(),
mergeOld_ ? &oldRemovalInfo->pixelIndices() : 0);
395 cri->setNewPixelClusters(newPixels);
398 auto_ptr<edmNew::DetSetVector<SiStripCluster> > newStripClusters =
cleanup(*stripClusters,
strips,
399 cri->stripIndices(),
mergeOld_ ? &oldRemovalInfo->stripIndices() : 0);
402 cri->setNewStripClusters(newStrips);
424 LogDebug(
"TrackClusterRemover")<<
"to merge in, "<<oldStrRef->size()<<
" strp and "<<oldPxlRef->size()<<
" pxl";
429 uint32_t
id = itOld->detId();
433 for (
std::map<uint32_t, std::set< SiStripRecHit1D::ClusterRef > >::iterator itskiped=
collectedStrip.begin();
436 for (std::set< SiStripRecHit1D::ClusterRef >::iterator topush = itskiped->second.begin();
437 topush!=itskiped->second.end();++topush){
439 LogDebug(
"TrackClusterRemover")<<
"registering strp ref to be skip on: "<<itskiped->first<<
" key: "<<topush->key();
442 itskiped->second.clear();
444 LogDebug(
"TrackClusterRemover")<<
"total strip to skip: "<<removedStripClsuterRefs->size();
445 iEvent.
put( removedStripClsuterRefs );
449 uint32_t
id = itOld->detId();
454 for (
std::map<uint32_t, std::set< SiPixelRecHit::ClusterRef > >::iterator itskiped=
collectedPixel.begin();
457 for (std::set< SiPixelRecHit::ClusterRef >::iterator topush = itskiped->second.begin();
458 topush!=itskiped->second.end();++topush){
460 LogDebug(
"TrackClusterRemover")<<
"registering pxk ref to be skip on: "<<itskiped->first<<
" key: "<<topush->key();
463 itskiped->second.clear();
465 LogDebug(
"TrackClusterRemover")<<
"total pxl to skip: "<<removedPixelClsuterRefs->size();
466 iEvent.
put( removedPixelClsuterRefs );
T getParameter(std::string const &) const
void push_back(data_type const &d)
edm::InputTag stripClusters_
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const_iterator begin() const
size_type dataSize() const
static const unsigned int NumberOfParamBlocks
ParamBlock pblocks_[NumberOfParamBlocks]
edm::InputTag pixelClusters_
ParamBlock(const edm::ParameterSet &iConfig)
TrackQuality
track quality
const SiStripRecHit2D * stereoHit() const
#define DEFINE_FWK_MODULE(type)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
void process(const TrackingRecHit *hit, float chi2)
std::map< uint32_t, std::set< SiPixelRecHit::ClusterRef > > collectedPixel
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.
data_type const * data(size_t cell) const
std::vector< uint8_t > pixels
const_iterator end() 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_
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 const & cluster() const
key_type key() const
Accessor for product key.
std::map< uint32_t, std::set< SiStripRecHit1D::ClusterRef > > collectedStrip
bool quality(const TrackQuality) const
Track quality.
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup)
ClusterRef const & cluster() const
edm::ProductID pixelSourceProdID
ProductID id() const
Accessor for product ID.
DetId geographicalId() const
const SiStripRecHit2D * monoHit() const
ClusterRef const & cluster() const
const SiStripRecHit2D & originalHit() const
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)